/* 小遊戲（docs/PLAN-games.md）。顏色與圓角用 design.css 的變數。 */

.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: var(--sp-4); }
.game-card { display: grid; grid-template-columns: 92px 1fr; gap: var(--sp-4); align-items: start; padding: var(--sp-4); }
.game-art {
  display: grid; place-items: center; width: 92px; height: 92px; border-radius: var(--r-md);
  background: var(--navy); color: #fff; font-size: 40px; font-weight: 900; box-shadow: 0 4px 0 var(--navy-deep);
}
.game-info { min-width: 0; display: grid; gap: var(--sp-2); }
.game-info h2 { font-size: 20px; margin: 0; }
.game-info p { margin: 0; }
.game-tag { font-size: 13px; font-weight: 800; color: var(--blue-deep); }
.game-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--sp-1); }

/* 首頁的遊戲專區 */
.home-games { margin: var(--sp-5) 0; }
.hg-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.hg-head h2 { margin: 0; font-size: 22px; }
.hg-head p { margin: 2px 0 0; }
.hg-row { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 2px 10px; margin: 0 -2px; -webkit-overflow-scrolling: touch; }
.hg-card {
  flex: 0 0 auto; width: 168px; display: grid; gap: 4px; padding: 0 0 10px; text-align: left; font: inherit; cursor: pointer;
  background: var(--surface); border: 2px solid var(--border-lite); border-radius: var(--r-md); overflow: hidden; scroll-snap-align: start;
  box-shadow: 0 4px 0 var(--border); color: var(--navy);
}
.hg-card:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--border); }
.hg-card b { padding: 0 12px; font-size: 15px; line-height: 1.25; }
.hg-card small { padding: 0 12px; color: var(--ink-muted); font-weight: 700; font-size: 12px; }
.hg-pic { display: block; aspect-ratio: 4 / 3; background: var(--surface-3); }
.hg-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hg-ph { display: grid; place-items: center; width: 100%; height: 100%; background: var(--tint); color: var(--ink); font-size: 26px; font-weight: 900; letter-spacing: .02em; }
@media (min-width: 900px) {
  .hg-row { flex-wrap: wrap; overflow: visible; }
  .hg-card { width: calc((100% - 5 * 12px) / 6); }
}
.app-games.home-games { margin: var(--sp-3) 0; padding: var(--sp-4); }
.game-slot { scroll-margin-top: 84px; }
.game-slot.is-pulse > .game-card { animation: slot-pulse 1.2s ease; }
@keyframes slot-pulse { 0%, 60% { box-shadow: 0 0 0 4px var(--cta); } 100% { box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .game-slot.is-pulse > .game-card { animation: none; box-shadow: 0 0 0 3px var(--cta); } }
/* 有插圖的遊戲：4:3 的插圖放在卡片最上面 */
.game-card.has-photo { grid-template-columns: 1fr; }
.game-photo { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-md); background: var(--surface-3); }

