@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;700;900&display=swap');

:root {
  --ink: #1f2933;
  --muted: #617282;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-2: #eef6f2;
  --line: #d7e1e7;
  --green: #26735d;
  --green-2: #1d5848;
  --green-light: #e8f5ef;
  --blue: #356d8f;
  --amber: #d89b25;
  --red: #c95046;
  --tile: #fffbef;
  --tile-line: #e6c25a;
  font-family: 'Cairo', Tahoma, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(53, 109, 143, 0.08), transparent 34%),
    linear-gradient(180deg, #fbfdfc, var(--bg));
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

/* ── Loading screen ────────────────────────────────────── */

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: grid;
  place-items: center;
  gap: 14px;
  font-size: 20px;
  font-weight: 800;
  color: var(--muted);
}

.loading-screen p {
  margin: 0;
}

.loading-spinner {
  width: 52px;
  height: 52px;
  border: 5px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Celebration overlay ───────────────────────────────── */

#celebration {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
  display: grid;
  place-items: center;
  font-size: 7rem;
  opacity: 0;
}

#celebration.burst {
  animation: celebrate 720ms ease-out forwards;
}

@keyframes celebrate {
  0%   { opacity: 0; transform: scale(0.3) rotate(-15deg); }
  25%  { opacity: 1; transform: scale(1.3) rotate(10deg); }
  60%  { opacity: 1; transform: scale(1.05) rotate(-3deg); }
  100% { opacity: 0; transform: scale(0.95) rotate(0deg); }
}

/* ── XP float ──────────────────────────────────────────── */

.xp-float {
  position: fixed;
  font-family: 'Cairo', Tahoma, sans-serif;
  font-weight: 900;
  font-size: 26px;
  color: var(--green);
  pointer-events: none;
  z-index: 9001;
  transform: translateX(-50%);
  text-shadow: 0 2px 8px rgba(38, 115, 93, 0.3);
  animation: xp-rise 950ms ease-out forwards;
}

@keyframes xp-rise {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-70px); }
}

/* ── Layout shell ──────────────────────────────────────── */

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.app-header,
.practice-head,
.practice-footer,
.panel-header,
.header-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  color: var(--green);
  font-weight: 900;
  margin: 0 0 4px;
  font-size: 15px;
  letter-spacing: 0.02em;
}

h1, h2, h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(42px, 8vw, 74px);
  line-height: 1;
}

h2 {
  font-size: clamp(22px, 4.5vw, 36px);
}

.select-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

select,
input,
textarea {
  min-height: 46px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  padding: 0 12px;
  transition: border-color 150ms;
}

select:focus,
input:focus,
textarea:focus {
  outline: none;
  border-color: var(--green);
}

textarea {
  min-height: 110px;
  padding: 12px;
  resize: vertical;
}

/* ── Buttons ───────────────────────────────────────────── */

.icon-button,
.secondary-button,
.primary-button,
.listen-button,
.mode-tab,
.choice {
  border-radius: 10px;
  cursor: pointer;
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 1.5px solid var(--line);
  background: white;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
  transition: background 150ms, border-color 150ms;
  flex-shrink: 0;
}

.icon-button:hover {
  background: var(--surface-2);
  border-color: var(--green);
}

.secondary-button {
  min-height: 52px;
  min-width: 110px;
  border: 1.5px solid var(--line);
  background: white;
  color: var(--ink);
  font-weight: 900;
  transition: background 150ms, border-color 150ms, transform 100ms;
}

.secondary-button:hover {
  background: #f5f8fa;
}

.primary-lite {
  background: var(--green-light);
  border-color: #b7ddcf;
  color: var(--green-2);
}

.primary-lite:hover {
  background: #d5ede6;
}

.primary-button {
  min-height: 52px;
  border: 0;
  background: var(--green);
  color: white;
  font-weight: 900;
  padding: 0 28px;
  transition: background 150ms, transform 100ms;
}

.primary-button:hover {
  background: var(--green-2);
}

/* ── Session pill ──────────────────────────────────────── */

.session-pill {
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1.5px solid #b7ddcf;
  border-radius: 10px;
  background: #eaf7f2;
  color: var(--green-2);
  padding: 0 14px;
  font-weight: 900;
}

/* ── Entry screen ──────────────────────────────────────── */

.entry-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.7fr);
  gap: 14px;
  margin-top: 22px;
}

.entry-card {
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 22px 60px rgba(31, 41, 51, 0.08);
  padding: clamp(18px, 4vw, 32px);
}

.parent-entry {
  align-content: start;
  display: grid;
  gap: 16px;
}

.parent-session-name {
  font-size: 18px;
  font-weight: 900;
  color: var(--ink);
  margin: 0;
}

.account-select-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.account-select-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: white;
  cursor: pointer;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  text-align: start;
  transition: border-color 120ms, box-shadow 120ms, transform 120ms;
}

.account-select-btn:hover {
  border-color: var(--green);
  box-shadow: 0 6px 20px rgba(38, 115, 93, 0.12);
  transform: translateY(-2px);
}

