/* ═══════════════════════════════════════════
   Glossa — Complete Stylesheet
   Dark Theme · Amber Accent · All Modes
   ═══════════════════════════════════════════ */

/* ── Reset ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0a0a0a;
  --surface:   #141414;
  --surface-2: #1e1e1e;
  --border:    #2a2a2a;
  --text-1:    #f0ede8;
  --text-2:    #8a8680;
  --text-3:    #4a4845;
  --amber:     #f0a500;
  --amber-dim: #7a5200;
  --teal:      #00b894;
  --teal-dim:  #004d3d;
  --red:       #e17055;
  --red-dim:   #5a2d22;
  --blue:      #74b9ff;
  --blue-dim:  #1a3a5c;
  --font-ui:   'Outfit', sans-serif;
  --font-word: 'Noto Sans', 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans SC',
               'Noto Sans Arabic', 'Noto Sans Devanagari', sans-serif;
  --ease:      cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 16px; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Screens ────────────────────────────── */
.screen { display: none; }
.screen.active { display: block; }

/* ── Header ─────────────────────────────── */
#header {
  position: sticky; top: 0; z-index: 100;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.wordmark {
  font-size: 1.35rem; font-weight: 700;
  letter-spacing: -0.02em; color: var(--text-1);
  cursor: pointer;
  transition: color 0.2s;
}
.wordmark:hover { color: var(--amber); }
.stats-btn {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s var(--ease);
}
.stats-btn:hover { border-color: var(--amber); color: var(--amber); }

/* ── Stats Drawer ───────────────────────── */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5);
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.drawer-overlay.open { opacity: 1; visibility: visible; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 300px; max-width: 85vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 32px 24px;
  transform: translateX(100%);
  transition: transform 0.3s var(--ease);
}
.drawer-overlay.open .drawer { transform: translateX(0); }
.drawer-title {
  font-size: 1.1rem; font-weight: 700; margin-bottom: 24px;
  color: var(--text-1);
}
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.stat-item {
  background: var(--surface-2); border-radius: 10px;
  padding: 16px 12px; text-align: center;
}
.stat-num {
  font-size: 1.8rem; font-weight: 700; color: var(--amber);
  line-height: 1.2;
}
.stat-lbl {
  font-size: 0.72rem; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-top: 4px;
}

/* ── HOME SCREEN ────────────────────────── */
.home-wrap {
  max-width: 480px; margin: 0 auto;
  padding: 40px 16px;
  display: flex; flex-direction: column; gap: 28px;
}

/* daily card */
.daily-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px;
  text-align: center;
}
.daily-label {
  font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--text-2);
  margin-bottom: 16px;
}
.daily-btn {
  width: 100%; height: 48px;
  background: var(--amber); color: #000;
  font-family: var(--font-ui); font-size: 1rem; font-weight: 700;
  border: none; border-radius: 8px; cursor: pointer;
  transition: all 0.2s var(--ease);
}
.daily-btn:hover { background: #ffc04d; transform: translateY(-1px); }
.daily-lock {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--text-3); font-size: 0.95rem;
  padding: 12px 0;
}
.lock-icon { font-size: 1.2rem; }
.daily-sub {
  font-size: 0.72rem; color: var(--text-3); margin-top: 12px;
}

/* practice label */
.practice-label {
  font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--text-2);
}

/* mode grid */
.mode-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.mode-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}
.mode-card:hover {
  border-color: var(--amber);
  background: var(--surface-2);
  transform: scale(1.01);
}
.mode-icon { font-size: 28px; margin-bottom: 6px; }
.mode-name { font-size: 0.9rem; font-weight: 500; color: var(--text-1); margin-bottom: 4px; }
.mode-desc { font-size: 0.72rem; color: var(--text-2); line-height: 1.4; }
.best-badge {
  display: inline-block;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 8px;
}

/* ── GAME SCREEN ────────────────────────── */
/* game-top-bar removed — wordmark is the back button */

.game-content {
  max-width: 520px; margin: 0 auto;
  padding: 24px 16px 60px;
}

.mode-container { display: none; }
.mode-container.active {
  display: flex; flex-direction: column;
  align-items: center; gap: 20px;
}

/* ── SHARED: Word Card ──────────────────── */
.word-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 48px 32px;
  text-align: center;
  position: relative;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.mystery-word {
  font-family: var(--font-word);
  font-size: 3.2rem; font-weight: 700;
  color: var(--text-1); line-height: 1.3;
  margin-bottom: 8px; word-break: break-word;
}
.translation {
  font-size: 0.95rem; color: var(--text-2);
}
.translation strong { color: var(--amber); font-weight: 500; }

