:root {
  --gold: #FFD93D;
  --orange: #FF8C42;
  --orange-soft: #FFB87A;
  --green: #5DCAA5;
  --red: #ef5350;
  --bg-top: #2c1f3d;
  --bg-bot: #1a1a2e;
  --text: #ffffff;
  --muted: rgba(255,255,255,0.5);
  /* Layered ambience: a warm aurora up top, a cool teal breath at the
     bottom. Sits on every screen; individual elements stay translucent. */
  --app-bg:
    radial-gradient(120% 60% at 50% -12%, rgba(124,77,255,0.28) 0%, rgba(124,77,255,0) 60%),
    radial-gradient(90% 40% at 85% 4%, rgba(255,140,66,0.10) 0%, rgba(255,140,66,0) 55%),
    radial-gradient(110% 55% at 12% 104%, rgba(93,202,165,0.10) 0%, rgba(93,202,165,0) 60%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bot) 100%);
  --card-face: rgba(255,255,255,0.05);
  --card-edge: rgba(255,255,255,0.10);
  --focus-ring: 0 0 0 3px rgba(255,217,61,0.55);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--app-bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Phone-shaped column on every viewport.
   Tall viewports (laptop/desktop) cap at 800px tall and center vertically.
   Short viewports (phones) fill 100vh as normal. */
#app {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;          /* fill the real mobile viewport (incl. browser chrome)
                              so tall phones don't get dead bands top and bottom */
  position: relative;
  overflow: hidden;
  background: var(--app-bg);
}

/* On anything wider than a phone, present the app as a floating device:
   rounded, edged, and lifted off a dimmed ambient backdrop. */
@media (min-width: 521px) and (min-height: 721px) {
  body {
    background:
      radial-gradient(100% 90% at 50% 0%, #241a35 0%, #120f1d 70%, #0c0a14 100%);
  }
  #app {
    /* Fixed design size, then scaled UP to fill the viewport so the phone-sized
       UI (and its text) isn't tiny on a big screen. --app-scale is set by JS
       (fitAppScale) from the viewport; default 1 for no-JS. */
    width: 480px;
    height: 800px;
    max-width: none;
    transform: scale(var(--app-scale, 1));
    transform-origin: center center;
    border-radius: 32px;
    border: 1px solid rgba(255,255,255,0.09);
    box-shadow:
      0 40px 90px rgba(0,0,0,0.55),
      0 12px 30px rgba(0,0,0,0.35),
      inset 0 1px 0 rgba(255,255,255,0.06);
  }
}

.screen {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
}
.screen.active { display: flex; }

/* ---------- HOME ---------- */
/* Screens are absolutely positioned (inset: 0), so safe-area insets for
   notched phones must live on each screen's own padding, not on #app. */
.screen-home {
  padding: calc(18px + env(safe-area-inset-top, 0px)) 22px calc(12px + env(safe-area-inset-bottom, 0px));
  justify-content: space-between;
}
.home-header {
  display: flex; align-items: center; justify-content: space-between;
}
.wordmark {
  font-size: 22px;
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.5px;
}
.wordmark-i { color: var(--gold); }
.btn-settings {
  background: none; border: 0;
  color: var(--text);
  font-size: 22px; opacity: 0.6;
  cursor: pointer;
}

.home-main {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 22px;
  padding: 12px 0;
  min-height: 0;
}
.flame-wrap {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  position: relative;
}
/* Soft halo behind the flame so the streak block anchors the screen
   instead of floating in flat darkness. Pure ambience, no motion. */