.session-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--green-light);
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 700;
  font-size: 15px;
  color: var(--green-2);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.security-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.6);
}

.security-card h4 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--ink);
}

.content-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.content-tabs {
  display: inline-flex;
  background: var(--green-light);
  border-radius: 999px;
  padding: 3px;
}

.content-tab {
  padding: 8px 18px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}

.content-tab.active {
  background: var(--green);
  color: white;
}

.content-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.content-filters select,
.content-filters input {
  padding: 8px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: white;
  font-family: inherit;
  font-size: 14px;
}

.content-list {
  display: grid;
  gap: 6px;
  max-height: 420px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.content-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 10px;
  background: white;
  border: 1px solid transparent;
  transition: background 120ms, border-color 120ms;
}

.content-row:hover {
  background: var(--green-light);
  border-color: rgba(38, 115, 93, 0.2);
}

.content-row-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}

.content-row-meta {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.content-delete-btn {
  padding: 4px 10px !important;
  font-size: 13px !important;
  min-height: auto !important;
}

.advanced-hidden {
  display: none !important;
}

.level-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  margin: 8px 0 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(38,115,93,0.10), rgba(38,115,93,0.04));
  border: 1.5px solid rgba(38,115,93,0.18);
  box-shadow: 0 6px 18px rgba(38,115,93,0.06);
}

.level-banner .level-emoji {
  font-size: 38px;
  line-height: 1;
}

.level-banner .level-meta {
  display: flex;
  flex-direction: column;
}

.level-banner .level-meta strong {
  font-size: 19px;
  color: var(--ink);
}

.level-banner .level-meta span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.hint-flash {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  font-size: clamp(40px, 10vw, 80px);
  font-weight: 900;
  color: white;
  text-shadow: 0 4px 24px rgba(0,0,0,0.4);
  letter-spacing: 4px;
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}

.hint-flash.show {
  opacity: 1;
}

.promotion-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 200ms ease;
}

.promotion-overlay.show {
  opacity: 1;
}

.promotion-card {
  background: white;
  border-radius: 24px;
  padding: 36px 32px;
  text-align: center;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 30px 80px rgba(0,0,0,0.3);
  animation: promo-pop 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes promo-pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.promotion-emoji {
  font-size: 72px;
  margin-bottom: 8px;
  animation: promo-bounce 800ms ease-in-out infinite alternate;
}

@keyframes promo-bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-10px); }
}

.promotion-card h2 {
  margin: 8px 0 4px;
  font-size: 28px;
  color: var(--green-2);
}

.promotion-card h3 {
  margin: 4px 0 12px;
  font-size: 24px;
  color: var(--ink);
}

.promotion-blurb {
  color: var(--muted);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 700;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 10px 0;
  font-weight: 700;
}

.toggle-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.parent-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: rgba(38, 115, 93, 0.12);
  border: 1px solid var(--green);
  color: var(--green-2);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.shake {
  animation: shake 0.4s ease-in-out;
  border-color: var(--red, #d04545) !important;
}

.child-login-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.login-child {
  min-height: 80px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  text-align: right;
  transition: border-color 150ms, background 150ms, transform 120ms;
}

.login-child:hover {
  transform: translateY(-2px);
  border-color: #aaced8;
}

.login-child.active {
  border-color: var(--green);
  background: var(--surface-2);
}

.child-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  font-size: 20px;
  flex-shrink: 0;
}

.login-child-info {
  display: grid;
  gap: 2px;
  text-align: right;
  min-width: 0;
}

.login-child-info span {
  font-weight: 900;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-child-info small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.child-login-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 10px;
  margin-top: 16px;
}

/* ── Onboarding entry steps ────────────────────────────── */

.entry-main-card {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.onboarding-form,
.add-child-form {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.onboard-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
}

.wide-button {
  width: 100%;
  min-height: 58px;
  font-size: 18px;
  border-radius: 14px;
}

.free-badge {
  display: inline-block;
  background: var(--green-light);
  color: var(--green-2);
  border: 1px solid #b7ddcf;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 14px;
  font-weight: 900;
  margin-top: 8px;
}

/* ── Onboarding wizard ─────────────────────────────────── */

.wizard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: start;
  animation: wiz-fade 240ms ease;
}

@keyframes wiz-fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.wizard h2 { margin: 2px 0 4px; }

.wizard-progress {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 14px;
}

.wizard-dot {
  flex: 1;
  display: grid;
  justify-items: center;
  gap: 5px;
  position: relative;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.wizard-dot::before {
  content: "";
  position: absolute;
  top: 13px;
  inset-inline-start: -50%;
  width: 100%;
  height: 2px;
  background: var(--line);
  z-index: 0;
}

.wizard-dot:first-child::before { display: none; }

.wizard-dot b {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: white;
  border: 2px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.wizard-dot.active b { border-color: var(--green); color: var(--green-2); box-shadow: 0 0 0 4px var(--green-light); }
.wizard-dot.active { color: var(--green-2); }
.wizard-dot.done b { background: var(--green); border-color: var(--green); color: white; }
.wizard-dot.done::before { background: var(--green); }

.wizard-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--green-light);
  margin: 6px 0 12px;
}

