/*
 * Voca Fun on the web: the tokens and components of docs/DESIGN.md as plain CSS. Kotlin
 * (Compose HTML) builds the DOM and adds these classes; one-off values go inline.
 * Light theme only, like the apps.
 */

@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito.ttf") format("truetype");
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #F5F3FF;
  --surface: #FFFFFF;
  --ink: #1E1B4B;
  --ink-soft: #6B6A8A;
  --line: #E7E3F8;
  --primary: #6D4AFF;
  --primary-ledge: #4F2FD6;
  --primary-tint: #EFEBFF;
  --gold: #FFC83D;
  --gold-ledge: #D9A11A;
  --gold-ink: #9A6F0B;
  --success: #22C55E;
  --success-ledge: #15803D;
  --danger: #F43F5E;
  --danger-ledge: #BE123C;
  --flame: #FF7A1A;
  --card-shadow: 0 6px 18px rgba(30, 27, 75, 0.08), 0 2px 6px rgba(30, 27, 75, 0.06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* System fonts after Nunito carry Chinese, Japanese, Korean and Vietnamese text. */
  --font: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans",
    "Apple SD Gothic Neo", "Noto Sans CJK SC", "Noto Sans", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overflow: clip;
  background: #E9E4FF;
  color: var(--ink);
  font-family: var(--font);
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/*
 * The page never scrolls: screens scroll inside. `clip` (after `hidden` for older browsers) also
 * stops focus and scrollIntoView from scrolling these frames, which would slide the app up.
 */
body { overflow: hidden; overflow: clip; }

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
img { -webkit-user-drag: none; user-select: none; }
:focus-visible { outline: 3px solid rgba(109, 74, 255, 0.55); outline-offset: 2px; }

#root { height: 100%; }


/*
 * The app: on a phone, screens fill it and a tab bar floats at the bottom. From 900px wide
 * (DESKTOP below), a sidebar takes the tab bar's place and pages lay out wide.
 */
.app {
  position: relative;
  height: 100%;
  display: flex;
  background: var(--bg);
  overflow: hidden;
  overflow: clip;
  isolation: isolate;
}
.main { position: relative; flex: 1 1 auto; min-width: 0; height: 100%; overflow: hidden; overflow: clip; }

/* Content widths on big screens: a page, a narrow page (forms, results) and a reading column. */
.page { width: 100%; max-width: 1180px; margin: 0 auto; }
.page-narrow { width: 100%; max-width: 640px; margin: 0 auto; }
.page-form { width: 100%; max-width: 760px; margin: 0 auto; }

/* A screen fills the app and scrolls on its own. */
.screen {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}
.screen.no-scroll { overflow: hidden; }
.screen-pad { padding: calc(var(--safe-top) + 8px) 0 calc(var(--safe-bottom) + 28px); }
.enter-forward { animation: enterForward 0.34s cubic-bezier(.2, .8, .2, 1) backwards; }
.enter-back { animation: enterBack 0.34s cubic-bezier(.2, .8, .2, 1) backwards; }
.enter-game { animation: enterGame 0.42s cubic-bezier(.2, .8, .2, 1) backwards; }
.enter-fade { animation: fadeIn 0.24s ease backwards; }

/* Layout */
.row { display: flex; flex-direction: row; align-items: center; min-width: 0; }
.row.top { align-items: flex-start; }
.row.bottom { align-items: flex-end; }
.row.stretch { align-items: stretch; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; min-width: 0; }
.col.center-x { align-items: center; }
.center { display: flex; align-items: center; justify-content: center; }
.box { position: relative; }
.fill { position: absolute; inset: 0; }
.grow { flex: 1 1 0; min-width: 0; }
.no-shrink { flex-shrink: 0; }
.full-w { width: 100%; }
.px20 { padding-left: 20px; padding-right: 20px; }
.hscroll {
  display: flex;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  padding: 6px 20px 10px;
  scroll-padding: 0 20px;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { flex-shrink: 0; }
.clip { overflow: hidden; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nowrap { white-space: nowrap; }
.tc { text-align: center; }
.hidden { display: none !important; }

/* Type scale */
.t-display { font-size: 30px; line-height: 36px; font-weight: 900; }
.t-title { font-size: 22px; line-height: 28px; font-weight: 800; }
.t-headline { font-size: 18px; line-height: 24px; font-weight: 800; }
.t-body { font-size: 16px; line-height: 22px; font-weight: 600; }
.t-caption { font-size: 13px; line-height: 17px; font-weight: 700; }
.t-micro { font-size: 11px; line-height: 14px; font-weight: 800; letter-spacing: 0.6px; }
.ink { color: var(--ink); }
.ink-soft { color: var(--ink-soft); }
.c-primary { color: var(--primary); }
.c-white { color: #fff; }
.c-danger { color: var(--danger); }
.c-success { color: var(--success); }

/* Components */
.card {
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--card-shadow);
}

/* A placeholder while content loads (ShimmerBlock): a soft violet block, a light sweeping across them all in step. */
.shim {
  flex: 0 0 auto;
  border-radius: 18px;
  background: #E9E4FB linear-gradient(100deg, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, 0.7) 50%, rgba(255, 255, 255, 0) 62%) no-repeat;
  background-size: 200vw 100%;
  background-attachment: fixed;
  animation: shimSweep 1.3s linear infinite;
}
@keyframes shimSweep { from { background-position: -100vw 0; } to { background-position: 100vw 0; } }

.tappable { cursor: pointer; user-select: none; transition: transform 0.18s cubic-bezier(.3, 1.6, .5, 1); }
.tappable:active { transform: scale(0.97); }

/* The chunky 3D button: a face on a darker ledge; pressing pushes the face onto it. */
.chunky {
  --face: var(--primary);
  --ledge: var(--primary-ledge);
  --label: #fff;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 56px;
  margin-bottom: 5px;
  padding: 0 18px;
  border-radius: 18px;
  background: var(--face);
  color: var(--label);
  box-shadow: 0 5px 0 var(--ledge);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  white-space: nowrap;
}
.chunky:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--ledge); }
.chunky:disabled { opacity: 0.5; cursor: default; }
.chunky.secondary { --face: #fff; --ledge: var(--line); --label: var(--ink); }
.chunky .play-mark { font-size: 16px; }
.chunky.round { border-radius: 50%; padding: 0; }

.icon-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(30, 27, 75, 0.12);
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(.3, 1.6, .5, 1);
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn.dark { background: rgba(255, 255, 255, 0.14); color: #fff; box-shadow: none; }
.icon-btn svg { width: 22px; height: 22px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--line);
  color: var(--ink);
  font-size: 13px;
  line-height: 17px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 4px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 4px 0 var(--line);
  cursor: pointer;
  user-select: none;
  transition: transform 0.18s cubic-bezier(.3, 1.6, .5, 1), background 0.15s;
}
.chip:active { transform: scale(0.97); }
.chip.selected { background: var(--primary); border-color: var(--primary); box-shadow: 0 4px 0 var(--primary-ledge); color: #fff; }
.chip .check-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: popIn 0.35s cubic-bezier(.3, 1.8, .5, 1) both;
}

.dashed-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 58px;
  padding: 0 18px;
  border-radius: 18px;
  border: 2px dashed rgba(109, 74, 255, 0.6);
  background: rgba(109, 74, 255, 0.05);
  color: var(--primary);
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.link-btn { color: var(--primary); font-size: 14px; font-weight: 800; cursor: pointer; }

.field {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: #fff;
  font-size: 16px;
  font-weight: 700;
  outline: none;
  transition: border-color 0.15s;
}
.field:focus { border-color: var(--primary); }
.field.error { border-color: var(--danger); }
textarea.field { height: auto; min-height: 96px; padding: 12px 16px; resize: vertical; }
.field-label { font-size: 13px; font-weight: 800; color: var(--ink-soft); margin: 0 0 6px 4px; }
/* Agreeing to the Terms (sign-up, a guest's first name): the tick-box row, then its two links under the label. */
.terms-label { font-size: 14px; line-height: 19px; }
.terms-links { padding: 2px 0 0 42px; }
.terms-link { padding: 8px 6px; font-size: 13px; line-height: 17px; color: var(--primary); text-decoration: none; }
.terms-link:focus-visible { outline: 2px solid var(--primary); border-radius: 8px; }
.terms-links-centered { justify-content: center; }

/* Continue with Google: Google's own button (its script draws it in .google-host). The cover
   takes the tap while it can't be used (Terms not ticked yet, or signing in). */
.or-divider { display: flex; align-items: center; gap: 12px; width: 100%; font-size: 14px; color: var(--ink-soft); }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1.5px; border-radius: 1px; background: var(--line); }
.google-btn { position: relative; width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.google-host { display: flex; justify-content: center; min-height: 44px; transition: opacity 0.15s; }
.google-host.dim { opacity: 0.35; }
.google-btn-cover { position: absolute; inset: 0; cursor: pointer; }
.google-btn-spinner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.google-agree-text { font-size: 13px; line-height: 18px; padding: 0 8px; }
/* First visit, in two steps (the language spoken, then the one to learn): the button stays put
   at the bottom while each step slides in from its side and its choices rise one after another. */
.setup-sky { position: absolute; inset: 0 0 auto 0; height: 340px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(109, 74, 255, 0.16), var(--bg)); }
.setup-col { position: relative; display: flex; flex-direction: column; height: 100%; box-sizing: border-box;
  padding: calc(var(--safe-top) + 4px) 20px calc(var(--safe-bottom) + 12px); }
.setup-top { position: relative; height: 52px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.setup-back { position: absolute; left: 0; top: 4px; }
.setup-pills { display: flex; gap: 6px; }
.setup-pill { width: 10px; height: 10px; border-radius: 5px; background: rgba(109, 74, 255, 0.22);
  transition: width 0.4s cubic-bezier(.2, .9, .3, 1.25), background 0.25s; }
.setup-pill.done { background: var(--primary); }
.setup-pill.active { width: 28px; }
.setup-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column;
  align-items: center; padding-bottom: 16px; }
.step-in-forward { animation: stepInForward 0.4s cubic-bezier(.2, .8, .2, 1) backwards; }
.step-in-back { animation: stepInBack 0.4s cubic-bezier(.2, .8, .2, 1) backwards; }
@keyframes stepInForward { from { transform: translateX(90px); opacity: 0; } }
@keyframes stepInBack { from { transform: translateX(-90px); opacity: 0; } }
.setup-header { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.setup-label { width: 100%; margin: 22px 0 12px; }
.setup-grid { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.setup-cards { width: 100%; gap: 10px; margin-top: 22px; }
.rise-in { animation: riseIn 0.5s cubic-bezier(.2, .9, .3, 1.15) backwards; }
@keyframes riseIn { from { transform: translateY(18px); opacity: 0; } }
.speak-tile { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 12px; margin-bottom: 4px;
  border-radius: 18px; background: #fff; color: var(--ink); box-shadow: 0 4px 0 var(--line); cursor: pointer;
  user-select: none; transition: background 0.18s, color 0.18s, box-shadow 0.18s, transform 0.1s; }
.speak-tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.speak-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.speak-tile.selected { background: var(--primary); color: #fff; box-shadow: 0 4px 0 var(--primary-ledge);
  animation: tilePop 0.34s cubic-bezier(.3, 1.6, .5, 1); }
.speak-tile.selected:active { box-shadow: 0 1px 0 var(--primary-ledge); }
.speak-name { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: inherit; }
.speak-tick { width: 22px; height: 22px; border-radius: 50%; background: #fff; flex-shrink: 0; display: flex;
  align-items: center; justify-content: center; animation: popIn 0.3s cubic-bezier(.3, 1.6, .5, 1); }
.lang-card.selected { animation: cardPop 0.34s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes tilePop { 40% { transform: scale(1.05); } }
@keyframes cardPop { 40% { transform: scale(1.03); } }
.setup-bottom { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
/* Wide windows: the step sits in the middle with its button right under the choices, not at the window's foot. */
@media (min-width: 900px) {
  .setup-screen { display: flex; align-items: center; }
  .setup-col { height: auto; max-height: 100%; }
  .setup-body { flex: 0 1 auto; }
  .setup-bottom { padding-top: 18px; }
}

/* Sign-in screen: Stella centred with the close (or back) button beside her, not above. */
.signin-top { display: flex; justify-content: center; position: relative; }
.signin-top-button { position: absolute; top: 0; left: 0; }
@media (hover: hover) { .terms-link:hover { text-decoration: underline; } }

.toggle {
  position: relative;
  width: 52px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--line);
  transition: background 0.2s;
  cursor: pointer;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s cubic-bezier(.3, 1.4, .5, 1);
}
.toggle.on { background: var(--primary); }
.toggle.on::after { transform: translateX(20px); }

.divider { height: 1px; background: var(--line); }

.error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #FFE4EA;
  color: var(--danger-ledge);
  font-size: 14px;
  font-weight: 700;
}

/*
 * A bottom sheet over a dimmed app; a centred dialog on wide screens is the same sheet. Both are
 * fixed to the window, and nothing holds a transform once it's in: a sheet opened from inside
 * another (Settings' language list) then covers the window too, not just its parent's box.
 */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(30, 27, 75, 0.45);
  animation: fadeIn 0.2s ease backwards;
  z-index: 40;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 92%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  border-radius: 28px 28px 0 0;
  padding: 10px 0 calc(var(--safe-bottom) + 16px);
  box-shadow: 0 -10px 40px rgba(30, 27, 75, 0.25);
  animation: sheetUp 0.32s cubic-bezier(.2, .9, .3, 1) backwards;
  z-index: 41;
}
.sheet .grabber { width: 40px; height: 5px; border-radius: 3px; background: rgba(30, 27, 75, 0.18); margin: 0 auto 14px; }
.sheet.white { background: #fff; }

.toast-host {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-bottom) + 104px);
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 60;
}
.toast {
  max-width: calc(100% - 40px);
  padding: 12px 18px;
  border-radius: 18px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 8px 24px rgba(30, 27, 75, 0.3);
  animation: toastIn 0.35s cubic-bezier(.3, 1.5, .5, 1) backwards;
}

/* The floating tab bar. */
.tabbar {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: calc(var(--safe-bottom) + 10px);
  height: 70px;
  padding: 6px;
  display: flex;
  border-radius: 28px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(109, 74, 255, 0.25);
  z-index: 20;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  user-select: none;
}
.tab.selected { background: var(--primary-tint); color: var(--primary); }
.tab.selected .tab-icon { animation: tabBounce 0.45s cubic-bezier(.3, 1.8, .5, 1); }
.tab .badge {
  position: absolute;
  top: -4px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--danger);
  border: 2px solid #fff;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
  animation: popIn 0.35s cubic-bezier(.3, 1.8, .5, 1) both;
}
.tab-space { height: calc(var(--safe-bottom) + 102px); }