/* card states */
.card-win {
  border-color: var(--teal) !important;
  box-shadow: 0 0 40px rgba(0,184,148,0.15);
}
.card-lose {
  border-color: var(--red) !important;
  box-shadow: 0 0 40px rgba(225,112,85,0.15);
}
.flash-correct { animation: flashCorrect 0.3s ease; }
.flash-wrong   { animation: flashWrong 0.3s ease; }

/* ── SHARED: Input Area ─────────────────── */
.input-area { width: 100%; position: relative; }
.input-row {
  display: flex; gap: 8px;
}
.input-row input {
  flex: 1;
  height: 48px;
  padding: 0 16px;
  font-family: var(--font-ui); font-size: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-1);
  outline: none; transition: border-color 0.2s;
}
.input-row input::placeholder { color: var(--text-3); }
.input-row input:focus { border-color: var(--amber); }

.dropdown-toggle {
  width: 40px; height: 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-2);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.dropdown-toggle:hover { border-color: var(--amber); color: var(--amber); }

.btn-guess {
  height: 48px; padding: 0 20px;
  font-family: var(--font-ui); font-size: 0.9rem; font-weight: 700;
  background: var(--amber); color: #000;
  border: none; border-radius: 8px; cursor: pointer;
  white-space: nowrap; transition: all 0.2s var(--ease);
}
.btn-guess:hover { background: #ffc04d; transform: translateY(-1px); }

/* ── SHARED: Autocomplete ───────────────── */
.autocomplete-list {
  position: absolute; top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 220px; overflow-y: auto;
  z-index: 50; display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.autocomplete-list.open { display: block; animation: fadeInUp 0.15s ease-out; }
.autocomplete-item {
  padding: 10px 14px;
  font-size: 0.9rem; color: var(--text-1);
  cursor: pointer; transition: background 0.12s;
}
.autocomplete-item:hover, .autocomplete-item.active {
  background: var(--surface-2); color: var(--amber);
}

/* ── SHARED: Progress Dots ──────────────── */
.progress-dots {
  display: flex; gap: 8px; justify-content: center;
}
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid var(--border);
  transition: all 0.2s;
}
.dot.used { background: var(--red); border-color: var(--red); animation: dotPop 0.3s; }
.dot.correct { background: var(--teal); border-color: var(--teal); animation: dotPop 0.3s; }

/* Segmented dots (meaning / impostor) */
.dots-bar {
  display: flex; gap: 6px; justify-content: center;
  width: 100%;
}
.seg-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid var(--border);
  transition: all 0.2s;
}
.seg-dot.dot-correct { background: var(--amber); border-color: var(--amber); }
.seg-dot.dot-wrong   { background: var(--red);   border-color: var(--red); }

/* ── SHARED: Clue Chips (daily) ─────────── */
.clue-chips { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.clue-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  animation: fadeInUp 0.25s ease-out;
}
.chip-top {
  display: flex; justify-content: space-between; align-items: center;
}
.chip-word {
  font-family: var(--font-word);
  font-size: 0.95rem; color: var(--text-2);
}
.chip-translation {
  font-size: 0.75rem; color: var(--text-3); font-style: italic;
}
.chip-guess {
  font-size: 0.75rem; color: var(--red);
  margin-top: 3px; font-weight: 500;
}
.chip-guess.guess-correct { color: var(--teal); }

/* ── SHARED: Feedback ───────────────────── */
.feedback {
  font-size: 0.85rem; font-weight: 500;
  text-align: center; min-height: 1.4rem;
  width: 100%;
}
.feedback.wrong { color: var(--red); animation: shake 0.35s ease; }
.feedback.correct { color: var(--teal); }

/* ── SHARED: End Screen ─────────────────── */
.end-screen {
  text-align: center;
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
  width: 100%;
}
.end-message { font-size: 1.1rem; font-weight: 600; }
.share-grid { font-size: 1.4rem; letter-spacing: 0.12em; }
.end-answer { font-size: 0.9rem; color: var(--text-2); }
.end-answer strong { color: var(--amber); }
.comeback-msg { font-size: 0.78rem; color: var(--text-3); margin-top: 6px; }

/* Home button */
.btn-home {
  font-family: var(--font-ui); font-size: 0.85rem; font-weight: 500;
  padding: 10px 24px; border-radius: 8px;
  background: transparent; color: var(--text-2);
  border: 1px solid var(--border);
  cursor: pointer; transition: all 0.2s;
}
.btn-home:hover { border-color: var(--text-2); color: var(--text-1); }

