/* =========================================================================
   Folio · styles
   Layout idea: a cool paper desk — pale page, blue ink, navy type,
   chunky "press-able" buttons and a winding road of lessons in the center.
   ========================================================================= */
:root {
  /* palette (all around blue) */
  --pri: #1F5FD6;
  --pri-text: #1F5FD6;     /* accent used as text/icon color */
  --pri-strong: #1749A8;
  --navy: #0B2559;
  --sky: #4C9AFF;
  --mist: #E5EEFF;
  --mist-2: #CFE0FF;
  --cream: #F5F8FF;
  --paper: #FFFFFF;
  --ink: #0B1B3A;          /* body text: navy-black (AA on cream) */
  --ink-soft: #3D5078;     /* secondary text (AA on cream/white) */
  --line: #D7E2F5;
  --line-soft: #C5D5F0;
  --on-red: #FFFFFF;
  --locked: #E1E7F2;
  --locked-ink: #5E6E8C;
  --char: #2A3142;
  --ash: #8A93A6;
  --flame-dim1: #C3CFE6; --flame-dim2: #D9E2F2; --flame-dim3: #F0F4FC;
  --shadow: 0 1px 2px rgba(11, 37, 89, .06), 0 8px 24px -8px rgba(11, 37, 89, .18);
  --shadow-lg: 0 2px 4px rgba(11, 37, 89, .06), 0 24px 48px -16px rgba(11, 37, 89, .28);
  /* mascot */
  --m-ink: #0E2350; --m-pri: #1F5FD6; --m-paper: #FFFDF8; --m-cheek: #FF9AA6; --m-line: #BFD3F7;
  --m-tongue: #FF9AA6; --m-wood: #F6D7B0; --m-tear: #BFE0FF; --m-shadow: rgba(11, 37, 89, .12);
  /* type */
  --f-display: 'Fredoka', 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  --f-body: 'Nunito Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --r-sm: 10px; --r: 16px; --r-lg: 24px;
  --hdr-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --pri: #2F6BEA; --pri-text: #8AB8FF; --pri-strong: #3D6FE0; --navy: #071633; --sky: #7FB2FF; --mist: #13254A; --mist-2: #1B3260;
    --cream: #0A1226; --paper: #111C36; --ink: #EAF1FF; --ink-soft: #AFC1E6; --line: #22355E; --line-soft: #2C4270;
    --locked: #1B2A4A; --locked-ink: #9FB0D2; --char: #0E1424; --ash: #7C879E;
    --flame-dim1: #2E3E60; --flame-dim2: #3A4C70; --flame-dim3: #4A5D82;
    --m-paper: #FFF3EE; --m-shadow: rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --pri: #2F6BEA; --pri-text: #8AB8FF; --pri-strong: #3D6FE0; --navy: #071633; --sky: #7FB2FF; --mist: #13254A; --mist-2: #1B3260;
  --cream: #0A1226; --paper: #111C36; --ink: #EAF1FF; --ink-soft: #AFC1E6; --line: #22355E; --line-soft: #2C4270;
  --locked: #1B2A4A; --locked-ink: #9FB0D2; --char: #0E1424; --ash: #7C879E;
  --flame-dim1: #2E3E60; --flame-dim2: #3A4C70; --flame-dim3: #4A5D82;
  --m-paper: #FFF3EE; --m-shadow: rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--hdr-h) + 16px); }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font: 400 16px/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--cream); }
img, svg { max-width: 100%; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4, h5 { margin: 0; font-family: var(--f-display); font-weight: 600; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }
kbd { font: 700 .82em/1 var(--f-body); padding: .25em .5em; border-radius: 6px; background: var(--paper); border: 1px solid var(--line-soft); box-shadow: 0 2px 0 var(--line-soft); color: var(--ink); white-space: nowrap; }
.display { font-size: clamp(2.3rem, 5.4vw, 4rem); font-weight: 700; letter-spacing: -.01em; }
.display em { font-style: normal; color: var(--pri-text); position: relative; white-space: nowrap; }
.display em::after { content: ""; position: absolute; left: 0; right: 0; bottom: .02em; height: .2em; background: var(--mist-2); z-index: -1; border-radius: 4px; }
.h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
.h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); }
.h3 { font-size: 1.2rem; }
.lead { font-size: 1.12rem; color: var(--ink-soft); max-width: 60ch; }
.eyebrow { font: 800 .74rem/1.2 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--pri-text); display: inline-flex; align-items: center; gap: .4em; }
.eyebrow .ico { width: 1.2em; height: 1.2em; }
.fine { font-size: .86rem; color: var(--ink-soft); }
.center { text-align: center; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grow { flex: 1; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; border-radius: 8px; }

.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico .a { fill: var(--mist-2); }

/* ------------------------------------------------------------ buttons */
.btn {
  --b: var(--paper); --bt: var(--ink); --bs: var(--line-soft);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: .7em 1.4em; border: 2px solid transparent; border-radius: 14px;
  background: var(--b); color: var(--bt); font: 800 .95rem/1 var(--f-body); letter-spacing: .04em; text-transform: uppercase;
  box-shadow: 0 4px 0 var(--bs); cursor: pointer; transition: transform .08s, box-shadow .08s, filter .15s; text-decoration: none;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--bs); }
.btn:disabled { --b: var(--locked); --bt: var(--locked-ink); --bs: var(--line-soft); cursor: not-allowed; filter: none; transform: none; }
.btn-primary { --b: var(--pri); --bt: var(--on-red); --bs: var(--navy); }
.btn-primary:hover { --b: var(--pri-strong); }
.btn-dark { --b: var(--navy); --bt: #fff; --bs: #06152F; }
.btn-ghost { --b: var(--paper); --bt: var(--pri-text); --bs: var(--line-soft); border-color: var(--line-soft); }
.btn-sm { min-height: 38px; padding: .5em 1em; font-size: .8rem; border-radius: 12px; }
.btn-xl { min-height: 58px; padding: .9em 2em; font-size: 1.05rem; border-radius: 16px; }
.btn-block { width: 100%; }
.btn .ico { width: 20px; height: 20px; }
.link { background: none; border: 0; padding: .3em 0; color: var(--pri-text); font-weight: 800; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; text-decoration-color: var(--mist-2); }
.link:hover { text-decoration-color: var(--pri-text); }
.icon-btn { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; }
.icon-btn:hover { background: var(--mist); color: var(--pri-text); }
.pill { display: inline-flex; align-items: center; gap: .3em; padding: .25em .7em; border-radius: 999px; background: var(--mist); color: var(--pri-strong); font: 800 .72rem/1.2 var(--f-body); letter-spacing: .04em; text-transform: uppercase; }
.pill .ico { width: 14px; height: 14px; }
.pill-premium { background: var(--navy); color: #D6E4FF; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ header */
#header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; background: color-mix(in srgb, var(--cream) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.hdr { display: flex; align-items: center; gap: 8px; max-width: 1180px; margin: 0 auto; min-height: var(--hdr-h); padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; gap: 6px; background: none; border: 0; cursor: pointer; padding: 0; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 40px; }
.brand-name { font: 700 1.45rem/1 var(--f-display); color: var(--pri-text); letter-spacing: -.01em; white-space: nowrap; }
.brand-sub { color: var(--navy); font-weight: 600; }
:root[data-theme="dark"] .brand-sub { color: var(--sky); }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 40px; padding: 0 10px; border-radius: 12px; border: 2px solid transparent; background: transparent; font: 800 1rem/1 var(--f-body); color: var(--ink); cursor: pointer; }
button.chip:hover, .chip.is-sel { background: var(--mist); border-color: var(--mist-2); }
.chip .ico { width: 22px; height: 22px; color: var(--pri-text); }
.points-chip { cursor: default; }
.points-chip .ico { fill: var(--mist-2); }
.chip-txt { font-size: .85rem; }
.streak-ico { width: 28px; height: 28px; flex: none; }
.streak-chip.is-active .chip-num { color: #C85A0E; }
:root[data-theme="dark"] .streak-chip.is-active .chip-num { color: #FFB020; }
.streak-chip.is-danger { background: var(--mist); animation: nudge 2.4s ease-in-out infinite; }
.lang { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--mist); border: 1px solid var(--mist-2); }
.lang button { border: 0; background: transparent; padding: 6px 9px; border-radius: 9px; font: 800 .78rem/1 var(--f-body); color: var(--ink-soft); cursor: pointer; letter-spacing: .05em; }
.lang button.is-sel { background: var(--paper); color: var(--pri-text); box-shadow: 0 2px 0 var(--line-soft); }
.avatar-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--mist-2); background: var(--pri); color: #fff; font: 700 1.05rem/1 var(--f-display); cursor: pointer; flex: none; }
.avatar-btn.is-sel { border-color: var(--navy); }
.avatar-btn .crown { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); color: var(--sky); }
.avatar-btn .crown .ico { width: 16px; height: 16px; fill: var(--sky); }

/* ------------------------------------------------------------ views */
#app { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-bottom: 48px; }
.view-lesson, .view-exam { padding: 0 !important; }

