/* ==========================================================================
   CurlyScript
   Palette and type come from the book "The School of Scriptology".
   ========================================================================== */

@font-face { font-family: 'Baloo 2'; src: url('../fonts/baloo-2-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url('../fonts/baloo-2-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url('../fonts/baloo-2-latin-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('../fonts/nunito-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('../fonts/nunito-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('../fonts/nunito-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('../fonts/nunito-latin-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('../fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('../fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --ink: #22304A;
  --ink-2: #4B5568;
  --ink-3: #69728A; /* 4.5:1 on paper and cards, for small print */
  --paper: #FFFDF6;
  --card: #FFFFFF;
  --line: #E8E4D6;
  --line-2: #D9D4C3;
  --yellow: #F7DF1E;
  --yellow-deep: #CDB600;
  --yellow-soft: #FFF7BF;
  --coral: #FF6B6B;
  --coral-deep: #D94A4A;
  --coral-soft: #FFE9E9;
  --teal: #2EC4B6;
  --teal-deep: #189C90;
  --teal-soft: #DCF6F2;
  --purple: #7B61FF;
  --purple-deep: #5A40DD;
  --purple-soft: #EEEAFF;
  --pink: #FF8C9B;
  --pink-deep: #E2667A;
  --pink-soft: #FFE6EA;
  --orange: #FF9F43;
  --orange-deep: #E07E1F;
  --orange-soft: #FFEEDC;
  --green: #4CB85A;
  --green-deep: #34923F;
  --green-soft: #E2F5E4;
  --gold: #F4B400;
  --code-bg: #FBF9F1;
  --console-bg: #1F2739;
  --shadow: 0 1px 0 rgba(34, 48, 74, 0.06), 0 6px 18px rgba(34, 48, 74, 0.07);
  --radius: 18px;
  --radius-sm: 12px;
  --app-width: 560px;
  --safe-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --nav-h: 66px;
  --font-display: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --ink: #F1F3F8;
  --ink-2: #C5CCDA;
  --ink-3: #8F98AB;
  --paper: #131927;
  --card: #1C2435;
  --line: #2B3549;
  --line-2: #39445C;
  --yellow-soft: #3A3713;
  --coral-soft: #3D2129;
  --teal-soft: #14363A;
  --purple-soft: #2A2550;
  --pink-soft: #3B2230;
  --orange-soft: #3D2C1C;
  --green-soft: #183421;
  --code-bg: #182032;
  --console-bg: #0E1320;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 8px 22px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
.svg { display: inline-flex; line-height: 0; }
.svg svg:not(.icon) { width: 100%; height: auto; }
.icon { width: 1.25em; height: 1.25em; vertical-align: -0.25em; flex: none; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; border-radius: 8px; }
#view:focus, #view:focus-visible { outline: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; margin: 0; letter-spacing: -0.005em; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: 0 0 0.6em; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 14px; }
.center { text-align: center; }
code.inline {
  font-family: var(--font-mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; font-size: 0.88em; background: var(--code-bg);
  border: 1px solid var(--line); padding: 0.05em 0.35em; border-radius: 6px; color: var(--coral-deep);
}
:root[data-theme='dark'] code.inline { color: #FF9C9C; }

/* ---------------------------------------------------------------- layout */
#app { min-height: 100%; }
.shell {
  max-width: var(--app-width);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  background: var(--paper);
}
@media (min-width: 640px) {
  body { background: radial-gradient(var(--line) 1.4px, transparent 1.5px) 0 0 / 22px 22px, var(--paper); }
  .shell { box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(34, 48, 74, 0.08); }
}
.screen { padding: 16px 16px calc(var(--nav-h) + var(--safe-bottom) + 24px); }
.screen.full { padding-bottom: 24px; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.between { justify-content: space-between; }

/* ---------------------------------------------------------------- buttons */
.btn {
  --b: var(--ink); --b-deep: #0F1626; --b-fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px; border: 0; border-radius: 16px;
  background: var(--b); color: var(--b-fg);
  font-family: var(--font-display); font-weight: 800; font-size: 18px; letter-spacing: 0.01em;
  box-shadow: 0 4px 0 var(--b-deep);
  cursor: pointer; transition: transform 0.06s, box-shadow 0.06s, filter 0.15s;
  user-select: none; text-decoration: none;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--b-deep); }
.btn:disabled { cursor: not-allowed; --b: var(--line); --b-deep: var(--line-2); --b-fg: var(--ink-3); }
.btn-primary { --b: var(--yellow); --b-deep: var(--yellow-deep); --b-fg: #22304A; }
.btn-teal { --b: var(--teal); --b-deep: var(--teal-deep); --b-fg: #22304A; }
.btn-danger { --b: #C93C3C; --b-deep: #9E2C2C; --b-fg: #fff; }
.btn-purple { --b: var(--purple-deep); --b-deep: #4330B8; --b-fg: #fff; }
.btn-ghost { --b: var(--card); --b-deep: var(--line-2); --b-fg: var(--ink); border: 2px solid var(--line-2); }
.btn-small { min-height: 40px; padding: 0 14px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 4px; color: var(--purple-deep); font-weight: 700; cursor: pointer; }
:root[data-theme='dark'] .link-btn { color: #A796FF; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--line); }
.icon-btn .icon { width: 24px; height: 24px; }

/* ---------------------------------------------------------------- HUD (top bar) */
.hud {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 6px;
  padding: calc(10px + var(--safe-top)) 14px 10px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--line);
}
.hud-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 12px;
  font-family: var(--font-display); font-weight: 800; font-size: 17px; background: transparent; border: 0; cursor: pointer;
}
.hud-chip:hover { background: var(--line); }
.hud-chip .icon { width: 22px; height: 22px; }
.chip-streak { color: var(--orange); }
.chip-streak.cold { color: var(--ink-3); }
.chip-coins { color: var(--gold); }
.chip-coins > span:not(.svg) { color: var(--ink); }
.chip-streak > span:not(.svg) { color: var(--ink); }
.hud-level {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  background: none; border: 0; cursor: pointer; padding: 4px;
}
.ring { --p: 0; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--teal) calc(var(--p) * 1%), var(--line) 0); }
.ring > span { width: 30px; height: 30px; border-radius: 50%; background: var(--paper); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 14px; }
.goal-ring { --p: 0; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--yellow-deep) calc(var(--p) * 1%), var(--line) 0); }
.goal-ring > span { width: 30px; height: 30px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; }
.goal-ring .icon { width: 18px; height: 18px; color: var(--yellow-deep); }

/* ---------------------------------------------------------------- bottom navigation */
.nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 30;
  width: 100%; max-width: var(--app-width);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 6px 6px calc(6px + var(--safe-bottom));
  background: var(--card); border-top: 2px solid var(--line);
}
.nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 14px;
  color: var(--ink-3); text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 13px;
}
.nav a .icon { width: 26px; height: 26px; }
.nav a.active { color: var(--ink); background: var(--yellow-soft); }
.nav a.active .icon { color: var(--purple); }
:root[data-theme='dark'] .nav a.active { background: #2A3247; }
.nav .dot { position: absolute; }

/* ---------------------------------------------------------------- map */
.map-intro { display: flex; gap: 10px; margin: 4px 0 18px; }
.quick-card {
  flex: 1; display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 12px; border-radius: var(--radius); background: var(--card); border: 2px solid var(--line);
  cursor: pointer; color: var(--ink); text-decoration: none; min-width: 0;
}
.quick-card:active { transform: translateY(1px); }
.quick-card .qc-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.quick-card .qc-icon .icon { width: 24px; height: 24px; }
.quick-card strong { display: block; font-family: var(--font-display); font-size: 16px; line-height: 1.1; }
.quick-card small { color: var(--ink-2); font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-card.done { opacity: 0.75; }

.school {
  --c: var(--yellow); --c-deep: var(--yellow-deep); --c-soft: var(--yellow-soft); --c-fg: #22304A;
  margin: 0 -16px; padding: 0 16px 28px; position: relative;
}
.school-yellow { --c: var(--yellow); --c-deep: var(--yellow-deep); --c-soft: var(--yellow-soft); --c-fg: #22304A; }
.school-teal { --c: var(--teal); --c-deep: var(--teal-deep); --c-soft: var(--teal-soft); --c-fg: #22304A; }
.school-pink { --c: var(--pink); --c-deep: var(--pink-deep); --c-soft: var(--pink-soft); --c-fg: #22304A; }
.school-orange { --c: var(--orange); --c-deep: var(--orange-deep); --c-soft: var(--orange-soft); --c-fg: #22304A; }
.school-purple { --c: var(--purple); --c-deep: var(--purple-deep); --c-soft: var(--purple-soft); --c-fg: #fff; }
.school-green { --c: var(--green); --c-deep: var(--green-deep); --c-soft: var(--green-soft); --c-fg: #22304A; }
.school-head {
  position: relative; overflow: hidden;
  background: var(--c); color: var(--c-fg); border-radius: 24px; padding: 18px 20px 20px; margin-bottom: 8px;
  box-shadow: 0 5px 0 var(--c-deep);
}
.school-head::after {
  content: '{ }'; position: absolute; right: -6px; bottom: -34px; font-family: var(--font-mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; font-weight: 700;
  font-size: 110px; line-height: 1; opacity: 0.14; pointer-events: none;
}
.school-head h2 { font-size: 34px; line-height: 1; letter-spacing: -0.01em; }
.school-head p { margin: 6px 0 0; font-weight: 700; max-width: 32ch; }
/* the bright schools carry navy text; purple is deepened so its white text stays readable */
.school-purple .school-head { background: var(--purple-deep); box-shadow: 0 5px 0 #4330B8; }
.school-head .school-meter { margin-top: 12px; height: 8px; border-radius: 8px; background: rgba(255,255,255,.35); overflow: hidden; max-width: 220px; }
.school-head .school-meter i { display: block; height: 100%; background: currentColor; border-radius: 8px; }
.school-yellow .school-head .school-meter, .school-teal .school-head .school-meter, .school-pink .school-head .school-meter, .school-orange .school-head .school-meter, .school-green .school-head .school-meter { background: rgba(34,48,74,.15); }

.grade-label {
  display: flex; align-items: baseline; gap: 10px; margin: 26px 0 6px; padding: 0 4px;
}
.grade-label .tag { font-family: var(--font-display); font-weight: 800; font-size: 14px; padding: 2px 10px; border-radius: 10px; background: var(--c-soft); color: var(--ink); }
.grade-label h3 { font-size: 19px; }
.grade-label .gp { margin-left: auto; font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--ink-3); white-space: nowrap; }

.path { position: relative; display: flex; flex-direction: column; align-items: center; padding: 6px 0; }
.node-wrap { position: relative; height: 108px; width: 100%; display: flex; justify-content: center; }
.node {
  position: relative; width: 76px; height: 70px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--c); color: var(--c-fg); box-shadow: 0 7px 0 var(--c-deep);
  display: grid; place-items: center; transition: transform 0.08s, box-shadow 0.08s;
}
.node .icon { width: 32px; height: 32px; }
.node:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 2px 0 var(--c-deep); }
.node.locked { background: var(--line); color: var(--ink-3); box-shadow: 0 7px 0 var(--line-2); cursor: pointer; }
.node.done { background: var(--gold); color: #fff; box-shadow: 0 7px 0 #C48F00; }
.node.current::before {
  content: ''; position: absolute; inset: -9px; border-radius: 50%; border: 4px solid var(--c);
  opacity: 0.45; animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(0.92); opacity: 0.6; } 100% { transform: scale(1.18); opacity: 0; } }
.node .stars {
  position: absolute; bottom: -13px; left: 50%; transform: translateX(-50%); display: flex; gap: 1px;
  padding: 2px 5px; border-radius: 999px; background: var(--card); box-shadow: 0 0 0 2px var(--line); color: var(--line-2);
}
.node .stars .icon { width: 14px; height: 14px; display: block; }
.node .stars .on { color: var(--gold); }
.node-boss { width: 96px; height: 82px; border-radius: 28px; background: var(--card); border: 3px solid var(--coral); box-shadow: 0 7px 0 var(--coral-deep); }
.node-boss .svg { width: 70px; }
.node-boss.locked { border-color: var(--line-2); box-shadow: 0 7px 0 var(--line-2); filter: grayscale(1); opacity: 0.7; }
.node-boss.done { background: var(--green-soft); border-color: var(--green); box-shadow: 0 7px 0 var(--green-deep); }
.node-label { position: absolute; top: 87px; font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--ink-2); white-space: nowrap; pointer-events: none; }
.walker { position: absolute; width: 64px; top: -6px; pointer-events: none; z-index: 2; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.graduated { text-align: center; padding: 30px 10px 10px; }
.graduated .svg { width: 160px; }

/* ---------------------------------------------------------------- generic cards and lists */
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card-tight { padding: 12px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--card); border: 2px solid var(--line); text-align: left; color: var(--ink); text-decoration: none; width: 100%; cursor: pointer;
}
.list-item .li-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.list-item .li-icon .icon { width: 24px; height: 24px; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-main strong { display: block; font-family: var(--font-display); font-size: 17px; line-height: 1.15; }
.list-item .li-main small { display: block; color: var(--ink-2); font-size: 14px; }
.list-item.locked { opacity: 0.8; }
.list-item.locked .li-icon { filter: grayscale(1); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-weight: 800; font-size: 13px; background: var(--line); color: var(--ink-2); }
.pill-teal { background: var(--teal-soft); color: var(--teal-deep); }
.pill-gold { background: var(--yellow-soft); color: #8A6D00; }
.pill-coral { background: var(--coral-soft); color: var(--coral-deep); }
.pill-purple { background: var(--purple-soft); color: var(--purple-deep); }
:root[data-theme='dark'] .pill-gold { color: var(--yellow); }
:root[data-theme='dark'] .pill-teal { color: var(--teal); }
:root[data-theme='dark'] .pill-purple { color: #B5A6FF; }
:root[data-theme='dark'] .pill-coral { color: #FF9C9C; }
.bg-yellow { background: var(--yellow-soft); color: #8A6D00; }
.bg-teal { background: var(--teal-soft); color: #0F6F66; }
.bg-coral { background: var(--coral-soft); color: var(--coral-deep); }
.bg-purple { background: var(--purple-soft); color: var(--purple-deep); }
.bg-orange { background: var(--orange-soft); color: var(--orange-deep); }
.bg-green { background: var(--green-soft); color: var(--green-deep); }
.bg-pink { background: var(--pink-soft); color: var(--pink-deep); }
:root[data-theme='dark'] .bg-yellow { color: var(--yellow); }
:root[data-theme='dark'] .bg-teal { color: var(--teal); }
:root[data-theme='dark'] .bg-purple { color: #B5A6FF; }
:root[data-theme='dark'] .bg-coral { color: #FF9C9C; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 10px; }
.section-title h2 { font-size: 20px; }
.page-head { display: flex; align-items: center; gap: 10px; padding-top: calc(4px + var(--safe-top)); margin-bottom: 14px; }
.page-head h1 { font-size: 28px; }
.tabs { display: flex; gap: 6px; padding: 4px; background: var(--line); border-radius: 14px; margin-bottom: 14px; }
.tabs button { flex: 1; border: 0; background: transparent; border-radius: 10px; padding: 8px; font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--ink-2); cursor: pointer; }
.tabs button.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.empty { text-align: center; padding: 26px 16px; color: var(--ink-2); }
.empty .svg { width: 110px; margin-bottom: 8px; }

/* ---------------------------------------------------------------- lesson player */
.player { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.notes-btn { position: relative; }
.notes-btn .mini-crown {
  position: absolute; right: -2px; top: -2px; width: 17px; height: 17px; border-radius: 50%;
  display: grid; place-items: center; background: var(--plus-bg); color: var(--plus-ink);
}
.notes-btn .mini-crown .icon { width: 11px; height: 11px; }
.player-top {
  display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-top)) 12px 10px;
  position: sticky; top: 0; background: var(--paper); z-index: 10;
}
.bar { flex: 1; height: 16px; background: var(--line); border-radius: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 10px; background: var(--teal); transition: width 0.35s ease; position: relative; }
.bar i::after { content: ''; position: absolute; left: 8px; right: 8px; top: 3px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.4); }
.lives { display: flex; gap: 2px; color: var(--coral); }
.lives .icon { width: 24px; height: 24px; }
.lives .lost { color: var(--line-2); }
.player-body { flex: 1; padding: 8px 18px 160px; }
.ex-type { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 800; font-size: 14px; color: var(--purple-deep); margin-bottom: 8px; }
:root[data-theme='dark'] .ex-type { color: #B5A6FF; }
.combo { margin-left: 8px; color: var(--orange-deep); }
.ex-prompt { font-size: 22px; margin-bottom: 14px; }
.player-foot {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: var(--app-width); z-index: 15;
  padding: 14px 18px calc(14px + var(--safe-bottom)); background: var(--paper); border-top: 2px solid var(--line);
}
.feedback {
  position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 110%); width: 100%; max-width: var(--app-width); z-index: 16;
  padding: 16px 18px calc(16px + var(--safe-bottom)); transition: transform 0.25s cubic-bezier(.2,.9,.3,1.2);
  border-top: 3px solid transparent;
}
.feedback.show { transform: translate(-50%, 0); }
.feedback.good { background: var(--teal-soft); border-color: var(--teal); }
.feedback.bad { background: var(--coral-soft); border-color: var(--coral); }
.feedback .fb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.feedback .fb-head .svg { width: 46px; flex: none; }
.feedback h3 { font-size: 22px; }
.feedback.good h3 { color: var(--teal-deep); }
.feedback.bad h3 { color: var(--coral-deep); }
:root[data-theme='dark'] .feedback.good h3 { color: var(--teal); }
:root[data-theme='dark'] .feedback.bad h3 { color: #FF9C9C; }
.feedback .fb-body { max-height: 34vh; overflow: auto; margin-bottom: 12px; font-size: 15px; }
.feedback .fb-answer { font-weight: 800; }
.feedback pre.code { margin: 6px 0; font-size: 13px; }
.feedback .report { font-size: 13px; }

/* learn cards */
.learn-card { background: var(--card); border: 2px solid var(--line); border-radius: 22px; padding: 18px; }
.learn-title { font-size: 24px; margin-bottom: 10px; }
.learn-text { font-size: 17px; }
.learn-text ul { margin: 0 0 0.6em; padding-left: 1.2em; }
.learn-text li { margin: 0.2em 0; }
.learn-tip { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--yellow-soft); font-size: 15px; }
.try-it { margin-top: 10px; }
.try-it .console { margin-top: 10px; }
.learn-host { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.learn-host .svg { width: 74px; flex: none; }
.bubble { position: relative; background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 10px 14px; font-weight: 700; }
.bubble::after { content: ''; position: absolute; left: -9px; bottom: 16px; width: 14px; height: 14px; background: var(--card); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg); }

/* code */
pre.code, .code {
  font-family: var(--font-mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; font-size: 14.5px; line-height: 1.6; background: var(--code-bg);
  border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 0 0 14px;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; color: var(--ink);
}
.t-kw { color: #B0217A; font-weight: 700; }
.t-str { color: #2E7D32; }
.t-sub { color: #6A1B9A; }
.t-num { color: #D35400; }
.t-com { color: #8B919C; font-style: italic; }
.t-fn { color: #1E63C4; font-weight: 700; }
.t-lit { color: #B0217A; }
.t-bi { color: #7A3FD0; }
.t-prop { color: #00798C; }
.t-cls { color: #C25B00; }
.t-op { color: #5B6475; }
:root[data-theme='dark'] .t-kw { color: #FF7AC6; }
:root[data-theme='dark'] .t-str { color: #8EE59B; }
:root[data-theme='dark'] .t-sub { color: #E1B3FF; }
:root[data-theme='dark'] .t-num { color: #FFB86B; }
:root[data-theme='dark'] .t-fn { color: #7CC4FF; }
:root[data-theme='dark'] .t-lit { color: #FF7AC6; }
:root[data-theme='dark'] .t-bi { color: #C7A6FF; }
:root[data-theme='dark'] .t-prop { color: #6FE0E8; }
:root[data-theme='dark'] .t-cls { color: #FFC56B; }
:root[data-theme='dark'] .t-op { color: #A9B2C3; }

.console { background: var(--console-bg); border-radius: 14px; overflow: hidden; margin: 0 0 14px; }
.console-bar { display: flex; align-items: center; gap: 5px; padding: 6px 10px; background: rgba(255,255,255,0.07); }
.console-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--coral); }
.console-bar i:nth-child(2) { background: var(--yellow); }
.console-bar i:nth-child(3) { background: var(--green); }
.console-bar span { margin-left: 6px; font-family: var(--font-display); font-weight: 700; font-size: 13px; color: #AEB8CE; }
.console-body { padding: 10px 14px; font-family: var(--font-mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; font-size: 14px; line-height: 1.55; color: #E9EEF7; max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-word; min-height: 44px; }
.console-line.error { color: #FF9C9C; }
.console-line.warn { color: #FFD479; }
.console-line.muted { color: #9AA4BA; font-style: italic; }
.console-line.pass { color: #8EE59B; }
.console-line.fail { color: #FF9C9C; }

/* options */
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px;
  border: 2px solid var(--line-2); border-bottom-width: 4px; border-radius: 16px; background: var(--card);
  text-align: left; font-size: 17px; font-weight: 700; cursor: pointer; transition: transform 0.06s;
}
.option:active:not(:disabled) { transform: translateY(2px); }
.option .opt-key { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--line-2); font-family: var(--font-display); font-size: 14px; color: var(--ink-3); }
.option[aria-checked='true'], .option[aria-pressed='true'] { border-color: var(--purple); background: var(--purple-soft); }
.option[aria-checked='true'] .opt-key { border-color: var(--purple); color: var(--purple); }
.option.is-correct { border-color: var(--teal); background: var(--teal-soft); }
.option.is-wrong { border-color: var(--coral); background: var(--coral-soft); }
.option:disabled { cursor: default; }
.mono-opt { font-family: var(--font-mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; font-size: 15px; white-space: pre-wrap; font-weight: 400; }
.tf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf-option { justify-content: center; font-family: var(--font-display); font-size: 22px; min-height: 76px; }
.statement { font-size: 18px; font-weight: 700; padding: 14px; border-radius: 16px; background: var(--card); border: 2px dashed var(--line-2); }

/* fill the blanks */
.fill-code { line-height: 2.3; }
.slot {
  display: inline-block; min-width: 48px; padding: 0 8px; margin: 0 2px; border-radius: 8px;
  border: 2px dashed var(--purple); background: var(--purple-soft); font-family: var(--font-mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; font-size: 14px; line-height: 1.7; cursor: pointer; vertical-align: middle; color: var(--ink);
}
.slot.filled { border-style: solid; }
.slot.is-correct { border-color: var(--teal); background: var(--teal-soft); }
.slot.is-wrong { border-color: var(--coral); background: var(--coral-soft); }
.token-bank, .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border: 2px solid var(--line-2); border-bottom-width: 4px; border-radius: 12px; background: var(--card);
  font-family: var(--font-mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; font-size: 15px; cursor: pointer;
}
.chip:disabled { opacity: 0.25; cursor: default; }

/* order lines */
.order-label { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--ink-3); margin: 6px 0; }
.order-answer, .order-bank { display: flex; flex-direction: column; gap: 6px; min-height: 52px; padding: 8px; border-radius: 16px; }
.order-answer { background: var(--code-bg); border: 2px dashed var(--line-2); margin-bottom: 8px; }
.order-answer.empty::before { content: 'Your lines go here'; color: var(--ink-3); font-size: 14px; padding: 6px; }
.code-line {
  display: block; width: 100%; text-align: left; padding: 8px 12px; border-radius: 10px; border: 2px solid var(--line-2); border-bottom-width: 3px;
  background: var(--card); font-family: var(--font-mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; font-size: 14px; white-space: pre; overflow-x: auto; cursor: pointer;
}
.code-line.is-correct { border-color: var(--teal); background: var(--teal-soft); }
.code-line.is-wrong { border-color: var(--coral); background: var(--coral-soft); }

/* bug hunt */
.bug-code { padding: 6px; }
.bug-line {
  display: flex; gap: 10px; width: 100%; text-align: left; border: 2px solid transparent; background: none; border-radius: 10px;
  padding: 4px 8px; font-family: var(--font-mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; font-size: 14.5px; line-height: 1.55; cursor: pointer; white-space: pre-wrap; word-break: break-word;
}
.bug-line:hover { background: var(--line); }
.bug-line .ln-no { color: var(--ink-3); min-width: 1.4em; text-align: right; user-select: none; }
.bug-line[aria-selected='true'] { border-color: var(--purple); background: var(--purple-soft); }
.bug-line.is-correct { border-color: var(--teal); background: var(--teal-soft); }
.bug-line.is-wrong { border-color: var(--coral); background: var(--coral-soft); }

/* matching */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-col { display: flex; flex-direction: column; gap: 10px; }
.match-card {
  min-height: 58px; padding: 8px 10px; border: 2px solid var(--line-2); border-bottom-width: 4px; border-radius: 14px; background: var(--card);
  font-weight: 700; font-size: 15px; cursor: pointer; text-align: center;
}
.match-card.mono { font-family: var(--font-mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; font-weight: 400; }
.match-card.selected { border-color: var(--purple); background: var(--purple-soft); }
.match-card.done { border-color: var(--teal); background: var(--teal-soft); opacity: 0.6; }
.shake { animation: shake 0.35s; border-color: var(--coral) !important; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

/* type */
.type-input {
  width: 100%; min-height: 56px; padding: 0 16px; border-radius: 16px; border: 2px solid var(--line-2); background: var(--card); color: var(--ink);
  font-family: var(--font-mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; font-size: 18px;
}
.type-input:focus { outline: none; border-color: var(--purple); }
.type-input.is-correct { border-color: var(--teal); background: var(--teal-soft); }
.type-input.is-wrong { border-color: var(--coral); background: var(--coral-soft); }

/* editor */
.editor-wrap { margin-bottom: 10px; }
.editor { position: relative; border: 2px solid var(--line-2); border-radius: 14px; background: var(--code-bg); }
.editor:focus-within { border-color: var(--purple); }
.editor-hl, .editor-input {
  margin: 0; padding: 12px 14px; font-family: var(--font-mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; font-size: 15px; line-height: 1.6; tab-size: 2;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; letter-spacing: 0; border: 0;
}
.editor-hl { pointer-events: none; color: var(--ink); min-height: 100%; }
.editor-input {
  position: absolute; inset: 0; width: 100%; height: 100%; resize: none; background: transparent; color: transparent;
  caret-color: var(--ink); outline: none; overflow: hidden;
}
.editor-input::selection { background: rgba(123, 97, 255, 0.28); color: transparent; }
.symbol-bar { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.symbol-bar::-webkit-scrollbar { display: none; }
.sym { flex: none; min-width: 40px; height: 36px; padding: 0 10px; border-radius: 10px; border: 2px solid var(--line-2); background: var(--card); font-family: var(--font-mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; font-size: 14px; cursor: pointer; }

/* results / celebration */
.result { text-align: center; padding: calc(30px + var(--safe-top)) 18px 30px; display: flex; flex-direction: column; align-items: center; gap: 14px; min-height: 100vh; min-height: 100dvh; justify-content: center; }
.result .svg.hero { width: 170px; }
.result h1 { font-size: 34px; }
.big-stars { display: flex; gap: 6px; color: var(--line-2); }
.big-stars .icon { width: 54px; height: 54px; }
.big-stars .on { color: var(--gold); animation: pop 0.45s cubic-bezier(.3,1.6,.5,1) both; }
.big-stars .on:nth-child(2) { animation-delay: 0.15s; }
.big-stars .on:nth-child(3) { animation-delay: 0.3s; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; }
.stat { border-radius: 16px; padding: 10px 6px; border: 2px solid var(--line); background: var(--card); }
.stat b { display: block; font-family: var(--font-display); font-size: 24px; line-height: 1.1; }
.stat span { font-size: 13px; color: var(--ink-2); font-weight: 700; }
.stat.xp b { color: var(--purple); }
.stat.coins b { color: var(--gold); }
.stat.acc b { color: var(--teal-deep); }
:root[data-theme='dark'] .stat.acc b { color: var(--teal); }
.result .actions { width: 100%; display: grid; gap: 10px; margin-top: 8px; }

/* boss battle */
.arena { padding: 4px 18px 0; }
.boss-stage { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 22px; background: var(--coral-soft); margin-bottom: 14px; }
.boss-stage .svg { width: 96px; flex: none; transition: transform 0.15s; }
.boss-stage.hit .svg { animation: bosshit 0.4s; }
.boss-stage.attack .svg { animation: bossattack 0.45s; }
@keyframes bosshit { 30% { transform: translateX(10px) rotate(8deg); filter: brightness(1.6); } 60% { transform: translateX(-6px); } }
@keyframes bossattack { 40% { transform: scale(1.18) translateX(-8px); } }
.boss-info { flex: 1; min-width: 0; }
.boss-info strong { font-family: var(--font-display); font-size: 19px; display: block; line-height: 1.1; }
.boss-taunt { font-size: 14px; color: var(--ink-2); min-height: 21px; }
.hp { height: 14px; border-radius: 10px; background: rgba(34,48,74,.12); overflow: hidden; margin-top: 6px; }
.hp i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--coral), var(--orange)); transition: width 0.4s; }
.timer-bar { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; margin-bottom: 12px; }
.timer-bar i { display: block; height: 100%; background: var(--purple); transition: width 1s linear; }
.timer-bar i.low { background: var(--coral); }
.flash-good { animation: flashgood 0.5s; }
@keyframes flashgood { 30% { background: var(--teal-soft); } }

/* overlays */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(15, 22, 38, 0.45); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity 0.2s; }
.sheet-backdrop.open { opacity: 1; }
.sheet { width: 100%; max-width: var(--app-width); max-height: 88vh; overflow: auto; background: var(--paper); border-radius: 26px 26px 0 0; padding: 22px 18px calc(22px + var(--safe-bottom)); transform: translateY(30px); transition: transform 0.25s; }
.sheet-backdrop.open .sheet { transform: translateY(0); }
.sheet-title { font-size: 24px; }
@media (min-width: 640px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 26px; } }
.toasts { position: fixed; top: calc(12px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px; background: var(--ink); color: var(--paper); font-weight: 700; box-shadow: var(--shadow); animation: toastin 0.3s cubic-bezier(.2,1.4,.4,1); }
.toast.leaving { opacity: 0; transform: translateY(-10px); transition: 0.3s; }
.toast-icon { display: inline-flex; width: 28px; }
.toast-icon .icon { width: 26px; height: 26px; }
.toast-achievement { background: var(--purple); color: #fff; }
.toast-good { background: var(--teal-deep); color: #fff; }
.toast-bad { background: var(--coral-deep); color: #fff; }
@keyframes toastin { from { transform: translateY(-16px) scale(0.96); opacity: 0; } }
.float-text { position: fixed; z-index: 90; transform: translateX(-50%); font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--purple); pointer-events: none; animation: floatup 1.1s ease-out forwards; }
.float-coin { color: var(--gold); }
@keyframes floatup { to { transform: translate(-50%, -60px); opacity: 0; } }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 95; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 800; font-size: 14px; color: var(--ink-2); }
.input {
  min-height: 50px; padding: 0 14px; border-radius: 14px; border: 2px solid var(--line-2); background: var(--card); color: var(--ink); font: inherit; font-size: 17px; width: 100%;
}
.input:focus { outline: none; border-color: var(--purple); }
.form-error { color: var(--coral-deep); font-weight: 700; font-size: 14px; min-height: 1.2em; }
:root[data-theme='dark'] .form-error { color: #FF9C9C; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 30px; background: var(--line-2); transition: 0.2s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid var(--purple); outline-offset: 2px; }
.setting { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 2px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting .s-main { flex: 1; }
.setting .s-main strong { display: block; }
.setting .s-main small { color: var(--ink-2); }
.choice-row { display: flex; gap: 8px; flex-wrap: wrap; }
.choice-row button { padding: 8px 14px; border-radius: 12px; border: 2px solid var(--line-2); background: var(--card); font-weight: 800; cursor: pointer; }
.choice-row button.active { border-color: var(--purple); background: var(--purple-soft); }

/* profile & shop */
.profile-hero { display: flex; align-items: center; gap: 14px; }
.avatar { width: 92px; height: 92px; border-radius: 28px; background: var(--yellow-soft); display: grid; place-items: center; overflow: hidden; flex: none; }
.avatar .svg { width: 100%; }
.avatar.small { width: 44px; height: 44px; border-radius: 14px; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-card { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); }
.stat-card .icon { width: 28px; height: 28px; flex: none; }
.stat-card b { display: block; font-family: var(--font-display); font-size: 21px; line-height: 1.05; }
.stat-card small { color: var(--ink-2); font-weight: 700; font-size: 13px; }
.badges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.badge { text-align: center; padding: 12px 6px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); }
.badge .b-icon { width: 54px; height: 54px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; background: var(--yellow-soft); }
.badge strong { display: block; font-family: var(--font-display); font-size: 14px; line-height: 1.15; }
.badge small { display: block; font-size: 12px; color: var(--ink-2); line-height: 1.3; margin-top: 2px; }
.badge.locked { opacity: 0.45; }
.badge.locked .b-icon { filter: grayscale(1); background: var(--line); }
.shop-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.shop-item { padding: 10px 6px 12px; border-radius: 18px; border: 2px solid var(--line); background: var(--card); text-align: center; cursor: pointer; }
.shop-item .svg { width: min(80px, 100%); }
.shop-item strong { display: block; font-family: var(--font-display); font-size: 14px; line-height: 1.1; }
.shop-item.equipped { border-color: var(--purple); background: var(--purple-soft); }
.price { display: inline-flex; align-items: center; gap: 2px; font-weight: 800; font-size: 14px; color: var(--ink-2); }
.price .icon { color: var(--gold); width: 18px; height: 18px; }

/* leaderboard */
.lb-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; }
.lb-row:nth-child(odd) { background: var(--card); }
.lb-row.me { background: var(--yellow-soft); border: 2px solid var(--yellow-deep); }
.lb-rank { width: 28px; font-family: var(--font-display); font-weight: 800; font-size: 18px; text-align: center; color: var(--ink-3); }
.lb-row:nth-child(1) .lb-rank { color: var(--gold); }
.lb-name { flex: 1; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-xp { font-family: var(--font-display); font-weight: 800; color: var(--purple); }

/* lab */
.lab-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.lab-tabs button { flex: 1; }
.preview { width: 100%; height: 300px; border: 2px solid var(--line-2); border-radius: 14px; background: #fff; }
.preview-small { height: 190px; margin: 10px 0; display: block; }
.web-demo { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.web-demo .preview-small { margin: 0; }
.ex-webcode details.cheat { margin-bottom: 10px; }
.lab-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.test-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.test-item { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; background: var(--card); border: 2px solid var(--line); font-size: 14px; }
.test-item .icon { width: 20px; height: 20px; margin-top: 1px; }
.test-item.pass { border-color: var(--teal); }
.test-item.pass .icon { color: var(--teal-deep); }
.test-item.fail { border-color: var(--coral); }
.test-item.fail .icon { color: var(--coral-deep); }
.test-item code { font-family: var(--font-mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; font-size: 13px; }

/* library */
.search { position: relative; margin-bottom: 12px; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search input { padding-left: 42px; }
.gloss-item { padding: 12px 0; border-bottom: 2px solid var(--line); }
.gloss-item strong { font-family: var(--font-display); font-size: 18px; }
details.cheat { border: 2px solid var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: 10px; }
details.cheat summary { padding: 14px 16px; font-family: var(--font-display); font-weight: 800; font-size: 18px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
details.cheat summary::-webkit-details-marker { display: none; }
details.cheat summary::after { content: '+'; color: var(--ink-3); }
details.cheat[open] summary::after { content: '−'; }
details.cheat .code { margin: 0 12px 12px; font-size: 13px; }

/* onboarding */
.onboard { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom)); }
.onboard .ob-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.onboard .ob-hero { width: 190px; margin: 0 auto; }
.onboard h1 { font-size: 36px; text-align: center; }
.onboard .lead { font-size: 18px; text-align: center; color: var(--ink-2); max-width: 30ch; margin: 0 auto; }
.wordmark { font-family: var(--font-display); font-weight: 800; font-size: 44px; line-height: 0.95; text-align: center; letter-spacing: -0.02em; }
.wordmark span { display: block; font-size: 58px; color: var(--ink); }
.wordmark small { display: block; font-size: 18px; color: var(--ink-2); letter-spacing: 0; margin-bottom: 6px; }
.goal-options { display: grid; gap: 10px; }
.goal-option { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--line-2); border-bottom-width: 4px; background: var(--card); font-weight: 800; font-size: 17px; cursor: pointer; }
.goal-option[aria-pressed='true'] { border-color: var(--purple); background: var(--purple-soft); }
.dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; }
.dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--line-2); transition: width 0.2s; }
.dots i.on { width: 22px; background: var(--purple); }

/* misc */
.callout { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius); }
.callout .svg { width: 58px; flex: none; }
.notice { padding: 12px 14px; border-radius: 14px; background: var(--yellow-soft); font-size: 15px; }
.level-up { text-align: center; }
.level-up .lvl { font-family: var(--font-display); font-weight: 800; font-size: 74px; line-height: 1; color: var(--purple); }
hr.soft { border: 0; height: 2px; background: var(--line); margin: 18px 0; }
.kbd-hint { font-size: 12px; color: var(--ink-3); text-align: center; margin-top: 8px; }
@media (hover: none) { .kbd-hint { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
:root[data-motion='off'] *, :root[data-motion='off'] *::before, :root[data-motion='off'] *::after { animation: none !important; transition: none !important; }
.feedback-inline { padding: 12px 14px; border-radius: 16px; max-height: 40vh; overflow: auto; }
.feedback-inline.good { background: var(--teal-soft); }
.feedback-inline.bad { background: var(--coral-soft); }
.feedback-inline h3 { font-size: 21px; margin-bottom: 4px; }
.feedback-inline pre.code { font-size: 13px; margin: 6px 0; }
.node-wrap.boss { height: 112px; }
.node-wrap.boss .node-label { top: 93px; }
.shop-hero { width: 150px; margin: 0 auto 10px; }
.sheet .hero { width: 130px; margin: 0 auto; }

.order-fixed pre.code { margin: 0 0 8px; opacity: .75; font-size: 14px; }
.order-fixed + .order-answer, .order-answer + .order-fixed { margin-top: 0; }

/* ---------- start-up and hidden helpers ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; font-family: 'Nunito', system-ui, sans-serif; color: var(--ink); }
.runner-frame { position: absolute; width: 0; height: 0; border: 0; visibility: hidden; pointer-events: none; }

/* ==========================================================================
   Hearts, streak freezes, quests, Plus, leagues and friends
   ========================================================================== */
:root {
  --plus-ink: #FFD25C;
  --plus-bg: #1F2739;
  --plus-bg-2: #2B3550;
  --sky-soft: #DDF0FF;
  --sky-deep: #2C7CC0;
}
:root[data-theme='dark'] { --plus-bg: #0E1320; --plus-bg-2: #1A2235; --sky-soft: #15304A; --sky-deep: #8CC8F7; }
.bg-sky { background: var(--sky-soft); color: var(--sky-deep); }
button.list-item { font: inherit; }
button.lb-row { width: 100%; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; background: transparent; }
button.lb-row:nth-child(odd) { background: var(--card); }

/* ---------- HUD ---------- */
.chip-hearts { color: var(--coral); }
.chip-hearts > span:not(.svg) { color: var(--ink); }
.chip-hearts.empty { color: var(--ink-3); }
.chip-hearts.plus { color: var(--purple); }
.chip-hearts.plus > span:not(.svg) .icon { width: 20px; color: var(--purple); }
.chip-streak { position: relative; }
.chip-badge { position: absolute; right: -2px; top: -2px; width: 16px; height: 16px; border-radius: 50%; background: var(--sky-soft); color: var(--sky-deep); display: grid; place-items: center; }
.chip-badge .icon { width: 11px !important; height: 11px !important; }
.goal-ring.boosted { background: conic-gradient(var(--purple) calc(var(--p) * 1%), var(--purple-soft) 0); }
.goal-ring.boosted .icon { color: var(--purple); }

/* ---------- hearts sheet and lesson hearts ---------- */
.heart-row { display: flex; justify-content: center; gap: 6px; color: var(--coral); }
.heart-row .icon { width: 40px; height: 40px; }
.heart-row .lost { color: var(--line-2); }
.heart-row.plus { color: var(--purple); }
.heart-row.plus .icon { width: 64px; height: 64px; }
.hearts-sheet .sheet-title, .hearts-sheet > p { text-align: center; }
.lives .plus { color: var(--purple); }
.lives b { font-family: var(--font-display); font-size: 18px; color: var(--ink); }
.stat.hearts b { color: var(--coral); }
.list-item.plus-item { border-color: var(--purple-soft); }

/* ---------- streak sheet ---------- */
.streak-day { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--line); color: var(--ink-3); }
.streak-day .icon { width: 20px; height: 20px; }
.streak-day.on { background: var(--yellow-soft); color: var(--orange); }
.streak-day.frozen { background: var(--sky-soft); color: var(--sky-deep); }
.streak-day.today { box-shadow: 0 0 0 2px var(--ink-3); }
.freeze-icon { width: 34px; color: var(--sky-deep); }
.freeze-icon .icon { width: 30px; height: 30px; }
.repair-card { border-color: var(--orange); background: var(--orange-soft); }

/* ---------- quests ---------- */
.quest-banner {
  display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; padding: 10px 14px;
  border-radius: var(--radius); border: 2px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none;
}
.quest-banner .qb-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--orange-soft); color: var(--orange-deep); flex: none; }
.quest-banner .qb-icon .icon { width: 26px; height: 26px; }
.quest-banner strong { display: block; font-family: var(--font-display); font-size: 16px; line-height: 1.1; }
.quest-banner > .svg { color: var(--ink-3); }
.qb-dots { display: flex; gap: 5px; margin-top: 5px; }
.qb-dots i { width: 26px; height: 7px; border-radius: 4px; background: var(--line); }
.qb-dots i.on { background: var(--green); }
.quest-banner.ready { border-color: var(--orange); background: var(--orange-soft); }
.quest-banner.ready .qb-icon { background: var(--orange); color: #fff; animation: chest-wiggle 1.6s ease-in-out infinite; }
.quest-banner.done { opacity: 0.8; }
@keyframes chest-wiggle { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-9deg); } 86% { transform: rotate(8deg); } 94% { transform: rotate(-4deg); } }
:root[data-motion='off'] .quest-banner.ready .qb-icon { animation: none; }
.quest-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.quest-hero .svg { width: 86px; flex: none; }
.quest-hero strong { font-family: var(--font-display); font-size: 22px; }
.quest-list .li-main strong { margin-bottom: 6px; }
.quest-bar { height: 12px; }
.quest-bar i { background: var(--orange); }
.quest.done .quest-bar i { background: var(--green); }
.chest { width: 54px; height: 54px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); color: var(--ink-3); display: grid; place-items: center; cursor: pointer; flex: none; }
.chest .icon { width: 30px; height: 30px; }
.chest:disabled { cursor: default; }
.chest.ready { background: var(--orange); border-color: var(--orange-deep); color: #fff; box-shadow: 0 4px 0 var(--orange-deep); animation: chest-wiggle 1.6s ease-in-out infinite; }
.chest.opened { opacity: 0.45; }
:root[data-motion='off'] .chest.ready { animation: none; }

/* ---------- Plus everywhere ---------- */
.pill-plus { background: var(--plus-bg); color: var(--plus-ink); text-decoration: none; }
.pill-plus .icon { width: 14px; height: 14px; }
.title-pill { margin-left: 8px; vertical-align: 3px; font-family: var(--font-body); }
.plus-teaser { color: var(--ink); text-decoration: none; border-color: var(--purple-soft); }
.plus-teaser > .svg:first-child { width: 30px; color: var(--purple); flex: none; }
.plus-teaser > .svg:first-child .icon { width: 28px; height: 28px; }
.plus-teaser > .svg:last-child { color: var(--ink-3); }
.plus-strip {
  display: flex; align-items: center; gap: 10px; margin: -6px 0 18px; padding: 10px 14px; border-radius: var(--radius);
  background: var(--plus-bg); color: #E8ECF5; text-decoration: none; font-size: 14px;
}
.plus-strip strong { display: block; color: var(--plus-ink); font-family: var(--font-display); font-size: 16px; line-height: 1.15; }
.plus-strip > .svg { color: var(--plus-ink); }
.plus-strip > .svg:last-child { color: #8F98AB; }
/* "Put CurlyScript on your phone", on the map after the first lesson */
.install-tip {
  display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 12px 10px 12px 14px;
  border-radius: var(--radius); border: 2px dashed var(--line); background: var(--card); font-size: 14px; color: var(--ink-2);
}
.install-tip strong { display: block; font-family: var(--font-display); font-size: 16px; line-height: 1.15; color: var(--ink); }
.install-tip .it-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--teal-soft); color: var(--teal-deep); flex: none; }
.install-tip .it-icon .icon { width: 24px; height: 24px; }
.install-tip .it-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.it-close { width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; color: var(--ink-3); display: grid; place-items: center; cursor: pointer; }
.it-close .icon { width: 16px; height: 16px; }
.it-close:hover { background: var(--line); }
.install-steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.install-steps li { padding-left: 4px; }
.btn-plus { --b: #FFC83D; --b-deep: #C98C00; --b-fg: #22304A; }
.shop-item.plus { border-style: dashed; }
.shop-item.plus .pill-plus { margin-top: 2px; }

/* ---------- the Plus page ---------- */
.premium-screen .page-head { margin-bottom: 0; }
.plus-hero {
  position: relative; text-align: center; padding: 18px 18px 22px; margin-bottom: 18px; border-radius: 26px;
  background: radial-gradient(circle at 50% 120%, var(--plus-bg-2), var(--plus-bg) 70%); color: #E8ECF5; overflow: hidden;
}
.plus-hero h1 { color: var(--plus-ink); font-size: 34px; margin-top: 4px; }
.plus-hero p { color: #C5CCDA; max-width: 36ch; margin: 6px auto 0; }
.plus-code {
  display: inline-block; text-align: left; font-family: var(--font-mono); font-variant-ligatures: none; font-size: 13.5px; line-height: 1.7;
  padding: 8px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08); color: #E8ECF5;
}
.plus-code .k { color: #C4B5FF; }
.plus-code .s { color: var(--plus-ink); }
.plus-code .c { color: #7FD9CF; }
.plus-curly { display: block; width: 150px; margin: 6px auto 0; padding: 8px 12px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 210, 92, 0.22), transparent 68%); }
.perk-list { list-style: none; padding: 0; margin-bottom: 18px; display: grid; gap: 12px; }
.perk-list li { display: flex; gap: 12px; align-items: flex-start; }
.perk-list li > .svg { width: 36px; height: 36px; border-radius: 11px; background: var(--purple-soft); color: var(--purple-deep); display: grid; place-items: center; flex: none; }
.perk-list li > .svg .icon { width: 20px; height: 20px; }
.perk-list strong { display: block; font-family: var(--font-display); font-size: 17px; line-height: 1.2; }
.perk-list small { color: var(--ink-2); font-size: 14px; }
.plans { display: grid; gap: 10px; }
.plan {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border-radius: 18px; text-align: left; cursor: pointer;
  border: 2px solid var(--line-2); background: var(--card); color: var(--ink); font: inherit;
}
.plan strong { display: block; font-family: var(--font-display); font-size: 19px; line-height: 1.1; }
.plan small { display: block; color: var(--ink-2); font-size: 14px; }
.plan small.trial { color: var(--teal-deep); font-weight: 800; }
.plan-radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; }
.plan.selected { border-color: var(--purple); background: var(--purple-soft); }
.plan.selected .plan-radio { border: 7px solid var(--purple); }
.plus-legal { margin-top: 8px; }
.plus-legal p { font-size: 12.5px; line-height: 1.45; }
.plus-status { display: flex; gap: 12px; align-items: center; background: var(--plus-bg); border-color: var(--plus-bg); color: #E8ECF5; }
.plus-status strong { color: var(--plus-ink); font-family: var(--font-display); font-size: 18px; }
.plus-status .small.muted { color: #C5CCDA; }
.plus-status > .svg { width: 34px; color: var(--plus-ink); }
.plus-status > .svg .icon { width: 32px; height: 32px; }
.demo-card { border-style: dashed; border-color: var(--purple); }

/* ---------- shop power-ups ---------- */
.power-up .li-main small.faint { margin-top: 2px; }
.price-btn { flex: none; }
.price-btn .icon { color: #8A6D00; }

/* ---------- leagues ---------- */
.league-head { text-align: center; margin: 4px 0 10px; }
.league-head h2 { font-size: 26px; margin-top: 8px; }
.tier-ladder { display: flex; justify-content: center; align-items: flex-end; gap: 6px; }
.tier-gem { display: inline-flex; width: 30px; opacity: 0.35; filter: grayscale(0.6); }
.tier-gem.past { opacity: 0.75; filter: none; }
.tier-gem.on { width: 54px; opacity: 1; filter: none; }
.tier-gem.big { width: 46px; }
.league-rules { margin-bottom: 10px; }
.league-list { gap: 4px; }
.zone-line { display: flex; align-items: center; gap: 6px; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 13px; padding: 4px; }
.zone-line .icon { width: 16px; height: 16px; }
.zone-line.up { color: var(--green-deep); border-top: 2px dashed var(--green); }
.zone-line.down { color: var(--coral-deep); border-top: 2px dashed var(--coral); }
.lb-row.zone-up .lb-rank { color: var(--green-deep); }
.lb-row.zone-down .lb-rank { color: var(--coral-deep); }
.league-result { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; border-color: var(--tier); }
.league-result.up { background: var(--green-soft); }
.league-result.down { background: var(--coral-soft); }

/* ---------- friends ---------- */
.friend-code { font-family: var(--font-mono); font-variant-ligatures: none; font-weight: 700; font-size: 26px; letter-spacing: 0.12em; color: var(--purple-deep); }
:root[data-theme='dark'] .friend-code { color: #C4B5FF; }
.add-friend { margin: 12px 0 4px; }
.add-friend .input { text-transform: uppercase; font-family: var(--font-mono); letter-spacing: 0.08em; }
.mini-streak { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; color: var(--orange-deep); margin-left: 6px; font-weight: 800; }
.mini-streak .icon { width: 14px; height: 14px; color: var(--orange); }
.small-tabs button { font-size: 14px; padding: 6px; }

/* ---------- account ---------- */
select.input { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.input.mono { font-family: var(--font-mono); font-variant-ligatures: none; letter-spacing: 0.06em; text-transform: uppercase; }
.time-input { width: auto; min-height: 42px; }

/* ---------- certificates ---------- */
.certificate { border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); margin-bottom: 12px; background: #FFFDF6; }
.certificate > svg { display: block; width: 100%; height: auto; }
.certificate.locked { position: relative; }
.certificate.locked svg { filter: blur(3px) saturate(0.7); opacity: 0.8; }
@media print {
  body * { visibility: hidden !important; }
  .certificate, .certificate * { visibility: visible !important; }
  .certificate { position: fixed; inset: 0; box-shadow: none; border-radius: 0; }
  .nav, .hud { display: none !important; }
}
a.hud-chip { text-decoration: none; }
@media (max-width: 370px) {
  .hud { gap: 0; padding-left: 8px; padding-right: 8px; }
  .hud-chip { padding: 6px 6px; font-size: 16px; }
  .hud-level { gap: 4px; padding: 2px; }
}

/* ---------- notes ---------- */
.notes-intro { margin-top: -6px; }
.continue-card { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; margin-bottom: 14px; border-color: var(--purple-soft); }
.continue-card > .svg { width: 30px; color: var(--purple); }
.continue-card > .svg .icon { width: 28px; height: 28px; }
.continue-card strong { display: block; font-family: var(--font-display); font-size: 18px; line-height: 1.2; }
.continue-card small { display: block; }
.notes-library { margin-top: 26px; }
.notes-results { margin-bottom: 16px; }

.notes-hero {
  background: var(--c-soft); border: 2px solid var(--c); border-radius: 22px; padding: 16px 18px; margin-bottom: 12px;
}
.notes-hero h2 { font-size: 26px; }
.notes-hero p { margin: 6px 0 10px; color: var(--ink-2); }
.notes-hero .bar { height: 12px; background: rgba(34, 48, 74, 0.1); }
.notes-hero .bar i { background: var(--c-deep); }
.notes-hero .bar i::after { display: none; }
.notes-hero p.small { margin: 8px 0 0; }
.notes-learn { margin-top: 14px; }
.notes-learn h3 { margin-bottom: 6px; }
.notes-learn ul { margin: 0; padding-left: 1.2em; }
.notes-learn li { margin: 0.15em 0; }
.page-row { text-decoration: none; color: inherit; }
.page-no {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--line); color: var(--ink-2); font-family: var(--font-display); font-weight: 800; font-size: 16px;
}
.page-row.is-read .page-no { background: var(--teal-soft); color: var(--teal-deep); }
.page-no .icon { width: 18px; height: 18px; }

/* a page of notes */
.notes-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 6px; }
.notes-meta .pill .icon { width: 14px; height: 14px; }
.notes-title { font-size: 30px; line-height: 1.12; margin: 0 0 16px; }
.notes-page { font-size: 17px; line-height: 1.65; }
.notes-page > p, .ncall-body > p { margin: 0 0 1em; }
.notes-page ul, .notes-page ol { margin: 0 0 1em; padding-left: 1.3em; }
.notes-page li { margin: 0.3em 0; }
.notes-page li > ul { margin: 0.2em 0 0; }
.n-h { font-size: 21px; margin: 1.5em 0 0.5em; }
.n-big {
  font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1.25; color: var(--purple-deep);
  border-left: 5px solid var(--purple); padding: 2px 0 2px 14px; margin: 0.4em 0 1em;
}
:root[data-theme='dark'] .n-big { color: #C4B5FF; }
.notes-page kbd, .term-def kbd {
  font-family: var(--font-mono); font-size: 0.82em; padding: 0.05em 0.45em; border-radius: 6px;
  border: 1.5px solid var(--line-2); border-bottom-width: 3px; background: var(--card);
}
.term {
  display: inline; padding: 0; margin: 0; border: 0; background: none; font: inherit; color: inherit; cursor: help;
  text-decoration: underline dotted var(--purple); text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.term:hover { color: var(--purple-deep); }
.term-kicker { margin: 0; }
.term-def { font-size: 17px; }

.n-fig { margin: 18px 0 20px; }
.n-fig-art { background: #FFFDF6; border: 2px solid var(--line); border-radius: 16px; padding: 8px; }
.n-fig-art svg { display: block; width: 100%; height: auto; }
.n-fig figcaption { text-align: center; color: var(--ink-2); font-size: 14px; margin-top: 8px; font-style: italic; }

.n-table { overflow-x: auto; margin: 0 0 1.1em; border: 2px solid var(--line); border-radius: 14px; }
.n-table table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.45; }
.n-table th { text-align: left; background: var(--line); font-family: var(--font-display); font-weight: 800; padding: 8px 10px; }
.n-table td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }

.ncall {
  --k: var(--ink-3); --k-soft: var(--line);
  margin: 4px 0 18px; padding: 14px 16px 4px; border-radius: 18px; background: var(--k-soft); border: 2px solid var(--line); border-color: color-mix(in srgb, var(--k) 35%, transparent);
  font-size: 16px; line-height: 1.6;
}
.ncall-tip { --k: var(--yellow-deep); --k-soft: var(--yellow-soft); }
.ncall-bug { --k: var(--coral-deep); --k-soft: var(--coral-soft); }
.ncall-prof { --k: var(--purple-deep); --k-soft: var(--purple-soft); }
.ncall-try { --k: var(--teal-deep); --k-soft: var(--teal-soft); }
.ncall-fun { --k: var(--pink-deep); --k-soft: var(--pink-soft); }
.ncall-recap { --k: var(--green-deep); --k-soft: var(--green-soft); }
.ncall-analogy { --k: var(--orange-deep); --k-soft: var(--orange-soft); }
.ncall-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ncall-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--card); color: var(--k); flex: none; }
.ncall-icon .icon { width: 20px; height: 20px; }
.ncall-art { width: 44px; flex: none; }
.ncall-kind { display: block; font-family: var(--font-display); font-weight: 800; font-size: 13px; color: color-mix(in srgb, var(--k) 62%, var(--ink)); }
.ncall-title { display: block; font-family: var(--font-display); font-size: 17px; line-height: 1.2; }
:root[data-theme='dark'] .ncall-kind { filter: brightness(1.5); }
.ncall .n-code, .ncall pre.code { margin-bottom: 12px; }

.n-code { margin: 0 0 18px; }
.n-code-head { display: flex; align-items: center; gap: 8px; margin: 0 2px 4px; font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--ink-3); }
.n-code-head .pill { font-size: 12px; padding: 0 8px; }
.n-code pre.code, .n-code .editor { margin: 0; }
.n-code-wrong pre.code { border-color: var(--coral); border-color: color-mix(in srgb, var(--coral) 55%, var(--line)); }
.n-code-right pre.code { border-color: var(--teal); border-color: color-mix(in srgb, var(--teal) 55%, var(--line)); }
.n-code-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.n-code-actions .btn { min-height: 38px; }
.n-code-actions .icon { width: 18px; height: 18px; }
.n-output, .n-code .console { margin-top: 8px; }
.n-output { background: var(--console-bg); border-radius: 14px; padding: 8px 14px 10px; }
.n-output-label { font-family: var(--font-display); font-weight: 700; font-size: 12px; color: #AEB8CE; }
.n-output-text {
  margin: 2px 0 0; font-family: var(--font-mono); font-variant-ligatures: none; font-size: 14px; line-height: 1.55; color: #E9EEF7;
  white-space: pre-wrap; word-break: break-word;
}
.notes-end { height: 1px; }
.practice-card { margin: 10px 0 16px; border-color: var(--teal-soft); }
.practice-card strong { font-family: var(--font-display); font-size: 18px; }
.notes-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.pager-link {
  display: block; padding: 12px 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); color: inherit; text-decoration: none; min-width: 0;
}
.pager-link small { display: block; color: var(--ink-3); font-weight: 700; font-size: 13px; }
.pager-link span { display: block; font-family: var(--font-display); font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.pager-link.next { text-align: right; border-color: var(--yellow); box-shadow: 0 3px 0 var(--yellow-deep); }

/* notes inside a lesson */
.sheet.sheet-tall { max-height: 94vh; min-height: 60vh; }
.page-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.page-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--line-2);
  background: var(--card); font-family: var(--font-display); font-weight: 700; font-size: 14px; cursor: pointer; text-align: left;
}
.page-chip.active { border-color: var(--purple); background: var(--purple-soft); }
.page-chip .icon { width: 14px; height: 14px; color: var(--teal-deep); }
.notes-sheet-title { font-size: 22px; margin: 4px 0 12px; }
.read-about { margin-top: 6px; }

/* numbered code */
pre.code.numbered { counter-reset: ln; padding-left: 0; }
pre.code.numbered .ln { display: inline-block; width: 100%; padding: 0 12px 0 3.1em; position: relative; border-radius: 6px; }
pre.code.numbered .ln::before {
  counter-increment: ln; content: counter(ln); position: absolute; left: 0; width: 2.2em; text-align: right; color: var(--ink-3); opacity: 0.8;
}

/* Watch it run */
.stepper-loading { padding: 20px 0; }
.step-code { max-height: 38vh; overflow: auto; }
.step-code .ln.next { background: var(--yellow-soft); box-shadow: inset 4px 0 0 var(--yellow-deep); }
.step-code .ln.ran { background: var(--teal-soft); background: color-mix(in srgb, var(--teal-soft) 60%, transparent); }
.step-code .ln.crash { background: var(--coral-soft); box-shadow: inset 4px 0 0 var(--coral); }
.stepper-meta { gap: 10px; align-items: baseline; margin: 2px 0 10px; }
.stepper-status { margin: 0; }
.stepper-status .bad { color: var(--coral-deep); }
.stepper-vars { background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; margin-bottom: 12px; }
.var-head { font-family: var(--font-display); font-weight: 800; font-size: 13px; color: var(--ink-3); margin: 2px 0 4px; }
.var-row { display: flex; gap: 10px; align-items: baseline; padding: 3px 6px; border-radius: 8px; font-family: var(--font-mono); font-size: 14px; }
.var-name { font-weight: 700; flex: none; min-width: 5ch; }
.var-value { overflow-wrap: anywhere; white-space: pre-wrap; color: var(--ink-2); }
.var-row.changed { background: var(--yellow-soft); }
.var-row.changed .var-value { color: var(--ink); font-weight: 700; }
.var-row.new { background: var(--teal-soft); }
.stepper-controls { position: sticky; bottom: calc(-22px - var(--safe-bottom)); background: var(--paper); padding: 8px 0 4px; }
.stepper-range { width: 100%; accent-color: var(--teal); margin: 0 0 8px; }
.stepper-controls .row { gap: 8px; }
.stepper-controls .btn .icon { width: 18px; height: 18px; }
@media (prefers-reduced-motion: reduce) { .step-code .ln { scroll-behavior: auto; } }
.btn .btn-meta { margin-left: 2px; font-weight: 700; }

/* ---------- guided projects ---------- */
.project-list { display: grid; gap: 12px; margin-top: 12px; }
.project-card { display: block; color: inherit; text-decoration: none; }
.project-card strong { display: block; font-family: var(--font-display); font-size: 19px; line-height: 1.15; }
.project-card small { display: block; }
.project-card .li-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.project-card .li-icon .icon { width: 26px; height: 26px; }
.project-card.locked { border-style: dashed; }
.project-blurb { margin: 10px 0 4px; }
.project-when { margin: 0 0 8px; }
.project-card .pill .icon { width: 13px; height: 13px; }
.project-wait .project-preview { height: 360px; }
.skill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.skill { font-size: 12.5px; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: var(--line); color: var(--ink-2); }
.step-dots { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.step-dot {
  width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--card); color: var(--ink-2);
  font-family: var(--font-display); font-weight: 800; font-size: 16px; display: grid; place-items: center; cursor: pointer;
}
.step-dot .icon { width: 18px; height: 18px; }
.step-dot.done { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-deep); }
.step-dot.active { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-soft); color: var(--ink); }
.step-dot:disabled { opacity: 0.45; cursor: default; }
.project-step { margin-bottom: 14px; }
.project-step .learn-text { font-size: 16px; }
.hint-box { margin-top: 10px; padding: 8px 12px; border-radius: 12px; background: var(--yellow-soft); }
.hint-box summary { cursor: pointer; font-weight: 800; }
.hint-box p { margin: 6px 0 2px; }
.project-preview { height: 420px; display: block; margin-bottom: 12px; }
.test-name { font-weight: 700; }
.notice-bad { background: var(--coral-soft); }
.check-list { margin: 0; padding-left: 1.2em; }
.check-list li { margin: 0.3em 0; }
.plus-teaser-card .project-preview { height: 360px; }
.build-card { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; margin: 6px 0 14px; }
.build-card > .svg { width: 30px; color: var(--purple); }
.build-card > .svg .icon { width: 28px; height: 28px; }
.build-card strong { display: block; font-family: var(--font-display); font-size: 18px; line-height: 1.15; }
.plus-mark .icon { width: 14px; height: 14px; color: #C98C00; }
.verify-link { display: block; padding: 10px 12px; border-radius: 12px; background: var(--code-bg); border: 2px solid var(--line); font-family: var(--font-mono); font-size: 13.5px; overflow-wrap: anywhere; user-select: all; }
.verify-card { margin-top: 12px; }

/* ---------- progress report ---------- */
.report-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.report-tile { background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; }
.report-tile .svg { width: 24px; margin-bottom: 4px; }
.report-tile .icon { width: 22px; height: 22px; }
.report-tile b { font-family: var(--font-display); font-size: 28px; line-height: 1.05; }
.report-tile small { font-size: 13.5px; color: var(--ink-2); line-height: 1.3; }
.report-tile small.faint { color: var(--ink-3); margin-top: 2px; }
.c-purple { color: var(--purple); } .c-orange { color: var(--orange); } .c-gold { color: var(--gold); } .c-teal { color: var(--teal); }
.chart-card { margin-bottom: 12px; }
.chart-card strong { font-family: var(--font-display); }
.xp-chart { display: block; width: 100%; height: auto; margin-top: 10px; overflow: visible; }
.xp-chart .xb { fill: var(--purple-soft); stroke: var(--purple); stroke-width: 1; }
.xp-chart .xb-goal { fill: var(--purple); }
.xp-chart .xb-today { fill: var(--yellow); stroke: var(--yellow-deep); stroke-width: 1.5; }
.xp-chart .goal-line { stroke: var(--ink-3); stroke-dasharray: 4 4; stroke-width: 1.2; }
.xp-chart text { font-size: 10px; fill: var(--ink-3); font-family: var(--font-body); font-weight: 700; }
.bar.thin { height: 10px; margin-top: 4px; }
.bar.thin i::after { display: none; }
.school-progress > div + div { margin-top: 10px; }
.row.tight { gap: 0; }
.report-teaser { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.report-teaser > .svg { width: 30px; color: var(--purple); }
.report-teaser > .svg .icon { width: 28px; height: 28px; }
.report-teaser strong { display: block; font-family: var(--font-display); font-size: 18px; }
.report-teaser small { display: block; }
.xp-chart .base-line { stroke: var(--line-2); stroke-width: 1.5; }

/* ---------- Ask Professor Curly ---------- */
.consent h3 { font-size: 20px; }
.consent p { margin: 0; }
.consent-list { margin: 0; padding-left: 1.2em; }
.consent-list li { margin: 0.25em 0; }
.notice-care { background: var(--purple-soft); }
.tutor-reply { font-size: 16px; }
.report-answer { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; }
.report-answer .icon { width: 16px; height: 16px; }
.report-reasons { gap: 0; }
.report-reason { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; }
.report-reason input { width: 18px; height: 18px; accent-color: var(--purple); }

/* ---------- share your progress ---------- */
.share-preview { background: var(--card); border: 2px dashed var(--line); border-radius: 14px; padding: 12px 14px; font-size: 15px; overflow-wrap: anywhere; }
.code-input {
  font-family: var(--font-mono); font-variant-ligatures: none; font-size: 24px; font-weight: 700; letter-spacing: 0.3em; text-align: center;
}

/* password boxes with a Show button */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 72px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 36px; padding: 0 12px;
  border: 0; border-radius: 10px; background: transparent; color: var(--purple-deep); font: 700 14px var(--font-body); cursor: pointer;
}
:root[data-theme='dark'] .pw-toggle { color: #A796FF; }

/* "Continue with Google", and the line under it */
.google-slot:empty { display: none; }
.google-slot { display: grid; gap: 10px; }
.google-button { min-height: 44px; display: flex; justify-content: center; }
.or-line { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 14px; font-weight: 700; margin: 4px 0; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
