/* ═══════════════════════════════════════════════════════
   EMOJLE — STYLESHEET
═══════════════════════════════════════════════════════ */
:root {
  --bg: #f0f4ff;
  --surface: #ffffff;
  --surface2: #e8edf8;
  --border: #c8d0e8;
  --correct: #0099cc;
  --present: #d4006a;
  --absent: #dde2f0;
  --absent-txt: #8896b0;
  --text: #1a2040;
  --muted: #5566aa;
  --purple: #6d28d9;
  --purple-lt: #7c3aed;
  --danger: #dc2626;
  --warn: #d97706;
  --gacha: #f59e0b;
  --gacha-dark: #d97706;
  --header-bg: #ffffff;
  --key-bg: #dde3f5;
  --key-border: #b8c2dc;
  --shadow-sm: 0 1px 3px rgba(80,90,140,0.10);
  --shadow-md: 0 4px 16px rgba(80,90,140,0.13);
  --shadow-lg: 0 8px 32px rgba(80,90,140,0.18);
  --sticky-ad-height: 120px;
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-image:
    radial-gradient(ellipse at top, #d8e4ff88 0%, transparent 60%),
    radial-gradient(ellipse at bottom, #e8d8ff55 0%, transparent 60%);
}
/* ═══════════════════════════════
   STICKY BANNER AD (120px) — above header
═══════════════════════════════ */
.sticky-ad-banner {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  max-width: 540px;
  height: var(--sticky-ad-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sticky-ad-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  border: 2px dashed var(--border);
  border-radius: 8px;
}
/* ═══════════════════════════════
   HEADER — sticky just below the ad banner
═══════════════════════════════ */
header {
  width: 100%;
  max-width: 540px;
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #d0d8f0;
  position: sticky;
  top: var(--sticky-ad-height);
  background: var(--header-bg);
  z-index: 10;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}
.logo {
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: 6px;
  background: linear-gradient(135deg, #0099cc, #6d28d9, #d4006a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
}
.header-right-btns { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.header-btn {
  border: none;
  border-radius: 22px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  padding: 7px 12px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.header-btn:hover { opacity: 0.88; }
.btn-how {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  box-shadow: 0 3px 10px #f59e0b55;
  animation: btnPulse 2.5s infinite;
}
/* Remove or comment out the old .btn-share rule */
/* .btn-share {
  background: linear-gradient(135deg, #6d28d9, #0099cc);
  color: #fff;
  box-shadow: 0 3px 10px #6d28d933;
} */

/* New TodayGG back button — styled like the EMOJLE logo */
.btn-todaygg {
  background: linear-gradient(135deg, #0099cc, #6d28d9, #d4006a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 3px;
  border: 2px solid transparent;
  background-origin: border-box;
  background-clip: text;
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 22px;
  position: relative;
  white-space: nowrap;
  cursor: pointer;
  display: flex;
  align-items: center;
  font-family: 'Space Grotesk', sans-serif;
  transition: opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}

/* Border achieved via box-shadow so gradient text still works */
.btn-todaygg::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 22px;
  padding: 2px;
  background: linear-gradient(135deg, #0099cc, #6d28d9, #d4006a);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.btn-todaygg:hover { opacity: 0.8; }
.btn-sound {
  background: var(--surface2);
  color: var(--text);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-size: 1rem;
  padding: 6px 10px;
}
.btn-sound:hover { background: var(--border); }
/* ═══════════════════════════════
   COLORBLIND BUTTON
═══════════════════════════════ */
.btn-colorblind {
  background: var(--surface2);
  color: var(--text);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-size: 1rem;
  padding: 6px 10px;
}
.btn-colorblind:hover { background: var(--border); }
body.colorblind-mode .btn-todaygg {
  background: none;
  -webkit-text-fill-color: #ffffff;
  color: #ffffff;
  border: 3px solid #000000;
  background-color: #000000;
  box-shadow: 0 3px 0 #555555;
  letter-spacing: 3px;
}

body.colorblind-mode .btn-todaygg::before {
  display: none;
}
/* ═══════════════════════════════
   TOAST
═══════════════════════════════ */
.toast {
  position: fixed;
  top: calc(var(--sticky-ad-height) + 58px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: #1a2040;
  color: #fff;
  padding: 10px 22px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.95rem;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* ═══════════════════════════════
   MAIN
═══════════════════════════════ */
main {
  width: 100%;
  max-width: 540px;
  padding: 10px 14px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
/* ═══════════════════════════════
   DECODER SCREEN
═══════════════════════════════ */
.decoder-screen {
  width: 100%;
  background: var(--surface);
  border: 2px solid #c0cce8;
  border-radius: 16px;
  padding: 14px 20px;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.decoder-screen::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0099cc, #6d28d9, #d4006a);
  border-radius: 16px 16px 0 0;
}
.screen-label {
  font-size: 0.72rem;
  color: var(--purple-lt);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 6px;
  font-weight: 700;
}
.emoji-clue { font-size: 3.5rem; letter-spacing: 8px; margin-bottom: 6px; }
.screen-hint { font-size: 0.85rem; color: var(--muted); letter-spacing: 1px; font-weight: 600; }
/* ═══════════════════════════════
   BOARD
═══════════════════════════════ */
.board { width: 100%; display: flex; flex-direction: column; gap: 7px; }
.decode-row { display: flex; gap: 5px; justify-content: center; align-items: center; }
/* ═══════════════════════════════
   TILES
═══════════════════════════════ */
.decode-tile {
  width: 52px; height: 52px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem; font-weight: 900;
  text-transform: uppercase;
  color: var(--text);
  transition: border-color 0.1s, background 0.1s;
  user-select: none;
  box-shadow: var(--shadow-sm);
}
.decode-tile.filled { border-color: var(--purple-lt); background: #f0eaff; animation: tpop 0.1s ease; }
.decode-tile.correct { background: var(--correct); border-color: var(--correct); color: #fff; box-shadow: 0 2px 10px #0099cc44; }
.decode-tile.present { background: var(--present); border-color: var(--present); color: #fff; box-shadow: 0 2px 10px #d4006a44; }
.decode-tile.absent { background: var(--absent); border-color: #c0c8dc; color: var(--absent-txt); }
.decode-tile.invalid { border-color: var(--danger) !important; background: #fee2e2 !important; color: var(--danger) !important; }
.decode-tile.reveal { animation: treveal 0.45s ease forwards; }
/* ═══════════════════════════════
   HINT ROW
═══════════════════════════════ */
.hint-row { gap: 5px; }
.hint-tile {
  border-color: transparent;
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}
.hint-tile.correct {
  border-style: solid;
  background: var(--correct);
  border-color: var(--correct);
  color: #fff;
  box-shadow: 0 2px 14px #0099cc55;
}
.hint-tile.sweeping {
  border-style: solid;
  border-color: var(--gacha);
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  color: var(--gacha-dark);
  box-shadow: 0 0 18px #f59e0b88, 0 0 36px #f59e0b44;
  animation: sweepPulse 0.15s ease infinite;
}
.hint-row.sweeping-glow { filter: drop-shadow(0 0 12px #f59e0b88); }
/* ═══════════════════════════════
   GUESS ROW
═══════════════════════════════ */
.guess-row { gap: 5px; }
.guess-row.needs-clear { animation: needsClear 1.2s ease infinite; }
.guess-row.game-ended { animation: none !important; filter: none !important; }
/* ═══════════════════════════════
   GACHA ZONE
═══════════════════════════════ */
.gacha-zone {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 6px 0 2px;
}
.gacha-btn-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}
/* Pre-start */
.pre-start-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
/* Active: timer | clr | guess */
.active-game-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}
/* Game over */
.gameover-btn-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  min-height: 64px;
}
.inline-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 8px 18px;
  box-shadow: var(--shadow-sm);
  min-width: 130px;
}
.inline-countdown-label {
  font-size: 0.62rem; font-weight: 700; color: var(--muted);
  letter-spacing: 2px; text-transform: uppercase; margin-bottom: 3px;
}
.inline-countdown-timer {
  font-size: 1.55rem; font-weight: 900; color: var(--purple-lt);
  letter-spacing: 3px; font-variant-numeric: tabular-nums;
}
.gameover-share-btn {
  background: linear-gradient(135deg, #6d28d9, #d4006a);
  color: #fff; border: none; border-radius: 50px;
  padding: 14px 28px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem; font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #4c1d95, var(--shadow-md);
  transition: opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  letter-spacing: 1px;
  animation: gameoverSharePulse 2s ease infinite;
}
.gameover-share-btn:hover { opacity: 0.9; }
/* ═══════════════════════════════
   START BUTTON
═══════════════════════════════ */
.gacha-btn {
  background: linear-gradient(135deg, #f59e0b, #ef4444, #f59e0b);
  background-size: 200% 200%;
  color: #fff; border: none; border-radius: 50px;
  padding: 13px 26px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem; font-weight: 900;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  min-width: 160px; min-height: 50px;
  box-shadow: 0 6px 0 #b45309, 0 8px 24px #f59e0b66, 0 0 40px #f59e0b33;
  transition: opacity 0.2s;
  letter-spacing: 1px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  animation: spinBtnGlow 2s ease infinite;
  font-variant-numeric: tabular-nums;
}
.gacha-btn:hover:not(:disabled) { opacity: 0.92; }
.gacha-btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; animation: none; }
.gacha-btn.start-game-btn {
  background: linear-gradient(135deg, #16a34a, #22c55e, #16a34a) !important;
  background-size: 200% 200% !important;
  box-shadow: 0 6px 0 #15803d, 0 8px 24px #22c55e66, 0 0 40px #22c55e33 !important;
  animation: startBtnGlow 2s ease infinite !important;
  color: #fff !important; border: none !important;
}
/* ═══════════════════════════════
   HINT TIMER DISPLAY
═══════════════════════════════ */
.hint-timer-display {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  border-radius: 50px;
  padding: 7px 14px;
  min-width: 195px;
  min-height: 54px;
  border: 2px solid #22c55e;
  background: #f0fdf4;
  box-shadow: 0 3px 0 #15803d88, 0 0 16px #22c55e33;
  transition: border-color 0.5s, background 0.5s, box-shadow 0.5s;
  flex-shrink: 0;
  gap: 0;
}
.hint-timer-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-right: 12px;
  border-right: 2px solid rgba(0,0,0,0.12);
  margin-right: 12px;
  min-width: 52px;
}
.hint-counter-label {
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #16a34a;
  transition: color 0.5s;
  line-height: 1;
  margin-bottom: 1px;
}
.hint-counter-value {
  font-size: 1.6rem;
  font-weight: 900;
  color: #16a34a;
  transition: color 0.5s;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hint-counter-of {
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #16a34a;
  transition: color 0.5s;
  line-height: 1;
  margin-top: 1px;
}
.hint-timer-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.hint-timer-label {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #16a34a;
  margin-bottom: 2px;
  transition: color 0.5s;
  white-space: nowrap;
}
.hint-timer-value {
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  color: #16a34a;
  transition: color 0.5s;
}
/* Timer color states */
.hint-timer-display.timer-green {
  border-color: #22c55e; background: #f0fdf4;
  box-shadow: 0 3px 0 #15803d88, 0 0 16px #22c55e33;
  animation: timerPulseGreen 1.2s ease infinite;
}
.hint-timer-display.timer-green .hint-timer-label,
.hint-timer-display.timer-green .hint-timer-value,
.hint-timer-display.timer-green .hint-counter-label,
.hint-timer-display.timer-green .hint-counter-value,
.hint-timer-display.timer-green .hint-counter-of { color: #16a34a; }
.hint-timer-display.timer-green .hint-timer-left { border-right-color: rgba(22,163,74,0.25); }
.hint-timer-display.timer-yellow {
  border-color: #eab308; background: #fefce8;
  box-shadow: 0 3px 0 #a16207aa, 0 0 16px #eab30833;
  animation: timerPulseYellow 1.2s ease infinite;
}
.hint-timer-display.timer-yellow .hint-timer-label,
.hint-timer-display.timer-yellow .hint-timer-value,
.hint-timer-display.timer-yellow .hint-counter-label,
.hint-timer-display.timer-yellow .hint-counter-value,
.hint-timer-display.timer-yellow .hint-counter-of { color: #a16207; }
.hint-timer-display.timer-yellow .hint-timer-left { border-right-color: rgba(161,98,7,0.25); }
.hint-timer-display.timer-orange {
  border-color: #f97316; background: #fff7ed;
  box-shadow: 0 3px 0 #c2410caa, 0 0 20px #f9731655;
  animation: timerPulseOrange 1.0s ease infinite;
}
.hint-timer-display.timer-orange .hint-timer-label,
.hint-timer-display.timer-orange .hint-timer-value,
.hint-timer-display.timer-orange .hint-counter-label,
.hint-timer-display.timer-orange .hint-counter-value,
.hint-timer-display.timer-orange .hint-counter-of { color: #c2410c; }
.hint-timer-display.timer-orange .hint-timer-left { border-right-color: rgba(194,65,12,0.25); }
.hint-timer-display.timer-red {
  border-color: #ef4444; background: #fef2f2;
  box-shadow: 0 3px 0 #991b1baa, 0 0 16px #ef444433;
  animation: timerPulseRed 0.8s ease infinite;
}
.hint-timer-display.timer-red .hint-timer-label,
.hint-timer-display.timer-red .hint-timer-value,
.hint-timer-display.timer-red .hint-counter-label,
.hint-timer-display.timer-red .hint-counter-value,
.hint-timer-display.timer-red .hint-counter-of { color: #dc2626; }
.hint-timer-display.timer-red .hint-timer-left { border-right-color: rgba(220,38,38,0.25); }
/* ═══════════════════════════════
   CLEAR BUTTON
═══════════════════════════════ */
.clear-btn {
  height: 50px;
  min-width: 60px;
  padding: 0 14px;
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  border: 2px solid #06b6d4;
  border-radius: 50px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 900;
  color: #fff;
  cursor: pointer;
  letter-spacing: 2px;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: box-shadow 0.15s, background 0.15s, border-color 0.15s;
  box-shadow: 0 4px 0 #0e7490, 0 0 16px #06b6d444;
  flex-shrink: 0;
  animation: clearBtnGlow 2.5s ease infinite;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.clear-btn.clear-btn-alert {
  background: linear-gradient(135deg, #f59e0b, #ea580c) !important;
  border-color: #fbbf24 !important;
  box-shadow: 0 4px 0 #92400e, 0 0 32px #f59e0bcc !important;
  animation: clearBtnAlertOrange 0.5s ease infinite !important;
  color: #fff !important;
}
/* ═══════════════════════════════
   KEY PRESSED STATE
   Applied briefly via JS on pointerdown for ALL keys
═══════════════════════════════ */
.qwerty-key-wide.key-pressed {
  background: #b0bad4 !important;
  border-color: #8898bc !important;
  box-shadow: 0 1px 0 #8090b0 !important;
  transform: translateY(1px) !important;
  transition: none !important;
}
/* Letter key pressed state — uses the correct (cyan) color family */
.qwerty-key-letter.key-pressed {
  background: linear-gradient(135deg, #0099cc, #0077aa) !important;
  border-color: #006699 !important;
  box-shadow: 0 1px 0 #005577, 0 0 12px #0099cc88 !important;
  color: #fff !important;
  transform: translateY(1px) !important;
  transition: none !important;
}
/* ═══════════════════════════════
   GUESS BUTTON
═══════════════════════════════ */
.decode-submit-btn {
  background: linear-gradient(135deg, #6d28d9, #0099cc);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 13px 16px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem; font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #4c1d95, var(--shadow-md);
  transition: opacity 0.2s, background 0.4s;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
  letter-spacing: 1px;
  min-height: 50px;
  min-width: 118px;
  max-width: 142px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}
.decode-submit-btn:hover:not(:disabled) { opacity: 0.9; }
.decode-submit-btn:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
.decode-submit-btn.loading { background: #c4b0f0; color: #6d28d9; cursor: not-allowed; animation: kpulse 0.9s infinite; box-shadow: none; }
.decode-submit-btn.guess-warn { background: linear-gradient(135deg, #d97706, #f59e0b); box-shadow: 0 4px 0 #92400e, 0 0 20px #f59e0b55; animation: warnPulse 1.5s ease infinite; }
.decode-submit-btn.guess-danger { background: linear-gradient(135deg, #dc2626, #ef4444); box-shadow: 0 4px 0 #991b1b, 0 0 20px #ef444455; animation: dangerPulse 1s ease infinite; }
/* ═══════════════════════════════
   QWERTY KEYBOARD
═══════════════════════════════ */
.qwerty-keyboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
  margin-top: 6px;
}
.qwerty-row {
  display: flex;
  gap: 5px;
  justify-content: center;
  width: 100%;
}
.qwerty-key {
  height: 52px;
  min-width: 30px;
  flex: 1;
  max-width: 44px;
  border-radius: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem; font-weight: 900;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  text-transform: uppercase;
  padding: 0;
  outline: none;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, transform 0.08s;
  border: 2px solid transparent;
  -webkit-appearance: none;
  appearance: none;
}
/* ENTER and ⌫ — neutral grey */
.qwerty-key-wide {
  min-width: 54px;
  max-width: 66px;
  flex: 1.5;
  font-size: 0.7rem;
  background: var(--surface2);
  border-color: var(--border);
  color: var(--muted);
  box-shadow: 0 3px 0 #b0bad4, var(--shadow-sm);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.08s;
}
/* ALL letter keys — always the same blue */
.qwerty-key-letter {
  background: linear-gradient(135deg, #e0f4ff, #c8ecff);
  border-color: var(--correct);
  border-style: solid;
  color: var(--text);
  box-shadow: 0 3px 0 #0077aa, 0 0 12px #0099cc55;
  animation: keyGlow 2.5s ease infinite;
}
.qwerty-key-letter:hover {
  background: linear-gradient(135deg, #bfedff, #a0e0ff);
  box-shadow: 0 3px 0 #0077aa, 0 0 20px #0099cc77;
}
/* ═══════════════════════════════
   HOW TO PLAY
═══════════════════════════════ */
.htp-section-page {
  width: 100%; max-width: 540px;
  padding: 24px 20px 40px;
  display: flex; flex-direction: column; align-items: center;
}
.htp-page-title {
  font-size: 2rem; font-weight: 900; text-align: center; margin-bottom: 4px;
  background: linear-gradient(135deg, #f59e0b, #ef4444, #6d28d9);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.htp-page-subtitle { text-align: center; color: var(--muted); font-size: 0.85rem; margin-bottom: 20px; letter-spacing: 2px; font-weight: 600; text-transform: uppercase; }
.htp-block { width: 100%; background: var(--surface); border: 1.5px solid var(--border); border-radius: 16px; padding: 18px 20px; margin-bottom: 12px; box-shadow: var(--shadow-sm); text-align: center; position: relative; }
.htp-block::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, #0099cc, #6d28d9, #d4006a); border-radius: 16px 16px 0 0; }
.htp-block-title { font-size: 0.82rem; font-weight: 700; color: var(--purple-lt); letter-spacing: 2px; text-transform: uppercase; margin-bottom: 10px; }
.htp-body-text { font-size: 1rem; color: var(--text); line-height: 1.65; text-align: center; max-width: 420px; margin: 0 auto; }
.htp-clue-box { background: #f5f7ff; border: 1.5px solid var(--border); border-radius: 12px; padding: 14px; text-align: center; margin: 12px auto 0; max-width: 280px; }
.htp-clue-box-label { font-size: 0.68rem; color: var(--purple-lt); letter-spacing: 3px; font-weight: 700; text-transform: uppercase; margin-bottom: 8px; }
.htp-clue-box-emojis { font-size: 2.2rem; letter-spacing: 6px; margin-bottom: 6px; }
.htp-clue-box-answer { font-size: 0.9rem; color: var(--muted); font-weight: 600; }
.htp-colour-legend { display: flex; flex-direction: column; gap: 10px; margin: 12px auto 0; max-width: 340px; width: 100%; }
.htp-colour-row { display: flex; align-items: center; gap: 14px; font-size: 0.98rem; color: var(--text); font-weight: 500; text-align: left; }
.htp-colour-tile { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 900; flex-shrink: 0; border: 2px solid transparent; }
.htp-colour-tile.correct { background: var(--correct); border-color: var(--correct); color: #fff; }
.htp-colour-tile.present { background: var(--present); border-color: var(--present); color: #fff; }
.htp-colour-tile.absent { background: var(--absent); border-color: #c0c8dc; color: var(--absent-txt); }
.htp-tips { display: flex; flex-direction: column; gap: 10px; margin: 4px auto 0; max-width: 420px; width: 100%; }
.htp-tip { display: flex; align-items: flex-start; gap: 12px; font-size: 0.98rem; color: var(--text); line-height: 1.6; text-align: left; }
.htp-tip-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 1px; }
/* ═══════════════════════════════
   FOOTER
═══════════════════════════════ */
.site-footer { width: 100%; max-width: 540px; border-top: 2px solid var(--border); padding: 24px 20px 36px; display: flex; flex-direction: column; align-items: center; gap: 16px; background: var(--surface); }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; }
.footer-link { background: none; border: none; color: var(--purple-lt); font-family: 'Space Grotesk', sans-serif; font-size: 0.9rem; font-weight: 700; cursor: pointer; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; transition: opacity 0.15s; -webkit-tap-highlight-color: transparent; }
.footer-link:hover { opacity: 0.8; }
.footer-contact { font-size: 0.88rem; color: var(--muted); font-weight: 600; text-align: center; line-height: 1.6; }
.footer-contact a { color: var(--purple-lt); text-decoration: none; font-weight: 700; }
.footer-contact a:hover { text-decoration: underline; }
.footer-copy { font-size: 0.78rem; color: var(--absent-txt); font-weight: 600; letter-spacing: 1px; text-align: center; }
/* ═══════════════════════════════
   MODALS
═══════════════════════════════ */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(100,110,160,0.45); z-index: 100; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(8px); }
.modal-overlay.show { display: flex; }
.modal-close { position: absolute; top: 14px; right: 16px; background: var(--surface2); border: 1.5px solid var(--border); border-radius: 50%; width: 34px; height: 34px; color: var(--muted); font-size: 1rem; cursor: pointer; transition: color 0.15s, background 0.15s; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.modal-close:hover { color: var(--text); background: var(--border); }
.modal { background: var(--surface); border: 1.5px solid #c8d0ee; border-radius: 20px; padding: 28px 24px; max-width: 390px; width: 100%; text-align: center; box-shadow: var(--shadow-lg); position: relative; max-height: 90vh; overflow-y: auto; }
.modal::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, #0099cc, #6d28d9, #d4006a); border-radius: 20px 20px 0 0; }
.modal.footer-modal-body-wrap { text-align: left; }
.modal.footer-modal-body-wrap p, .modal.footer-modal-body-wrap ul { font-size: 0.95rem; color: var(--text); line-height: 1.7; margin-bottom: 12px; }
.modal.footer-modal-body-wrap ul { padding-left: 20px; }
.modal.footer-modal-body-wrap a { color: var(--purple-lt); font-weight: 700; }
.footer-modal-title { font-size: 1.4rem; font-weight: 900; margin-bottom: 18px; color: var(--text); text-align: center; }
.modal-icon { font-size: 3.4rem; margin-bottom: 10px; }
.modal-title { font-size: 1.9rem; font-weight: 900; margin-bottom: 8px; background: linear-gradient(135deg, #0099cc, #d4006a); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.modal-sub { color: var(--muted); margin-bottom: 16px; font-size: 1rem; font-weight: 600; }
.answer-box { background: linear-gradient(135deg, #e0f4ff, #ede0ff); border: 2px solid var(--correct); border-radius: 12px; padding: 12px; font-size: 1.6rem; font-weight: 900; letter-spacing: 6px; margin-bottom: 16px; color: var(--text); animation: glow 2s infinite; }
.share-box { background: #f5f7ff; border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 16px; font-family: monospace; font-size: 0.88rem; white-space: pre; line-height: 1.7; color: var(--text); margin-bottom: 12px; text-align: left; overflow-x: auto; }
.share-btn { width: 100%; background: linear-gradient(135deg, #6d28d9, #d4006a); color: #fff; border: none; padding: 14px; border-radius: 10px; font-size: 1.05rem; font-weight: 700; cursor: pointer; margin-bottom: 14px; font-family: 'Space Grotesk', sans-serif; transition: opacity 0.2s; box-shadow: 0 4px 14px #6d28d933; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.share-btn:hover { opacity: 0.88; }
.modal-countdown-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 2px; margin-bottom: 6px; font-weight: 700; }
.modal-countdown { font-size: 1.8rem; font-weight: 900; color: var(--purple-lt); letter-spacing: 4px; }
/* ═══════════════════════════════
   ANIMATIONS
═══════════════════════════════ */
@keyframes btnPulse {
  0%,100% { box-shadow: 0 3px 10px #f59e0b55; }
  50% { box-shadow: 0 3px 20px #f59e0b99, 0 0 30px #ef444433; }
}
@keyframes startBtnGlow {
  0%,100% { box-shadow: 0 6px 0 #15803d, 0 8px 24px #22c55e66, 0 0 40px #22c55e33; }
  50% { box-shadow: 0 6px 0 #15803d, 0 8px 36px #22c55e99, 0 0 60px #22c55e55; }
}
@keyframes spinBtnGlow {
  0%,100% { box-shadow: 0 6px 0 #b45309, 0 8px 24px #f59e0b66, 0 0 40px #f59e0b33; }
  50% { box-shadow: 0 6px 0 #b45309, 0 8px 36px #f59e0b99, 0 0 60px #f59e0b55; }
}
@keyframes keyGlow {
  0%,100% { box-shadow: 0 3px 0 #0077aa, 0 0 8px #0099cc44; }
  50% { box-shadow: 0 3px 0 #0077aa, 0 0 18px #0099cc88; }
}
@keyframes clearBtnGlow {
  0%,100% { box-shadow: 0 4px 0 #0e7490, 0 0 12px #06b6d433; }
  50% { box-shadow: 0 4px 0 #0e7490, 0 0 26px #06b6d477; }
}
@keyframes clearBtnAlertOrange {
  0%,100% {
    box-shadow: 0 4px 0 #92400e, 0 0 20px #f59e0baa, 0 0 40px #f59e0b55;
    background: linear-gradient(135deg, #f59e0b, #ea580c);
    border-color: #fbbf24;
  }
  50% {
    box-shadow: 0 4px 0 #78350f, 0 0 40px #fbbf24dd, 0 0 70px #f59e0b88;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-color: #fde68a;
  }
}
@keyframes sweepPulse {
  0%,100% { box-shadow: 0 0 18px #f59e0b88, 0 0 36px #f59e0b44; }
  50% { box-shadow: 0 0 28px #f59e0bcc, 0 0 52px #f59e0b66; }
}
@keyframes needsClear {
  0%,100% { filter: drop-shadow(0 0 4px transparent); }
  50% { filter: drop-shadow(0 0 10px #dc262666); }
}
@keyframes gameoverSharePulse {
  0%,100% { box-shadow: 0 4px 0 #4c1d95, 0 0 20px #6d28d944; }
  50% { box-shadow: 0 4px 0 #4c1d95, 0 0 36px #d4006a66; }
}
@keyframes warnPulse {
  0%,100% { box-shadow: 0 4px 0 #92400e, 0 0 14px #f59e0b44; }
  50% { box-shadow: 0 4px 0 #92400e, 0 0 28px #f59e0b88; }
}
@keyframes dangerPulse {
  0%,100% { box-shadow: 0 4px 0 #991b1b, 0 0 14px #ef444433; }
  50% { box-shadow: 0 4px 0 #991b1b, 0 0 28px #ef444477; }
}
@keyframes timerPulseGreen {
  0%,100% { box-shadow: 0 3px 0 #15803d88, 0 0 10px #22c55e33; }
  50% { box-shadow: 0 3px 0 #15803d88, 0 0 24px #22c55e77; }
}
@keyframes timerPulseYellow {
  0%,100% { box-shadow: 0 3px 0 #a16207aa, 0 0 10px #eab30833; }
  50% { box-shadow: 0 3px 0 #a16207aa, 0 0 24px #eab30877; }
}
@keyframes timerPulseOrange {
  0%,100% { box-shadow: 0 3px 0 #c2410caa, 0 0 14px #f9731655; }
  50% { box-shadow: 0 3px 0 #c2410caa, 0 0 32px #f97316bb; }
}
@keyframes timerPulseRed {
  0%,100% { box-shadow: 0 3px 0 #991b1baa, 0 0 10px #ef444433; }
  50% { box-shadow: 0 3px 0 #991b1baa, 0 0 28px #ef444488; }
}
@keyframes tpop {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
@keyframes treveal {
  0% { transform: rotateX(0deg); }
  45% { transform: rotateX(-90deg); }
  55% { transform: rotateX(-90deg); }
  100% { transform: rotateX(0deg); }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-7px); }
  40%,80% { transform: translateX(7px); }
}
@keyframes glow {
  0%,100% { box-shadow: 0 0 10px #0099cc22; }
  50% { box-shadow: 0 0 22px #0099cc55; }
}
@keyframes kpulse {
  0%,100% { opacity: 0.7; }
  50% { opacity: 1; }
}
.shake { animation: shake 0.4s ease; }
/* ═══════════════════════════════
   RESPONSIVE
═══════════════════════════════ */
@media (max-width: 400px) {
  :root { --sticky-ad-height: 100px; }
  .decode-tile { width: 44px; height: 46px; font-size: 1.15rem; }
  .emoji-clue { font-size: 3rem; letter-spacing: 5px; }
  .logo { font-size: 1.4rem; letter-spacing: 4px; }
  .btn-how, .btn-share { font-size: 0.68rem; padding: 6px 9px; }
  .btn-sound { font-size: 0.85rem; padding: 5px 8px; }
  .btn-colorblind { font-size: 0.85rem; padding: 5px 8px; }
  .gacha-btn { padding: 11px 18px; font-size: 0.9rem; min-width: 130px; }
  .decode-submit-btn { padding: 11px 10px; font-size: 0.85rem; min-width: 98px; }
  .clear-btn { min-width: 50px; font-size: 0.75rem; padding: 0 10px; height: 44px; }
  .hint-timer-display { min-width: 160px; padding: 5px 10px; }
  .hint-timer-value { font-size: 1.25rem; }
  .hint-timer-label { font-size: 0.48rem; }
  .hint-counter-value { font-size: 1.3rem; }
  .hint-counter-label, .hint-counter-of { font-size: 0.45rem; }
  .qwerty-key { height: 44px; font-size: 0.82rem; min-width: 26px; }
  .qwerty-key-wide { min-width: 44px; font-size: 0.62rem; }
  .gameover-share-btn { padding: 12px 20px; font-size: 1rem; }
  .inline-countdown-timer { font-size: 1.25rem; }
}
@media (max-height: 700px) {
  :root { --sticky-ad-height: 80px; }
  main { gap: 6px; padding-top: 6px; }
  .decode-tile { height: 46px; }
  .decoder-screen { padding: 10px 14px; }
  .emoji-clue { font-size: 3rem; margin-bottom: 4px; }
}

/* ═══════════════════════════════════════════════════════
   COLORBLIND MODE
   Activated by: body.colorblind-mode
   Design principles:
     - Black/white/yellow/blue palette (deuteranopia/protanopia/tritanopia safe)
     - All interactive elements get thick black borders + text labels
     - No reliance on red/green distinction anywhere
     - High contrast text: minimum 7:1 ratio
     - Patterns/shapes/underlines supplement color cues
═══════════════════════════════════════════════════════ */

/* === GLOBAL BODY OVERRIDES === */
body.colorblind-mode {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface2: #f0f0f0;
  --border: #000000;
  --correct: #0055cc;
  --present: #cc6600;
  --absent: #e0e0e0;
  --absent-txt: #333333;
  --text: #000000;
  --muted: #333333;
  --purple: #333399;
  --purple-lt: #333399;
  --danger: #000000;
  --warn: #cc6600;
  --gacha: #cc6600;
  --gacha-dark: #994400;
  --header-bg: #ffffff;
  --key-bg: #f0f0f0;
  --key-border: #000000;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.30);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.30);
  background: #ffffff;
  background-image: none;
  color: #000000;
}

/* === STICKY AD BANNER === */
body.colorblind-mode .sticky-ad-banner {
  background: #ffffff;
  border-bottom: 3px solid #000000;
}
body.colorblind-mode .sticky-ad-placeholder {
  color: #000000;
  border: 3px solid #000000;
  background: #f0f0f0;
}

/* === HEADER === */
body.colorblind-mode header {
  background: #ffffff;
  border-bottom: 3px solid #000000;
  box-shadow: 0 2px 0 #000000;
}
body.colorblind-mode .logo {
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: #000000;
  background-clip: unset;
  color: #000000;
  letter-spacing: 6px;
  text-shadow: none;
}

/* === HEADER BUTTONS === */
body.colorblind-mode .btn-how {
  background: #000000;
  color: #ffffff;
  border: 3px solid #000000;
  box-shadow: 0 3px 0 #555555;
  animation: none;
}
body.colorblind-mode .btn-share {
  background: #000000;
  color: #ffffff;
  border: 3px solid #000000;
  box-shadow: 0 3px 0 #555555;
}
body.colorblind-mode .btn-sound {
  background: #f0f0f0;
  color: #000000;
  border: 3px solid #000000;
  box-shadow: 0 2px 0 #555555;
}
body.colorblind-mode .btn-sound:hover {
  background: #cccccc;
}

/* === TOAST === */
body.colorblind-mode .toast {
  background: #000000;
  color: #ffffff;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

/* === DECODER SCREEN === */
body.colorblind-mode .decoder-screen {
  background: #ffffff;
  border: 3px solid #000000;
  box-shadow: 0 4px 0 #000000;
}
body.colorblind-mode .decoder-screen::before {
  background: #000000;
  height: 6px;
}
body.colorblind-mode .screen-label {
  color: #000000;
  font-weight: 900;
}
body.colorblind-mode .screen-hint {
  color: #333333;
  font-weight: 700;
}

/* === TILES: BASE === */
body.colorblind-mode .decode-tile {
  background: #ffffff;
  border: 3px solid #000000;
  color: #000000;
  box-shadow: 0 2px 0 #000000;
}
body.colorblind-mode .decode-tile.filled {
  border-color: #000000;
  background: #ffffcc;
  color: #000000;
  animation: tpop 0.1s ease;
}

/* === CORRECT TILE: blue background, white text, underline pattern === */
body.colorblind-mode .decode-tile.correct {
  background: #0055cc;
  border-color: #000000;
  color: #ffffff;
  box-shadow: 0 3px 0 #000000;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* === PRESENT TILE: orange/amber, black text, bold border === */
body.colorblind-mode .decode-tile.present {
  background: #ff9900;
  border-color: #000000;
  color: #000000;
  box-shadow: 0 3px 0 #000000;
  font-style: italic;
}

/* === ABSENT TILE: light grey, dark text === */
body.colorblind-mode .decode-tile.absent {
  background: #cccccc;
  border-color: #666666;
  color: #333333;
}

/* === INVALID TILE: black border, yellow bg, black text === */
body.colorblind-mode .decode-tile.invalid {
  border-color: #000000 !important;
  background: #ffffcc !important;
  color: #000000 !important;
}

/* === HINT ROW TILES === */
body.colorblind-mode .hint-tile {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
body.colorblind-mode .hint-tile.correct {
  background: #0055cc;
  border-color: #000000;
  border-style: solid;
  color: #ffffff;
  box-shadow: 0 3px 0 #000000;
  text-decoration: underline;
  text-underline-offset: 3px;
}
body.colorblind-mode .hint-tile.sweeping {
  border-style: solid;
  border-color: #000000;
  background: #ffffcc;
  color: #000000;
  box-shadow: 0 0 10px #ccaa0088;
  animation: cbSweepPulse 0.15s ease infinite;
}
body.colorblind-mode .hint-row.sweeping-glow {
  filter: drop-shadow(0 0 8px #ccaa0088);
}

/* === GUESS ROW === */
body.colorblind-mode .guess-row.needs-clear {
  animation: cbNeedsClear 1.2s ease infinite;
}

/* === GACHA / START BUTTON === */
body.colorblind-mode .gacha-btn {
  background: #000000;
  color: #ffffff;
  border: 3px solid #000000;
  box-shadow: 0 6px 0 #444444;
  animation: none;
}
body.colorblind-mode .gacha-btn:hover:not(:disabled) {
  background: #333333;
  opacity: 1;
}
body.colorblind-mode .gacha-btn:disabled {
  background: #999999;
  color: #ffffff;
  border-color: #666666;
  box-shadow: none;
  opacity: 0.6;
}
body.colorblind-mode .gacha-btn.start-game-btn {
  background: #000000 !important;
  color: #ffffff !important;
  border: 3px solid #000000 !important;
  box-shadow: 0 6px 0 #444444 !important;
  animation: none !important;
}
body.colorblind-mode .gacha-btn.start-game-btn:hover:not(:disabled) {
  background: #333333 !important;
}

/* === HINT TIMER DISPLAY === */
body.colorblind-mode .hint-timer-display {
  background: #f0f0f0;
  border: 3px solid #000000;
  box-shadow: 0 3px 0 #000000;
  animation: none;
}
body.colorblind-mode .hint-timer-display.timer-green {
  background: #e8ffe8;
  border-color: #000000;
  box-shadow: 0 3px 0 #000000;
  animation: none;
}
body.colorblind-mode .hint-timer-display.timer-green .hint-timer-label,
body.colorblind-mode .hint-timer-display.timer-green .hint-timer-value,
body.colorblind-mode .hint-timer-display.timer-green .hint-counter-label,
body.colorblind-mode .hint-timer-display.timer-green .hint-counter-value,
body.colorblind-mode .hint-timer-display.timer-green .hint-counter-of {
  color: #000000;
}
body.colorblind-mode .hint-timer-display.timer-green .hint-timer-left {
  border-right-color: #000000;
}
body.colorblind-mode .hint-timer-display.timer-yellow {
  background: #ffffcc;
  border-color: #000000;
  box-shadow: 0 3px 0 #000000;
  animation: none;
}
body.colorblind-mode .hint-timer-display.timer-yellow .hint-timer-label,
body.colorblind-mode .hint-timer-display.timer-yellow .hint-timer-value,
body.colorblind-mode .hint-timer-display.timer-yellow .hint-counter-label,
body.colorblind-mode .hint-timer-display.timer-yellow .hint-counter-value,
body.colorblind-mode .hint-timer-display.timer-yellow .hint-counter-of {
  color: #000000;
}
body.colorblind-mode .hint-timer-display.timer-yellow .hint-timer-left {
  border-right-color: #000000;
}
body.colorblind-mode .hint-timer-display.timer-orange {
  background: #ffe8cc;
  border-color: #000000;
  box-shadow: 0 3px 0 #000000;
  animation: cbTimerPulse 1.0s ease infinite;
}
body.colorblind-mode .hint-timer-display.timer-orange .hint-timer-label,
body.colorblind-mode .hint-timer-display.timer-orange .hint-timer-value,
body.colorblind-mode .hint-timer-display.timer-orange .hint-counter-label,
body.colorblind-mode .hint-timer-display.timer-orange .hint-counter-value,
body.colorblind-mode .hint-timer-display.timer-orange .hint-counter-of {
  color: #000000;
  font-weight: 900;
}
body.colorblind-mode .hint-timer-display.timer-orange .hint-timer-left {
  border-right-color: #000000;
}
body.colorblind-mode .hint-timer-display.timer-red {
  background: #ffffcc;
  border-color: #000000;
  border-width: 4px;
  box-shadow: 0 3px 0 #000000;
  animation: cbTimerPulseUrgent 0.7s ease infinite;
}
body.colorblind-mode .hint-timer-display.timer-red .hint-timer-label,
body.colorblind-mode .hint-timer-display.timer-red .hint-timer-value,
body.colorblind-mode .hint-timer-display.timer-red .hint-counter-label,
body.colorblind-mode .hint-timer-display.timer-red .hint-counter-value,
body.colorblind-mode .hint-timer-display.timer-red .hint-counter-of {
  color: #000000;
  font-weight: 900;
}
body.colorblind-mode .hint-timer-display.timer-red .hint-timer-left {
  border-right-color: #000000;
}
body.colorblind-mode .hint-timer-left {
  border-right-color: #000000;
}
body.colorblind-mode .hint-counter-value,
body.colorblind-mode .hint-timer-value,
body.colorblind-mode .hint-timer-label,
body.colorblind-mode .hint-counter-label,
body.colorblind-mode .hint-counter-of {
  color: #000000;
}

/* === CLEAR BUTTON === */
body.colorblind-mode .clear-btn {
  background: #000000;
  border: 3px solid #000000;
  color: #ffffff;
  box-shadow: 0 4px 0 #555555;
  animation: none;
}
body.colorblind-mode .clear-btn.clear-btn-alert {
  background: #cc6600 !important;
  border-color: #000000 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 0 #000000, 0 0 0 3px #ffffcc !important;
  animation: cbClearAlert 0.5s ease infinite !important;
}

/* === GUESS BUTTON === */
body.colorblind-mode .decode-submit-btn {
  background: #000000;
  color: #ffffff;
  border: 3px solid #000000;
  box-shadow: 0 4px 0 #444444;
}
body.colorblind-mode .decode-submit-btn:hover:not(:disabled) {
  background: #333333;
  opacity: 1;
}
body.colorblind-mode .decode-submit-btn:disabled {
  background: #999999;
  color: #cccccc;
  border-color: #666666;
  box-shadow: none;
}
body.colorblind-mode .decode-submit-btn.loading {
  background: #666666;
  color: #ffffff;
  animation: kpulse 0.9s infinite;
  box-shadow: none;
}
body.colorblind-mode .decode-submit-btn.guess-warn {
  background: #cc6600;
  color: #ffffff;
  border: 3px solid #000000;
  box-shadow: 0 4px 0 #000000;
  animation: cbWarnPulse 1.5s ease infinite;
}
body.colorblind-mode .decode-submit-btn.guess-danger {
  background: #000000;
  color: #ffffcc;
  border: 4px solid #cc6600;
  box-shadow: 0 4px 0 #555555;
  animation: cbDangerPulse 0.8s ease infinite;
}

/* === QWERTY KEYBOARD === */
body.colorblind-mode .qwerty-key-wide {
  background: #e0e0e0;
  border-color: #000000;
  border-width: 2px;
  color: #000000;
  box-shadow: 0 3px 0 #555555;
}
body.colorblind-mode .qwerty-key-wide.key-pressed {
  background: #999999 !important;
  border-color: #000000 !important;
  box-shadow: 0 1px 0 #333333 !important;
  transform: translateY(1px) !important;
  transition: none !important;
}
body.colorblind-mode .qwerty-key-letter {
  background: #f0f8ff;
  border-color: #0055cc;
  border-style: solid;
  border-width: 2px;
  color: #000000;
  box-shadow: 0 3px 0 #0055cc;
  animation: none;
  font-weight: 900;
}
body.colorblind-mode .qwerty-key-letter:hover {
  background: #cce0ff;
  box-shadow: 0 3px 0 #0055cc;
}
body.colorblind-mode .qwerty-key-letter.key-pressed {
  background: #0055cc !important;
  border-color: #000000 !important;
  color: #ffffff !important;
  box-shadow: 0 1px 0 #003388 !important;
  transform: translateY(1px) !important;
  transition: none !important;
}

/* === INLINE COUNTDOWN === */
body.colorblind-mode .inline-countdown {
  background: #ffffff;
  border: 3px solid #000000;
  box-shadow: 0 3px 0 #000000;
}
body.colorblind-mode .inline-countdown-label {
  color: #000000;
  font-weight: 900;
}
body.colorblind-mode .inline-countdown-timer {
  color: #000000;
  font-weight: 900;
}

/* === GAMEOVER SHARE BUTTON === */
body.colorblind-mode .gameover-share-btn {
  background: #000000;
  color: #ffffff;
  border: 3px solid #000000;
  box-shadow: 0 4px 0 #555555;
  animation: none;
}
body.colorblind-mode .gameover-share-btn:hover {
  background: #333333;
  opacity: 1;
}

/* === HOW TO PLAY SECTION === */
body.colorblind-mode .htp-section-page {
  background: #ffffff;
}
body.colorblind-mode .htp-page-title {
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: #000000;
  background-clip: unset;
  color: #000000;
}
body.colorblind-mode .htp-page-subtitle {
  color: #333333;
}
body.colorblind-mode .htp-block {
  background: #ffffff;
  border: 2px solid #000000;
  box-shadow: 0 3px 0 #000000;
}
body.colorblind-mode .htp-block::before {
  background: #000000;
}
body.colorblind-mode .htp-block-title {
  color: #000000;
  font-weight: 900;
}
body.colorblind-mode .htp-body-text {
  color: #000000;
}
body.colorblind-mode .htp-clue-box {
  background: #f0f0f0;
  border: 2px solid #000000;
}
body.colorblind-mode .htp-clue-box-label {
  color: #000000;
}
body.colorblind-mode .htp-clue-box-answer {
  color: #000000;
  font-weight: 700;
}
body.colorblind-mode .htp-colour-tile.correct {
  background: #0055cc;
  border-color: #000000;
  color: #ffffff;
  text-decoration: underline;
}
body.colorblind-mode .htp-colour-tile.present {
  background: #ff9900;
  border-color: #000000;
  color: #000000;
}
body.colorblind-mode .htp-colour-tile.absent {
  background: #cccccc;
  border-color: #000000;
  color: #333333;
}
body.colorblind-mode .htp-tip {
  color: #000000;
}
body.colorblind-mode .htp-colour-row {
  color: #000000;
}

/* === FOOTER === */
body.colorblind-mode .site-footer {
  background: #f0f0f0;
  border-top: 3px solid #000000;
}
body.colorblind-mode .footer-link {
  color: #000000;
  text-decoration: underline;
  font-weight: 900;
}
body.colorblind-mode .footer-link:hover {
  color: #333399;
  opacity: 1;
}
body.colorblind-mode .footer-contact {
  color: #000000;
}
body.colorblind-mode .footer-contact a {
  color: #000000;
  text-decoration: underline;
  font-weight: 900;
}
body.colorblind-mode .footer-copy {
  color: #333333;
}

/* === MODALS === */
body.colorblind-mode .modal-overlay {
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}
body.colorblind-mode .modal {
  background: #ffffff;
  border: 3px solid #000000;
  box-shadow: 0 8px 0 #000000;
}
body.colorblind-mode .modal::before {
  background: #000000;
  height: 6px;
}
body.colorblind-mode .modal-close {
  background: #000000;
  color: #ffffff;
  border: 2px solid #000000;
}
body.colorblind-mode .modal-close:hover {
  background: #333333;
  color: #ffffff;
}
body.colorblind-mode .modal-title {
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: #000000;
  background-clip: unset;
  color: #000000;
  font-weight: 900;
}
body.colorblind-mode .modal-sub {
  color: #333333;
  font-weight: 700;
}
body.colorblind-mode .modal-icon {
  filter: none;
}
body.colorblind-mode .answer-box {
  background: #f0f8ff;
  border: 3px solid #000000;
  color: #000000;
  animation: none;
  box-shadow: 0 3px 0 #000000;
}
body.colorblind-mode .share-box {
  background: #f0f0f0;
  border: 2px solid #000000;
  color: #000000;
}
body.colorblind-mode .share-btn {
  background: #000000;
  color: #ffffff;
  border: 3px solid #000000;
  box-shadow: 0 4px 0 #555555;
}
body.colorblind-mode .share-btn:hover {
  opacity: 0.85;
}
body.colorblind-mode .modal-countdown-label {
  color: #333333;
  font-weight: 900;
}
body.colorblind-mode .modal-countdown {
  color: #000000;
  font-weight: 900;
}
body.colorblind-mode .footer-modal-title {
  color: #000000;
}
body.colorblind-mode .modal.footer-modal-body-wrap p,
body.colorblind-mode .modal.footer-modal-body-wrap ul {
  color: #000000;
}
body.colorblind-mode .modal.footer-modal-body-wrap a {
  color: #000000;
  text-decoration: underline;
  font-weight: 900;
}

/* === COLORBLIND-SPECIFIC ANIMATIONS === */
@keyframes cbSweepPulse {
  0%,100% { box-shadow: 0 0 10px #ccaa0066; }
  50% { box-shadow: 0 0 20px #ccaa00aa; }
}
@keyframes cbNeedsClear {
  0%,100% { filter: drop-shadow(0 0 4px transparent); }
  50% { filter: drop-shadow(0 0 10px #00000066); }
}
@keyframes cbTimerPulse {
  0%,100% { box-shadow: 0 3px 0 #000000, 0 0 8px rgba(0,0,0,0.2); }
  50% { box-shadow: 0 3px 0 #000000, 0 0 18px rgba(0,0,0,0.45); }
}
@keyframes cbTimerPulseUrgent {
  0%,100% {
    box-shadow: 0 3px 0 #000000, 0 0 10px rgba(0,0,0,0.3);
    background: #ffffcc;
  }
  50% {
    box-shadow: 0 3px 0 #000000, 0 0 26px rgba(0,0,0,0.6);
    background: #ffff88;
  }
}
@keyframes cbClearAlert {
  0%,100% {
    box-shadow: 0 4px 0 #000000, 0 0 0 3px #ffffcc;
    background: #cc6600;
  }
  50% {
    box-shadow: 0 4px 0 #000000, 0 0 0 5px #ffff88;
    background: #ff8800;
  }
}
@keyframes cbWarnPulse {
  0%,100% { box-shadow: 0 4px 0 #000000; background: #cc6600; }
  50% { box-shadow: 0 4px 0 #000000, 0 0 18px rgba(0,0,0,0.4); background: #ff8800; }
}
@keyframes cbDangerPulse {
  0%,100% {
    box-shadow: 0 4px 0 #555555;
    background: #000000;
    border-color: #cc6600;
  }
  50% {
    box-shadow: 0 4px 0 #555555, 0 0 20px rgba(0,0,0,0.5);
    background: #222222;
    border-color: #ff9900;
  }
}

/* ═══════════════════════════════
   HEADER FIT ON PHONES (2026-11-22): logo scales, buttons compress, nothing overflows
═══════════════════════════════ */
header { min-width: 0; }
.logo { min-width: 0; font-size: clamp(1.05rem, 5.2vw, 1.7rem); letter-spacing: clamp(2px, 1vw, 6px); }
@media (max-width: 480px) {
  header { padding: 8px 10px; gap: 6px; }
  .header-right-btns { gap: 4px; }
  .header-btn { padding: 6px 9px; font-size: 0.72rem; }
  .btn-sound, .btn-colorblind { padding: 5px 8px; }
}
@media (max-width: 420px) {
  .btn-how .btn-label { display: none; }
  .btn-how { padding: 6px 10px; }
}
@media (max-width: 350px) {
  header { padding: 6px 6px; gap: 4px; }
  .header-btn { padding: 5px 7px; font-size: 0.66rem; }
  .logo { letter-spacing: 1px; }
}
