:root {
  --bg: #fff8f0;
  --bg2: #ffffff;
  --ink: #33272a;
  --ink-soft: #7a6b70;
  --brand: #ff5a5f;
  --brand-deep: #d94a4f;
  --accent: #ffb4a2;
  --line: #f0e3da;
  --panel: #ffffff;
  --shadow: 0 10px 30px rgba(51, 39, 42, .10);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f191c;
    --bg2: #2a2226;
    --ink: #f5e9e3;
    --ink-soft: #b7a6a8;
    --brand: #ff6b70;
    --brand-deep: #e0555a;
    --line: #3d3236;
    --panel: #2a2226;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  }
}
[data-theme="dark"] {
  --bg: #1f191c;
  --bg2: #2a2226;
  --ink: #f5e9e3;
  --ink-soft: #b7a6a8;
  --brand: #ff6b70;
  --brand-deep: #e0555a;
  --line: #3d3236;
  --panel: #2a2226;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
[data-theme="dark"] .stage { background: #241d20 !important; }
[data-theme="light"] {
  --bg: #fff8f0;
  --bg2: #ffffff;
  --ink: #33272a;
  --ink-soft: #7a6b70;
  --brand: #ff5a5f;
  --brand-deep: #d94a4f;
  --line: #f0e3da;
  --panel: #ffffff;
  --shadow: 0 10px 30px rgba(51, 39, 42, .10);
}
[data-theme="light"] .stage, [data-theme="light"] .shelf-card { background: #fdf1e3 !important; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
#board, .chip, .btn { -webkit-tap-highlight-color: transparent; }
#board { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
a { color: var(--brand-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

/* header */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1040px; margin: 0 auto; padding: 14px 20px;
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--ink); letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.brand-mark { margin-right: 6px; }
.site-nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.site-nav > a { color: var(--ink-soft); font-size: .92rem; }
.site-nav > a:hover { color: var(--brand-deep); text-decoration: none; }
.nav-sound-btn, .nav-theme-btn {
  border: 1px solid var(--line); background: var(--bg2); color: var(--ink-soft);
  border-radius: 999px; padding: 3px 10px; font-size: .92rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s ease; line-height: 1.4;
}
.nav-sound-btn:hover, .nav-theme-btn:hover { color: var(--brand-deep); border-color: var(--brand); }
.nav-sound-btn.active { color: var(--brand-deep); border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--bg2)); }
.nav-sound-btn.muted { opacity: .7; }
.lang-switch { position: relative; }
.lang-switch summary {
  list-style: none; cursor: pointer; color: var(--ink-soft); font-size: .92rem;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; user-select: none;
}
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch[open] .lang-menu { display: grid; }
.lang-menu {
  display: none; position: absolute; right: 0; top: 130%; z-index: 30;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; min-width: 160px;
}
.lang-menu a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--ink); font-size: .92rem; }
.lang-menu a:hover { background: var(--bg); text-decoration: none; }
.lang-menu a[aria-current="true"] { color: var(--brand-deep); font-weight: 700; }