.wizard-avatar-row .child-avatar { width: 52px; height: 52px; font-size: 24px; }
.wizard-avatar-row strong { display: block; font-size: 17px; }
.wizard-avatar-row small { color: var(--muted); font-size: 13px; }

.wizard-fields { display: grid; gap: 14px; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.field textarea {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
  background: white;
  color: var(--ink);
}
.field textarea:focus { outline: none; border-color: var(--green); }

.wiz-chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.wiz-chip {
  border: 1.5px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 120ms, background 120ms, color 120ms;
}
.wiz-chip:hover { border-color: var(--green); color: var(--green-2); }
.wiz-chip.selected { background: var(--green); border-color: var(--green); color: white; }

.wiz-lang-row { display: flex; gap: 10px; }

.wiz-lang {
  flex: 1;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 12px 8px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: white;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition: border-color 120ms, box-shadow 120ms, transform 120ms;
}
.wiz-lang:hover { border-color: var(--green); transform: translateY(-2px); }
.wiz-lang b { font-size: 18px; font-weight: 900; }
.wiz-lang span { font-size: 12px; color: var(--muted); }
.wiz-lang.selected { border-color: var(--green); background: var(--green-light); box-shadow: 0 6px 18px rgba(38, 115, 93, 0.12); }
.wiz-lang.selected span { color: var(--green-2); }

.wiz-subhead {
  margin: 14px 0 2px;
  font-size: 14px;
  font-weight: 900;
  color: var(--green-2);
}

.wiz-cards { display: grid; gap: 12px; margin: 8px 0 4px; }

.wiz-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-align: start;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: white;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition: border-color 140ms, box-shadow 140ms, transform 140ms;
}
.wiz-card:hover { border-color: var(--green); transform: translateY(-2px); box-shadow: 0 10px 28px rgba(38, 115, 93, 0.1); }
.wiz-card.selected { border-color: var(--green); background: var(--green-light); box-shadow: 0 10px 28px rgba(38, 115, 93, 0.14); }
.wiz-card-emoji { font-size: 28px; line-height: 1.2; flex-shrink: 0; }
.wiz-card-body { display: grid; gap: 4px; }
.wiz-card-body strong { font-size: 16px; }
.wiz-card-body small { color: var(--muted); font-size: 13px; line-height: 1.6; }
.wiz-rec {
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
  color: var(--green-2);
  background: white;
  border: 1px solid #b7ddcf;
  border-radius: 6px;
  padding: 1px 7px;
  margin-inline-start: 4px;
}
.wiz-card.selected .wiz-rec { background: white; }

.wizard-actions { display: grid; gap: 10px; margin-top: 16px; }
.wizard-actions .secondary-button:last-child:not(.wide-button) { justify-self: center; border: 0; background: transparent; color: var(--muted); }

.wizard-nav {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}
.wizard-nav .secondary-button { flex: 0 0 auto; }
.wizard-nav .primary-button { flex: 1; min-height: 52px; font-size: 17px; }

.wizard-creating, .wizard-done {
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 24px 8px;
}
.wizard-creating .loading-spinner { width: 44px; height: 44px; }
.wizard-done-badge {
  font-size: 56px;
  animation: wiz-pop 420ms cubic-bezier(.2,1.3,.5,1);
}
@keyframes wiz-pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ── Child select (no passcode) ────────────────────────── */

.child-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.login-child-direct {
  min-height: 150px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  border-radius: 18px;
  border: 2px solid var(--line);
  padding: 22px 16px;
  background: white;
  cursor: pointer;
  font-weight: 900;
  color: var(--ink);
  transition: border-color 150ms, box-shadow 150ms, transform 150ms;
  display: flex;
  text-align: center;
}

.login-child-direct:hover {
  transform: translateY(-4px);
  border-color: var(--green);
  box-shadow: 0 14px 36px rgba(38, 115, 93, 0.15);
}

.login-child-direct .child-avatar {
  width: 64px;
  height: 64px;
  font-size: 28px;
}

.login-child-direct .login-child-info {
  text-align: center;
}

.login-child-direct .login-child-info span {
  font-size: 17px;
}

/* ── Haraka choices (letter exercise) ──────────────────── */

.choice.haraka-choice {
  min-width: 90px;
  font-size: clamp(26px, 5.5vw, 46px);
}

/* ── Mode tabs ─────────────────────────────────────────── */

.mode-tabs {
  display: flex;
  gap: 8px;
  margin: 20px 0 14px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.mode-tabs::-webkit-scrollbar {
  display: none;
}

.mode-tab {
  min-height: 66px;
  min-width: 88px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--muted);
  font-weight: 900;
  font-size: 15px;
  display: grid;
  place-items: center;
  gap: 2px;
  flex-shrink: 0;
  transition: all 150ms ease;
  padding: 8px 12px;
}

