/* ============================================================
   PlayHub — RETRO ARCADE design system
   Self-hosted OFL fonts · primary palette · hard ink borders
   · offset (no-blur) shadows · CRT scanlines · bento cabinet
   ============================================================ */

/* ---------- self-hosted fonts (OFL, no CDN) ---------- */
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url(/assets/fonts/pressstart2p-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url(/assets/fonts/pressstart2p-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/assets/fonts/spacegrotesk-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/assets/fonts/spacegrotesk-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- design tokens ---------- */
:root {
  /* primary palette (constant across themes) */
  --red:     #e43b44;
  --orange:  #f77622;
  --yellow:  #feae34;
  --gold:    #ffd23f;
  --lime:    #63c74d;
  --green:   #3fb45b;
  --cyan:    #2ce8f5;
  --blue:    #2c6bf5;
  --indigo:  #5a4be8;
  --magenta: #e455c6;
  --pink:    #ff5db1;

  /* CJK-aware font stacks (per-lang overrides below) */
  --cjk: "Apple SD Gothic Neo", "Noto Sans KR", "Hiragino Sans", "Noto Sans JP", "PingFang SC", "Noto Sans SC", "Malgun Gothic", sans-serif;
  --px-bump: 1;
  --font-pixel: 'Press Start 2P', var(--cjk);
  --font-body: 'Space Grotesk', "Helvetica Neue", Arial, var(--cjk);

  /* dark theme (default) */
  --bg:        #12122b;
  --bg-2:      #1a1a3d;
  --panel:     #22224d;
  --panel-2:   #2c2c5e;
  --panel-3:   #383877;
  --ink:       #07071a;               /* hard border + hard shadow ink */
  --ink-soft:  #0d0d28;
  --line:      #4a4a9e;
  --text:      #f4f1e4;               /* off-white */
  --text-soft: #c8c6e8;
  --muted:     #8f8dc4;
  --faint:     #6b6aa0;
  --accent:    var(--cyan);
  --accent-ink:#07071a;

  /* shape + elevation (HARD, no blur) */
  --bw: 3px;                          /* border width */
  --r-sm: 0px;
  --r-md: 0px;
  --r-lg: 0px;
  --sh: 4px 4px 0 var(--ink);
  --sh-lg: 6px 6px 0 var(--ink);
  --sh-sm: 2px 2px 0 var(--ink);
  --overlay-bg: rgba(7, 7, 20, .82);
  --maxw: 1120px;
  --scan: rgba(0, 0, 0, .18);
}
:root { color-scheme: dark; }  /* 다크 전용 — 라이트 모드는 2026-08-15 제거 */


/* per-language CJK-first stacks (Press Start 2P has no CJK glyphs) */
:lang(ko) { --cjk: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif; }
:lang(ko) { --px-bump: 1.26; }
:lang(ja) { --cjk: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif; }
:lang(ja) { --px-bump: 1.26; }
:lang(zh) { --cjk: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif; }
:lang(zh) { --px-bump: 1.26; }
/* 한글·가나·한자는 Press Start 2P에 글리프가 없어 대체 폰트로 떨어진다.
   글자만 바뀌고 공백은 픽셀 폰트에서 와 단어 사이가 1em씩 벌어지므로,
   픽셀 폰트를 쓰는 요소에 한해 좁힌다(본문 문단은 건드리지 않는다). */
:lang(ko) .logo,
:lang(ko) .hero h1,
:lang(ko) .quick-links .ql-label,
:lang(ko) .sec-head h2,
:lang(ko) .gcard-body h3,
:lang(ko) .gcard-genre,
:lang(ko) .gcard-badge,
:lang(ko) .tile-name,
:lang(ko) .tile-new,
:lang(ko) .card h2,
:lang(ko) .genre,
:lang(ko) .ph-splash-name,
:lang(ko) .ph-splash-btn,
:lang(ko) .crumb a,
:lang(ko) .game-main h1,
:lang(ko) .stat .lbl,
:lang(ko) .overlay-box h2,
:lang(ko) .ov-rec-head,
:lang(ko) .ov-next-lbl,
:lang(ko) /* 게임오버·일시정지 오버레이 닫기(×) — 결과를 닫고 판을 다시 보고 싶을 때 */
.overlay-box { position: relative; }
.ov-close { position: absolute; top: 6px; right: 8px; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: var(--fg); opacity: .7;
  font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 0; }
.ov-close:hover, .ov-close:focus-visible { opacity: 1; }
/* 닫아 둔 오버레이는 화면을 가리지 않되, 다시 열 수 있게 작은 배지를 남긴다 */
.ov-reopen { position: absolute; right: 10px; bottom: 10px; z-index: 30; }

/* 홈 상단: 이어하기 + 오늘의 미션 + 앱 설치 */
.ph-daily { display: flex; flex-direction: column; gap: 12px; margin: 4px 0 22px; }
.ph-continue { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  font-family: var(--font-pixel); font-size: calc(.62rem * var(--px-bump)); line-height: 1.5;
  background: var(--cyan); color: var(--ink); padding: 11px 15px;
  border: 3px solid var(--ink); box-shadow: var(--sh-sm); }
.ph-continue:hover { text-decoration: none; transform: translate(-1px,-1px); box-shadow: var(--sh); }
.ph-continue svg { width: 16px; height: 16px; }
.ph-mis { background: var(--bg-2); border: 3px solid var(--ink); box-shadow: var(--sh-sm); padding: 12px 14px; }
.ph-mis-head { font-family: var(--font-pixel); font-size: calc(.6rem * var(--px-bump));
  line-height: 1.5; margin-bottom: 9px; }
.ph-mis-row { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 6px 0; font-size: .92rem; color: var(--fg); border-top: 1px solid rgba(255,255,255,.07); }
a.ph-mis-row:hover { color: var(--cyan); text-decoration: none; }
.ph-mis-row.done { opacity: .55; }
.ph-mis-row.done .ph-mis-st { color: var(--lime); }
.ph-mis-st { white-space: nowrap; font-weight: 700; color: var(--gold, #ffd23f); }
.ph-install { display: flex; gap: 8px; align-items: center; }
.ov-mis { margin-top: 10px; font-size: .9rem; color: #ffd23f; }

/* 주간/전체 랭킹 탭 */
.lb-tabs { display: flex; gap: 8px; margin: 10px 0 12px; }
.lb-tabs .btn.active { background: var(--cyan); color: var(--ink); }

.lb-title,
:lang(ko) .lb-table th,
:lang(ko) .content h2,
:lang(ko) .related h2,
:lang(ko) .site-footer .copy,
:lang(ko) .text-main h1,
:lang(ko) .text-main h2,
:lang(ko) .home-copy h2,
:lang(ko) #stats-root h2,
:lang(ko) .reward-card .rc-lbl,
:lang(ja) .logo,
:lang(ja) .hero h1,
:lang(ja) .quick-links .ql-label,
:lang(ja) .sec-head h2,
:lang(ja) .gcard-body h3,
:lang(ja) .gcard-genre,
:lang(ja) .gcard-badge,
:lang(ja) .tile-name,
:lang(ja) .tile-new,
:lang(ja) .card h2,
:lang(ja) .genre,
:lang(ja) .ph-splash-name,
:lang(ja) .ph-splash-btn,
:lang(ja) .crumb a,
:lang(ja) .game-main h1,
:lang(ja) .stat .lbl,
:lang(ja) .overlay-box h2,
:lang(ja) .ov-rec-head,
:lang(ja) .ov-next-lbl,
:lang(ja) .lb-title,
:lang(ja) .lb-table th,
:lang(ja) .content h2,
:lang(ja) .related h2,
:lang(ja) .site-footer .copy,
:lang(ja) .text-main h1,
:lang(ja) .text-main h2,
:lang(ja) .home-copy h2,
:lang(ja) #stats-root h2,
:lang(ja) .reward-card .rc-lbl,
:lang(zh) .logo,
:lang(zh) .hero h1,
:lang(zh) .quick-links .ql-label,
:lang(zh) .sec-head h2,
:lang(zh) .gcard-body h3,
:lang(zh) .gcard-genre,
:lang(zh) .gcard-badge,
:lang(zh) .tile-name,
:lang(zh) .tile-new,
:lang(zh) .card h2,
:lang(zh) .genre,
:lang(zh) .ph-splash-name,
:lang(zh) .ph-splash-btn,
:lang(zh) .crumb a,
:lang(zh) .game-main h1,
:lang(zh) .stat .lbl,
:lang(zh) .overlay-box h2,
:lang(zh) .ov-rec-head,
:lang(zh) .ov-next-lbl,
:lang(zh) .lb-title,
:lang(zh) .lb-table th,
:lang(zh) .content h2,
:lang(zh) .related h2,
:lang(zh) .site-footer .copy,
:lang(zh) .text-main h1,
:lang(zh) .text-main h2,
:lang(zh) .home-copy h2,
:lang(zh) #stats-root h2,
:lang(zh) .reward-card .rc-lbl {
  word-spacing: -.52em;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  background-image:
    linear-gradient(var(--bg-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-2) 1px, transparent 1px);
  background-size: 34px 34px;
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
/* CRT scanline overlay — light, non-interactive */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg, var(--scan) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
@media (prefers-reduced-motion: no-preference) {
  body::after { animation: ph-flicker 6s steps(60) infinite; }
}
@keyframes ph-flicker { 0%,100% { opacity: 1; } 50% { opacity: .86; } }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
::selection { background: var(--magenta); color: #fff; }
img { max-width: 100%; }
.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ---------- header ---------- */
.site-header {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 2;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-pixel);
  font-size: calc(.98rem * var(--px-bump));
  color: var(--text);
  letter-spacing: 0;
  line-height: 1;
}
.logo:hover { text-decoration: none; }
.logo:hover .logo-mark { transform: translate(-1px,-1px); box-shadow: var(--sh); }
.logo-mark {
  width: 40px; height: 40px;
  background: var(--red);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  transition: transform .1s steps(2), box-shadow .1s steps(2);
}
.logo-mark svg { width: 24px; height: 24px; display: block; image-rendering: pixelated; }
.logo .ph-hi { color: var(--yellow); }
.head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.stats-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
  padding: 7px 12px;
  font-size: .74rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.stats-chip:hover { text-decoration: none; transform: translate(-1px,-1px); box-shadow: var(--sh); }
.stats-chip .chip-ico { width: 15px; height: 15px; display: inline-block; vertical-align: middle; }
.stats-chip .chip-seg { display: inline-flex; align-items: center; gap: 5px; }
.stats-chip .chip-seg + .chip-seg { border-left: 2px solid var(--line); padding-left: 10px; }


.lang-switch select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--panel);
  color: var(--text);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
  padding: 9px 30px 9px 12px;
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.lang-switch select:hover { border-color: var(--accent); }

/* ---------- hero (asymmetric, cabinet marquee) ---------- */
.hero {
  position: relative;
  max-width: var(--maxw);
  margin: 6px auto 0;
  padding: 8px 20px 16px;
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  align-items: center;
  gap: 22px;
}
.hero-copy { min-width: 0; }
.hero h1 {
  font-family: var(--font-pixel);
  font-size: clamp(1.5rem, 5.4vw, 2.9rem);
  line-height: 1.15;
  letter-spacing: 0;
  color: var(--yellow);
  text-shadow: 4px 4px 0 var(--ink);
  -webkit-text-stroke: 1px var(--ink);
  margin-bottom: 4px;
}
.hero h1 .grad { color: var(--cyan); }
.hero .tag {
  color: var(--text);
  margin-top: 16px;
  font-size: clamp(1rem, 2.6vw, 1.18rem);
  font-weight: 700;
  max-width: 30ch;
}
.hero .intro {
  color: var(--text-soft);
  max-width: 46ch;
  margin: 12px 0 0;
  font-size: .92rem;
}
.quick-links {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.quick-links .ql-label {
  color: var(--faint);
  font-family: var(--font-pixel);
  font-size: calc(.56rem * var(--px-bump));
  letter-spacing: .06em;
  text-transform: uppercase;
  width: 100%;
  margin-bottom: 4px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: var(--bw) solid var(--ink);
  color: var(--text);
  padding: 7px 13px;
  font-size: .82rem;
  font-weight: 700;
  box-shadow: var(--sh-sm);
  transition: transform .1s steps(2), box-shadow .1s steps(2);
}
.chip .chip-ico { width: 16px; height: 16px; flex: none; image-rendering: pixelated; }
.chip:hover {
  text-decoration: none;
  transform: translate(-2px, -2px);
  box-shadow: var(--sh);
  border-color: var(--accent);
}

/* hero cabinet artwork (right column) */
.hero-cab {
  position: relative;
  aspect-ratio: 4 / 5;
  /* the games are the point of the page — keep the cabinet art from pushing
     the first row of cards below the fold */
  max-width: 200px;
  margin: 0 0 0 auto;
  width: 100%;
  background:
    repeating-linear-gradient(0deg, transparent 0 7px, rgba(0,0,0,.10) 7px 8px),
    var(--red);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.hero-cab .cab-screen {
  margin: 14px 14px 8px;
  flex: 1;
  background: #05050f;
  border: var(--bw) solid var(--ink);
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.hero-cab .cab-screen svg { width: 78%; height: 78%; image-rendering: pixelated; }
.hero-cab .cab-screen::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.05) 0 1px, transparent 1px 3px);
  pointer-events: none;
}
.hero-cab .cab-panel {
  height: 24%;
  margin: 0 14px 16px;
  border: var(--bw) solid var(--ink);
  background: var(--panel-2);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  justify-items: center;
  gap: 14px;
  padding: 8px 18px;
}
.hero-cab .cab-btn {
  width: 74%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: var(--bw) solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
.hero-cab .cab-btn:nth-child(1) { background: var(--red); }
.hero-cab .cab-btn:nth-child(2) { background: var(--yellow); }
.hero-cab .cab-btn:nth-child(3) { background: var(--cyan); }

/* short viewports (laptops, landscape phones): drop the decorative cabinet
   so the game grid starts near the top */
@media (max-height: 640px) {
  .hero-cab { display: none; }
  .hero { grid-template-columns: 1fr; padding-bottom: 8px; }
}

/* ---------- key-art game cards ---------- */
.home-sec { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.home-sec + .home-sec { margin-top: 30px; }

/* 홈 리드 문단 — 카드 격자 위. 홈에 그림만 있고 사이트를 설명하는 글이
   한 줄도 없던 것을 메운다. 격자와 같은 폭에 맞추되 읽기 좋은 길이로 자른다. */
.home-lead {
  max-width: var(--maxw); margin: 0 auto 26px; padding: 0 20px;
  color: var(--text-soft); font-size: 1.02rem; line-height: 1.75;
}
.home-lead > * { max-width: 68ch; }

/* 홈 본문 — 카드 격자 아래 편집 글. 문단 폭은 본문 페이지(.text-main)와
   같은 기준으로 잡아 사이트 전체에서 읽는 리듬이 어긋나지 않게 한다. */
.home-copy {
  max-width: var(--maxw); margin: 34px auto 0; padding: 0 20px;
}
.home-copy + .home-copy { margin-top: 26px; }
.home-copy h2 {
  font-family: var(--font-pixel); font-size: calc(.86rem * var(--px-bump));
  line-height: 1.5; color: var(--text); margin: 0 0 12px;
}
.home-copy p {
  max-width: 72ch; color: var(--text-soft); line-height: 1.75; margin: 0 0 12px;
}
.home-copy p:last-child { margin-bottom: 0; }
.sec-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 0 14px;
}
.sec-head h2 {
  font-family: var(--font-pixel); font-size: calc(.86rem * var(--px-bump)); line-height: 1.5;
  color: var(--text);
}
.sec-head .sec-count { color: var(--faint); font-size: .8rem; font-weight: 700; }

.gcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.gcard {
  position: relative; display: block; text-decoration: none; color: var(--text);
  background: var(--panel); border: var(--bw) solid var(--ink); box-shadow: var(--sh);
  overflow: hidden;
  transition: transform .1s steps(2), box-shadow .1s steps(2);
}
.gcard:hover, .gcard:focus-visible { transform: translate(-3px, -3px); box-shadow: var(--sh-lg); text-decoration: none; }
.gcard:active { transform: translate(1px, 1px); }
/* key art: per-game gradient set from --c1/--c2 inline, plus a pixel grid wash */
.gcard-art {
  position: relative; aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--c1, #2c6bf5), var(--c2, #e455c6));
  border-bottom: var(--bw) solid var(--ink);
}
.gcard-art::before {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(7,7,26,.18) 2px, transparent 2px),
                    linear-gradient(90deg, rgba(7,7,26,.18) 2px, transparent 2px);
  background-size: 14px 14px;
}
.gcard-art svg { position: relative; width: 46%; max-width: 108px; height: auto; image-rendering: pixelated;
  filter: drop-shadow(4px 4px 0 rgba(7,7,26,.55)); }
/* captured 3D game screenshots — real renders, not pixel art */
.gcard-art.gshot { background: var(--bg-2); }
.gcard-art.gshot img { position: relative; width: 100%; height: 100%; object-fit: cover; display: block; }
.gcard-art.gshot::before { opacity: .18; }

/* full-bleed key-art thumbnails (tools/thumbs.py scenes) */
.gcard-art.gthumb { background: var(--bg-2); }
.gcard-art.gthumb svg { width: 100%; height: 100%; max-width: none; filter: none; display: block; }
.gcard-art.gthumb::before { opacity: .5; }
.gcard-body { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 13px; }
.gcard-body h3 { font-family: var(--font-pixel); font-size: calc(.72rem * var(--px-bump)); line-height: 1.5; word-break: keep-all; }
.gcard-genre {
  flex: none; font-family: var(--font-pixel); font-size: calc(.50rem * var(--px-bump));
  background: var(--gold); color: var(--ink); padding: 4px 6px; border: 2px solid var(--ink);
}
.gcard-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: var(--red); color: var(--text);
  font-family: var(--font-pixel); font-size: calc(.52rem * var(--px-bump));
  padding: 5px 7px; border: 2px solid var(--ink); box-shadow: var(--sh-sm);
}
.gcard-badge.hot { background: var(--orange); }
/* 같은 게임의 구버전(2D)임을 알리는 배지 — 3D판과 헷갈리지 않게 */
.gcard-badge.two-d { background: var(--bg-2); color: var(--fg); }
/* 게임 페이지 하단 관련 게임 — 홈 카드와 같은 격자를 재사용한다 */
.related { margin: 34px 0 8px; }
.related h2 { font-family: var(--font-pixel); font-size: calc(.86rem * var(--px-bump));
  line-height: 1.5; margin-bottom: 14px; }
body.ph-fs .related { display: none; }

/* 2D ↔ 3D 서로 건너가는 링크 */
.ph-variant { display: flex; justify-content: center; margin: 14px 0 4px; }
.ph-variant a { display: inline-flex; align-items: center; gap: 8px; }
body.ph-fs .ph-variant { display: none; }
@media (max-width: 620px) {
  .home-sec { padding: 0 14px; }
  .gcards { grid-template-columns: 1fr 1fr; gap: 12px; }
  .gcard-body { padding: 9px 10px; }
  .gcard-body h3 { font-size: calc(.72rem * var(--px-bump)); }
  .gcard-genre { display: none; }
}
@media (max-width: 330px) {
  .gcards { grid-template-columns: 1fr; }
  .gcard-body h3 { font-size: calc(.72rem * var(--px-bump)); }
  .gcard-genre { display: inline-block; }
}

/* ---------- app-style launcher ---------- */
.launcher {
  max-width: var(--maxw);
  margin: 16px auto 46px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 14px;
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 16px 6px 12px;
  background: var(--panel);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh);
  color: var(--text);
  text-decoration: none;
  transition: transform .1s steps(2), background .1s steps(2);
}
.tile:hover, .tile:focus-visible { transform: translate(-2px, -2px); background: var(--panel-2); }
.tile:active { transform: translate(1px, 1px); }
.tile-ico { width: 58px; height: 58px; display: block; }
.tile-ico svg { width: 100%; height: 100%; image-rendering: pixelated; }
.tile-name { font-family: var(--font-pixel); font-size: calc(.78rem * var(--px-bump)); line-height: 1.5; text-align: center; word-break: keep-all; }
.tile-new {
  position: absolute; top: -7px; right: -7px;
  background: var(--red); color: var(--text);
  font-family: var(--font-pixel); font-size: calc(.52rem * var(--px-bump));
  padding: 4px 5px; border: 2px solid var(--ink);
}
@media (max-width: 560px) {
  .launcher { padding: 0 14px; gap: 10px; grid-template-columns: repeat(3, 1fr); }
  .tile { padding: 12px 4px 10px; }
  .tile-ico { width: 52px; height: 52px; }
  .tile-name { font-size: calc(.78rem * var(--px-bump)); }
}

/* ---------- bento game grid ---------- */
.grid {
  max-width: var(--maxw);
  margin: 14px auto 44px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  position: relative;
  z-index: 1;
}
.card {
  position: relative;
  background: var(--panel);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh);
  padding: 14px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: transform .1s steps(2), box-shadow .1s steps(2);
  overflow: hidden;
}
/* bento emphasis — first tile is a 2x2 feature, a couple span 2 cols */
.card.feat { grid-column: span 2; grid-row: span 2; }
.card.wide { grid-column: span 2; }
a.card:hover, a.card:focus-visible {
  text-decoration: none;
  transform: translate(-3px, -3px);
  box-shadow: var(--sh-lg);
  border-color: var(--accent);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card h2 {
  font-family: var(--font-pixel);
  font-size: calc(.80rem * var(--px-bump));
  line-height: 1.35;
  color: var(--text);
}
.card.feat h2 { font-size: 1rem; }
.genre {
  flex: none;
  font-family: var(--font-pixel);
  font-size: calc(.52rem * var(--px-bump));
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid var(--ink);
  padding: 4px 7px;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.card p.blurb { color: var(--text-soft); font-size: .84rem; flex: 1; line-height: 1.5; }
.card.feat p.blurb { font-size: .95rem; }
.badges { display: flex; gap: 7px; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .68rem;
  font-weight: 700;
  border: 2px solid var(--ink);
  padding: 3px 8px;
  background: var(--panel-2);
  color: var(--muted);
}
.badge.best { background: var(--gold); color: var(--ink); }
.badge svg { width: 11px; height: 11px; }

/* ---------- card art (pure CSS pixel scenes) ---------- */
.card-art {
  position: relative;
  height: 116px;
  border: var(--bw) solid var(--ink);
  overflow: hidden;
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
  image-rendering: pixelated;
}
.card.feat .card-art { height: 200px; }
.card-art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.12) 0 2px, transparent 2px 4px);
}
.card-art i, .card-art span { position: absolute; display: block; }

/* 2048 */
.art-2048 {
  background: #1b1030;
  display: grid;
  grid-template-columns: repeat(2, 46px);
  justify-content: center;
  align-content: center;
  gap: 5px;
}
.art-2048 span {
  position: static;
  width: 46px; height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
  font-size: .62rem;
  color: #fff;
  border: 3px solid var(--ink);
  transition: transform .15s steps(2);
}
.art-2048 .t2 { background: var(--blue); }
.art-2048 .t4 { background: var(--indigo); }
.art-2048 .t8 { background: var(--magenta); }
.art-2048 .t16 { background: var(--red); font-size: .5rem; }
a.card:hover .art-2048 .t2 { transform: translate(-2px,-2px); }
a.card:hover .art-2048 .t16 { transform: translate(2px,2px); }

/* snake */
.art-snake { background: #0a2018; }
.art-snake i { width: 18px; height: 18px; border: 3px solid var(--ink); background: var(--lime); }
.art-snake .s1 { left: 26px; top: 62px; background: var(--cyan); }
.art-snake .s2 { left: 46px; top: 62px; }
.art-snake .s3 { left: 66px; top: 62px; }
.art-snake .s4 { left: 66px; top: 42px; }
.art-snake .s5 { left: 66px; top: 22px; }
.art-snake .food { width: 16px; height: 16px; background: var(--red); right: 42px; top: 60px; }
a.card:hover .art-snake .food { animation: ph-blink .5s steps(1) infinite; }

/* breakout */
.art-breakout { background: #141033; }
.art-breakout .row { height: 12px; left: 16px; right: 16px; border: 2px solid var(--ink); }
.art-breakout .r1 { top: 14px; background: var(--red); }
.art-breakout .r2 { top: 30px; background: var(--yellow); }
.art-breakout .r3 { top: 46px; background: var(--lime); }
.art-breakout .paddle { bottom: 12px; left: 50%; width: 50px; height: 10px; margin-left: -25px; background: var(--cyan); border: 3px solid var(--ink); }
.art-breakout .ball { width: 12px; height: 12px; background: var(--gold); left: 50%; bottom: 30px; margin-left: -6px; border: 2px solid var(--ink); }
a.card:hover .art-breakout .ball { animation: ph-bounce .5s steps(2) infinite alternate; }

/* minesweeper */
.art-mine {
  background: #201540;
  display: grid;
  grid-template-columns: repeat(3, 28px);
  gap: 4px;
  justify-content: center;
  align-content: center;
}
.art-mine i {
  position: static;
  width: 28px; height: 28px;
  background: var(--panel-3);
  border: 3px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-style: normal; font-weight: 800; font-size: .78rem;
  font-family: var(--font-pixel);
}
.art-mine .open { background: #100a24; }
.art-mine .n1 { color: var(--cyan); font-size: .6rem; }
.art-mine .n2 { color: var(--lime); font-size: .6rem; }
.art-mine .flagged { position: relative; }
.art-mine .flagged::before { content: ""; width: 0; height: 0; border-left: 10px solid var(--red); border-top: 6px solid transparent; border-bottom: 6px solid transparent; margin-left: 2px; }
.art-mine .boom-cell { background: var(--red); }
.art-mine .boom-cell::before { content: ""; width: 12px; height: 12px; background: var(--ink); }
a.card:hover .art-mine .flagged { transform: translateY(-2px); }

/* memory */
.art-memory { background: #2a1040; }
.art-memory i {
  width: 48px; height: 62px;
  border: 3px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-style: normal; font-weight: 800; font-size: 1.4rem;
  font-family: var(--font-pixel);
}
.art-memory .mcb { background: var(--indigo); color: var(--cyan); transform: translateX(-28px) rotate(-6deg); }
.art-memory .mcf { background: var(--panel); transform: translateX(28px) rotate(6deg); }
.art-memory .mcf::before {
  content: ""; width: 26px; height: 26px; background: var(--gold);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
a.card:hover .art-memory .mcf { transform: translateX(28px) rotate(6deg) translateY(-3px); }

/* gomoku */
.art-gomoku {
  background:
    repeating-linear-gradient(0deg, transparent 0 17px, var(--ink) 17px 19px),
    repeating-linear-gradient(90deg, transparent 0 17px, var(--ink) 17px 19px),
    var(--orange);
}
.art-gomoku i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--ink); }
.art-gomoku .stb { background: #1a1a1a; }
.art-gomoku .stw { background: #f4f1e4; }
.art-gomoku .g1 { left: 42px; top: 24px; }
.art-gomoku .g2 { left: 62px; top: 44px; }
.art-gomoku .g3 { left: 82px; top: 64px; }
.art-gomoku .g4 { left: 62px; top: 24px; }
.art-gomoku .g5 { left: 42px; top: 64px; }
a.card:hover .art-gomoku .g3 { transform: scale(1.2); }

/* reaction */
.art-reaction { background: #0f3b24; }
.art-reaction .ring { width: 66px; height: 66px; border-radius: 50%; border: 4px solid var(--lime); left: 50%; top: 50%; transform: translate(-50%,-50%); }
.art-reaction .bolt {
  width: 30px; height: 44px; left: 50%; top: 50%; transform: translate(-50%,-52%);
  background: var(--gold);
  clip-path: polygon(62% 0, 18% 55%, 44% 55%, 34% 100%, 82% 42%, 54% 42%);
}
a.card:hover .art-reaction .ring { animation: ph-ring 1s steps(6) infinite; }

/* simon */
.art-simon {
  background: #100a24;
  display: grid;
  grid-template-columns: repeat(2, 42px);
  gap: 6px;
  justify-content: center;
  align-content: center;
}
.art-simon i { position: static; width: 42px; height: 42px; border: 3px solid var(--ink); opacity: .55; }
.art-simon .sq0 { background: var(--red); }
.art-simon .sq1 { background: var(--lime); }
.art-simon .sq2 { background: var(--yellow); }
.art-simon .sq3 { background: var(--blue); }
a.card:hover .art-simon .sq0 { animation: ph-lit 1.2s steps(1) infinite; }
a.card:hover .art-simon .sq1 { animation: ph-lit 1.2s steps(1) .3s infinite; }
a.card:hover .art-simon .sq3 { animation: ph-lit 1.2s steps(1) .6s infinite; }
a.card:hover .art-simon .sq2 { animation: ph-lit 1.2s steps(1) .9s infinite; }

/* flappy */
.art-flappy { background: #143a5a; }
.art-flappy .pipe { width: 24px; background: var(--lime); border: 3px solid var(--ink); }
.art-flappy .pt { top: 0; height: 34px; right: 30px; }
.art-flappy .pb { bottom: 0; height: 40px; right: 30px; }
.art-flappy .bird { width: 20px; height: 20px; background: var(--gold); border: 3px solid var(--ink); left: 34px; top: 48px; }
a.card:hover .art-flappy .bird { animation: ph-bounce .4s steps(2) infinite alternate; }

/* stack */
.art-stack { background: #241338; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 10px; gap: 3px; }
.art-stack i { position: static; height: 15px; border: 3px solid var(--ink); }
.art-stack .b1 { width: 74px; background: var(--red); }
.art-stack .b2 { width: 66px; background: var(--orange); }
.art-stack .b3 { width: 70px; background: var(--yellow); }
.art-stack .b4 { width: 58px; background: var(--lime); }
.art-stack .b5 { width: 62px; background: var(--cyan); }
a.card:hover .art-stack .b5 { transform: translateX(6px); }

/* rhythm */
.art-rhythm { background: #3a1030; display: flex; align-items: flex-end; justify-content: center; gap: 6px; padding-bottom: 12px; }
.art-rhythm i { position: static; width: 16px; border: 3px solid var(--ink); }
.art-rhythm .k1 { height: 30px; background: var(--red); }
.art-rhythm .k2 { height: 54px; background: var(--yellow); }
.art-rhythm .k3 { height: 40px; background: var(--cyan); }
.art-rhythm .k4 { height: 64px; background: var(--magenta); }
a.card:hover .art-rhythm .k2 { animation: ph-bounce .3s steps(2) infinite alternate; }
a.card:hover .art-rhythm .k4 { animation: ph-bounce .4s steps(2) infinite alternate; }

/* puzzle (sliding) */
.art-puzzle { background: #10243a; display: grid; grid-template-columns: repeat(3, 30px); gap: 4px; justify-content: center; align-content: center; }
.art-puzzle i {
  position: static; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-pixel); font-size: .56rem; color: #fff;
  background: var(--blue); border: 3px solid var(--ink);
}
.art-puzzle .hole { background: transparent; border-color: transparent; }
.art-puzzle .p2 { background: var(--indigo); }
.art-puzzle .p3 { background: var(--cyan); color: var(--ink); }
a.card:hover .art-puzzle .p3 { transform: translateX(-6px); }

/* whack (mole mash) */
.art-whack { background: #1a5c2e; }
.art-whack .hole { width: 30px; height: 15px; background: #2a140a; border: 3px solid var(--ink); bottom: 20px; }
.art-whack .hl { left: 22px; }
.art-whack .hr { right: 22px; }
.art-whack .mole { width: 26px; height: 26px; background: var(--orange); border: 3px solid var(--ink); left: 50%; margin-left: -13px; bottom: 30px; }
.art-whack .mole::before { content: ""; position: absolute; left: 4px; top: 6px; width: 4px; height: 4px; background: var(--ink); box-shadow: 10px 0 var(--ink); }
a.card:hover .art-whack .mole { animation: ph-bounce .35s steps(2) infinite alternate; }

/* tiles (tap tiles) */
.art-tiles { background: #f4f1e4; display: flex; justify-content: center; gap: 4px; padding: 10px 16px; }
.art-tiles .tl { position: static; width: 22px; background: var(--ink); border: 3px solid var(--ink); }
.art-tiles .a { height: 46px; margin-top: 10px; }
.art-tiles .b { height: 62px; }
.art-tiles .c { height: 40px; margin-top: 20px; }
.art-tiles .d { height: 56px; margin-top: 4px; }
a.card:hover .art-tiles .b { transform: translateY(6px); }

/* bubble (bubble pop) */
.art-bubble { background: #101a3a; display: grid; grid-template-columns: repeat(3, 26px); gap: 6px; justify-content: center; align-content: center; }
.art-bubble .bub { position: static; width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--ink); }
.art-bubble .c1, .art-bubble .c2, .art-bubble .c4 { background: var(--cyan); }
.art-bubble .c3, .art-bubble .c5 { background: var(--magenta); }
.art-bubble .c6 { background: var(--gold); }
a.card:hover .art-bubble .c1 { transform: scale(1.15); }
a.card:hover .art-bubble .c4 { transform: scale(1.15); }

/* jump (one-touch jump) */
.art-jump { background: #141b3a; }
.art-jump .plat { height: 10px; background: var(--lime); border: 3px solid var(--ink); }
.art-jump .p1 { width: 40px; left: 16px; bottom: 20px; }
.art-jump .p2 { width: 40px; right: 20px; bottom: 48px; }
.art-jump .p3 { width: 36px; left: 30px; top: 18px; }
.art-jump .hopper { width: 20px; height: 20px; background: var(--gold); border: 3px solid var(--ink); left: 26px; bottom: 30px; }
a.card:hover .art-jump .hopper { animation: ph-bounce .4s steps(2) infinite alternate; }

/* fruit (fruit slice) */
.art-fruit { background: #2a1030; }
.art-fruit .fr { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--ink); }
.art-fruit .fa { background: var(--red); left: 20px; top: 24px; }
.art-fruit .fb { background: var(--gold); right: 24px; bottom: 20px; }
.art-fruit .bomb { width: 24px; height: 24px; background: var(--ink); border: 3px solid #555; border-radius: 50%; left: 50%; margin-left: -12px; top: 12px; }
.art-fruit .blade { width: 3px; height: 120%; background: var(--cyan); left: 30%; top: -10%; transform: rotate(28deg); opacity: .8; }
a.card:hover .art-fruit .fa { transform: translate(-4px,-4px) rotate(-12deg); }
a.card:hover .art-fruit .fb { transform: translate(4px,4px) rotate(12deg); }

/* colorswitch */
.art-colorswitch { background: #0b0b22; }
.art-colorswitch .csring { width: 74px; height: 74px; border-radius: 50%; left: 50%; top: 50%; transform: translate(-50%,-50%); border: 8px solid var(--red); border-right-color: var(--lime); border-bottom-color: var(--blue); border-left-color: var(--gold); }
.art-colorswitch .csball { width: 18px; height: 18px; border-radius: 50%; background: var(--lime); border: 3px solid var(--ink); left: 50%; margin-left: -9px; bottom: 16px; }
a.card:hover .art-colorswitch .csring { animation: ph-spin 3s linear infinite; }

@keyframes ph-spin { to { transform: translate(-50%,-50%) rotate(360deg); } }

@keyframes ph-blink { 50% { opacity: 0; } }
@keyframes ph-bounce { from { transform: translateY(0); } to { transform: translateY(-14px); } }
@keyframes ph-ring { from { opacity: 1; transform: translate(-50%,-50%) scale(1); } to { opacity: 0; transform: translate(-50%,-50%) scale(1.5); } }
@keyframes ph-lit { 0%,60%,100% { opacity: .55; } 20% { opacity: 1; } }

/* ad cards */
.ad-card {
  align-items: center;
  justify-content: center;
  min-height: 240px;
  background: var(--bg-2);
  border-style: dashed;
}
.ad-card .ad-tag {
  color: var(--faint);
  font-family: var(--font-pixel);
  font-size: .5rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.ad-card ins { width: 100%; }

/* ---------- play splash (start gate over the game) ---------- */
.ph-splash {
  position: absolute; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(7, 7, 26, .78);
}
/* solid card: without a background the splash text visually mixes with the
   dimmed hud/mode buttons behind the translucent overlay (worst on phones) */
.ph-splash-inner {
  text-align: center; padding: 22px 26px; max-width: 92%;
  background: var(--panel); border: var(--bw) solid var(--ink); box-shadow: var(--sh);
}
.ph-splash-name {
  font-family: var(--font-pixel); font-size: 1rem; line-height: 1.5;
  color: var(--yellow); text-shadow: 3px 3px 0 var(--ink); margin-bottom: 18px;
}
.ph-splash-btn {
  font-family: var(--font-pixel); font-size: .9rem; line-height: 1.4;
  background: var(--lime); color: var(--ink);
  border: var(--bw) solid var(--ink); box-shadow: var(--sh);
  padding: 16px 30px; cursor: pointer;
  transition: transform .08s steps(2);
  animation: ph-splash-pulse 1.6s ease-in-out infinite;
}
.ph-splash-btn:hover, .ph-splash-btn:focus-visible { transform: translate(-2px, -2px); }
.ph-splash-btn:active { transform: translate(2px, 2px); animation: none; }
@keyframes ph-splash-pulse { 0%,100% { box-shadow: var(--sh); } 50% { box-shadow: 0 0 0 6px rgba(99,199,77,.28), var(--sh); } }
.ph-splash-hint {
  margin-top: 16px; color: var(--text-soft); font-weight: 600; font-size: .88rem; line-height: 1.6;
}
@media (prefers-reduced-motion: reduce) { .ph-splash-btn { animation: none; } }

/* ---------- immersive fullscreen game mode ---------- */
body.ph-fs { overflow: hidden; }
body.ph-fs .site-header, body.ph-fs .site-footer, body.ph-fs .ch-banner,
body.ph-fs .game-main > *:not(.game-shell) { display: none !important; }
body.ph-fs .game-main { max-width: none; padding: 0; margin: 0; }
body.ph-fs .game-shell {
  position: fixed; inset: 0; z-index: 3000; margin: 0; border: 0; box-shadow: none;
  /* dvh tracks the collapsing iOS address bar, so the hud never slides
     under it the way a plain 100vh/inset:0 box does */
  height: 100dvh;
  display: flex; flex-direction: column; overflow: auto;
  /* respect notches/home indicator so the hud is never cut off */
  padding: calc(8px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right))
           calc(8px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left));
  background: var(--bg);
}
body.ph-fs .hud { flex: none; margin-bottom: 8px; }
body.ph-fs #game-root {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center;
  /* safe center keeps overflow reachable instead of clipping the top */
  justify-content: center; justify-content: safe center;
}
body.ph-fs #game-root > * { flex: none; }
/* never rescale the canvas from CSS: games map touches through
   getBoundingClientRect, and object-fit/max-width letterboxing would offset
   every tap from what is actually drawn */

/* "turn your phone" nudge for wide games held in portrait */
.rotate-hint {
  display: none;
  align-items: center; justify-content: center; gap: 8px;
  flex: none;
  margin: 0 auto 8px; padding: 9px 14px;
  background: var(--panel-2); border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
  font-family: var(--font-pixel); font-size: .56rem; line-height: 1.6;
  color: var(--gold); text-align: center;
}
.rotate-hint.show { display: flex; }
.rotate-hint .rh-ico { font-size: 1rem; animation: rh-tilt 1.8s ease-in-out infinite; }
@keyframes rh-tilt { 0%,60%,100% { transform: rotate(0deg); } 80% { transform: rotate(-90deg); } }

/* ---------- game page ---------- */
.game-main { max-width: 900px; margin: 0 auto; padding: 8px 20px 48px; position: relative; z-index: 1; }
/* desktop monitors: let the board breathe instead of sitting in a 900px column */
@media (min-width: 1080px) { .game-main { max-width: 1180px; } }
@media (min-width: 1500px) { .game-main { max-width: 1320px; } }
.crumb { margin-bottom: 12px; }
.crumb a {
  color: var(--muted);
  font-family: var(--font-pixel);
  font-size: calc(.62rem * var(--px-bump));
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.crumb a:hover { color: var(--accent); text-decoration: none; }
.game-main h1 {
  font-family: var(--font-pixel);
  font-size: clamp(1.1rem, 4vw, 1.7rem);
  line-height: 1.3;
  color: var(--yellow);
  text-shadow: 3px 3px 0 var(--ink);
}
.game-main .tagline { color: var(--text-soft); margin: 10px 0 16px; font-weight: 600; }

.game-shell {
  background: var(--bg-2);
  border: var(--bw) solid var(--ink);
  padding: 14px;
  position: relative;
  box-shadow: var(--sh);
}
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.hud-left { display: flex; gap: 8px; flex-wrap: wrap; }
.stat {
  background: var(--panel);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
  padding: 6px 14px;
  min-width: 88px;
  text-align: center;
}
.stat .lbl {
  display: block;
  color: var(--faint);
  font-family: var(--font-pixel);
  font-size: calc(.60rem * var(--px-bump));
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.stat b { font-family: var(--font-pixel); font-size: calc(.88rem * var(--px-bump)); color: var(--text); line-height: 1.3; }
.stat.gold b { color: var(--gold); }
.hud-right { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  background: var(--panel);
  color: var(--text);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
  padding: 8px 15px;
  font-family: var(--font-body);
  font-size: .86rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s steps(2), box-shadow .08s steps(2);
}
.btn:hover { transform: translate(-1px,-1px); box-shadow: var(--sh); }
.btn:active { transform: translate(2px,2px); box-shadow: none; }
.btn:disabled { opacity: .45; cursor: default; box-shadow: var(--sh-sm); transform: none; }
.btn.primary { background: var(--red); color: #fff; }
.btn.small { padding: 6px 11px; font-size: .78rem; }
.btn.active { background: var(--cyan); color: var(--ink); }

#game-root { display: flex; flex-direction: column; align-items: center; gap: 12px; }
#game-root canvas {
  max-width: 100%;
  touch-action: none;
  display: block;
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh);
  image-rendering: pixelated;
}

/* ---- mobile touch hardening (applies to every game surface) ----
   Kill the grey tap flash, block double-tap-to-zoom and text selection on
   interactive elements, and stop taps/drags on game boards from scrolling the
   page or triggering pull-to-refresh. */
.btn, .simon-pad, .ms-cell, .mem-card, .lang-switch select { -webkit-tap-highlight-color: transparent; }
.btn, .simon-pad, .ms-cell, .mem-card {
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
/* .rx-half is the actual tap target — touch-action does not inherit from
   .rx-duel, so it has to be listed here too */
#game-root, .ms-grid, .mem-grid, .simon-wrap, .rx-area, .rx-duel, .rx-half {
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: contain;
}
/* comfortable finger targets: control buttons stay >=44px tall on touch */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn.small { min-height: 44px; padding: 8px 13px; }
  /* starting size only — minesweeper.js re-sizes cells to fit the width
     (30-44px) once it runs, so this just avoids a tiny first paint */
  .ms-cell { width: 34px; height: 34px; }
  /* text fields need the same finger-sized box as the buttons beside them */
  .lb-submit input, .lb-submit button,
  .ov-rec-row input, .ov-rec-row .btn { min-height: 44px; }
  .crumb a { padding: 6px 2px; }
}
.sub-controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.game-msg { color: var(--text-soft); font-size: .9rem; text-align: center; min-height: 1.5em; font-weight: 600; }

/* overlay */
.overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 16px;
}
.overlay.hidden { display: none; }
.overlay-box {
  text-align: center;
  padding: 26px 24px;
  background: var(--panel);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-lg);
  max-width: 92%;
  /* the on-screen keyboard shrinks the viewport when the name field is
     focused — keep the whole box reachable instead of clipping it */
  max-height: 100%;
  overflow-y: auto;
  animation: ph-pop .18s steps(3);
}
@keyframes ph-pop { from { transform: translate(-4px,-4px); } }
.overlay-box h2 {
  font-family: var(--font-pixel);
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: var(--yellow);
  line-height: 1.3;
}
.overlay-box p { color: var(--text-soft); margin-bottom: 16px; white-space: pre-line; font-size: .92rem; }
.overlay-box .btn { font-size: .95rem; padding: 11px 24px; }

/* reward toast (progression) */
.ph-toast-wrap {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 10000; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none; width: max-content; max-width: 92vw;
}
.ph-toast {
  background: var(--panel); color: var(--text);
  border: var(--bw) solid var(--ink); box-shadow: var(--sh);
  padding: 9px 15px; font-weight: 700; font-size: .84rem;
  display: flex; align-items: center; gap: 9px;
  animation: ph-toast-in .2s steps(3);
}
.ph-toast .t-ico { width: 18px; height: 18px; flex: none; }
.ph-toast.xp { border-color: var(--cyan); }
.ph-toast.coin { border-color: var(--gold); }
.ph-toast.level { border-color: var(--magenta); }
.ph-toast.ach { border-color: var(--lime); }
@keyframes ph-toast-in { from { transform: translateY(14px); opacity: 0; } }

/* XP / level bar (hud + stats) */
.ph-levelbar { display: flex; align-items: center; gap: 8px; font-size: .72rem; font-weight: 700; }
.ph-levelbar .lv {
  font-family: var(--font-pixel); font-size: calc(.60rem * var(--px-bump)); color: var(--ink);
  background: var(--cyan); border: 2px solid var(--ink); padding: 3px 6px; flex: none;
}
.ph-xp-track { flex: 1; height: 12px; background: var(--panel-2); border: 2px solid var(--ink); min-width: 90px; overflow: hidden; }
.ph-xp-fill { height: 100%; background: var(--cyan); width: 0; transition: width .4s steps(8); }
.ph-coin { display: inline-flex; align-items: center; gap: 5px; color: var(--gold); }
.ph-coin svg { width: 14px; height: 14px; }

/* minesweeper board */
.board-scroll { max-width: 100%; overflow-x: auto; padding-bottom: 4px; }
.ms-grid { display: grid; gap: 3px; user-select: none; -webkit-user-select: none; }
.ms-cell {
  width: 30px; height: 30px;
  background: var(--panel-3);
  border: 3px solid var(--ink);
  font-family: var(--font-pixel);
  font-size: .62rem;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
}
.ms-cell:not(.open):hover { background: var(--panel-2); }
.ms-cell.open { background: var(--bg-2); cursor: default; }
.ms-cell.boom { background: var(--red); }
.ms-c1 { color: var(--cyan); } .ms-c2 { color: var(--lime); } .ms-c3 { color: var(--red); }
.ms-c4 { color: var(--indigo); } .ms-c5 { color: var(--orange); } .ms-c6 { color: var(--cyan); }
.ms-c7 { color: var(--text); } .ms-c8 { color: var(--muted); }

/* memory board */
.mem-grid { display: grid; gap: 8px; width: 100%; max-width: 480px; }
.mem-card { aspect-ratio: 1; perspective: 500px; cursor: pointer; border: 0; background: transparent; padding: 0; }
.mem-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .3s steps(4); }
.mem-card.flip .mem-inner { transform: rotateY(180deg); }
.mem-face {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  border: var(--bw) solid var(--ink);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  font-size: clamp(1.2rem, 5vw, 2rem);
}
.mem-back { background: var(--indigo); color: var(--cyan); font-family: var(--font-pixel); font-size: .9rem; }
.mem-front { background: var(--panel); transform: rotateY(180deg); }
.mem-ico { width: 64%; height: 64%; image-rendering: pixelated; }
.ms-cell .cell-ico { width: 74%; height: 74%; image-rendering: pixelated; }
.btn .cell-ico { width: 13px; height: 13px; vertical-align: -1px; }
/* HUD 토글(효과음·배경음악·전체화면): 아이콘만 있으면 무슨 버튼인지 안 보인다.
   아이콘 + 글자 라벨을 붙이고 ON/OFF를 색으로 뚜렷하게 구분한다. */
.ph-toggle { display: inline-flex; align-items: center; gap: 6px; }
.ph-toggle svg { width: 15px; height: 15px; display: block; flex: none; }
.ph-toggle.is-on { background: var(--cyan); color: var(--ink); }
.ph-toggle.is-off { opacity: .62; }
/* 음악은 켜졌지만 효과음 스위치가 꺼져 소리가 나지 않는 상태.
   "켜짐"으로 보이는데 조용해서 고장으로 오인되던 것을 구분해 준다. */
.ph-toggle.is-muted {
  background: transparent;
  color: inherit;
  opacity: .62;
  border-style: dashed;
}

/* 첫 방문 1회 안내 말풍선 — 배경음악이 있다는 걸 알리는 용도 */
.ph-music-hint {
  position: relative;
  align-self: center;
  margin-left: 6px;
  padding: 5px 9px;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .45);
  animation: ph-hint-in .18s ease-out;
}
.ph-music-hint::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 50%;
  width: 0;
  height: 0;
  transform: translateY(-50%);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 6px solid var(--yellow);
}
@keyframes ph-hint-in {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: none; }
}
@media (max-width: 520px) {
  /* 좁은 화면에서는 버튼 줄이 접히므로 말풍선이 줄을 밀지 않게 한다 */
  .ph-music-hint { font-size: 11px; padding: 4px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .ph-music-hint { animation: none; }
}
.lb-title .chip-ico { width: 16px; height: 16px; vertical-align: -2px; }
.mem-card.done .mem-front { background: var(--lime); opacity: .8; }

/* reaction */
.rx-area {
  width: 100%; max-width: 560px; height: 300px;
  border: var(--bw) solid var(--ink); box-shadow: var(--sh);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; cursor: pointer;
  font-family: var(--font-pixel); font-size: 1rem; line-height: 1.5;
  text-align: center; padding: 16px;
  user-select: none; -webkit-user-select: none;
}
.rx-idle { background: var(--panel); }
.rx-wait { background: var(--red); color: #fff; }
.rx-go { background: var(--lime); color: var(--ink); }
.rx-result { font-family: var(--font-body); font-size: .95rem; font-weight: 600; opacity: .9; }
.rx-idle .rx-result { color: var(--text-soft); opacity: 1; }

/* simon */
.simon-wrap {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  width: min(320px, 80vw); padding: 14px;
  background: var(--bg-2); border: var(--bw) solid var(--ink); box-shadow: var(--sh);
}
.simon-pad { aspect-ratio: 1; border: var(--bw) solid var(--ink); cursor: pointer; opacity: .5; transition: opacity .06s steps(1), transform .06s steps(1); }
.simon-pad.lit, .simon-pad:active { opacity: 1; transform: scale(1.04); }
.simon-0 { background: var(--red); }
.simon-1 { background: var(--lime); }
.simon-2 { background: var(--yellow); }
.simon-3 { background: var(--blue); }

/* reaction duel */
.rx-duel { width: 100%; max-width: 560px; height: 380px; display: grid; grid-template-rows: 1fr 1fr; gap: 6px; }
.rx-half {
  border: var(--bw) solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  font-family: var(--font-pixel); font-size: .8rem; text-align: center; padding: 12px;
}
.rx-half.rx-idle { background: var(--panel); }
.rx-half.rx-wait { background: var(--red); color: #fff; }
.rx-half.rx-go { background: var(--lime); color: var(--ink); }
.rx-half.rx-won { background: var(--cyan); color: var(--ink); }
.rx-half.rx-top .rx-half-label { transform: rotate(180deg); }

/* challenge banner + overlay extras */
.ch-banner {
  display: flex; flex-direction: column; gap: 3px;
  background: var(--panel); border: var(--bw) solid var(--cyan); box-shadow: var(--sh-sm);
  padding: 12px 16px; margin-bottom: 14px; font-size: .9rem;
}
.ch-banner b { color: var(--cyan); }
.ov-ch { font-weight: 700; border: 2px solid var(--ink); padding: 8px 12px; margin-bottom: 12px; }
.ov-ch.ok { background: var(--lime); color: var(--ink); }
.ov-ch.no { background: var(--gold); color: var(--ink); }
#ph-ov-extra { margin-top: 14px; }
#ph-ov-extra .btn { margin-bottom: 4px; }
/* new-record name entry inside the game-over overlay */
.ov-rec {
  background: var(--panel-2); border: var(--bw) solid var(--ink); box-shadow: var(--sh-sm);
  padding: 10px 12px; margin-bottom: 12px;
}
.ov-rec-head {
  font-family: var(--font-pixel); font-size: calc(.62rem * var(--px-bump)); line-height: 1.6;
  color: var(--gold); margin-bottom: 9px;
}
.ov-rec-head.ok { color: var(--lime); margin-bottom: 0; }
.ov-rec-row { display: flex; gap: 8px; align-items: stretch; }
.ov-rec-row input {
  background: var(--panel); color: var(--text); border: var(--bw) solid var(--ink);
  padding: 9px 12px; font-family: var(--font-body); font-weight: 700; font-size: 1rem;
  flex: 1; min-width: 0; /* 16px font stops iOS from zooming on focus */
}
.ov-rec-row input:focus { outline: none; border-color: var(--cyan); }
.ov-rec-row .btn { flex: none; }

.ov-next { margin-top: 14px; border-top: 3px solid var(--ink); padding-top: 12px; }
.ov-next-head { color: var(--muted); font-size: .85rem; margin-bottom: 8px; font-style: italic; }
.ov-next-lbl {
  color: var(--faint); font-family: var(--font-pixel); font-size: calc(.56rem * var(--px-bump));
  letter-spacing: .06em; text-transform: uppercase; margin-bottom: 8px;
}
.ov-next-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.ov-next-card {
  background: var(--panel-2); border: 3px solid var(--ink); box-shadow: var(--sh-sm);
  padding: 8px 14px; font-weight: 700; font-size: .84rem; color: var(--text);
  display: inline-flex; align-items: center; gap: 6px;
}
.ov-next-card:hover { text-decoration: none; transform: translate(-1px,-1px); box-shadow: var(--sh); }
.ov-next-card .chip-ico { width: 15px; height: 15px; }

/* ---------- leaderboard ---------- */
.lb-wrap { margin-top: 22px; }
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.lb-title { font-family: var(--font-pixel); font-size: calc(.80rem * var(--px-bump)); color: var(--text); display: flex; align-items: center; gap: 8px; }
.lb-tabs { display: flex; gap: 6px; }
.lb-status { font-size: .74rem; color: var(--faint); font-weight: 600; }
.lb-status.local { color: var(--orange); }
.lb-table { width: 100%; border-collapse: collapse; border: var(--bw) solid var(--ink); background: var(--panel); box-shadow: var(--sh); }
.lb-table th, .lb-table td { text-align: left; padding: 8px 12px; border-bottom: 2px solid var(--line); font-size: .86rem; }
.lb-table th { font-family: var(--font-pixel); font-size: calc(.56rem * var(--px-bump)); text-transform: uppercase; color: var(--faint); letter-spacing: .04em; }
.lb-table td.rank { font-family: var(--font-pixel); font-size: calc(.68rem * var(--px-bump)); color: var(--gold); width: 2.5em; }
.lb-table td.score { text-align: right; font-weight: 700; }
.lb-table tr.me td { background: var(--panel-2); color: var(--cyan); }
.lb-empty { padding: 16px; text-align: center; color: var(--faint); font-size: .86rem; }
.lb-submit { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.lb-submit input {
  background: var(--panel); color: var(--text); border: var(--bw) solid var(--ink);
  padding: 8px 12px; font-family: var(--font-body); font-weight: 700; font-size: .86rem; flex: 1; min-width: 120px;
}
.lb-submit input:focus { outline: none; border-color: var(--cyan); }

/* ---------- content section ---------- */
.content { margin-top: 40px; }
.content h2 {
  font-family: var(--font-pixel);
  font-size: calc(.90rem * var(--px-bump)); line-height: 1.5;
  margin: 32px 0 14px; padding-bottom: 10px;
  border-bottom: 3px solid var(--ink);
  color: var(--text);
}
.content h3 { font-size: 1rem; margin: 18px 0 6px; color: var(--cyan); font-weight: 700; }
.content p { color: var(--text-soft); margin-bottom: 10px; }
.content ul { padding-left: 20px; color: var(--text-soft); }
.content li { margin-bottom: 7px; }
.content details {
  background: var(--panel); border: var(--bw) solid var(--ink); box-shadow: var(--sh-sm);
  padding: 13px 17px; margin-bottom: 10px;
}
.content details[open] { border-color: var(--cyan); }
.content summary { cursor: pointer; font-weight: 700; }
.content details p { margin: 10px 0 0; }

.ad-box { margin: 40px 0 0; text-align: center; }
.ad-box .ad-tag {
  color: var(--faint); font-family: var(--font-pixel); font-size: .5rem;
  letter-spacing: .1em; text-transform: uppercase; display: block; margin-bottom: 8px;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 3px solid var(--ink);
  margin-top: 28px; padding: 26px 20px 44px;
  text-align: center; color: var(--muted); font-size: .84rem;
  position: relative; z-index: 1;
}
.site-footer .links {
  margin-bottom: 10px; display: flex; gap: 18px;
  justify-content: center; flex-wrap: wrap; font-weight: 700;
}
.site-footer .copy { font-family: var(--font-pixel); font-size: calc(.60rem * var(--px-bump)); color: var(--faint); }

/* ---------- text pages ---------- */
.text-main { max-width: 780px; margin: 0 auto; padding: 16px 20px 48px; position: relative; z-index: 1; }
.text-main h1 { font-family: var(--font-pixel); font-size: 1.2rem; line-height: 1.4; margin-bottom: 18px; color: var(--yellow); text-shadow: 3px 3px 0 var(--ink); }
.text-main h2 { font-family: var(--font-pixel); font-size: calc(.86rem * var(--px-bump)); line-height: 1.5; margin: 28px 0 10px; }
.text-main p, .text-main li { color: var(--text-soft); }
/* 문단 사이 간격이 없어 여러 문단이 한 덩어리로 붙어 보였다 (소개·방침 공통) */
.text-main p { line-height: 1.75; margin: 0 0 12px; }
.text-main p:last-child { margin-bottom: 0; }
.text-main ul { padding-left: 20px; margin: 0 0 12px; }
.text-main li { line-height: 1.7; margin-bottom: 4px; }
.nf-wrap { text-align: center; padding: 60px 20px; }
.nf-wrap .code {
  font-family: var(--font-pixel); font-size: 3.4rem; color: var(--red);
  text-shadow: 5px 5px 0 var(--ink); margin-bottom: 20px;
}

/* ---------- stats page ---------- */
.stats-tiles { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 10px; }
.stats-tiles .stat { flex: 1; min-width: 120px; }
#stats-root h2 {
  font-family: var(--font-pixel); font-size: calc(.86rem * var(--px-bump)); line-height: 1.5;
  margin: 28px 0 14px; padding-bottom: 8px; border-bottom: 3px solid var(--ink);
}
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ach {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: var(--bw) solid var(--ink);
  padding: 10px 12px; opacity: .42; filter: grayscale(1);
}
.ach.unlocked { opacity: 1; filter: none; border-color: var(--gold); box-shadow: var(--sh-sm); }
.ach-icon { width: 26px; height: 26px; flex: none; display: inline-flex; }
.ach-icon svg { width: 100%; height: 100%; }
.ach-name { font-size: .8rem; font-weight: 700; }
.stats-game {
  background: var(--panel); border: var(--bw) solid var(--ink); box-shadow: var(--sh-sm);
  padding: 12px 16px; margin-bottom: 10px;
}
.sg-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.sg-head b { display: inline-flex; align-items: center; gap: 8px; }
.sg-head b .chip-ico { width: 18px; height: 18px; }
.sg-head span { color: var(--muted); font-size: .84rem; }
.sg-recents { display: flex; gap: 6px; flex-wrap: wrap; color: var(--faint); font-size: .84rem; }
.sg-chip { background: var(--panel-2); border: 2px solid var(--ink); padding: 2px 9px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.sg-chip.win { background: var(--lime); color: var(--ink); }

/* reward panel on stats */
.reward-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 10px; }
.reward-card { background: var(--panel); border: var(--bw) solid var(--ink); box-shadow: var(--sh-sm); padding: 14px; }
.reward-card .rc-lbl { font-family: var(--font-pixel); font-size: calc(.52rem * var(--px-bump)); text-transform: uppercase; color: var(--faint); letter-spacing: .06em; }
.reward-card .rc-val { font-family: var(--font-pixel); font-size: 1rem; margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.reward-card.lv .rc-val { color: var(--cyan); }
.reward-card.coin .rc-val { color: var(--gold); }
.reward-card .rc-val svg { width: 20px; height: 20px; }
.reward-card .ph-xp-track { margin-top: 10px; }
.daily-btn { margin-top: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .card.feat { grid-column: span 2; grid-row: auto; }
  .card.feat .card-art { height: 140px; }
}
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; padding-bottom: 10px; }
  /* hide the cabinet art on mobile so the game grid is visible immediately */
  .hero-cab { display: none; }
  .hero .tag, .hero .intro { max-width: none; }
  .hero .tag { margin-top: 8px; }
  .grid { margin-top: 10px; }
}
@media (max-width: 560px) {
  .grid { gap: 12px; padding: 0 14px; }
  .card { padding: 12px; }
  .card.wide { grid-column: span 2; }
  .card-art { height: 92px; }
  .card.feat .card-art { height: 120px; }
  .art-2048 { grid-template-columns: repeat(2, 38px); }
  .art-2048 span { width: 38px; height: 38px; font-size: .5rem; }
  .card h2 { font-size: calc(.80rem * var(--px-bump)); }
  .card.feat h2 { font-size: .78rem; }
  .card p.blurb { font-size: .78rem; }
  .ms-cell { width: 27px; height: 27px; font-size: .54rem; }
  .hud-left, .hud-right { width: 100%; justify-content: center; }
  .stat { flex: 1; }
  .ad-card { min-height: 160px; }
  .logo { font-size: calc(.98rem * var(--px-bump)); }

  /* ---- phone: shrink the chrome so the game fits the first screen ----
     before this, header+title+hud ate 500px of an 816px viewport and the
     board started below the fold. each rule here buys back vertical space. */
  .site-header { flex-wrap: wrap; padding: 10px 14px; row-gap: 8px; }
  /* flex children refuse to shrink below content width; without wrap the
     logo+chips min-content (~398px) pushed the header past a 375px screen */
  .logo-mark { width: 34px; height: 34px; }
  .logo-mark svg { width: 20px; height: 20px; }
  .stats-chip { padding: 6px 9px; }
  .stats-chip .chip-seg + .chip-seg { padding-left: 7px; }
  .game-main { padding: 4px 12px 40px; }
  .crumb { margin-bottom: 8px; }
  .game-main h1 { margin: 0 0 6px; }
  .game-main h1 + p { margin: 0 0 10px; font-size: .84rem; }
  .hud { gap: 6px; margin-bottom: 8px; }
  .hud-left, .hud-right { gap: 6px; }
  .stat { padding: 4px 10px; min-width: 64px; }
  .hud .btn { padding: 7px 10px; font-size: .8rem; }
}

/* ---------- sudoku ---------- */
.sd-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: min(100%, 480px);
  margin: 10px auto 12px;
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh);
  background: var(--panel);
  user-select: none;
  -webkit-user-select: none;
}
.sd-cell {
  aspect-ratio: 1;
  min-width: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel);
  color: var(--accent);
  border: 1px solid var(--line);
  font-family: var(--font-body);
  font-size: clamp(.9rem, 4vw, 1.35rem);
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  position: relative;
}
/* 3x3 box walls: --ink vanishes on the dark bg, so use the bright text tone */
.sd-cell.bt { border-top: 2px solid var(--text-soft); }
.sd-cell.bl { border-left: 2px solid var(--text-soft); }
.sd-cell.bb { border-bottom: 2px solid var(--text-soft); }
.sd-cell.br { border-right: 2px solid var(--text-soft); }
.sd-cell.given { color: var(--text); cursor: default; }
.sd-cell.peer { background: var(--panel-2); }
.sd-cell.same { outline: 2px solid var(--accent); outline-offset: -2px; }
.sd-cell.sel { background: var(--accent-dim, #274156); outline: 2px solid var(--accent); outline-offset: -2px; }
.sd-cell.bad { color: var(--red); }
.sd-cell.bad.given { color: var(--red); }
.sd-notes {
  position: absolute; inset: 1px;
  font-size: .52rem; font-weight: 600; line-height: 1.1;
  color: var(--faint); letter-spacing: 1px;
  display: flex; flex-wrap: wrap; align-items: flex-start;
  pointer-events: none; overflow: hidden;
}
.sd-grid.sd-hide .sd-cell { color: transparent; }
.sd-grid.sd-hide .sd-notes { visibility: hidden; }
.sd-pad {
  display: grid;
  grid-template-columns: repeat(9, 1fr) auto auto;
  gap: 6px;
  width: min(100%, 480px);
  margin: 0 auto 6px;
}
.sd-key { padding: 10px 0; font-size: 1.05rem; font-weight: 700; text-align: center; }
.sd-key.done { opacity: .35; }
.sd-note { font-size: .8rem; white-space: nowrap; padding: 10px 10px; }
.sd-erase { padding: 10px 12px; }
@media (max-width: 560px) {
  .sd-pad { grid-template-columns: repeat(5, 1fr); }
  .sd-note { grid-column: span 3; }
  .sd-erase { grid-column: span 2; }
  .sd-key { padding: 12px 0; }   /* fat-finger friendly */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  body::after { animation: none; }
}