/* ── SHARED: Share / Play Again ─────────── */
.share-btn {
  font-family: var(--font-ui); font-size: 0.85rem; font-weight: 600;
  padding: 10px 24px; border-radius: 8px;
  border: none; background: var(--amber); color: #000;
  cursor: pointer; transition: all 0.2s var(--ease);
  display: flex; align-items: center; gap: 6px;
}
.share-btn:hover { background: #ffc04d; }
.share-btn .copied-label { display: none; }
.share-btn.copied .share-label { display: none; }
.share-btn.copied .copied-label { display: inline; }

.btn-play-again {
  font-family: var(--font-ui); font-size: 0.85rem; font-weight: 500;
  padding: 10px 24px; border-radius: 8px;
  background: var(--surface-2); color: var(--text-1);
  border: 1px solid var(--border);
  cursor: pointer; transition: all 0.2s;
}
.btn-play-again:hover { border-color: var(--amber); }

/* ── SHARED: Result Overlay ─────────────── */
.result-overlay {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: center;
  z-index: 150;
  transform: translateY(100%);
  transition: transform 0.4s var(--ease);
}
.result-overlay.visible { transform: translateY(0); }
.result-card {
  width: 100%; max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 32px 24px;
  text-align: center;
  display: flex; flex-direction: column;
  align-items: center; gap: 12px;
}
.result-emoji { font-size: 2.4rem; }
.result-title { font-size: 1.15rem; font-weight: 700; color: var(--text-1); }
.result-score { font-size: 0.9rem; color: var(--text-2); }

/* ═══ SPEED MODE ═══════════════════════════ */
.speed-top-bar {
  display: flex; justify-content: space-between; align-items: baseline;
  width: 100%;
}
.speed-timer {
  font-size: 48px; font-weight: 700; color: var(--text-1);
  transition: color 0.3s;
  line-height: 1;
}
.speed-timer.timer-warning { color: var(--red); }
.speed-timer.timer-critical { color: var(--red); animation: pulse 0.5s ease infinite; }
.speed-score { font-size: 0.9rem; color: var(--text-2); }

.speed-progress-bar {
  width: 100%; height: 4px;
  background: var(--border); border-radius: 2px;
  overflow: hidden;
}
.speed-progress-fill {
  height: 100%; width: 100%;
  background: var(--amber);
  transition: width 0.1s linear;
  border-radius: 2px;
}

.speed-card { padding: 40px 24px; }

.speed-answer-label {
  font-size: 0.85rem; font-weight: 600;
  margin-top: 10px; min-height: 1.2rem;
}
.speed-answer-label.correct { color: var(--teal); }
.speed-answer-label.wrong   { color: var(--red); }

.speed-skip-row {
  display: flex; justify-content: flex-end;
  margin-top: 6px;
}
.skip-link {
  background: none; border: none;
  color: var(--text-3); font-family: var(--font-ui);
  font-size: 0.78rem; cursor: pointer;
  transition: color 0.2s;
}
.skip-link:hover { color: var(--text-2); }
.skip-link.disabled { opacity: 0.3; cursor: default; }

/* ═══ STREAK MODE ══════════════════════════ */
.streak-top-bar {
  text-align: center; width: 100%;
}
.streak-counter {
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.streak-flame { font-size: 2.2rem; }
.streak-num {
  font-size: 56px; font-weight: 700; color: var(--amber);
  line-height: 1;
}
.streak-best {
  font-size: 0.78rem; color: var(--text-2); margin-top: 2px;
}
.streak-card { position: relative; }
.streak-fire-label {
  font-size: 0.72rem; color: var(--amber);
  text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 6px; display: none;
}

/* streak visual multipliers */
.streak-glow {
  box-shadow: 0 0 30px rgba(240,165,0,0.1);
}
.streak-glow-hot {
  box-shadow: 0 0 50px rgba(240,165,0,0.2);
}
.streak-gold {
  border-color: var(--amber) !important;
  box-shadow: 0 0 60px rgba(240,165,0,0.25);
}

/* ═══ MEANING MODE ═════════════════════════ */
.meaning-card {
  padding: 32px 24px;
}
.meaning-card .mystery-word { font-size: 2.5rem; }
.meaning-lang-pill {
  display: inline-block;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.72rem;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.meaning-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; width: 100%;
}
.meaning-option {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-family: var(--font-ui); font-size: 0.9rem; font-weight: 500;
  color: var(--text-1);
  cursor: pointer; transition: all 0.15s;
  min-height: 56px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
}
.meaning-option:hover:not(:disabled) {
  background: var(--surface-2);
}
.meaning-option.opt-correct {
  background: var(--teal-dim);
  border-color: var(--teal);
  color: var(--teal);
}
.meaning-option.opt-wrong {
  background: var(--red-dim);
  border-color: var(--red);
  color: var(--red);
}
.meaning-option:disabled {
  cursor: default;
}

/* ═══ IMPOSTOR MODE ════════════════════════ */
.impostor-instruction {
  font-size: 0.85rem; color: var(--text-2);
  text-align: center; width: 100%;
}
.impostor-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; width: 100%;
}
.impostor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer; transition: all 0.15s;
}
.impostor-card:hover {
  border-color: var(--text-3);
}
.imp-word {
  font-family: var(--font-word);
  font-size: 1.8rem; color: var(--text-1);
  margin-bottom: 6px; word-break: break-word;
}
.imp-trans {
  font-size: 0.8rem; color: var(--text-2);
}
.imp-label {
  font-size: 0.7rem; color: var(--text-3);
  margin-top: 8px;
}
.impostor-card.imp-correct {
  background: var(--teal-dim);
  border-color: var(--teal);
}
.impostor-card.imp-wrong {
  background: var(--red-dim);
  border-color: var(--red);
}