.mode-tab span {
  font-size: 19px;
  line-height: 1;
  display: block;
  opacity: 0.55;
}

.mode-tab.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.mode-tab.active span {
  opacity: 1;
}

.mode-tab:hover:not(.active) {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-light);
}

.mode-tab:hover:not(.active) span {
  opacity: 0.9;
}

/* ── Status grid ───────────────────────────────────────── */

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.status-grid article {
  min-height: 82px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  transition: transform 120ms;
}

.status-grid article:hover {
  transform: translateY(-1px);
}

.status-grid strong {
  font-size: 30px;
  color: var(--green-2);
  line-height: 1;
}

.status-grid span {
  color: var(--muted);
  font-weight: 800;
  font-size: 14px;
}

/* ── Daily progress bar ────────────────────────────────── */

.daily-bar-wrap {
  margin-bottom: 14px;
  padding: 10px 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: white;
}

.daily-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 800;
  font-size: 15px;
  color: var(--muted);
}

.daily-bar-track {
  height: 14px;
  border-radius: 7px;
  background: var(--line);
  overflow: hidden;
}

.daily-fill {
  height: 100%;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--green), #44c99a);
  transition: width 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 0%;
}

/* ── Practice card ─────────────────────────────────────── */

.practice {
  border: 2px solid #e4d9b8;
  border-radius: 20px;
  background: linear-gradient(165deg, #fffdf6 0%, #fff8e8 100%);
  box-shadow: 0 20px 60px rgba(120, 80, 20, 0.08);
  padding: clamp(18px, 4vw, 34px);
}

/* ── Listen button ─────────────────────────────────────── */

.listen-button {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 0;
  background: var(--green);
  color: white;
  font-size: 28px;
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 8px 28px rgba(38, 115, 93, 0.32);
  cursor: pointer;
  transition: background 150ms, transform 100ms, box-shadow 150ms;
}

.listen-button:hover {
  background: var(--green-2);
  transform: scale(1.05);
  box-shadow: 0 12px 32px rgba(38, 115, 93, 0.38);
}

.listen-button:active {
  transform: scale(0.97);
}

.listen-button::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 3px solid rgba(38, 115, 93, 0.45);
  animation: pulse-ring 2.5s ease-out infinite;
}

@keyframes pulse-ring {
  0%   { opacity: 0.7; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.55); }
}

/* ── Prompt area ───────────────────────────────────────── */

.prompt-area {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  font-size: clamp(34px, 8vw, 68px);
  font-weight: 900;
}

.skeleton-piece {
  min-width: 58px;
  min-height: 70px;
  display: grid;
  place-items: center;
  border-bottom: 4px solid var(--line);
}

.skeleton-piece.missing {
  color: var(--blue);
  border: 2px dashed var(--blue);
  border-radius: 10px;
}

/* ── Answer slots ──────────────────────────────────────── */

.answer-slots {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 8px;
}

.slot {
  min-width: 62px;
  min-height: 72px;
  padding: 4px 14px;
  display: grid;
  place-items: center;
  border: 2px dashed #c0d0d8;
  border-radius: 14px;
  background: #f5fafe;
  font-size: clamp(28px, 7vw, 52px);
  font-weight: 900;
}

.slot.filled {
  border-style: solid;
  border-color: var(--green);
  background: var(--surface-2);
  animation: slot-pop 230ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slot-pop {
  from { transform: scale(1.28); }
  to   { transform: scale(1); }
}

.slot.space-slot {
  min-width: 26px;
  border-color: transparent;
  background: transparent;
}

.slot.space-choice-slot,
.choice.space-choice {
  min-width: 150px;
  color: var(--blue);
  border-style: dashed;
  background: #eef7fb;
}

.slot.mistake-slot {
  border-color: var(--red);
  background: #fff0ee;
  color: var(--red);
  animation: slot-pop 230ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.open-answer-placeholder {
  min-height: 68px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: clamp(18px, 4vw, 26px);
  font-weight: 800;
  text-align: center;
}

/* ── Feedback ──────────────────────────────────────────── */

.feedback {
  min-height: 40px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  margin: 4px 0 14px;
  padding: 8px 18px;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  transition: background 200ms, color 200ms;
}

.feedback.ok {
  color: var(--green-2);
  background: #eaf7f2;
}

.feedback.bad {
  color: var(--red);
  background: #fff0ee;
}

/* ── Choice bank ───────────────────────────────────────── */

.choice-bank {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
  gap: 12px;
}

.special-choice-bank {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.choice {
  min-height: 78px;
  border: 2px solid var(--tile-line);
  border-radius: 14px;
  background: var(--tile);
  color: var(--ink);
  font-size: clamp(28px, 6vw, 52px);
  font-weight: 900;
  box-shadow: 0 6px 0 #c9a83a;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
  cursor: pointer;
}

.choice.word-choice {
  font-size: clamp(22px, 4vw, 34px);
  min-height: 66px;
}

.choice:hover,
.choice:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 9px 0 #c9a83a;
}

.choice:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #c9a83a;
}

.choice:disabled {
  opacity: 0.44;
  transform: translateY(4px);
  box-shadow: none;
}

.choice.wrong {
  animation: shake 220ms ease-in-out;
  background: #fff0ee;
  border-color: var(--red);
  box-shadow: 0 6px 0 #b04040;
}

.choice.correct {
  background: var(--surface-2);
  border-color: var(--green);
  box-shadow: 0 6px 0 #1d7a5f;
}

.choice.hint-highlight {
  border-color: var(--blue);
  background: #e8f3fb;
  animation: hint-pulse 500ms ease-in-out 2;
}

@keyframes hint-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 4px rgba(53, 109, 143, 0.25), 0 6px 0 #c9a83a; }
}

