/* Nino — A1 Italian for Persian speakers
   Layout: single-column app shell (max 960px), sticky top bar, bottom tab bar on phones,
   RTL Persian UI with LTR Italian islands. */

:root {
  --bg: #F4F6FB;
  --surface: #FFFFFF;
  --surface-2: #EAEFF8;
  --fg: #152038;
  --muted: #5D6C88;
  --line: #D9E1EE;
  --primary: #1D5BC9;
  --primary-fg: #FFFFFF;
  --primary-soft: #E1EAFB;
  --accent: #F3B63C;
  --accent-fg: #2A2000;
  --accent-soft: #FFF1CF;
  --accent-soft-fg: #2A2000; /* text on --accent-soft; on a solid --accent use --accent-fg */
  --success: #1E9A62;
  --success-soft: #DBF4E7;
  --danger: #D8473A;
  --danger-soft: #FBE2DF;
  --shadow: 0 12px 32px rgba(21, 32, 56, .08);
  --shadow-sm: 0 2px 8px rgba(21, 32, 56, .06);
  --radius: 18px;
  --radius-sm: 12px;
  --font-fa: 'Vazirmatn', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --font-it: 'Nunito', 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --nav-h: 64px;
  --tab-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1425; --surface: #151E34; --surface-2: #1D2944; --fg: #EDF1F9; --muted: #9DAAC4; --line: #2A3754;
    --primary: #5E90F0; --primary-fg: #0A1222; --primary-soft: #1B2B4F;
    --accent: #F6C75B; --accent-fg: #2A2000; --accent-soft: #3B2F12; --accent-soft-fg: #F8DDA0;
    --success: #3DBE82; --success-soft: #153826; --danger: #F0705F; --danger-soft: #45201C;
    --shadow: 0 12px 32px rgba(0, 0, 0, .35); --shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1425; --surface: #151E34; --surface-2: #1D2944; --fg: #EDF1F9; --muted: #9DAAC4; --line: #2A3754;
  --primary: #5E90F0; --primary-fg: #0A1222; --primary-soft: #1B2B4F;
  --accent: #F6C75B; --accent-fg: #2A2000; --accent-soft: #3B2F12; --accent-soft-fg: #F8DDA0;
  --success: #3DBE82; --success-soft: #153826; --danger: #F0705F; --danger-soft: #45201C;
  --shadow: 0 12px 32px rgba(0, 0, 0, .35); --shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--fg);
  font-family: var(--font-fa); font-size: 16px; line-height: 1.7;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
html, body { overflow-x: hidden; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Italian islands */
.it, [dir="ltr"] { direction: ltr; font-family: var(--font-it); unicode-bidi: isolate; }
.it { font-weight: 700; }
.display { font-family: var(--font-display); font-weight: 600; direction: ltr; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- App shell ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 960px; margin: 0 auto; height: var(--nav-h);
  display: flex; align-items: center; gap: 12px; padding-inline: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); }
.brand-mark { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 11px; display: block; box-shadow: 0 2px 6px rgba(9, 73, 186, .25); }
.brand-name { font-family: var(--font-display); font-size: 22px; direction: ltr; letter-spacing: -.01em; }
.brand-name b { color: var(--primary); font-weight: 600; }
.brand-sub { display: block; font-family: var(--font-fa); font-size: 10px; line-height: 1; color: var(--muted); direction: rtl; margin-top: 2px; letter-spacing: 0; }
@media (max-width: 560px) { .brand-sub { display: none; } }
.topnav { display: none; gap: 4px; margin-inline-start: 8px; }
.topnav a { text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: 999px; font-weight: 500; }
.topnav a.active, .topnav a:hover { color: var(--fg); background: var(--surface-2); }
.topbar-spacer { flex: 1; }
.stat-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
  background: var(--surface-2); font-weight: 700; font-size: 14px; white-space: nowrap;
}
.stat-chip .ic { font-size: 16px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; color: var(--fg);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.wide { width: auto; padding-inline: 10px; gap: 6px; white-space: nowrap; font-size: 13px; font-weight: 700; }
@media (max-width: 560px) { .hide-sm { display: none; } .icon-btn.wide { padding-inline: 0; width: 40px; } }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: var(--primary-fg);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; border: none;
}
.session-chip { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-soft-fg); font-weight: 800; min-width: 72px; padding-inline: 10px; border-radius: 12px; height: 40px; border: 1px solid var(--accent); }

main { max-width: 960px; margin: 0 auto; padding-inline: 16px; padding-block: 20px calc(var(--tab-h) + 28px); }
@media (max-width: 560px) {
  .topbar-inner { gap: 8px; }
  .brand-name { font-size: 17px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
  .stat-chip { padding: 4px 8px; font-size: 13px; gap: 4px; }
  .stat-chip .ic { font-size: 14px; }
  #theme-btn { display: none; }
  .icon-btn, .avatar { width: 36px; height: 36px; }
  .stat-tile b { font-size: 22px; }
  .stat-tile { padding: 12px 8px; }
}
@media (min-width: 820px) {
  .topnav { display: flex; }
  main { padding-block: 28px 56px; }
  .tabbar { display: none !important; }
}

.tabbar {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px;
  text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600; min-height: var(--tab-h);
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--primary); }