/* ------------------------------------------------------------ mascot */
.mascot { display: block; overflow: visible; flex: none; }
.m-cursor { animation: blink 1.05s steps(1) infinite; }
.m-idle { animation: idle 3.2s ease-in-out infinite; transform-origin: 60px 130px; }
.m-bounce { animation: bounce .9s ease-in-out infinite; transform-origin: 60px 130px; }
.m-breathe { animation: breathe 3.6s ease-in-out infinite; transform-origin: 60px 130px; }
.m-shiver { animation: shiver .5s ease-in-out infinite; transform-origin: 60px 130px; }
.m-wave { animation: wave 1.1s ease-in-out infinite; transform-origin: 95px 76px; }
.m-cheer { animation: cheer .9s ease-in-out infinite; transform-origin: 60px 76px; }
.m-zzz { animation: zzz 2.4s ease-in-out infinite; }
.m-tear, .m-sweat { animation: drip 2s ease-in infinite; }
.m-spark { animation: sparkle 1.2s ease-in-out infinite; transform-origin: center; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes idle { 50% { transform: translateY(-2px) rotate(-1deg); } }
@keyframes bounce { 50% { transform: translateY(-7px); } }
@keyframes breathe { 50% { transform: scale(1.02, .98); } }
@keyframes shiver { 25% { transform: translateX(-.8px); } 75% { transform: translateX(.8px); } }
@keyframes wave { 50% { transform: rotate(-16deg); } }
@keyframes cheer { 50% { transform: translateY(-3px); } }
@keyframes zzz { 50% { transform: translate(3px, -4px); opacity: .5; } }
@keyframes drip { 0% { transform: translateY(0); opacity: 1; } 80% { transform: translateY(8px); opacity: 0; } 100% { opacity: 0; } }
@keyframes sparkle { 50% { transform: scale(.7); opacity: .6; } }

.mascot-says { display: flex; align-items: flex-end; gap: 12px; }
.bubble { position: relative; background: var(--paper); border: 2px solid var(--line-soft); border-radius: 18px; padding: 12px 16px; font-weight: 700; box-shadow: var(--shadow); max-width: 34ch; margin-bottom: 26px; }
.bubble::before { content: ""; position: absolute; left: -10px; bottom: 16px; width: 16px; height: 16px; background: var(--paper); border-left: 2px solid var(--line-soft); border-bottom: 2px solid var(--line-soft); transform: rotate(45deg); }

/* ------------------------------------------------------------ landing */
.landing { max-width: 1180px; margin: 0 auto; display: grid; gap: clamp(64px, 9vw, 112px); padding-top: 24px; }
.hero { display: grid; grid-template-columns: 1.08fr 1fr; gap: 40px; align-items: center; }
.hero-copy { display: grid; gap: 22px; min-width: 0; }
.hero-cta { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.trust { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px 22px; font-weight: 700; color: var(--ink-soft); font-size: .95rem; }
.trust li { display: inline-flex; align-items: center; gap: 6px; }
.trust .ico { color: var(--pri-text); width: 20px; height: 20px; }
.hero-folio .bubble { margin-bottom: 40px; }
.hero-visual { position: relative; height: 600px; border-radius: 32px; overflow: hidden; background: linear-gradient(160deg, var(--mist), var(--cream)); border: 1px solid var(--line); min-width: 0; }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .75; }
.b1 { width: 340px; height: 340px; background: var(--sky); top: -60px; right: -80px; animation: drift 14s ease-in-out infinite; }
.b2 { width: 300px; height: 300px; background: var(--pri); bottom: -80px; left: -60px; opacity: .45; animation: drift 18s ease-in-out infinite reverse; }
.b3 { width: 220px; height: 220px; background: var(--mist-2); top: 40%; left: 30%; animation: drift 11s ease-in-out infinite; }
@keyframes drift { 50% { transform: translate(30px, 40px) scale(1.08); } }
.marquee { position: absolute; inset: 0; overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent); }
.marquee-track { display: grid; gap: 16px; padding: 16px clamp(16px, 8%, 56px); animation: scrollY 48s linear infinite; }
.hero-visual:hover .marquee-track { animation-play-state: paused; }
@keyframes scrollY { to { transform: translateY(calc(-50% - 8px)); } }
.pv-card { background: color-mix(in srgb, var(--paper) 82%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid color-mix(in srgb, var(--paper) 60%, var(--line)); border-radius: 20px; padding: 16px 18px; box-shadow: var(--shadow); display: grid; gap: 10px; }
.pv-card:nth-child(even) { margin-left: 28px; } .pv-card:nth-child(3n) { margin-right: 22px; }
.pv-top { display: flex; align-items: center; gap: 10px; }
.pv-num { font: 700 .95rem/1 var(--f-display); color: #fff; background: var(--pri); border-radius: 10px; padding: 6px 8px; box-shadow: 0 3px 0 var(--navy); }
.pv-card.is-premium .pv-num { background: var(--navy); box-shadow: 0 3px 0 #000; }
.pv-unit { font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-card h3 { font-size: 1.12rem; }
.mini-tool { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mini-path { font-size: .78rem; font-weight: 700; color: var(--ink-soft); }
.mini-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: var(--paper); border: 2px solid var(--pri); color: var(--ink); font-weight: 800; font-size: .85rem; animation: hlpulse 1.8s ease-out infinite; }
.mini-btn .ico { color: var(--pri-text); width: 18px; height: 18px; }
.mini-tool > .ico { color: var(--pri-text); }

.boxes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.box { padding: 28px; display: grid; gap: 12px; align-content: start; transition: transform .2s, box-shadow .2s; }
.box:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.box-ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--mist); color: var(--pri-text); transform: rotate(-4deg); box-shadow: 0 4px 0 var(--mist-2); }
.box-ico .ico { width: 30px; height: 30px; }
.box p { color: var(--ink-soft); }
.sec-head { display: grid; gap: 10px; justify-items: center; text-align: center; margin-bottom: 32px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; counter-reset: s; position: relative; }
.step { background: var(--paper); border-radius: var(--r-lg); padding: 28px 24px; border: 1px solid var(--line); display: grid; gap: 10px; align-content: start; position: relative; }
.step p { color: var(--ink-soft); }
.step-n { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--pri); color: #fff; font: 700 1.4rem/1 var(--f-display); box-shadow: 0 4px 0 var(--navy); }
.ribbon-demo .demo-host { max-width: 920px; margin: 0 auto; }
.table-wrap { overflow-x: auto; max-width: 820px; margin: 0 auto; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--paper); box-shadow: var(--shadow); }
.plan-table { width: 100%; border-collapse: collapse; min-width: 520px; }
.plan-table th, .plan-table td { padding: 14px 18px; text-align: center; border-bottom: 1px solid var(--line); }
.plan-table tbody th { text-align: left; font-weight: 700; }
.plan-table thead th { font: 600 1.15rem/1.2 var(--f-display); padding-top: 22px; }
.plan-table thead small { display: block; font: 700 .8rem/1.4 var(--f-body); color: var(--ink-soft); }
.plan-table thead .is-prem { background: var(--navy); color: #fff; }
.plan-table thead .is-prem small { color: #D6E4FF; }
.plan-table thead .is-prem .ico { width: 18px; height: 18px; vertical-align: -3px; }
.plan-table td:last-child { background: color-mix(in srgb, var(--mist) 45%, transparent); font-weight: 700; }
.plan-table tr:last-child th, .plan-table tr:last-child td { border-bottom: 0; }
.plan-table .yes { color: var(--pri-text); stroke-width: 3; }
.plan-table .no { color: var(--ink-soft); }
.plans .fine { margin-top: 14px; }
.faq-list { max-width: 780px; margin: 0 auto; display: grid; gap: 12px; }
.faq-item { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 0 20px; }
.faq-item summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 0; font: 600 1.08rem/1.3 var(--f-display); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-plus { width: 28px; height: 28px; border-radius: 50%; background: var(--mist); position: relative; flex: none; transition: transform .25s; }
.faq-plus::before, .faq-plus::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 2.5px; background: var(--pri); border-radius: 2px; transform: translate(-50%, -50%); }
.faq-plus::after { transform: translate(-50%, -50%) rotate(90deg); }
.faq-item[open] .faq-plus { transform: rotate(45deg); }
.faq-item p { padding-bottom: 18px; color: var(--ink-soft); max-width: 65ch; }
.final-cta { display: flex; align-items: center; gap: 28px; padding: 36px; background: linear-gradient(120deg, var(--pri), var(--pri-strong)); color: #fff; border: 0; }
.final-cta .lead { color: #E5EEFF; margin: 10px 0 20px; }
.final-cta .btn-primary { --b: #fff; --bt: var(--pri-strong); --bs: var(--navy); }
.site-foot { border-top: 1px solid var(--line); padding: 32px 0 8px; display: grid; gap: 10px; color: var(--ink-soft); font-size: .9rem; max-width: 80ch; }
.foot-brand { display: flex; align-items: center; gap: 8px; font: 700 1.3rem/1 var(--f-display); color: var(--pri-text); }

/* ------------------------------------------------------------ auth / level / quiz */
.auth { max-width: 980px; margin: 0 auto; padding-top: 32px; display: grid; grid-template-columns: 1fr minmax(0, 440px); gap: 32px; align-items: center; }
.auth-card { padding: 28px; display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 800; font-size: .9rem; }
.field input, .type-in { width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line-soft); background: var(--cream); color: var(--ink); font: 600 1rem/1.2 var(--f-body); transition: border-color .15s, box-shadow .15s; }
.field input:focus, .type-in:focus { outline: none; border-color: var(--pri-text); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pri) 18%, transparent); }
.field input[aria-invalid="true"] { border-color: var(--pri-strong); }
.field-err, .form-err { color: var(--pri-strong); font-weight: 700; font-size: .85rem; min-height: 0; }
:root[data-theme="dark"] .field-err, :root[data-theme="dark"] .form-err { color: var(--sky); }
.field-err:not(:empty)::before, .form-err:not(:empty)::before { content: "✕ "; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); font-weight: 700; font-size: .85rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.level-page { max-width: 760px; margin: 0 auto; padding-top: 28px; display: grid; gap: 22px; }
.level-say { justify-content: center; }
.level-list { display: grid; gap: 14px; }
.level-opt { display: flex; align-items: center; gap: 18px; padding: 20px 22px; text-align: left; cursor: pointer; border-width: 2px; box-shadow: 0 5px 0 var(--line-soft); transition: transform .1s, box-shadow .1s, border-color .15s; }
.level-opt:hover { border-color: var(--pri-text); }
.level-opt:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line-soft); }
.level-opt.is-rec { border-color: var(--pri-text); background: color-mix(in srgb, var(--mist) 50%, var(--paper)); }
.level-ico { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: var(--mist); color: var(--pri-text); flex: none; }
.level-ico .ico { width: 32px; height: 32px; }
.level-txt { display: grid; gap: 3px; flex: 1; min-width: 0; }
.level-txt b { font: 600 1.3rem/1.1 var(--f-display); }
.level-txt span { color: var(--ink-soft); font-style: italic; }
.level-txt small { color: var(--pri-strong); font-weight: 700; }
:root[data-theme="dark"] .level-txt small { color: var(--sky); }
.quiz { max-width: 620px; margin: 28px auto 0; padding: 24px; display: grid; gap: 16px; justify-items: center; text-align: center; }
.quiz-top { width: 100%; display: flex; justify-content: space-between; }
.quiz .opts { width: 100%; }