.choice.space-choice {
  min-height: 60px;
  font-size: clamp(20px, 4vw, 32px);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  30%  { transform: translateX(8px); }
  70%  { transform: translateX(-8px); }
}

/* ── Practice footer ───────────────────────────────────── */

.practice-footer {
  margin-top: 18px;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

/* ── Parent panel (full overlay) ───────────────────────── */

.parent-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  transition: background 280ms ease;
  display: flex;
  justify-content: flex-start;
}

.parent-panel.open {
  background: rgba(0, 0, 0, 0.46);
  pointer-events: auto;
}

.parent-panel-inner {
  width: min(600px, 100%);
  height: 100%;
  overflow-y: auto;
  background: white;
  box-shadow: -4px 0 48px rgba(0, 0, 0, 0.14);
  padding: clamp(16px, 4vw, 32px);
  transform: translateX(110%);
  transition: transform 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.parent-panel.open .parent-panel-inner {
  transform: translateX(0);
}

/* ── Dashboard ─────────────────────────────────────────── */

.pin-gate,
.ai-form,
.profile-form {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.profile-section {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fbfdfe;
  padding: 16px;
  margin-top: 18px;
}

.profile-status {
  color: var(--muted);
  font-weight: 800;
  margin: 10px 0 0;
}

.child-form {
  display: grid;
  grid-template-columns: 1fr 110px 160px 1.2fr;
  gap: 10px;
  margin-top: 16px;
}

.child-form textarea,
.child-form button {
  grid-column: 1 / -1;
}

.child-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.child-card {
  display: grid;
  gap: 8px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 14px;
  transition: border-color 150ms;
}

.child-card.active {
  border-color: #9fcfbd;
  background: #f1fbf7;
}

.child-card p {
  margin: 0;
  color: var(--ink);
}

.child-card span {
  color: var(--muted);
  font-weight: 700;
}

.child-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.child-metrics span {
  border-radius: 8px;
  background: #eef6f2;
  color: var(--green-2);
  padding: 5px 10px;
  font-size: 14px;
}

.child-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.child-card-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hint-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff3e0;
  color: #c75000;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

.hint-badge.none {
  background: #eef6f2;
  color: var(--green-2);
}

.activity-log {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.activity-log-list {
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 6px;
  padding-inline-end: 4px;
}

.activity-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 5px 8px;
  border-radius: 7px;
  background: #f7f9fb;
}

.activity-row.correct { background: #f1fbf7; }
.activity-row.wrong   { background: #fff3f3; }
.activity-row.hint    { background: #fff8ee; }

.activity-row .act-icon { font-size: 15px; flex-shrink: 0; }
.activity-row .act-text { flex: 1; color: var(--ink); }
.activity-row .act-type { color: var(--muted); font-size: 11px; }
.activity-row .act-context { display: block; font-weight: 700; }
.activity-row .act-detail { display: block; color: var(--muted); font-size: 12px; }

.goal-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.goal-row label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.goal-row input[type="number"] {
  width: 64px;
  padding: 4px 8px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  text-align: center;
}

.danger-button {
  background: white;
  border: 1.5px solid #e57373;
  color: #c62828;
  border-radius: 10px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}

.danger-button:hover {
  background: #ffebee;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.dashboard-grid article {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fbfdfe;
  padding: 14px;
  min-height: 180px;
}

.mastery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.mastery-cell {
  min-height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  font-size: 15px;
  transition: transform 150ms;
}

.mastery-cell:hover {
  transform: scale(1.15);
}

pre {
  white-space: pre-wrap;
  direction: ltr;
  text-align: left;
  max-height: 220px;
  overflow: auto;
  font-size: 13px;
  background: #f5f8fa;
  border-radius: 8px;
  padding: 10px;
  margin: 8px 0 0;
}

.ai-review-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.ai-card {
  display: grid;
  gap: 8px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 12px;
}

.ai-card span,
.ai-empty {
  color: var(--muted);
  font-weight: 700;
}

.approve-all-btn {
  width: 100%;
  margin-bottom: 4px;
}

/* ── Utility ───────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* ── Dark mode ─────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e2e9ef;
    --muted: #8fa3b4;
    --bg: #161d22;
    --surface: #1e272e;
    --surface-2: #1a2e28;
    --line: #2d3e4a;
    --green: #2d9970;
    --green-2: #44c99a;
    --green-light: #172e26;
    --blue: #4a8fb8;
    --tile: #2a2415;
    --tile-line: #6b5320;
  }

  body {
    background: linear-gradient(135deg, rgba(45, 153, 112, 0.07), transparent 34%), var(--bg);
  }

  .practice {
    background: linear-gradient(165deg, #201c10 0%, #231e0e 100%);
    border-color: #4a3e22;
  }

  .entry-card {
    background: var(--surface);
    border-color: var(--line);
  }

  .loading-screen {
    background: var(--bg);
  }

  .daily-bar-wrap,
  .status-grid article,
  .login-child,
  .mode-tab,
  .secondary-button,
  .icon-button,
  .choice,
  .slot,
  .child-card,
  .profile-section,
  .dashboard-grid article,
  .ai-card {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
  }

  .mode-tab.active {
    background: var(--green);
    border-color: var(--green);
    color: white;
  }

  .primary-lite {
    background: var(--green-light);
    border-color: #2a5040;
    color: var(--green-2);
  }

  select, input, textarea {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line);
  }

  pre {
    background: #1a2530;
  }

  .slot {
    background: #1a2530;
    border-color: #3a5060;
  }

  .choice {
    box-shadow: 0 6px 0 #5a4415;
  }

  .choice.correct {
    background: var(--surface-2);
  }

  .feedback.ok {
    background: #152820;
  }

  .feedback.bad {
    background: #2a1414;
  }
}

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 760px) {
  .shell {
    padding: 12px;
  }

  .app-header,
  .practice-head,
  .practice-footer,
  .header-actions,
  .pin-gate,
  .ai-form,
  .profile-form {
    align-items: stretch;
    flex-direction: column;
  }

  .practice-head {
    flex-direction: row;
  }

  .status-grid,
  .dashboard-grid,
  .entry-screen,
  .child-login-form,
  .child-form {
    grid-template-columns: 1fr;
  }

  .secondary-button,
  .primary-button,
  input,
  select,
  textarea {
    width: 100%;
  }

  .parent-panel-inner {
    width: 100%;
  }
}

/* ── Daily tracking dashboard ──────────────────────────── */

.daily-tracking {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.daily-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.daily-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.daily-card-head strong {
  font-size: 17px;
}

.today-chip {
  font-size: 13px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.today-chip.done {
  background: var(--green-light);
  color: var(--green-2);
  border-color: var(--green);
}

.today-chip.partial {
  background: #fdf3df;
  color: #8a6310;
  border-color: var(--amber);
}

.today-chip.none {
  background: #fbeae8;
  color: var(--red);
  border-color: var(--red);
}

.streak-chip {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-inline-start: auto;
}

.daily-chart {
  direction: ltr;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 86px;
  padding: 4px 2px 0;
  border-bottom: 1px solid var(--line);
}

.daily-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.daily-bar-col {
  width: 70%;
  max-width: 26px;
  border-radius: 4px 4px 0 0;
  transition: height 0.25s ease;
}

.daily-bar-col.good { background: var(--green); }
.daily-bar-col.mid { background: var(--amber); }
.daily-bar-col.low { background: var(--red); }
.daily-bar-col.empty { background: var(--line); }

.daily-col-label {
  font-size: 10px;
  color: var(--muted);
  line-height: 1;
}

.daily-summary {
  font-size: 13px;
  color: var(--muted);
}

/* ── Language badges & Latin practice ──────────────────── */

.lang-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 8px;
  border-radius: 999px;
  vertical-align: middle;
  letter-spacing: 0.4px;
}

.lang-badge.lang-ar { background: var(--green-light); color: var(--green-2); }
.lang-badge.lang-fr { background: #e7eefc; color: #2c4f9c; }
.lang-badge.lang-en { background: #f3e9fb; color: #6b3fa0; }

.latin-text {
  font-family: 'Cairo', 'Segoe UI', Arial, sans-serif;
  letter-spacing: 0.4px;
}

.prompt-area.latin-text,
.answer-slots.latin-text,
.choice-bank.latin-text {
  direction: ltr;
}

.choice-bank.latin-text .choice {
  text-transform: lowercase;
}

/* ── Inline selects & badges in forms ──────────────────── */

.select-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.select-inline select {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.free-badge-inline {
  font-size: 12px;
  font-weight: 800;
  background: var(--green-light);
  color: var(--green-2);
  border: 1px solid var(--green);
  border-radius: 999px;
  padding: 1px 10px;
  margin-inline-start: 8px;
  vertical-align: middle;
}

.login-child .lang-badge {
  margin-inline-start: auto;
}

/* ── Admin: subscriber management ──────────────────────── */

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-email {
  font-size: 13px;
  color: var(--muted);
  direction: ltr;
}

.admin-badge {
  font-size: 11px;
  font-weight: 800;
  background: #fdf3df;
  color: #8a6310;
  border: 1px solid var(--amber);
  border-radius: 999px;
  padding: 1px 10px;
  vertical-align: middle;
}

.plan-badge {
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 10px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.plan-badge.premium {
  background: #f3e9fb;
  color: #6b3fa0;
  border-color: #b08ad6;
}

.admin-usage-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 700;
}

.admin-week {
  color: var(--muted);
  font-weight: 600;
}

.usage-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}

.usage-fill {
  height: 100%;
  background: var(--green);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.usage-fill.warn { background: var(--amber); }
.usage-fill.full { background: var(--red); }
.usage-fill.premium { background: linear-gradient(90deg, #8e55b6, #3a8fd1); }

.admin-children {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-child-chip {
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ── Dashboard page (/dashboard) ───────────────────────── */

.dash-body {
  min-height: 100vh;
}

.dash-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.dash-header h1 {
  margin: 0;
  font-size: 24px;
}

.dash-header .eyebrow {
  margin: 0 0 2px;
}

.dash-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dash-actions a.secondary-button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.dash-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 18px 60px;
}

.dash-loading {
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 80px 0;
  font-weight: 800;
  color: var(--muted);
}

.pin-gate-page {
  display: grid;
  place-items: center;
  padding: 60px 0;
}

.pin-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.pin-card input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 20px;
  text-align: center;
  letter-spacing: 6px;
}

.dash-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}

.dash-tab {
  border: none;
  background: transparent;
  font-weight: 800;
  font-size: 15px;
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 12px 12px 0 0;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}

.dash-tab:hover {
  background: var(--surface-2);
}

.dash-tab.active {
  color: var(--green-2);
  border-bottom-color: var(--green);
  background: var(--surface);
}

.dash-tab-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dash-tab-panel .profile-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
}

.insight-select {
  max-width: 360px;
  margin-bottom: 12px;
}

.plan-badge.premium#plan-badge,
#plan-badge.premium {
  background: #f3e9fb;
  color: #6b3fa0;
  border-color: #b08ad6;
}

@media (max-width: 640px) {
  .dash-header {
    padding: 12px 14px;
  }
  .dash-shell {
    padding: 14px 10px 40px;
  }
  .dash-tab {
    font-size: 13px;
    padding: 8px 10px;
  }
}

/* ── Error taxonomy & adaptive UI ──────────────────────── */

.error-category-list {
  margin: 0;
  padding-inline-start: 18px;
  font-size: 14px;
  line-height: 1.9;
}

.error-category-list li {
  color: var(--ink);
}

.mode-badge {
  font-size: 11px;
  font-weight: 800;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 9px;
  margin-inline-start: 6px;
}

/* Stage step-down: calm, not celebratory */
.promotion-overlay.stage-down .promotion-card {
  border-top: 6px solid var(--blue);
}
.promotion-overlay.stage-down h2 {
  color: var(--blue);
}

/* Admin tools row */
.admin-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 0 8px;
}

/* Admin cost estimate */
.cost-total-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--green-light);
  border: 1px solid var(--green);
  border-radius: 14px;
  padding: 12px 16px;
}
.cost-total-banner strong { font-size: 15px; color: var(--green-2); }
.cost-total {
  font-size: 22px;
  font-weight: 900;
  color: var(--green-2);
  margin-inline-start: auto;
}
.cost-pill {
  font-size: 13px;
  font-weight: 800;
  color: var(--green-2);
  background: var(--green-light);
  border: 1px solid var(--green);
  border-radius: 999px;
  padding: 1px 10px;
}

/* ── Confusion drill banner ─────────────────────────────────────────────── */

.drill-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--tile);
  border: 1px dashed var(--tile-line);
  border-radius: 14px;
  padding: 10px 16px;
  margin: 12px 0;
}

.drill-banner.active {
  background: var(--green-light);
  border: 1px solid var(--green);
}

.drill-label {
  font-weight: 700;
}

.drill-start,
.drill-exit {
  border: none;
  border-radius: 999px;
  padding: 7px 16px;
  font-weight: 700;
  cursor: pointer;
}

.drill-start {
  background: var(--green);
  color: #fff;
}

.drill-start:hover {
  background: var(--green-2);
}

.drill-exit {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

/* ── Voice reward picker ────────────────────────────────────────────────── */

.voice-card {
  max-width: 420px;
  width: calc(100vw - 40px);
}

.voice-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.voice-option {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 10px;
  text-align: start;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.voice-option:hover:not(.locked):not(.selected) {
  border-color: var(--green);
}

.voice-option.selected {
  border-color: var(--green);
  background: var(--green-light);
}

.voice-option.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.voice-emoji {
  font-size: 26px;
}

.voice-name {
  font-weight: 700;
}

.voice-status {
  color: var(--muted);
}

/* ── Family leaderboard ─────────────────────────────────────────────────── */

.leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 40px auto 1fr;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
}

.leaderboard-row.leader {
  border-color: var(--amber);
  background: var(--tile);
}

.leaderboard-medal {
  font-size: 22px;
  text-align: center;
}

.leaderboard-detail {
  color: var(--muted);
  justify-self: end;
  font-size: 14px;
}

/* ── Weekly report ──────────────────────────────────────────────────────── */

.weekly-report {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.weekly-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
}

.weekly-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 6px 0;
  color: var(--muted);
  font-size: 14px;
}

.weekly-advice {
  margin: 4px 0 0;
  font-size: 14px;
}

/* ── Printable dictation worksheet ──────────────────────────────────────── */

.print-sheet {
  display: none;
}

@media print {
  body > *:not(#print-sheet) {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .print-sheet {
    display: block;
    color: #000;
    padding: 10mm;
    font-size: 14pt;
  }

  .ws-head h1 {
    margin: 0 0 4mm;
    font-size: 20pt;
  }

  .ws-head p {
    margin: 0 0 2mm;
  }

  .ws-howto {
    font-size: 11pt;
    color: #444;
  }

  .ws-rows {
    margin: 8mm 0;
  }

  .ws-row {
    display: flex;
    align-items: flex-end;
    gap: 6mm;
    margin-bottom: 9mm;
  }

  .ws-num {
    font-weight: 700;
    min-width: 10mm;
  }

  .ws-line {
    flex: 1;
    border-bottom: 1.5pt dotted #555;
    height: 9mm;
  }

  .ws-answers {
    page-break-inside: avoid;
    margin-top: 12mm;
  }

  .ws-cut {
    color: #777;
    font-size: 10pt;
    text-align: center;
  }

  .ws-answer-list {
    font-size: 13pt;
    line-height: 2;
    text-align: center;
  }

  .ws-answer-list.ws-latin {
    direction: ltr;
  }
}

/* ── School spelling list (واجب الأسبوع) ────────────────────────────────── */

.homework-banner {
  background: var(--green-light);
  border: 1px dashed var(--green);
}

.homework-banner.active {
  border-style: solid;
}

.homework-panel {
  margin: 8px 0;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.homework-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  margin: 8px 0;
  resize: vertical;
}

.hw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hw-chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 14px;
}

.hw-chip.done {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green-2);
  font-weight: 700;
}

/* ── Mistakes in context ────────────────────────────────────────────────── */

.mistake-context-list {
  padding-inline-start: 18px;
  margin: 0;
  display: grid;
  gap: 8px;
}

.mistake-context .mistake-word {
  display: block;
  font-size: 20px;
  font-weight: 700;
}

.confusion-item {
  margin-bottom: 10px;
}

.confusion-pair {
  font-weight: 700;
}

.confusion-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.confusion-example {
  background: var(--panel-2, rgba(38, 115, 93, 0.08));
  border: 1px solid rgba(38, 115, 93, 0.25);
  border-radius: 10px;
  padding: 2px 10px;
  font-size: 17px;
  font-weight: 700;
}

.mistake-letter {
  background: transparent;
  color: var(--red);
  font-weight: 900;
  text-decoration: underline dotted;
  text-underline-offset: 4px;
}

.mistake-context small {
  color: var(--muted);
  display: block;
}

/* ── Paper dictation (إملاء على الورقة) ─────────────────────────────────── */

.paper-banner {
  background: var(--surface-2);
  border-color: var(--blue);
}

body.paper-active .practice:not(.paper-session),
body.paper-active .mode-tabs,
body.paper-active #drill-banner,
body.paper-active #homework-banner {
  display: none !important;
}

