/* ==========================================================================
   IlmuStrim — design system
   Fonts: Nunito (display, rounded) + DM Sans (body)
   ========================================================================== */

:root {
  /* Noto Sans Math / Noto Sans (index.php) only fill in maths glyphs the brand fonts lack: ∝ √ ≤ π, xⁿ x₁ ⅓ kᵐ */
  --font-display: "Nunito", "Noto Sans Math", "Noto Sans", system-ui, sans-serif;
  --font-body: "DM Sans", "Noto Sans Math", "Noto Sans", system-ui, sans-serif;

  --bg: #f6f7fb;
  --bg-soft: #eef0fa;
  --surface: #ffffff;
  --surface-2: #f3f4fa;
  --surface-3: #e9ebf6;
  --text: #141633;
  --text-2: #43486a;
  --muted: #646a8c;
  --border: #e1e4f0;
  --overlay: rgba(13, 15, 31, 0.6);

  --brand: #0d9488;
  --brand-600: #0f766e;
  --brand-700: #115e59;
  --brand-soft: #d9f5f1;
  --brand-ink: #0f766e;
  --on-brand: #ffffff;
  --focus: #0d9488;

  /* Button fills: white label text >= 4.5:1 in both themes (WCAG AA) */
  --btn-brand: #0f766e;   --btn-brand-edge: #0b4f4a;
  --btn-green: #12873f;   --btn-green-edge: #0b5c2a;
  --btn-teal: #0e7d74;    --btn-teal-edge: #0a5650;
  --btn-coral: #e11d48;   --btn-coral-edge: #9f1239;
  --btn-red: #dc2626;     --btn-red-edge: #991b1b;

  --teal: #0fa898;
  --teal-700: #0a6e64;
  --teal-soft: #dcf7f3;
  --sun: #ffc53d;
  --sun-700: #d39400;
  --star: #9a6700; /* star text on light surfaces: 4.5:1 */
  --sun-soft: #fff4d6;
  --coral: #ff5e7e;
  --coral-700: #be123c;
  --coral-soft: #ffe4ea;
  --green: #1fb85a;
  --green-700: #15803d;
  --green-soft: #dcfce7;
  --red: #ef4444;
  --red-700: #b91c1c;
  --red-soft: #fee2e2;

  --shadow-sm: 0 1px 2px rgba(20, 22, 51, 0.06), 0 1px 3px rgba(20, 22, 51, 0.06);
  --shadow-md: 0 6px 20px rgba(20, 22, 51, 0.08), 0 2px 6px rgba(20, 22, 51, 0.05);
  --shadow-lg: 0 24px 60px rgba(20, 22, 51, 0.14);
  --ring: 0 0 0 3px rgba(13, 148, 136, 0.45);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --header-h: 68px;
  --container: 1200px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #081a2c;
  --bg-soft: #0b2136;
  --surface: #0f2942;
  --surface-2: #163452;
  --surface-3: #1f4165;
  --text: #f1f6fb;
  --text-2: #c5d3e3;
  --muted: #9bb0c7;
  --border: #25476a;
  --overlay: rgba(2, 10, 20, 0.78);

  --brand: #2dd4bf;
  --brand-600: #14b8a6;
  --brand-700: #0f766e;
  --brand-soft: #0f2f2d;
  --brand-ink: #5eead4;
  --focus: #5eead4;

  --teal: #2dd4bf;
  --teal-700: #0f8f80;
  --teal-soft: #113a3a;
  --sun: #ffcf5c;
  --sun-700: #b98100;
  --star: var(--sun);
  --sun-soft: #3a3016;
  --coral: #ff7b95;
  --coral-700: #c43b58;
  --coral-soft: #3d1c27;
  --green: #34d36f;
  --green-700: #168a42;
  --green-soft: #12341f;
  --red: #f87171;
  --red-700: #b91c1c;
  --red-soft: #3b1515;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --ring: 0 0 0 3px rgba(94, 234, 212, 0.6);

  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-weight: 900; }