/* ------------------------------------------------------------ path */
.learn { max-width: 640px; margin: 0 auto; padding-top: 20px; min-width: 0; }
.learn-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px; }
.alert { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 18px; margin-bottom: 14px; font-weight: 700; }
.alert-danger { background: var(--mist); border: 2px solid var(--sky); }
.alert p { flex: 1; }
.alert .streak-ico { width: 40px; height: 40px; }
.road { position: relative; max-width: 440px; margin: 10px auto 0; }
.road-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.road-bed { fill: none; stroke: var(--mist); stroke-width: 34; stroke-linecap: round; }
.road-line { fill: none; stroke: var(--line-soft); stroke-width: 4; stroke-dasharray: 2 12; stroke-linecap: round; }
.road-done { fill: none; stroke: var(--mist-2); stroke-width: 34; stroke-linecap: round; opacity: .9; }
.road-start { position: absolute; left: 50%; transform: translate(-50%, -50%); font: 800 .75rem/1 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); background: var(--cream); padding: 6px 10px; border-radius: 999px; border: 1px dashed var(--line-soft); }
.node-wrap { position: absolute; transform: translate(-50%, -50%); display: grid; justify-items: center; z-index: 2; }
.node { --n: var(--pri); --ns: var(--navy); --ni: #fff; position: relative; width: 72px; height: 68px; border-radius: 50%; border: 0; background: var(--n); color: var(--ni); cursor: pointer; box-shadow: 0 7px 0 var(--ns), 0 12px 18px -6px rgba(11, 37, 89, .35); transition: transform .1s, box-shadow .1s; display: grid; place-items: center; }
.node:active { transform: translateY(6px); box-shadow: 0 1px 0 var(--ns); }
.node-face .ico { width: 32px; height: 32px; stroke-width: 2.2; }
.node-face .ico .a { fill: rgba(255, 255, 255, .35); }
.node-num { position: absolute; right: -6px; top: -6px; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px; background: var(--paper); color: var(--ink); font: 800 .75rem/24px var(--f-body); border: 2px solid var(--line-soft); }
.st-done .node { --n: var(--pri); }
.st-done .node-face .ico { stroke-width: 3; }
.st-current .node { --n: var(--pri); width: 84px; height: 80px; animation: nodepulse 1.8s ease-out infinite; }
.st-skipped .node { --n: var(--mist); --ns: var(--mist-2); --ni: var(--pri-strong); outline: 2px dashed var(--sky); outline-offset: 3px; }
:root[data-theme="dark"] .st-skipped .node { --ni: var(--sky); }
.st-locked .node { --n: var(--locked); --ns: var(--line-soft); --ni: var(--locked-ink); box-shadow: 0 7px 0 var(--ns); }
.st-premium .node { --n: var(--navy); --ns: #040E22; --ni: var(--sky); }
.st-premium .node .ico { fill: color-mix(in srgb, var(--sky) 30%, transparent); }
.kind-exam .node { width: 96px; height: 90px; border-radius: 30px; }
.kind-exam.st-current .node { width: 104px; height: 98px; }
.kind-exam .node-face .ico { width: 42px; height: 42px; }
@keyframes nodepulse { 0% { box-shadow: 0 7px 0 var(--ns), 0 0 0 0 color-mix(in srgb, var(--pri) 55%, transparent); } 80%, 100% { box-shadow: 0 7px 0 var(--ns), 0 0 0 18px transparent; } }
.node-stars { display: flex; gap: 1px; margin-top: 10px; }
.node-stars i .ico { width: 16px; height: 16px; stroke: var(--line-soft); fill: var(--line); }
.node-stars i.on .ico { stroke: var(--pri-strong); fill: var(--sky); }
.node-title { position: absolute; top: 50%; transform: translateY(-50%); width: max-content; max-width: min(150px, 34vw); font: 700 .8rem/1.25 var(--f-body); color: var(--ink-soft); }
.node-title.side-right { left: calc(100% + 14px); }
.node-title.side-left { right: calc(100% + 14px); text-align: right; }
.st-locked .node-title, .st-premium .node-title { opacity: .7; }
.st-current .node-title { display: none; }
.node-current { position: absolute; top: 50%; transform: translateY(-50%); display: grid; justify-items: center; gap: 4px; width: 150px; }
.node-current.side-right { left: calc(100% + 4px); }
.node-current.side-left { right: calc(100% + 4px); }
.nc-title { font: 600 .9rem/1.2 var(--f-display); text-align: center; color: var(--ink); }
.unit-banner { position: absolute; left: -8px; right: -8px; transform: translateY(-50%); display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 22px; background: linear-gradient(115deg, var(--pri), var(--pri-strong)); color: #fff; box-shadow: 0 6px 0 var(--navy), var(--shadow); z-index: 1; }
.unit-banner .eyebrow { color: #D6E4FF; }
.unit-banner h2 { font-size: 1.25rem; }
.unit-banner.u6, .unit-banner.u7, .unit-banner.u8, .unit-banner.u9, .unit-banner.u10 { background: linear-gradient(115deg, #16367A, var(--navy)); box-shadow: 0 6px 0 #040E22, var(--shadow); }
.ub-icon { width: 52px; height: 52px; border-radius: 16px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; flex: none; }
.ub-icon .ico { width: 28px; height: 28px; }
.ub-icon .ico .a { fill: rgba(255, 255, 255, .3); }
.ub-text { flex: 1; min-width: 0; display: grid; gap: 4px; }
.ub-meter { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .22); overflow: hidden; margin-top: 4px; }
.ub-meter i { display: block; height: 100%; background: #fff; border-radius: 99px; }
.ub-badge { width: 44px; height: 44px; border-radius: 50%; background: #fff; color: var(--pri-text); display: grid; place-items: center; }

/* ------------------------------------------------------------ lesson */
.lesson-screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.lesson-top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 12px; padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); background: var(--cream); max-width: 980px; width: 100%; margin: 0 auto; }
.progress { flex: 1; height: 16px; border-radius: 99px; background: var(--locked); overflow: hidden; width: 100%; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--sky), var(--pri)); box-shadow: inset 0 -4px 0 rgba(0,0,0,.12), inset 0 3px 0 rgba(255,255,255,.3); transition: width .4s cubic-bezier(.3, 1.4, .5, 1); min-width: 16px; }
.lesson-score { display: inline-flex; align-items: center; gap: 4px; font: 800 1rem/1 var(--f-body); color: var(--pri-text); min-width: 56px; justify-content: flex-end; }
.lesson-score .ico { fill: var(--mist-2); }
.lesson-crumb { max-width: 980px; width: 100%; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); font-size: .85rem; color: var(--ink-soft); }
.lesson-main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right, 0px)) 150px max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 20px; align-content: start; }
.lesson-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--paper); border-top: 2px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.foot-inner { max-width: 980px; margin: 0 auto; padding-block: 16px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.foot-inner .btn-primary { min-width: 160px; }
.theory { padding: 22px; display: grid; gap: 14px; }
.theory-head { display: flex; align-items: center; gap: 14px; }
.theory-text { font-size: 1.08rem; max-width: 70ch; }
.theory-example { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--mist); color: var(--ink); font-weight: 600; }
.theory-example .ico { color: var(--pri-text); fill: var(--mist-2); margin-top: 2px; }
.tool-stage { display: grid; gap: 10px; min-width: 0; }
.exercise { display: grid; gap: 16px; min-width: 0; }
.ex-prompt { font-size: clamp(1.3rem, 2.8vw, 1.7rem); }
.ex-body { display: grid; gap: 14px; min-width: 0; }
.retry-tag { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: .8rem; color: var(--pri-strong); background: var(--mist); padding: 4px 10px; border-radius: 99px; justify-self: start; }
.retry-tag .ico { width: 16px; height: 16px; }
.shake { animation: shake .45s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 15%, 85% { transform: translateX(-2px); } 30%, 70% { transform: translateX(5px); } 45%, 55% { transform: translateX(-7px); } }