.paper-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.paper-head h2 {
  margin: 4px 0 0;
}

.paper-intro {
  line-height: 1.9;
  color: var(--muted);
  max-width: 60ch;
}

.paper-label {
  font-weight: 700;
  margin: 18px 0 8px;
}

.paper-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.paper-chip {
  min-width: 64px;
  min-height: 52px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.3rem;
  font-weight: 900;
  cursor: pointer;
}

.paper-chip.active {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green);
}

.paper-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.paper-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 6px;
}

.paper-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--line);
}

.paper-dot.done {
  background: var(--green);
}

.paper-dot.current {
  background: var(--amber);
  transform: scale(1.3);
}

.paper-stage {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 28px 0 12px;
}

.paper-hint {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.paper-footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.paper-footer .primary-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.paper-list {
  list-style: none;
  counter-reset: paper;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 10px;
}

.paper-row {
  counter-increment: paper;
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.paper-row::before {
  content: counter(paper);
  font-weight: 900;
  color: var(--muted);
  font-size: 0.85rem;
}

.paper-row.right {
  border-color: var(--green);
}

.paper-row.wrong {
  border-color: var(--red);
}

.paper-text {
  margin: 0;
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  font-weight: 700;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.paper-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.paper-mark {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 6px 14px;
  cursor: pointer;
}

.paper-mark.right.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.paper-mark.wrong.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.paper-source {
  font-weight: 700;
  margin: 12px 0 0;
}

.paper-source.mastered {
  color: var(--green);
}

.paper-source.level {
  color: var(--muted);
}