h2, h3 { font-weight: 800; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.topic-row:focus-visible, .chapter-tile:focus-visible, .subject-card:focus-visible, .tile:focus-visible, .match-card:focus-visible { outline-offset: -4px; }
a, button, summary, [role="button"] { touch-action: manipulation; }
::selection { background: var(--brand); color: #fff; }

.icon { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-fill { fill: currentColor; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .container { padding: 0 24px; } }

.skip-link { position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 700; }
.skip-link:focus { top: 12px; }

/* ---------- Buttons (chunky, game-like) ---------- */
.btn {
  --btn-bg: var(--btn-brand);
  --btn-fg: #fff;
  --btn-shadow: var(--btn-brand-edge);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 22px;
  font-family: var(--font-display); font-weight: 800; font-size: 16px; letter-spacing: 0.01em;
  color: var(--btn-fg); background: var(--btn-bg);
  border-radius: 14px; box-shadow: 0 4px 0 var(--btn-shadow);
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), filter 0.2s;
  white-space: nowrap; user-select: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--btn-shadow); }
.btn:disabled, .btn[aria-disabled="true"] { --btn-bg: var(--surface-3); --btn-fg: var(--muted); --btn-shadow: var(--border); cursor: not-allowed; filter: none; }
.btn:disabled:active { transform: none; box-shadow: 0 4px 0 var(--btn-shadow); }
.btn-lg { min-height: 56px; padding: 14px 28px; font-size: 18px; border-radius: 16px; }
.btn-sm { min-height: 40px; padding: 8px 14px; font-size: 14px; border-radius: 12px; box-shadow: 0 3px 0 var(--btn-shadow); }
.btn-block { width: 100%; }
.btn-teal { --btn-bg: var(--btn-teal); --btn-shadow: var(--btn-teal-edge); --btn-fg: #fff; }
.btn-sun { --btn-bg: var(--sun); --btn-shadow: var(--sun-700); --btn-fg: #2b1d00; }
.btn-coral { --btn-bg: var(--btn-coral); --btn-shadow: var(--btn-coral-edge); --btn-fg: #fff; }
.btn-green { --btn-bg: var(--btn-green); --btn-shadow: var(--btn-green-edge); --btn-fg: #fff; }
.btn-red { --btn-bg: var(--btn-red); --btn-shadow: var(--btn-red-edge); --btn-fg: #fff; }
.btn-ghost { --btn-bg: var(--surface); --btn-fg: var(--text); --btn-shadow: var(--border); border: 2px solid var(--border); }
.btn-white { --btn-bg: #fff; --btn-fg: #1c1a4a; --btn-shadow: rgba(0, 0, 0, 0.18); }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border);
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-3); }
.icon-btn:active { transform: scale(0.94); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.site-header .container { height: 100%; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 900; font-size: 22px; letter-spacing: -0.02em; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: block; flex: none; }
.brand-word { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.brand-word b { color: var(--brand); font-weight: 800; }
.brand-mark .icon { width: 22px; height: 22px; }
.brand b { color: var(--brand); }
.nav-links { display: none; gap: 4px; margin-left: 12px; }
.nav-links a { padding: 8px 14px; border-radius: 10px; font-weight: 600; color: var(--text-2); transition: background 0.2s, color 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.lang-toggle { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.lang-toggle button { min-width: 40px; height: 36px; padding: 0 10px; border-radius: 9px; font-family: var(--font-display); font-weight: 800; font-size: 14px; color: var(--muted); transition: all 0.2s var(--ease); }
.lang-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
.xp-pill { display: none; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 12px; background: var(--sun-soft); color: var(--text); font-family: var(--font-display); font-weight: 800; font-size: 14px; }
.xp-pill .icon { color: var(--sun-700); }
:root[data-theme="dark"] .xp-pill .icon { color: var(--sun); }
.header-cta { display: none; }
@media (min-width: 900px) {
  .nav-links { display: flex; }
  .header-cta { display: inline-flex; }
}
@media (min-width: 560px) { .xp-pill { display: inline-flex; } }

/* ---------- Generic UI ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.chip .icon { width: 15px; height: 15px; }
.chip-brand { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.chip-teal { background: var(--teal-soft); color: var(--teal-700); border-color: transparent; }
:root[data-theme="dark"] .chip-teal { color: var(--teal); }
.chip-sun { background: var(--sun-soft); color: #8a5a00; border-color: transparent; }
:root[data-theme="dark"] .chip-sun { color: var(--sun); }
.chip-muted { opacity: 0.9; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 800; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand); }
.section { padding: 72px 0; }
.section-sm { padding: 40px 0; }
.section-head { max-width: 680px; margin-bottom: 36px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head h2 { font-size: clamp(28px, 4.4vw, 42px); margin-top: 10px; }
.section-head p { margin-top: 12px; font-size: 18px; color: var(--text-2); }
.grad-text { background: linear-gradient(90deg, var(--brand), #14b8a6 55%, var(--sun)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.progress { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--green)); transition: width 0.6s var(--ease); }
.ring { --p: 0; --size: 64px; --c: var(--teal); width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0); position: relative; flex: none; }
.ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.ring > span { position: relative; font-family: var(--font-display); font-weight: 900; font-size: 15px; }

.stars { display: inline-flex; gap: 2px; color: var(--muted); } /* empty stars must stay visible (3:1 for graphics) */
.stars .icon { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.stars .on { color: var(--sun); }

.empty-state { text-align: center; padding: 48px 16px; color: var(--muted); }

.toast-wrap { position: fixed; left: 50%; top: calc(var(--header-h) + 10px); transform: translateX(-50%); z-index: 400; display: grid; gap: 10px; width: min(92vw, 420px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px; background: var(--text); color: var(--bg); font-weight: 600; box-shadow: var(--shadow-lg); animation: toast-in 0.35s var(--ease-bounce); pointer-events: auto; }
.toast .icon { color: var(--sun); width: 22px; height: 22px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-16px) scale(0.96); } }

/* ---------- Landing ---------- */
.hero { position: relative; overflow: hidden; padding: 48px 0 56px; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto; height: 120%; z-index: -1;
  background:
    radial-gradient(600px 400px at 85% 20%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
    radial-gradient(500px 360px at 10% 10%, color-mix(in srgb, var(--teal) 18%, transparent), transparent 70%),
    radial-gradient(500px 360px at 60% 90%, color-mix(in srgb, var(--coral) 14%, transparent), transparent 70%);
}
.hero-grid { display: grid; gap: 40px; align-items: center; }
.hero-grid > *, .lesson-grid > *, .aina-section > * { min-width: 0; }
.hero h1 { font-size: clamp(38px, 5.6vw, 64px); letter-spacing: -0.03em; margin-top: 16px; }
.h1-sub { display: block; margin-top: 12px; font-size: 0.52em; font-weight: 800; letter-spacing: -0.01em; color: var(--text-2); }
.hero-sub { margin-top: 18px; font-size: clamp(17px, 2vw, 20px); color: var(--text-2); max-width: 560px; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-trust { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 26px; color: var(--muted); font-size: 14px; font-weight: 600; }
.hero-trust span { display: inline-flex; align-items: center; gap: 6px; }
.hero-trust .icon { color: var(--teal); width: 18px; height: 18px; }

.picker { margin-top: 28px; padding: 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); max-width: 560px; }
.picker-label { font-family: var(--font-display); font-weight: 800; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
/* All five forms always visible (landing picker + hub): 5 across when the box
   is wide enough, otherwise 3 + 2 (never 4 + 1 leaving Tingkatan 5 alone). */
.picker, .hub-tabs { container-type: inline-size; }
.form-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding-bottom: 2px; }
@container (min-width: 504px) { .form-tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.form-tab { height: 44px; padding: 0 4px; font-size: clamp(11.5px, 4.6cqi, 15px); white-space: nowrap; border-radius: 12px; font-family: var(--font-display); font-weight: 800; background: var(--surface-2); color: var(--text-2); border: 2px solid transparent; transition: all 0.2s var(--ease); }
.form-tab:hover { color: var(--text); }
.form-tab[aria-selected="true"] { background: var(--brand-soft); color: var(--brand-ink); border-color: var(--brand); }
.picker-subjects { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.subject-pill { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 6px; border-radius: 12px; font-weight: 700; font-size: 14px; background: var(--surface-2); border: 1px solid var(--border); transition: transform 0.15s, border-color 0.2s, background 0.2s; }
.subject-pill .dot { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; color: #fff; }
.subject-pill .dot .icon { width: 16px; height: 16px; }
.subject-pill.is-live { border-color: var(--teal); background: var(--teal-soft); }
.subject-pill.is-live::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 25%, transparent); }
.subject-pill.is-soon { opacity: 0.7; }
.subject-pill:hover { transform: translateY(-2px); }

.hero-art { position: relative; min-height: 360px; display: grid; place-items: center; }
.hero-blob { position: absolute; width: min(96%, 540px); aspect-ratio: 1; border-radius: 42% 58% 55% 45% / 50% 42% 58% 50%; background: linear-gradient(135deg, var(--brand) 0%, #0f766e 55%, #0f2942 100%); opacity: 0.95; animation: blob 14s ease-in-out infinite; }
:root[data-theme="dark"] .hero-blob { opacity: 0.8; }
@keyframes blob { 50% { border-radius: 58% 42% 45% 55% / 42% 58% 42% 58%; transform: rotate(8deg) scale(1.03); } }
/* Five students grouped close together (picture ~1:0.92), large over the blob. */
.hero-figure { position: relative; width: min(100%, 580px); }
.hero-students { display: block; width: 100%; height: auto; filter: drop-shadow(0 30px 40px rgba(20, 22, 51, 0.28)); }
.float-card { position: absolute; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-family: var(--font-display); font-weight: 800; font-size: 14px; animation: bob 5s ease-in-out infinite; }
.float-card .badge-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; }
.float-card small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 12px; color: var(--muted); }
/* All cards live inside .hero-figure (the picture's box); faces are in the top ~30%, so the
   side cards sit on the skirt (left) and below the hand on the hip (right). */
.fc-1 { top: 70%; left: -6%; }
.fc-2 { top: 52%; right: -6%; animation-delay: -1.6s; }
/* Inside .hero-figure (exactly the image's box), centred below the row of students so it
   covers no face. Margin centring: bob owns `transform`. */
.fc-3 { bottom: -9%; left: 0; right: 0; width: max-content; margin-inline: auto; animation-delay: -3.2s; }
@media (max-width: 559px) {
  .float-card { gap: 8px; padding: 7px 10px; border-radius: 13px; font-size: 13px; }
  .fc-1 { left: 0; }
  .fc-2 { right: 0; }
  .float-card .badge-ico { width: 30px; height: 30px; border-radius: 9px; }
  .float-card small { font-size: 11px; }
}
@keyframes bob { 50% { transform: translateY(-10px); } }

.stats-strip { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat { padding: 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); text-align: center; }
.stat b { display: block; font-family: var(--font-display); font-weight: 900; font-size: 36px; line-height: 1; color: var(--brand); }
.stat span { display: block; margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--text-2); }

.steps { display: grid; gap: 16px; counter-reset: step; }
.step { position: relative; padding: 28px 24px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
.step-ico { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; color: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15); }
.step-ico .icon { width: 28px; height: 28px; }
.step h3 { font-size: 22px; margin-top: 18px; }
.step p { margin-top: 8px; color: var(--text-2); }
.step-num { position: absolute; top: 20px; right: 22px; font-family: var(--font-display); font-weight: 900; font-size: 48px; line-height: 1; color: var(--surface-3); }

.feature-grid { display: grid; gap: 16px; }
.feature { padding: 26px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); transition: transform 0.25s var(--ease), box-shadow 0.25s; }
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.feature-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; }
.feature-ico .icon { width: 24px; height: 24px; }
.feature h3 { font-size: 20px; margin-top: 16px; }
.feature p { margin-top: 6px; color: var(--text-2); font-size: 15px; }

.showcase { display: grid; gap: 16px; }
.chapter-tile { position: relative; display: block; border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-2); aspect-ratio: 16 / 10; isolation: isolate; box-shadow: var(--shadow-sm); transition: transform 0.3s var(--ease), box-shadow 0.3s; }
.chapter-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform 0.6s var(--ease); }
.chapter-tile::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, transparent 30%, rgba(8, 9, 24, 0.86)); }
.chapter-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.chapter-tile:hover img { transform: scale(1.06); }
.chapter-tile .tile-body { position: absolute; left: 16px; right: 16px; bottom: 14px; color: #fff; }
.chapter-tile .tile-num { display: inline-block; padding: 3px 10px; border-radius: 8px; font-family: var(--font-display); font-weight: 900; font-size: 12px; letter-spacing: 0.04em; color: #fff; }
.chapter-tile h3 { font-size: 18px; margin-top: 8px; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4); }

.aina-section { display: grid; gap: 32px; align-items: center; }
.aina-photo { position: relative; border-radius: var(--radius-xl); overflow: hidden; aspect-ratio: 1; max-width: 460px; box-shadow: var(--shadow-lg); }
.aina-photo img { width: 100%; height: 100%; object-fit: cover; }
.aina-video { aspect-ratio: 9 / 16; max-width: 300px; margin-inline: auto; background: var(--surface-2); }
.aina-video video { display: block; width: 100%; height: 100%; object-fit: cover; }
.speech { position: relative; display: inline-block; padding: 16px 20px; border-radius: 20px 20px 20px 6px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); font-family: var(--font-display); font-weight: 800; font-size: 18px; }
.aina-points { display: grid; gap: 14px; margin-top: 24px; }
.aina-points li { display: flex; gap: 12px; align-items: flex-start; color: var(--text-2); }
.aina-points .icon { color: var(--teal); margin-top: 3px; }

.forms-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-card { position: relative; padding: 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); transition: transform 0.2s var(--ease), border-color 0.2s; text-align: left; }
.form-card:hover { transform: translateY(-3px); border-color: var(--brand); }
.form-card b { display: block; font-family: var(--font-display); font-weight: 900; font-size: 40px; line-height: 1; color: var(--brand); }
.form-card span { display: block; margin-top: 6px; font-weight: 700; }
.form-card small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.form-card .chip { margin-top: 12px; }

.audience-split { display: grid; gap: 16px; }
.audience-card { padding: 28px; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.audience-card h3 { font-size: 24px; }
.audience-card ul { margin-top: 14px; display: grid; gap: 10px; }
.audience-card li { display: flex; gap: 10px; color: var(--text-2); }
.audience-card li .icon { color: var(--brand); margin-top: 3px; }
.audience-card .btn { margin-top: 20px; }

.faq { display: grid; gap: 12px; max-width: 820px; margin: 0 auto; }
.faq details { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); padding: 0 20px; transition: border-color 0.2s; }
.faq details[open] { border-color: var(--brand); }
.faq summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; font-family: var(--font-display); font-weight: 800; font-size: 17px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { transition: transform 0.25s var(--ease); color: var(--brand); }
.faq details[open] summary .icon { transform: rotate(180deg); }
.faq details p { padding: 0 0 20px; color: var(--text-2); }

.cta-band { position: relative; overflow: hidden; border-radius: var(--radius-xl); padding: 48px 28px; color: #fff; background: linear-gradient(120deg, #0f766e, #0f4c5c 60%, #0f2942); text-align: center; }
.cta-band::before, .cta-band::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.12); }
.cta-band::before { width: 280px; height: 280px; top: -120px; left: -60px; }
.cta-band::after { width: 200px; height: 200px; bottom: -90px; right: -40px; }
.cta-band h2 { font-size: clamp(28px, 4.6vw, 44px); position: relative; }
.cta-band p { position: relative; margin: 12px auto 0; max-width: 560px; font-size: 18px; opacity: 0.92; }
.cta-band .btn { position: relative; margin-top: 26px; }

.site-footer { margin-top: 40px; padding: 48px 0 32px; border-top: 1px solid var(--border); background: var(--bg-soft); }
.footer-grid { display: grid; gap: 28px; }
.footer-grid h4 { font-size: 15px; margin-bottom: 12px; }
.footer-grid a { display: block; padding: 4px 0; color: var(--text-2); font-size: 15px; }
.footer-grid a:hover { color: var(--brand); }
.footer-note { margin-top: 12px; color: var(--muted); font-size: 14px; max-width: 360px; }
.footer-bottom { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; color: var(--muted); font-size: 14px; }

@media (min-width: 640px) {
  .stats-strip { grid-template-columns: repeat(4, 1fr); }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .showcase { grid-template-columns: repeat(2, 1fr); }
  .forms-row { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
  .hero { padding: 72px 0 88px; }
  .hero-grid { grid-template-columns: 1.08fr 0.92fr; }
  /* Bigger than its column: it spills into the right margin only, never over the text. */
  .hero-figure { width: min(118%, 640px); translate: 7% 0; }
  .hero-blob { translate: 7% 0; }
  .hero-art { min-height: 620px; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
  .showcase { grid-template-columns: repeat(4, 1fr); }
  .aina-section { grid-template-columns: 0.9fr 1.1fr; gap: 56px; }
  .forms-row { grid-template-columns: repeat(5, 1fr); }
  .audience-split { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
  .cta-band { padding: 64px 40px; }
}

/* ---------- Page headers ---------- */
.page { padding-top: 28px; padding-bottom: 40px; min-height: calc(100vh - var(--header-h)); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.crumbs a:hover { color: var(--brand); }
.crumbs .icon { width: 14px; height: 14px; }
.page-title { font-size: clamp(28px, 4.5vw, 40px); margin-top: 10px; }
.page-sub { margin-top: 8px; color: var(--text-2); font-size: 17px; }

/* ---------- Learn hub ---------- */
.continue-card { display: grid; gap: 16px; align-items: center; padding: 16px; margin-top: 24px; border-radius: var(--radius-lg); background: linear-gradient(120deg, var(--brand), #0f4c5c); color: #fff; box-shadow: 0 6px 0 var(--brand-700); }
.continue-card .thumb { border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; background: rgba(255, 255, 255, 0.15); }
.continue-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.continue-card small { font-weight: 700; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.06em; font-size: 12px; }
.continue-card h3 { font-size: 20px; margin-top: 4px; }
.continue-card .text { min-width: 0; }
.continue-card h3 { overflow-wrap: anywhere; }
.continue-card .btn-lg { min-width: 210px; gap: 12px; }
.continue-card .btn-lg .icon { width: 22px; height: 22px; }
.continue-card:hover .btn { filter: brightness(1.04); transform: translateY(-1px); }
@media (min-width: 640px) { .continue-card { grid-template-columns: 200px 1fr auto; padding: 18px 22px 18px 18px; } }
@media (max-width: 639px) { .continue-card .btn-lg { width: 100%; } }
.hero-cta { min-width: 200px; }

.hub-tabs { margin-top: 28px; }
.subject-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 18px; }
.subject-card { position: relative; display: flex; flex-direction: column; border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--border); text-align: left; transition: transform 0.25s var(--ease), box-shadow 0.25s, border-color 0.2s; }
.subject-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.subject-card .art { position: relative; aspect-ratio: 4 / 3; background: var(--sc, var(--brand)); overflow: hidden; }
.subject-card .art img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.subject-card:hover .art img { transform: scale(1.05); }
.subject-card .art .form-badge { position: absolute; top: 10px; left: 10px; padding: 4px 10px; border-radius: 9px; font-family: var(--font-display); font-weight: 900; font-size: 13px; background: rgba(255, 255, 255, 0.92); color: #1c1a4a; }
.subject-card .body { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.subject-card h3 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.subject-card h3 .icon { color: var(--sc); }
.subject-card.is-soon .art img { filter: grayscale(0.55) brightness(0.9); }
.subject-card.is-soon { cursor: default; }
.subject-card.is-soon:hover { transform: none; box-shadow: none; }
.subject-card .soon-veil { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--overlay) 55%, transparent); color: #fff; font-family: var(--font-display); font-weight: 900; font-size: 15px; gap: 6px; }
.subject-card .soon-veil span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; background: rgba(0, 0, 0, 0.35); backdrop-filter: blur(6px); }
.subject-card.is-live { border: 2px solid var(--sc); }
@media (min-width: 640px) { .subject-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .subject-grid { grid-template-columns: repeat(4, 1fr); gap: 18px; } }

/* ---------- Course page ---------- */
.course-hero { position: relative; border-radius: var(--radius-xl); overflow: hidden; color: #fff; isolation: isolate; min-height: 260px; display: flex; align-items: flex-end; }
.course-hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.course-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(10, 12, 32, 0.9) 0%, rgba(10, 12, 32, 0.65) 45%, rgba(10, 12, 32, 0.15) 100%); }
.course-hero .inner { width: 100%; padding: 28px 22px; display: grid; gap: 18px; align-items: end; }
.course-hero h1 { font-size: clamp(32px, 5.5vw, 52px); }
.course-hero p { margin-top: 8px; max-width: 560px; opacity: 0.9; }
.course-hero .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.course-hero .chip { background: rgba(255, 255, 255, 0.16); color: #fff; border-color: rgba(255, 255, 255, 0.25); backdrop-filter: blur(6px); }
.course-hero .ring { --size: 84px; }
.course-hero .ring::before { background: rgba(10, 12, 32, 0.85); }
.course-hero .ring > span { color: #fff; font-size: 18px; }
.course-progress { display: flex; align-items: center; gap: 14px; }
.course-progress small { display: block; opacity: 0.8; font-size: 13px; }
.course-progress b { font-family: var(--font-display); font-size: 18px; }
@media (min-width: 760px) { .course-hero { min-height: 340px; } .course-hero .inner { grid-template-columns: 1fr auto; padding: 40px; } }

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 28px 0 18px; }
.filter-bar .seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.filter-bar .seg button { height: 44px; min-width: 44px; padding: 0 14px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--muted); }
.filter-bar .seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.chapter-list { display: grid; gap: 18px; }
.chapter { border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.chapter-head { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; padding: 12px; }
.chapter-head .art { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 1; background: var(--cc); }
.chapter-head .art img { width: 100%; height: 100%; object-fit: cover; }
.chapter-head .num { font-family: var(--font-display); font-weight: 900; font-size: 13px; letter-spacing: 0.05em; color: var(--cc); text-transform: uppercase; }
.chapter-head h2 { font-size: 19px; margin-top: 2px; }
.chapter-head .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.chapter-head .progress { width: 100px; height: 8px; }
.chapter-head .progress > span { background: var(--cc); }
@media (min-width: 640px) { .chapter-head { grid-template-columns: 180px 1fr; padding: 14px; } .chapter-head .art { aspect-ratio: 16 / 10; } .chapter-head h2 { font-size: 22px; } }

.topic-list { border-top: 1px solid var(--border); }
/* ---- Course page: master-detail chapter / Tema browser ----
   Phones: rows with the open chapter's topics under it (accordion).
   >= 900px: sticky row list on the left, the chosen chapter on the right. */
.theme-browser { display: grid; gap: 10px; align-items: start; }
.theme-nav { display: grid; gap: 8px; align-content: start; }
.theme-item { display: grid; grid-template-columns: 44px 1fr 20px; gap: 12px; align-items: center; width: 100%; min-height: 64px; padding: 10px 12px; text-align: left; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); transition: border-color 0.2s, background 0.2s, box-shadow 0.2s; }
.theme-item:hover { border-color: color-mix(in srgb, var(--cc) 55%, var(--border)); }
.theme-item:focus-visible { outline-offset: -3px; }
.theme-item[aria-expanded="true"] { border-color: var(--cc); background: color-mix(in srgb, var(--cc) 9%, var(--surface)); box-shadow: inset 4px 0 0 var(--cc); }
.ti-num { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--cc); color: #fff; font-family: var(--font-display); font-weight: 900; font-size: 18px; }
.ti-body { display: grid; gap: 2px; min-width: 0; }
.ti-label { font-family: var(--font-display); font-weight: 900; font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.ti-title { font-weight: 700; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ti-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.ti-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.ti-meta .icon, .ti-done .icon { width: 13px; height: 13px; }
.ti-done { color: var(--btn-green); }
.ti-chev { width: 20px; height: 20px; color: var(--muted); transition: transform 0.2s var(--ease); }
.theme-item[aria-expanded="true"] .ti-chev { transform: rotate(90deg); color: var(--cc); }
.theme-item, .theme-panel { scroll-margin-top: calc(var(--header-h) + 10px); }
.theme-panel { border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.theme-empty { display: grid; justify-items: center; gap: 12px; padding: 48px 16px; text-align: center; color: var(--muted); border-radius: var(--radius-lg); background: var(--surface); border: 1px dashed var(--border); }
.theme-empty > .icon { width: 32px; height: 32px; }
@media (min-width: 900px) {
  .theme-browser { grid-template-columns: minmax(280px, 340px) 1fr; gap: 20px; }
  .theme-nav { position: sticky; top: calc(var(--header-h) + 12px); max-height: calc(100vh - var(--header-h) - 24px); overflow-y: auto; padding: 2px 6px 2px 2px; overscroll-behavior: contain; }
  .theme-nav { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
  .theme-panel { position: sticky; top: calc(var(--header-h) + 12px); }
  .theme-item[aria-expanded="true"] .ti-chev { transform: none; }
  .theme-empty { grid-column: 1 / -1; }
}
/* Phones: the open row already names the chapter, so the panel shows only its topics. */
@media (max-width: 899px) { .theme-panel .chapter-head { display: none; } .theme-panel .topic-list { border-top: 0; } }
@media (prefers-reduced-motion: reduce) { .ti-chev { transition: none; } }

.topic-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 12px 14px; min-height: 68px; border-bottom: 1px solid var(--border); transition: background 0.15s; }
.topic-row:last-child { border-bottom: 0; }
a.topic-row:hover { background: var(--surface-2); }
.topic-row .bubble { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 900; font-size: 14px; color: #fff; background: var(--cc); box-shadow: 0 3px 0 color-mix(in srgb, var(--cc) 60%, #000); flex: none; }
.topic-row.is-done .bubble { background: var(--btn-green); box-shadow: 0 3px 0 var(--btn-green-edge); }
.topic-row.is-soon .bubble { background: var(--surface-3); color: var(--muted); box-shadow: none; }
.topic-row .title { font-weight: 700; line-height: 1.3; }
.topic-row .sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.topic-row .sub span { display: inline-flex; align-items: center; gap: 4px; }
.topic-row .sub .icon { width: 14px; height: 14px; }
.topic-row .go { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); flex: none; }
.topic-row.is-soon .go { background: var(--surface-2); color: var(--muted); }
.tag-live { color: var(--teal-700); }
:root[data-theme="dark"] .tag-live { color: var(--teal); }

/* ---------- Lesson page ---------- */
.lesson-grid { display: grid; gap: 24px; margin-top: 16px; }
@media (min-width: 1024px) { .lesson-grid { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } .lesson-side { position: sticky; top: calc(var(--header-h) + 16px); } }
.lesson-title { font-size: clamp(24px, 3.6vw, 34px); margin-top: 18px; }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
/* Every part stays visible (a topic can have 7 videos): a wrapping grid, not a sideways scroller. */
.parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-top: 14px; }
.part-btn { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 44px; padding: 8px 12px; border-radius: 12px; font-weight: 700; font-size: 14px; line-height: 1.3; text-align: left; background: var(--surface-2); border: 2px solid var(--border); }
.part-btn .pn { flex: none; font-variant-numeric: tabular-nums; }
.part-btn .pt { min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; }
.part-btn[aria-pressed="true"] { border-color: var(--brand-ink); color: var(--brand-ink); background: var(--brand-soft); }

.quiz-cta { display: grid; gap: 16px; align-items: center; margin-top: 20px; padding: 20px; border-radius: var(--radius-lg); background: linear-gradient(120deg, var(--sun-soft), var(--coral-soft)); border: 1px solid var(--border); }
.quiz-cta .q-ico { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--sun); color: #2b1d00; box-shadow: 0 4px 0 var(--sun-700); }
.quiz-cta .q-ico .icon { width: 28px; height: 28px; }
.quiz-cta h3 { font-size: 20px; }
.quiz-cta p { color: var(--text-2); font-size: 15px; margin-top: 2px; }
.quiz-cta .best { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--text-2); }
@media (min-width: 640px) { .quiz-cta { grid-template-columns: auto 1fr auto; } }
/* Videos watched, quiz never tried: the card asks for attention (one gentle pulse ring, none with reduced motion). */
.quiz-cta.is-nudge { border: 2px solid var(--sun-700); }
.quiz-cta.is-nudge p.q-sub { color: var(--text); font-weight: 700; }
.quiz-cta.is-nudge .js-quiz { animation: quiz-nudge 1.6s ease-out 3; }
@keyframes quiz-nudge { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--sun) 70%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
@media (prefers-reduced-motion: reduce) { .quiz-cta.is-nudge .js-quiz { animation: none; } }

.info-cards { display: grid; gap: 16px; margin-top: 20px; }
.info-card { padding: 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
.info-card h3 { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.info-card h3 .icon { color: var(--brand); }
.info-card ul { margin-top: 12px; display: grid; gap: 10px; }
.info-card li { display: flex; gap: 10px; color: var(--text-2); }
.info-card li .icon { color: var(--green); margin-top: 3px; }
.info-card.fun { background: var(--teal-soft); border-color: transparent; }
.info-card.fun h3 .icon { color: var(--teal-700); }
.info-card.fun p { margin-top: 8px; color: var(--text); }
@media (min-width: 760px) { .info-cards { grid-template-columns: 1.3fr 1fr; } }

.side-card { border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.side-card header { padding: 16px 16px 12px; }
.side-card header small { font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--cc, var(--brand)); }
.side-card header h3 { font-size: 17px; margin-top: 2px; }
.side-card .topic-row { min-height: 60px; padding: 10px 14px; }
.side-card .topic-row .bubble { width: 40px; height: 40px; border-radius: 12px; font-size: 13px; }
.side-card .topic-row[aria-current="page"] { background: var(--brand-soft); }
.side-card .topic-row[aria-current="page"] .title { color: var(--brand-ink); }
.nav-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }

/* ---------- Video player ---------- */
.player {
  position: relative; aspect-ratio: 16 / 9; width: 100%; border-radius: var(--radius-lg); overflow: hidden;
  background: #05060f; color: #fff; isolation: isolate; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  box-shadow: var(--shadow-lg);
}
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #05060f; pointer-events: none; }
.player .poster { position: absolute; inset: 0; z-index: 1; }
.player .poster img { width: 100%; height: 100%; object-fit: cover; filter: brightness(0.62) saturate(1.1); }
.player.is-started .poster { display: none; }
.player .big-play { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; }
.player .big-play span { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); box-shadow: 0 6px 0 var(--brand-700), 0 0 0 10px rgba(255, 255, 255, 0.15); transition: transform 0.2s var(--ease-bounce); }
.player .big-play span .icon { width: 38px; height: 38px; fill: #fff; stroke: none; margin-left: 5px; }
.player .big-play:hover span { transform: scale(1.08); }
.player.is-playing .big-play { display: none; }
.player .resume-chip { position: absolute; left: 50%; bottom: 16px; translate: -50% 0; z-index: 4; display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 16px; border-radius: 999px; background: rgba(15, 41, 66, 0.88); color: #fff; font: 700 14px var(--font-display); white-space: nowrap; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }
.player .resume-chip[hidden] { display: none; }
.player .rc-restart { min-height: 44px; padding: 0 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); color: #fff; font: 800 13px var(--font-display); }
.player .rc-restart:hover { background: rgba(255, 255, 255, 0.28); }
.player .big-play .label { position: absolute; bottom: 18%; font-family: var(--font-display); font-weight: 800; font-size: 15px; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); width: auto; height: auto; background: none; box-shadow: none; border-radius: 0; }
.player .click-layer { position: absolute; inset: 0; z-index: 2; }
.player .spinner { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; border: 5px solid rgba(255, 255, 255, 0.2); border-top-color: #fff; animation: spin 0.9s linear infinite; z-index: 4; display: none; }
.player.is-loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.player .watermark { position: absolute; z-index: 5; pointer-events: none; font: 700 13px/1.3 var(--font-body); color: rgba(255, 255, 255, 0.26); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); transition: top 1.6s var(--ease), left 1.6s var(--ease); white-space: nowrap; mix-blend-mode: screen; }
.player .wm-tile { position: absolute; inset: -20%; z-index: 5; pointer-events: none; opacity: 0.05; transform: rotate(-22deg); font: 800 15px/3.2 var(--font-display); color: #fff; overflow: hidden; word-spacing: 60px; }

.player .controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; padding: 28px 12px 10px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.75)); display: grid; gap: 6px; transition: opacity 0.3s; }
.player.is-idle.is-playing .controls { opacity: 0; }
.player:not(.is-started) .controls { opacity: 0; pointer-events: none; }
.player .bar-row { display: flex; align-items: center; gap: 4px; }
.player .ctrl { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; transition: background 0.15s; }
.player .ctrl:hover { background: rgba(255, 255, 255, 0.14); }
.player .ctrl .icon { width: 22px; height: 22px; }
.player .ctrl .icon-fill { stroke: none; }
.player .time { font: 700 13px var(--font-body); font-variant-numeric: tabular-nums; padding: 0 6px; opacity: 0.92; }
.player .spacer { flex: 1; }
.player .scrub { position: relative; height: 22px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.player .scrub .track { position: relative; width: 100%; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.25); overflow: visible; }
.player .scrub .buffered { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: rgba(255, 255, 255, 0.35); }
.player .scrub .played { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--brand)); }
.player .scrub .knob { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); transform: scale(0); transition: transform 0.15s; }
.player .scrub:hover .knob, .player .scrub.dragging .knob { transform: scale(1); }
.player .speed { font: 800 13px var(--font-display); width: auto; padding: 0 10px; }

.player .shield { position: absolute; inset: 0; z-index: 20; display: none; place-items: center; text-align: center; padding: 20px; background: rgba(5, 6, 15, 0.92); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
.player.is-shielded .shield { display: grid; }
.player .shield .icon { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--sun); }
.player .shield b { display: block; font-family: var(--font-display); font-size: 20px; }
.player .shield p { margin-top: 6px; opacity: 0.8; font-size: 14px; }
.player .shield .btn { margin-top: 16px; }
.player .msg { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; text-align: center; padding: 24px; }
.player .msg .icon { width: 48px; height: 48px; margin: 0 auto 12px; color: var(--sun); }
.player .msg b { display: block; font-family: var(--font-display); font-size: 22px; }
.player .msg p { margin-top: 6px; opacity: 0.85; max-width: 420px; }
.player .end-card { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; text-align: center; padding: 20px; background: radial-gradient(circle at center, rgba(13, 148, 136, 0.55), rgba(5, 6, 15, 0.92)); animation: fade-in 0.4s var(--ease); }
.player .end-card .icon-big { width: 64px; height: 64px; margin: 0 auto; color: var(--sun); }
.player .end-card b { display: block; margin-top: 10px; font-family: var(--font-display); font-weight: 900; font-size: clamp(22px, 3.4vw, 32px); }
.player .end-card p { margin-top: 4px; opacity: 0.85; }
.player .end-card .row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
/* "Close full screen" only makes sense in full screen. */
.player:not(.is-immersive) .end-card .e-exitfs { display: none; }
/* Small inline player (phone, portrait): compact card that fits, scrolls if it still does not. */
.player .end-card { overflow-y: auto; place-items: safe center; }
@media (max-width: 639px) {
  .player:not(.is-immersive) .end-card { padding: 10px 12px; }
  .player:not(.is-immersive) .end-card .icon-big { width: 30px; height: 30px; }
  .player:not(.is-immersive) .end-card b { margin-top: 2px; font-size: 18px; }
  .player:not(.is-immersive) .end-card p { margin-top: 2px; font-size: 13px; }
  .player:not(.is-immersive) .end-card .row { margin-top: 8px; gap: 8px; }
  .player:not(.is-immersive) .end-card .btn { min-height: 44px; padding: 8px 14px; font-size: 14px; }
  .player:not(.is-immersive) .end-card .e-count { margin-top: 6px !important; }
}
.player:fullscreen { border-radius: 0; }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- Quiz (game mode) ---------- */
.quiz-root { position: fixed; inset: 0; z-index: 300; background: var(--bg); display: flex; flex-direction: column; animation: quiz-in 0.35s var(--ease); }
@keyframes quiz-in { from { opacity: 0; transform: scale(0.98); } }
.quiz-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; max-width: 860px; width: 100%; margin: 0 auto; }
.quiz-top .progress { flex: 1; height: 14px; }
.quiz-top .progress > span { background: linear-gradient(90deg, var(--green), var(--teal)); }
.combo { display: inline-flex; align-items: center; gap: 4px; min-width: 64px; height: 36px; padding: 0 10px; border-radius: 12px; background: var(--coral-soft); color: var(--coral-700); font-family: var(--font-display); font-weight: 900; font-size: 15px; justify-content: center; transition: transform 0.2s var(--ease-bounce); }
:root[data-theme="dark"] .combo { color: var(--coral); }
.combo.bump { transform: scale(1.25); }
.combo.off { background: var(--surface-2); color: var(--muted); }
.quiz-xp { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 10px; border-radius: 12px; background: var(--sun-soft); font-family: var(--font-display); font-weight: 900; font-size: 15px; }
.quiz-xp .icon { color: var(--sun-700); }
.quiz-body { flex: 1; overflow-y: auto; }
.quiz-stage { max-width: 760px; margin: 0 auto; padding: 8px 16px 240px; }
.q-type { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-ink); font-family: var(--font-display); font-weight: 900; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
.q-head { display: flex; gap: 14px; align-items: flex-start; margin-top: 14px; }
.q-head .mascot { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; flex: none; border: 3px solid var(--surface); box-shadow: var(--shadow-md); }
.q-head .mascot img { width: 100%; height: 100%; object-fit: cover; }
.q-prompt { font-family: var(--font-display); font-weight: 800; font-size: clamp(20px, 3.2vw, 26px); line-height: 1.3; }
.q-hint { margin-top: 6px; color: var(--muted); font-size: 14px; font-weight: 600; }
.q-area { margin-top: 24px; }
.q-stimulus { margin: 14px 0 0; padding: 14px 16px; border-left: 4px solid var(--brand); border-radius: 12px; background: var(--surface-2); color: var(--text); font-size: 16px; line-height: 1.55; }
.q-stimulus p + p, .q-stimulus p + .q-stimulus-table, .q-stimulus-table + p, .q-stimulus-table + .q-stimulus-table { margin-top: 10px; }
.q-stimulus-table { overflow-x: auto; }
.q-stimulus table { border-collapse: collapse; min-width: 60%; font-size: 15px; font-variant-numeric: tabular-nums; }
.q-stimulus caption { caption-side: top; text-align: left; padding-bottom: 6px; font-weight: 600; }
.q-stimulus th, .q-stimulus td { padding: 6px 12px; border: 1px solid var(--border); text-align: left; }
.q-stimulus th { font-weight: 800; background: var(--surface); }

.tiles { display: grid; gap: 12px; }
@media (min-width: 640px) { .tiles.two { grid-template-columns: 1fr 1fr; } }
.tile {
  --t: var(--brand); position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 12px 16px; text-align: left;
  border-radius: 16px; background: var(--surface); border: 2px solid var(--border); box-shadow: 0 4px 0 var(--border);
  font-weight: 700; font-size: 17px; line-height: 1.3; transition: transform 0.12s, box-shadow 0.12s, border-color 0.15s, background 0.15s;
}
.tile:hover { border-color: color-mix(in srgb, var(--t) 50%, var(--border)); }
.tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--border); }
.tile .shape { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--t); color: #fff; }
.tile .shape .icon { width: 18px; height: 18px; fill: #fff; stroke: none; }
.tile .check-box { width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--border); display: grid; place-items: center; flex: none; margin-left: auto; color: transparent; }
.tile[aria-pressed="true"] { border-color: var(--t); background: color-mix(in srgb, var(--t) 12%, var(--surface)); box-shadow: 0 4px 0 color-mix(in srgb, var(--t) 70%, #000); }
.tile[aria-pressed="true"] .check-box { background: var(--t); border-color: var(--t); color: #fff; }
.tile.is-correct { --t: var(--green); border-color: var(--green); background: var(--green-soft); box-shadow: 0 4px 0 var(--green-700); }
.tile.is-wrong { --t: var(--red); border-color: var(--red); background: var(--red-soft); box-shadow: 0 4px 0 var(--red-700); animation: shake 0.4s; }
.tile.is-dim { opacity: 0.55; }
.tile:disabled { cursor: default; }
.tile:disabled:active { transform: none; }
.t-0 { --t: #ef476f; } .t-1 { --t: #3a86ff; } .t-2 { --t: #ffb703; } .t-3 { --t: #06d6a0; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.tf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tf-btn { min-height: 120px; border-radius: 20px; display: grid; place-items: center; gap: 6px; font-family: var(--font-display); font-weight: 900; font-size: 22px; color: #fff; transition: transform 0.12s, box-shadow 0.12s, opacity 0.2s; }
.tf-btn .icon { width: 40px; height: 40px; stroke-width: 3; }
.tf-true { background: var(--btn-green); box-shadow: 0 6px 0 var(--btn-green-edge); }
.tf-false { background: var(--btn-red); box-shadow: 0 6px 0 var(--btn-red-edge); }
.tf-btn:active { transform: translateY(5px); box-shadow: none; }
.tf-btn[aria-pressed="true"] { outline: 4px solid var(--text); outline-offset: 3px; }
.tf-btn.is-dim { opacity: 0.4; }

.fill-sentence { font-family: var(--font-display); font-weight: 800; font-size: clamp(20px, 3vw, 24px); line-height: 1.6; padding: 22px; border-radius: 18px; background: var(--surface); border: 2px dashed var(--border); }
.fill-slot { display: inline-flex; align-items: center; justify-content: center; min-width: 120px; min-height: 44px; padding: 2px 14px; margin: 0 4px; border-radius: 12px; vertical-align: middle; border: 2px solid var(--brand); background: var(--brand-soft); color: var(--brand); transition: all 0.2s; }
.fill-slot.empty { border-style: dashed; color: transparent; }
.fill-slot.is-correct { border-color: var(--green); background: var(--green-soft); color: var(--green-700); }
.fill-slot.is-wrong { border-color: var(--red); background: var(--red-soft); color: var(--red-700); }
.word-bank { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; justify-content: center; }
.word { min-height: 48px; padding: 8px 18px; border-radius: 14px; background: var(--surface); border: 2px solid var(--border); box-shadow: 0 4px 0 var(--border); font-weight: 700; font-size: 17px; transition: transform 0.12s, box-shadow 0.12s, opacity 0.2s; }
.word:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--border); }
.word[aria-pressed="true"] { opacity: 0.35; }

.order-list { display: grid; gap: 10px; }
.order-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; min-height: 64px; padding: 10px 10px 10px 12px; border-radius: 16px; background: var(--surface); border: 2px solid var(--border); box-shadow: 0 3px 0 var(--border); font-weight: 700; touch-action: none; transition: transform 0.18s var(--ease), border-color 0.2s, background 0.2s; }
.order-item .grip { color: var(--muted); cursor: grab; display: grid; place-items: center; width: 32px; height: 44px; }
.order-item .n { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 900; background: var(--brand-soft); color: var(--brand-ink); }
.order-item .moves { display: flex; gap: 4px; }
.order-item .moves button { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.order-item .moves button:disabled { opacity: 0.3; }
.order-item.dragging { z-index: 5; border-color: var(--brand); box-shadow: var(--shadow-lg); transform: scale(1.02); }
.order-item.is-correct { border-color: var(--green); background: var(--green-soft); }
.order-item.is-wrong { border-color: var(--red); background: var(--red-soft); }
.order-item .label { display: flex; align-items: center; gap: 10px; }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.match-col { display: grid; gap: 10px; align-content: start; }
.match-card { min-height: 64px; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 2px solid var(--border); box-shadow: 0 3px 0 var(--border); font-weight: 700; font-size: 15px; line-height: 1.3; text-align: left; transition: all 0.15s; }
.match-card.is-selected { border-color: var(--brand); background: var(--brand-soft); }
.match-card.is-paired { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 14%, var(--surface)); box-shadow: 0 3px 0 var(--pc); }
.match-card.is-correct { border-color: var(--green); background: var(--green-soft); }
.match-card.is-wrong { border-color: var(--red); background: var(--red-soft); }
.match-card .tag { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; border-radius: 7px; font-size: 12px; font-weight: 900; color: #fff; background: var(--pc); vertical-align: -4px; }

.sort-label { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 13px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); scroll-margin-top: 80px; }
.sort-label .icon { width: 15px; height: 15px; }
.sort-buckets + .sort-label { margin-top: 18px; }
.sort-pool { display: flex; flex-wrap: wrap; gap: 10px; min-height: 64px; padding: 12px; border-radius: 18px; background: var(--surface-2); border: 2px dashed var(--border); }
.sort-buckets { display: grid; gap: 12px; }
.sort-buckets.b2 { grid-template-columns: 1fr 1fr; }
@media (min-width: 640px) { .sort-buckets.b3 { grid-template-columns: 1fr 1fr 1fr; } }
.bucket-empty { display: block; width: 100%; padding: 14px 6px; border: 2px dashed color-mix(in srgb, var(--bc) 45%, var(--border)); border-radius: 12px; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); }
.sort-buckets.is-armed .bucket { border-color: var(--bc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bc) 25%, transparent); }
@media (prefers-reduced-motion: no-preference) { .sort-buckets.is-armed .bucket { animation: bucket-pulse 1.2s ease-in-out infinite; } }
@keyframes bucket-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--bc) 18%, transparent); } }
.bucket { min-height: 110px; padding: 12px; border-radius: 18px; background: var(--surface); border: 2px solid var(--border); transition: border-color 0.2s, background 0.2s; }
.bucket.is-target { border-color: var(--brand); background: var(--brand-soft); }
.bucket-head { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; font-family: var(--font-display); font-weight: 900; font-size: 16px; color: var(--bc); text-align: left; }
.bucket-head .dot { width: 14px; height: 14px; border-radius: 5px; background: var(--bc); }
.bucket-items { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sort-chip { min-height: 44px; padding: 8px 14px; border-radius: 12px; background: var(--surface); border: 2px solid var(--border); box-shadow: 0 3px 0 var(--border); font-weight: 700; font-size: 15px; touch-action: none; cursor: grab; transition: transform 0.12s, border-color 0.15s; text-align: left; }
.sort-chip.is-selected { border-color: var(--brand); background: var(--brand-soft); transform: translateY(-2px); }
.sort-chip.is-correct { border-color: var(--green); background: var(--green-soft); }
.sort-chip.is-wrong { border-color: var(--red); background: var(--red-soft); }
.drag-ghost { position: fixed; z-index: 500; pointer-events: none; transform: translate(-50%, -50%) rotate(-3deg) scale(1.05); box-shadow: var(--shadow-lg); opacity: 0.95; }

.quiz-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; border-top: 2px solid var(--border); background: var(--bg); transition: background 0.25s; }
.quiz-foot .inner { max-width: 760px; margin: 0 auto; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); display: grid; gap: 12px; }
.quiz-foot.correct { background: var(--green-soft); border-color: transparent; }
.quiz-foot.wrong { background: var(--red-soft); border-color: transparent; }
.feedback { display: none; gap: 12px; align-items: flex-start; animation: slide-up 0.3s var(--ease-bounce); }
.quiz-foot.correct .feedback, .quiz-foot.wrong .feedback { display: flex; }
.feedback .f-ico { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; }
.quiz-foot.correct .f-ico { background: var(--btn-green); }
.quiz-foot.wrong .f-ico { background: var(--btn-red); }
.feedback .f-ico .icon { width: 26px; height: 26px; stroke-width: 3; }
.feedback b { font-family: var(--font-display); font-weight: 900; font-size: 20px; }
.quiz-foot.correct .feedback b { color: var(--green-700); }
.quiz-foot.wrong .feedback b { color: var(--red-700); }
:root[data-theme="dark"] .quiz-foot.correct .feedback b { color: var(--green); }
:root[data-theme="dark"] .quiz-foot.wrong .feedback b { color: var(--red); }
.feedback p { margin-top: 2px; font-size: 15px; color: var(--text); }
@keyframes slide-up { from { opacity: 0; transform: translateY(14px); } }
@media (min-width: 640px) { .quiz-foot .inner { grid-template-columns: 1fr auto; align-items: center; } .quiz-foot .btn { min-width: 180px; } }

