/* ============================================================
   VINTAGE WARM STUDY — bold, crisp, clearly readable
   ============================================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* warm vintage palette — rich and saturated for contrast */
  --cream: #f5e6c8;
  --cream-warm: #efd9b4;
  --parchment: #f9eed8;
  --vanilla: #fff8e7;
  --butter: #f7e4a3;
  --butter-deep: #d9b95c;
  --terracotta: #c87956;
  --terracotta-deep: #8f4428;
  --rust: #b5654a;
  --brick: #7a3320;
  --mustard: #d4a548;
  --mustard-deep: #a3781f;
  --olive: #8a9a5b;
  --olive-deep: #4d5c2a;
  --sage: #a8b88a;
  --rose: #d99a8a;
  --rose-deep: #a85a48;
  --plum: #8a5a5a;
  --brown: #4a2c1a;
  --ink: #1f1408;
  --ink-soft: #3a2618;
  --card: #fdf5e0;
  --shadow: rgba(74, 44, 26, 0.22);
  --border: #b8945e;
  --border-dark: #8a6a3a;
}

html, body { height: 100%; }

body {
  font-family: "Nunito", "Trebuchet MS", system-ui, sans-serif;
  font-weight: 700;
  background:
    radial-gradient(ellipse 80% 50% at 15% 20%, rgba(212, 165, 72, 0.22), transparent 60%),
    radial-gradient(ellipse 70% 45% at 85% 15%, rgba(200, 121, 86, 0.2), transparent 55%),
    radial-gradient(ellipse 60% 40% at 50% 90%, rgba(168, 184, 138, 0.22), transparent 50%),
    linear-gradient(170deg, #f9eed8 0%, #f5e6c8 35%, #efd9b4 65%, #f7e4a3 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--ink);
  padding-top: 68px;
  padding-bottom: 60px;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* vintage paper grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(74, 44, 26, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 70% 60%, rgba(74, 44, 26, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 40% 80%, rgba(74, 44, 26, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 90% 20%, rgba(74, 44, 26, 0.05) 1px, transparent 1px);
  background-size: 18px 18px, 24px 24px, 22px 22px, 20px 20px;
}

/* warm corner glows */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(143, 68, 40, 0.14), transparent 70%),
    radial-gradient(ellipse 50% 35% at 100% 0%, rgba(212, 165, 72, 0.16), transparent 70%);
}

/* ============================================================
   HEADER — bold vintage wooden sign
   ============================================================ */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background:
    repeating-linear-gradient(90deg, rgba(74, 44, 26, 0.08) 0 2px, transparent 2px 8px),
    linear-gradient(120deg, #b5654a 0%, #8f4428 40%, #7a3320 100%);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 22px rgba(58, 30, 16, 0.45), inset 0 1px 0 rgba(255, 248, 231, 0.18);
  flex-wrap: wrap;
  border-bottom: 3px solid #5a2410;
}

header h1 {
  font-family: "Baloo 2", cursive;
  font-size: 1.55rem;
  font-weight: 800;
  color: #fff8e7;
  letter-spacing: 0.4px;
  text-shadow: 2px 2px 0 rgba(31, 20, 8, 0.5);
  margin-right: 4px;
  line-height: 1;
}

header .spark {
  font-size: 1.15rem;
  animation: tw 2.4s infinite alternate ease-in-out;
  filter: drop-shadow(0 0 6px rgba(255, 248, 231, 0.8));
}

@keyframes tw {
  from { transform: scale(1) rotate(-6deg); opacity: 0.85; }
  to   { transform: scale(1.15) rotate(6deg); opacity: 1; }
}

.nav-btn {
  background: rgba(255, 248, 231, 0.22);
  border: 2px solid rgba(255, 248, 231, 0.7);
  color: #fff8e7;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.22s ease;
  white-space: nowrap;
  letter-spacing: 0.3px;
  font-family: "Nunito", sans-serif;
  text-shadow: 1px 1px 0 rgba(31, 20, 8, 0.4);
}

.nav-btn:hover:not(:disabled) {
  background: rgba(255, 248, 231, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(58, 30, 16, 0.45);
}

.nav-btn:active:not(:disabled) { transform: translateY(0) scale(0.97); }

.nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.nav-spacer { margin-left: auto; }

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
main {
  max-width: 1020px;
  margin: 0 auto;
  padding: 20px 16px;
  position: relative;
  z-index: 1;
}

.panel {
  background:
    linear-gradient(135deg, rgba(255, 248, 231, 0.85), rgba(249, 238, 216, 0.95)),
    var(--card);
  border-radius: 22px;
  padding: 20px;
  box-shadow:
    0 10px 32px var(--shadow),
    inset 0 0 0 1px rgba(184, 148, 94, 0.5);
  border: 2.5px solid var(--border);
  position: relative;
}

/* ============================================================
   HERO — bold vintage sunset postcard
   ============================================================ */
.hero {
  background:
    repeating-linear-gradient(45deg, rgba(255, 248, 231, 0.07) 0 8px, transparent 8px 16px),
    linear-gradient(140deg, #d9b95c 0%, #c87956 40%, #8f4428 75%, #7a3320 100%);
  border-radius: 26px;
  padding: 30px 20px;
  color: #fff8e7;
  text-align: center;
  box-shadow:
    0 16px 40px rgba(122, 51, 32, 0.4),
    inset 0 0 0 2px rgba(255, 248, 231, 0.3);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  border: 3px double rgba(255, 248, 231, 0.6);
}

.hero::before {
  content: "✿ ❀ ✿ ❀ ✿";
  position: absolute;
  top: 8px; left: 0; right: 0;
  font-size: 0.85rem;
  opacity: 0.55;
  letter-spacing: 14px;
  pointer-events: none;
  color: #fff8e7;
}

.hero::after {
  content: "";
  position: absolute;
  bottom: -30px; left: -10%; right: -10%;
  height: 80px;
  background: radial-gradient(ellipse 80% 100% at 50% 100%, rgba(255, 248, 231, 0.28), transparent);
  border-radius: 50%;
  pointer-events: none;
}

.hero h2 {
  font-family: "Baloo 2", cursive;
  font-size: 2.1rem;
  margin-bottom: 8px;
  text-shadow: 2px 2px 0 rgba(31, 20, 8, 0.5);
  font-weight: 800;
  letter-spacing: 0.4px;
  line-height: 1.15;
}

.hero p {
  opacity: 1;
  font-size: 0.95rem;
  line-height: 1.6;
  font-weight: 700;
  text-shadow: 1px 1px 0 rgba(31, 20, 8, 0.3);
}

/* ============================================================
   BUTTONS — bold vintage stamp style
   ============================================================ */
.bigbtn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  background: linear-gradient(135deg, #f7e4a3 0%, #d9b95c 50%, #d4a548 100%);
  color: #4a2c1a;
  border: 2.5px dashed rgba(74, 44, 26, 0.65);
  padding: 15px 30px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow:
    0 8px 26px rgba(212, 165, 72, 0.5),
    inset 0 0 0 1px rgba(255, 248, 231, 0.7);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin-top: 16px;
  letter-spacing: 0.3px;
  position: relative;
  z-index: 1;
  font-family: "Nunito", sans-serif;
  text-shadow: 1px 1px 0 rgba(255, 248, 231, 0.6);
}

.bigbtn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 34px rgba(212, 165, 72, 0.65);
}

.bigbtn:active { transform: translateY(0) scale(0.98); }

/* ============================================================
   SEARCH
   ============================================================ */
.searchbar {
  width: 100%;
  padding: 13px 20px;
  border-radius: 999px;
  border: 2.5px solid var(--border);
  font-size: 0.95rem;
  outline: none;
  margin-bottom: 16px;
  background: #fffaf0;
  transition: all 0.25s ease;
  color: var(--ink);
  font-weight: 700;
  font-family: "Nunito", sans-serif;
}

.searchbar::placeholder { color: #8a6a3a; font-weight: 600; }

.searchbar:focus {
  border-color: var(--terracotta-deep);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(200, 121, 86, 0.2);
}

/* ============================================================
   TOPIC GRID
   ============================================================ */
.topicgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}

.tbtn {
  background: linear-gradient(145deg, #fffaf0 0%, #f9eed8 100%);
  border: 2.5px solid var(--border);
  border-radius: 16px;
  padding: 12px 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--ink);
  font-family: "Nunito", sans-serif;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(74, 44, 26, 0.1);
}

.tbtn:hover {
  border-color: var(--terracotta-deep);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(143, 68, 40, 0.28);
  background: #fff;
}

.tbtn:active { transform: translateY(0) scale(0.98); }

.tbtn .num {
  background: linear-gradient(135deg, #8f4428, #7a3320);
  color: #fff8e7;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 7px;
  flex: none;
  box-shadow: 0 2px 6px rgba(122, 51, 32, 0.4);
  font-family: "Baloo 2", sans-serif;
}

.tbtn .ttl {
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink-soft);
}

.tbtn .emo { font-size: 1.1rem; line-height: 1; }

/* ============================================================
   TOPIC HEADER — bold vintage banner
   ============================================================ */
.topichead {
  background:
    repeating-linear-gradient(45deg, rgba(255, 248, 231, 0.08) 0 6px, transparent 6px 12px),
    linear-gradient(135deg, #d4a548 0%, #c87956 55%, #7a3320 100%);
  color: #fff8e7;
  border-radius: 22px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 10px 30px rgba(122, 51, 32, 0.4), inset 0 0 0 2px rgba(255, 248, 231, 0.25);
  border: 3px double rgba(255, 248, 231, 0.5);
}

.topichead h2 {
  font-family: "Baloo 2", cursive;
  font-size: 1.25rem;
  margin-bottom: 5px;
  font-weight: 800;
  text-shadow: 1px 1px 0 rgba(31, 20, 8, 0.4);
}

.topichead p { font-size: 0.82rem; opacity: 1; font-weight: 700; }

/* ============================================================
   GAME GRID
   ============================================================ */
.gamegrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px;
}

.gbtn {
  border: 2.5px solid rgba(255, 248, 231, 0.55);
  border-radius: 18px;
  padding: 18px 12px;
  cursor: pointer;
  color: #fff8e7;
  font-weight: 800;
  font-size: 0.9rem;
  text-align: center;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 22px rgba(58, 30, 16, 0.35);
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  font-family: "Nunito", sans-serif;
  letter-spacing: 0.2px;
  text-shadow: 1px 1px 0 rgba(31, 20, 8, 0.45);
  position: relative;
  overflow: hidden;
}

.gbtn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 248, 231, 0.22) 0%, transparent 55%);
  pointer-events: none;
}

