/* ============================================================
   KhelaGhor — dark neon gaming theme
   Operator accents: neutral = violet/cyan · bdapps = Robi red ·
   applink = Banglalink orange. Everything reads from the vars below.
   ============================================================ */

:root {
  --brand: #8b5cf6;
  --brand-2: #6366f1;
  --accent: #22d3ee;
  --gold: #ffd200;
  --bg: #0b0e17;
  --bg-2: #10162a;
  --card: rgba(255, 255, 255, .045);
  --card-solid: #151b2e;
  --line: rgba(255, 255, 255, .09);
  --text: #e8eaf2;
  --muted: #96a0b5;
  --good: #22c55e;
  --bad: #f43f5e;
}

/* bdapps → Robi red neon */
body.theme-bdapps {
  --brand: #ff3b4e;
  --brand-2: #c40024;
  --accent: #ffd200;
}

/* AppLink → Banglalink orange neon */
body.theme-applink {
  --brand: #ff9f1c;
  --brand-2: #e07000;
  --accent: #ffd200;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { touch-action: manipulation; } /* kills double-tap zoom on fast taps */

body {
  font-family: "Segoe UI", "Noto Sans Bengali", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* aurora glow blobs behind everything */
body::before, body::after {
  content: '';
  position: fixed;
  z-index: -1;
  width: 55vmax; height: 55vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .16;
  pointer-events: none;
}
body::before {
  background: var(--brand);
  top: -20vmax; left: -15vmax;
  animation: auroraA 16s ease-in-out infinite alternate;
}
body::after {
  background: var(--accent);
  bottom: -25vmax; right: -15vmax;
  animation: auroraB 20s ease-in-out infinite alternate;
}
@keyframes auroraA { to { transform: translate(8vmax, 6vmax) scale(1.15); } }
@keyframes auroraB { to { transform: translate(-8vmax, -6vmax) scale(1.1); } }

/* ---------------- header ---------------- */
header {
  background: rgba(11, 14, 23, .75);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: .9rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
header a { color: var(--text); text-decoration: none; }
header .logo {
  font-size: 1.35rem;
  font-weight: 900;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
header nav { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
header nav a {
  padding: .35rem .8rem;
  border-radius: 20px;
  font-size: .92rem;
  opacity: .9;
  transition: background .15s, opacity .15s;
}
header nav a:hover { opacity: 1; background: var(--card); }
header .sub-cta {
  background: linear-gradient(135deg, var(--gold), #ffb020);
  color: #1a1500 !important;
  font-weight: 800;
  box-shadow: 0 0 16px rgba(255, 210, 0, .35);
}
header .sub-ok { font-size: .85rem; color: var(--good); }
#fx-mute {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 36px; height: 36px; padding: 0;
  font-size: 1rem;
  box-shadow: none;
}

main { flex: 1; max-width: 1000px; width: 100%; margin: 0 auto; padding: 1.4rem; }

/* ---------------- hero ---------------- */
.hero {
  text-align: center;
  padding: 2.6rem 1.4rem;
  margin-top: 1rem;
  border-radius: 22px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(700px 260px at 85% -30%, color-mix(in srgb, var(--brand) 40%, transparent), transparent 70%),
    radial-gradient(500px 220px at 10% 130%, color-mix(in srgb, var(--accent) 25%, transparent), transparent 70%),
    var(--bg-2);
  border: 1px solid var(--line);
}
.hero h1 {
  font-size: 1.9rem;
  font-weight: 900;
  background: linear-gradient(90deg, var(--brand), var(--accent), var(--brand));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: heroShine 5s linear infinite;
}
@keyframes heroShine { to { background-position: 200% 0; } }
.hero p { color: var(--muted); margin-top: .5rem; }
.hero-cta {
  display: inline-block;
  margin-top: 1.2rem;
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold), #ffab00);
  color: #1a1500;
  box-shadow: 0 0 22px rgba(255, 210, 0, .4);
  animation: fxPulse 2.2s ease-in-out infinite;
}
.hero-cta:hover { filter: brightness(1.08); }

/* ---------------- cards grid ---------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.2rem;
  text-decoration: none;
  color: var(--text);
  display: block;
  position: relative;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.card:hover {
  transform: translateY(-5px) scale(1.02);
  border-color: var(--brand);
  box-shadow: 0 0 24px color-mix(in srgb, var(--brand) 35%, transparent);
}
.card .emoji { font-size: 2.1rem; }
.card:hover .emoji { animation: fxBounce .5s; display: inline-block; }
.card h3 { margin: .45rem 0 .2rem; font-size: 1.05rem; }
.card p { color: var(--muted); font-size: .85rem; }
.card .kw {
  display: inline-block; margin-top: .5rem; font-size: .72rem;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; border-radius: 20px; padding: .16rem .6rem;
}

.section-title {
  margin: 2.2rem 0 .6rem;
  font-size: 1.25rem;
  font-weight: 800;
  border-left: 4px solid var(--brand);
  padding-left: .6rem;
}

/* ---------------- buttons & inputs ---------------- */
button, .btn {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: .58rem 1.15rem;
  font-size: .98rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s, filter .15s;
  touch-action: manipulation;
}
button:hover, .btn:hover {
  filter: brightness(1.12);
  box-shadow: 0 0 18px color-mix(in srgb, var(--brand) 45%, transparent);
}
button:active, .btn:active { transform: scale(.94); }

input, select {
  background: var(--bg-2);
  color: var(--text);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: .55rem .7rem;
  font-size: 1rem;
}
input:focus, select:focus { outline: none; border-color: var(--brand); }

.status { margin: .8rem 0; font-weight: 600; min-height: 1.4em; }
.big { font-size: 1.15rem; }
.hint { color: var(--muted); font-size: .8rem; margin-top: .4rem; }

/* ---------------- game sections ---------------- */
.game-wrap { text-align: center; padding: 1rem 0; }
.game-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.5rem 1.2rem;
  margin: 1.3rem 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.game-section::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--brand), var(--accent), transparent);
}
.game-section h2 {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  margin-bottom: .5rem; font-size: 1.3rem;
}
.game-section > p { color: var(--muted); font-size: .9rem; }

/* organized control rows: any plain div directly inside a section becomes a neat flex row */
.game-section > div:not([class]) {
  display: flex; flex-wrap: wrap; gap: .55rem;
  justify-content: center; align-items: center;
  margin-top: .8rem;
}

/* fullscreen */
.fs-btn {
  background: var(--card);
  border: 1px solid var(--line);
  width: 34px; height: 34px; padding: 0;
  border-radius: 9px; font-size: 1rem; line-height: 1;
  box-shadow: none; flex: 0 0 auto;
}
.fs-btn:hover { border-color: var(--brand); box-shadow: 0 0 12px color-mix(in srgb, var(--brand) 40%, transparent); }
.game-section:fullscreen {
  background: radial-gradient(800px 400px at 50% -10%, color-mix(in srgb, var(--brand) 25%, transparent), transparent 70%), var(--bg);
  border-radius: 0; border: none; margin: 0;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  overflow-y: auto; padding: 2rem;
}
.game-section:fullscreen .game-canvas { width: min(78vmin, 560px); height: auto; }
.game-section:fullscreen h2 { font-size: 1.6rem; }

.game-canvas {
  max-width: 100%;
  border: 2px solid var(--brand);
  border-radius: 12px;
  box-shadow: 0 0 26px color-mix(in srgb, var(--brand) 30%, transparent);
  touch-action: none;
}

/* d-pad */
.dpad {
  display: grid; grid-template-columns: repeat(3, 58px); gap: 6px;
  justify-content: center; margin-top: .9rem;
}
.dpad button { width: 58px; height: 46px; padding: 0; border-radius: 12px; font-size: 1rem; }
.dpad .blank { visibility: hidden; }

/* ---------------- Tic Tac Toe ---------------- */
.ttt { display: grid; grid-template-columns: repeat(3, 80px); gap: 6px; justify-content: center; }
.ttt button {
  width: 80px; height: 80px; padding: 6px;
  background: var(--bg-2); border: 2px solid var(--line); border-radius: 12px;
  box-shadow: none; position: relative;
}
.ttt button:hover { border-color: var(--brand); }
.ttt button svg { width: 100%; height: 100%; display: block; }
.ttt-wrap { position: relative; width: 252px; margin: 1rem auto; }
.ttt .mark-x path {
  stroke: var(--brand); stroke-width: 9; stroke-linecap: round; fill: none;
  stroke-dasharray: 64; stroke-dashoffset: 64;
  animation: tttDraw .28s ease-out forwards;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--brand) 70%, transparent));
}
.ttt .mark-x path:nth-child(2) { animation-delay: .18s; }
.ttt .mark-o circle {
  stroke: var(--accent); stroke-width: 9; stroke-linecap: round; fill: none;
  stroke-dasharray: 152; stroke-dashoffset: 152;
  animation: tttDraw .42s ease-out forwards;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent) 70%, transparent));
}
@keyframes tttDraw { to { stroke-dashoffset: 0; } }
#ttt-pencil {
  position: absolute; z-index: 5; font-size: 1.7rem; left: 0; top: 0;
  transition: transform .28s ease, opacity .2s;
  opacity: 0; pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.6));
}
#ttt-strike { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
#ttt-strike line { stroke: var(--good); stroke-width: 8; stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(34,197,94,.8)); }
.ttt button.win-cell { border-color: var(--good); box-shadow: 0 0 16px rgba(34,197,94,.5); }
.ttt button.dim { opacity: .35; }