/* ---------- Primitives ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; direction: ltr; font-family: var(--font-it); text-align: right; display: block; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.accent { background: var(--accent-soft); color: var(--accent-soft-fg); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 800; font-size: 16px; line-height: 1.2; text-decoration: none;
  background: var(--surface-2); color: var(--fg); transition: transform .08s ease, background .2s, box-shadow .2s;
  min-height: 46px;
}
.btn:hover { filter: brightness(.98); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-fg); box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn-accent { background: var(--accent); color: var(--accent-fg); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-lg { padding: 16px 28px; font-size: 18px; border-radius: 16px; }
.btn-sm { padding: 8px 14px; font-size: 14px; min-height: 36px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn svg { width: 20px; height: 20px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; font-size: 14px; }
.input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  min-height: 48px; transition: border-color .2s, box-shadow .2s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.input.it { font-weight: 600; }
.field .err { color: var(--danger); font-size: 13px; min-height: 18px; }
.help { font-size: 13px; color: var(--muted); }

.progress { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.progress.accent > i { background: var(--accent); }
.progress.success > i { background: var(--success); }

.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input { appearance: none; width: 46px; height: 26px; border-radius: 999px; background: var(--line); position: relative; transition: background .2s; margin: 0; flex: 0 0 auto; }
.toggle input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle input:checked { background: var(--primary); }
.toggle input:checked::after { transform: translateX(-20px); }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: none; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-sm); }

.toast-wrap { position: fixed; bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom, 0px)); inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; padding-inline: 16px; }
@media (min-width: 820px) { .toast-wrap { bottom: 24px; } }
.toast { background: var(--fg); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 700; box-shadow: var(--shadow); animation: toast-in .3s ease; max-width: 100%; }
.toast.ok { background: var(--success); color: #fff; }
.toast.warn { background: var(--accent); color: var(--accent-fg); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.page-head h1 { font-size: clamp(24px, 4vw, 32px); font-weight: 800; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.back svg { width: 18px; height: 18px; }

/* ---------- Home / hero ---------- */
.hero { position: relative; overflow: hidden; border-radius: 28px; padding: clamp(24px, 5vw, 48px); background: var(--primary); color: var(--primary-fg); isolation: isolate; }
.hero::before { content: ""; position: absolute; inset: -40% -20% auto auto; width: 60%; aspect-ratio: 1; border-radius: 50%; background: color-mix(in srgb, var(--accent) 80%, transparent); filter: blur(60px); opacity: .55; z-index: -1; }
.hero::after { content: ""; position: absolute; inset: auto auto -50% -10%; width: 55%; aspect-ratio: 1; border-radius: 50%; background: color-mix(in srgb, #fff 40%, transparent); filter: blur(70px); opacity: .35; z-index: -1; }
.hero .eyebrow { text-align: right; }
.hero .display { font-size: clamp(40px, 9vw, 84px); line-height: 1.05; letter-spacing: -.02em; text-align: right; }
.hero .display .blank { display: inline-block; min-width: 3.2ch; border-bottom: .07em solid var(--accent); color: var(--accent); line-height: .95; vertical-align: baseline; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.hero p { max-width: 36rem; opacity: .95; font-size: 17px; margin-top: 10px; }
.hero-form { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.hero-logo { position: absolute; inset-inline-end: auto; left: clamp(20px, 4vw, 44px); top: clamp(20px, 4vw, 44px); width: clamp(84px, 12vw, 136px); height: auto; border-radius: 22%; box-shadow: 0 14px 34px rgba(0,0,0,.25); }
@media (max-width: 640px) { .hero-logo { position: static; width: 96px; margin-bottom: 14px; display: block; margin-inline-start: auto; } }
.auth-logo { display: block; width: 88px; height: 88px; border-radius: 22%; margin: 0 auto 14px; box-shadow: 0 8px 22px rgba(9, 73, 186, .25); }
.hero-form .input { max-width: 260px; background: color-mix(in srgb, #fff 92%, transparent); color: #152038; border-color: transparent; }
.feature { display: flex; gap: 14px; align-items: flex-start; padding: 18px; }
.feature .ic { width: 44px; height: 44px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 22px; flex: 0 0 auto; }
.feature h3 { font-size: 16px; font-weight: 800; }
.feature p { font-size: 14px; color: var(--muted); }

.greeting { font-size: 14px; color: var(--muted); }
.home-title { font-size: clamp(26px, 5vw, 36px); font-weight: 800; }
.continue-card { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 20px; border-radius: 22px; background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #7C3AED)); color: var(--primary-fg); box-shadow: 0 14px 34px color-mix(in srgb, var(--primary) 40%, transparent); }
.continue-card .unit-emoji { font-size: 40px; }
.continue-card .btn { background: #fff; color: #152038; }
@media (max-width: 480px) { .continue-card { grid-template-columns: 1fr; } }
.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-tile { padding: 14px; text-align: center; }
.stat-tile b { display: block; font-size: 26px; font-weight: 800; line-height: 1.1; }
.stat-tile span { font-size: 12px; color: var(--muted); }
.unit-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.unit-dot { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); font-size: 20px; text-decoration: none; border: 2px solid transparent; }
.unit-dot.done { background: var(--success-soft); border-color: var(--success); }
.unit-dot.current { border-color: var(--primary); background: var(--primary-soft); }
.unit-dot.locked { opacity: .45; filter: grayscale(1); }
.phrase-card { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.phrase-card .it { font-size: 22px; }

/* ---------- Units map ---------- */
.unit-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.unit-card { display: flex; gap: 14px; padding: 18px; text-decoration: none; color: inherit; position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.unit-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.unit-card .emoji { width: 56px; height: 56px; border-radius: 16px; background: var(--primary-soft); display: grid; place-items: center; font-size: 28px; flex: 0 0 auto; }
.unit-card .num { font-size: 12px; color: var(--muted); font-weight: 700; direction: ltr; font-family: var(--font-it); text-align: right; }
.unit-card h3 { font-size: 17px; font-weight: 800; }
.unit-card .title-it { font-family: var(--font-it); direction: ltr; text-align: right; color: var(--muted); font-size: 14px; display: block; }
.unit-card .progress { margin-top: 8px; }
.unit-card.locked { opacity: .55; }
.unit-card.locked .emoji { background: var(--surface-2); filter: grayscale(1); }
.unit-card .lock { position: absolute; top: 12px; inset-inline-start: 12px; }
.unit-card.done .emoji { background: var(--success-soft); }

/* ---------- Unit page ---------- */
.unit-hero { display: flex; gap: 18px; align-items: center; padding: 22px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); }
.unit-hero .emoji { width: 72px; height: 72px; border-radius: 22px; background: var(--primary-soft); display: grid; place-items: center; font-size: 38px; flex: 0 0 auto; }
.unit-hero h1 { font-size: clamp(22px, 4vw, 30px); font-weight: 800; }
.unit-hero .title-it { font-family: var(--font-display); font-size: 20px; direction: ltr; text-align: right; color: var(--primary); display: block; }
.goals { display: grid; gap: 8px; }
.goal { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.goal .ic { color: var(--success); flex: 0 0 auto; margin-top: 3px; }
.goal .it { font-weight: 600; font-size: 13px; color: var(--muted); display: block; text-align: start; }
.section-list { display: grid; gap: 10px; }
.section-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-decoration: none; color: inherit; transition: transform .12s; }
.section-item:hover { transform: translateX(-3px); }
.section-item .num { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); font-weight: 800; flex: 0 0 auto; }
.section-item.done .num { background: var(--success-soft); color: var(--success); }
.section-item.next .num { background: var(--primary); color: var(--primary-fg); }
.section-item h3 { font-size: 16px; font-weight: 800; }
.section-item p { font-size: 13px; color: var(--muted); }
.section-item .chev { margin-inline-start: auto; color: var(--muted); }
.section-item .chev svg { width: 20px; height: 20px; }

.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h1 { font-size: 22px; font-weight: 800; }
.section-head .crumb { font-size: 13px; color: var(--muted); display: block; }
.section-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; flex-wrap: wrap; }

/* ---------- Scene player (motion graphics) ---------- */
.scene { overflow: hidden; }
.scene-title { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 14px 18px 0; }
.scene-title h3 { font-size: 16px; font-weight: 800; }
.scene-title .it { font-size: 14px; color: var(--muted); font-weight: 600; }
.stage-wrap { padding: 14px 18px 0; }
.stage {
  position: relative; width: 100%; aspect-ratio: 360 / 220; border-radius: 16px; overflow: hidden;
  container-type: inline-size; direction: ltr; border: 1px solid var(--line);
  background: var(--surface-2);
}
.stage.bg-sky { background: linear-gradient(180deg, #BEE3FF 0%, #E9F5FF 62%, #CDE8C3 62.5%, #B7DBA8 100%); }
.stage.bg-night { background: linear-gradient(180deg, #0B1838 0%, #1B2E5E 65%, #22314F 65.5%, #1A2740 100%); }
.stage.bg-street { background: linear-gradient(180deg, #DDEBFF 0%, #EEF4FF 58%, #C9CFD9 58.5%, #AEB5C2 100%); }
.stage.bg-room { background: linear-gradient(180deg, #FFF4E3 0%, #FFEBD0 62%, #D9B38C 62.5%, #C69A70 100%); }
.stage.bg-cafe { background: linear-gradient(180deg, #F6E7D3 0%, #F1DDC2 62%, #8E5B3A 62.5%, #74452A 100%); }
.stage.bg-plain { background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.stage.bg-street::before { content: ""; position: absolute; left: 0; right: 0; bottom: 42%; height: 26%;
  background:
    linear-gradient(#B9C6DF, #B9C6DF) 2% 100% / 14% 70% no-repeat,
    linear-gradient(#A8B6D2, #A8B6D2) 20% 100% / 10% 100% no-repeat,
    linear-gradient(#C4D0E6, #C4D0E6) 34% 100% / 18% 55% no-repeat,
    linear-gradient(#AFBDD8, #AFBDD8) 58% 100% / 12% 85% no-repeat,
    linear-gradient(#BFCBE3, #BFCBE3) 75% 100% / 16% 60% no-repeat,
    linear-gradient(#A3B1CD, #A3B1CD) 96% 100% / 10% 95% no-repeat; opacity: .8; }
.stage.bg-night::before { content: ""; position: absolute; inset: 0 0 35% 0; background-image: radial-gradient(#fff 1px, transparent 1.5px), radial-gradient(#fff 1px, transparent 1.5px); background-size: 60px 50px, 90px 70px; background-position: 10px 5px, 40px 30px; opacity: .6; }
.stage.bg-room::before { content: ""; position: absolute; left: 8%; top: 12%; width: 22%; aspect-ratio: 1; border: 2cqw solid #fff; background: linear-gradient(180deg, #9CD3FF, #DFF1FF); border-radius: 1cqw; opacity: .9; }

.el { position: absolute; transform: translate(-50%, -50%); transition: left 1s cubic-bezier(.2,.8,.2,1), top 1s cubic-bezier(.2,.8,.2,1), transform 1s cubic-bezier(.2,.8,.2,1), opacity .6s ease, color .6s ease, filter .6s ease; will-change: transform, opacity; }
.el-shape svg { width: 100%; height: auto; display: block; overflow: visible; }
.el-text { white-space: normal; max-width: 92cqw; text-align: center; font-family: var(--font-it); font-weight: 800; line-height: 1.1; text-shadow: 0 1px 0 rgba(255,255,255,.4); }
.el-text[dir="rtl"] { font-family: var(--font-fa); font-weight: 600; }
.el-bubble { background: #fff; color: #152038; border-radius: 3.5cqw; padding: 2.2cqw 3.6cqw; font-family: var(--font-it); font-weight: 800; white-space: normal; max-width: 46cqw; width: max-content; text-align: center; box-shadow: 0 1.5cqw 4cqw rgba(0,0,0,.14); line-height: 1.15; }
.el-bubble::after { content: ""; position: absolute; left: 50%; bottom: -2.4cqw; width: 3.4cqw; height: 3.4cqw; background: #fff; transform: translateX(-50%) rotate(45deg); border-radius: .5cqw; }
.el-chip { background: rgba(21, 32, 56, .88); color: #fff; border-radius: 999px; padding: 1.4cqw 3.4cqw; white-space: normal; max-width: 92cqw; width: max-content; text-align: center; font-weight: 700; line-height: 1.3; font-family: var(--font-fa); }
.el-arrow svg { width: 100%; height: auto; display: block; }
.el.glow { filter: drop-shadow(0 0 2.5cqw color-mix(in srgb, var(--accent) 90%, transparent)); }
.el .swap-text { transition: opacity .22s; }
.el.swapping .swap-text { opacity: 0; }

.scene-caption { padding: 14px 18px 4px; min-height: 86px; display: flex; flex-direction: column; gap: 4px; }
.scene-caption .cap-it { font-family: var(--font-it); font-weight: 800; font-size: 20px; direction: ltr; text-align: right; color: var(--primary); transition: opacity .25s; }
.scene-caption .cap-fa { font-size: 15px; color: var(--fg); transition: opacity .25s; }
.scene-caption.fade .cap-it, .scene-caption.fade .cap-tr, .scene-caption.fade .cap-fa { opacity: 0; }
.scene-controls { display: flex; align-items: center; gap: 8px; padding: 10px 18px 16px; flex-wrap: wrap; }
.scene-controls .dots { display: flex; gap: 6px; flex: 1; justify-content: center; direction: ltr; }
.scene-controls .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: all .25s; display: block; }
.scene-controls .dots i.on { background: var(--primary); width: 20px; border-radius: 4px; }
.scene-controls .dots i.seen { background: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.scene-done { margin: 0 18px 16px; padding: 12px 14px; border-radius: 12px; background: var(--success-soft); color: var(--success); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.scene-done svg { width: 20px; height: 20px; flex: 0 0 auto; }
/* inline icon sizing safety net */
.goal .ic svg, .section-item .num svg, .gpoint-head .chev svg, .section-item .chev svg { width: 20px; height: 20px; }
.badge svg { width: 14px; height: 14px; }

/* ---------- Conjugation / table widgets ---------- */
.conj { display: grid; gap: 6px; direction: ltr; }
.conj-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.conj-head .verb { font-family: var(--font-display); font-size: 28px; color: var(--primary); }
.conj-head .fa { font-family: var(--font-fa); direction: rtl; color: var(--muted); font-weight: 600; }
.conj-row { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr auto; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); font-family: var(--font-it); opacity: 0; transform: translateX(-10px); animation: row-in .5s cubic-bezier(.2,.8,.2,1) forwards; cursor: pointer; border: 1px solid transparent; }
.conj-row:hover { border-color: var(--primary); }
.conj-row .pr { color: var(--muted); font-weight: 600; }
.conj-row .form { font-weight: 800; font-size: 19px; }
.conj-row .stem { color: var(--primary); }
.conj-row .end { color: var(--accent-fg); background: var(--accent); border-radius: 6px; padding: 0 5px; display: inline-block; animation: pop .5s cubic-bezier(.2,.8,.2,1) both; }
.conj-row .spk { color: var(--muted); }
.conj-row .spk svg { width: 18px; height: 18px; }
@keyframes row-in { to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

.gtable { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; border-radius: 12px; border: 1px solid var(--line); font-size: 15px; }
.gtable th { background: var(--surface-2); padding: 10px 12px; text-align: center; font-weight: 800; }
.gtable td { padding: 10px 12px; border-top: 1px solid var(--line); text-align: center; font-family: var(--font-it); font-weight: 600; direction: ltr; }
.gtable td:first-child { font-weight: 800; color: var(--primary); }
.gtable tr { opacity: 0; animation: row-in .45s ease forwards; }
.gtable-wrap { overflow-x: auto; }
.gtable-cap { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* ---------- Vocabulary ---------- */
.vocab-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.vcard { padding: 16px; display: flex; flex-direction: column; gap: 6px; position: relative; transition: transform .15s, box-shadow .15s; }
.vcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.vcard .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vcard .emoji { font-size: 28px; }
.vcard .it { font-size: 20px; text-align: right; }
.vcard .pos { font-size: 11px; color: var(--muted); font-family: var(--font-it); direction: ltr; text-align: right; }
.vcard .fa { font-weight: 600; }
.vcard .fa.hidden-fa { filter: blur(6px); cursor: pointer; user-select: none; }
.vcard .fa.hidden-fa:hover { filter: blur(3px); }
.vcard .ex { font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 2px; }
.vcard .ex .it { font-size: 13px; font-weight: 600; display: block; }
.vcard .note { font-size: 12px; color: var(--accent-soft-fg); background: var(--accent-soft); border-radius: 8px; padding: 4px 8px; }
.spk-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; color: var(--primary); flex: 0 0 auto; }
.spk-btn:hover { background: var(--primary-soft); }
.spk-btn svg { width: 18px; height: 18px; }
.spk-btn.playing { background: var(--primary); color: var(--primary-fg); }

.flash { perspective: 1200px; }
.flash-card { position: relative; min-height: 260px; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.2,.8,.2,1); cursor: pointer; }
.flash-card.flipped { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; border-radius: var(--radius); }
.flash-face.back { transform: rotateY(180deg); background: var(--primary-soft); }
.flash-face .big { font-size: 34px; }
.flash-face .emoji { font-size: 48px; }
.flash-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }

/* ---------- Dialogue ---------- */
.dialogue-setting { padding: 14px 18px; background: var(--accent-soft); color: var(--accent-soft-fg); border-radius: 14px; font-size: 14px; }
.chat { display: flex; flex-direction: column; gap: 12px; direction: ltr; }
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 88%; }
.msg.right { align-self: flex-end; flex-direction: row-reverse; }
.msg .who { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 22px; flex: 0 0 auto; }
.msg .bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 10px 14px; box-shadow: var(--shadow-sm); transition: background .3s, border-color .3s; }
.msg.right .bubble { background: var(--primary-soft); border-color: transparent; }
.msg .bubble .name { font-size: 11px; color: var(--muted); font-family: var(--font-it); font-weight: 700; }
.msg .bubble .it { font-size: 17px; display: block; text-align: left; }
.msg .bubble .fa { direction: rtl; text-align: right; font-size: 14px; color: var(--muted); margin-top: 4px; display: block; }
.msg .bubble .fa.hidden-fa { filter: blur(6px); cursor: pointer; }
.msg.active .bubble { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-soft-fg); }
.msg .spk-btn { width: 32px; height: 32px; }

/* ---------- Grammar ---------- */
.gpoint { overflow: hidden; }
.gpoint-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; cursor: pointer; }
.gpoint-head .num { width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 800; flex: 0 0 auto; }
.gpoint-head h3 { font-size: 17px; font-weight: 800; }
.gpoint-head .it { font-size: 14px; color: var(--muted); display: block; text-align: right; }
.gpoint-head .chev { margin-inline-start: auto; transition: transform .3s; color: var(--muted); }
.gpoint.open .gpoint-head .chev { transform: rotate(180deg); }
.gpoint-body { display: none; padding: 0 18px 18px; gap: 16px; flex-direction: column; }
.gpoint.open .gpoint-body { display: flex; }
.explain p { margin-bottom: 10px; }
.explain p:last-child { margin-bottom: 0; }
.examples { display: grid; gap: 8px; }
.example { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.example .txt { flex: 1; min-width: 0; }
.example .it { display: block; text-align: right; font-size: 16px; }
.example .fa { display: block; font-size: 14px; color: var(--muted); }
.tip { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-soft-fg); font-size: 14px; }
.tip .ic { font-size: 18px; }

/* ---------- Exercises ---------- */
.ex-wrap { max-width: 680px; margin: 0 auto; }
.ex-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.ex-top .progress { flex: 1; }
.ex-top .count { font-weight: 800; font-size: 14px; color: var(--muted); white-space: nowrap; }
.ex-card { padding: 22px; animation: ex-in .35s cubic-bezier(.2,.8,.2,1); }
@keyframes ex-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ex-type { font-size: 12px; color: var(--muted); font-weight: 700; display: inline-flex; gap: 6px; align-items: center; margin-bottom: 10px; }
.ex-prompt { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.ex-prompt .it { display: block; font-size: 22px; text-align: right; margin-top: 6px; color: var(--primary); }
.ex-sentence { font-size: 24px; direction: ltr; text-align: center; font-family: var(--font-it); font-weight: 800; padding: 16px; background: var(--surface-2); border-radius: 14px; margin-bottom: 14px; line-height: 1.5; }
.ex-sentence .blank { display: inline-block; min-width: 3ch; border-bottom: 3px solid var(--primary); color: var(--primary); padding: 0 6px; }
.ex-sentence .blank.filled { border-bottom-color: transparent; background: var(--primary-soft); border-radius: 8px; }
.ex-trans { text-align: center; color: var(--muted); font-size: 14px; margin-top: -6px; margin-bottom: 14px; }
.options { display: grid; gap: 10px; }
.opt { text-align: start; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; font-size: 17px; transition: all .15s; display: flex; align-items: center; gap: 10px; }
.opt.it { direction: ltr; text-align: left; }
.opt:hover { border-color: var(--primary); }
.opt.selected { border-color: var(--primary); background: var(--primary-soft); }
.opt.correct { border-color: var(--success); background: var(--success-soft); }
.opt.wrong { border-color: var(--danger); background: var(--danger-soft); }
.opt .key { width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-size: 13px; color: var(--muted); flex: 0 0 auto; font-family: var(--font-it); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; direction: ltr; }
.chip { padding: 10px 16px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-family: var(--font-it); font-weight: 800; font-size: 17px; transition: all .15s; }
.chip:hover { border-color: var(--primary); transform: translateY(-1px); }
.chip.used { opacity: .3; pointer-events: none; }
.chip.selected { border-color: var(--primary); background: var(--primary-soft); }
.chip.correct { border-color: var(--success); background: var(--success-soft); }
.chip.wrong { border-color: var(--danger); background: var(--danger-soft); }
.builder { min-height: 64px; display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border-radius: 14px; border: 2px dashed var(--line); direction: ltr; margin-bottom: 14px; align-items: center; }
.builder:empty::before { content: attr(data-ph); color: var(--muted); font-size: 14px; font-family: var(--font-fa); direction: rtl; width: 100%; text-align: center; }
.builder .chip { border-style: solid; background: var(--primary-soft); border-color: var(--primary); }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-col { display: grid; gap: 10px; align-content: start; }
.mt { padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; font-size: 16px; min-height: 52px; transition: all .15s; text-align: center; }
.mt.it { direction: ltr; }
.mt.selected { border-color: var(--primary); background: var(--primary-soft); }
.mt.matched { border-color: var(--success); background: var(--success-soft); opacity: .7; pointer-events: none; }
.mt.wrong { border-color: var(--danger); background: var(--danger-soft); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.listen-btn { width: 96px; height: 96px; border-radius: 50%; background: var(--primary); color: var(--primary-fg); border: none; display: grid; place-items: center; margin: 6px auto 18px; box-shadow: 0 10px 28px color-mix(in srgb, var(--primary) 40%, transparent); transition: transform .15s; }
.listen-btn:hover { transform: scale(1.04); }
.listen-btn svg { width: 40px; height: 40px; }
.listen-btn.slow { width: 44px; height: 44px; margin: 0; box-shadow: none; background: var(--surface-2); color: var(--fg); }
.listen-btn.slow svg { width: 20px; height: 20px; }
.speak-box { text-align: center; }
.speak-box .say { font-size: 26px; display: block; text-align: center; margin-bottom: 6px; }
.speak-box .fa { color: var(--muted); }
.mic-btn { width: 84px; height: 84px; border-radius: 50%; border: none; background: var(--danger); color: #fff; display: grid; place-items: center; margin: 16px auto 8px; box-shadow: 0 10px 28px color-mix(in srgb, var(--danger) 40%, transparent); }
.mic-btn.rec { animation: pulse 1s infinite; }
.mic-btn svg { width: 36px; height: 36px; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.heard { font-family: var(--font-it); direction: ltr; font-weight: 700; padding: 10px 14px; background: var(--surface-2); border-radius: 12px; margin-top: 10px; min-height: 44px; }
.ex-actions { display: flex; gap: 10px; margin-top: 18px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.feedback { margin-top: 16px; padding: 14px 16px; border-radius: 14px; display: flex; gap: 12px; align-items: flex-start; animation: ex-in .3s ease; }
.feedback.ok { background: var(--success-soft); color: var(--success); }
.feedback.bad { background: var(--danger-soft); color: var(--danger); }
.feedback .ic { font-size: 24px; line-height: 1; }
.feedback b { display: block; margin-bottom: 2px; }
.feedback p { color: var(--fg); font-size: 14px; }
.feedback .ans { font-family: var(--font-it); direction: ltr; display: inline-block; font-weight: 800; color: var(--fg); }
.result-card { text-align: center; padding: 32px 22px; }
.result-card .score { font-size: 64px; font-weight: 800; line-height: 1; color: var(--primary); font-family: var(--font-it); }
.result-card h2 { font-size: 24px; font-weight: 800; margin-top: 10px; }
.result-card p { color: var(--muted); margin-top: 6px; }
.result-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

/* ---------- Levels / placement / reading ---------- */
.level-head { display: flex; align-items: center; gap: 12px; margin: 10px 0 12px; flex-wrap: wrap; }
.level-head .lvl { font-family: var(--font-display); font-size: 30px; color: var(--primary); direction: ltr; line-height: 1; }
.level-head h2 { font-size: 18px; font-weight: 800; }
.level-head .progress { flex: 1; min-width: 120px; max-width: 260px; }
.level-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-family: var(--font-it); direction: ltr; }
.placement-cta { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 18px 20px; border-radius: 22px; background: linear-gradient(135deg, var(--accent-soft), var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--line)); }
.placement-cta .big { font-size: 38px; line-height: 1; }
.placement-cta h3 { font-size: 17px; font-weight: 800; }
.placement-cta p { font-size: 14px; color: var(--muted); }
@media (max-width: 560px) { .placement-cta { grid-template-columns: 1fr; text-align: center; } .placement-cta .big { margin: 0 auto; } }
.pl-result { text-align: center; padding: 30px 22px; }
.pl-result .lvl { font-family: var(--font-display); font-size: 72px; line-height: 1; color: var(--primary); direction: ltr; }
.pl-result h2 { font-size: 24px; font-weight: 800; margin-top: 8px; }
.pl-result p { color: var(--muted); margin-top: 8px; max-width: 36rem; margin-inline: auto; }
.pl-scores { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pl-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; direction: ltr; }
@media (max-width: 560px) { .pl-grid { grid-template-columns: repeat(5, 1fr); } }
.pl-tile { aspect-ratio: 1; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--surface-2); border: 2px solid transparent; position: relative; }
.pl-tile small { position: absolute; bottom: 2px; right: 5px; font-size: 10px; font-weight: 800; color: var(--muted); font-family: var(--font-it); }
.pl-tile.ok { background: var(--success-soft); border-color: var(--success); }
.pl-tile.bad { background: var(--danger-soft); border-color: var(--danger); }
.pl-tile.half { background: var(--accent-soft); border-color: var(--accent); }
.pl-tile.na { opacity: .45; }
.ex-wrap.silent .opt.correct, .ex-wrap.silent .opt.wrong, .ex-wrap.silent .chip.correct, .ex-wrap.silent .chip.wrong { border-color: var(--primary) !important; background: var(--primary-soft) !important; }
.ex-wrap.silent .mt.wrong { animation: none; }
.reading-text { font-family: var(--font-it); direction: ltr; text-align: left; font-size: 18px; line-height: 1.8; font-weight: 500; }
.reading-text p { margin-bottom: 12px; }
.reading-text p:last-child { margin-bottom: 0; }
.reading-text.highlight p { background: var(--accent-soft); border-radius: 8px; padding: 2px 6px; }
.gloss { display: flex; flex-wrap: wrap; gap: 8px; }
.gloss button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-weight: 700; display: inline-flex; gap: 8px; align-items: center; }
.gloss button .it { font-size: 15px; }
.gloss button .fa { color: var(--muted); font-weight: 500; }
.gloss button .fa.hidden-fa { filter: blur(6px); }
.writing textarea.input { direction: ltr; font-family: var(--font-it); font-size: 17px; min-height: 150px; line-height: 1.6; font-weight: 500; }
.checklist { display: grid; gap: 6px; }
.checklist .ck { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.checklist .ck .box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line); display: grid; place-items: center; flex: 0 0 auto; }
.checklist .ck.on { color: var(--success); }
.checklist .ck.on .box { background: var(--success); border-color: var(--success); color: #fff; }
.checklist .ck .box svg { width: 14px; height: 14px; }
.model { background: var(--primary-soft); border-radius: 14px; padding: 14px 16px; }
.model .it { display: block; text-align: left; font-weight: 600; font-size: 16px; line-height: 1.7; }
.model .fa { display: block; color: var(--muted); font-size: 14px; margin-top: 8px; }
/* writing prompts and model answers keep their line breaks (tables, letters, paragraphs) */
.writing .tip .it, .model .it, .model .fa { white-space: pre-line; }

/* ---------- Review ---------- */
.due-pill { font-size: 40px; font-weight: 800; color: var(--primary); font-family: var(--font-it); }

/* ---------- Register ---------- */
.auth { max-width: 460px; margin: 0 auto; }
.auth .card { padding: 26px; }
.auth h1 { font-size: 26px; font-weight: 800; }
.auth .sub { color: var(--muted); margin: 6px 0 18px; }
.auth form { display: grid; gap: 14px; }
.user-pick { display: grid; gap: 8px; }
.user-pick button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-align: start; }
.user-pick button:hover { background: var(--surface-2); }

/* ---------- Profile ---------- */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: none; }
.setting .lbl b { display: block; font-weight: 700; }
.setting .lbl span { font-size: 13px; color: var(--muted); }
textarea.input { min-height: 120px; direction: ltr; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ---------- Guide ---------- */
.timeline { display: grid; gap: 10px; }
.tl { display: grid; grid-template-columns: 90px 1fr; gap: 12px; padding: 12px 14px; }
.tl .when { font-weight: 800; color: var(--primary); }
.prose p { margin-bottom: 10px; }
.prose ul { margin: 0 0 10px; padding-inline-start: 20px; }

/* ---------- Confetti canvas ---------- */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

/* ---------- Session overlay ---------- */
.session-done { position: fixed; inset: 0; z-index: 65; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; }
.session-done .card { max-width: 420px; text-align: center; padding: 30px; }
.session-done .big { font-size: 56px; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 48px; margin-bottom: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .conj-row, .gtable tr { opacity: 1; transform: none; }
}

/* ---------- Auth: password fields ---------- */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-inline-start: 46px; }
.pw-eye { position: absolute; top: 50%; inset-inline-start: 6px; transform: translateY(-50%); width: 36px; height: 36px; border: none; background: transparent; border-radius: 10px; font-size: 18px; opacity: .55; }
.pw-eye:hover, .pw-eye.on { opacity: 1; background: var(--surface-2); }
.pw-meter { height: 4px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.pw-meter i { display: block; height: 100%; width: 0; transition: width .25s, background .25s; }
.form-err { text-align: center; color: var(--danger); font-size: 14px; min-height: 18px; }
.linkish { border: none; background: none; color: var(--primary); text-decoration: underline; padding: 0; font: inherit; cursor: pointer; }

/* ---------- Feedback: footer link on every page + report form ---------- */
body:has(> .site-foot:not([hidden])) main { padding-bottom: 8px; }
.site-foot { max-width: 960px; margin: 0 auto; padding: 4px 16px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom, 0px)); }
.site-foot-inner { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 14px; padding-top: 18px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 14px; }
@media (min-width: 820px) { .site-foot { padding-bottom: 40px; } }
.fb-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fb-type { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 6px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; font-size: 15px; transition: border-color .15s, background .15s; }
.fb-type .ic { font-size: 26px; line-height: 1; }
.fb-type:hover { border-color: var(--primary); }
.fb-type[aria-checked="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.fb-type:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--primary-soft); }
.fb-form textarea.input { min-height: 150px; resize: vertical; line-height: 1.8; direction: rtl; unicode-bidi: plaintext; font-family: var(--font-fa); font-size: 16px; }
/* dark mode: accent badges had dark text on a dark background */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.accent { color: var(--accent); } }
:root[data-theme="dark"] .badge.accent { color: var(--accent); }
.fb-hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.fb-done { text-align: center; padding: 32px 20px; }
.fb-done .big { font-size: 52px; line-height: 1; }

/* ---------- Privacy: sign-up consent, policy page, acceptance banner ---------- */
.consent { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.7; cursor: pointer; font-weight: 500; }
.consent input { width: 20px; height: 20px; margin: 3px 0 0; flex: 0 0 auto; accent-color: var(--primary); }
.site-foot-link { color: var(--muted); font-size: 13px; }
.pv-toc { display: flex; flex-wrap: wrap; gap: 8px; }
.pv-chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.pv-chip:hover { color: var(--fg); border-color: var(--primary); }
.pv-body { line-height: 1.9; }
.pv-body[dir="ltr"] { font-family: var(--font-it); text-align: left; line-height: 1.7; }
.pv-intro { font-size: 15px; }
.pv-sec { scroll-margin-top: calc(var(--nav-h) + 12px); }
.pv-sec + .pv-sec { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 4px; }
.pv-sec h2 { font-size: 18px; font-weight: 800; margin: 14px 0 8px; }
.pv-sec h3 { font-size: 15px; font-weight: 800; margin: 14px 0 4px; }
.pv-sec li { margin-bottom: 6px; }
.pv-accept { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); background: var(--primary-soft); }
.pv-banner { background: var(--primary-soft); border-bottom: 1px solid color-mix(in srgb, var(--primary) 30%, var(--line)); }
.pv-banner-inner { max-width: 960px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; font-size: 14px; }

/* ---------- Courses: language switcher (top bar flag, menu, pills on home/units/landing) ---------- */
.course-btn { width: auto; padding: 0 10px; gap: 6px; font-weight: 700; font-size: 13px; }
.course-btn .flag { font-size: 18px; line-height: 1; }
.course-menu { position: fixed; z-index: 80; width: min(300px, calc(100vw - 16px)); max-height: calc(100vh - 80px); overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); animation: cm-in .18s ease both; }
@keyframes cm-in { from { opacity: 0; transform: translateY(-6px); } }
.course-menu .cm-head { font-size: 13px; font-weight: 800; color: var(--muted); padding: 6px 8px 2px; }
.course-menu .cm-foot { font-size: 12px; color: var(--muted); padding: 4px 8px 2px; }
.course-menu .cm-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; border: 1px solid transparent; background: none; font: inherit; color: var(--fg); text-align: right; cursor: pointer; }
.course-menu .cm-item:hover { background: var(--surface-2); }
.course-menu .cm-item.on { border-color: var(--primary); background: var(--primary-soft); }
.course-menu .cm-item .flag { font-size: 26px; }
.course-menu .cm-item span:not(.flag) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.course-menu .cm-item small { color: var(--muted); font-size: 12px; }
.course-menu .cm-item svg { width: 18px; height: 18px; color: var(--primary); }
.course-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.course-pills .cp { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--fg); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; transition: transform .15s, border-color .15s; }
.course-pills .cp:hover { transform: translateY(-1px); border-color: var(--primary); }
.course-pills .cp.on { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.course-pills .flag, .hero-courses .flag { font-size: 18px; line-height: 1; }
.hero-courses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; max-width: 560px; }
.hero-courses .hc { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border-radius: 16px; border: 1.5px solid rgba(255,255,255,.4); background: rgba(255,255,255,.12); color: inherit; font: inherit; cursor: pointer; transition: transform .2s, background .2s; }
.hero-courses .hc:hover { transform: translateY(-2px); background: rgba(255,255,255,.2); }
.hero-courses .hc.on { background: #fff; color: #152038; border-color: #fff; }
.hero-courses .hc .flag { font-size: 28px; }
.hero-courses .hc b { font-size: 15px; }
.hero-courses .hc small { font-size: 11.5px; opacity: .85; }
.topnav a { white-space: nowrap; }
.topbar-inner > .icon-btn, .topbar-inner > .avatar, .topbar-inner > .stat-chip, .topbar-inner > #session-chip { flex: 0 0 auto; }
@media (max-width: 1320px) { .course-btn .hide-sm { display: none; } }
/* Scenes are drawn for a light stage (dark text, dark outlines): keep the "plain" stage light in dark mode too. */
.stage.bg-plain { background: linear-gradient(180deg, #EAF0FA, #FFFFFF); }
.hero-courses { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); max-width: 640px; }

/* ==========================================================================
   UI refresh 2026-10-08: calm, minimal surfaces; line icons instead of emoji;
   new logo alone in the header; quieter phone header; install invite.
   ========================================================================== */
:root { --shadow-sm: 0 1px 2px rgba(21, 32, 56, .05); }
.topbar { background: color-mix(in srgb, var(--bg) 84%, transparent); border-bottom-color: color-mix(in srgb, var(--line) 70%, transparent); }
.brand-mark { width: 42px; height: 42px; border-radius: 0; box-shadow: none; }
.avatar { text-decoration: none; font-size: 15px; }
.stat-chip { background: transparent; padding: 6px 4px; gap: 4px; }
.stat-chip svg { width: 18px; height: 18px; flex: 0 0 auto; }
.stat-chip.streak svg, .st-ic.streak { color: #F06A2B; }
.stat-chip.xp svg, .st-ic.xp { color: #E9A50E; }
@media (max-width: 560px) { .brand-mark { width: 38px; height: 38px; } .topbar-inner { gap: 6px; } }

.btn { font-weight: 700; }
.btn-primary { box-shadow: none; }
.btn-primary:hover { filter: brightness(1.07); }
.btn-accent, .btn-soft { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.eyebrow { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; }

.spinner { width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%; border: 3px solid var(--primary-soft); border-top-color: var(--primary); animation: nino-spin .8s linear infinite; }
@keyframes nino-spin { to { transform: rotate(360deg); } }
.big-ic { width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 18px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.big-ic svg { width: 28px; height: 28px; }
.done-ic { width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 50%; background: var(--success-soft); color: var(--success); display: grid; place-items: center; }
.done-ic svg { width: 32px; height: 32px; stroke-width: 2.5; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; }
.card-title svg { width: 20px; height: 20px; color: var(--primary); flex: 0 0 auto; }
.tip .ic svg { width: 18px; height: 18px; }
.fb-type .ic svg { width: 26px; height: 26px; }
.guide-ic { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px; background: color-mix(in srgb, var(--accent) 30%, transparent); display: grid; place-items: center; }
.guide-ic svg { width: 22px; height: 22px; }
.feature .ic svg { width: 22px; height: 22px; }
.section-item .num { color: var(--muted); }
.section-item .num svg { width: 18px; height: 18px; }
.site-foot-inner .btn svg { width: 16px; height: 16px; }
.pv-banner-inner > svg { width: 18px; height: 18px; color: var(--primary); flex: 0 0 auto; }

/* home */
.continue-card { background: linear-gradient(160deg, color-mix(in srgb, var(--primary) 86%, #fff), var(--primary)); box-shadow: none; }
.stat-tile { padding: 14px 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat-tile .st-ic { display: inline-flex; }
.stat-tile .st-ic svg { width: 20px; height: 20px; }
.st-ic.done { color: var(--success); }
.stat-tile b { font-size: 24px; color: var(--fg); }
.placement-cta { background: var(--surface); border: 1px solid var(--line); }
.placement-cta .big { width: 48px; height: 48px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.placement-cta .big svg { width: 24px; height: 24px; }
@media (max-width: 640px) {
  .course-pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 2px 16px; }
  .course-pills::-webkit-scrollbar { display: none; }
  .course-pills .cp { flex: 0 0 auto; }
}

/* landing: light hero */
.hero { background: var(--surface); color: var(--fg); border: 1px solid var(--line); text-align: center; padding: clamp(28px, 6vw, 56px) clamp(18px, 5vw, 48px); }
.hero::before { inset: -45% auto auto 50%; width: 130%; transform: translateX(-50%); background: radial-gradient(closest-side, color-mix(in srgb, var(--primary) 16%, transparent), transparent); filter: none; opacity: 1; }
.hero::after { display: none; }
.hero .hero-logo, .hero-logo { position: static; display: block; width: 88px; height: 88px; margin: 0 auto 18px; border-radius: 0; box-shadow: none; filter: drop-shadow(0 10px 18px rgba(9, 73, 186, .22)); }
.hero-title { font-size: clamp(30px, 7vw, 46px); font-weight: 800; line-height: 1.25; }
.hero p.hero-sub { margin: 12px auto 0; max-width: 34rem; font-size: 16px; color: var(--muted); opacity: 1; }
.hero p.hero-free { display: inline-flex; align-items: center; gap: 6px; margin: 16px auto 0; padding: 6px 14px; border-radius: 999px; background: var(--success-soft); color: var(--success); font-weight: 700; font-size: 14px; opacity: 1; }
.hero-free svg { width: 16px; height: 16px; stroke-width: 3; }
.hero-courses { margin: 22px auto 0; }
.hero-courses .hc { border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
.hero-courses .hc:hover { background: var(--surface-2); transform: none; }
.hero-courses .hc.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.hero-courses .hc small { color: var(--muted); opacity: 1; }
.hero-cta { display: flex; justify-content: center; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.hero-cta .btn { min-width: 140px; }
.auth-logo { border-radius: 0; box-shadow: none; filter: drop-shadow(0 8px 16px rgba(9, 73, 186, .2)); }

/* add to home screen invite */
.install-card { display: flex; gap: 14px; padding: 16px; align-items: flex-start; }
.install-card .ic-tile { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.install-card .ic-tile svg { width: 22px; height: 22px; }
.install-card .ic-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.install-card h3 { font-size: 16px; font-weight: 800; }
.install-card p { font-size: 14px; color: var(--muted); }
.install-card .steps { margin: 2px 0 4px; padding-inline-start: 20px; font-size: 14px; display: grid; gap: 4px; }
.install-card .steps svg { width: 16px; height: 16px; vertical-align: -3px; color: var(--primary); }

/* footer: Instagram as a quiet text link (the pill style is injected by patente/js/hook.js) */
.site-foot-inner .pt-insta-link { padding: 0; background: none; color: var(--muted); box-shadow: none; font-weight: 600; }
.site-foot-inner .pt-insta-link:hover { transform: none; color: var(--fg); }
.site-foot-inner .pt-insta-link svg { width: 16px; height: 16px; }
.site-foot-inner .pt-insta-link b { font-weight: 600; opacity: 1; }
/* text Google reads before the app starts (replaced on the first render) */
.seo-static { padding: 28px 4px; color: var(--muted); line-height: 1.9; }
.seo-static h1 { font-size: 26px; color: var(--fg); margin-bottom: 8px; }
.seo-static h2 { font-size: 18px; color: var(--fg); margin: 18px 0 6px; }
.seo-static ul { padding-inline-start: 20px; margin: 0; }
/* continue card: the same deep blue in light and dark mode (dark --primary is too light for a filled card) */
.continue-card { background: linear-gradient(160deg, #2F6FE0, #1D5BC9); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .continue-card { background: linear-gradient(160deg, #2A5CC4, #1B3F93); } }
:root[data-theme="dark"] .continue-card { background: linear-gradient(160deg, #2A5CC4, #1B3F93); }
.pt-promo .btn { background: #fff; color: #152038; }
/* landing: five language cards centred (3 + 2) */
.hero-courses { display: flex; flex-wrap: wrap; justify-content: center; }
.hero-courses .hc { flex: 0 1 calc(33.333% - 10px); min-width: 96px; }
@media (min-width: 700px) { .hero-courses .hc { flex-basis: calc(20% - 10px); } }
/* landing: three lessons per level until «همه درس‌ها» */
.landing-levels .unit-list { margin-bottom: 10px; }
.landing-levels .unit-list.collapsed > :nth-child(n+4) { display: none; }
.landing-levels .lv-more { margin-bottom: 22px; }
.seo-static h3 { font-size: 16px; color: var(--fg); margin: 12px 0 2px; }

/* placement answer sheet (پاسخ‌نامه) */
.pl-sheet .pls-part { border-top: 1px solid var(--line); padding-top: 8px; }
.pl-sheet .pls-part > summary { cursor: pointer; padding: 6px 0; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.pl-sheet .pls-row { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.pl-sheet .pls-row:last-child { border-bottom: none; }
.pl-sheet .pls-n { flex: 0 0 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--success-soft); color: var(--success); }
.pl-sheet .pls-row.bad .pls-n { background: var(--danger-soft); color: var(--danger); }
.pl-sheet .pls-body { display: grid; gap: 4px; min-width: 0; font-size: 14px; }
.pl-sheet .pls-q { line-height: 1.8; }
.pl-sheet .pls-q .it { font-weight: 600; }
.pl-sheet .pls-a { font-size: 13px; }
.pl-sheet .pls-a.bad { color: var(--danger); }
.pl-sheet .pls-a.right, .pl-sheet .pls-a.ok { color: var(--success); }
.pl-sheet .pls-why { font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 6px 10px; }

/* reminders + install page (2026-10-11) */
.remind-card { display: flex; gap: 14px; padding: 16px; align-items: flex-start; border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.remind-card .ic-tile, .unit-hero .ic-tile { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.remind-card .ic-tile svg, .unit-hero .ic-tile svg { width: 22px; height: 22px; }
.unit-hero .ic-tile.big { width: 72px; height: 72px; border-radius: 20px; } .unit-hero .ic-tile.big svg { width: 34px; height: 34px; }
.remind-card .ic-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.remind-card h3 { font-size: 16px; font-weight: 800; } .remind-card p { font-size: 14px; color: var(--muted); }
.steps.big { padding-inline-start: 22px; font-size: 15px; line-height: 1.9; display: grid; gap: 6px; }
.steps.big svg { width: 18px; height: 18px; vertical-align: -4px; color: var(--primary); }
.inst.current { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.inst.current .card-title::after { content: "این دستگاه"; font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-soft); border-radius: 999px; padding: 2px 10px; margin-inline-start: 8px; vertical-align: middle; }

/* ==========================================================================
   Courses in other scripts (October 2026): Arabic (a right-to-left target language), Chinese, Korean, Russian.
   ========================================================================== */
/* Transliteration line (pinyin, romanised Korean or Russian for beginners) under target-language text */
.tr { display: block; font-family: var(--font-it); font-weight: 600; font-size: .78em; color: var(--muted); direction: ltr; line-height: 1.3; unicode-bidi: isolate; }
.vcard .tr { text-align: right; font-size: 13px; }
.vcard .ex .tr { font-size: 12px; }
.msg .bubble .tr { text-align: left; font-size: 13px; }
.flash-face .tr { font-size: 14px; }
.example .tr, .gloss button .tr { text-align: right; font-size: 13px; }
.phrase-card .tr { font-size: 14px; text-align: right; }
.scene-caption .cap-tr { font-family: var(--font-it); font-weight: 600; font-size: 14px; color: var(--muted); direction: ltr; text-align: right; transition: opacity .25s; }
.scene-caption .cap-tr[hidden] { display: none; }
.reading-text p.tr { font-size: 14px; font-weight: 500; color: var(--muted); margin-top: -8px; }
/* System fonts with the right glyphs for Chinese and Korean (the bundled Nunito covers Latin and Cyrillic only) */
html[data-course="zh"] { --font-it: 'Nunito', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', 'Noto Sans CJK SC', 'Source Han Sans SC', 'Segoe UI', sans-serif; }
html[data-course="ko"] { --font-it: 'Nunito', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', 'Noto Sans CJK KR', 'Segoe UI', sans-serif; }
html[data-course="zh"] .it, html[data-course="ko"] .it, html[data-course="zh"] .chip, html[data-course="ko"] .chip, html[data-course="zh"] .ex-sentence, html[data-course="ko"] .ex-sentence { font-weight: 600; }
html[data-course="zh"] .it, html[data-course="zh"] .chip, html[data-course="zh"] .ex-sentence, html[data-course="zh"] .scene-caption .cap-it { letter-spacing: .03em; }
/* Arabic: the target language is right-to-left and uses the Persian font (same script) */
html[data-course="ar"] .it:not([dir="ltr"]), html[data-course="ar"] .input.it, html[data-course="ar"] .ex-sentence, html[data-course="ar"] .chip, html[data-course="ar"] .heard, html[data-course="ar"] .feedback .ans, html[data-course="ar"] .reading-text, html[data-course="ar"] .writing textarea.input, html[data-course="ar"] .scene-caption .cap-it, html[data-course="ar"] .conj, html[data-course="ar"] .conj-row, html[data-course="ar"] .gtable td, html[data-course="ar"] .unit-card .title-it, html[data-course="ar"] .unit-hero .title-it, html[data-course="ar"] .vcard .pos, html[data-course="ar"] .msg .bubble .name, html[data-course="ar"] .el-bubble, html[data-course="ar"] .pv-body[dir="ltr"] { direction: rtl; font-family: var(--font-fa); }
html[data-course="ar"] .it:not([dir="ltr"]) { unicode-bidi: isolate; }
html[data-course="ar"] .msg .bubble .it, html[data-course="ar"] .model .it, html[data-course="ar"] .reading-text, html[data-course="ar"] .opt.it, html[data-course="ar"] .writing .tip .it, html[data-course="ar"] .el-bubble { text-align: right; }
html[data-course="ar"] .chips, html[data-course="ar"] .builder { direction: rtl; }
html[data-course="ar"] .el-text, html[data-course="ar"] .el-bubble { font-weight: 700; }
html[data-course="ar"] .home-title .display { direction: rtl; font-family: var(--font-fa); font-weight: 800; }
html[data-course="ar"] .unit-hero .title-it { font-weight: 700; }

/* ---------- accessibility options (profile → دسترس‌پذیری; App.applyA11y). Every rule needs an attribute that is only on
   <html> when the learner turned the option on, so the site looks and works the same for everyone else. ---------- */
/* No-sound mode (deaf and hard-of-hearing learners): buttons that only play audio are hidden. */
:root[data-deaf] .spk-btn, :root[data-deaf] .listen-btn, :root[data-deaf] .play-all, :root[data-deaf] .play-dlg,
:root[data-deaf] .play-text, :root[data-deaf] .c-speak, :root[data-deaf] .pt-spk, :root[data-deaf] .vs { display: none !important; }
/* Larger text: the page content (not the top and bottom bars) is scaled like browser zoom, so the layout reflows. */
:root[data-text] main { zoom: var(--text-zoom, 1); }
/* High contrast: darker text, stronger borders and a clear focus ring, in the light and the dark theme. */
:root[data-contrast="high"] {
  --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #E4E9F2; --fg: #000000; --muted: #26324A; --line: #56637C;
  --primary: #0B3F9E; --primary-soft: #D9E4FA; --success: #0A6638; --success-soft: #D2F0DF; --danger: #A82317; --danger-soft: #F9DAD6;
  --accent-fg: #000000; --accent-soft-fg: #000000;
}
:root[data-theme="dark"][data-contrast="high"] {
  --bg: #000000; --surface: #0A0F1C; --surface-2: #19233B; --fg: #FFFFFF; --muted: #DCE3F0; --line: #8A97B3;
  --primary: #9BBCFF; --primary-fg: #000000; --primary-soft: #1C2D52; --success: #63DCA2; --success-soft: #0E3322; --danger: #FF9283; --danger-soft: #4A1E19;
  --accent-soft-fg: #FFFFFF;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-contrast="high"] {
    --bg: #000000; --surface: #0A0F1C; --surface-2: #19233B; --fg: #FFFFFF; --muted: #DCE3F0; --line: #8A97B3;
    --primary: #9BBCFF; --primary-fg: #000000; --primary-soft: #1C2D52; --success: #63DCA2; --success-soft: #0E3322; --danger: #FF9283; --danger-soft: #4A1E19;
  --accent-soft-fg: #FFFFFF;
  }
}
:root[data-contrast="high"] .card, :root[data-contrast="high"] .opt, :root[data-contrast="high"] .chip, :root[data-contrast="high"] .input { border-width: 2px; }
:root[data-contrast="high"] :focus-visible { outline: 3px solid var(--primary) !important; outline-offset: 2px; }
:root[data-contrast="high"] main a:not([class]) { text-decoration: underline; }
/* The accessibility card itself (profile). */
.a11y .seg { flex-wrap: wrap; }
.a11y .seg button { min-width: 56px; }