.flame-wrap::before {
  content: "";
  position: absolute;
  top: -30px; left: 50%;
  transform: translateX(-50%);
  width: 240px; height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,140,66,0.16) 0%, rgba(255,217,61,0.06) 45%, transparent 70%);
  pointer-events: none;
}
.flame-icon {
  width: 90px; height: 90px;
  display: grid; place-items: center;
  font-size: 72px;
  background: linear-gradient(180deg, var(--gold) 0%, var(--orange) 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255,140,66,0.45));
}
.streak-num {
  font-size: 56px; font-weight: 900;
  color: var(--gold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 18px rgba(255,217,61,0.35);
}
.streak-label {
  font-size: 11px; letter-spacing: 2px;
  opacity: 0.55;
}
.best-streak {
  font-size: 12px;
  opacity: 0.5;
  margin-top: 6px;
  letter-spacing: 0.3px;
}
.best-streak.hidden { display: none; }
.play-subtext {
  display: block;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.4px;
  opacity: 0.65;
  margin-top: 4px;
  text-transform: none;
}
.btn-play[disabled] {
  opacity: 0.4;
  cursor: default;
  filter: grayscale(0.5);
}

.dots-pill {
  display: flex; align-items: center; gap: 12px;
  background: var(--card-face);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 8px 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.dots { display: flex; gap: 6px; }
.dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
}
.dot.done {
  background: var(--green);
  box-shadow: 0 0 8px rgba(93,202,165,0.7);
}
.dots-text { font-size: 11px; opacity: 0.55; }

.chip-tomaster {
  border: 1px solid rgba(255,140,66,0.3);
  background: rgba(255,140,66,0.12);
  color: var(--orange-soft);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.18s ease;
}
.chip-tomaster:active { transform: scale(0.97); }

.play-wrap {
  padding: 0 0 18px;
  display: flex; justify-content: center;
}
.btn-play {
  width: 100%; max-width: 320px; height: 72px;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(135deg, #FFE066 0%, var(--gold) 32%, var(--orange) 100%);
  color: #2a1a00;
  font-size: 22px; font-weight: 800; letter-spacing: 2px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.18s ease;
  box-shadow:
    0 10px 28px rgba(255,140,66,0.38),
    0 2px 6px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255,255,255,0.55),
    inset 0 -2px 0 rgba(140,60,0,0.22);
}
.btn-play:hover { filter: brightness(1.05); box-shadow: 0 14px 34px rgba(255,140,66,0.5), 0 2px 6px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.55), inset 0 -2px 0 rgba(140,60,0,0.22); }
.btn-play:active { transform: scale(0.97); filter: brightness(0.98); }
.btn-play:focus-visible { outline: none; box-shadow: var(--focus-ring), 0 10px 28px rgba(255,140,66,0.38); }

.home-footer {
  text-align: center;
  font-size: 10px; letter-spacing: 1.5px;
  opacity: 0.35;
  padding: 4px 0 6px;
}

/* Language chip on the home header — opens the picker. */
.btn-lang {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  width: 38px; height: 38px;
  border-radius: 12px;
  display: grid; place-items: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s ease, background 0.18s ease;
}
.btn-lang:active { transform: scale(0.94); }
.btn-lang:hover { background: rgba(255,255,255,0.1); }
.btn-lang-flag {
  font-size: 20px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* ---------- LANGUAGE PICKER ---------- */
.screen-langpicker {
  padding: calc(18px + env(safe-area-inset-top, 0px)) 22px calc(22px + env(safe-area-inset-bottom, 0px));
}
.lp-header {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  margin-bottom: 14px;
}
.lp-header .wordmark { text-align: center; }
.btn-lp-back {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 12px;
  font-size: 18px;
  cursor: pointer;
  display: grid; place-items: center;
  padding: 0;
  transition: transform 0.1s ease, background 0.18s ease;
}
.btn-lp-back:active { transform: scale(0.94); }
.btn-lp-back.hidden { visibility: hidden; }
.lp-header-spacer { width: 38px; }

.lp-title {
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  margin-top: 6px;
  letter-spacing: 0.2px;
}
.lp-sub {
  font-size: 12px;
  text-align: center;
  opacity: 0.55;
  margin: 4px 0 18px;
}
.lp-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  overflow-y: auto;
  padding: 2px 2px 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.lp-grid::-webkit-scrollbar { width: 4px; }
.lp-grid::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
}

.lp-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  position: relative;
  color: var(--text);
  font-family: inherit;
  text-align: center;
  transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
@media (hover: hover) {
  .lp-card:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.3);
  }
}
.lp-card:active { transform: scale(0.97); }
.lp-card:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.lp-card.current {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(255,217,61,0.12) 0%, rgba(255,140,66,0.06) 100%);
  box-shadow: 0 0 0 1px rgba(255,217,61,0.35), 0 6px 18px rgba(255,140,66,0.18);
}
.lp-flag {
  font-size: 34px;
  line-height: 1;
  margin-bottom: 2px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35));
}
/* Twemoji replaces emoji chars with <img class="emoji">. Inline + sized so
   they sit cleanly inside .lp-flag / .btn-lang-flag without baseline drift. */