.quiz-intro, .quiz-result { max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; text-align: center; }
.quiz-intro .mascot-lg, .quiz-result .mascot-lg { width: 120px; height: 120px; border-radius: 50%; overflow: hidden; margin: 12px auto 0; border: 5px solid var(--surface); box-shadow: var(--shadow-lg); }
.quiz-intro .mascot-lg img, .quiz-result .mascot-lg img { width: 100%; height: 100%; object-fit: cover; }
.quiz-intro h2, .quiz-result h2 { font-size: clamp(26px, 4.5vw, 36px); margin-top: 18px; }
.quiz-intro p { margin-top: 10px; color: var(--text-2); font-size: 17px; }
.quiz-intro .rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0; }
.quiz-intro .rule { padding: 14px 8px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 700; color: var(--text-2); }
.quiz-intro .rule .icon { width: 26px; height: 26px; margin: 0 auto 6px; color: var(--brand); }
.result-stars { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.result-stars .icon { width: 64px; height: 64px; fill: var(--surface-3); stroke: none; transform: scale(0); animation: star-pop 0.5s var(--ease-bounce) forwards; }
.result-stars .icon.on { fill: var(--sun); filter: drop-shadow(0 4px 0 var(--sun-700)); }
.result-stars .icon:nth-child(2) { animation-delay: 0.25s; transform: scale(0) translateY(-12px); width: 76px; height: 76px; }
.result-stars .icon:nth-child(3) { animation-delay: 0.5s; }
@keyframes star-pop { to { transform: scale(1); } }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 24px; }
.result-stat { padding: 14px 6px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); }
.result-stat small { display: block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.result-stat b { display: block; margin-top: 4px; font-family: var(--font-display); font-weight: 900; font-size: 24px; }
.result-stat.xp { border-color: var(--sun); background: var(--sun-soft); }
.result-stat.acc { border-color: var(--green); background: var(--green-soft); }
.result-stat.time { border-color: var(--brand); background: var(--brand-soft); }
.result-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.result-actions { display: grid; gap: 12px; margin-top: 28px; }
.result-share { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
@media (max-width: 380px) { .result-share { grid-template-columns: 1fr; } }
.review-list { text-align: left; display: grid; gap: 10px; margin-top: 24px; }
.review-item { display: flex; gap: 12px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.review-item .icon { flex: none; margin-top: 2px; }
.review-item.ok .icon { color: var(--green); }
.review-item.bad .icon { color: var(--red); }
.review-item b { display: block; font-size: 15px; }
.review-item p { font-size: 14px; color: var(--text-2); margin-top: 2px; }

/* ---------- Profile ---------- */
.profile-head { display: grid; gap: 20px; align-items: center; padding: 24px; border-radius: var(--radius-xl); background: linear-gradient(120deg, var(--brand), #0f4c5c 60%, #0f2942); color: #fff; }
.avatar { width: 88px; height: 88px; border-radius: 28px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 900; font-size: 36px; color: #fff; background: rgba(255, 255, 255, 0.2); border: 3px solid rgba(255, 255, 255, 0.5); }
.profile-head h1 { font-size: clamp(26px, 4vw, 36px); }
.level-bar { margin-top: 10px; max-width: 360px; }
.level-bar .progress { background: rgba(255, 255, 255, 0.25); }
.level-bar .progress > span { background: var(--sun); }
.level-bar small { display: block; margin-top: 6px; opacity: 0.9; font-weight: 600; }
@media (min-width: 640px) { .profile-head { grid-template-columns: auto 1fr auto; } }
.name-form { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.name-form input { flex: 1; min-width: 180px; height: 48px; padding: 0 14px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); }
.name-form input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 20px; }
@media (min-width: 760px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
@media (min-width: 640px) { .badge-grid { grid-template-columns: repeat(4, 1fr); } }
.badge-card { padding: 18px 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); text-align: center; }
.badge-card .medal { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; color: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18); }
.badge-card .medal .icon { width: 30px; height: 30px; }
.badge-card b { display: block; margin-top: 10px; font-family: var(--font-display); font-size: 15px; }
.badge-card small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.badge-card.locked .medal { background: var(--surface-3) !important; color: var(--muted); box-shadow: none; }
.badge-card.locked b { color: var(--muted); }

/* ---------- Misc ---------- */
.confetti-canvas { position: fixed; inset: 0; z-index: 600; pointer-events: none; }
.loading-screen { min-height: 60vh; display: grid; place-items: center; }
.loading-dots { display: flex; gap: 8px; }
.loading-dots span { width: 14px; height: 14px; border-radius: 50%; background: var(--brand); animation: dot 1s infinite ease-in-out; }
.loading-dots span:nth-child(2) { animation-delay: 0.15s; background: var(--teal); }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; background: var(--coral); }
@keyframes dot { 50% { transform: translateY(-12px); } }
.fade-in { animation: fade-up 0.45s var(--ease) both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* Anti-copy: no text selection on media, nothing printable */
.no-select { user-select: none; -webkit-user-select: none; }
img { -webkit-user-drag: none; user-select: none; }
@media print {
  body * { display: none !important; }
  body::after { content: "Kandungan ini dilindungi / This content is protected."; display: block !important; padding: 40px; font: 700 20px sans-serif; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Mobile tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.5) blur(14px); -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border-top: 1px solid var(--border);
}
.tabbar a { display: grid; place-items: center; align-content: center; gap: 2px; font-size: 11.5px; font-weight: 700; color: var(--muted); min-height: 44px; }
.tabbar a .icon { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--brand); }
.tabbar a[aria-current="page"] .icon { stroke-width: 2.5; }
body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) {
  .tabbar { display: none; }
  body { padding-bottom: 0; }
}
.site-footer[hidden] { display: none; }
main:focus, main:focus-visible { outline: none; box-shadow: none; }

/* Feature icon tints (readable in both themes) */
.fi-brand { background: var(--brand-soft); color: var(--brand); }
.fi-coral { background: var(--coral-soft); color: var(--coral-700); }
.fi-sun { background: var(--sun-soft); color: #8a5a00; }
.fi-teal { background: var(--teal-soft); color: var(--teal-700); }
.fi-green { background: var(--green-soft); color: var(--green-700); }
:root[data-theme="dark"] .fi-coral { color: var(--coral); }
:root[data-theme="dark"] .fi-sun { color: var(--sun); }
:root[data-theme="dark"] .fi-teal { color: var(--teal); }
:root[data-theme="dark"] .fi-green { color: var(--green); }
.footer-grid a.brand { display: inline-flex; padding: 0; color: var(--text); }
svg.icon { display: inline-block; vertical-align: -0.2em; }
.filter-bar .seg button { display: inline-flex; align-items: center; gap: 6px; }
.chapter-head .meta span { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Immersive (session-wide full screen, landscape) ---------- */
/* The box is exactly the screen (inset, not 100vw/100vh, so it can never be
   larger than the screen); the picture inside is fitted by height (contain):
   black side bars on wide screens, nothing is ever cropped. */
.player.is-immersive {
  position: fixed; inset: 0; z-index: 250;
  width: auto; height: auto; aspect-ratio: auto;
  border-radius: 0; box-shadow: none;
}
.player.is-immersive video, .player.is-immersive .poster img { object-fit: contain; }
.player.is-immersive .poster { background: #05060f; }
/* "Large text" zooms the page 1.12x; undo it for the full-screen player so
   the video is not blown up past the screen edges (cropped bottom/right). */
:root[data-text="large"] .player.is-immersive { zoom: 0.892857; }
.player.is-immersive .controls { padding: 40px max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.player.is-immersive .big-play span { width: 104px; height: 104px; }
.player.is-immersive .watermark { font-size: 15px; }
body.has-immersive { overflow: hidden; }
body.has-immersive .site-header, body.has-immersive .tabbar { visibility: hidden; }
.fs-exit {
  position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 240;
  display: none; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border-radius: 12px; background: var(--text); color: var(--bg);
  font-family: var(--font-display); font-weight: 800; font-size: 14px; box-shadow: var(--shadow-lg);
}
body.is-fullscreen:not(.has-immersive) .fs-exit { display: inline-flex; }
.quiz-intro .rule .icon, .player .shield .icon, .player .msg .icon, .player .end-card .icon-big { display: block; }

/* Never let the player box scroll (focus could shift the video inside it) */
.player { overflow: clip; }

/* Phone/tablet held upright (or the OS cannot rotate, e.g. iPhone): full
   screen is turned to landscape with CSS. When Android's orientation lock
   succeeds the viewport becomes landscape and this rule stops matching.
   Same proven technique as the odl-uum player. */
@media (orientation: portrait) and (pointer: coarse) {
  .player.is-immersive {
    inset: 0 auto auto 100vw;
    width: 100vh; width: 100dvh; height: 100vw;
    transform: rotate(90deg);
    transform-origin: top left;
  }
  .player.is-immersive .controls {
    padding-left: max(16px, env(safe-area-inset-top));
    padding-right: max(16px, env(safe-area-inset-bottom));
  }
}

/* ================================================================ upgrades */

/* ---- Topic thumbnails (course list, lesson sidebar, up-next) ---- */
.t-thumb { position: relative; display: block; width: 104px; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--cc, var(--surface-3)); flex: none; box-shadow: 0 2px 0 color-mix(in srgb, var(--cc, #000) 55%, #000); }
.t-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s var(--ease); }
a.topic-row:hover .t-thumb img, .upnext:hover .t-thumb img { transform: scale(1.06); }
.t-pct { position: absolute; top: 6px; right: 6px; padding: 1px 7px; border-radius: 999px; background: var(--sun); color: #1b1300; font: 900 12px/1.4 var(--font-display); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); }
.t-num { position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 7px; background: rgba(8, 9, 24, 0.78); color: #fff; font: 900 12px/1.4 var(--font-display); letter-spacing: 0.02em; }
.t-badge { position: absolute; bottom: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); }
.t-badge .icon { width: 13px; height: 13px; }
.t-done { background: var(--btn-green); }
.t-play { background: var(--btn-brand); }
.t-play .icon { margin-left: 1px; }
.t-soon { background: rgba(8, 9, 24, 0.72); }
.t-watched { background: var(--btn-teal); }
.t-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(8, 9, 24, 0.55); }
.t-prog i { display: block; height: 100%; background: var(--sun); }
.st-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.topic-row .sub .st-chip .icon { width: 13px; height: 13px; }
.st-done { background: var(--green-soft); color: var(--btn-green); }
.st-watched { background: var(--teal-soft); color: var(--teal-700); }
.st-partial { background: var(--surface-2); color: var(--text); }
:root[data-theme="dark"] .st-done { color: var(--green); }
:root[data-theme="dark"] .st-watched { color: var(--teal); }
.topic-row.is-soon .t-thumb img { filter: grayscale(0.7) brightness(0.85); }
@media (min-width: 640px) { .chapter .t-thumb { width: 144px; } }
.side-card .t-thumb { width: 84px; border-radius: 10px; }
.side-card .t-num { font-size: 11px; }

/* ---- Course hero: glass progress + resume ---- */
.hero-side { display: grid; gap: 10px; justify-items: start; }
.course-progress { padding: 12px 16px 12px 12px; border-radius: 20px; background: rgba(10, 12, 32, 0.55); border: 1px solid rgba(255, 255, 255, 0.16); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
@media (min-width: 760px) { .hero-side { justify-items: end; } }

/* ---- Sticky chapter jump bar ---- */
.course-toolbar { position: relative; z-index: 20; display: flex; align-items: center; gap: 10px; margin: 24px 0 18px; padding: 8px; border-radius: 18px; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--border); box-shadow: var(--shadow-md); }
.course-toolbar .filter-bar { margin: 0; flex: none; }
.chapter-jump { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 24px 2px 2px; min-width: 0; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
.chapter-jump::-webkit-scrollbar { display: none; }
.jump { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border-radius: 11px; font: 800 13.5px var(--font-display); color: var(--text-2); background: var(--surface); border: 1px solid var(--border); transition: background 0.2s, color 0.2s, border-color 0.2s; }
.jump .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cc); }
.jump:hover { color: var(--text); border-color: var(--cc); }
.jump[aria-current] { color: var(--text); border-color: var(--cc); background: color-mix(in srgb, var(--cc) 16%, var(--surface)); }
.chapter { scroll-margin-top: calc(var(--header-h) + 84px); }
@media (max-width: 639px) { .course-toolbar { flex-direction: column; align-items: stretch; gap: 8px; } .course-toolbar .filter-bar .seg { width: 100%; } .course-toolbar .filter-bar .seg button { flex: 1; justify-content: center; } }

/* ---- Lesson: up-next card + previous link ---- */
.upnext { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-top: 14px; padding: 12px; border-radius: var(--radius-lg); background: var(--surface); border: 2px solid var(--cc); box-shadow: 0 4px 0 color-mix(in srgb, var(--cc) 60%, #000); transition: transform 0.15s var(--ease); }
.upnext:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--cc) 60%, #000); }
.upnext small { display: block; font: 900 12px var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.upnext b { display: block; margin-top: 2px; font: 800 15px/1.3 var(--font-display); }
.upnext > .icon { color: var(--brand-ink); width: 22px; height: 22px; }
.prev-link { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 8px; padding: 0 4px; font-size: 14px; font-weight: 600; color: var(--muted); }
.prev-link:hover { color: var(--text); }

/* ---- Landing: try-a-question demo ---- */
.try-panel { display: grid; gap: 28px; align-items: center; padding: 28px 20px; border-radius: var(--radius-xl); background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 12%, var(--surface)), color-mix(in srgb, var(--teal) 10%, var(--surface))); border: 1px solid var(--border); }
.try-copy h2 { font-size: clamp(26px, 3.8vw, 38px); margin-top: 10px; }
.try-copy p { margin-top: 10px; font-size: 17px; color: var(--text-2); }
.try-types { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.try-card { padding: 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); min-height: 320px; }
.try-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.try-from { font-size: 13px; font-weight: 700; color: var(--muted); }
.try-card .q-prompt { font-size: clamp(18px, 2.4vw, 22px); }
.try-card .tile { min-height: 56px; font-size: 16px; }
.try-feedback { margin-top: 16px; padding: 14px 16px; border-radius: 16px; }
.try-feedback b { display: flex; align-items: center; gap: 8px; font: 900 18px var(--font-display); }
.try-feedback p { margin-top: 4px; font-size: 15px; color: var(--text); }
.try-feedback.ok { background: var(--green-soft); }
.try-feedback.ok b { color: var(--green-700); }
.try-feedback.bad { background: var(--red-soft); }
.try-feedback.bad b { color: var(--red-700); }
:root[data-theme="dark"] .try-feedback.ok b { color: var(--green); }
:root[data-theme="dark"] .try-feedback.bad b { color: var(--red); }
.try-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
@media (min-width: 900px) { .try-panel { grid-template-columns: 0.85fr 1.15fr; padding: 40px; gap: 40px; } }

/* ---- Quiz key hints (keyboard users on desktop) ---- */
kbd.k { display: none; margin-left: auto; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 8px; place-items: center; font: 800 12px var(--font-display); color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 3px; flex: none; }
.tile kbd.k + .check-box { margin-left: 10px; }
.tf-btn { position: relative; }
.tf-btn kbd.k { position: absolute; top: 10px; right: 10px; color: #fff; background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.35); }
@media (pointer: fine) { kbd.k { display: inline-grid; } }
@media (max-width: 639px) { .chapter .topic-row .go { display: none; } .chapter .topic-row { grid-template-columns: auto 1fr; } }

/* ================================================================ accounts */
/* ---- header account chip / sign-in ---- */
.acct { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 3px 12px 3px 3px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); font: 800 14px var(--font-display); color: var(--text); transition: border-color 0.2s; }
.acct:hover { border-color: var(--brand); }
.acct img { width: 36px; height: 36px; border-radius: 11px; object-fit: cover; }
.acct-login .icon { width: 18px; height: 18px; }
@media (max-width: 559px) {
  .acct { padding: 3px; }
  .acct span, .acct-login span { display: none; }
  .acct-login { width: 44px; padding: 0; }
}
.tab-avatar { width: 26px; height: 26px; border-radius: 9px; object-fit: cover; border: 2px solid transparent; }
.tabbar a[aria-current="page"] .tab-avatar { border-color: var(--brand); }

/* ---- forms ---- */
.field { display: grid; gap: 6px; }
.field label, .field .label { font: 800 14px var(--font-display); color: var(--text); }
.field input:not([type="radio"]):not([type="checkbox"]) { width: 100%; height: 52px; padding: 0 14px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); font-size: 16px; transition: border-color 0.2s, box-shadow 0.2s; }
.field input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.field input[aria-invalid="true"] { border-color: var(--red); }
.field .hint { font-size: 13px; color: var(--muted); }
.field .err { font-size: 13px; font-weight: 700; color: var(--red-700); }
:root[data-theme="dark"] .field .err { color: var(--red); }
.field .err:empty { display: none; }
.field-row { display: grid; gap: 14px; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px !important; }
.pw-toggle { position: absolute; right: 4px; top: 4px; width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; color: var(--muted); }
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
.chip-radios { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-radio, .avatar-opt { position: relative; }
.chip-radio input, .avatar-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-radio span { display: inline-grid; place-items: center; min-width: 56px; height: 44px; padding: 0 14px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); font: 900 15px var(--font-display); color: var(--text-2); cursor: pointer; transition: all 0.15s; }
.chip-radio input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.chip-radio input:focus-visible + span, .avatar-opt input:focus-visible + img { outline: 3px solid var(--focus); outline-offset: 2px; }
.avatar-picker { display: flex; flex-wrap: wrap; gap: 10px; }
.avatar-opt img { width: 64px; height: 64px; border-radius: 18px; object-fit: cover; border: 3px solid transparent; cursor: pointer; transition: transform 0.15s var(--ease-bounce), border-color 0.15s; opacity: 0.75; }
.avatar-opt input:checked + img { border-color: var(--brand); opacity: 1; transform: scale(1.06); box-shadow: 0 4px 0 var(--btn-brand-edge); }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-weight: 700; font-size: 15px; }
.check input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--btn-brand); flex: none; }
.check small { display: block; font-weight: 500; font-size: 13px; color: var(--muted); }
.form-error { font-weight: 700; color: var(--red-700); }
:root[data-theme="dark"] .form-error { color: var(--red); }
.form-error:empty { display: none; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spin 0.8s linear infinite; }
.btn-ghost.is-busy::after { border-color: var(--border); border-top-color: var(--brand); }
.link { color: var(--brand-ink); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; padding: 0 4px; }

/* ---- sign in / sign up page ---- */
.auth-page { padding-top: 24px; padding-bottom: 40px; min-height: calc(100vh - var(--header-h)); }
.auth-card { display: grid; max-width: 1040px; margin: 0 auto; border-radius: var(--radius-xl); overflow: hidden; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.auth-art { position: relative; display: none; min-height: 100%; background: #96d6d1; }
.auth-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 8%; }
.auth-art .speech { position: absolute; left: 24px; right: 24px; bottom: 24px; color: var(--text); }
.auth-main { padding: 24px 20px 28px; display: grid; gap: 14px; align-content: start; }
.auth-tabs { display: flex; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.auth-tabs button { flex: 1; height: 44px; border-radius: 11px; font: 800 15px var(--font-display); color: var(--muted); }
.auth-tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-main h1 { font-size: clamp(26px, 4vw, 34px); margin-top: 6px; }
.auth-sub { color: var(--text-2); margin-top: -6px; }
.auth-note { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--sun-soft); font-weight: 700; font-size: 14px; }
.auth-form { display: grid; gap: 16px; margin-top: 4px; }
.auth-switch { text-align: center; color: var(--text-2); font-weight: 600; }
.auth-help { display: flex; gap: 8px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.auth-help .icon { flex: none; margin-top: 2px; color: var(--teal-700); }
:root[data-theme="dark"] .auth-help .icon { color: var(--teal); }
@media (min-width: 880px) {
  .auth-card { grid-template-columns: 0.9fr 1.1fr; min-height: 640px; }
  .auth-art { display: block; }
  .auth-main { padding: 40px 48px; }
}

/* ---- profile ---- */
.avatar-lg { width: 96px; height: 96px; border-radius: 28px; object-fit: cover; border: 4px solid rgba(255, 255, 255, 0.6); box-shadow: 0 6px 0 rgba(0, 0, 0, 0.15); }
.ph-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ph-meta span { padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.18); font-size: 13px; font-weight: 700; }
.ph-level { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-weight: 800; }
.ph-level .icon { width: 18px; height: 18px; }
.profile-head .ring::before { background: var(--surface); }
.profile-head .ring > span { text-align: center; line-height: 1.05; }
.p-h2 { display: flex; align-items: center; gap: 10px; font-size: 22px; margin-top: 32px; }
.p-h2 .icon { color: var(--brand); }
.chapter-progress { display: grid; gap: 10px; margin-top: 16px; }
@media (min-width: 760px) { .chapter-progress { grid-template-columns: 1fr 1fr; } }
.cp-row { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: center; padding: 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); transition: border-color 0.2s; }
.cp-row:hover { border-color: var(--cc); }
.cp-row img { width: 72px; aspect-ratio: 16 / 10; border-radius: 10px; object-fit: cover; background: var(--cc); }
.cp-body { display: grid; gap: 4px; min-width: 0; }
.cp-body small { font: 900 11.5px var(--font-display); letter-spacing: 0.05em; text-transform: uppercase; color: var(--cc); }
.cp-body b { font-size: 14.5px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-body .progress { height: 8px; }
.cp-body .progress > span { background: var(--cc); }
.cp-count { font-size: 13px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.profile-cols { display: grid; gap: 16px; margin-top: 8px; }
@media (min-width: 900px) { .profile-cols { grid-template-columns: 1.3fr 1fr; align-items: start; } }
.p-card { padding: 22px; }
.profile-form, .password-form { display: grid; gap: 16px; margin-top: 16px; }
.profile-form .btn, .password-form .btn { justify-self: start; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; font-weight: 700; }
.setting-row + .setting-row { border-top: 1px solid var(--border); }

/* ================================================================ text size */
:root[data-text="large"] body { zoom: 1.12; }

/* ================================================================ admin panel */
.adm-link .icon { width: 18px; height: 18px; }
@media (max-width: 899px) { .adm-link span { display: none; } .adm-link { width: 44px; padding: 0; } }

.admin { display: grid; gap: 20px; padding-top: 20px; padding-bottom: 48px; }
.adm-nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.adm-nav::-webkit-scrollbar { display: none; }
.adm-nav a { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border-radius: 12px; font-weight: 700; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); }
.adm-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.adm-nav .icon { width: 18px; height: 18px; }
.adm-nav hr, .adm-brand { display: none; }
@media (min-width: 1024px) {
  .admin { grid-template-columns: 230px minmax(0, 1fr); align-items: start; }
  .adm-nav { position: sticky; top: calc(var(--header-h) + 16px); flex-direction: column; overflow: visible; padding: 14px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
  .adm-nav a { width: 100%; background: none; border: 0; }
  .adm-nav a:hover { background: var(--surface-2); }
  .adm-nav hr { display: block; width: 100%; border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
  .adm-brand { display: flex; align-items: center; gap: 8px; padding: 6px 10px 12px; font: 900 15px var(--font-display); color: var(--brand-ink); }
}
.adm-main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; }
.adm-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.adm-head h1 { font-size: clamp(26px, 3.4vw, 34px); }
.adm-head p { color: var(--text-2); margin-top: 4px; }
.adm-actions, .adm-filters, .exports { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.adm-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.adm-toolbar .exports { margin-left: auto; }
.adm-select, .adm-input { height: 42px; padding: 0 12px; border-radius: 11px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font-size: 14.5px; font-weight: 600; max-width: 100%; }
textarea.adm-input { height: auto; padding: 10px 12px; width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 13.5px; font-weight: 500; }
.adm-select:focus, .adm-input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.adm-search { display: flex; align-items: center; gap: 8px; flex: 1 1 220px; height: 42px; padding: 0 12px; border-radius: 11px; border: 1.5px solid var(--border); background: var(--surface-2); color: var(--muted); }
.adm-search input { flex: 1; min-width: 0; border: 0; background: none; height: 100%; font-size: 14.5px; }
.adm-search input:focus { outline: none; }
.adm-search:focus-within { border-color: var(--brand); box-shadow: var(--ring); }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { position: relative; padding: 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); display: grid; gap: 2px; }
.kpi b { font: 900 30px/1.1 var(--font-display); }
.kpi span { font-weight: 700; font-size: 14px; }
.kpi small { color: var(--muted); font-size: 12.5px; }
.kpi-ico { position: absolute; right: 14px; top: 14px; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; }
.kpi-ico .icon { width: 18px; height: 18px; }
.kpi .kpi-ico + b { margin-top: 2px; }

.adm-grid { display: grid; gap: 16px; }
@media (min-width: 1100px) { .adm-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.adm-card { padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.adm-card > header { margin-bottom: 12px; }
.adm-card h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.adm-card h2 .icon { color: var(--brand); }
.adm-card header p { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.empty-ok { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 600; padding: 8px 0; }
.empty-ok .icon { color: var(--teal-700); }
.more { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-weight: 800; color: var(--brand-ink); }

.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who img { width: 38px; height: 38px; border-radius: 12px; object-fit: cover; flex: none; }
.who b { display: block; font-size: 14.5px; line-height: 1.25; }
.who small { display: block; color: var(--muted); font-size: 12.5px; }
.people li a, .leaders li a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px; border-radius: 12px; min-height: 52px; }
.people li a:hover, .leaders li a:hover { background: var(--surface-2); }
.people .meta { text-align: right; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.leaders li a { justify-content: flex-start; }
.leaders .xp { margin-left: auto; font: 900 14px var(--font-display); color: var(--brand-ink); }
.rank { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font: 900 13px var(--font-display); background: var(--surface-2); flex: none; }
.rank.r1 { background: #fbbf24; color: #3b2600; } .rank.r2 { background: #cbd5e1; color: #1e293b; } .rank.r3 { background: #f59e0b80; }

.st { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.st-ok { background: var(--green-soft); color: var(--green-700); }
.st-idle { background: var(--sun-soft); color: #8a5a00; }
.st-new { background: var(--brand-soft); color: var(--brand-ink); }
.st-off { background: var(--red-soft); color: var(--red-700); }
.st-graduated { background: var(--surface-3); color: var(--text-2); }
:root[data-theme="dark"] .st-ok { color: var(--green); }
:root[data-theme="dark"] .st-idle { color: var(--sun); }
:root[data-theme="dark"] .st-off { color: var(--red); }

.mini-bar { display: block; width: 100%; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.mini-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--btn-teal); }
.pbar { display: grid; grid-template-columns: minmax(60px, 120px) auto; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }

.chap-bars { display: grid; gap: 10px; }
@media (min-width: 900px) { .chap-bars { grid-template-columns: 1fr 1fr; column-gap: 24px; } }
.chap-bar { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.chap-bar img { width: 56px; aspect-ratio: 16 / 10; border-radius: 9px; object-fit: cover; background: var(--cc); }
.chap-bar b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chap-bar small { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.chap-bar .v { font: 900 15px var(--font-display); }

.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); }
.adm-card .table-wrap { border: 0; border-radius: 0; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.adm-table th { position: sticky; top: 0; text-align: left; padding: 10px 12px; font: 800 12px var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.adm-table td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: middle; }
.adm-table tbody tr[data-id], .adm-table tbody tr[data-topic] { cursor: pointer; }
.adm-table tbody tr[data-id]:hover, .adm-table tbody tr[data-topic]:hover { background: var(--surface-2); }
.adm-table td .sub { display: block; color: var(--muted); font-size: 12px; }
.adm-table.compact td { padding: 8px 12px; }
.adm-table .ch-row td { background: color-mix(in srgb, var(--cc) 10%, var(--surface)); font: 900 13px var(--font-display); color: var(--text); border-left: 4px solid var(--cc); }
.adm-table tr.is-done .tp .icon { color: var(--green-700); }
:root[data-theme="dark"] .adm-table tr.is-done .tp .icon { color: var(--green); }
.tp { display: inline-flex; align-items: center; gap: 8px; }
.tp-thumb { width: 52px; aspect-ratio: 16 / 9; border-radius: 7px; object-fit: cover; flex: none; }
.stars-txt { color: var(--star); letter-spacing: 1px; white-space: nowrap; }
.stars-txt .off { color: var(--muted); }
:root[data-theme="dark"] .stars-txt { color: var(--sun); }
.muted { color: var(--muted); }

.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; font-weight: 700; color: var(--text-2); }
.back-link:hover { color: var(--brand-ink); }
.det-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.det-head > img { width: 84px; height: 84px; border-radius: 24px; object-fit: cover; }
.det-head h1 { font-size: clamp(24px, 3.2vw, 32px); }
.det-head h1 small { font-size: 0.6em; color: var(--muted); font-weight: 700; }
.det-head p { color: var(--text-2); margin-top: 4px; }
.det-head p.sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; }
.adm-form { display: grid; gap: 14px; }
.acct-actions { display: grid; gap: 16px; }
.acct-actions > div { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.acct-actions > div:last-child { border-bottom: 0; padding-bottom: 0; }
.acct-actions p { color: var(--muted); font-size: 13.5px; margin: 2px 0 8px; }
.cred { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin: 10px 0; padding: 14px 16px; border-radius: 14px; background: var(--sun-soft); border: 2px dashed var(--sun-700); }
.cred small { display: block; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.cred b { font: 900 18px ui-monospace, Consolas, monospace; }
.cred .btn { margin-left: auto; }
.ok-head { display: flex; align-items: center; gap: 8px; font: 900 18px var(--font-display); color: var(--green-700); }
:root[data-theme="dark"] .ok-head { color: var(--green); }
.hint { color: var(--muted); font-size: 13.5px; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--teal-soft); color: var(--text); font-size: 14px; }
.note .icon { flex: none; margin-top: 2px; color: var(--teal-700); }
.skipped { display: grid; gap: 6px; margin-top: 12px; font-size: 13.5px; color: var(--text-2); max-height: 220px; overflow: auto; }
.defaults { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px 14px; display: grid; gap: 12px; }
.defaults legend { padding: 0 6px; font: 800 13px var(--font-display); color: var(--muted); }

.q-stats { display: grid; gap: 12px; }
.q-stats li { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--border); }
.q-stats li.is-hard { border-color: var(--btn-red); background: color-mix(in srgb, var(--red) 6%, var(--surface)); }
.q-stats .qn { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font: 900 14px var(--font-display); background: var(--brand-soft); color: var(--brand-ink); }
.q-stats p { font-weight: 700; }
.q-stats small { display: block; color: var(--muted); font-size: 12.5px; margin: 2px 0 6px; }
.q-stats .pbar { grid-template-columns: minmax(80px, 240px) auto; }

.con-head { display: flex; align-items: center; gap: 12px; }
.con-head img { width: 72px; aspect-ratio: 16 / 10; border-radius: 10px; object-fit: cover; }
.con-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 0; border-top: 1px solid var(--border); }
.con-meta { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- dialogs ---- */
.dlg-backdrop { position: fixed; inset: 0; z-index: 350; display: grid; place-items: center; padding: 16px; background: var(--overlay); animation: fade-in 0.2s; }
.dlg { width: min(100%, 520px); max-height: calc(100vh - 32px); overflow: auto; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: quiz-in 0.25s var(--ease); }
.dlg.wide { width: min(100%, 720px); }
.dlg header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.dlg header h2 { font-size: 20px; }
.dlg-body { padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ================================================================ account page */
.stack { display: grid; gap: 16px; align-content: start; }
.p-h3 { font-size: 18px; margin-bottom: 4px; }
.acc-title { margin-top: 40px; }
.school-info { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.school-info dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 10px 0; }
.school-info dt { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.school-info dd { margin: 2px 0 0; font-weight: 700; }
.school-info .hint { display: flex; gap: 8px; align-items: flex-start; }
.school-info .hint .icon { flex: none; margin-top: 2px; }
.chapter-progress.one-col { grid-template-columns: 1fr; }
.badge-grid.two { grid-template-columns: repeat(2, 1fr); }
.recent-box { padding: 6px; }
.recent-box .muted { padding: 14px; }
.recent-list li a { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; }
.recent-list li a:hover { background: var(--surface-2); }
.recent-list .t-thumb { width: 84px; }
.recent-list b { display: block; font-size: 14.5px; line-height: 1.3; }
.recent-list small { color: var(--muted); font-size: 12.5px; }
.r-score { display: grid; justify-items: end; font: 900 15px var(--font-display); }
.setting-row .seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.setting-row .seg button { min-height: 38px; padding: 0 12px; border-radius: 9px; font-weight: 700; font-size: 13.5px; color: var(--muted); }
.setting-row .seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.setting-row { flex-wrap: wrap; }
.setting-row > span { display: inline-flex; align-items: center; gap: 8px; }

ol.leaders, ol.q-stats { list-style: none; margin: 0; padding: 0; }
.adm-search { min-width: 240px; }

/* publish controls */
.note.warn { background: var(--sun-soft); }
.note.warn .icon { color: #8a5a00; }
:root[data-theme="dark"] .note.warn .icon { color: var(--sun); }
a.note { font-weight: 700; }
.con-bulk { margin: -4px 0 8px; }
.vid { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px; border-radius: 14px; }
.vid.is-hidden { background: var(--sun-soft); }

/* ===================================================================== Premium / subscriptions */
.topic-row.is-locked .t-thumb img { filter: grayscale(0.85) brightness(0.8); }
.topic-row.is-locked .title { color: var(--text-2); }
.pm-lock { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: 12.5px; color: var(--sun-700); }
:root[data-theme="dark"] .pm-lock { color: var(--sun); }
.pm-lock .icon { width: 14px; height: 14px; }

.pm-page { display: grid; gap: 16px; align-content: start; }
.pm-narrow { max-width: 640px; }
.pm-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .pm-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.pm-card { padding: 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); min-width: 0; display: grid; gap: 12px; align-content: start; }
.pm-card h2 { display: flex; align-items: center; gap: 8px; font-size: 19px; }
.pm-card h2 .icon { color: var(--brand); }
.pm-off { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pm-status { grid-template-columns: auto 1fr; align-items: center; }
.pm-status p { font-weight: 700; }
.pm-status > .btn { grid-column: 1 / -1; justify-self: start; }
.pm-status .pm-badge { justify-self: start; }
.pm-badge { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; font: 800 13px var(--font-display); background: var(--surface-3); color: var(--text); }
.pm-status.is-active .pm-badge, .pm-profile.is-active .pm-badge { background: var(--green-soft); color: var(--green-700); }
.pm-status.is-trial { border-color: var(--brand); }
.pm-status.is-past_due { border-color: var(--sun-700); background: var(--sun-soft); }
:root[data-theme="dark"] .pm-status.is-active .pm-badge { color: var(--green); }
.pm-perks { display: grid; gap: 8px; }
.pm-perks li { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; }
.pm-perks .icon { color: var(--green-700); flex: none; margin-top: 3px; }
:root[data-theme="dark"] .pm-perks .icon { color: var(--green); }
.pm-price { display: flex; align-items: baseline; gap: 6px; }
.pm-price b { font: 900 40px/1 var(--font-display); }
.pm-price span { color: var(--muted); font-weight: 700; }
.pm-lines { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14.5px; }
.pm-lines dd { margin: 0; text-align: right; font-weight: 700; }
.pm-lines dt { color: var(--text-2); }
.pm-note { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); }
.pm-note .icon { flex: none; margin-top: 2px; color: var(--teal-700); }
.pm-promo-row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.pm-promo-row input { flex: 1 1 140px; text-transform: uppercase; }
.pm-promo-msg { min-height: 20px; font-size: 13.5px; font-weight: 700; }
.pm-promo-msg.ok { color: var(--green-700); }
.pm-promo-msg.bad { color: var(--red-700); }
:root[data-theme="dark"] .pm-promo-msg.ok { color: var(--green); }
:root[data-theme="dark"] .pm-promo-msg.bad { color: var(--red); }
.pm-form { display: grid; gap: 12px; }
.pm-payer { border: 1.5px solid var(--border); border-radius: 14px; padding: 14px; display: grid; gap: 12px; min-width: 0; }
.pm-payer legend { display: flex; align-items: center; gap: 6px; padding: 0 6px; font: 800 15px var(--font-display); }
.pm-consent { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.pm-consent input { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.pm-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pm-link { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: var(--brand-soft); }
.pm-link input { width: 100%; }
.pm-link-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pm-history { display: grid; gap: 6px; }
.pm-history li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.pm-history li:last-child { border-bottom: 0; }
.pm-history small { display: block; color: var(--muted); font-size: 12.5px; }
.pm-pay { font-weight: 800; font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--surface-3); }
.pm-pay.is-paid { background: var(--green-soft); color: var(--green-700); }
.pm-pay.is-failed { background: var(--red-soft); color: var(--red-700); }
:root[data-theme="dark"] .pm-pay.is-paid { color: var(--green); }
:root[data-theme="dark"] .pm-pay.is-failed { color: var(--red); }
.pm-result { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-radius: 14px; font-weight: 700; }
.pm-result.ok { background: var(--green-soft); color: var(--green-700); }
.pm-result.bad { background: var(--red-soft); color: var(--red-700); }
.pm-result.wait { background: var(--sun-soft); color: var(--text); }
:root[data-theme="dark"] .pm-result.ok { color: var(--green); }
:root[data-theme="dark"] .pm-result.bad { color: var(--red); }
.pm-result-slot:empty { display: none; }
.pm-profile { grid-template-columns: 1fr auto; align-items: center; margin-bottom: 16px; }
.pm-profile h2 { font-size: 17px; }
@media (max-width: 520px) { .pm-profile { grid-template-columns: 1fr; } }

.pm-wall { max-width: 560px; margin: 28px auto; text-align: center; display: grid; gap: 14px; justify-items: center; padding: 28px 22px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
.pm-wall-ico { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; background: var(--sun-soft); color: var(--sun-700); }
.pm-wall-ico .icon { width: 34px; height: 34px; }
.pm-wall h1 { font-size: clamp(22px, 4vw, 28px); }
.pm-wall p { color: var(--text-2); }
.pm-wall-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.pm-back { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--brand-ink); min-height: 44px; }

.pm-banner { background: var(--sun-soft); border-bottom: 1px solid var(--sun-700); }
.pm-banner .container { display: flex; align-items: center; gap: 10px; min-height: 48px; padding-top: 6px; padding-bottom: 6px; font-weight: 700; font-size: 14px; }
.pm-banner .container > span { flex: 1; min-width: 0; }
.pm-banner .icon { flex: none; }
/* Last reminder (1 day left / overdue): red, announced as an alert. */
.pm-banner.is-urgent { background: var(--red-soft); border-bottom-color: var(--red); }
.pm-banner.is-urgent .container > .icon { color: var(--red-700); }
:root[data-theme="dark"] .pm-banner.is-urgent .container > .icon { color: var(--red); }

/* Only the video or only the quiz of a topic is Premium. */
.pm-part-lock { display: grid; gap: 12px; align-items: center; }
@media (min-width: 640px) { .pm-part-lock { grid-template-columns: auto 1fr auto; } }
.pm-part-lock .q-ico { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--sun-soft); color: var(--sun-700); }
:root[data-theme="dark"] .pm-part-lock .q-ico { color: var(--sun); }
.pm-part-lock .q-ico .icon { width: 28px; height: 28px; }
.pm-part-lock h3 { font-size: 18px; }
.pm-part-lock p { color: var(--text-2); font-size: 14.5px; margin-top: 2px; }
.pm-player-lock { display: grid; place-items: center; }
.pm-player-lock .poster img { filter: blur(6px) brightness(0.45); }
.pm-player-lock .pm-part-lock { position: relative; z-index: 1; max-width: 520px; margin: 16px; padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); text-align: left; color: var(--text); grid-template-columns: auto 1fr; }
.pm-player-lock .pm-part-lock > .btn { grid-column: 1 / -1; justify-self: start; }
.pm-player-lock .pm-part-lock h3 { color: var(--text); }

.chip-red { background: var(--red-soft); color: var(--red-700); border-color: transparent; }
:root[data-theme="dark"] .chip-red { color: #fecaca; }

/* Admin: per-topic Free/Premium marks, reminders, devices, 2-step sign-in */
.pa-topics { margin-top: 10px; flex: 1 0 100%; width: 100%; }
.pa-free > .hint, .pa-free > .err { flex: 1 0 100%; margin: 0; }
.pa-topics summary { cursor: pointer; font-weight: 800; min-height: 44px; display: flex; align-items: center; }
.pa-topic-list { display: grid; gap: 6px; max-height: 420px; overflow: auto; padding-right: 4px; }
.pa-topic { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.pa-topic > span { min-width: 0; font-size: 14px; }
.pa-topic select { flex: none; width: auto; min-width: 130px; }
.pa-rem-actions { display: flex; flex-wrap: wrap; gap: 6px; }
tr.is-done td { opacity: 0.7; }
.dev-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.dev-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.dev-list li > span { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dev-list small { display: block; color: var(--muted); font-size: 13px; }
.dev-list.compact li { padding: 6px 10px; }
.auth-note.is-warn { background: var(--sun-soft); }
.tf-panel { display: grid; gap: 12px; }
.tf-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tf-state.is-on .icon { color: var(--btn-green); }
.tf-steps { display: grid; gap: 14px; padding-left: 20px; }
.tf-key code { font-size: 18px; letter-spacing: 1px; word-break: break-all; padding: 8px 10px; display: inline-block; border-radius: 8px; background: var(--surface-2, var(--bg)); border: 1px solid var(--border); }
.tf-key-actions, .tf-actions, .tf-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tf-row input { width: 160px; letter-spacing: 3px; font-size: 18px; }
.tf-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; padding-left: 20px; }
.tf-codes code { font-size: 16px; }
.tf-backup { display: grid; gap: 8px; padding: 12px; border-radius: var(--radius); border: 1px dashed var(--border); }

.warn-txt { color: var(--sun-700); font-weight: 700; }
:root[data-theme="dark"] .warn-txt { color: var(--sun); }
.pa-legal-links { display: flex; flex-wrap: wrap; gap: 8px; }

/* Legal pages (#/dokumen/...) */
.lg-page { max-width: 860px; }
.lg-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.lg-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); font-weight: 800; color: var(--text); background: var(--surface); }
.lg-nav a[aria-current="page"] { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-soft, var(--surface-2)); }
.lg-doc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(18px, 4vw, 34px); line-height: 1.65; }
.lg-doc h2 { font-size: clamp(24px, 4vw, 32px); margin-bottom: 10px; }
.lg-doc h3 { font-size: 19px; margin: 22px 0 8px; }
.lg-doc h4 { font-size: 16px; margin: 16px 0 6px; }
.lg-doc p, .lg-doc li { color: var(--text-2); margin: 6px 0; }
.lg-doc ul, .lg-doc ol { padding-left: 22px; }
.lg-doc .note { margin: 10px 0; }
.lg-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 14px; }
.lg-table th, .lg-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.lg-fill { background: var(--sun-soft); color: var(--sun-700); font-weight: 800; padding: 0 3px; border-radius: 4px; }
:root[data-theme="dark"] .lg-fill { color: var(--sun); }
.lg-accept { margin-top: 10px; }
.lg-accept a { color: var(--brand-ink); font-weight: 800; text-decoration: underline; }
/* Admin header on narrow phones: the account chip must fit (375px). */
@media (max-width: 400px) { .header-actions { gap: 4px; } }

/* Premium plans (1 / 6 / 12 months), referral and parent dashboard */
.pm-plans { border: 0; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.pm-plans legend { font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.pm-plan { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; background: var(--surface); }
.pm-plan:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.pm-plan input { width: 18px; height: 18px; accent-color: var(--brand); }
.pm-plan small { display: block; color: var(--btn-green, var(--brand-ink)); font-weight: 800; font-size: 12px; }
:root[data-theme="dark"] .pm-plan small { color: #86efac; }
.pm-ref-code { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; }
.pm-ref-code code { font-size: 22px; letter-spacing: 3px; padding: 4px 10px; border-radius: 8px; border: 1px dashed var(--border); }
.par-courses { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 12px; }
.par-courses li { display: grid; gap: 4px; }
.par-courses li > span:first-child { font-weight: 800; }
.par-bar { display: grid; gap: 4px; }
.par-bar small { color: var(--muted); }

/* XP competitions */
.cp-banner { display: flex; align-items: center; gap: 12px; margin: 14px 0; padding: 12px 16px; min-height: 56px; border-radius: var(--radius-lg); background: var(--sun-soft); border: 1px solid var(--sun-700); color: var(--text); }
.cp-banner > span { flex: 1; min-width: 0; display: grid; }
.cp-banner small { color: var(--text-2); }
.cp-banner > .icon:first-child { color: var(--sun-700); width: 28px; height: 28px; }
:root[data-theme="dark"] .cp-banner > .icon:first-child { color: var(--sun); }
.cp-season { display: grid; gap: 10px; }
.cp-season.is-live { border-color: var(--brand); }
.cp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cp-head h2 { display: flex; align-items: center; gap: 8px; }
.cp-season h3 { display: flex; align-items: center; gap: 6px; font-size: 16px; margin-top: 6px; }
.cp-me { font-weight: 800; display: flex; align-items: center; gap: 6px; }
.cp-grid { display: grid; gap: 16px; }
@media (min-width: 760px) { .cp-grid { grid-template-columns: 1fr 1fr; } }
.cp-board { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.cp-board li { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.cp-board li.is-me { border-color: var(--brand); background: var(--brand-soft); }
.cp-board li.cp-gap { margin-top: 8px; border-style: dashed; }
.cp-rank { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3, var(--border)); font-weight: 800; font-size: 14px; }
.cp-board li:nth-child(1) .cp-rank { background: #fde68a; color: #713f12; }
.cp-board li:nth-child(2) .cp-rank { background: #e5e7eb; color: #1f2937; }
.cp-board li:nth-child(3) .cp-rank { background: #fed7aa; color: #7c2d12; }
.cp-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cp-prizes { padding-left: 20px; display: grid; gap: 4px; }
.cp-rules summary { cursor: pointer; font-weight: 800; min-height: 44px; display: flex; align-items: center; }
.cp-rules ul { padding-left: 20px; display: grid; gap: 4px; color: var(--text-2); }
.cp-prize-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; width: 100%; margin-bottom: 6px; }
.cp-prize-row .adm-select { width: auto; }
.cp-prize-row [data-p="label"] { flex: 1; min-width: 140px; }
.cp-prizes-edit .js-prizes { width: 100%; }

/* Learn page: lower forms for revision, under the student's own form. */
.review-sec { margin-top: 34px; }
.review-sec h2 { display: flex; align-items: center; gap: 8px; font-size: clamp(20px, 3vw, 24px); }
.review-sec .page-sub { margin-bottom: 14px; }

/* Admin: Langganan */
.pa-tabs { gap: 6px; }
.pa-form { display: grid; gap: 16px; }
.pa-switch { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.pa-switch input { width: 26px; height: 26px; flex: none; }
.pa-switch small { display: block; color: var(--muted); font-size: 13px; }
.pa-prices { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; margin-bottom: 8px; }
.pa-row { grid-template-columns: minmax(150px, 260px) minmax(0, 1fr); align-items: start; gap: 12px; margin-top: 10px; }
.pa-row .adm-select, .dlg .adm-select, .dlg .adm-input { max-width: 100%; }
@media (max-width: 640px) { .pa-row { grid-template-columns: minmax(0, 1fr); gap: 4px; } }
.pa-check { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-weight: 600; cursor: pointer; }
.pa-check input { width: 20px; height: 20px; }
.pa-free { border: 1.5px solid var(--border); border-radius: 12px; padding: 10px 12px; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 8px 14px; }
.pa-free legend { padding: 0 6px; font: 800 13px var(--font-display); color: var(--text-2); }
.pa-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; min-height: 32px; cursor: pointer; }
.pa-chip input { width: 18px; height: 18px; }
.pa-save { position: sticky; bottom: 12px; display: flex; justify-content: flex-end; }
.pa-bars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; align-items: end; height: 190px; }
@media (max-width: 520px) { .pa-bars { gap: 4px; } .pa-bar b { font-size: 10.5px; } }
.pa-bar { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; text-align: center; }
.pa-bar-fill { display: block; width: 70%; min-height: 3px; border-radius: 8px 8px 0 0; background: var(--btn-teal); }
.pa-bar b { font-size: 12.5px; margin-top: 4px; max-width: 100%; overflow-wrap: anywhere; line-height: 1.15; }
.pa-bar small { color: var(--muted); font-size: 12px; }
.pa-grant { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 14px; }
.pa-grant h3 { font-size: 16px; }

/* Admin > Analitik */
.an-ins { display: grid; gap: 8px; }
.an-ins li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; line-height: 1.45; }
.an-ins li .icon { flex: none; margin-top: 2px; }
.an-ins .an-warn { background: var(--red-soft); } .an-ins .an-warn .icon { color: var(--red-700); }
.an-ins .an-video .icon { color: var(--brand); } .an-ins .an-quiz .icon { color: #8a5a00; } .an-ins .an-info .icon { color: var(--teal-700); }
:root[data-theme="dark"] .an-ins .an-warn .icon { color: var(--red); }
:root[data-theme="dark"] .an-ins .an-quiz .icon { color: var(--sun); }
.an-funnel { display: grid; gap: 10px; padding: 0; list-style: none; }
.an-funnel li { display: grid; grid-template-columns: minmax(110px, 150px) 1fr auto 44px; align-items: center; gap: 10px; font-size: 14px; }
.an-funnel .an-step { font-weight: 700; }
.an-funnel small { color: var(--muted); text-align: right; }
.an-fbar { display: block; height: 14px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.an-fbar > span { display: block; height: 100%; border-radius: inherit; background: var(--btn-teal); }
.an-note { font-size: 12.5px; margin-top: 10px; }
.an-forms { display: grid; gap: 8px; }
.an-forms li { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; border-radius: 12px; background: var(--surface-2); }
.an-forms li b { font: 900 16px var(--font-display); width: 36px; }
.an-forms li .st { margin-left: auto; }
.an-vt td small { display: block; }
.an-curve { display: inline-flex; align-items: flex-end; gap: 2px; height: 32px; width: 120px; }
.an-curve > span { flex: 1; background: var(--btn-teal); border-radius: 2px 2px 0 0; min-height: 1px; }
.an-wrong { display: flex !important; align-items: center; gap: 6px; margin-top: 6px !important; color: var(--red-700) !important; font-weight: 700; }
:root[data-theme="dark"] .an-wrong { color: var(--red) !important; }
@media (max-width: 520px) { .an-funnel li { grid-template-columns: 1fr auto 40px; } .an-funnel .an-fbar { grid-column: 1 / -1; grid-row: 2; } }
.hub-formnote { margin: 4px 0 18px; }
.hub-formnote .btn { margin: 8px 6px 0 0; min-height: 44px; }
.subject-pill .soon-tag { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 800; }

/* Admin -> Langsung (live activity): dense rows for hundreds of students, controls that survive each refresh */
.lv-head-actions { align-items: center; gap: 12px; }
.lv-upd { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.lv-pulse { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--green); animation: lv-pulse 2s infinite; }
.is-paused .lv-pulse { background: var(--muted); animation: none; }
@keyframes lv-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }
@media (prefers-reduced-motion: reduce) { .lv-pulse { animation: none; } }
.lv-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.lv-search { position: relative; flex: 1 1 240px; display: flex; }
.lv-search > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.lv-search input { width: 100%; padding-left: 38px; min-height: 44px; }
.lv-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2, var(--surface-3)); }
.lv-seg button { min-height: 36px; padding: 0 12px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.lv-seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.lv-seg button:focus-visible, .lv-gbtn:focus-visible { outline: 3px solid var(--focus, var(--btn-brand)); outline-offset: 2px; }
.lv-cnt { font-variant-numeric: tabular-nums; font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); }
.lv-list, .lv-feed, .lv-glist { list-style: none; margin: 0; padding: 0; }
.lv-list li { display: grid; grid-template-columns: minmax(0, 230px) minmax(0, 1fr) 92px; gap: 6px 16px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }
.lv-list li:first-child { border-top: 0; }
.lv-who { color: inherit; text-decoration: none; min-height: 44px; display: flex; align-items: center; border-radius: 10px; min-width: 0; }
.lv-who .who img { width: 32px; height: 32px; }
.lv-who:hover b { text-decoration: underline; }
.lv-doing { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 14px; }
.lv-what { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.lv-what > .icon { flex: none; margin-top: 2px; }
.lv-what > span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lv-k { font-weight: 800; }
.lv-prog { display: flex; align-items: center; gap: 10px; }
.lv-prog .mini-bar { flex: 1; max-width: 240px; }
.lv-prog small, .lv-meta { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; }
.lv-meta { text-align: right; }
.lv-more { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; }
.lv-chip { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; padding: 6px 6px 6px 12px; border-radius: 12px; background: var(--surface-2, var(--surface-3)); font-weight: 700; font-size: 14px; }
.lv-glist { display: grid; gap: 6px; }
.lv-gbtn { width: 100%; min-height: 48px; display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(60px, 160px) 36px; gap: 12px; align-items: center; padding: 6px 10px; border-radius: 12px; text-align: left; color: inherit; border: 1px solid transparent; }
.lv-gbtn:hover { background: var(--surface-2, var(--surface-3)); }
.lv-gbtn[aria-pressed="true"] { border-color: var(--btn-brand); background: var(--surface-2, var(--surface-3)); }
.lv-gname { display: flex; flex-direction: column; min-width: 0; }
.lv-gname b, .lv-gname small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-gname small { color: var(--muted); font-size: 12px; }
.lv-gbar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.lv-gbar > span { display: block; height: 100%; border-radius: inherit; background: var(--btn-teal); }
.lv-gn { font-size: 18px; text-align: right; font-variant-numeric: tabular-nums; }
.lv-feed li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }
.lv-feed li:first-child { border-top: 0; }
.lv-feed li > .icon { color: var(--muted); margin-top: 3px; }
.lv-feed a { color: inherit; }
.lv-feed time { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .lv-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .lv-list .lv-doing { grid-column: 1 / -1; grid-row: 2; }
  .lv-gbtn { grid-template-columns: auto minmax(0, 1fr) 36px; }
  .lv-gbar { display: none; }
  .lv-tools > label:not(.lv-search) { flex: 1 1 140px; }
  .lv-tools select { width: 100%; }
}
/* Lesson part buttons: watched mark (owner 2026-11-22) */
.part-btn .pt-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.part-btn .pw { flex: none; font-size: 12px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.part-btn .pw-done { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green-700); }
.part-btn .pw-done .icon { width: 14px; height: 14px; }
.part-btn.is-watched > .icon { color: var(--green-700); }
:root[data-theme="dark"] .part-btn .pw-done { color: var(--green); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .part-btn .pw-done { color: var(--green); } }