/* options */
.opts { display: grid; gap: 10px; }
.opt { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: left; border-radius: 16px; border: 2px solid var(--line-soft); background: var(--paper); box-shadow: 0 4px 0 var(--line-soft); cursor: pointer; font-weight: 700; font-size: 1.02rem; transition: transform .08s, box-shadow .08s, border-color .15s, background .15s; }
.opt:hover { border-color: var(--sky); }
.opt:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line-soft); }
.opt.is-sel { border-color: var(--pri-text); background: var(--mist); box-shadow: 0 4px 0 var(--pri); }
.opt-key { width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--line-soft); display: grid; place-items: center; font-size: .85rem; color: var(--ink-soft); flex: none; }
.opt.is-sel .opt-key { border-color: var(--pri-text); color: var(--pri-text); }
.opt.is-right { border-color: var(--pri-text); background: var(--mist); position: relative; }
.opt.is-right::after { content: "✓"; margin-left: auto; font-weight: 900; color: var(--pri-text); font-size: 1.2rem; }
.opt.is-wrong { border-style: dashed; opacity: .75; text-decoration: line-through; text-decoration-color: var(--pri-strong); }
.opt.is-wrong::after { content: "✕"; margin-left: auto; font-weight: 900; color: var(--ink-soft); }
.is-locked .opt, .is-locked .chip-step, .is-locked .m-item, .is-locked .vk, .is-locked .rb-btn, .is-locked .ww-tab, .is-locked .bs-item { pointer-events: none; }
.tf { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf-btn { flex-direction: column; justify-content: center; padding: 22px; font: 600 1.2rem/1 var(--f-display); text-align: center; }
.tf-btn .ico { width: 34px; height: 34px; color: var(--pri-text); stroke-width: 2.6; }
.tf-btn.is-right::after, .tf-btn.is-wrong::after { margin: 0; }

/* order */
.ord-answer { list-style: none; margin: 0; padding: 12px; min-height: 64px; border-radius: 18px; border: 2px dashed var(--line-soft); display: grid; gap: 8px; counter-reset: o; }
.ord-empty { color: var(--ink-soft); font-weight: 700; text-align: center; align-self: center; font-size: .92rem; }
.ord-pool { display: flex; flex-wrap: wrap; gap: 10px; }
.chip-step { display: inline-flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line-soft); background: var(--paper); box-shadow: 0 4px 0 var(--line-soft); font-weight: 700; cursor: pointer; text-align: left; width: auto; animation: popin .2s ease-out; }
.chip-step:hover { border-color: var(--sky); }
.chip-step.is-placed { width: 100%; border-color: var(--pri-text); background: var(--mist); box-shadow: 0 3px 0 var(--pri); }
.chip-step .n { width: 26px; height: 26px; border-radius: 50%; background: var(--pri); color: #fff; display: grid; place-items: center; font-size: .8rem; flex: none; }
@keyframes popin { from { transform: scale(.9); opacity: 0; } }

/* type */
.type-in { font-size: 1.15rem; min-height: 58px; }
.hint { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink-soft); }
.hint .ico { color: var(--pri-text); width: 18px; height: 18px; }
.hint-btn { justify-self: start; }