img.emoji {
  height: 1em;
  width: 1em;
  margin: 0;
  display: inline-block;
  vertical-align: -0.1em;
}
.lp-flag img.emoji { height: 34px; width: 34px; }
.btn-lang-flag img.emoji { height: 22px; width: 22px; }
.lp-native {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.lp-en {
  font-size: 11px;
  opacity: 0.5;
  letter-spacing: 0.3px;
}
.lp-tier {
  margin-top: 6px;
  font-size: 9px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  opacity: 0.7;
}
.lp-card.current .lp-tier {
  background: rgba(255,217,61,0.18);
  color: var(--gold);
  opacity: 1;
}
.lp-card.current::after {
  content: "✓";
  position: absolute;
  top: 7px; right: 9px;
  font-size: 12px;
  color: var(--gold);
  font-weight: 800;
}

/* ---------- SESSION ---------- */
/* Inherits position:absolute + inset:0 from .screen so it fills #app.
   Don't re-declare position here — that overrides the parent rule and
   collapses the screen to its content height. */
.screen-session {
  padding: calc(12px + env(safe-area-inset-top, 0px)) 18px calc(18px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
}
.session-top { flex: 0 0 auto; }
.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--green), #7DEDC4);
  width: 0%;
  transition: width 0.4s cubic-bezier(0.2, 0.7, 0.3, 1);
  box-shadow: 0 0 10px rgba(93,202,165,0.55);
}
.session-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0 14px;
}
.btn-back {
  background: none; border: 0;
  color: var(--text); font-size: 22px;
  opacity: 0.6; cursor: pointer;
}
.streak-indicator {
  display: flex; align-items: center; gap: 6px;
  font-weight: 700; color: var(--gold);
  font-size: 16px;
}
.streak-flame { font-size: 16px; }


.card-deck {
  flex: 1;
  position: relative;
  margin-top: 14px;
  min-height: 0;
}

.card {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding-bottom: 16px;
  transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.3, 1), opacity 0.22s ease;
  will-change: transform, opacity;
}
.card.enter-right { transform: translateX(110%); opacity: 0; }
.card.enter-left  { transform: translateX(-110%); opacity: 0; }
/* Exiting cards are inert — a card sliding out must not catch taps meant
   for the incoming card (covers the swipe-skip case, where the outgoing
   card was never graded so it carries no answered-flag). */
.card.exit-left   { transform: translateX(-110%); opacity: 0; transition: transform 0.22s ease-in, opacity 0.22s ease; pointer-events: none; }
.card.exit-right  { transform: translateX(110%); opacity: 0; transition: transform 0.22s ease-in, opacity 0.22s ease; pointer-events: none; }

.prompt-area {
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  padding: 10px 0;
  min-height: 0;
  text-align: center;
  overflow: hidden;
}
.prompt-emoji { font-size: 130px; line-height: 1; }
.prompt-icon {
  max-width: 130px; max-height: 130px;
  width: auto; height: auto;
  display: block;
}
.prompt-saylabel {
  font-size: 11px; letter-spacing: 2px;
  opacity: 0.55;
}
/* clamp() keeps long words / sentences from clipping on narrow phones —
   the fixed sizes overflowed for words like "responsibilities". */
.prompt-en-big {
  font-size: clamp(28px, 10vw, 44px);
  font-weight: 800;
  line-height: 1.1;
  overflow-wrap: break-word;
  max-width: 100%;
  padding: 0 8px;
}
.prompt-sentence {
  font-size: clamp(22px, 7.2vw, 30px);
  font-style: italic;
  text-align: center;
  line-height: 1.25;
  padding: 0 12px;
  overflow-wrap: break-word;
  max-width: 100%;
}
.prompt-sentence .gap {
  color: var(--gold);
  border-bottom: 2px dashed var(--gold);
  padding: 0 12px;
}
.prompt-en {
  font-size: 13px;
  opacity: 0.45;
  font-style: italic;
}

/* New round-type prompt blocks. Each matches the rhythm of .prompt-sentence
   but carries its own visual cue so the user knows what kind of round
   they're looking at. */