/* Pictures and art */
.pic { display: block; flex-shrink: 0; object-fit: contain; pointer-events: none; }
.pic.grey { filter: grayscale(1); }
canvas.art { display: block; flex-shrink: 0; }

/* Motion */
.entrance { animation: entrance 0.6s cubic-bezier(.2, .9, .3, 1.15) backwards; }
.pop-in { animation: popIn 0.4s cubic-bezier(.3, 1.8, .5, 1) backwards; }
.fade-in { animation: fadeIn 0.25s ease backwards; }
.slide-up { animation: slideUp 0.4s cubic-bezier(.2, .9, .3, 1.1) backwards; }
.shake { animation: shake 0.42s ease both; }
.breathe { animation: breathe 1.5s ease-in-out infinite alternate; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(40%); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes toastIn { from { transform: translateY(20px) scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes entrance { from { transform: translateY(36px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes enterForward { from { transform: translateX(25%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes enterBack { from { transform: translateX(-16%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes enterGame { from { transform: translateY(16%) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}
@keyframes breathe { from { transform: scale(1); } to { transform: scale(1.12); } }
@keyframes tabBounce { from { transform: scale(0.78); } to { transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseBorder { 0%, 100% { box-shadow: 0 0 0 0 rgba(109, 74, 255, 0.5); } 50% { box-shadow: 0 0 0 4px rgba(109, 74, 255, 0.25); } }
@keyframes countPop {
  from { transform: scale(1.8); opacity: 0; }
  40% { opacity: 1; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes bounceWave { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-8px); } }
@keyframes floatUp { from { transform: translateY(0) scale(0.8); opacity: 1; } to { transform: translateY(-30px) scale(1.2); opacity: 0; } }
@keyframes confettiFall {
  from { transform: translate3d(0, -20px, 0) rotate(0deg); opacity: 1; }
  to { transform: translate3d(var(--dx, 0px), 110vh, 0) rotate(var(--rot, 540deg)); opacity: 1; }
}
@keyframes cheerIn { from { transform: translateY(110%); } to { transform: none; } }

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(109, 74, 255, 0.2);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

/* The desktop sidebar. */
.sidenav {
  position: relative;
  flex: 0 0 248px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px 14px;
  background: #fff;
  border-right: 1px solid var(--line);
  z-index: 20;
  overflow-x: hidden;
  overflow-y: auto;
}
/* Stella over the icon column, the name starting where the labels do. */
.sidenav .brand { display: flex; align-items: center; font-size: 28px; font-weight: 900; padding: 0 0 14px; white-space: nowrap; }
.sidenav .brand-stella { flex: none; width: 56px; height: 56px; }
/* Stella is drawn low in her square (room above for hops), so the name drops to her middle. */
.sidenav .brand-word { margin-top: 14px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 16px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--bg); }
.nav-item.selected { background: var(--primary-tint); color: var(--primary); }
.nav-item .badge {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}
.nav-sep { height: 1px; background: var(--line); margin: 10px 12px; }
.nav-foot { margin-top: auto; padding: 12px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }

/* Home: Stella's side and the main column (one column on a phone). */
.home-grid { display: flex; flex-direction: column; gap: 18px; }
.home-side, .home-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Game shell */
.game { position: absolute; inset: 0; overflow: hidden; overflow: clip; touch-action: none; user-select: none; }
.game-col {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}
.game-area { position: relative; flex: 1 1 0; min-height: 0; }
/* GameSplit: a column on a phone; a side panel and a board filling the rest on a desktop. */
.game-split { display: flex; flex-direction: column; min-height: 0; }
.game-split > .gs-top, .game-split > .gs-bottom { flex: 0 0 auto; min-width: 0; }
.game-split > .gs-main { position: relative; flex: 1 1 0; min-height: 0; min-width: 0; }
.progress-track { height: 8px; border-radius: 999px; background: rgba(30, 27, 75, 0.08); overflow: hidden; width: 100%; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--primary); transition: width 0.45s cubic-bezier(.3, 1.2, .5, 1); }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 30; }
/* A dialog's layer is fixed to the window, so one opened from inside a sheet covers it all. */
.overlay.dialog-layer { position: fixed; }
.overlay-dim { position: absolute; inset: 0; background: rgba(30, 27, 75, 0.55); animation: fadeIn 0.2s ease both; z-index: 29; }
.countdown {
  font-size: 120px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  white-space: nowrap;
  animation: countPop 0.5s cubic-bezier(.3, 1.6, .5, 1) both;
}
.stat-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #fff;
  font-size: 16px;
  font-weight: 800;
}
.streak-pill {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--flame);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  animation: popIn 0.35s cubic-bezier(.3, 1.8, .5, 1) both;
}
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i {
  position: absolute;
  top: -20px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}

/* Swipe Sprint */
@keyframes cardRise { from { transform: translateY(18px) scale(0.93); } to { transform: none; } }
@keyframes flashOut { from { opacity: 0.22; } to { opacity: 0; } }
.card-rise { animation: cardRise 0.35s cubic-bezier(.3, 1.4, .5, 1) backwards; }
.flash { position: absolute; inset: 0; pointer-events: none; animation: flashOut 0.45s ease-out both; }

/* Big screens and mice: last, so these win over the rules above. */
@media (hover: hover) {
  .tappable:hover { filter: brightness(1.03); }
  .chunky:hover:not(:disabled) { filter: brightness(1.05); }
  .chip:hover { border-color: rgba(109, 74, 255, 0.4); }
  .icon-btn:hover { box-shadow: 0 4px 12px rgba(30, 27, 75, 0.18); }
}

@media (max-width: 899.98px) {
  .mob-hide { display: none !important; }
}
@media (min-width: 900px) {
  .desk-hide { display: none !important; }
  .screen-pad { padding-top: 16px; }
  .page, .page-narrow, .page-form { padding-left: 28px; padding-right: 28px; }
  .page .px20, .page-narrow .px20, .page-form .px20 { padding-left: 0; padding-right: 0; }
  /* Rows that scroll sideways on a phone wrap on a desktop (no sideways scrolling with a mouse). */
  .page .hscroll, .page-narrow .hscroll, .page-form .hscroll { flex-wrap: wrap; overflow: visible; padding-left: 0; padding-right: 0; }
  .home-grid { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 28px; align-items: start; }
  .home-side { position: sticky; top: 16px; }
  .toast-host { bottom: 32px; }
  /* Sheets become centred dialogs. */
  .sheet {
    top: 0;
    margin: auto;
    width: min(560px, calc(100% - 48px));
    height: fit-content;
    max-height: 86%;
    border-radius: 28px;
    padding: 22px 6px 22px;
    animation: sheetPop 0.26s cubic-bezier(.2, .9, .3, 1.1) backwards;
  }
  .sheet .grabber { display: none; }
  /* Activities take the whole window: a side panel and the board (GameSplit), capped on huge screens. */
  .game-col { left: 0; right: 0; margin: 0 auto; max-width: 1680px; padding-left: 24px; padding-right: 24px; }
  .game-hud-mid { width: 100%; max-width: 640px; margin: 0 auto; }
  .game .overlay > * { max-width: 520px; }
  .game-split {
    display: grid;
    grid-template-columns: var(--gs-side, 380px) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "top main" "bottom main";
    column-gap: 28px;
    padding-bottom: 16px;
  }
  .game-split > .gs-top { grid-area: top; padding-top: 4px; }
  .game-split > .gs-main { grid-area: main; }
  .game-split > .gs-bottom { grid-area: bottom; align-self: start; min-height: 0; max-height: 100%; overflow-y: auto; padding-top: 12px; }
}
@keyframes sheetPop { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
@keyframes dialogIn { from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); } to { opacity: 1; transform: translate(-50%, -50%); } }

/* The desktop sidebar folds to a rail of icons (the button at its foot). */
.sidenav { transition: flex-basis 0.22s ease, padding 0.22s ease; }
.sidenav.collapsed { flex-basis: 80px; padding: 22px 12px; }
.sidenav.collapsed .brand { padding: 0 0 14px; justify-content: center; }
.sidenav.collapsed .brand-word { display: none; }
.sidenav.collapsed .nav-item { justify-content: center; padding: 8px 0; }
.sidenav.collapsed .nav-label { display: none; }
.sidenav.collapsed .nav-sep { margin: 10px 8px; }
.sidenav.collapsed .nav-item .badge { position: absolute; top: 2px; right: 4px; margin: 0; min-width: 18px; height: 18px; padding: 0 4px; font-size: 10px; line-height: 18px; }
.nav-toggle {
  margin-top: auto;
  align-self: flex-end;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  transition: background 0.15s, color 0.15s;
}
.nav-toggle:hover { background: var(--bg); color: var(--primary); }
.sidenav.collapsed .nav-toggle { align-self: center; }

/* A key on the keyboard that does the same as a button above it, shown only where there's a mouse. */
.keycap {
  display: none;
  min-width: 24px;
  height: 22px;
  margin-top: 4px;
  padding: 0 5px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 2px 0 var(--line);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
}
@media (hover: hover) and (pointer: fine) {
  .keycap { display: inline-block; }
}
