: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);
}

* { 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: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bot) 100%);
  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;
  max-height: 800px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bot) 100%);
}

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

/* ---------- HOME ---------- */
.screen-home {
  padding: 18px 22px 12px;
  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;
}
.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: 800;
  color: var(--gold);
  line-height: 1;
}
.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: rgba(255,255,255,0.05);
  border-radius: 999px;
  padding: 8px 16px;
}
.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: 18px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--orange) 100%);
  color: #2a1a00;
  font-size: 22px; font-weight: 800; letter-spacing: 1px;
  cursor: pointer;
  transition: transform 0.1s ease;
  box-shadow: 0 8px 22px rgba(255,140,66,0.35);
}
.btn-play:active { transform: scale(0.97); }

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

/* ---------- 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: 12px 18px 18px;
  overflow: hidden;
}
.session-top { flex: 0 0 auto; }
.progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #7DEDC4);
  width: 0%;
  transition: width 0.4s ease;
}
.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; }

.session-header-spacer { width: 28px; }

.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; }
.card.exit-left   { transform: translateX(-110%); opacity: 0; transition: transform 0.22s ease-in, opacity 0.22s ease; }
.card.exit-right  { transform: translateX(110%); opacity: 0; transition: transform 0.22s ease-in, opacity 0.22s ease; }

.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;
}
.prompt-en-big { font-size: 44px; font-weight: 800; }
.prompt-sentence {
  font-size: 30px;
  font-style: italic;
  text-align: center;
  line-height: 1.25;
  padding: 0 12px;
}
.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: 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: 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); }
.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: #fff;
  color: #2a1f3d;
  border: 0;
  border-radius: 14px;
  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;
}
/* 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; }
/* 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;
}
.option.wrong {
  background: linear-gradient(180deg, var(--red), #b8332e);
  color: #fff;
}

.explainer {
  position: absolute;
  left: 14px; right: 14px; bottom: 90px;
  background: rgba(91,69,140,0.55);
  border: 1px solid rgba(150,120,210,0.45);
  border-left: 3px solid #b39ddb;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-style: italic;
  opacity: 1;
  transition: opacity 0.28s ease;
}
.explainer.fading { opacity: 0; }

/* Wrong-answer feedback panel — slides up from bottom of session screen. */
.feedback-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 22px 22px 22px;
  background: linear-gradient(180deg, #2a2040 0%, #14121e 100%);
  border-top: 1px solid rgba(255,140,66,0.3);
  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-correct-label {
  font-size: 11px; letter-spacing: 2px;
  opacity: 0.55;
  text-transform: uppercase;
}
.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-answer {
  font-size: 30px; font-weight: 800;
  font-style: italic;
  color: var(--green);
  margin: 2px 0 4px;
  line-height: 1.15;
}
.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-tricky {
  font-size: 13px;
  color: var(--orange-soft);
  background: rgba(255,140,66,0.1);
  border: 1px solid rgba(255,140,66,0.3);
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 6px;
  font-style: italic;
}
.fb-gotit {
  width: 100%; height: 56px;
  border: 0;
  border-radius: 14px;
  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;
}
.fb-gotit:active { transform: scale(0.98); }

#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: 24px 22px;
  z-index: 30;
}
.modal.active { display: flex; }
.modal-head {
  font-size: 20px; font-weight: 800;
  padding: 6px 0 18px;
}
.modal-list {
  flex: 1; overflow-y: auto;
  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: 14px;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  color: #2a1a00;
  font-weight: 800; font-size: 16px;
  letter-spacing: 1px;
  cursor: pointer;
  margin-top: 14px;
}

/* SETTINGS */
.settings-list {
  flex: 1;
  display: flex; flex-direction: column;
  gap: 8px;
}
.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-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);
}