.prompt-idiom {
  font-size: clamp(22px, 7.2vw, 30px);
  font-weight: 700;
  font-style: italic;
  text-align: center;
  line-height: 1.25;
  padding: 0 12px;
  color: var(--gold);
}
.prompt-falsefriend {
  font-size: 12px;
  opacity: 0.7;
  font-style: italic;
  text-align: center;
  padding: 0 16px;
  margin-top: 4px;
  color: #ff9a8a;
}
.prompt-region {
  font-size: clamp(26px, 8.5vw, 36px);
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.5px;
  color: var(--gold);
}
.prompt-context {
  font-size: 18px;
  font-style: italic;
  text-align: center;
  line-height: 1.3;
  padding: 0 16px;
  opacity: 0.85;
}
.prompt-tag {
  display: inline-block;
  align-self: center;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255,154,138,0.15);
  color: #ff9a8a;
  margin-bottom: 6px;
}

.listen-btn {
  width: 140px; height: 140px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--green), #2c8064);
  color: #fff;
  font-size: 56px;
  border: 0;
  box-shadow: 0 8px 28px rgba(93,202,165,0.35);
  cursor: pointer;
  transition: transform 0.1s ease;
}
.listen-btn:active { transform: scale(0.96); }
@media (hover: hover) {
  .listen-btn:hover { transform: scale(1.03); box-shadow: 0 12px 34px rgba(93,202,165,0.45); }
}
.listen-btn:focus-visible { outline: none; box-shadow: var(--focus-ring), 0 8px 28px rgba(93,202,165,0.35); }
.listen-hint { font-size: 12px; opacity: 0.5; margin-top: 6px; }

.options-area {
  display: flex; flex-direction: column; gap: 10px;
  padding-top: 8px;
  flex: 0 0 auto;
  flex-shrink: 0;
}
.option {
  position: relative;
  width: 100%; height: 64px;
  background: linear-gradient(180deg, #ffffff 0%, #f2eefb 100%);
  color: #2a1f3d;
  border: 0;
  border-radius: 16px;
  font-size: 22px;
  font-style: italic; font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.1s ease, box-shadow 0.18s ease;
  box-shadow:
    0 4px 12px rgba(0,0,0,0.28),
    inset 0 1px 0 rgba(255,255,255,0.9),
    inset 0 -2px 0 rgba(42,31,61,0.10);
}
@media (hover: hover) {
  .option:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(0,0,0,0.34), inset 0 1px 0 rgba(255,255,255,0.9), inset 0 -2px 0 rgba(42,31,61,0.10); }
}
.option:focus-visible { outline: none; box-shadow: var(--focus-ring), 0 4px 12px rgba(0,0,0,0.28); }
/* Digit floats in the corner — never inline with the option text. */
.opt-num {
  position: absolute;
  top: 8px;
  left: 12px;
  display: inline-block;
  font-family: ui-monospace, "SF Mono", Consolas, "Courier New", monospace;
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
  opacity: 0.5;
  pointer-events: none;
  letter-spacing: 0;
  line-height: 1;
}
.option.correct .opt-num,
.option.wrong .opt-num { color: rgba(255,255,255,0.7); opacity: 0.7; }
/* RTL languages (ar, he, fa): cards opt in via .rtl when the current
   lang is in rounds.js RTL_LANGS. The option button's numbered chip stays
   LTR; the native-text span inside gets dir="rtl" inline. */
.card.rtl .prompt-en-big,
.card.rtl .prompt-idiom,
.card.rtl .prompt-sentence,
.card.rtl .prompt-region { direction: rtl; text-align: center; }
.card.rtl .option [dir="rtl"] { unicode-bidi: isolate; }
/* Listening options stack the Spanish answer over a soft English gloss.
   The English is quiet on purpose — a friendly hint, not a co-headline. */