/* ═══ CONFETTI ═════════════════════════════ */
.confetti-container {
  position: fixed; inset: 0;
  pointer-events: none; overflow: hidden;
  z-index: 300;
}
.confetti-piece {
  position: absolute; top: -20px;
  animation: confettiFall linear forwards;
}

/* ═══ ADS & CONSENT ════════════════════════ */
.ad-slot {
  width: 100%;
  max-width: 728px;
  margin: 16px auto;
  min-height: 90px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.ad-slot::before {
  content: 'Ad';
  position: absolute;
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}
.ad-slot ins.adsbygoogle[data-ad-status="filled"]::before {
  display: none;
}
.ad-slot--result {
  max-width: 480px;
  margin-bottom: 12px;
}
.ad-slot--game {
  max-width: 480px;
  margin: 12px auto;
}

#consent-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 200;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#consent-banner.visible {
  transform: translateY(0);
}
#consent-banner.hiding {
  transform: translateY(100%);
  transition: transform 0.2s ease-in;
}
.consent-inner {
  max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.consent-text {
  font-family: 'Outfit', sans-serif; font-weight: 400;
  font-size: 14px; color: var(--text-2);
  line-height: 1.4;
}
.consent-link {
  color: var(--text-3); text-decoration: underline;
  margin-left: 6px; transition: color 0.2s;
}
.consent-link:hover { color: var(--text-2); }
.consent-buttons {
  display: flex; gap: 10px; flex-shrink: 0;
}
.consent-btn {
  border-radius: 6px; padding: 8px 16px;
  font-family: 'Outfit', sans-serif; font-size: 14px;
  cursor: pointer; transition: all 0.2s;
}
.btn-decline {
  background: transparent; color: var(--text-2);
  border: 1px solid var(--border); font-weight: 500;
}
.btn-decline:hover { border-color: var(--text-2); color: var(--text-1); }
.btn-accept {
  background: var(--amber); color: #000;
  border: none; font-weight: 700;
}
.btn-accept:hover { background: #ffc04d; transform: translateY(-1px); }

/* ═══ ANIMATIONS ═══════════════════════════ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes flashCorrect {
  0%, 100% { border-color: var(--border); }
  50%      { border-color: var(--teal); }
}
@keyframes flashWrong {
  0%, 100% { border-color: var(--border); }
  50%      { border-color: var(--red); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card-enter { animation: cardEnter 0.25s ease-out; }
@keyframes dotPop {
  0%   { transform: scale(0.5); }
  60%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-5px); }
  40%  { transform: translateX(5px); }
  60%  { transform: translateX(-3px); }
  80%  { transform: translateX(3px); }
}
@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}
.pulse-anim { animation: pulse 0.3s ease; }

/* ═══ RESPONSIVE ═══════════════════════════ */
@media (max-width: 520px) {
  .speed-timer { font-size: 36px; }
  .mystery-word { font-size: 2.4rem; }
  .word-card { padding: 32px 16px; }
  .meaning-card .mystery-word { font-size: 2rem; }
  .imp-word { font-size: 1.4rem; }
  .streak-num { font-size: 42px; }
  .home-wrap { padding: 24px 12px; }
  .meaning-grid, .impostor-grid { gap: 8px; }
  .meaning-option { padding: 10px 8px; font-size: 0.82rem; min-height: 48px; }
  .impostor-card { padding: 16px 10px; }
}
@media (max-width: 480px) {
  .ad-slot { min-height: 60px; }
  .consent-inner { flex-direction: column; align-items: stretch; text-align: center; }
  .consent-buttons { justify-content: center; margin-top: 4px; }
}