.gbtn::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(255, 248, 231, 0.45);
  border-radius: 14px;
  pointer-events: none;
}

.gbtn:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 14px 34px rgba(58, 30, 16, 0.5);
}

.gbtn:active { transform: translateY(-1px) scale(0.98); }

.gbtn small {
  font-weight: 700;
  font-size: 0.68rem;
  opacity: 1;
  display: block;
  line-height: 1.3;
}

.g1 { background: linear-gradient(135deg, #d4a548, #a3781f); }
.g2 { background: linear-gradient(135deg, #c87956, #8f4428); }
.g3 { background: linear-gradient(135deg, #8a9a5b, #4d5c2a); }
.g4 { background: linear-gradient(135deg, #d99a8a, #a85a48); }
.g5 { background: linear-gradient(135deg, #7a3320, #5a2410); }
.g6 { background: linear-gradient(135deg, #b5654a, #7a3320); }

/* ============================================================
   INSTRUCTION — bold vintage note
   ============================================================ */
.instruction {
  background:
    repeating-linear-gradient(0deg, rgba(184, 148, 94, 0.15) 0 1px, transparent 1px 26px),
    linear-gradient(135deg, #fffaf0 0%, #f9eed8 100%);
  border: 2.5px dashed var(--mustard-deep);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--ink);
  font-weight: 700;
}

.instruction b { color: #7a3320; font-weight: 800; }

.instruction .my {
  display: block;
  margin-top: 6px;
  color: #8f4428;
  font-weight: 800;
  font-size: 0.82rem;
}

/* ============================================================
   TOP BAR / PILLS
   ============================================================ */
.topbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pill {
  background: #fffaf0;
  border: 2.5px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
  font-weight: 800;
  font-size: 0.8rem;
  color: #7a3320;
  transition: all 0.2s ease;
  font-family: "Baloo 2", sans-serif;
  box-shadow: 0 2px 6px rgba(74, 44, 26, 0.12);
}

.pill.score {
  border-color: var(--olive);
  color: #3d4a1e;
  background: #f0f4e6;
}

.pill.time {
  border-color: var(--mustard);
  color: #6a4a10;
  background: #fdf6e3;
}

/* ============================================================
   PROGRESS
   ============================================================ */
.progress {
  height: 12px;
  background: #e8dcc0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 18px;
  box-shadow: inset 0 1px 4px rgba(74, 44, 26, 0.18);
  border: 1px solid rgba(184, 148, 94, 0.6);
}

.progress > div {
  height: 100%;
  background:
    repeating-linear-gradient(45deg, rgba(255, 248, 231, 0.3) 0 6px, transparent 6px 12px),
    linear-gradient(90deg, #d4a548, #c87956, #8f4428);
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 999px;
}

/* ============================================================
   IMAGE SLOT — bright, crisp vintage photo frame
   ============================================================ */
.img-slot {
  position: relative;
  width: 100%;
  max-width: 400px;
  height: 270px;
  margin: 0 auto 16px;
  border: 4px solid var(--border-dark);
  border-radius: 14px;
  overflow: hidden;
  background: #fffaf0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 8px 24px var(--shadow),
    inset 0 0 0 4px #fffaf0,
    inset 0 0 0 6px var(--border);
  padding: 6px;
}

.img-slot .emoji-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.5rem;
  line-height: 1;
  opacity: 0.55;
  transition: opacity 0.4s ease;
  z-index: 0;
}

.img-slot img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.4s ease;
  border-radius: 8px;
  /* bright, clear, natural colour — no dim filter */
  filter: brightness(1.06) contrast(1.08) saturate(1.12);
}

.img-slot img.loaded { opacity: 1; }

.img-slot .img-lbl {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  z-index: 2;
  background: rgba(255, 250, 240, 0.97);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.74rem;
  font-weight: 800;
  color: #5a2410;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1.5px solid var(--border-dark);
  font-family: "Baloo 2", sans-serif;
  letter-spacing: 0.3px;
}

/* ============================================================
   QUESTION — bold black text
   ============================================================ */
.qbox { text-align: center; padding: 6px 0; }

.qword {
  font-family: "Baloo 2", cursive;
  font-size: 2.2rem;
  font-weight: 800;
  color: #1f1408;
  margin-bottom: 4px;
  word-break: break-word;
  letter-spacing: 0.3px;
  text-shadow: 1px 1px 0 rgba(255, 248, 231, 0.8);
  line-height: 1.1;
}

.qipa {
  color: #6a4a10;
  font-weight: 800;
  margin-bottom: 6px;
  font-family: "Courier New", monospace;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
}

.qmean {
  color: var(--ink);
  font-size: 0.92rem;
  margin-bottom: 18px;
  font-weight: 700;
}

/* ============================================================
   OPTIONS — clear bold text
   ============================================================ */
.opts { display: grid; gap: 10px; }

.opt {
  background: #fffaf0;
  border: 2.5px solid var(--border);
  border-radius: 14px;
  padding: 15px 18px;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  color: var(--ink);
  font-family: "Nunito", sans-serif;
  letter-spacing: 0.15px;
  box-shadow: 0 2px 6px rgba(74, 44, 26, 0.1);
}

.opt:hover:not(.locked) {
  border-color: var(--terracotta-deep);
  background: #fff8e7;
  transform: translateX(5px);
  box-shadow: 0 4px 14px rgba(143, 68, 40, 0.25);
}

.opt:active:not(.locked) { transform: translateX(3px) scale(0.99); }

.opt.right {
  background: #e6efd6;
  border-color: #4d5c2a;
  color: #2a3510;
  animation: pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.opt.wrong {
  background: #f5ddd6;
  border-color: #7a3320;
  color: #5a1a08;
  animation: shake 0.4s ease;
}

.opt.locked { pointer-events: none; cursor: default; }

@keyframes pop {
  0% { transform: scale(0.95); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* ============================================================
   NEXT / TTS BUTTONS
   ============================================================ */
.center { text-align: center; }

.nextbtn {
  margin-top: 20px;
  background: linear-gradient(135deg, #4d5c2a 0%, #8a9a5b 100%);
  color: #fff8e7;
  border: 2.5px solid rgba(255, 248, 231, 0.55);
  padding: 14px 30px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.96rem;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(77, 92, 42, 0.45);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: "Nunito", sans-serif;
  letter-spacing: 0.3px;
  text-shadow: 1px 1px 0 rgba(31, 20, 8, 0.4);
}

.nextbtn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(77, 92, 42, 0.6);
}

.nextbtn:active { transform: translateY(0) scale(0.97); }

.nextbtn.hide { display: none; }

.tts-btn {
  background: linear-gradient(135deg, #d4a548 0%, #8f4428 100%);
  color: #fff8e7;
  border: 2.5px solid rgba(255, 248, 231, 0.55);
  padding: 11px 22px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.86rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(212, 165, 72, 0.45);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin: 8px 4px;
  font-family: "Nunito", sans-serif;
  letter-spacing: 0.3px;
  text-shadow: 1px 1px 0 rgba(31, 20, 8, 0.4);
}

.tts-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(212, 165, 72, 0.6);
}

.tts-btn:active:not(:disabled) { transform: scale(0.96); }

.tts-btn:disabled { cursor: not-allowed; opacity: 0.8; }

.tts-btn.speaking {
  background: linear-gradient(135deg, #a85a48 0%, #7a3320 100%);
  animation: pulse 1s infinite;
  box-shadow: 0 6px 20px rgba(168, 90, 72, 0.55);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(168, 90, 72, 0.45); }
  50% { box-shadow: 0 6px 30px rgba(168, 90, 72, 0.85); }
}

/* ============================================================
   RESULT
   ============================================================ */
.resultbox { text-align: center; padding: 24px 20px; }

.resultbox .big {
  font-size: 3rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(74, 44, 26, 0.25));
}

.resultbox h3 {
  font-family: "Baloo 2", cursive;
  font-size: 1.8rem;
  margin-bottom: 6px;
  color: #1f1408;
  font-weight: 800;
}

.resultbox p {
  color: var(--ink);
  margin-bottom: 18px;
  font-size: 0.92rem;
  line-height: 1.55;
  font-weight: 700;
}

.stars {
  font-size: 1.5rem;
  letter-spacing: 4px;
  margin-bottom: 14px;
  filter: drop-shadow(0 2px 6px rgba(212, 165, 72, 0.55));
}

/* ============================================================
   SCRAMBLE
   ============================================================ */
.letters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 16px 0;
}

.ltn {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  border: 2.5px solid var(--border-dark);
  background: #fffaf0;
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  color: #5a2410;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 8px rgba(74, 44, 26, 0.15);
}

.ltn:hover:not(.used) {
  background: #fff8e7;
  transform: translateY(-3px);
  border-color: var(--terracotta-deep);
  box-shadow: 0 6px 16px rgba(143, 68, 40, 0.3);
}

.ltn:active:not(.used) { transform: translateY(0) scale(0.94); }

.ltn.used {
  opacity: 0.25;
  pointer-events: none;
  transform: scale(0.92);
}

.answer {
  min-height: 56px;
  border: 2.5px dashed var(--terracotta-deep);
  border-radius: 14px;
  background: #fffaf0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  padding: 10px;
  margin-bottom: 14px;
  transition: all 0.3s ease;
}

.achip {
  background: linear-gradient(135deg, #8f4428, #7a3320);
  color: #fff8e7;
  border-radius: 8px;
  padding: 8px 14px;
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 3px 10px rgba(122, 51, 32, 0.35);
}

.achip:hover { transform: scale(1.06); box-shadow: 0 4px 14px rgba(122, 51, 32, 0.45); }
.achip:active { transform: scale(0.95); }

/* ============================================================
   MEMORY
   ============================================================ */
.memgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.memcard {
  height: 150px;
  perspective: 700px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.memcard:hover { transform: scale(1.02); }

.meminner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.memcard.flip .meminner { transform: rotateY(180deg); }

.memface {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  text-align: center;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  border: 2.5px solid rgba(255, 248, 231, 0.55);
  font-family: "Nunito", sans-serif;
}

.memfront {
  background:
    repeating-linear-gradient(45deg, rgba(255, 248, 231, 0.12) 0 6px, transparent 6px 12px),
    linear-gradient(135deg, #d4a548 0%, #8f4428 100%);
  color: #fff8e7;
  font-size: 1.7rem;
  box-shadow: inset 0 2px 12px rgba(255, 248, 231, 0.28);
}

.memword {
  background:
    repeating-linear-gradient(45deg, rgba(255, 248, 231, 0.1) 0 6px, transparent 6px 12px),
    linear-gradient(135deg, #c87956 0%, #7a3320 100%);
  color: #fff8e7;
  font-size: 0.85rem;
  box-shadow: inset 0 2px 12px rgba(255, 248, 231, 0.22);
  word-break: break-word;
  padding: 4px;
  font-family: "Baloo 2", sans-serif;
}

.memmean {
  background: #fffaf0;
  border: 2.5px solid #4d5c2a;
  color: #2a3510;
  transform: rotateY(180deg);
  justify-content: flex-start;
  padding-top: 6px;
}

.memmean .mini-img {
  width: 100%;
  height: 54px;
  border: 2px dashed #8a9a5b;
  border-radius: 8px;
  background: #f0f4e6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 4px;
  overflow: hidden;
}

.memcard.matched .meminner { transform: rotateY(180deg) scale(0.94); }

.memcard.matched .memmean {
  border-color: #a3781f;
  background: #fdf6e3;
  color: #6a4a10;
}

/* ============================================================
   HANGMAN
   ============================================================ */
.hword {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 18px 0;
  font-family: "Baloo 2", sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 3px;
}

.hl { color: #5a2410; }
.hl.gap { width: 16px; }

.hkeys {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 14px;
}

.hkey {
  padding: 10px 0;
  border-radius: 8px;
  border: 2.5px solid var(--border-dark);
  background: #fffaf0;
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  color: #5a2410;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(74, 44, 26, 0.1);
}

.hkey:hover:not(.gone) {
  background: #fff8e7;
  border-color: var(--terracotta-deep);
  transform: translateY(-1px);
}

.hkey.gone {
  opacity: 0.3;
  pointer-events: none;
  background: #e8dcc0;
  border-color: #e8dcc0;
  color: #8a6a3a;
  box-shadow: none;
}

.lives { font-size: 1.1rem; letter-spacing: 3px; }

/* ============================================================
   SPEED
   ============================================================ */
.speedbox { text-align: center; }

.speedword {
  font-family: "Baloo 2", cursive;
  font-size: 2.2rem;
  font-weight: 800;
  color: #1f1408;
  margin: 10px 0;
  text-shadow: 1px 1px 0 rgba(255, 248, 231, 0.8);
}

.speedopts { display: grid; gap: 10px; margin-top: 14px; }

/* ============================================================
   MISC
   ============================================================ */
.extra {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.chip {
  display: inline-block;
  background: #fffaf0;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.74rem;
  color: #5a2410;
  font-weight: 800;
  margin: 2px;
  border: 1.5px solid var(--border);
  font-family: "Nunito", sans-serif;
}

.footer {
  text-align: center;
  font-size: 0.8rem;
  color: #8a6a3a;
  margin-top: 26px;
  font-family: "Nunito", sans-serif;
  font-weight: 700;
}

.diag {
  border: 2.5px solid #4d5c2a;
  border-radius: 14px;
  padding: 12px 14px;
  margin-top: 14px;
  background: #f0f4e6;
  font-size: 0.84rem;
  line-height: 1.55;
  font-weight: 700;
  color: var(--ink);
}

.diag b { color: #4d5c2a; }
.diag .ok { color: #3d4a1e; font-weight: 800; }
.diag .warn { color: #6a4a10; font-weight: 800; }
.diag .err { color: #7a3320; font-weight: 800; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 520px) {
  .qword { font-size: 1.85rem; }
  .speedword { font-size: 1.85rem; }
  .memgrid { grid-template-columns: repeat(2, 1fr); }
  .hkeys { grid-template-columns: repeat(6, 1fr); }
  header h1 { font-size: 1.3rem; }
  .nav-btn { padding: 6px 10px; font-size: 0.76rem; }
  .img-slot { height: 220px; }
  .hero h2 { font-size: 1.75rem; }
  .resultbox h3 { font-size: 1.5rem; }
}