/* layout */
main { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.hero { text-align: center; padding: 14px 0 6px; }
.hero h1 { font-size: clamp(1.35rem, 3.2vw, 2rem); margin: 0 0 4px; letter-spacing: -.4px; }
.tagline { color: var(--ink-soft); margin: 0 auto; max-width: 640px; font-size: .94rem; }

/* game layout: mobile = single column, ≥760px = 2-column board + side panel */
.game-section { margin: 6px auto 14px; max-width: 900px; }
.game-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; justify-content: center; }
.game-board { width: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.game-side { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 520px; margin: 0 auto; min-width: 0; }
.side-card {
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 16px; box-shadow: var(--shadow);
}
.side-card-head {
  display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 8px;
}
.daily-count { font-weight: 800; color: var(--brand-deep); font-variant-numeric: tabular-nums; }
.evo-chain-badge {
  font-size: .68rem; font-weight: 700; color: var(--ink-soft);
  background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px;
}
.evo-mini-track {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  font-size: 1.05rem; overflow-x: auto; padding: 4px 0; scrollbar-width: none; user-select: none;
}
.evo-mini-track::-webkit-scrollbar { display: none; }
.evo-mini { font-size: 1.15rem; line-height: 1.6; user-select: none; }
.evo-mini-fruit {
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .25s cubic-bezier(.175, .885, .32, 1.275), filter .2s, opacity .2s;
  opacity: .32; filter: grayscale(90%);
}
.evo-mini-fruit.unlocked { opacity: 1; filter: none; transform: scale(1); }
.evo-mini-fruit.highest {
  transform: scale(1.22); filter: drop-shadow(0 2px 6px rgba(255, 90, 95, .45));
}
.evo-mini-fruit.pop { animation: evoPop .35s ease-out; }
@keyframes evoPop {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.5); filter: drop-shadow(0 0 10px #ff8a5c); }
  100% { transform: scale(1.22); }
}
.evo-mini-arrow {
  font-style: normal; color: var(--ink-soft); font-size: .78rem; margin: 0 1px;
  opacity: .35; transition: opacity .2s, color .2s;
}
.evo-mini-arrow.unlocked { opacity: .9; color: var(--brand-deep); }
.next-card #next { border-radius: 8px; }
/* share sheet: social network grid */
.share-sheet { align-items: center; }
.sheet {
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); padding: 16px 18px 14px; width: min(94%, 380px);
  max-height: 96%; overflow: auto;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sheet-title { font-weight: 800; font-size: 1.05rem; }
.sheet-close {
  border: none; background: var(--bg2); color: var(--ink-soft); width: 30px; height: 30px;
  border-radius: 50%; cursor: pointer; font-size: 13px; line-height: 1;
}
.sheet-close:hover { color: var(--brand-deep); }
.sheet-preview { margin: 0 auto 12px; text-align: center; }
.card-preview-img {
  width: 100%; max-width: 210px; height: auto; border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .22); display: block; margin: 0 auto;
  user-select: auto; -webkit-user-select: auto;
}
.sheet-tip { font-size: .74rem; color: var(--brand-deep); margin: 6px 0 0; font-weight: 600; }
.sheet-net { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 6px; margin-bottom: 12px; }
.net-btn { display: flex; flex-direction: column; align-items: center; gap: 5px; background: none; border: none; cursor: pointer; padding: 0; }
.net-ico { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: transform .12s; }
.net-btn:hover .net-ico { transform: scale(1.08); }
.net-ico svg { width: 22px; height: 22px; }
.net-name { font-size: .66rem; color: var(--ink-soft); }
.net-ico.x { background: #111; }
.net-ico.telegram { background: #229ED9; }
.net-ico.reddit { background: #FF4500; }
.net-ico.whatsapp { background: #25D366; }
.net-ico.facebook { background: #1877F2; }
.net-ico.instagram { background: linear-gradient(45deg, #F58529, #DD2A7B 55%, #8134AF); }
.net-ico.email { background: #8a8a8a; }
.net-ico.more { background: var(--ink-soft); }
.sheet-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.btn.small { padding: 8px 14px; font-size: .85rem; }
.sheet-url { text-align: center; color: var(--ink-soft); font-size: .76rem; margin: 10px 0 0; word-break: break-all; }
.streak-chip { font-weight: 700; font-size: .9rem; color: var(--brand-deep); }
.lb-card { flex-direction: column; align-items: stretch; gap: 8px; }
.lb-head { display: flex; gap: 6px; }
.lb-tab {
  flex: 1; border: none; background: var(--bg2); color: var(--ink-soft);
  border-radius: 999px; padding: 6px 8px; font-size: .8rem; font-weight: 700; cursor: pointer;
}
.lb-tab:hover { color: var(--brand-deep); }
.lb-tab.active { background: var(--brand); color: #fff; }
.lb-list { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.lb-list li { display: flex; gap: 8px; align-items: center; padding: 4px 6px; border-top: 1px dashed var(--line); }
.lb-list li:first-child { border-top: 0; padding-top: 0; }
.lb-rank { color: var(--ink-soft); min-width: 18px; }
.lb-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.lb-mode { margin-left: auto; color: var(--ink-soft); font-size: .78rem; }
.lb-empty { color: var(--ink-soft); justify-content: center; }
/* podium: gold / silver / bronze */
.medal {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 13px; color: #fff; flex: none; position: relative;
}
.medal .crown { position: absolute; top: -14px; right: -10px; font-size: 14px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.lb-list li.top1, .top-runs li.top1 { background: linear-gradient(90deg, rgba(255,193,7,.20), rgba(255,193,7,.02)); }
.lb-list li.top2, .top-runs li.top2 { background: linear-gradient(90deg, rgba(176,190,197,.22), rgba(176,190,197,.02)); }
.lb-list li.top3, .top-runs li.top3 { background: linear-gradient(90deg, rgba(205,127,50,.18), rgba(205,127,50,.02)); }
.lb-list li.top1, .lb-list li.top2, .lb-list li.top3,
.top-runs li.top1, .top-runs li.top2, .top-runs li.top3 {
  border-radius: 10px; border-top: 0; padding-top: 6px; padding-bottom: 6px; margin-top: 2px;
}
.lb-list li.top1 .medal { background: linear-gradient(135deg, #ffe082, #ff9800); box-shadow: 0 0 0 2px rgba(255,213,79,.45), 0 0 16px rgba(255,160,0,.65); }
.lb-list li.top2 .medal { background: linear-gradient(135deg, #eceff1, #90a4ae); box-shadow: 0 0 0 2px rgba(207,216,220,.5), 0 0 12px rgba(144,164,174,.6); }
.lb-list li.top3 .medal { background: linear-gradient(135deg, #ffcc9e, #b5651d); box-shadow: 0 0 0 2px rgba(255,171,145,.45), 0 0 12px rgba(181,101,29,.6); }
.lb-list li.top1 .lb-score, .top-runs li.top1 .lb-score {
  font-size: 1.06rem;
  background: linear-gradient(135deg, #ffd54f, #ff8f00);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lb-list li.top2 .lb-score, .top-runs li.top2 .lb-score {
  background: linear-gradient(135deg, #eceff1, #78909c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lb-list li.top3 .lb-score, .top-runs li.top3 .lb-score {
  background: linear-gradient(135deg, #ffab73, #b5651d);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.top-runs .medal { margin-right: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .lb-list li.top1 .medal, .top-runs li.top1 .medal { animation: lbPulse 1.8s ease-in-out infinite; }
  @keyframes lbPulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(255,213,79,.45), 0 0 12px rgba(255,160,0,.5); }
    50% { box-shadow: 0 0 0 3px rgba(255,213,79,.6), 0 0 24px rgba(255,160,0,.9); }
  }
}
@media (min-width: 860px) {
  .game-grid {
    grid-template-columns: minmax(0, 520px) minmax(240px, 280px);
    gap: 16px;
    align-items: start;
    justify-content: center;
  }
  .game-board { width: 100%; max-width: 520px; margin: 0; min-width: 0; }
  .game-side { width: 100%; max-width: 280px; margin: 0; min-width: 0; }
}
@media (min-width: 940px) {
  .game-grid {
    grid-template-columns: 520px 280px;
    gap: 18px;
  }
}
/* landscape phones: shrink board to fit the viewport height */
@media (max-height: 660px) and (orientation: landscape) {
  .stage { max-width: calc((100dvh - 120px) * .72); margin: 0 auto; }
  .hero { padding: 4px 0 2px; }
  .hero h1 { font-size: 1.15rem; }
  .hero .tagline { display: none; }
}

/* HUD: clean score and tools layout */
.hud {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 12px; box-shadow: var(--shadow); margin-bottom: 8px;
}
.hud-main {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
}
.hud-stats {
  display: flex; align-items: center; justify-content: flex-start; gap: 14px; flex: 1;
}
.hud-cell {
  display: flex; flex-direction: column; align-items: center; min-width: 48px; padding: 0 2px;
}
.combo-cell { position: relative; min-width: 54px; }
.combo-meter {
  width: 100%; height: 3px; background: rgba(0, 0, 0, 0.08); border-radius: 2px;
  overflow: hidden; margin-top: 2px; opacity: 0; transition: opacity .15s ease;
}
.combo-meter.active { opacity: 1; }
.combo-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #ffb703, #ff3366);
  border-radius: 2px; transition: width 0.06s linear;
}
.hud-label { font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.hud-value { font-size: 1.25rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.15; }
.blitz-timer-cell .blitz-time { color: #ff5a5f; }
.hud-tools {
  display: flex; align-items: center; gap: 4px; flex: none;
}
.hud-modes {
  display: flex; align-items: center; justify-content: center; width: 100%; margin-top: 2px;
}
.hud-chips {
  display: flex; align-items: center; justify-content: space-between; gap: 4px; width: 100%;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 3px;
}
.chip {
  border: 1px solid var(--line); background: var(--bg2); color: var(--ink);
  border-radius: 999px; padding: 5px 12px; font-size: .82rem; cursor: pointer; font-weight: 600;
  white-space: nowrap; user-select: none; transition: all .15s ease;
}
.hud-chips .chip {
  flex: 1 1 0; text-align: center; border: none; background: transparent; color: var(--ink-soft);
  border-radius: 999px; padding: 5px 8px; font-size: .78rem; font-weight: 700; cursor: pointer;
  white-space: nowrap; user-select: none; transition: all .15s ease;
}
.hud-chips .chip:hover { color: var(--brand-deep); }
.hud-chips .chip.active {
  background: var(--brand); color: #fff; box-shadow: 0 2px 6px rgba(255, 90, 95, 0.3);
}
.chip.icon {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: .92rem;
}
.hud-tools .chip.icon {
  border: 1px solid var(--line); background: var(--bg2); color: var(--ink);
  cursor: pointer; transition: all .15s ease;
}
.hud-tools .chip.icon:hover { border-color: var(--brand); transform: scale(1.05); }
.hud-tools .chip.icon:active { transform: scale(0.95); }
.chip.sound-chip.active { background: color-mix(in srgb, var(--brand) 15%, var(--bg2)); border-color: var(--brand); color: var(--brand-deep); }
.chip.sound-chip.muted { background: var(--bg2); border-color: var(--line); color: var(--ink-soft); opacity: .7; }

/* Stage container & dedicated stage shelf (和游戏主屏同款设计) */
.stage-container {
  display: flex; flex-direction: row; align-items: flex-start; justify-content: center;
  gap: 10px; width: 100%; position: relative;
}
.stage {
  position: relative; border-radius: 16px; overflow: hidden;
  border: 2px solid #e7c9a9; box-shadow: var(--shadow); background: #fdf1e3;
  flex: 1 1 414px; width: 100%;
  max-width: min(414px, calc((100vh - 190px) * 0.71875));
  max-width: min(414px, calc((100dvh - 190px) * 0.71875));
  min-width: 0;
  aspect-ratio: 460 / 640;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .stage {
    background: #241d20; border-color: var(--line);
  }
}
[data-theme="dark"] .stage { background: #241d20 !important; border-color: var(--line) !important; }
#board { display: block; width: 100%; height: auto; aspect-ratio: 460 / 640; touch-action: none; cursor: crosshair; }

/* Stage Shelf: Right-side control wing */
.stage-shelf {
  display: flex; flex-direction: column; gap: 6px; flex: 0 0 94px; width: 94px;
}
.shelf-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 6px 4px; min-height: 74px;
  background: #fdf1e3; border: 2px solid #e7c9a9; border-radius: 14px;
  box-shadow: 0 3px 10px rgba(231, 201, 169, 0.32); position: relative;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  user-select: none;
}
button.shelf-card {
  font-family: inherit; color: inherit; cursor: pointer; outline: none;
}
button.shelf-card:hover {
  transform: translateY(-2px); border-color: var(--brand);
  box-shadow: 0 6px 16px rgba(255, 90, 95, 0.25);
}
button.shelf-card:active {
  transform: translateY(0);
}
button.shelf-card:disabled,
button.shelf-card.disabled {
  opacity: .5; cursor: not-allowed; transform: none !important;
  box-shadow: none !important; filter: grayscale(40%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shelf-card {
    background: #241d20; border-color: var(--line); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  }
}
[data-theme="dark"] .shelf-card {
  background: #241d20 !important; border-color: var(--line) !important; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4) !important;
}
.shelf-sublabel {
  font-size: .66rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: #8c532b; line-height: 1; user-select: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shelf-sublabel { color: #f5a623; }
}
[data-theme="dark"] .shelf-sublabel { color: #f5a623 !important; }
.shelf-preview {
  position: relative; display: flex; align-items: center; justify-content: center;
}
.shelf-card canvas {
  display: block; width: 44px; height: 44px; object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.12)); border-radius: 8px;
}
.shelf-card.hold-card { cursor: pointer; }
.shelf-card.hold-card:hover {
  transform: translateY(-2px); border-color: var(--brand);
  box-shadow: 0 6px 16px rgba(255, 90, 95, 0.25);
}
.shelf-card.hold-card:active {
  transform: translateY(0);
}
.shelf-card.hold-card.locked {
  opacity: .55; cursor: not-allowed; transform: none; filter: grayscale(40%);
}
.shelf-nudge-val {
  display: flex; align-items: center; justify-content: center; gap: 3px; margin: 2px 0;
}
.nudge-ico { font-size: 1.1rem; line-height: 1; }
.shelf-nudge-val .nudge-count {
  font-size: 1.3rem; font-weight: 900; color: var(--brand-deep);
  font-variant-numeric: tabular-nums; line-height: 1;
}
[data-theme="dark"] .shelf-nudge-val .nudge-count { color: #ff758f; }

.shelf-kbd {
  position: absolute; bottom: 4px; right: 5px;
  background: rgba(51, 39, 42, 0.75); color: #fff;
  font-size: .58rem; font-weight: 800; border-radius: 3px;
  padding: 1px 3px; line-height: 1; font-family: inherit;
}
.shelf-card .streak-chip {
  position: absolute; bottom: -4px; right: -6px;
  background: linear-gradient(135deg, #ff8a5c, #ff5a5f); color: #fff;
  font-size: .66rem; font-weight: 900; border-radius: 999px;
  padding: 2px 6px; box-shadow: 0 2px 6px rgba(255, 90, 95, 0.4);
}

/* Shelf controls helper for desktop */
.shelf-kb-hints {
  display: flex; flex-direction: column; gap: 4px; padding: 7px 6px;
  background: var(--bg2); border: 1px dashed var(--line); border-radius: 12px;
  user-select: none;
}
.shelf-hint-title {
  font-size: .58rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-soft); text-align: center;
}
.shelf-hint-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .65rem; color: var(--ink-soft); gap: 2px;
}
.shelf-hint-row kbd {
  background: var(--panel); border: 1px solid var(--line); border-radius: 3px;
  padding: 1px 3px; font-size: .6rem; font-weight: 700; color: var(--ink);
  font-family: inherit; box-shadow: 0 1px 1px rgba(0, 0, 0, .06);
}

/* mobile & compact layout responsiveness (< 860px) */
@media (max-width: 859px) {
  .site-header { padding: 6px 12px; }
  .brand { font-size: 1.05rem; }
  .site-nav { gap: 6px; }
  .site-nav > a { display: none !important; }
  .nav-sound-btn { display: none !important; }
  .hero { padding: 2px 0 1px; }
  .hero h1 { font-size: 1.05rem; margin: 0; }
  .hero .tagline { display: none; }
  main { padding: 0 8px; }
  .game-section { margin: 2px auto 8px; }
  .game-board {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .hud {
    padding: 6px 8px;
    gap: 4px;
    margin-bottom: 4px;
    border-radius: 14px;
    width: 100%;
    max-width: min(calc(100% - 8px), calc((100dvh - 165px) * (460 / 640)), 375px);
    margin: 0 auto 4px;
  }
  .hud-main { gap: 6px; }
  .hud-stats { gap: 8px; }
  .hud-cell { min-width: 36px; padding: 0 2px; }
  .hud-label { font-size: .56rem; }
  .hud-value { font-size: 1.12rem; }
  .hud-tools { gap: 3px; }
  .chip.icon { width: 30px; height: 30px; font-size: .85rem; }
  .hud-modes { margin-top: 2px; }
  .hud-chips { gap: 3px; padding: 2px; }
  .hud-chips .chip { padding: 4px 6px; font-size: .72rem; }

  .stage-container {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
  }
  .stage-shelf {
    order: -1;
    flex-direction: row;
    justify-content: space-between;
    align-items: stretch;
    gap: 6px;
    width: 100%;
    max-width: min(calc(100% - 12px), calc((100vh - 180px) * 0.71875), 375px);
    max-width: min(calc(100% - 12px), calc((100dvh - 180px) * 0.71875), 375px);
    margin: 0 auto;
  }
  .shelf-kb-hints { display: none !important; }
  .shelf-kbd { display: none !important; }
  .shelf-card {
    flex: 1 1 0;
    min-width: 0;
    min-height: 40px;
    height: 40px;
    padding: 2px 6px;
    border-radius: 12px;
    gap: 4px;
  }
  .shelf-card.hold-card { order: 1; flex-direction: row; justify-content: center; }
  .shelf-card.nudge-card { order: 2; flex-direction: row; justify-content: center; }
  .shelf-card.next-card { order: 3; flex-direction: row; justify-content: center; }
  .shelf-card canvas { width: 32px; height: 32px; }
  .shelf-sublabel { font-size: .62rem; }
  .shelf-nudge-val { margin: 0; gap: 2px; }
  .shelf-nudge-val .nudge-count { font-size: 1.15rem; }
  .nudge-ico { font-size: .95rem; }

  .stage {
    width: 100%;
    max-width: min(calc(100% - 12px), calc((100vh - 180px) * 0.71875), 375px);
    max-width: min(calc(100% - 12px), calc((100dvh - 180px) * 0.71875), 375px);
    aspect-ratio: 460 / 640;
    margin: 0 auto;
    border-radius: 14px;
  }
  #board { display: block; width: 100%; height: auto; aspect-ratio: 460 / 640; }
  .start-hint span { font-size: .82rem; padding: 6px 14px; }
  .game-side {
    width: 100%;
    max-width: min(calc(100% - 12px), calc((100vh - 180px) * 0.71875), 375px);
    max-width: min(calc(100% - 12px), calc((100dvh - 180px) * 0.71875), 375px);
    margin: 8px auto 0;
  }
  .side-card { flex: 1 1 100%; padding: 10px 12px; }
  .content { margin: 20px auto; padding: 16px 18px; border-radius: 14px; }
}

@media (max-width: 380px) {
  .hud {
    padding: 4px 6px;
    max-width: min(calc(100% - 8px), calc((100vh - 160px) * 0.71875));
    max-width: min(calc(100% - 8px), calc((100dvh - 160px) * 0.71875));
  }
  .hud-cell { min-width: 30px; }
  .hud-value { font-size: 1rem; }
  .chip.icon { width: 26px; height: 26px; font-size: .75rem; }
  .hud-chips .chip { padding: 3px 4px; font-size: .68rem; }
  .stage-shelf {
    max-width: min(calc(100% - 8px), calc((100vh - 160px) * 0.71875));
    max-width: min(calc(100% - 8px), calc((100dvh - 160px) * 0.71875));
    gap: 4px;
  }
  .shelf-card { min-height: 36px; height: 36px; padding: 2px 4px; border-radius: 10px; }
  .shelf-card canvas { width: 26px; height: 26px; }
  .shelf-sublabel { font-size: .56rem; }
  .stage {
    max-width: min(calc(100% - 8px), calc((100vh - 160px) * 0.71875));
    max-width: min(calc(100% - 8px), calc((100dvh - 160px) * 0.71875));
  }
  .game-side {
    max-width: min(calc(100% - 8px), calc((100vh - 160px) * 0.71875));
    max-width: min(calc(100% - 8px), calc((100dvh - 160px) * 0.71875));
  }
}
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 18px; text-align: center;
}
.start-hint { pointer-events: none; }
.start-hint span {
  background: rgba(51, 39, 42, .72); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: .95rem; animation: bob 1.6s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .start-hint span { animation: none; } }
.gameover .panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); padding: 16px 20px 12px; max-width: 340px; width: 100%;
  max-height: 94%; overflow-y: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.go-title { margin: 0 0 4px; font-size: 1.25rem; }
.go-newbest { color: var(--brand-deep); font-weight: 800; margin: 0 0 2px; font-size: .92rem; }
.go-score { font-size: 2.3rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; }
.go-score-row { margin: 2px 0; }
.go-biggest, .go-daily, .go-countdown { color: var(--ink-soft); font-size: .86rem; margin: 2px 0; }

/* Global Leaderboard Submission Widget */
.go-lb-box {
  margin: 10px 0 6px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--brand) 6%, var(--bg2));
  border: 1px dashed color-mix(in srgb, var(--brand) 30%, var(--line));
  border-radius: 12px;
  text-align: left;
}
.go-lb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.go-lb-title {
  font-size: .78rem;
  font-weight: 800;
  color: var(--brand-deep);
}
.go-lb-sub {
  font-size: .68rem;
  color: var(--ink-soft);
}
.go-lb-form {
  display: flex;
  gap: 6px;
  align-items: center;
}
.go-lb-input-wrap {
  display: flex;
  flex: 1;
  position: relative;
  align-items: center;
}
.go-lb-input {
  width: 100%;
  padding: 5px 56px 5px 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  font-size: .78rem;
  color: var(--ink);
  font-family: inherit;
  outline: none;
  transition: border-color .15s ease;
}
.go-lb-input:focus {
  border-color: var(--brand);
}
.btn-roll-name {
  position: absolute;
  right: 3px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 5px;
  font-size: .66rem;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1.3;
  transition: all .15s ease;
  user-select: none;
}
.btn-roll-name:hover {
  color: var(--brand-deep);
  border-color: var(--brand);
  transform: scale(1.04);
}
.go-lb-btn {
  padding: 6px 12px !important;
  font-size: .8rem !important;
  white-space: nowrap;
  flex: none;
}
.go-lb-success {
  text-align: center;
  padding: 4px 2px 2px;
}
.go-lb-rank-badge {
  display: inline-block;
  background: linear-gradient(135deg, #ffd54f, #ff8f00);
  color: #fff;
  font-weight: 800;
  font-size: .82rem;
  padding: 3px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(255, 160, 0, .4);
}
.go-lb-share-tip {
  margin: 5px 0 0;
  font-size: .72rem;
  color: var(--brand-deep);
  font-weight: 700;
}
.btn.highlight-share {
  background: linear-gradient(135deg, #ff8a5c, #ff5a5f) !important;
  color: #fff !important;
  border-color: var(--brand) !important;
  box-shadow: 0 3px 10px rgba(255, 90, 95, .35);
  animation: shareGlow 1.8s ease-in-out infinite;
}
@keyframes shareGlow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.go-actions { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line); background: var(--bg2); color: var(--ink);
  border-radius: 12px; padding: 9px 16px; font-size: .92rem; font-weight: 700; cursor: pointer;
}
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-deep); }
.top-runs {
  margin: 10px 0 0; padding: 0; list-style: none; color: var(--ink-soft);
  font-size: .82rem; max-height: 148px; overflow-y: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.top-runs li { display: flex; justify-content: space-between; padding: 3px 0; border-top: 1px dashed var(--line); }
.share-toast {
  position: absolute; inset: auto; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: rgba(51, 39, 42, .85); color: #fff; border-radius: 999px; padding: 10px 18px;
  font-size: .95rem; white-space: nowrap; max-width: 92%;
}
.next-card #next { border-radius: 8px; }
.kb-hint { text-align: center; color: var(--ink-soft); font-size: .85rem; margin: 10px 0 0; }
/* battle banner (async duel via share links) */
#battle-banner {
  text-align: center; margin: 0 0 10px;
  background: linear-gradient(90deg, #ff8a5c, #ff5a5f);
  color: #fff; font-weight: 800; font-size: .9rem;
  border-radius: 999px; padding: 8px 18px;
  box-shadow: 0 6px 18px rgba(255, 90, 95, .35);
}
.go-daily.battle-win {
  background: linear-gradient(90deg, rgba(255, 193, 7, .22), rgba(255, 193, 7, .05));
  border-radius: 10px; padding: 6px 10px; font-weight: 800; color: var(--brand-deep);
}
.top-runs-toggle {
  display: block; margin: 6px auto 0; background: none; border: none;
  color: var(--brand-deep); font-weight: 700; font-size: .8rem; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.top-runs-toggle:hover { text-decoration: underline; }
/* pager: glass segmented pill */
.lb-pager {
  display: inline-flex; align-items: center; gap: 2px;
  align-self: center; margin-top: 8px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px; box-shadow: 0 2px 8px rgba(51, 39, 42, .08);
}
.lb-pager button {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  font-size: .85rem; line-height: 1; display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, transform .15s;
}
.lb-pager button:hover:not(:disabled) { background: var(--brand); color: #fff; transform: scale(1.06); }
.lb-pager button:active:not(:disabled) { transform: scale(.94); }
.lb-pager button:disabled { opacity: .28; cursor: default; }
.lb-page {
  min-width: 46px; text-align: center; font-size: .8rem; font-weight: 800;
  color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: .04em;
}
.noscript-msg { font-weight: 700; color: var(--brand-deep); text-align: center; }

/* content sections - framed cards aligning with 894px grid */
.content {
  margin: 32px auto;
  max-width: 894px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px 28px;
  box-shadow: var(--shadow);
}
.content h2 {
  font-size: 1.35rem;
  margin: 0 0 14px;
  letter-spacing: -.3px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.content p {
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0 0 10px;
}
.steps { padding-left: 20px; color: var(--ink-soft); line-height: 1.6; }
.steps li { margin: 10px 0; }
.steps strong { color: var(--ink); display: block; margin-bottom: 2px; }
.evo-chart {
  list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 0;
}
.evo-chart li {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 12px; min-width: 84px; font-size: .85rem; color: var(--ink-soft);
  transition: transform .15s cubic-bezier(.34, 1.56, .64, 1), border-color .15s;
}
.evo-chart li:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
}
.evo-chart .em { font-size: 1.7rem; }
.tips-list { padding-left: 20px; color: var(--ink-soft); line-height: 1.6; }
.tips-list li { margin: 8px 0; }
.faq-item {
  margin: 14px 0;
  padding: 12px 16px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.faq-item h3 { margin: 0 0 6px; font-size: 1rem; color: var(--ink); }
.faq-item p { margin: 0; color: var(--ink-soft); line-height: 1.5; }

/* footer */
.site-footer {
  max-width: 894px;
  margin: 30px auto 0;
  padding: 22px 20px 40px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: .88rem;
  text-align: center;
}
.lang-row { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: center; margin: 0 0 12px; }
.footer-links { margin: 8px 0; }
.footer-link-btn {
  background: none; border: none; color: var(--ink-soft); font-size: .85rem;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.footer-link-btn:hover { color: var(--brand-deep); }
.copyright { margin-top: 12px; font-size: .8rem; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* nav achievements & stats button */
.nav-ach-btn, .nav-stats-btn {
  border: 1px solid var(--line); background: var(--bg2); color: var(--ink-soft);
  border-radius: 999px; padding: 3px 10px; font-size: .92rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  transition: all .15s ease; line-height: 1.4;
}
.nav-ach-btn:hover, .nav-stats-btn:hover { color: var(--brand-deep); border-color: var(--brand); }

/* HUD pause, fullscreen & tools */
.hud-cell.hud-tools { display: flex; flex-direction: row; align-items: center; gap: 6px; margin-left: auto; }
.pause-chip, .fs-chip, .sound-chip, .bgm-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; border-radius: 50%; font-size: .95rem;
}
.pause-overlay {
  background: rgba(31, 25, 28, .62);
  backdrop-filter: blur(5px);
  z-index: 15;
}
.pause-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); padding: 24px 32px; min-width: 220px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.pause-title { margin: 0; font-size: 1.35rem; font-weight: 800; color: var(--ink); }

/* challenge banner */
.challenge-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: linear-gradient(90deg, #ff7a18, #ff5a5f); color: #fff;
  padding: 8px 16px; border-radius: 999px; margin-bottom: 10px;
  font-size: .88rem; font-weight: 700; box-shadow: 0 4px 14px rgba(255, 90, 95, .3);
  animation: challengeSlide .25s ease-out;
}
.challenge-close {
  background: transparent; border: none; color: #fff; font-size: 14px;
  cursor: pointer; padding: 2px 6px; line-height: 1; border-radius: 50%;
  opacity: .85; transition: opacity .15s;
}
.challenge-close:hover { opacity: 1; }
@keyframes challengeSlide { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ad slots */
.ad-slot {
  display: none;
  background: var(--bg2); border: 1px dashed var(--line); border-radius: var(--radius);
  overflow: hidden; text-align: center;
}
.ad-slot-gameover {
  margin: 12px auto 0; max-width: 300px; min-height: 60px;
}

/* modal overlays */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(31, 25, 28, .6); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); width: min(100%, 460px); max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  animation: modalPop .2s cubic-bezier(.175, .885, .32, 1.275);
}
@keyframes modalPop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-title { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--ink); }
.modal-close {
  border: none; background: var(--bg2); color: var(--ink-soft); width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s ease;
}
.modal-close:hover { color: var(--brand-deep); background: var(--line); }

/* achievements showcase */
.ach-modal-card { width: min(100%, 520px); }
.ach-summary { padding: 14px 20px 8px; }
.ach-progress-bar {
  height: 8px; background: var(--line); border-radius: 999px; overflow: hidden;
}
.ach-progress-fill {
  height: 100%; background: linear-gradient(90deg, #ffb4a2, #ff5a5f);
  border-radius: 999px; transition: width .4s ease;
}
.ach-progress-text {
  font-size: .82rem; font-weight: 700; color: var(--ink-soft);
  margin: 6px 0 0; text-align: right;
}
.ach-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 10px; padding: 12px 20px 20px; overflow-y: auto; max-height: 60vh;
}
.ach-card {
  border: 1px solid var(--line); border-radius: 14px; background: var(--bg2);
  padding: 12px; display: flex; flex-direction: column; align-items: center; text-align: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
.ach-card.unlocked {
  border-color: #ffd54f;
  background: color-mix(in srgb, #ffd54f 8%, var(--bg2));
  box-shadow: 0 4px 14px rgba(255, 193, 7, .18);
}
.ach-card.locked { opacity: .55; filter: grayscale(.85); }
.ach-card:hover { transform: translateY(-2px); }
.ach-icon { font-size: 2rem; margin-bottom: 6px; }
.ach-name { font-size: .88rem; font-weight: 800; margin: 0 0 4px; color: var(--ink); }
.ach-desc { font-size: .74rem; color: var(--ink-soft); margin: 0; line-height: 1.35; }
.ach-tag {
  margin-top: 6px; font-size: .68rem; font-weight: 700; padding: 2px 8px;
  border-radius: 999px;
}
.ach-card.unlocked .ach-tag { background: #ffe082; color: #8d5b00; }
.ach-card.locked .ach-tag { background: var(--line); color: var(--ink-soft); }

/* site-feedback-fab */
.feedback-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--brand));
  color: #fff; font-weight: 700; font-size: .88rem; border: none;
  box-shadow: 0 8px 24px rgba(255, 90, 95, .35); cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.feedback-fab:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 30px rgba(255, 90, 95, .45);
}
.feedback-fab:active { transform: translateY(0) scale(.98); }
.feedback-fab-icon { font-size: 1.1rem; line-height: 1; }
@media (max-width: 600px) {
  .feedback-fab { padding: 10px 12px; }
  .feedback-fab-text { display: none; }
}

.feedback-modal-card { width: min(100%, 440px); }
.feedback-form {
  padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px;
}
.feedback-kinds {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
}
.kind-chip {
  border: 1px solid var(--line); background: var(--bg2); color: var(--ink);
  border-radius: 10px; padding: 8px 10px; font-size: .82rem; font-weight: 600;
  cursor: pointer; transition: all .15s ease; text-align: center;
}
.kind-chip:hover { border-color: var(--brand); }
.kind-chip.active {
  background: color-mix(in srgb, var(--brand) 12%, var(--bg2));
  border-color: var(--brand); color: var(--brand-deep); font-weight: 700;
}
.feedback-input {
  width: 100%; border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); border-radius: 10px; padding: 10px 12px; font-size: .9rem;
  font-family: inherit; transition: border-color .15s ease;
}
.feedback-input:focus { outline: none; border-color: var(--brand); }
.feedback-textarea { resize: vertical; min-height: 90px; }
.feedback-privacy-note {
  margin: 0; font-size: .74rem; color: var(--ink-soft); line-height: 1.4;
}
.feedback-actions { display: flex; justify-content: flex-end; }
.feedback-status {
  padding: 8px 12px; border-radius: 8px; font-size: .82rem; font-weight: 600; text-align: center;
}
.feedback-status.success { background: #e8f5e9; color: #2e7d32; }
.feedback-status.error { background: #ffebee; color: #c62828; }

/* doc modals & footer links */
.doc-modal-card { width: min(100%, 580px); }
.doc-body {
  padding: 16px 22px 24px; overflow-y: auto; max-height: 70vh; font-size: .9rem;
  color: var(--ink); line-height: 1.65; text-align: left;
}
.doc-body h3 { font-size: 1rem; margin: 16px 0 6px; color: var(--brand-deep); }
.doc-body p { margin: 0 0 10px; color: var(--ink-soft); }
.doc-body code {
  background: var(--line); padding: 2px 6px; border-radius: 4px; font-size: .82rem;
}
.footer-links { margin: 6px 0; font-size: .85rem; }
.footer-link-btn {
  background: none; border: none; padding: 0; color: var(--ink-soft);
  font-size: inherit; cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px;
}
.footer-link-btn:hover { color: var(--brand-deep); }
.btn.secondary {
  background: color-mix(in srgb, var(--accent) 25%, var(--bg2));
  border-color: var(--accent); color: var(--brand-deep);
}
.btn.secondary:hover {
  background: color-mix(in srgb, var(--accent) 45%, var(--bg2));
}

/* language suggestion banner */
.lang-suggest-banner {
  background: color-mix(in srgb, var(--brand) 12%, var(--panel));
  border-bottom: 1px solid var(--line); padding: 8px 16px;
  animation: slideDown .25s ease-out;
}
.lang-suggest-inner {
  max-width: 1040px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.lang-suggest-text { font-size: .88rem; font-weight: 700; color: var(--brand-deep); }
.lang-suggest-actions { display: flex; align-items: center; gap: 8px; }
.lang-suggest-close {
  background: none; border: none; font-size: 14px; cursor: pointer; color: var(--ink-soft); padding: 4px 8px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.lang-suggest-close:hover { color: var(--brand-deep); background: var(--line); }

/* keyboard shortcut badge */
.kbd-hint {
  display: inline-block; font-family: inherit; font-size: .72rem; font-weight: 600;
  background: rgba(255, 255, 255, .3); border-radius: 4px; padding: 1px 6px;
  margin-left: 6px; vertical-align: middle; line-height: 1.3;
}
@media (max-width: 759px), (pointer: coarse) {
  .kbd-hint { display: none !important; }
}

/* Nudge & BGM chip styling */
.chip.nudge-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: linear-gradient(135deg, rgba(255, 183, 3, .14), rgba(255, 90, 95, .12));
  border-color: rgba(255, 183, 3, .45); color: var(--ink);
  transition: all .2s cubic-bezier(.175, .885, .32, 1.275);
}
.chip.nudge-chip:not(:disabled):hover {
  transform: scale(1.05);
  border-color: var(--brand);
  box-shadow: 0 2px 10px rgba(255, 183, 3, .35);
}
.chip.nudge-chip .nudge-count {
  background: var(--brand); color: #fff; border-radius: 999px;
  padding: 1px 6px; font-size: .72rem; font-weight: 800;
}
.chip.nudge-chip:disabled {
  opacity: .42; cursor: not-allowed; filter: grayscale(80%);
  border-color: var(--line); transform: none; box-shadow: none;
}
.chip.bgm-chip.active {
  background: color-mix(in srgb, var(--brand) 15%, var(--bg2));
  border-color: var(--brand); color: var(--brand-deep);
}
.chip.bgm-chip.muted {
  background: var(--bg2); border-color: var(--line); color: var(--ink-soft); opacity: .7;
}

/* milestone real-time toast */
.milestone-toast {
  pointer-events: none; z-index: 25;
  display: flex; align-items: center; justify-content: center;
}
.milestone-badge {
  background: linear-gradient(135deg, #fff3e0, #ffe082);
  color: #b75300; border: 2px solid #ffd54f;
  padding: 10px 22px; border-radius: 999px;
  font-size: 1.15rem; font-weight: 900;
  box-shadow: 0 6px 24px rgba(255, 160, 0, .45), 0 0 16px rgba(255, 213, 79, .6);
  animation: milestonePop 1.8s cubic-bezier(.175, .885, .32, 1.275) forwards;
}
.milestone-badge.best {
  background: linear-gradient(135deg, #ffebee, #ffcdd2);
  color: #c62828; border-color: #ef5350;
  box-shadow: 0 6px 24px rgba(239, 83, 80, .5), 0 0 18px rgba(255, 90, 95, .7);
}
@keyframes milestonePop {
  0% { transform: scale(0.6) translateY(24px); opacity: 0; }
  18% { transform: scale(1.12) translateY(-4px); opacity: 1; }
  28% { transform: scale(1) translateY(0); opacity: 1; }
  78% { transform: scale(1) translateY(0); opacity: 1; }
  100% { transform: scale(0.92) translateY(-20px); opacity: 0; }
}

/* career stats modal */
.stats-modal-card { width: min(100%, 460px); }
.stats-highlight {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 18px 20px 14px;
  background: linear-gradient(135deg, color-mix(in srgb, #2ec4b6 12%, var(--bg2)), color-mix(in srgb, var(--brand) 12%, var(--bg2)));
  border-bottom: 1px solid var(--line); text-align: center;
}
.stat-highlight-icon { font-size: 2.8rem; line-height: 1; margin-bottom: 4px; filter: drop-shadow(0 4px 10px rgba(0,0,0,.15)); }
.stat-highlight-val { font-size: 2.2rem; font-weight: 900; color: var(--brand-deep); font-variant-numeric: tabular-nums; }
.stat-highlight-label { font-size: .85rem; font-weight: 700; color: var(--ink-soft); margin-top: 2px; }
.stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  padding: 16px 20px 20px; overflow-y: auto; max-height: 60vh;
}
.stat-tile {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px;
}
.stat-tile .stat-val { font-size: 1.35rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-tile .stat-lbl { font-size: .75rem; color: var(--ink-soft); font-weight: 600; }

/* PWA install prompt button */
.pwa-card { padding: 4px 6px; }
.btn-side-pwa {
  width: 100%; border: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff; font-weight: 700; font-size: .85rem;
  padding: 9px 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 4px 12px rgba(255, 90, 95, .3);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-side-pwa:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(255, 90, 95, .42);
}

/* Hold card & Blitz mode */
.hold-card { cursor: pointer; transition: transform .15s, border-color .15s; }
.hold-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.hold-card.locked { opacity: .55; cursor: not-allowed; transform: none; }
.hold-card #hold { border-radius: 8px; }
.blitz-timer-cell .blitz-time {
  color: #ff5a5f; font-weight: 900; font-variant-numeric: tabular-nums;
}
.blitz-timer-cell.urgent .blitz-time {
  animation: blitzUrgent 0.6s ease-in-out infinite alternate;
}
@keyframes blitzUrgent {
  from { color: #ff5a5f; transform: scale(1); }
  to { color: #d90429; transform: scale(1.1); filter: drop-shadow(0 0 6px rgba(217,4,41,.6)); }
}

/* 7-Day Streak Calendar */
.daily-streak-head {
  display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 6px;
}
.streak-calendar {
  display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 3px;
}
.streak-day {
  flex: 1; height: 26px; border-radius: 8px; font-size: 0.68rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2); border: 1px solid var(--line); color: var(--ink-soft);
  transition: transform .15s ease, background .15s ease;
}
.streak-day.completed {
  background: #2ec4b6; border-color: #2ec4b6; color: #fff;
  box-shadow: 0 2px 6px rgba(46,196,182,.35);
}
.streak-day.today {
  border: 1.5px solid var(--brand); color: var(--brand); font-weight: 800;
  box-shadow: 0 0 8px rgba(255,90,95,.25);
}
.streak-day.today.completed {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.streak-day.future { opacity: 0.45; }

/* Clickable fruit evolution icons */
.evo-mini-fruit, .evo-chart li { cursor: pointer; transition: transform .15s cubic-bezier(.34,1.56,.64,1); }
.evo-mini-fruit:hover { transform: scale(1.28); }
.evo-chart li:hover { transform: translateY(-2px); }

/* Fruit Dex Encyclopedia Modal */
.fruitdex-modal-card { max-width: 440px; }
.fruitdex-body {
  display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 10px 0;
}
.fruitdex-visual {
  display: flex; flex-direction: column; align-items: center; position: relative;
}
#fruitdex-canvas {
  width: 100px; height: 100px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.12));
}
.fruitdex-tier-badge {
  margin-top: 4px; padding: 2px 10px; border-radius: 12px;
  background: var(--bg2); border: 1px solid var(--line);
  font-size: 0.72rem; font-weight: 800; color: var(--ink-soft); text-transform: uppercase;
}
.fruitdex-stats {
  width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
}
.fd-stat-row { display: flex; flex-direction: column; gap: 2px; }
.fd-stat-lbl { font-size: 0.72rem; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; }
.fd-stat-val { font-size: 1.05rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.fruitdex-desc {
  font-size: 0.85rem; line-height: 1.45; text-align: center; color: var(--ink); opacity: .88;
  padding: 0 8px; margin: 0;
}
.fruitdex-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin-top: 4px;
}
.fruitdex-strip {
  display: flex; gap: 4px; overflow-x: auto; padding: 4px 2px; scrollbar-width: none;
}
.fruitdex-strip::-webkit-scrollbar { display: none; }
.fd-thumb {
  width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid transparent;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
  background: var(--bg2); cursor: pointer; transition: transform .12s, border-color .12s;
  flex-shrink: 0;
}
.fd-thumb:hover { transform: scale(1.15); }
.fd-thumb.active { border-color: var(--brand); transform: scale(1.15); box-shadow: 0 2px 8px rgba(255,90,95,.3); }

/* Career Stats save actions */
.stats-actions {
  display: flex; gap: 10px; justify-content: center; margin-top: 16px;
}

/* Accessibility screen reader live announcement */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; white-space: nowrap;
}

/* ========================================================
   FULLSCREEN MODE ADAPTATION (Zero-overflow, 100vh fitted)
   ======================================================== */
:fullscreen,
:-webkit-full-screen {
  overflow: hidden !important;
  background: var(--bg) !important;
}

:fullscreen body,
:-webkit-full-screen body {
  overflow: hidden !important;
  height: 100vh !important;
  height: 100dvh !important;
  width: 100vw !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Hide non-game chrome in fullscreen to reclaim 100% of viewport height */
:fullscreen .site-header,
:-webkit-full-screen .site-header,
:fullscreen .hero,
:-webkit-full-screen .hero,
:fullscreen .feedback-fab,
:-webkit-full-screen .feedback-fab,
:fullscreen .content,
:-webkit-full-screen .content,
:fullscreen .site-footer,
:-webkit-full-screen .site-footer,
:fullscreen .kb-hint,
:-webkit-full-screen .kb-hint {
  display: none !important;
}

:fullscreen main,
:-webkit-full-screen main {
  max-width: 100vw !important;
  width: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
  padding: 4px 8px !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  overflow: hidden !important;
}

:fullscreen .game-section,
:-webkit-full-screen .game-section {
  margin: 0 auto !important;
  max-width: 100% !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
}

:fullscreen .game-grid,
:-webkit-full-screen .game-grid {
  display: flex !important;
  flex-direction: row !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 16px !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 100vh !important;
  overflow: hidden !important;
}

:fullscreen .game-board,
:-webkit-full-screen .game-board {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  height: 100% !important;
  max-height: 100vh !important;
  width: auto !important;
  max-width: 100% !important;
}

:fullscreen .hud,
:-webkit-full-screen .hud {
  margin-bottom: 6px !important;
  padding: 4px 10px !important;
  width: 100% !important;
  flex: none !important;
}

:fullscreen .stage-container,
:-webkit-full-screen .stage-container {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  justify-content: center !important;
  gap: 12px !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: calc(100vh - 84px) !important;
  max-height: calc(100dvh - 84px) !important;
}

:fullscreen .stage,
:-webkit-full-screen .stage {
  /* Exactly budget height to guarantee zero vertical overflow */
  height: calc(100vh - 86px) !important;
  height: calc(100dvh - 86px) !important;
  width: calc((100vh - 86px) * 0.71875) !important;
  width: calc((100dvh - 86px) * 0.71875) !important;
  max-width: 90vw !important;
  max-height: calc(100vh - 86px) !important;
  margin: 0 auto !important;
}

:fullscreen #board,
:-webkit-full-screen #board {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: 460 / 640 !important;
}

:fullscreen .stage-shelf,
:-webkit-full-screen .stage-shelf {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  flex: none !important;
}

@media (max-width: 859px) {
  :fullscreen .stage-container,
  :-webkit-full-screen .stage-container {
    flex-direction: column !important;
    align-items: center !important;
    gap: 6px !important;
    max-height: calc(100vh - 80px) !important;
  }
  :fullscreen .stage,
  :-webkit-full-screen .stage {
    height: calc(100vh - 140px) !important;
    height: calc(100dvh - 140px) !important;
    width: calc((100vh - 140px) * 0.71875) !important;
    width: calc((100dvh - 140px) * 0.71875) !important;
  }
  :fullscreen .stage-shelf,
  :-webkit-full-screen .stage-shelf {
    order: -1 !important;
    flex-direction: row !important;
    max-width: calc((100vh - 140px) * 0.71875) !important;
    max-width: calc((100dvh - 140px) * 0.71875) !important;
  }
}

/* In fullscreen on screens narrower than 1100px, hide sidebar to prioritize gameplay */
@media (max-width: 1099px) {
  :fullscreen .game-side,
  :-webkit-full-screen .game-side {
    display: none !important;
  }
}
@media (min-width: 1100px) {
  :fullscreen .game-side,
  :-webkit-full-screen .game-side {
    display: flex !important;
    max-height: calc(100vh - 40px) !important;
    overflow-y: auto !important;
    scrollbar-width: thin !important;
  }
}

/* PWA standalone mode: clean up web-only chrome for app-like immersion */
@media (display-mode: standalone) {
  .lang-suggest { display: none !important; }
  .hero { padding: 4px 0 2px; }
  .hero h1 { font-size: 1.15rem; }
  .hero .tagline { display: none; }
}