.option-bilingual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.opt-text { line-height: 1.1; }
.opt-en {
  font-size: 13px;
  font-style: normal;
  font-weight: 500;
  opacity: 0.45;
  line-height: 1.1;
}
.option.correct .opt-en,
.option.wrong .opt-en { color: rgba(255,255,255,0.85); opacity: 0.85; }
/* Hide on touch devices — no keyboard, no shortcuts, just visual noise. */
@media (hover: none) and (pointer: coarse) {
  .opt-num { display: none; }
}
.option:active { transform: scale(0.98); }
.option.correct {
  background: linear-gradient(180deg, var(--green), #3da080);
  color: #fff;
  box-shadow: 0 4px 18px rgba(93,202,165,0.45), inset 0 1px 0 rgba(255,255,255,0.35);
}
.option.wrong {
  background: linear-gradient(180deg, var(--red), #b8332e);
  color: #fff;
  box-shadow: 0 4px 18px rgba(239,83,80,0.4), inset 0 1px 0 rgba(255,255,255,0.25);
}

/* Wrong-answer feedback panel — slides up from bottom of session screen. */
.feedback-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 22px 22px calc(22px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, #2a2040 0%, #14121e 100%);
  border-top: 1px solid rgba(255,140,66,0.3);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -16px 40px rgba(0,0,0,0.55);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.3, 1);
  z-index: 25;
  display: flex; flex-direction: column;
  gap: 4px;
}
.feedback-panel.on { transform: translateY(0); }
.fb-compare {
  display: flex;
  gap: 14px;
  margin: 0 0 8px;
}
.fb-pick {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}
.fb-pick-wrong {
  border-color: rgba(239,83,80,0.4);
  background: rgba(239,83,80,0.08);
}
.fb-pick-right {
  border-color: rgba(93,202,165,0.45);
  background: rgba(93,202,165,0.10);
}
.fb-pick-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  opacity: 0.6;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.fb-pick-text {
  font-size: 22px;
  font-weight: 800;
  font-style: italic;
  line-height: 1.15;
  word-break: break-word;
}
.fb-pick-wrong .fb-pick-text { color: var(--red); }
.fb-pick-right .fb-pick-text { color: var(--green); }
.fb-english {
  font-size: 17px;
  opacity: 0.9;
  margin-bottom: 6px;
}
.fb-explain {
  font-size: 14px;
  opacity: 0.78;
  font-style: italic;
  border-left: 3px solid #b39ddb;
  padding: 4px 0 4px 12px;
  margin: 6px 0 4px;
}
.fb-gotit {
  width: 100%; height: 56px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  color: #2a1a00;
  font-weight: 800; font-size: 16px; letter-spacing: 1px;
  cursor: pointer;
  margin-top: 14px;
  transition: transform 0.1s ease;
  box-shadow: 0 6px 18px rgba(255,140,66,0.3), inset 0 1px 0 rgba(255,255,255,0.5);
}
.fb-gotit:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.fb-gotit:active { transform: scale(0.98); }
.fb-leech-prompt {
  font-size: 14px;
  opacity: 0.85;
  margin-top: 10px;
  text-align: center;
  font-style: italic;
}
.fb-leech-buttons {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.fb-leech-btn {
  flex: 1;
  height: 48px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  color: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}
.fb-leech-btn:active { transform: scale(0.97); }
.fb-leech-btn:hover { background: rgba(255,255,255,0.12); }

#particles {
  position: absolute; inset: 0;
  pointer-events: none;
  width: 100%; height: 100%;
}

/* ---------- MODAL ---------- */
.modal {
  position: absolute; inset: 0;
  background: rgba(10,10,26,0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 22px calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
}
.modal.active { display: flex; }
.modal-head {
  font-size: 20px; font-weight: 800;
  padding: 6px 0 18px;
}
.modal-list {
  flex: 1; min-height: 0; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.tomaster-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
}
.tm-emoji {
  font-size: 24px;
  width: 32px; text-align: center;
}
.tm-words { flex: 1; min-width: 0; }
.tm-es { font-size: 16px; font-style: italic; }
.tm-en { font-size: 11px; opacity: 0.5; margin-top: 2px; }
.tomaster-empty {
  opacity: 0.5; text-align: center;
  padding: 40px 0; font-style: italic;
}
.tomaster-more {
  opacity: 0.45; text-align: center;
  padding: 14px 0 4px;
  font-size: 13px; font-style: italic;
}

.btn-done {
  width: 100%; height: 56px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  color: #2a1a00;
  font-weight: 800; font-size: 16px;
  letter-spacing: 1px;
  cursor: pointer;
  margin-top: 14px;
  box-shadow: 0 6px 18px rgba(255,140,66,0.3), inset 0 1px 0 rgba(255,255,255,0.5);
  transition: transform 0.1s ease, filter 0.15s ease;
}
.btn-done:active { transform: scale(0.98); }
.btn-done:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* SETTINGS */
.settings-list {
  flex: 1;
  /* min-height:0 lets this flex child shrink below its content so it can
     scroll; without it the list grows to full height and pushes the Reset /
     DONE buttons off the bottom of the screen on shorter phones. */
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column;
  gap: 8px;
}
/* Settings header with an easy back button (mirrors the DONE action). */
.modal-head-nav {
  display: flex; align-items: center; gap: 10px;
}
.modal-back {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  margin: -6px 0 -6px -8px;      /* enlarge tap target without shifting the title */
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  color: var(--text); font-size: 22px; line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.modal-back:hover { background: rgba(255,255,255,0.12); }
.modal-back:active { transform: scale(0.94); }
.modal-back:focus-visible { outline: none; box-shadow: var(--focus-ring); }
/* "Get it on Google Play" badge (settings). Hidden when already running as the
   installed app, since a Play Store link there is redundant. */
.playstore-badge {
  display: flex; align-items: center; gap: 12px;
  align-self: flex-start;
  margin-top: 12px;
  padding: 9px 18px 9px 16px;
  background: #000;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 12px;
  color: #fff; text-decoration: none;
  transition: background 0.15s ease, transform 0.1s ease;
}
.playstore-badge:hover { background: #141414; }
.playstore-badge:active { transform: scale(0.98); }
.playstore-badge:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ps-logo { flex: 0 0 auto; display: block; }
.ps-text { display: flex; flex-direction: column; line-height: 1.12; }
.ps-small { font-size: 9px; letter-spacing: 1.2px; text-transform: uppercase; opacity: 0.92; }
.ps-big { font-size: 17px; font-weight: 600; letter-spacing: 0.2px; }
@media (display-mode: standalone), (display-mode: minimal-ui), (display-mode: fullscreen) {
  .playstore-badge { display: none; }
}
.settings-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 14px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  font-size: 15px;
  cursor: pointer;
}
.settings-select {
  appearance: none; -webkit-appearance: none;
  background: rgba(255,255,255,0.12);
  color: inherit;
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  max-width: 62%;
  cursor: pointer;
}
.settings-row input[type=checkbox] {
  appearance: none; -webkit-appearance: none;
  width: 44px; height: 24px;
  border-radius: 12px;
  background: rgba(255,255,255,0.15);
  position: relative;
  cursor: pointer;
  transition: background 0.18s ease;
}
.settings-row input[type=checkbox]::before {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}
.settings-row input[type=checkbox]:checked { background: var(--green); }
.settings-row input[type=checkbox]:checked::before { transform: translateX(20px); }

.settings-row.disabled {
  opacity: 0.4;
  pointer-events: none;
}
.settings-sub {
  margin-left: 18px;
  font-size: 14px;
}

.btn-reset {
  width: 100%;
  background: rgba(239, 83, 80, 0.08);
  border: 1px solid rgba(239, 83, 80, 0.4);
  color: #ef5350;
  padding: 14px;
  border-radius: 12px;
  font-size: 14px;
  letter-spacing: 0.5px;
  margin-top: 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-reset:hover { background: rgba(239, 83, 80, 0.15); }
.btn-reset:active { background: rgba(239, 83, 80, 0.22); }

/* TRICKY */
.tricky-overlay {
  position: absolute; inset: 0;
  background: rgba(10,10,26,0.85);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 40;
}
.tricky-overlay.on { opacity: 1; }
.tricky-spiral {
  font-size: 80px;
  animation: spin 2.4s linear infinite;
}
.tricky-text {
  font-size: 16px;
  opacity: 0.85;
  padding: 0 30px;
  text-align: center;
  font-style: italic;
}
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* MASTERED FLASH */
.mastered-flash {
  position: absolute;
  top: 38%; left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  background: linear-gradient(135deg, var(--gold), var(--orange));
  color: #2a1a00;
  font-weight: 900; letter-spacing: 2px;
  font-size: 18px;
  padding: 10px 22px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.2,0.7,0.3,1);
  box-shadow: 0 8px 28px rgba(255,140,66,0.5);
}
.mastered-flash.on {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ---------- AUTH ---------- */
/* Account row inside the settings modal. */
.settings-account {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex; flex-direction: column;
  gap: 8px;
}
.settings-account .acct-email {
  font-size: 13px;
  opacity: 0.7;
  line-height: 1.4;
  word-break: break-word;
}
.settings-account button {
  align-self: flex-start;
  border: 1px solid rgba(255,140,66,0.4);
  background: rgba(255,140,66,0.12);
  color: var(--orange-soft);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.settings-account button.acct-signout {
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: var(--muted);
}

/* Auth modal (#modal-auth reuses .modal / .modal-head). */
.auth-body {
  flex: 1;
  display: flex; flex-direction: column;
  gap: 12px;
}
.auth-intro {
  font-size: 14px;
  opacity: 0.7;
  line-height: 1.45;
  margin: 0 0 4px;
}
.auth-tabs { display: flex; gap: 8px; }
.auth-tab {
  flex: 1; height: 42px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border-radius: 12px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.auth-tab.active {
  background: rgba(255,140,66,0.15);
  border-color: rgba(255,140,66,0.45);
  color: var(--orange-soft);
}
.auth-input {
  width: 100%; height: 52px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 0 16px;
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
}
.auth-input::placeholder { color: rgba(255,255,255,0.35); }
.auth-input:focus { border-color: rgba(255,140,66,0.6); }
.auth-msg {
  font-size: 13px;
  min-height: 18px;
  line-height: 1.4;
  opacity: 0.85;
}
.auth-msg.error { color: var(--red); opacity: 1; }
.auth-msg.ok { color: var(--green); opacity: 1; }
.auth-submit {
  width: 100%; height: 54px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  color: #2a1a00;
  font-weight: 800; font-size: 16px; letter-spacing: 0.5px;
  cursor: pointer;
  margin-top: 4px;
  transition: transform 0.1s ease, opacity 0.15s ease;
}
.auth-submit:active { transform: scale(0.98); }
.auth-submit[disabled] { opacity: 0.5; cursor: default; }
.auth-cancel.btn-done {
  background: rgba(255,255,255,0.06);
  color: var(--muted);
}

/* ---------- DAILY 5-MINUTE TIMER ---------- */
/* Lives in the session header, right side. Counts up toward today's goal. */
.session-timer {
  font-family: ui-monospace, "SF Mono", Consolas, "Courier New", monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  min-width: 44px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}
.session-timer.goal-hit { color: var(--green); }

/* Home-screen reward shown after a session that hit the 5-minute goal. */
.daily-reward {
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
  padding: 26px 40px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(44,31,61,0.98), rgba(26,26,46,0.98));
  border: 1px solid rgba(255,140,66,0.35);
  box-shadow: 0 16px 50px rgba(0,0,0,0.6);
  text-align: center;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.2,0.7,0.3,1);
}
.daily-reward.on { transform: translate(-50%, -50%) scale(1); }
.dr-flame {
  font-size: 46px; line-height: 1;
  filter: drop-shadow(0 0 16px rgba(255,140,66,0.5));
}
.dr-streak {
  font-size: 52px; font-weight: 800;
  color: var(--gold);
  line-height: 1.1;
}
.dr-label {
  font-size: 11px; letter-spacing: 2px;
  opacity: 0.6; text-transform: uppercase;
}
.dr-sub {
  margin-top: 10px;
  font-size: 13px;
  color: var(--orange-soft);
  font-style: italic;
}

/* ---------- DECAY URGENCY ---------- */
/* Home-screen "your words are slipping" line. Amber, never red — a gentle,
   honest reason to come back, not a shame counter. */
.fading-line {
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
  border: 1px solid rgba(255,184,122,0.28);
  background: rgba(255,184,122,0.08);
  color: var(--orange-soft);
  border-radius: 14px;
  padding: 9px 18px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.18s ease;
}
.fading-line.hidden { display: none; }
.fading-line:active { transform: scale(0.98); }
.fading-line .fading-count { font-size: 14px; font-weight: 700; }
.fading-line .fading-sub {
  font-size: 11px;
  opacity: 0.75;
  font-style: italic;
}

/* Respect the OS "reduce motion" setting: collapse every transition and
   animation to ~instant (this also stops the infinite tricky-spiral spin).
   JS timing is setTimeout-driven, not transitionend-driven, so card swaps
   and the feedback panel still sequence correctly — only the perceptible
   motion is removed. The correct-answer particle burst is gated separately
   in fx.js. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