/* ---------------- RPS ---------------- */
.rps-hands { font-size: 3rem; display: flex; justify-content: center; gap: 2.5rem; margin: .6rem 0; min-height: 3.6rem; }
.rps-hands .shaking { animation: rpsShake .18s ease-in-out 3; display: inline-block; }
@keyframes rpsShake { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-14px) rotate(-14deg); } }
.rps-hands .reveal { animation: fxPopIn .3s both; display: inline-block; }
.rps-btns { display: flex; flex-wrap: wrap; gap: .55rem; justify-content: center; }

/* ---------------- Word Guess ---------------- */
.wg-board { display: grid; gap: 5px; justify-content: center; margin: 1rem auto; }
.wg-row { display: grid; grid-template-columns: repeat(5, 52px); gap: 5px; }
.wg-cell {
  width: 52px; height: 52px; border: 2px solid var(--line); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700; text-transform: uppercase;
  background: var(--bg-2); color: var(--text);
}
.wg-cell.hit { background: var(--good); border-color: var(--good); color: #fff; }
.wg-cell.near { background: #d4a017; border-color: #d4a017; color: #fff; }
.wg-cell.miss { background: #333a4e; border-color: #333a4e; color: #aab; }
@keyframes wgFlip { 0% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
.wg-cell.wg-reveal { animation: wgFlip .45s both; }
.wg-input { display: flex; gap: .5rem; justify-content: center; margin-top: .6rem; flex-wrap: wrap; }
.wg-input input { width: 160px; text-align: center; text-transform: uppercase; border-color: var(--brand); }

/* ---------------- Memory ---------------- */
.mem { display: grid; grid-template-columns: repeat(4, 70px); gap: 8px; justify-content: center; margin: 1rem auto; }
.mem button {
  width: 70px; height: 70px; padding: 0; font-size: 1.8rem; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.mem button.open { background: var(--bg-2); border: 2px solid var(--brand); animation: fxPopIn .3s; }
.mem button.done { background: var(--good); animation: fxPulse .5s; }

/* ---------------- 2048 ---------------- */
.g2048 {
  display: grid; grid-template-columns: repeat(4, 70px); gap: 8px;
  justify-content: center; margin: 1rem auto; background: #262c40;
  padding: 8px; border-radius: 12px; width: fit-content;
}
.g2-cell {
  width: 70px; height: 70px; background: #1a2036; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 800;
}

/* ---------------- sliding puzzle ---------------- */
.sp-board { display: grid; grid-template-columns: repeat(4, 66px); gap: 6px; justify-content: center; margin: 1rem auto; }
.sp-board button { width: 66px; height: 66px; padding: 0; font-size: 1.3rem; font-weight: 700; border-radius: 10px; }
.sp-board button.sp-blank { background: var(--bg-2); box-shadow: inset 0 0 6px rgba(0,0,0,.5); }

/* ---------------- simon ---------------- */
.simon { display: grid; grid-template-columns: repeat(2, 90px); gap: 10px; justify-content: center; margin: 1rem auto; }
.simon button { width: 90px; height: 90px; padding: 0; border-radius: 16px; opacity: .5;
  transition: opacity .1s, box-shadow .1s, transform .1s; }
.simon button.lit { opacity: 1; transform: scale(1.06); box-shadow: 0 0 26px 8px rgba(255,255,255,.55); }

/* ---------------- reaction ---------------- */
.rt-box { width: 100%; max-width: 380px; height: 130px; margin: .8rem auto; display: block;
  font-size: 1.1rem; border-radius: 16px; background: linear-gradient(135deg, #2a3352, #1a2036); }
.rt-box.rt-wait { background: linear-gradient(135deg, #b91c1c, #7f1d1d); }
.rt-box.rt-go { background: linear-gradient(135deg, #16a34a, #15803d); box-shadow: 0 0 26px rgba(34,197,94,.5); }

/* ---------------- whack-a-mole ---------------- */
.mole { display: grid; grid-template-columns: repeat(3, 76px); gap: 8px; justify-content: center; margin: 1rem auto; }
.mole button { width: 76px; height: 76px; padding: 0; font-size: 2rem; border-radius: 14px;
  background: linear-gradient(135deg, #5c3a12, #3d2408); }
.mole button span { display: inline-block; }
.mole button .mole-up { animation: molePop .22s cubic-bezier(.5,1.8,.6,1) both; }
@keyframes molePop { 0% { transform: translateY(18px) scale(.3); } 100% { transform: translateY(0) scale(1); } }

/* ---------------- dice ---------------- */
#dr-dice { font-size: 3.2rem; }
#dr-dice.rolling { animation: diceRoll .12s linear infinite; display: inline-block; }
@keyframes diceRoll { 0% { transform: rotate(-14deg) scale(1.1); } 50% { transform: rotate(14deg) scale(.95); } 100% { transform: rotate(-14deg) scale(1.1); } }

/* ---------------- minesweeper ---------------- */
.ms-board { display: grid; grid-template-columns: repeat(8, 36px); gap: 3px; justify-content: center; margin: 1rem auto; }
.ms-board button { width: 36px; height: 36px; padding: 0; font-size: .95rem; font-weight: 700; border-radius: 8px; }
.ms-board button.ms-open { background: var(--bg-2); color: var(--text); border: 1px solid var(--line); }

/* ---------------- connect four ---------------- */
.c4-board {
  display: grid; grid-template-columns: repeat(7, 42px); gap: 4px;
  justify-content: center; margin: 1rem auto;
  background: linear-gradient(160deg, #1d2c6b, #101a45);
  padding: 8px; border-radius: 14px; width: fit-content;
  box-shadow: 0 0 22px rgba(60,80,220,.3);
}
.c4-board button { width: 42px; height: 42px; padding: 0; font-size: 1.3rem; background: #0b0e17; border-radius: 50%; box-shadow: inset 0 0 6px rgba(0,0,0,.6); }

/* ---------------- stroop / odd one out ---------------- */
.stroop { font-size: 2rem; font-weight: 800; min-height: 1.4em; }
.oo-board { display: grid; gap: 4px; justify-content: center; margin: 1rem auto; }
.oo-board button { border-radius: 10px; padding: 0; }

/* ---------------- quiz ---------------- */
.quiz-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 1.6rem; max-width: 560px; margin: 0 auto;
}
.quiz-q { margin: 1rem 0; font-size: 1.15rem; }
.quiz-options { display: grid; gap: .6rem; }
.quiz-opt {
  background: var(--bg-2); color: var(--text); border: 2px solid var(--line);
  text-align: left; font-size: 1rem; box-shadow: none;
  transition: transform .12s, border-color .15s, background .15s;
}
.quiz-opt:hover { transform: translateX(4px); border-color: var(--brand); }
.quiz-opt.right { background: var(--good); border-color: var(--good); color: #fff; animation: fxPopIn .3s; }
.quiz-opt.wrong { background: var(--bad); border-color: var(--bad); color: #fff; }
.qz-bar { height: 8px; background: var(--bg-2); border-radius: 6px; overflow: hidden; margin: .6rem 0; }
.qz-bar i { display: block; height: 100%; width: 0; border-radius: 6px;
  background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .4s ease; }

/* ---------------- daily corner ---------------- */
.sign-grid { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: .8rem 0; }
.sign-btn { background: var(--bg-2); color: var(--text); border: 2px solid var(--line); font-size: .9rem; box-shadow: none; }
.sign-btn.active, .sign-btn:hover { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: var(--brand); color: #fff; }

/* ---------------- subscribe ---------------- */
.sub-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 2rem; max-width: 480px; margin: 0 auto;
}
.sub-label { display: block; margin: 1rem 0 .4rem; font-weight: 600; text-align: left; }
.app-select { width: 100%; }
.op-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.op-card {
  border: 2px solid var(--line); border-radius: 14px; padding: .8rem;
  cursor: pointer; display: flex; flex-direction: column; gap: .2rem;
  background: var(--bg-2);
}
.op-card:has(input:checked), .op-card.preselect {
  border-color: var(--brand);
  box-shadow: 0 0 14px color-mix(in srgb, var(--brand) 35%, transparent);
}
.op-card input { accent-color: var(--brand); }
.op-name { font-weight: 700; }
.op-price { font-size: .78rem; color: var(--muted); }
.cc { display: flex; align-items: center; padding: 0 .6rem; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 10px; font-weight: 600; }
.sub-go { width: 100%; margin-top: 1rem; font-size: 1.05rem; }
.link-btn { background: none; color: var(--accent); margin-top: .5rem; box-shadow: none; }
.link-btn:hover { background: none; text-decoration: underline; box-shadow: none; }
.terms { font-size: .72rem; color: var(--muted); margin-top: 1rem; }

/* ---------------- leaderboard ---------------- */
#lb-game { padding: .5rem .8rem; margin-bottom: .8rem; border-color: var(--brand); }
.lb-table { margin: 0 auto; border-collapse: collapse; min-width: 260px; }
.lb-table th, .lb-table td { padding: .45rem .9rem; border-bottom: 1px solid var(--line); text-align: left; }
.lb-table th { color: var(--accent); }
.lb-table tbody tr { transition: background .15s; }
.lb-table tbody tr:hover { background: var(--card); }
.lb-table tbody tr:first-child td { font-weight: 800; color: var(--gold); }

footer {
  text-align: center; color: var(--muted); font-size: .8rem; padding: 1.4rem;
  border-top: 1px solid var(--line);
}

/* ---------------- shared fx ---------------- */
@keyframes fxIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.fx-in { animation: fxIn .5s both; }

@keyframes fxShake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-8px); } 40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); } 80% { transform: translateX(5px); }
}
.fx-shake { animation: fxShake .45s; }

@keyframes fxPopUp { 0% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -60px) scale(1.5); } }
.fx-pop {
  position: fixed; z-index: 999; pointer-events: none;
  font-weight: 900; font-size: 1.3rem; color: var(--gold);
  text-shadow: 0 0 8px rgba(255,210,0,.7);
  animation: fxPopUp .85s ease-out both;
}

.fx-confetti { position: fixed; inset: 0; z-index: 998; pointer-events: none; }

@keyframes fxPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes fxBounce { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-9px); } 70% { transform: translateY(2px); } }
@keyframes fxPopIn { 0% { transform: scale(.4); } 65% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* ============ pseudo-fullscreen fallback (iPhone & blocked API) ============ */
body.no-scroll { overflow: hidden; }
.game-section.pseudo-fs {
  position: fixed; inset: 0; z-index: 200;
  margin: 0; border-radius: 0; border: none;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  overflow-y: auto; padding: 1.5rem;
  background: radial-gradient(800px 400px at 50% -10%, color-mix(in srgb, var(--brand) 25%, transparent), transparent 70%), var(--bg);
}
.game-section.pseudo-fs .game-canvas { width: min(78vmin, 560px); height: auto; }
.game-section.pseudo-fs h2 { font-size: 1.5rem; }

/* ============ mobile ============ */
@media (max-width: 640px) {
  header { padding: .55rem .8rem .45rem; gap: .3rem; }
  header .logo { font-size: 1.05rem; }
  /* nav becomes its own swipeable row under the logo */
  header nav {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: flex-start;
    padding-bottom: .15rem;
  }
  header nav::-webkit-scrollbar { display: none; }
  header nav a { padding: .3rem .65rem; font-size: .82rem; flex: 0 0 auto; }
  header .sub-cta { font-size: .82rem; }
  header .sub-ok { flex: 0 0 auto; font-size: .78rem; }
  #fx-mute { width: 30px; height: 30px; font-size: .85rem; flex: 0 0 auto; }

  main { padding: .9rem .7rem; }
  .hero { padding: 1.6rem .9rem; margin-top: .6rem; border-radius: 16px; }
  .hero h1 { font-size: 1.3rem; }
  .hero p { font-size: .88rem; }
  .section-title { font-size: 1.05rem; margin: 1.6rem 0 .5rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
  .card { padding: .9rem; border-radius: 13px; }
  .card .emoji { font-size: 1.7rem; }
  .card h3 { font-size: .95rem; }
  .card p { font-size: .78rem; }
  .game-section { padding: 1.1rem .7rem; margin: .9rem 0; border-radius: 14px; }
  .game-section h2 { font-size: 1.12rem; }
  button, .btn { padding: .5rem .95rem; font-size: .92rem; }
  .quiz-box { padding: 1.1rem .8rem; }
  .sub-box { padding: 1.3rem 1rem; }
}

/* very narrow phones: scale the wide boards down */
@media (max-width: 380px) {
  .g2048 { grid-template-columns: repeat(4, 60px); }
  .g2-cell { width: 60px; height: 60px; font-size: 1.1rem; }
  .c4-board { grid-template-columns: repeat(7, 36px); }
  .c4-board button { width: 36px; height: 36px; font-size: 1.05rem; }
  .wg-row { grid-template-columns: repeat(5, 46px); }
  .wg-cell { width: 46px; height: 46px; font-size: 1.2rem; }
  .mem { grid-template-columns: repeat(4, 62px); }
  .mem button { width: 62px; height: 62px; font-size: 1.5rem; }
  .sp-board { grid-template-columns: repeat(4, 58px); }
  .sp-board button { width: 58px; height: 58px; font-size: 1.1rem; }
  .ttt { grid-template-columns: repeat(3, 72px); }
  .ttt button { width: 72px; height: 72px; }
  .ttt-wrap { width: 228px; }
  .ms-board { grid-template-columns: repeat(8, 32px); }
  .ms-board button { width: 32px; height: 32px; font-size: .82rem; }
  .rps-hands { gap: 1.6rem; font-size: 2.5rem; }
}