/* 24 點 */
.g24 { max-width: 520px; margin: 0 auto; display: grid; gap: var(--sp-3); }
.g24-bar { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.g24-chip { font-size: 13px; font-weight: 800; padding: 3px 10px; border-radius: var(--r-pill); background: var(--blue-tint); color: var(--blue-deep); }
.g24-stat { margin-left: auto; font-weight: 700; }
.g24-time { font-weight: 900; font-variant-numeric: tabular-nums; min-width: 4.5em; text-align: right; }
.g24-time.is-low { color: var(--red-deep); }
.g24-goal { margin: var(--sp-2) 0 0; text-align: center; font-size: 17px; font-weight: 700; }
.g24-goal b { font-size: 26px; color: var(--cta-deep); }
.g24-board { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.g24-tile {
  min-height: 88px; border: 2px solid var(--border); border-radius: var(--r-md); background: var(--surface);
  font: inherit; font-size: 36px; font-weight: 900; color: var(--navy); cursor: pointer;
  box-shadow: 0 4px 0 var(--border); transition: transform .06s, box-shadow .06s, border-color .12s, background .12s;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; padding: 6px;
}
.g24-tile:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--border); }
.g24-tile.is-sel { border-color: var(--cta); background: var(--cta-tint); box-shadow: 0 4px 0 var(--cta-shadow); }
.g24-tile.is-won { border-color: var(--green); background: var(--green-tint); color: var(--green-deep); box-shadow: 0 4px 0 var(--green); }
.g24-ops { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.g24-op {
  min-height: 56px; border: 2px solid var(--navy); border-radius: var(--r-pill); background: var(--surface);
  font: inherit; font-size: 28px; font-weight: 900; color: var(--navy); cursor: pointer; line-height: 1;
}
.g24-op.is-sel { background: var(--navy); color: #fff; }
.g24-op:disabled, .g24-tile:disabled { cursor: default; }
.g24-op:disabled:not(.is-sel) { opacity: .45; }
.g24-msg { margin: 0; min-height: 3em; text-align: center; color: var(--ink-muted); font-weight: 700; overflow-wrap: anywhere; }
.g24-msg.is-good { color: var(--green-deep); font-size: 18px; }
.g24-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.g24-result { text-align: center; display: grid; gap: var(--sp-2); justify-items: center; padding: var(--sp-5); }
.g24-result h2 { margin: 0; font-size: 24px; }
.g24-result p { margin: 0; }
.g24-big { font-size: 64px; font-weight: 900; color: var(--cta-deep); line-height: 1; }
.g24-big span { font-size: 20px; color: var(--ink-muted); }
.g24-result .game-actions { justify-content: center; }

@media (max-width: 420px) {
  .game-card { grid-template-columns: 1fr; }
  .game-art { width: 64px; height: 64px; font-size: 28px; }
  .g24-tile { min-height: 76px; font-size: 32px; }
}

/* 方程式猜謎 */
.game-art-eq { font-size: 30px; background: var(--green-deep); box-shadow: 0 4px 0 #14573a; }
.eq { max-width: 520px; margin: 0 auto; display: grid; gap: var(--sp-3); }
.eq-how { border: 2px solid var(--border-lite); border-radius: var(--r-sm); padding: 8px 14px; background: var(--surface); }
.eq-how summary { cursor: pointer; font-weight: 800; }
.eq-how ul { margin: 8px 0 4px; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.eq-legend { display: inline-block; min-width: 1.6em; text-align: center; border-radius: 6px; color: #fff; margin-right: 4px; padding: 0 4px; }
.eq-legend.is-c { background: var(--green); }
.eq-legend.is-p { background: var(--amber); color: var(--ink); }
.eq-legend.is-a { background: var(--ink-faint); }
.eq-board { display: grid; gap: 6px; }
.eq-row { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 5px; max-width: calc(var(--n) * 50px); margin: 0 auto; width: 100%; }
.eq-cell {
  aspect-ratio: 1; display: grid; place-items: center; border: 2px solid var(--border); border-radius: 8px;
  background: var(--surface); font-weight: 900; font-size: clamp(15px, 5.4vw, 24px); color: var(--navy); font-variant-numeric: tabular-nums;
}
.eq-cell.is-typed { border-color: var(--navy-soft); }
.eq-cell.is-c, .eq-key.is-c { background: var(--green); border-color: var(--green); color: #fff; }
.eq-cell.is-p, .eq-key.is-p { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.eq-cell.is-a, .eq-key.is-a { background: var(--ink-faint); border-color: var(--ink-faint); color: #fff; }
.eq-row.is-shake { animation: eq-shake .3s; }
@keyframes eq-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .eq-row.is-shake { animation: none; } }
.g24-msg.is-bad { color: var(--red-deep); }
.eq-end { text-align: center; display: grid; gap: var(--sp-2); justify-items: center; }
.eq-end p { margin: 0; }
.eq-answer { font-size: 18px; font-weight: 700; }
.eq-answer b { display: block; margin-top: 2px; font-size: 26px; letter-spacing: .04em; }
.eq-end.is-win .eq-answer b { color: var(--green-deep); }
.eq-end.is-lose .eq-answer b { color: var(--red-deep); }
.eq-end .game-actions { justify-content: center; }
.eq-keys { display: grid; gap: 6px; }
.eq-keyrow { display: flex; gap: 5px; justify-content: center; }
.eq-key {
  flex: 1 1 0; min-width: 0; max-width: 46px; height: 48px; border: 2px solid var(--border); border-radius: 8px; background: var(--surface-3);
  font: inherit; font-weight: 800; font-size: 18px; color: var(--navy); cursor: pointer; padding: 0;
}
.eq-key.is-wide { max-width: 120px; flex: 2 1 0; font-size: 15px; }
.eq-key:active { transform: translateY(1px); }
.eq-key:disabled { opacity: .5; cursor: default; }

/* 弱點 Boss 戰 */
.game-art-boss { background: var(--blue-tint); box-shadow: 0 4px 0 var(--border); padding: 6px; }
.game-art-boss svg { width: 100%; height: 100%; }
.boss { max-width: 560px; margin: 0 auto; display: grid; gap: var(--sp-3); }
.boss-hearts { margin-left: auto; color: var(--red); font-size: 20px; letter-spacing: 2px; }
.boss-lost { color: var(--ink-disabled); }
.boss-card.is-hit { animation: boss-hit .35s; }
.boss-card.is-hurt { animation: eq-shake .35s; }
@keyframes boss-hit { 30% { transform: scale(.97); background: var(--green-tint); } }
@media (prefers-reduced-motion: reduce) { .boss-card.is-hit, .boss-card.is-hurt { animation: none; } }
.boss-head { display: flex; gap: var(--sp-3); align-items: center; }
.boss-mon { flex: 0 0 96px; width: 96px; height: 96px; }
.boss-mon.is-down { opacity: .5; filter: grayscale(.6); transform: rotate(12deg); }
.boss-mon.is-flee { opacity: .6; }
.boss-svg { width: 100%; height: 100%; }
.boss-info { min-width: 0; display: grid; gap: 6px; }
.boss-info h2 { margin: 0; font-size: 20px; }
.boss-info p { margin: 0; }
.boss-hp { display: flex; gap: 4px; }
.boss-hp i { flex: 1; height: 12px; border-radius: 6px; background: var(--border); }
.boss-hp i.is-on { background: var(--red); }
.boss-q .stem { font-size: 17px; }
.boss-why { margin-top: var(--sp-3); }
.boss-why summary { cursor: pointer; font-weight: 800; }
.boss-result { text-align: center; display: grid; gap: var(--sp-2); justify-items: center; padding: var(--sp-5); }
.boss-result h2 { margin: 0; font-size: 22px; }
.boss-result p { margin: 0; text-align: left; }
.boss-result .game-actions { justify-content: center; }
.boss-big { font-size: 56px; font-weight: 900; color: var(--cta-deep); line-height: 1; text-align: center !important; }
.boss-big span { font-size: 18px; color: var(--ink-muted); }
.boss-load { text-align: center; padding: var(--sp-6, 32px); }
.boss-load p { margin: 0; }
@media (max-width: 420px) { .boss-mon { flex-basis: 72px; width: 72px; height: 72px; } }

/* 拼板 */
.game-art-tiles { background: var(--surface-3); box-shadow: 0 4px 0 var(--border); padding: 8px; }
.tile-x2 { fill: var(--blue); }
.tile-x { fill: var(--green); }
.tile-one { fill: var(--orange); }
.tiles { max-width: 520px; margin: 0 auto; display: grid; gap: var(--sp-3); }
.tiles-poly { font-size: 24px; color: var(--cta-deep); }
.tiles-pile { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tiles-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); border: 2px solid var(--border); background: var(--surface); font-size: 14px; font-weight: 700; }
.tiles-chip i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; }
.tiles-chip i.tile-x2 { background: var(--blue); } .tiles-chip i.tile-x { background: var(--green); } .tiles-chip i.tile-one { background: var(--orange); }
.tiles-chip b { font-variant-numeric: tabular-nums; }
.tiles-chip.is-ok { border-color: var(--green); background: var(--green-tint); color: var(--green-deep); }
.tiles-chip.is-more { border-color: var(--red); background: var(--red-tint); color: var(--red-deep); }
.tiles-board { padding: 8px; }
.tiles-svg { display: block; width: 100%; max-height: 46vh; height: auto; }
.tiles-svg rect { stroke: #fff; stroke-width: .1; }
.tile-t { fill: #fff; font-weight: 800; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.tile-edge { fill: var(--navy); font-weight: 900; text-anchor: middle; }
.tiles-ctl { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
@media (max-width: 420px) { .tiles-ctl { grid-template-columns: 1fr; } }
.tiles-edge { display: grid; gap: 6px; padding: 10px 12px; border: 2px solid var(--border-lite); border-radius: var(--r-sm); background: var(--surface); }
.tiles-edge-t { margin: 0; font-weight: 900; color: var(--navy); }
.tiles-step { display: flex; align-items: center; gap: 8px; }
.tiles-step-l { flex: 1; display: grid; font-weight: 800; font-size: 14px; line-height: 1.2; }
.tiles-step-l small { font-weight: 500; color: var(--ink-muted); font-size: 12px; }
.tiles-step-v { min-width: 1.6em; text-align: center; font-size: 20px; font-variant-numeric: tabular-nums; }

/* 函數打靶 */
.game-art-aim { background: var(--surface-3); box-shadow: 0 4px 0 var(--border); padding: 8px; }
.aim { max-width: 520px; margin: 0 auto; display: grid; gap: var(--sp-3); }
.aim-board { padding: 6px; }
.aim-svg { display: block; width: 100%; height: auto; max-height: 40vh; margin: 0 auto; }
.aim-grid { stroke: var(--border-lite); stroke-width: .04; }
.aim-axis { stroke: var(--ink-faint); stroke-width: .08; }
.aim-tick { fill: var(--ink-faint); text-anchor: middle; }
.aim-curve { fill: none; stroke: var(--navy); stroke-width: .16; stroke-linecap: round; stroke-linejoin: round; }
.aim-t circle:first-child { fill: none; stroke: var(--cta); stroke-width: .16; }
.aim-t .aim-dot { fill: var(--cta); stroke: none; }
.aim-t.is-hit circle:first-child { stroke: var(--green); fill: var(--green-tint); }
.aim-t.is-hit .aim-dot { fill: var(--green); }
.aim-eq { margin: 0; text-align: center; font-size: 20px; font-weight: 900; color: var(--navy); }
.aim-ctl { display: grid; gap: 8px; padding: 10px 12px; border: 2px solid var(--border-lite); border-radius: var(--r-sm); background: var(--surface); }
.aim-row { display: grid; grid-template-columns: 6.2em auto minmax(0, 1fr) auto 2.4em; gap: 6px; align-items: center; }
.aim-row .btn { padding: 2px 10px; min-width: 34px; min-height: 34px; }
.aim-lab { font-weight: 800; font-size: 13px; line-height: 1.2; }
.aim-range { width: 100%; min-width: 0; accent-color: var(--cta); }
.aim-val { text-align: center; font-variant-numeric: tabular-nums; }

/* 吃數字 */
.game-art-munch { background: var(--purple-tint); box-shadow: 0 4px 0 var(--border); padding: 14px; }
.munch { max-width: 520px; margin: 0 auto; display: grid; gap: var(--sp-2); }
.munch-rule { margin: var(--sp-2) 0 0; text-align: center; font-size: 20px; font-weight: 900; color: var(--navy); }
.munch-rule small { font-size: 13px; font-weight: 700; color: var(--ink-muted); }
.munch-rule.is-hurt { animation: eq-shake .3s; color: var(--red-deep); }
.munch-timebar { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.munch-timebar i { display: block; height: 100%; background: var(--cta); transition: width .2s linear; }
.munch-time-row { display: flex; justify-content: space-between; margin: 0; align-items: baseline; }
.munch-time-row b { font-variant-numeric: tabular-nums; }
.munch-time-row b.is-low { color: var(--red-deep); }
.munch-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 6px; }
.munch-cell {
  aspect-ratio: 1; display: grid; place-items: center; border: 2px solid var(--border); border-radius: 10px; background: var(--surface);
  font: inherit; font-size: clamp(14px, 4.6vw, 20px); font-weight: 900; color: var(--navy); cursor: pointer; padding: 0;
  box-shadow: 0 3px 0 var(--border); font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.munch-cell:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--border); }
.munch-cell.is-eaten { background: var(--green-tint); border-color: var(--green); box-shadow: none; opacity: .55; }
.munch-cell.is-wrong { background: var(--red-tint); border-color: var(--red); box-shadow: none; color: var(--red-deep); text-decoration: line-through; opacity: .8; }
.munch-cell.has-mon { background: var(--purple-tint); border-color: var(--purple); }
.munch-mon { width: 80%; height: 80%; }
@media (prefers-reduced-motion: reduce) { .munch-rule.is-hurt { animation: none; } .munch-timebar i { transition: none; } }

/* 因數 2048 */
.game-art-fuse { background: var(--amber-tint); box-shadow: 0 4px 0 var(--amber-bd); color: var(--orange-deep); font-size: 22px; line-height: 1.1; text-align: center; }
.fuse { max-width: 440px; margin: 0 auto; display: grid; gap: var(--sp-2); }
.fuse-target { margin: var(--sp-2) 0 0; text-align: center; font-size: 18px; font-weight: 700; }
.fuse-target b { font-size: 32px; color: var(--cta-deep); }
.fuse-target small { font-size: 15px; color: var(--ink-muted); font-weight: 700; }
.fuse-rule { margin: 0; text-align: center; }
.fuse-board {
  display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 6px; padding: 8px; border-radius: var(--r-md);
  background: var(--surface-4); touch-action: none; user-select: none; -webkit-user-select: none;
}
.fuse-tile {
  aspect-ratio: 1; display: grid; place-items: center; align-content: center; border-radius: 10px; background: hsl(var(--h) 70% 82%);
  color: hsl(var(--h) 55% 22%); font-weight: 900; line-height: 1.1; overflow: hidden; padding: 2px;
}
.fuse-tile b { font-size: clamp(16px, 6vw, 26px); font-variant-numeric: tabular-nums; }
.fuse-tile small { font-size: clamp(8px, 2.4vw, 11px); font-weight: 700; opacity: .8; }
.fuse-tile.is-empty { background: var(--border-lite); }
.fuse-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fuse-pad .btn { font-size: 20px; padding: 8px 0; }

/* 彈珠台機率 */
.game-art-plinko { background: var(--blue-tint); box-shadow: 0 4px 0 var(--border); padding: 8px; }
.plinko { max-width: 520px; margin: 0 auto; display: grid; gap: var(--sp-3); }
.pl-card { padding: 8px; }
.pl-svg { display: block; width: 100%; height: auto; max-height: 44vh; margin: 0 auto; }
.pl-peg { fill: var(--ink-faint); }
.pl-base { stroke: var(--ink-faint); stroke-width: 1.5; }
.pl-bar { fill: var(--blue); opacity: .85; }
.pl-bar.is-in { fill: var(--cta); opacity: 1; }
.pl-cnt { fill: var(--navy); font-size: 9px; font-weight: 800; text-anchor: middle; }
.pl-lab { fill: var(--ink-muted); font-size: 10px; font-weight: 700; text-anchor: middle; }
.pl-mark { stroke: var(--navy); stroke-width: 1.6; stroke-dasharray: 3 2; }
.pl-route { fill: none; stroke: var(--green); stroke-width: 2; opacity: .8; stroke-linejoin: round; }
.pl-ball { fill: var(--green-deep); }
.pl-hint { margin: 4px 0 0; text-align: center; }
.pl-v { min-width: 3em; }

/* 數線跳跳 */
.game-art-numline { background: var(--green-tint); box-shadow: 0 4px 0 var(--border); padding: 8px; }
.numline { max-width: 520px; margin: 0 auto; display: grid; gap: var(--sp-3); }
.nl-card { padding: 8px; }
.nl-svg { display: block; width: 100%; height: auto; }
.nl-axis { stroke: var(--navy); stroke-width: 2.4; stroke-linecap: round; }
.nl-tick { stroke: var(--navy); stroke-width: 1.4; }
.nl-tick.is-zero { stroke-width: 2.6; }
.nl-lab { fill: var(--ink-muted); font-size: 9px; font-weight: 700; text-anchor: middle; }
.nl-lab.is-zero { fill: var(--navy); font-weight: 900; }
.nl-hit { fill: transparent; cursor: pointer; }
.nl-hit:hover { fill: rgba(240, 87, 58, .08); }
.nl-sel line { stroke: var(--cta); stroke-width: 2; } .nl-sel path { fill: var(--cta); } .nl-sel circle { fill: var(--cta); }
.nl-right line { stroke: var(--green-deep); stroke-width: 2; } .nl-right path { fill: var(--green); } .nl-right circle { fill: var(--green-deep); }
.nl-wrong line { stroke: var(--red-deep); stroke-width: 2; } .nl-wrong path { fill: var(--red); } .nl-wrong circle { fill: var(--red-deep); }
#nl-frog { transition: transform .5s ease; }
@media (prefers-reduced-motion: reduce) { #nl-frog { transition: none; } }

/* 座標戰艦 */
.game-art-battle { background: var(--blue-tint); box-shadow: 0 4px 0 var(--border); padding: 8px; }
.battle { max-width: 520px; margin: 0 auto; display: grid; gap: var(--sp-3); }
.bt-card { padding: 6px; }
.bt-svg { display: block; width: 100%; height: auto; max-height: 56vh; margin: 0 auto; }
.bt-grid { stroke: var(--border-lite); stroke-width: 1; }
.bt-axis { stroke: var(--navy); stroke-width: 2; }
.bt-lab { fill: var(--ink-muted); font-size: 8px; font-weight: 700; text-anchor: middle; }
.bt-lab.is-o { fill: var(--navy); font-weight: 900; }
.bt-axis-n { fill: var(--navy); font-size: 10px; font-weight: 900; font-style: italic; }
.bt-hit { fill: transparent; cursor: crosshair; }
.bt-hit:hover { fill: rgba(27, 58, 107, .08); }
.bt-hitm { fill: var(--red); stroke: #fff; stroke-width: 1.5; }
.bt-miss { stroke: var(--ink-faint); stroke-width: 2; stroke-linecap: round; fill: none; }
.bt-ship { stroke-width: 9; stroke-linecap: round; opacity: .35; }
.bt-ship.is-sunk { stroke: var(--green); }
.bt-ship.is-left { stroke: var(--orange); opacity: .55; }
.bt-aim line { stroke: var(--cta); stroke-width: 2; } .bt-aim circle { fill: none; stroke: var(--cta); stroke-width: 2; }
.bt-fleet { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.bt-ship-chip { font-size: 14px; letter-spacing: 1px; color: var(--navy); padding: 2px 10px; border-radius: var(--r-pill); background: var(--surface-3); border: 2px solid var(--border); }
.bt-ship-chip.is-sunk { color: var(--green-deep); background: var(--green-tint); border-color: var(--green); text-decoration: line-through; }

/* 格點畢氏 */
.game-art-pyth { background: var(--blue-tint); box-shadow: 0 4px 0 var(--border); padding: 8px; }
.pyth { max-width: 520px; margin: 0 auto; display: grid; gap: var(--sp-3); }
.py-card { padding: 6px; }
.py-svg { display: block; width: 100%; height: auto; max-height: 54vh; margin: 0 auto; }
.py-dot { fill: var(--ink-faint); }
.py-hit { fill: transparent; cursor: pointer; }
.py-hit:hover { fill: rgba(240, 87, 58, .12); }
.py-pick { fill: none; stroke: var(--cta); stroke-width: 2.5; }
.py-leg { fill: none; stroke: var(--ink-faint); stroke-width: 1.6; stroke-dasharray: 4 3; }
.py-seg { stroke-width: 3.2; stroke-linecap: round; stroke: var(--navy); }
.py-seg.is-good, .py-end.is-good { stroke: var(--green-deep); fill: var(--green-deep); }
.py-seg.is-bad, .py-end.is-bad { stroke: var(--red-deep); fill: var(--red-deep); }
.py-seg.is-hint, .py-end.is-hint { stroke: var(--orange); fill: var(--orange); }
.py-end { fill: var(--navy); }
.py-end.is-tri { fill: var(--navy); }
.py-tri { fill: rgba(59, 130, 224, .14); stroke: var(--navy); stroke-width: 2.4; stroke-linejoin: round; }
.py-t { fill: var(--navy); font-size: 11px; font-weight: 800; text-anchor: middle; }
.py-name { fill: var(--navy); font-size: 13px; font-weight: 900; }

/* 算式方格 */
.game-art-cage { background: var(--surface-3); box-shadow: 0 4px 0 var(--border); padding: 8px; }
.cage { max-width: 440px; margin: 0 auto; display: grid; gap: var(--sp-2); }
.cg-rule { margin: 0; }
.cg-board { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 0; background: var(--surface); border: 3px solid var(--navy); border-radius: 8px; overflow: hidden; }
.cg-cell {
  position: relative; aspect-ratio: 1; display: grid; place-items: center; padding: 0; font: inherit; color: var(--navy); background: var(--surface); cursor: pointer;
  border: 1px solid var(--border); border-radius: 0;
}
.cg-cell b { font-size: clamp(22px, 8vw, 34px); font-weight: 900; font-variant-numeric: tabular-nums; }
.cg-cell.e-t { border-top: 3px solid var(--navy); } .cg-cell.e-b { border-bottom: 3px solid var(--navy); }
.cg-cell.e-l { border-left: 3px solid var(--navy); } .cg-cell.e-r { border-right: 3px solid var(--navy); }
.cg-cell.is-given { background: var(--surface-4); }
.cg-cell.is-sel { background: var(--cta-tint); }
.cg-cell.is-bad { background: var(--red-tint); color: var(--red-deep); }
.cg-tag { position: absolute; top: 2px; left: 4px; font-size: clamp(11px, 3.4vw, 14px); font-weight: 900; color: var(--navy); }
.cg-tag.is-bad { color: var(--red-deep); }
.cg-pad { display: grid; grid-template-columns: repeat(4, 1fr) 1.6fr; gap: 6px; }
.cg-key { height: 48px; border: 2px solid var(--border); border-radius: 10px; background: var(--surface-3); font: inherit; font-size: 20px; font-weight: 900; color: var(--navy); cursor: pointer; }
.cg-key.is-wide { font-size: 14px; }
.cg-key:disabled { opacity: .5; cursor: default; }

/* 入口頁最上方的橫幅（16:9） */
.games-banner { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 670; object-fit: cover; border-radius: var(--r-lg); margin-bottom: var(--sp-4); background: var(--surface-3); }

/* 窄螢幕（≤ 400px）：方程式猜謎的數字鍵分兩排，每個鍵至少 44px 寬 */
@media (max-width: 400px) {
  .eq-keyrow:first-child { flex-wrap: wrap; }
  .eq-keyrow:first-child .eq-key { flex: 0 0 calc((100% - 20px) / 5); max-width: none; }
}