/* match: two columns joined by curved lines */
.match { position: relative; display: grid; grid-template-columns: 1fr 1fr; column-gap: clamp(48px, 12vw, 140px); }
.m-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 1; }
.m-line { fill: none; stroke-width: 4; stroke-linecap: round; stroke: var(--pri); stroke-dasharray: 600; stroke-dashoffset: 600; animation: drawline .45s ease-out forwards; }
.m-line.c2 { stroke: var(--navy); } .m-line.c3 { stroke: var(--sky); } .m-line.c4 { stroke: var(--pri-strong); }
.m-line.is-wrong { stroke: var(--ink-soft); stroke-dasharray: 6 8; stroke-dashoffset: 0; animation: none; opacity: .7; }
.m-line.is-right { stroke-width: 5; }
@keyframes drawline { to { stroke-dashoffset: 0; } }
.m-col { display: grid; gap: 12px; align-content: start; position: relative; z-index: 2; }
.m-item { --mc: var(--line-soft); position: relative; display: flex; align-items: center; gap: 8px; min-height: 58px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line-soft); background: var(--paper); box-shadow: 0 4px 0 var(--line-soft); font-weight: 700; text-align: left; cursor: pointer; font-size: .95rem; transition: border-color .15s, transform .1s, background .15s; }
.m-item.side-r { padding-left: 22px; }
.m-item.side-l { padding-right: 22px; }
.m-txt { flex: 1; min-width: 0; }
.m-dot { position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); border: 3px solid var(--mc); transform: translateY(-50%); transition: background .15s, border-color .15s, transform .15s; }
.side-l .m-dot { right: -9px; }
.side-r .m-dot { left: -9px; }
.m-item:hover { border-color: var(--sky); }
.m-item:hover .m-dot { --mc: var(--sky); }
.m-item.is-active { --mc: var(--pri); border-color: var(--pri-text); box-shadow: 0 4px 0 var(--pri); transform: translateY(-2px); background: var(--mist); }
.m-item.is-active .m-dot { background: var(--pri); transform: translateY(-50%) scale(1.25); animation: dotpulse 1.2s ease-out infinite; }
.match.has-active .m-item:not(.is-active):not(.is-paired) { border-style: dashed; }
@keyframes dotpulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pri) 50%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
.m-item.is-paired { --mc: var(--pri); border-color: var(--mc); background: var(--mist); box-shadow: 0 3px 0 var(--mc); }
.m-item.is-paired .m-dot { background: var(--mc); }
.m-item.c2 { --mc: var(--navy); } .m-item.c3 { --mc: var(--sky); } .m-item.c4 { --mc: var(--pri-strong); }
:root[data-theme="dark"] .m-item.c2 { --mc: #9DB8F0; }
.m-item.is-wrong { border-style: dashed; }
.m-item.is-right .m-dot, .m-item.is-wrong .m-dot { width: 22px; height: 22px; display: grid; place-items: center; color: #fff; font: 900 .7rem/1 var(--f-body); }
.side-l.is-right .m-dot, .side-l.is-wrong .m-dot { right: -12px; }
.m-item.is-right .m-dot::after { content: "✓"; }
.m-item.is-wrong .m-dot { background: var(--ink-soft); border-color: var(--ink-soft); }
.m-item.is-wrong .m-dot::after { content: "✕"; }

/* shortcut */
.combo-box { display: grid; justify-items: center; gap: 8px; padding: 16px; border-radius: 18px; background: var(--paper); border: 2px solid var(--line); }
.combo-label { font: 800 .72rem/1 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.combo-out { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; font-weight: 700; color: var(--ink-soft); text-align: center; }
.combo-out kbd { font-size: 1.3rem; padding: .35em .7em; box-shadow: 0 4px 0 var(--line-soft); border-width: 2px; }
.combo-out .plus { font-weight: 900; color: var(--pri-text); }
.combo-out.pop { animation: popin .25s ease-out; }
.ans-list { margin: 4px 0 0; padding-left: 1.2em; }

/* feedback */
.feedback { border-top: 0; animation: slideup .25s ease-out; }
.feedback.is-ok { background: var(--mist); }
.feedback.is-bad { background: color-mix(in srgb, var(--mist) 60%, var(--paper)); }
.fb-inner { max-width: 980px; margin: 0 auto; padding-block: 14px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; align-items: center; gap: 14px; }
.fb-text { flex: 1; min-width: 0; display: grid; gap: 4px; max-height: 40vh; overflow-y: auto; }
.fb-title { display: flex; align-items: center; gap: 8px; font: 700 1.3rem/1.1 var(--f-display); color: var(--pri-strong); }
:root[data-theme="dark"] .fb-title { color: var(--sky); }
.fb-ico { width: 28px; height: 28px; stroke-width: 3; padding: 4px; border-radius: 50%; background: var(--pri); color: #fff; }
.is-bad .fb-ico { background: var(--navy); }
.fb-delta { font: 800 .9rem/1 var(--f-body); padding: 4px 8px; border-radius: 99px; background: var(--paper); color: var(--pri-text); }
.fb-say { font-weight: 700; font-style: italic; color: var(--ink-soft); }
.fb-answer { font-weight: 700; }
.fb-answer > span { color: var(--ink-soft); }
.fb-explain { color: var(--ink); }
@keyframes slideup { from { transform: translateY(100%); } }

/* results */
.results { display: grid; justify-items: center; gap: 16px; text-align: center; padding-top: 12px; }
.stars { display: flex; gap: 8px; }
.star .ico { width: 46px; height: 46px; stroke: var(--line-soft); fill: var(--locked); stroke-width: 1.5; }
.star.on .ico { stroke: var(--pri-strong); fill: var(--sky); animation: starpop .5s var(--d) both cubic-bezier(.3, 1.6, .5, 1); }
@keyframes starpop { from { transform: scale(0) rotate(-40deg); } }
.res-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; max-width: 520px; margin: 0; }
.res-tile { border-radius: 18px; border: 2px solid var(--pri); overflow: hidden; background: var(--paper); }
.res-tile dt { background: var(--pri); color: #fff; font: 800 .72rem/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; padding: 7px; }
.res-tile dd { margin: 0; padding: 12px 6px; font: 700 1.5rem/1 var(--f-display); display: flex; align-items: center; justify-content: center; gap: 4px; }
.res-tile .streak-ico { width: 26px; height: 26px; }
.t-acc { border-color: var(--navy); } .t-acc dt { background: var(--navy); }
.t-streak { border-color: #E2621A; } .t-streak dt { background: #C2410C; }
.res-say { font-weight: 700; color: var(--ink-soft); max-width: 46ch; }
.badge-won { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 16px; background: var(--navy); color: #fff; font-weight: 800; }
.res-breakdown { width: 100%; max-width: 520px; text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 10px 16px; }
.res-breakdown summary { cursor: pointer; font-weight: 800; color: var(--pri-text); }
.res-breakdown ul { margin: 10px 0 4px; padding-left: 1.2em; display: grid; gap: 4px; }
.exam-intro { padding: 24px; display: grid; gap: 16px; }
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ticks li { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.ticks .ico { color: var(--pri-text); flex: none; }

/* ------------------------------------------------------------ simulated Word window */
.rb-host { min-width: 0; }
.wwin { border-radius: 18px; overflow: hidden; border: 1px solid var(--line-soft); background: var(--paper); box-shadow: var(--shadow-lg); font-size: 13px; min-width: 0; }
.ww-title { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: linear-gradient(90deg, var(--pri-strong), var(--pri)); color: #fff; }
.qat { display: flex; align-items: center; gap: 2px; padding: 2px; border-radius: 10px; position: relative; }
.qat .rb-btn { color: #fff; width: 32px; height: 30px; }
.qat .rb-btn:hover { background: rgba(255, 255, 255, .18); }
.ww-docname { flex: 1; text-align: center; font-weight: 700; font-size: .82rem; opacity: .95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ww-share { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid rgba(255, 255, 255, .7); background: rgba(255, 255, 255, .1); color: #fff; border-radius: 8px; padding: 4px 10px; font-weight: 700; font-size: .8rem; cursor: pointer; }
.ww-share .ico { width: 16px; height: 16px; }
.ww-tabs { display: flex; gap: 2px; padding: 4px 8px 0; background: var(--cream); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; position: relative; }
.ww-tabs::-webkit-scrollbar { display: none; }
.ww-tab { flex: none; padding: 8px 12px; border: 0; border-radius: 8px 8px 0 0; background: transparent; cursor: pointer; font-weight: 700; font-size: .82rem; color: var(--ink-soft); position: relative; }
.ww-tab:hover { background: var(--mist); color: var(--ink); }
.ww-tab.is-sel { color: var(--pri-text); background: var(--paper); }
.ww-tab.is-sel::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px; background: var(--pri); }
.ww-tab.is-file { background: var(--pri); color: #fff; margin-right: 4px; }
.ww-tab.is-file.is-sel { background: var(--navy); color: #fff; }
.ww-body { display: flex; align-items: stretch; gap: 0; padding: 8px 6px 4px; overflow-x: auto; min-height: 118px; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: var(--line-soft) transparent; }
.ww-body.has-tags { padding-top: 34px; }
.rb-group { display: flex; flex-direction: column; flex: none; padding: 0 8px; border-right: 1px solid var(--line); border-radius: 10px; transition: background .3s; }
.rb-group.has-hl { background: color-mix(in srgb, var(--mist) 70%, transparent); }
.rb-tools { display: flex; align-items: flex-start; gap: 4px; flex: 1; }
.rb-glabel { text-align: center; font-size: .7rem; font-weight: 700; color: var(--ink-soft); padding-top: 4px; white-space: nowrap; }
.rb-group.has-hl .rb-glabel { color: var(--pri-strong); }
:root[data-theme="dark"] .rb-group.has-hl .rb-glabel { color: var(--sky); }
.rb-stack { display: grid; gap: 2px; }
.rb-smblock { display: flex; flex-wrap: wrap; gap: 2px; width: 140px; align-content: flex-start; }
.rb-smblock.wide { width: 196px; }
.rb-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid transparent; background: transparent; border-radius: 8px; cursor: pointer; color: var(--ink); padding: 3px 6px; font-weight: 600; font-size: .78rem; white-space: nowrap; transition: background .15s; }
.rb-btn:hover { background: var(--mist); border-color: var(--mist-2); }
.rb-btn .ico { width: 18px; height: 18px; color: var(--ink); }
.rb-lg { flex-direction: column; justify-content: flex-start; gap: 4px; width: 66px; min-height: 76px; padding: 6px 2px; white-space: normal; text-align: center; line-height: 1.15; }
.rb-lg .ico { width: 30px; height: 30px; color: var(--pri-text); }
.rb-md { height: 26px; }
.rb-md .ico { color: var(--pri-text); }
.rb-sm { width: 30px; height: 28px; justify-content: center; padding: 0; }
.rb-combo { height: 28px; border: 1.5px solid var(--line-soft); background: var(--paper); justify-content: space-between; min-width: 92px; font-weight: 600; }
.rb-combo[data-tool="font-size"] { min-width: 44px; }
.combo-caret { font-size: .7rem; color: var(--ink-soft); }
.rb-btn.is-press { animation: press .2s; }
@keyframes press { 50% { transform: scale(.92); } }
.rb-btn.is-picked, .ww-tab.is-picked, .bs-item.is-picked { background: var(--mist); border-color: var(--pri-text); box-shadow: 0 0 0 2px var(--pri); }
/* highlights (teach mode) */
.is-hl { z-index: 2; }
.rb-btn.is-hl, .ww-tab.is-hl, .ww-share.is-hl { border-color: var(--pri-text) !important; background: var(--paper); animation: hlpulse 1.6s ease-out infinite; }
.ww-title .rb-btn.is-hl { background: rgba(255,255,255,.2); border-color: #fff !important; }
@keyframes hlpulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pri) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 10px transparent; } }
.hl-tag { position: absolute; left: 50%; bottom: calc(100% + 7px); transform: translateX(-50%); background: var(--pri); color: #fff; font: 800 .68rem/1 var(--f-body); padding: 5px 8px; border-radius: 7px; white-space: nowrap; pointer-events: none; box-shadow: 0 3px 8px rgba(11, 37, 89, .25); animation: tagbob 1.6s ease-in-out infinite; z-index: 3; }
.hl-tag::after { content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--pri-text); }
@keyframes tagbob { 50% { transform: translate(-50%, -3px); } }
.ww-title .hl-tag { display: none; }
.rb-md .hl-tag { left: calc(100% + 8px); bottom: auto; top: 50%; transform: translateY(-50%); animation: none; }
.rb-md .hl-tag::after { left: -5px; top: 50%; transform: translateY(-50%); border-top-color: transparent; border-right-color: var(--pri-text); }
.rb-stack { position: relative; z-index: 3; }
.is-zone-hl { outline: 3px dashed var(--sky); outline-offset: -3px; animation: zonepulse 1.6s ease-in-out infinite; }
.qat.is-zone-hl { outline-color: #fff; outline-offset: 1px; }
@keyframes zonepulse { 50% { outline-color: var(--pri-text); } }
.qat.is-zone-hl { animation: none; }
.zone-badge { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--navy); color: #fff; font: 800 .75rem/1 var(--f-body); flex: none; align-self: center; margin-right: 4px; }
.qat .zone-badge { background: #fff; color: var(--pri-text); }
/* backstage */
.ww-backstage { display: grid; grid-template-columns: 170px minmax(0, 1fr); min-height: 250px; }
.bs-nav { background: var(--navy); padding: 8px 6px; color: #fff; }
:root[data-theme="dark"] .bs-nav { background: #0D2147; }
.bs-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.bs-back { border: 0; background: rgba(255,255,255,.12); color: #fff; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; margin: 2px 0 8px 4px; }
.bs-back .ico { width: 18px; height: 18px; }
.bs-item { position: relative; width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1.5px solid transparent; border-radius: 8px; background: transparent; color: #E5EEFF; cursor: pointer; font-weight: 700; font-size: .82rem; text-align: left; }
.bs-item .ico { width: 17px; height: 17px; }
.bs-item .ico .a { fill: rgba(255,255,255,.25); }
.bs-item:hover { background: rgba(255, 255, 255, .12); }
.bs-item.is-sel { background: rgba(255, 255, 255, .18); color: #fff; }
.bs-item.is-hl { background: var(--pri); color: #fff; border-color: #fff !important; animation: hlpulse 1.6s ease-out infinite; }
.bs-item .hl-tag { left: auto; right: -6px; bottom: auto; top: 50%; transform: translate(100%, -50%); background: var(--paper); color: var(--pri-text); animation: none; }
.bs-item .hl-tag::after { left: -5px; top: 50%; transform: translateY(-50%); border-top-color: transparent; border-right-color: var(--paper); }
.ww-backstage .bs-item .hl-tag { display: none; }
.bs-pane { padding: 16px 18px; display: grid; gap: 10px; align-content: start; min-width: 0; background: var(--paper); }
.bs-h { font: 600 1.25rem/1.1 var(--f-display); }
.bs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.bs-card { display: grid; gap: 6px; justify-items: center; text-align: center; font-weight: 700; font-size: .75rem; }
.bs-thumb { width: 100%; aspect-ratio: 3 / 4; max-width: 100%; border-radius: 8px; border: 1.5px solid var(--line-soft); display: grid; place-items: center; background: var(--cream); }
.bs-thumb .ico { width: 30px; height: 30px; color: var(--pri-text); }
.is-soft-hl .bs-thumb, .bs-row.is-soft-hl { border-color: var(--pri-text); background: var(--mist); }
.bs-list-h { font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.bs-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.bs-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--cream); font-weight: 600; }
.bs-list li > span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bs-list .ico { width: 16px; height: 16px; color: var(--pri-text); }
.pin { color: var(--ink-soft); opacity: .5; display: inline-flex; }
.pin.is-on { opacity: 1; }
.pin.is-on .ico { fill: var(--mist-2); }
.bs-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; border: 1.5px solid var(--line); font-weight: 700; }
.bs-row .ico { color: var(--pri-text); }
.bs-field { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 8px; background: var(--cream); font-size: .8rem; }
.bs-field span { color: var(--ink-soft); font-weight: 700; }
.bs-print { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 14px; }
.bs-form { display: grid; gap: 6px; align-content: start; }
.bs-cta { display: inline-flex; align-items: center; gap: 6px; justify-self: start; padding: 7px 12px; border-radius: 9px; background: var(--pri); color: #fff; font-weight: 800; }
.bs-cta .ico { width: 16px; height: 16px; }
.bs-preview { background: #fff; border: 1px solid var(--line-soft); border-radius: 4px; aspect-ratio: 3 / 4; padding: 12px 10px; display: grid; gap: 6px; align-content: start; box-shadow: var(--shadow); }
.bs-preview i { display: block; height: 4px; border-radius: 2px; background: #D5E0F3; }
.bs-preview i:first-child { width: 60%; height: 7px; background: var(--pri); }
.bs-empty { color: var(--ink-soft); }
/* document + status bar */
.ww-docwrap { background: var(--cream); padding: 14px; border-top: 1px solid var(--line); }
.ww-page { background: #fff; color: #0B1B3A; max-width: 460px; margin: 0 auto; padding: 18px 22px; border-radius: 4px; box-shadow: var(--shadow); display: grid; gap: 6px; }
.ww-page h5 { font: 600 1.1rem/1.2 var(--f-display); }
.ww-page p { font-size: .85rem; }
.ww-page .faint { color: #3D5078; }
.caret { display: inline-block; width: 2px; height: 1.05em; background: var(--pri); vertical-align: -2px; margin-left: 1px; animation: blink 1s steps(1) infinite; }
.ww-status { display: flex; align-items: center; gap: 14px; padding: 5px 12px; background: var(--navy); color: #E5EEFF; font-size: .74rem; font-weight: 700; position: relative; }
:root[data-theme="dark"] .ww-status { background: #0D2147; }
.ww-status .zone-badge { background: #fff; color: var(--pri-text); }
.ww-status.is-zone-hl { outline-color: #fff; }
.st-views { display: inline-flex; gap: 6px; border-radius: 6px; padding: 2px; }
.st-views .ico { width: 15px; height: 15px; }
.st-zoom { display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; padding: 2px 4px; }
.st-zoom i { width: 70px; height: 3px; background: rgba(255,255,255,.4); border-radius: 2px; position: relative; }
.st-zoom u { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: #fff; transform: translate(-50%, -50%); }
.st-zoom.is-zone-hl, .st-views.is-zone-hl { outline-color: #fff; }
.rb-crumbs { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.rb-crumbs li { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--paper); border: 2px solid var(--mist-2); font-weight: 700; font-size: .88rem; }
.rb-crumbs i { font-style: normal; color: var(--pri-text); font-weight: 900; }
.rb-crumbs span:last-of-type { color: var(--pri-strong); }
:root[data-theme="dark"] .rb-crumbs span:last-of-type { color: var(--sky); }
.pick-readout { font-weight: 700; color: var(--ink-soft); }
.pick-readout b { color: var(--ink); }
.rb-tooltip { position: fixed; z-index: 200; max-width: 260px; padding: 8px 10px; border-radius: 10px; background: var(--navy); color: #fff; font-size: .8rem; line-height: 1.35; pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; box-shadow: var(--shadow-lg); }
.rb-tooltip.show { opacity: 1; transform: none; }
.rb-tooltip small { display: block; opacity: .85; margin-top: 2px; }
.rb-tooltip kbd { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.3); box-shadow: none; margin-left: 4px; }

/* ------------------------------------------------------------ virtual keyboard */
.kbd-host { overflow-x: auto; padding-bottom: 4px; }
.vkbd { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; padding: 14px; border-radius: 20px; background: var(--navy); box-shadow: var(--shadow-lg); width: max-content; min-width: 100%; }
:root[data-theme="dark"] .vkbd { background: #0D2147; }
.vk-main, .vk-nav { display: grid; gap: 5px; align-content: start; }
.vk-main { width: min(620px, 100%); min-width: 340px; }
.vk-row { display: flex; gap: 5px; }
.vk-frow .vk { height: 26px; font-size: .62rem; }
.vk-nav { width: 150px; }
.vk, .vk-gap { flex: var(--w) 1 0; min-width: 0; }
.vk { height: 36px; border-radius: 7px; border: 0; background: #F3F7FF; color: #0B1B3A; font: 800 .74rem/1 var(--f-body); box-shadow: 0 3px 0 #9FB0D2; cursor: default; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: transform .06s, box-shadow .06s, background .15s; }
.vk.is-word { font-size: .62rem; }
.is-interactive .vk { cursor: pointer; }
.is-interactive .vk:hover { background: #fff; }
.vk:active, .vk.is-down { transform: translateY(3px); box-shadow: 0 0 0 #9FB0D2; }
.vk.is-down { animation: keydown .3s; }
@keyframes keydown { 0% { background: var(--sky); } 100% { background: #F3F7FF; } }
.vk.is-on { background: var(--sky); color: #fff; box-shadow: 0 3px 0 var(--pri-strong); }
.vk.is-hl { background: var(--pri); color: #fff; box-shadow: 0 3px 0 #06152F, 0 0 0 3px #D6E4FF; animation: keyglow 1.6s ease-in-out infinite; }
@keyframes keyglow { 50% { box-shadow: 0 3px 0 #06152F, 0 0 0 6px rgba(255, 214, 218, .4); } }
.teach .vk { pointer-events: none; }

/* ------------------------------------------------------------ leaderboard / profile */
.lb, .profile { max-width: 640px; margin: 0 auto; padding-top: 22px; display: grid; gap: 18px; }
.lb-head { display: flex; align-items: center; gap: 16px; }
.lb-me { margin-top: 6px; font-weight: 800; color: var(--pri-strong); }
:root[data-theme="dark"] .lb-me { color: var(--sky); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; border-radius: 16px; background: var(--mist); border: 1px solid var(--mist-2); gap: 4px; }
.seg button { border: 0; border-radius: 12px; background: transparent; padding: 10px; font-weight: 800; cursor: pointer; color: var(--ink-soft); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button.is-sel { background: var(--paper); color: var(--pri-text); box-shadow: 0 3px 0 var(--line-soft); }
.lb-list { list-style: none; margin: 0; padding: 8px; display: grid; gap: 4px; background: var(--paper); border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: var(--shadow); }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; }
.lb-row.is-me { background: var(--mist); outline: 2px solid var(--pri); }
.rank { width: 30px; text-align: center; font: 700 1.05rem/1 var(--f-display); color: var(--ink-soft); flex: none; }
.rank.medal { height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.m1 { background: var(--pri); box-shadow: 0 3px 0 var(--navy); } .m2 { background: var(--navy); box-shadow: 0 3px 0 #040E22; } .m3 { background: var(--sky); color: var(--navy) !important; box-shadow: 0 3px 0 var(--pri-strong); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--av, var(--pri)); color: #fff; font: 700 1rem/1 var(--f-display); flex: none; overflow: hidden; }
.avatar.is-me { background: var(--paper); border: 2px solid var(--pri); }
.lb-name { flex: 1; min-width: 0; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name small { color: var(--ink-soft); font-weight: 700; }
.lb-pts { font-weight: 800; font-variant-numeric: tabular-nums; }
.lb-pts small { color: var(--ink-soft); }
.lb-gap { text-align: center; color: var(--ink-soft); }
.prof-head { display: flex; align-items: center; gap: 16px; padding: 20px; }
.prof-head .pill { margin-top: 8px; }
.profile > .card:not(.prof-head) { padding: 20px; display: grid; gap: 12px; }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; }
.stat-row .card { padding: 14px; text-align: center; }
.stat-row dt { font: 800 .72rem/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.stat-row dd { margin: 6px 0 0; font: 700 1.6rem/1 var(--f-display); color: var(--pri-text); font-variant-numeric: tabular-nums; }
.badges { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.badge { display: grid; justify-items: center; gap: 4px; font-size: .72rem; font-weight: 800; color: var(--ink-soft); }
.badge .ico { width: 44px; height: 44px; padding: 9px; border-radius: 50%; background: var(--locked); color: var(--locked-ink); }
.badge.on .ico { background: var(--pri); color: #fff; box-shadow: 0 4px 0 var(--navy); }
.dev { border-style: dashed !important; }
.dev-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.switch { display: inline-flex; align-items: center; gap: 12px; font-weight: 800; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 50px; height: 30px; border-radius: 99px; background: var(--locked); position: relative; transition: background .2s; flex: none; }
.switch .track i { position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .track { background: var(--pri); }
.switch input:checked + .track i { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid var(--sky); outline-offset: 2px; }

/* ------------------------------------------------------------ modal, toast, fx */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 14, 34, .55); backdrop-filter: blur(4px); animation: fade .2s; }
.modal { position: relative; width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--paper); border-radius: 28px; padding: 28px; box-shadow: var(--shadow-lg); animation: modalin .3s cubic-bezier(.3, 1.4, .5, 1); }
.modal-sm { width: min(440px, 100%); }
.modal-lg { width: min(620px, 100%); }
.modal:focus { outline: none; }
.modal-x { position: absolute; right: 12px; top: 12px; z-index: 2; }
@keyframes fade { from { opacity: 0; } }
@keyframes modalin { from { transform: translateY(24px) scale(.96); opacity: 0; } }
.confirm, .milestone { display: grid; justify-items: center; gap: 12px; text-align: center; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.milestone-num { display: flex; align-items: center; gap: 4px; font: 700 3rem/1 var(--f-display); color: #C2410C; }
.milestone-num .streak-ico { width: 56px; height: 56px; }
.streak-modal { display: grid; gap: 16px; }
.streak-hero { display: flex; align-items: center; justify-content: center; gap: 12px; }
.streak-hero .streak-ico { width: 84px; height: 84px; }
.streak-big b { display: block; font: 700 3rem/1 var(--f-display); }
.streak-big span { color: var(--ink-soft); font-weight: 700; }
.streak-week { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.streak-week .dot { width: 34px; height: 34px; margin: 0 auto 4px; border-radius: 50%; display: grid; place-items: center; background: var(--locked); color: #fff; }
.streak-week .on .dot { background: linear-gradient(180deg, #FFB020, #FF7A1A); }
.streak-week .today .dot { outline: 2px solid var(--pri); outline-offset: 2px; }
.streak-week .ico { width: 18px; height: 18px; stroke-width: 3; }
.dname { font-size: .72rem; font-weight: 800; color: var(--ink-soft); }
.streak-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.streak-stats div { background: var(--cream); border-radius: 14px; padding: 10px; text-align: center; }
.streak-stats dt { font-size: .75rem; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }
.streak-stats dd { margin: 4px 0 0; font: 700 1.3rem/1 var(--f-display); }
.paywall { display: grid; gap: 18px; }
.pw-head { display: flex; align-items: center; gap: 16px; }
.pw-head p:not(.eyebrow) { color: var(--ink-soft); margin-top: 6px; }
.pw-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pw-plan { position: relative; display: grid; gap: 4px; justify-items: start; text-align: left; padding: 16px; border-radius: 18px; border: 2px solid var(--line-soft); background: var(--paper); box-shadow: 0 4px 0 var(--line-soft); cursor: pointer; }
.pw-plan.is-sel { border-color: var(--pri-text); background: var(--mist); box-shadow: 0 4px 0 var(--pri); }
.pw-plan .pill { position: absolute; top: -12px; right: 12px; background: var(--pri); color: #fff; }
.pw-price { font: 700 1.6rem/1 var(--f-display); }
.pw-price small { font: 700 .85rem/1 var(--f-body); color: var(--ink-soft); }
.pw-plan > small { color: var(--ink-soft); font-weight: 700; }
.pw-was { font: 700 1rem/1 var(--f-body); color: var(--ink-soft); text-decoration-thickness: 2px; }
.launch-note { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 14px auto 0; padding: 10px 16px; max-width: 640px; border-radius: 14px; background: var(--mist); color: var(--pri-text); font-weight: 800; text-align: center; }
.launch-note .ico { flex: none; }
#toasts { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 150; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 10px; border-radius: 18px; background: var(--navy); color: #fff; font-weight: 700; box-shadow: var(--shadow-lg); animation: toastin .3s cubic-bezier(.3, 1.4, .5, 1); }
.toast.out { opacity: 0; transform: translateY(10px); transition: .4s; }
@keyframes toastin { from { transform: translateY(20px); opacity: 0; } }
.score-pop { position: fixed; z-index: 160; transform: translate(-50%, 0); font: 700 1.6rem/1 var(--f-display); pointer-events: none; animation: scorepop 1.1s ease-out forwards; text-shadow: 0 2px 0 #fff; }
.score-pop.is-plus { color: var(--pri-text); }
.score-pop.is-minus { color: var(--navy); }
:root[data-theme="dark"] .score-pop { text-shadow: none; }
:root[data-theme="dark"] .score-pop.is-minus { color: var(--ink-soft); }
@keyframes scorepop { 0% { transform: translate(-50%, 10px) scale(.6); opacity: 0; } 20% { transform: translate(-50%, 0) scale(1.15); opacity: 1; } 100% { transform: translate(-50%, -50px) scale(1); opacity: 0; } }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 170; }

/* streak icon animations */
.flame .fl-outer { transform-origin: 16px 28px; animation: flicker 1.3s ease-in-out infinite; }
.flame.is-dim .fl-outer { animation: none; }
.burning .flicker { transform-origin: 16px 26px; animation: flicker .7s ease-in-out infinite; }
.ashes .smoke { animation: smoke 2.6s ease-in-out infinite; }
@keyframes flicker { 50% { transform: scale(1.06, .94) skewX(-2deg); } }
@keyframes smoke { 0% { opacity: 0; transform: translateY(3px); } 50% { opacity: .9; } 100% { opacity: 0; transform: translateY(-3px); } }
@keyframes nudge { 0%, 85%, 100% { transform: none; } 90% { transform: rotate(-6deg); } 95% { transform: rotate(6deg); } }


/* ------------------------------------------------------------ path side panels */
.learn-layout { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); justify-content: center; gap: 28px; }
.side { display: none; }
@media (min-width: 1100px) {
  .learn-layout { grid-template-columns: minmax(220px, 280px) minmax(0, 600px) minmax(220px, 280px); gap: 24px; }
  .side { display: grid; gap: 16px; align-content: start; position: sticky; top: calc(var(--hdr-h) + 20px + env(safe-area-inset-top, 0px)); grid-template-columns: minmax(0, 1fr); min-width: 0; padding: 20px 6px 24px; max-height: calc(100vh - var(--hdr-h) - 24px); overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
  .learn { margin: 0; max-width: none; }
}
.side-card { padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.side-h { display: flex; align-items: center; gap: 12px; }
.side-h .streak-ico { width: 44px; height: 44px; }
.side-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-row .h3 { display: inline-flex; align-items: center; gap: 6px; font-size: 1.05rem; }
.side-row .h3 .ico { color: var(--pri-text); }
.goal-bar { position: relative; height: 22px; border-radius: 99px; background: var(--locked); overflow: hidden; }
.goal-bar i { display: block; height: 100%; background: linear-gradient(90deg, #FFB020, #FF7A1A); border-radius: inherit; }
.goal-bar span { position: absolute; inset: 0; display: grid; place-items: center; font: 800 .75rem/1 var(--f-body); color: var(--ink); }
.goal-card .streak-week .dot { width: 26px; height: 26px; }
.goal-card .streak-week .ico { width: 14px; height: 14px; }
.goal-card .link { justify-self: start; font-size: .88rem; }
.tip-card { background: linear-gradient(160deg, var(--mist), var(--paper)); }
.tip-text { font-weight: 600; line-height: 1.5; }
.tip-text kbd { font-size: .78em; }
.mini-board { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mini-board li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 12px; font-size: .9rem; }
.mini-board li.is-me { background: var(--mist); outline: 2px solid var(--pri); }
.mini-board .rank { width: 26px; font-size: .9rem; }
.mini-board .rank.medal { height: 26px; }
.mini-board b { font-variant-numeric: tabular-nums; }
.mini-badges { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.mini-badges li { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: var(--locked); color: var(--locked-ink); }
.mini-badges li .ico { width: 20px; height: 20px; }
.mini-badges li.on { background: var(--pri); color: #fff; box-shadow: 0 3px 0 var(--navy); }
.prem-card { grid-template-columns: auto minmax(0, 1fr); align-items: center; background: linear-gradient(150deg, var(--navy), var(--pri-strong)); color: #fff; border: 0; }
.prem-card .eyebrow { color: #D6E4FF; }
.prem-card .fine { color: #D6E4FF; }
.prem-card .btn { margin-top: 8px; --b: #fff; --bt: var(--pri-strong); --bs: #040E22; }
.prem-card.is-on > .ico { width: 36px; height: 36px; color: #fff; }
:root[data-theme="dark"] .m-line.c2 { stroke: #9DB8F0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .m-line.c2 { stroke: #9DB8F0; } }

/* ------------------------------------------------------------ document practice */
.doc-practice { display: grid; gap: 12px; min-width: 0; }
.mini-desk { background: var(--mist); border-radius: 16px; padding: 18px; border: 1px solid var(--line); }
.mini-page { background: #fff; color: #0B1B3A; max-width: 560px; margin: 0 auto; padding: 22px 26px; border-radius: 6px; box-shadow: var(--shadow); display: grid; gap: 6px; font-family: var(--f-body); }
.dseg { position: relative; padding: 4px 6px; border-radius: 6px; cursor: text; border: 2px solid transparent; line-height: 1.5; transition: background .12s; }
.dseg:hover { background: #EEF3FD; }
.dseg.is-sel .seg-t { background: #BFD5FA; box-shadow: 0 0 0 2px #BFD5FA; border-radius: 2px; }
.dseg.is-sel { border-color: #9DBBF2; }
.dseg-h { font: 600 1.3rem/1.25 var(--f-display); }
.dseg-li { padding-left: 18px; }
.f-b .seg-t { font-weight: 900; } .f-i .seg-t { font-style: italic; } .f-u .seg-t { text-decoration: underline; text-decoration-thickness: 2px; }
.f-s .seg-t { text-decoration: line-through; } .f-u.f-s .seg-t { text-decoration: underline line-through; }
.f-mark .seg-t { background: #FFF06A; } .dseg.is-sel.f-mark .seg-t { background: linear-gradient(#BFD5FA, #FFF06A); }
.f-up .seg-t { text-transform: uppercase; } .f-color .seg-t { color: #1F5FD6; } .f-big .seg-t { font-size: 1.3em; } .f-serif .seg-t { font-family: Georgia, 'Times New Roman', serif; }
.al-center { text-align: center; } .al-right { text-align: right; } .al-justify { text-align: justify; }
.ls-bullet, .ls-number { padding-left: 30px; } .ls-m { position: absolute; left: 12px; font-weight: 800; }
.in-1 { margin-left: 28px; } .in-2 { margin-left: 56px; } .in-3 { margin-left: 84px; }
.sp-2 { line-height: 2.3; }
.doc-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.doc-readout { font-weight: 700; color: var(--ink-soft); }
.doc-readout b { color: var(--ink); }
.doc-readout.nudge { animation: shake .45s; color: var(--pri-strong); }
.ww-ruler { position: relative; height: 22px; max-width: 460px; margin: 0 auto 8px; background: #fff; border: 1px solid var(--line-soft); border-radius: 4px; font-size: .6rem; color: #3D5078; }
.ww-ruler i { position: absolute; top: 0; height: 8px; border-left: 1px solid #9FB0D2; font-style: normal; padding-left: 2px; }
.ww-ruler .tabstop { position: absolute; bottom: 1px; font: 900 .8rem/1 var(--f-body); color: var(--pri-text); transform: translateX(-50%); }
.ww-tab.is-ctx { color: var(--pri-strong); background: color-mix(in srgb, var(--sky) 18%, transparent); }
.ww-tab.is-ctx.is-sel { background: var(--paper); }
:root[data-theme="dark"] .ww-tab.is-ctx { color: var(--sky); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-visual { height: 440px; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { justify-self: center; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .boxes { grid-template-columns: 1fr; }
  .final-cta { flex-direction: column; text-align: center; padding: 28px 20px; }
  .chip-txt, .hide-sm { display: none; }
  .hdr { gap: 4px; }
  .chip { padding: 0 6px; }
  .brand-name { font-size: 1.2rem; }
  .tf { grid-template-columns: 1fr 1fr; }
  .m-item { font-size: .84rem; padding: 8px 10px; min-height: 52px; }
  .m-item.side-l { padding-right: 16px; } .m-item.side-r { padding-left: 16px; }
  .fb-inner { flex-wrap: wrap; }
  .fb-inner .mascot { display: none; }
  .fb-inner .btn { width: 100%; }
  .foot-inner .btn-primary { min-width: 0; flex: 1; }
  .ww-backstage { grid-template-columns: 112px minmax(0, 1fr); }
  .vkbd { width: 100%; padding: 8px; gap: 8px; border-radius: 14px; }
  .vk-main { min-width: 0; width: 100%; gap: 3px; }
  .vk-row { gap: 3px; }
  .vk { height: 30px; font-size: .62rem; border-radius: 5px; }
  .vk.is-word { font-size: .5rem; }
  .vk-nav { width: 100%; max-width: 220px; gap: 3px; }
  .bs-item { font-size: .74rem; padding: 6px; gap: 5px; }
  .bs-item .ico { width: 15px; height: 15px; }
  .bs-print { grid-template-columns: 1fr; }
  .bs-preview { display: none; }
  .node-current { width: 112px; }
  .node-current .mascot { width: 54px; height: 64px; }
  .pw-plans { grid-template-columns: 1fr; }
  .pw-head { flex-direction: column; text-align: center; }
  .badges { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .modal { padding: 22px 18px; }
  .mascot-says .bubble { font-size: .95rem; }
}
@media (max-width: 420px) {
  .hide-xs { display: none; }
  .lang button { padding: 6px 7px; }
  .avatar-btn { width: 36px; height: 36px; }
  .points-chip .ico { display: none; }
  .node { width: 64px; height: 60px; }
  .st-current .node { width: 74px; height: 70px; }
  .kind-exam .node { width: 84px; height: 78px; }
  .node-title { max-width: 26vw; font-size: .72rem; }
  .res-tile dd { font-size: 1.2rem; }
}

/* ------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .marquee-track { animation: none !important; }
  .m-cursor, .caret { animation: none !important; }
}
.lesson-screen:has(.feedback) .lesson-main { padding-bottom: min(60vh, 460px); }

.mini-board li { min-width: 0; }
.mini-board .lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-row { min-width: 0; flex-wrap: wrap; }
.mini-badges li, .badges .badge { cursor: help; }
.mini-badges li:focus-visible, .badges .badge:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.rb-tooltip .tip-state { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 99px; background: rgba(255,255,255,.18); font-weight: 800; font-size: .72rem; }

.bs-cmd { position: relative; width: 100%; background: var(--paper); color: var(--ink); cursor: pointer; text-align: left; font: inherit; font-weight: 700; }
.bs-cmd:hover { background: var(--mist); }
.bs-cmd.is-hl { border-color: var(--pri-text) !important; animation: hlpulse 1.6s ease-out infinite; }
.bs-cmd.is-picked { border-color: var(--pri-text); box-shadow: 0 0 0 2px var(--pri); }
.bs-cmd .hl-tag { left: auto; right: 10px; bottom: auto; top: 50%; transform: translateY(-50%); animation: none; }
.bs-cmd .hl-tag::after { display: none; }

/* ------------------------------------------------------------ certificate */
.cert-page { max-width: 900px; margin: 0 auto; padding-top: 24px; display: grid; gap: 18px; }
.cert-locked { padding: 28px; display: grid; justify-items: center; gap: 12px; text-align: center; }
.cert-tools { padding: 14px 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cert-tools label { font-weight: 800; }
.cert-tools input { flex: 1; min-width: 180px; min-height: 42px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line-soft); background: var(--cream); color: var(--ink); font: 700 1rem var(--f-body); }
.certificate { background: #FDFDF8; color: #0B1B3A; border-radius: 18px; padding: clamp(12px, 3vw, 22px); box-shadow: var(--shadow-lg); }
.cert-border { border: 3px solid #1F5FD6; outline: 1px solid #1F5FD6; outline-offset: -10px; border-radius: 12px; padding: clamp(20px, 5vw, 48px); display: grid; justify-items: center; gap: 10px; text-align: center;
  background: radial-gradient(circle at 50% 0%, #E5EEFF 0, transparent 55%), repeating-linear-gradient(45deg, transparent 0 14px, rgba(31,95,214,.025) 14px 15px); }
.cert-head { display: flex; align-items: center; gap: 10px; }
.cert-brand { font: 700 1.8rem/1 var(--f-display); color: #1F5FD6; }
.cert-eyebrow { font: 800 .9rem/1.2 var(--f-body); letter-spacing: .22em; text-transform: uppercase; color: #1749A8; }
.cert-small { color: #3D5078; font-style: italic; }
.cert-name { font: 700 clamp(1.8rem, 5vw, 3rem)/1.1 var(--f-display); color: #0B2559; border-bottom: 2px solid #CFE0FF; padding: 0 24px 6px; min-width: 60%; overflow-wrap: anywhere; }
.cert-body { max-width: 52ch; color: #0B1B3A; }
.cert-units { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-size: .78rem; font-weight: 700; color: #3D5078; }
.cert-units li { display: inline-flex; align-items: center; gap: 4px; }
.cert-units .ico { width: 14px; height: 14px; color: #1F5FD6; stroke-width: 3; }
.cert-foot { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 16px; margin-top: 18px; }
.cert-foot small { display: block; font-weight: 700; color: #3D5078; font-size: .78rem; }
.cert-line { display: block; height: 2px; background: #9FB0D2; margin-bottom: 6px; }
.cert-seal { width: 72px; height: 72px; border-radius: 50%; background: #1F5FD6; color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 6px #CFE0FF; }
.cert-seal .ico { width: 36px; height: 36px; }
.cert-disclaimer { margin-top: 10px; font-size: .72rem; color: #5E6E8C; }
.cert-card .h3 { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 560px) { .cert-foot { grid-template-columns: 1fr; justify-items: center; } .cert-line { width: 180px; margin-inline: auto; } }
@media print {
  #header, .cert-tools, #toasts, body::before { display: none !important; }
  body, #app { background: #fff !important; padding: 0 !important; }
  .view-certificate .cert-page { padding: 0; max-width: none; }
  .certificate { box-shadow: none; }
  @page { size: landscape; margin: 12mm; }
}

/* ------------------------------------------------------------ phase 4 polish */
#app > * { animation: viewin .28s ease-out both; }
@keyframes viewin { from { opacity: 0; transform: translateY(8px); } }
h1[tabindex="-1"]:focus, .ex-prompt:focus { outline: none; }
.node:hover { transform: translateY(-2px); }
.st-locked .node:hover, .st-premium .node:hover { transform: none; }
@media (max-width: 380px) { .brand-sub { display: none; } }

:root[data-theme="dark"] .pill:not(.pill-premium) { color: var(--pri-text); }
:root[data-theme="dark"] .pw-plan .pill { color: #fff; }

/* responsive fixes (phase 4) */
@media (max-width: 900px) { .hero { grid-template-columns: minmax(0, 1fr); } }
.learn-head > div, .lb-head > div, .prof-head > div { min-width: 0; }
.learn-head h1, .lb-head h1, .prof-head h1, .learn-head .h2, .prof-head .h2 { overflow-wrap: anywhere; }
.mascot-says .bubble { min-width: 0; overflow-wrap: anywhere; }
.stat-row dd, .stat-row dt { overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .unit-banner { left: 0; right: 0; }
  .brand-sub { display: none; }
  .hdr .chip { padding: 0 4px; gap: 3px; }
  .hdr .lang button { padding: 6px 6px; }
  .level-say .mascot, .lb-head .mascot, .prof-head .mascot { width: 64px; height: 76px; }
}
@media (max-width: 360px) {
  .brand-name { display: none; }
  .stat-row { grid-template-columns: 1fr; }
}
.landing, .lb, .profile, .cert-page, .level-page, .lesson-main, .exercise, .ex-body, .theory { grid-template-columns: minmax(0, 1fr); }
.lb-list, .profile > .card { grid-template-columns: minmax(0, 1fr); }
.seg { grid-auto-columns: minmax(0, 1fr); }
.seg button { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 380px) { .seg button { font-size: .8rem; padding: 10px 4px; } .lb-row { gap: 8px; padding: 8px; } }
.lb-pts { flex: none; white-space: nowrap; } @media (max-width: 380px) { .lb-pts small { display: none; } }

.forgot { margin-top: -6px; text-align: right; }

.confirm .stars { justify-content: center; } .confirm .star .ico { width: 34px; height: 34px; }

/* ------------------------------------------------------------ seasonal: holidays */
:root { --snow: rgba(120, 160, 235, .55); }
:root[data-theme="dark"] { --snow: rgba(255, 255, 255, .75); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --snow: rgba(255, 255, 255, .75); } }
.snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 90; }
.season-pill { display: inline-flex; width: fit-content; justify-self: start; align-self: start; align-items: center; gap: 6px; margin: 0 0 12px; padding: 6px 14px; border-radius: 999px;
  background: color-mix(in srgb, #E0383E 12%, var(--paper)); color: #B4232A; border: 1px solid color-mix(in srgb, #E0383E 30%, transparent); font-weight: 800; font-size: .9rem; }
:root[data-theme="dark"] .season-pill { color: #FFB3B6; }
