:root {
  --bg: #150e09;
  --panel: #241810;
  --panel-2: #33231a;
  --line: #5a4229;
  --text: #f4e8cd;
  --muted: #b9a582;
  --khaki: #dcc79b;
  --gold: #e8b453;
  --brass: #b98d45;
  --brass-2: #8b6630;
  --parchment: #f2e4bf;
  --leather: linear-gradient(#3b291b, #261910);
  --red-1: #c9302f;
  --red-2: #7c1418;
  --red-ink: #fbe9c6;
  --blue-1: #2f6fc0;
  --blue-2: #153d77;
  --blue-ink: #e6eef8;
  --win: #9fd067;
  --lose: #ef7a62;
  --font-display: "Oswald", "Arial Narrow", system-ui, sans-serif;
  --font-ui: "Spectral", Georgia, serif;
  --font-num: "Oswald", "Arial Narrow", system-ui, sans-serif;
  --font-type: "Oswald", "Arial Narrow", system-ui, sans-serif;
  --font-prose: "Spectral", Georgia, serif;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-soft: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1200px 640px at 50% -10%, rgba(232, 180, 83, .12), transparent 70%),
    radial-gradient(ellipse at 50% 40%, #2c1e13, var(--bg) 70%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-ui);
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: var(--grain); opacity: .14; mix-blend-mode: overlay;
}
[hidden] { display: none !important; }
body:has(#home:not([hidden])) {
  background:
    linear-gradient(90deg, rgba(20, 12, 7, .92) 0%, rgba(20, 12, 7, .7) 36%, rgba(20, 12, 7, .12) 66%, rgba(20, 12, 7, .2) 100%),
    linear-gradient(180deg, rgba(20, 12, 7, .35), transparent 22%, transparent 75%, rgba(21, 14, 9, .85)),
    url("/images/hero.webp") 62% 30% / cover no-repeat fixed,
    var(--bg);
}

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

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; border-bottom: 2px solid var(--brass-2);
  background: linear-gradient(#2e2015, #1b120b);
  box-shadow: 0 1px 0 rgba(232, 180, 83, .25), 0 6px 18px rgba(0, 0, 0, .4);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--parchment); text-decoration: none;
}
.brand::before {
  content: "★"; display: inline-grid; place-items: center; width: 30px; height: 30px; letter-spacing: 0;
  border: 2px solid var(--brass); border-radius: 50%; color: var(--red-ink); font-size: 14px;
  background: radial-gradient(circle at 40% 35%, #e0484a, #8e1a1f 70%);
}
.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; letter-spacing: .06em; text-transform: uppercase; font-size: 14px; }
.link:hover { color: var(--text); }
.sound { display: inline-flex; padding: 4px; }
.sound svg { width: 22px; height: 22px; }
.sound .off, .sound.muted .on { display: none; }
.sound.muted .off { display: inline; }

main { max-width: 1200px; margin: 0 auto; padding: 28px 16px 48px; }

.btn {
  font: inherit; font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text); background: linear-gradient(#4a3423, #2d1f14); border: 2px solid var(--brass-2); border-radius: 8px;
  padding: 10px 18px; cursor: pointer; transition: filter .15s, border-color .15s, transform .05s;
  box-shadow: inset 0 1px 0 rgba(255, 230, 180, .15), 0 3px 0 #120b06, 0 5px 10px rgba(0, 0, 0, .35);
}
.btn:hover { border-color: var(--gold); filter: brightness(1.1); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 230, 180, .15), 0 1px 0 #120b06; }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn:focus-visible, .link:focus-visible, input:focus-visible, .icon-btn:focus-visible, .mode-face:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn.primary {
  color: var(--red-ink); background: linear-gradient(#d8403c, #9b1d20 60%, #7a1316); border-color: var(--brass);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .45);
}
.btn.campaign { color: #2b1a08; background: linear-gradient(#f1cd7a, #c8963f); border-color: var(--brass); }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--line); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.muted { color: var(--muted); }

/* ---------- home: mode cards in the style of a war-room menu ---------- */
#home {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 540px); gap: 56px;
  align-items: center; min-height: calc(100vh - 150px);
}
h1 {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(38px, 4.6vw, 60px); margin: 0;
  letter-spacing: .03em; line-height: 1.02; text-transform: uppercase; text-wrap: balance; color: var(--parchment);
  text-shadow: 0 3px 0 rgba(0, 0, 0, .55), 0 0 40px rgba(232, 180, 83, .18);
}
.hero h1 span {
  display: block; margin-top: 12px; color: var(--gold); font-size: .4em; letter-spacing: .2em; line-height: 1.3;
}
.hero-intro { max-width: 44ch; margin: 16px 0 0; color: var(--muted); line-height: 1.6; font-size: 16px; }

.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 14px; max-width: 560px; margin: 46px 0 0; }
.mode { margin: 0; }
.mode-ai, .mode-friends { grid-column: 1 / -1; }
.mode-face {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
  width: 100%; min-height: 104px; padding: 34px 10px 14px; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: .06em; text-transform: uppercase; color: #3b2512;
  background: var(--grain-soft), radial-gradient(ellipse at 50% 75%, #fdf6e1, #ecdcb3 65%, #d5bd88);
  border: 4px solid var(--brass); border-radius: 50% 50% 12px 12px / 44px 44px 12px 12px;
  box-shadow: inset 0 0 0 2px #2f63a3, inset 0 0 0 5px rgba(255, 248, 228, .6), inset 0 -10px 18px rgba(120, 85, 35, .25),
    0 5px 0 #5e4120, 0 12px 22px rgba(0, 0, 0, .5);
  transition: transform .12s, filter .12s;
}
.mode-face:hover { transform: translateY(-3px); filter: brightness(1.05); }
.mode-face:active { transform: translateY(2px); }
.mode-face .disc {
  position: absolute; top: -24px; left: 50%; transform: translateX(-50%);
  display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; color: #fbecc8;
  background: radial-gradient(circle at 38% 32%, #ea5552, #a51e23 60%, #6b0f13);
  border: 3px solid var(--brass); box-shadow: 0 0 0 2px #3a2511, 0 4px 8px rgba(0, 0, 0, .45), inset 0 -4px 8px rgba(0, 0, 0, .3);
}
.mode-face .disc svg { width: 26px; height: 26px; }
.mode-ai .mode-face { min-height: 128px; font-size: 30px; padding-top: 46px; }
.mode-ai .mode-face .disc { width: 70px; height: 70px; top: -34px; }
.mode-ai .mode-face .disc svg { width: 36px; height: 36px; }
.mode-ai { display: flex; flex-direction: column; gap: 10px; }
.arrange-ai { align-self: center; padding: 4px 8px; font-size: 13px; }
.mode-friends { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: end; }
.join { display: flex; gap: 8px; }
.join input {
  flex: 1; min-width: 0; font: inherit; font-family: var(--font-display); font-size: 17px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--text); background: rgba(0, 0, 0, .35); border: 2px solid var(--brass-2); border-radius: 8px; padding: 10px 12px;
}
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; padding: 0; border: 0; }
.levels label { position: relative; }
.levels input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.levels span {
  display: block; text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: .1em;

  text-transform: uppercase; padding: 8px 0; border-radius: 8px; color: var(--muted);
  background: linear-gradient(#3a281a, #24180f); border: 2px solid var(--line);
}
.levels input:checked + span { color: #2b1a08; background: linear-gradient(#f1cd7a, #c8963f); border-color: var(--brass); }
.levels input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }

.hero-stage { perspective: 1400px; }
.hero-board { pointer-events: none; transform: rotateX(24deg) rotateZ(-3deg); }
@media (max-width: 860px) {
  #home { grid-template-columns: 1fr; gap: 40px; min-height: 0; }
  .modes { max-width: none; }
}
@media (max-width: 520px) {
  .modes { grid-template-columns: 1fr 1fr; }
  .modes > :nth-child(4) { grid-column: 1 / -1; }
  .mode-friends { grid-template-columns: 1fr; }
  .mode-ai .mode-face { font-size: 24px; }
}

/* ---------- board: grass field, blue lakes, wooden frame ---------- */
.board-wrap { position: relative; }
.board {
  container-type: inline-size;
  display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); grid-template-rows: repeat(10, minmax(0, 1fr));
  width: 100%; aspect-ratio: 1; user-select: none;
  border: 14px solid transparent; border-radius: 12px;
  background:
    var(--board-art, none) 0 0 / 100% 100% no-repeat padding-box,
    radial-gradient(ellipse at 50% 42%, #86b34f, #63943a 50%, #44702a) padding-box,
    linear-gradient(150deg, #a8763b, #6a4420 35%, #452a12 65%, #8a5e2c) border-box;
  box-shadow: 0 0 0 2px #d1a556, 0 0 0 6px #241608, 0 28px 60px rgba(0, 0, 0, .65), inset 0 0 50px rgba(10, 30, 0, .45);
}
.cell { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; }
#board .cell:not(.lake) { cursor: pointer; }
/* Low specificity on purpose: move targets on the bottom row take over ::after. */
#board [data-r]::before {
  content: attr(data-r); position: absolute; left: 3%; top: 2%; z-index: 1; pointer-events: none;
  font: 700 max(8px, 1.4cqw)/1 var(--font-display); color: rgba(255, 252, 232, .7); text-shadow: 0 1px 1px rgba(0, 0, 0, .7);
}
#board [data-f]::after {
  content: attr(data-f); position: absolute; right: 4%; bottom: 2%; z-index: 1; pointer-events: none;
  font: 700 max(8px, 1.4cqw)/1 var(--font-display); color: rgba(255, 252, 232, .7); text-shadow: 0 1px 1px rgba(0, 0, 0, .7);
}
.cell.setup { box-shadow: inset 0 0 0 1px rgba(255, 245, 200, .14); }
.cell.last { background: rgba(255, 226, 110, .2); box-shadow: inset 0 0 0 2px rgba(255, 226, 110, .7); }
.cell.last.from { background: rgba(255, 226, 110, .1); box-shadow: inset 0 0 0 2px rgba(255, 226, 110, .35); }
#board .cell.target::after {
  content: ""; position: absolute; inset: auto; width: 26%; height: 26%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #fffbe8 0 34%, rgba(255, 240, 180, .45) 40% 100%);
  box-shadow: 0 0 12px rgba(255, 240, 180, .85);
}
#board .cell.target.attack::after {
  width: 100%; height: 100%; border-radius: 0; box-shadow: none; z-index: 2;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%23ff4f3f' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M3 11V3h8M29 3h8v8M37 29v8h-8M11 37H3v-8'/%3E%3C/g%3E%3C/svg%3E") center / 92% no-repeat;
  animation: aim .9s ease-in-out infinite alternate;
}
#board .cell.target.attack.odds-win::after { filter: hue-rotate(95deg) saturate(1.2); }
#board .cell.target.attack.odds-trade::after { filter: hue-rotate(40deg) brightness(1.3); }
#board .cell.target.attack.odds-lose::after { filter: grayscale(1); opacity: .6; animation: none; }
@keyframes aim { from { transform: scale(1); } to { transform: scale(.9); } }
.cell.hint { animation: hint 1s ease-in-out infinite alternate; }
@keyframes hint { from { box-shadow: inset 0 0 0 2px rgba(255, 226, 110, .3); } to { box-shadow: inset 0 0 0 5px rgba(255, 226, 110, .95); } }

/* ---------- pieces: coloured tokens with a portrait cameo ---------- */
.piece {
  --c1: #ea4b49; --c2: #b8242a; --c3: #74111a; --ink: #5a0e14;
  position: relative; display: grid; place-items: center; flex: none;
  border-radius: 40% / 48%; font-family: var(--font-num); font-weight: 900; line-height: 1;
  background: var(--grain-soft), radial-gradient(120% 95% at 50% 15%, var(--c1), var(--c2) 52%, var(--c3));
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .4), inset 0 2px 0 rgba(255, 255, 255, .38), inset 0 -3px 0 rgba(0, 0, 0, .32), 0 3px 4px rgba(0, 0, 0, .55);
}
.piece.blue { --c1: #5b9be6; --c2: #2862b4; --c3: #123670; --ink: #0f2c5a; }
.cell .piece { width: 90%; height: 78%; font-size: 3.1cqw; transition: transform .12s; }
.piece .art {
  position: absolute; inset: 8% 7%; overflow: hidden; border-radius: 50%; background: #2a1a10;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .45), 0 -1px 0 1.5px rgba(255, 255, 255, .22);
}
.piece .art svg { display: block; width: 100%; height: 100%; }
.piece .art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; pointer-events: none; }
.piece .art::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 2px 5px rgba(0, 0, 0, .45); }
.piece .num {
  position: absolute; left: 3%; top: -4%; z-index: 1; font-size: 1em; font-weight: inherit; color: #fff;
  text-shadow: .05em 0 0 #111, -.05em 0 0 #111, 0 .05em 0 #111, 0 -.05em 0 #111, .04em .04em 0 #111, -.04em -.04em 0 #111, .04em -.04em 0 #111, -.04em .04em 0 #111, 0 .09em 0 #111;
}
.piece.hidden .crest { width: 70%; height: 70%; color: var(--c3); }
.piece.hidden .crest .cut { fill: var(--c2); }
.piece.hidden::after {
  content: ""; position: absolute; inset: 7% 6%; border-radius: 50%; pointer-events: none;
  box-shadow: inset 0 1.5px 0 rgba(0, 0, 0, .35), 0 1px 0 rgba(255, 255, 255, .25);
}
.piece .note {
  position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-num);
  color: #ffe08a; text-shadow: 0 1px 2px #000, 0 0 6px #000;
}
.piece .note::after { content: "?"; font-size: .55em; position: absolute; right: 12%; top: 8%; }
.piece.moved::before {
  content: ""; position: absolute; left: 14%; bottom: 10%; width: 20%; height: 8%;
  border-bottom: 2px dotted rgba(255, 255, 255, .75);
}
.piece.exposed::after {
  content: ""; position: absolute; top: 4%; right: 8%; z-index: 1; width: 16%; height: 20%;
  border-radius: 50%; background: #ffd04f; box-shadow: 0 0 0 1.5px #3a2208, 0 0 5px #ffd04f;
}
.piece.unveiled { outline: 2px dashed rgba(255, 226, 110, .9); outline-offset: -3px; filter: saturate(.7); }
.cell.selected .piece {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 0 0 3px #ffd56b, 0 0 18px rgba(255, 213, 107, .85), 0 10px 14px rgba(0, 0, 0, .55);
}

.piece.mini { width: 30px; height: 25px; font-size: 13px; }
.piece.mini .art { display: none; }
.piece.mini.icon .art { display: block; inset: 10% 8%; }
.piece.mini .num { position: static; text-shadow: 0 1px 0 rgba(0, 0, 0, .6); }
.piece.mini.hidden .crest { width: 78%; height: 78%; }
.piece.big { width: 150px; height: 124px; font-size: 40px; }
.piece.lost { opacity: .35; filter: grayscale(.9); }

/* ---------- battle reveal ---------- */
.combat {
  position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(circle, rgba(18, 10, 4, .55), rgba(10, 6, 2, .88)); pointer-events: none; border-radius: 12px;
  animation: fade 1.5s ease forwards;
}
.duel { display: flex; align-items: center; gap: 18px; }
.fighter {
  position: relative; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; width: 186px; padding: 0 14px 18px;
  background: var(--grain), linear-gradient(#4a3524, #2a1c11); border: 3px solid var(--brass); border-radius: 10px;
  box-shadow: inset 0 0 0 2px #22150a, 0 16px 30px rgba(0, 0, 0, .6);
  animation: charge-l .35s cubic-bezier(.2, .8, .2, 1);
}
.fighter:last-child { animation-name: charge-r; }
.fighter::after, .player::after {
  content: ""; position: absolute; inset: -3px; z-index: 2; pointer-events: none;
  background:
    var(--cn-tl, none) 0 0 / 22px no-repeat, var(--cn-tr, none) 100% 0 / 22px no-repeat,
    var(--cn-bl, none) 0 100% / 22px no-repeat, var(--cn-br, none) 100% 100% / 22px no-repeat;
}
.player::after { inset: -2px; background-size: 18px; }
.fighter figcaption {
  align-self: stretch; margin: 0 -14px; padding: 9px 6px; border-radius: 6px 6px 0 0; text-align: center;
  font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: .1em; text-transform: uppercase;
  color: #2b1a08; background: linear-gradient(#f0cd7c, #b98a3c); border-bottom: 2px solid #22150a;
}
.fighter.lost .piece { animation: fall .5s .45s ease forwards; }
.vs { color: var(--muted); font-weight: 700; }
.duel .vs {
  display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; z-index: 1; margin: 0 -30px;
  font-family: var(--font-num); font-size: 20px; color: #fbecc8;

  background: radial-gradient(circle at 38% 32%, #ea5552, #a51e23 60%, #6b0f13); border: 3px solid var(--brass);
  box-shadow: 0 0 0 2px #22150a, 0 0 24px rgba(234, 85, 82, .6);
}
.verdict {
  margin: 0; padding: 8px 40px; border-block: 2px solid var(--brass);
  font-family: var(--font-display); font-weight: 700; font-size: 24px; letter-spacing: .12em; text-transform: uppercase;
  background: linear-gradient(90deg, transparent, rgba(30, 18, 8, .95) 15% 85%, transparent);
  animation: stamp .3s .3s ease both;
}
.verdict.good { color: var(--win); }
.verdict.bad { color: var(--lose); }
.verdict.even { color: var(--khaki); }
@keyframes fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes charge-l { from { transform: translateX(-80px) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes charge-r { from { transform: translateX(80px) rotate(6deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fall { to { opacity: .3; filter: grayscale(1) brightness(.6); transform: rotate(-8deg) translateY(6px); } }
@keyframes stamp { from { transform: scale(1.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.blast {
  position: absolute; width: 22%; aspect-ratio: 1; margin: -11% 0 0 -11%; border-radius: 50%; pointer-events: none; z-index: 3;
  background: radial-gradient(circle, #fff6cf 0, #f7b34a 22%, rgba(214, 84, 36, .8) 45%, rgba(60, 40, 20, .5) 65%, transparent 72%);
  animation: blast .7s ease-out forwards;
}
@keyframes blast { from { transform: scale(.2); opacity: 1; } 60% { opacity: .85; } to { transform: scale(1.5); opacity: 0; } }
.board-wrap.shake { animation: shake .42s ease; }
@keyframes shake {
  0%, 100% { transform: none; }
  20% { transform: translate(-5px, 3px); }
  40% { transform: translate(4px, -3px); }
  60% { transform: translate(-3px, 2px); }
  80% { transform: translate(2px, -1px); }
}

.turn-banner { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; pointer-events: none; }
.turn-banner span {
  padding: 14px 90px; border-block: 3px solid var(--brass);
  font-family: var(--font-display); font-weight: 700; font-size: clamp(26px, 4vw, 46px); letter-spacing: .14em; text-transform: uppercase;
  color: #fff4d8; text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
  background: linear-gradient(90deg, transparent, rgba(150, 24, 28, .95) 18%, rgba(196, 40, 42, .97) 50%, rgba(150, 24, 28, .95) 82%, transparent);
  animation: banner 1.3s ease both;
}
@keyframes banner {
  0% { opacity: 0; transform: scaleX(.2); }
  16% { opacity: 1; transform: none; }
  80% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-14px); }
}

.intel {
  position: absolute; z-index: 5; display: grid; grid-template-columns: repeat(7, 34px); gap: 4px; padding: 8px;
  background: var(--leather); border: 2px solid var(--brass); border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .6);
}
.intel button {
  height: 34px; padding: 0; font: 900 14px/1 var(--font-num); color: var(--text);
  background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
}
.intel button:hover, .intel button[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.intel button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

/* ---------- full-screen game stage ---------- */
body.playing .topbar, body.playing .site-footer { display: none; }
body.playing main { max-width: none; padding: 0; }
body.playing { overflow: hidden; }
.stage {
  --bs: min(calc(100dvh - 36px), calc(100vw - 640px));
  position: fixed; inset: 0; z-index: 1; display: grid; justify-content: center; align-items: center; gap: 24px; padding: 18px;
  grid-template-columns: minmax(250px, 300px) var(--bs) minmax(230px, 280px);
  background: radial-gradient(ellipse at 50% 45%, #3c2a1a, #1b120b 60%, #0c0805);
}
.stage .board-wrap { width: var(--bs); }
.hud {
  align-self: stretch; min-height: 0; display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.hud-right { justify-content: center; }
#bar-me { margin-top: auto; }
.stage-bar { display: flex; gap: 8px; }
.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; cursor: pointer; color: var(--parchment);
  background: linear-gradient(#4a3423, #2d1f14); border: 2px solid var(--brass-2); border-radius: 50%;
  box-shadow: inset 0 1px 0 rgba(255, 230, 180, .15), 0 3px 8px rgba(0, 0, 0, .4);
}
.icon-btn:hover { border-color: var(--gold); }
.icon-btn svg { width: 22px; height: 22px; }

.player {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  position: relative; padding: 10px 12px; border-radius: 12px;
  background: var(--grain), var(--leather); border: 2px solid var(--brass-2);
  box-shadow: inset 0 0 0 1px #1a1008, 0 8px 18px rgba(0, 0, 0, .45);
  transition: border-color .2s, box-shadow .2s;
}
.player .avatar {
  grid-row: 1 / span 2; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  font: 700 24px/1 var(--font-display); color: #fff2d2; text-shadow: 0 1px 0 rgba(0, 0, 0, .5);
  background: url("/images/pieces/marshal-red.webp") 50% 10% / 150% auto no-repeat, radial-gradient(circle at 38% 30%, #ea5552, #a51e23 60%, #6b0f13);
  color: transparent; text-shadow: none;
  border: 3px solid var(--brass); box-shadow: 0 0 0 2px #1a1008, inset 0 -6px 10px rgba(0, 0, 0, .35);
}
.player[data-side="blue"] .avatar { background: url("/images/pieces/general-blue.webp") 50% 10% / 150% auto no-repeat, radial-gradient(circle at 38% 30%, #5b9be6, #2862b4 60%, #123670); }
.player .name { grid-column: 2; font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .meta { grid-column: 2; grid-row: 2; font-size: 13px; color: var(--muted); }
.player .meta:empty { display: none; }
.player .clock {
  grid-column: 3; grid-row: 1 / span 2; padding: 4px 10px; border-radius: 8px; background: rgba(0, 0, 0, .4);
  font: 700 22px/1 var(--font-display); font-variant-numeric: tabular-nums;
}
.player .clock.low { color: var(--lose); }
.player.turn { border-color: #f1c45f; box-shadow: inset 0 0 0 1px #1a1008, 0 0 0 1px #f1c45f, 0 0 26px rgba(241, 196, 95, .35); }
.player.turn .avatar { animation: pulse 1.4s ease-in-out infinite alternate; }
@keyframes pulse { to { box-shadow: 0 0 0 2px #1a1008, 0 0 0 5px rgba(241, 196, 95, .55), inset 0 -6px 10px rgba(0, 0, 0, .35); } }

.status-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.status {
  font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding-left: 12px; border-left: 4px solid var(--line); color: var(--parchment);
}
.status.mine[data-side="red"] { border-color: var(--red-1); }
.status.mine[data-side="blue"] { border-color: var(--blue-1); }
.turn-no { font-family: var(--font-display); font-size: 14px; color: var(--muted); white-space: nowrap; }
.briefing {
  display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 10px;
  padding: 12px 14px; border: 2px solid var(--brass-2); border-radius: 10px;
  background: var(--grain-soft), radial-gradient(ellipse at 50% 30%, #f6ead0, #e2cc99); color: #3b2512;
}
.op-year { font-family: var(--font-display); font-weight: 700; color: var(--red-2); font-size: 15px; }
.op-name { font-family: var(--font-display); font-size: 20px; letter-spacing: .08em; text-transform: uppercase; }
.op-brief { grid-column: 1 / -1; margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: #5a3f22; }
.room-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.room-code { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: .25em; color: var(--gold); }
.setup { display: flex; flex-direction: column; gap: 10px; }
.setup .row .btn { flex: 1; }
.btn.ready { font-size: 20px; padding: 12px; }
.hint { margin: 0; color: var(--muted); font-size: 14px; }
.matchup {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 10px;
  padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, .26); font-size: 14px;
}
.mu-piece { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; letter-spacing: .04em; }
.mu-label { color: var(--muted); }
.runs { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 3px; vertical-align: middle; }
.thru { color: var(--muted); padding: 0 1px; }
.actions-row .btn { flex: 1; }

.grave { width: 100%; border-collapse: separate; border-spacing: 0 3px; font-size: 14px; }
.grave thead th { padding: 0 0 4px; }
.grave thead th[data-side]::before {
  content: ""; display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--brass);
  background: radial-gradient(circle at 38% 30%, #ea5552, #8e1a1f);
}
.grave thead th[data-side="blue"]::before { background: radial-gradient(circle at 38% 30%, #5b9be6, #153d77); }
.grave tbody tr { background: rgba(0, 0, 0, .26); }

.grave tbody th { padding: 3px 8px 3px 4px; border-radius: 8px 0 0 8px; text-align: left; font-weight: 600; white-space: nowrap; }
.grave tbody th > * { vertical-align: middle; }
.grave tbody th .piece { display: inline-grid; margin-right: 8px; }
.grave td { width: 44px; padding: 3px 4px; text-align: center; }
.grave td:last-child { border-radius: 0 8px 8px 0; }
.grave tr.gone th { opacity: .4; }
.cnt {
  position: relative; display: inline-grid; place-items: center; width: 30px; height: 28px; vertical-align: middle;
  clip-path: polygon(50% 0, 100% 37%, 81% 100%, 19% 100%, 0 37%); background: linear-gradient(#d6d9de, #5e636a);
}
.cnt::before {
  content: ""; position: absolute; inset: 3px; clip-path: inherit;
  background: radial-gradient(circle at 50% 58%, #ffd862, #f39a1e 58%, #c15d0d);
}
.cnt span { position: relative; margin-top: 4px; font: 900 13px/1 var(--font-num); color: #3a1c04; }
.cnt.out { filter: grayscale(1) brightness(.55); }

.log {
  list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px;
  max-height: 200px; overflow-y: auto; scrollbar-color: var(--line) transparent; scrollbar-width: thin;
}
.log:empty { display: none; }
.log li { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; background: rgba(0, 0, 0, .22); }
.log li:first-child { animation: dispatch .4s ease; }
.log .at { margin-left: auto; font-family: var(--font-display); font-size: 13px; color: var(--muted); }
@keyframes dispatch { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }

@media (max-width: 1000px) {
  body.playing { overflow: auto; }
  .stage { position: static; display: flex; flex-direction: column; align-items: stretch; gap: 10px; max-width: 640px; min-height: 100dvh; margin: 0 auto; padding: 10px; }
  .stage .board-wrap { width: 100%; }
  .hud { display: contents; }
  .stage-bar { order: 0; }
  #bar-opp { order: 1; }
  .board-wrap { order: 2; }
  .status-row, #matchup { order: 3; }
  #briefing { order: 4; }
  #room-bar { order: 5; }
  #setup-controls { order: 6; }
  #bar-me { order: 7; margin-top: 0; }
  .actions-row { order: 8; }
  .grave { order: 9; }
  .log { order: 10; }
  .board { border-width: 8px; }
  .player { padding: 6px 10px; }
  .player .avatar { width: 40px; height: 40px; font-size: 19px; }
}

/* ---------- dialogs ---------- */
.dialog {
  background:
    var(--cn-tl, none) 0 0 / 22px no-repeat, var(--cn-tr, none) 100% 0 / 22px no-repeat,
    var(--cn-bl, none) 0 100% / 22px no-repeat, var(--cn-br, none) 100% 100% / 22px no-repeat,
    var(--grain), linear-gradient(var(--panel-2), var(--panel));
  color: var(--text); border: 3px solid var(--brass); outline: 1px solid rgba(232, 180, 83, .25); outline-offset: -8px;
  border-radius: 12px; padding: 26px; max-width: min(540px, 92vw);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7);
}
.dialog::backdrop { background: rgba(6, 6, 4, .7); }
.dialog h2 { margin: 0 0 14px; font-family: var(--font-display); letter-spacing: .1em; text-transform: uppercase; }
.dialog.wide { width: min(620px, 94vw); max-width: none; }
.rules { padding-left: 20px; margin: 0 0 16px; line-height: 1.7; }
#rules { width: min(600px, 94vw); max-width: none; }
.matchups { width: 100%; border-collapse: separate; border-spacing: 0 3px; margin-bottom: 18px; font-size: 14px; }
.matchups thead th { padding: 0 8px 4px; text-align: left; color: var(--muted); font-weight: 600; }
.matchups tbody tr { background: rgba(0, 0, 0, .22); }
.matchups tbody th { padding: 3px 8px 3px 4px; border-radius: 8px 0 0 8px; text-align: left; font-weight: 600; white-space: nowrap; }
.matchups tbody th > * { vertical-align: middle; }
.matchups tbody th .piece { display: inline-grid; margin-right: 8px; }
.matchups tbody th .muted { margin-left: 6px; font-weight: 400; }
.matchups td { padding: 3px 8px; }
.matchups td:last-child { border-radius: 0 8px 8px 0; }
.result { text-align: center; min-width: 300px; }
.result h2 {
  display: inline-block; margin: 6px 0 16px; padding: 6px 22px; font-size: 46px;
  border: 4px double currentColor; transform: rotate(-3deg);
  animation: stamp .35s ease both;
}
.result h2.win { color: var(--win); }
.result h2.lose { color: var(--lose); }
.result p { color: var(--muted); margin: 0 0 18px; }
.result .row { justify-content: center; }
.medal { display: inline-flex; align-items: center; gap: 10px; margin: -4px 0 16px; font-family: var(--font-display); font-size: 20px; letter-spacing: .14em; text-transform: uppercase; }
.medal .medal-icon svg { width: 34px; height: 48px; animation: stamp .4s .2s ease both; }
.report { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 22px; padding: 12px 0; border-block: 1px dashed var(--line); }
.report dt { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.report dd { margin: 4px 0 0; font-family: var(--font-type); font-size: 22px; font-weight: 700; }

.medal-icon { display: inline-flex; }
.medal-icon svg { width: 18px; height: 26px; }
.medal-icon .ribbon { fill: #7d2a21; }
.medal-icon .stripe { fill: #e8dcc0; }
.medal-icon .emblem { fill: rgba(0, 0, 0, .35); }
.medal-icon.m1 .disc { fill: #b0713e; }
.medal-icon.m2 .disc { fill: #c9cdd1; }
.medal-icon.m3 .disc { fill: #e5bb4f; }

.ops { display: grid; gap: 18px; margin-bottom: 18px; }
.ops h3 { margin: 0 0 8px; font-family: var(--font-type); font-size: 14px; color: var(--gold); letter-spacing: .1em; }
.ops ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.op {
  width: 100%; display: grid; grid-template-columns: 52px 1fr auto 26px; align-items: center; gap: 12px;
  padding: 10px 12px; font: inherit; color: var(--text); text-align: left; cursor: pointer;
  background: rgba(0, 0, 0, .22); border: 1px solid var(--line); border-radius: 3px;
}
.op:hover:not(:disabled) { border-color: var(--gold); background: rgba(208, 166, 76, .08); }
.op:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.op:disabled { cursor: default; opacity: .5; }
.op .op-name { font-size: 17px; }
.op .lvl { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.op .lock { width: 18px; height: 18px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 20;
  background: var(--panel); border: 1px solid var(--brass-2); border-radius: 3px; font-family: var(--font-type);
  padding: 10px 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- accounts, ladder, clocks, saved setups ---------- */
.nav { display: flex; align-items: center; gap: 18px; }
#board { touch-action: none; }
.cell.dragging .piece { opacity: .3; }
.piece.ghost {
  position: fixed; left: 0; top: 0; z-index: 10; pointer-events: none;
  outline: 3px solid var(--gold); box-shadow: 0 12px 26px rgba(0, 0, 0, .6);
}

.saved { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.saved:empty { display: none; }
.saved-item { position: relative; }
.thumb {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 1px; width: 100%; padding: 4px;
  background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 2px; cursor: pointer;
}
.thumb:hover { border-color: var(--khaki); }
.thumb i { aspect-ratio: 1; border-radius: 1px; background: var(--red-1); }
.thumb .r0 { background: var(--gold); }
.thumb .r11 { background: var(--bg); }
.thumb .r1, .thumb .r2 { opacity: .3; }
.thumb .r3, .thumb .r4 { opacity: .45; }
.thumb .r5, .thumb .r6 { opacity: .6; }
.thumb .r7, .thumb .r8 { opacity: .8; }
.del {
  position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; padding: 0;
  border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font: inherit; font-size: 13px; line-height: 1; cursor: pointer;
}
.del:hover { color: var(--text); }

.dialog.narrow { width: min(360px, 92vw); }
.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.field input {
  font: inherit; font-family: var(--font-type); letter-spacing: 0; text-transform: none; color: var(--text); background: rgba(0, 0, 0, .3);
  border: 1px solid var(--line); border-radius: 3px; padding: 10px 12px;
}
.error { margin: 0; min-height: 1.2em; color: var(--lose); font-size: 14px; }
.result .delta { font-family: var(--font-type); font-size: 20px; font-weight: 800; margin-top: -6px; }
.result .delta.win { color: var(--win); }
.result .delta.lose { color: var(--lose); }

.ladder, .games {
  list-style: none; margin: 0 0 16px; padding: 0; min-width: min(420px, 80vw);
  max-height: 60vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.ladder li, .games li {
  display: grid; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px dashed var(--line);
}
.ladder li { grid-template-columns: 32px 1fr auto 52px; }
.ladder li.muted { display: block; }
.ladder .pos { color: var(--muted); font-family: var(--font-type); font-variant-numeric: tabular-nums; }

.ladder .name { text-align: left; color: var(--text); padding: 0; text-transform: none; font-size: 15px; }
.ladder li:nth-child(-n+3) .pos { color: var(--gold); font-weight: 800; }
.ladder b, .games b { text-align: right; font-family: var(--font-type); font-variant-numeric: tabular-nums; }
.games li { grid-template-columns: 28px 1fr auto 44px; }
.games:empty { display: none; }
.badge { display: inline-flex; justify-content: center; border-radius: 2px; font-size: 13px; padding: 2px 0; background: var(--line); }
.games .win .badge { background: rgba(0, 0, 0, .3); color: var(--win); }
.games .loss .badge { background: rgba(0, 0, 0, .3); color: var(--lose); }
.stats { display: grid; grid-template-columns: repeat(4, auto); gap: 12px 20px; margin: 0 0 16px; }
.stats div:last-child { grid-column: 1 / -1; }
.stats dt { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-family: var(--font-type); font-size: 18px; font-weight: 700; }
.brand, .nav .link, #account { white-space: nowrap; }
#account { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) {
  .topbar { padding: 12px 14px; gap: 10px; }
  .brand { letter-spacing: .08em; font-size: 17px; }
  .brand::before { width: 24px; height: 24px; font-size: 12px; }
  .nav { gap: 10px; }
  .nav .link { font-size: 12px; letter-spacing: .02em; }
  #account { max-width: 96px; }
  .piece.big { width: 92px; height: 76px; font-size: 26px; }
  .fighter { width: 132px; }
  .duel .vs { width: 44px; height: 44px; font-size: 15px; margin: 0 -22px; }
  .verdict { font-size: 17px; }
  .op { grid-template-columns: 44px 1fr auto 22px; gap: 8px; }
}
@media (max-width: 420px) {
  .brand { font-size: 0; gap: 0; }
}

.site-footer {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 12px 20px; padding: 16px 16px 28px; border-top: 3px double var(--line);
}
.site-footer a { color: var(--muted); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.prose { font-family: var(--font-prose); font-size: 17px; line-height: 1.7; }
.prose p, .prose ul, .prose ol { max-width: 70ch; }
.prose h2 { margin: 48px 0 16px; font-family: var(--font-display); font-size: 28px; line-height: 1.2; letter-spacing: .06em; text-transform: uppercase; }
.prose h3 { margin: 24px 0 8px; font-family: var(--font-ui); font-size: 18px; line-height: 1.4; }
.prose .btn { font-family: var(--font-ui); }
.prose a { color: var(--gold); text-underline-offset: 3px; }
.prose a:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.game-guide { max-width: 76ch; margin: 64px auto 0; padding-top: 16px; border-top: 3px double var(--line); }
.game-guide h2:first-child { margin-top: 24px; }
#game:not([hidden]) ~ .game-guide { display: none; }
.faq h3 { padding-top: 16px; border-top: 1px dashed var(--line); }
.guide-links { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 24px 0; font-family: var(--font-ui); }
.gameplay-shot { margin: 24px 0; }
.gameplay-shot img { display: block; width: 100%; height: auto; border: 1px solid var(--brass-2); border-radius: 4px; filter: sepia(.15); }
.gameplay-shot figcaption { margin-top: 8px; color: var(--muted); font-size: 14px; font-family: var(--font-type); }
.guide-page { max-width: 80ch; padding-top: 48px; }
.guide-page h1 { font-size: clamp(30px, 5vw, 46px); }
.guide-page .btn { display: inline-block; color: var(--red-ink); text-decoration: none; margin: 12px 0; }
.ranks { border-collapse: collapse; width: 100%; max-width: 60ch; font-family: var(--font-ui); }
.ranks caption { text-align: left; color: var(--muted); padding-bottom: 8px; }
.ranks th, .ranks td { padding: 8px 12px; border-bottom: 1px dashed var(--line); text-align: left; }
.legal { max-width: 80ch; padding-top: 48px; }
.legal h1 { font-size: clamp(28px, 5vw, 48px); line-height: 1.2; letter-spacing: .02em; }
.legal .updated { margin-bottom: 32px; }
.nav a { text-decoration: none; }
@media (max-width: 640px) {
  .prose h2 { margin-top: 32px; font-size: 24px; }
  .game-guide { margin-top: 48px; }
  .legal { padding-top: 32px; }
}
.site-footer a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (max-width: 520px) {
  .site-footer { gap: 10px 16px; padding: 14px 14px 24px; }
}


/* ===== 首屏版式修正（2026-11-18）：内容上移成组、棋盘收进安全区、难度条改成真 tab ===== */
#home.screen[hidden]{ display:none !important; }
#home.screen{
  display:grid;
  grid-template-columns:minmax(0,1.05fr) minmax(0,.95fr);
  align-items:center;
  gap:clamp(20px,3vw,48px);
  min-height:100svh;
  padding:clamp(76px,9vh,104px) clamp(20px,4vw,56px) clamp(24px,4vh,48px);
  box-sizing:border-box;
}
#home.screen .hero{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:clamp(12px,1.6vw,20px);
  min-width:0;
}
#home.screen .hero h1{ margin:0; }
#home.screen .hero-intro{ margin:0; max-width:44ch; }
#home.screen .modes{ margin-top:clamp(2px,.8vw,10px); width:100%; }
#home.screen .hero-stage{
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:0;
}
#home.screen .hero-board{
  width:100%;
  max-width:min(100%,600px);
  margin-inline:auto;
}
#home.screen .levels{
  display:inline-flex;
  padding:3px;
  gap:2px;
  border-radius:10px;
  background:rgba(20,12,7,.55);
  border:1px solid var(--line);
}
#home.screen .levels label{ position:relative; display:block; }
#home.screen .levels label > span{
  display:block;
  padding:8px 16px;
  border-radius:8px;
  font-family:var(--font-display);
  font-weight:600;
  font-size:13px;
  line-height:1;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:var(--muted);
  transition:background 160ms ease,color 160ms ease;
}
#home.screen .levels input:checked + span{
  background:var(--gold);
  color:#241810;
  box-shadow:inset 0 -2px 0 rgba(255,255,255,.3);
}
#home.screen .levels input:focus-visible + span{
  outline:2px solid var(--gold);
  outline-offset:2px;
}

@media (max-width:640px){
  #home.screen{
    display:block;
    min-height:auto;
    padding:clamp(76px,14vw,96px) 16px 32px;
  }
  #home.screen .hero{ align-items:stretch; gap:14px; }
  #home.screen .hero-stage{ display:none; }
  #home.screen .modes{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
  }
  #home.screen .mode-ai,
  #home.screen .mode-friends{ grid-column:1 / -1; }
  #home.screen .levels{ display:flex; width:100%; gap:4px; }
  #home.screen .levels label{ flex:1 1 0; }
  #home.screen .levels label > span{ padding:9px 6px; text-align:center; }
}


/* ===== 第二轮修正：首屏高度收紧、左右栏拉近、难度条加高、副标题提亮 ===== */
#home.screen{
  grid-template-columns:minmax(0,.95fr) minmax(0,1.05fr);
  gap:clamp(16px,2.2vw,36px);
  align-items:center;
  min-height:92svh;
  padding:clamp(70px,7vh,88px) clamp(20px,4vw,56px) clamp(18px,3vh,32px);
}
#home.screen .hero{ max-width:560px; }
#home.screen .hero-intro{
  color:var(--parchment);
  margin:0;
}
#home.screen .hero-board{ max-width:min(100%,560px); }
#home.screen .levels label > span{ min-height:44px; display:flex; align-items:center; justify-content:center; }
#home.screen .modes .mode:not(.mode-ai):not(.mode-friends){
  box-shadow:0 4px 6px rgba(0,0,0,.3);
}
@media (min-width:641px){
  #home.screen .hero{ gap:clamp(14px,1.6vw,22px); }
}
@media (max-width:640px){
  #home.screen{
    display:block;
    min-height:auto;
    padding:clamp(74px,13vw,92px) 16px 30px;
  }
  #home.screen .hero{ max-width:none; }
  #home.screen .hero-intro{ margin:0 0 18px; line-height:1.55; }
  #home.screen .modes{ margin-top:4px; gap:12px; }
  #home.screen .levels label > span{ min-height:44px; padding:12px 6px; }
  #home.screen .mode-face{ min-height:52px; }
}


/* ===== 第三轮：首屏与正文之间的间隙收干净，版面不再出现大块空屏 ===== */
#home.screen{ min-height:88svh; }
#home.screen + #game-guide,
#game-guide{
  margin-top:clamp(20px,3vw,40px) !important;
  padding-top:0 !important;
}
#game-guide > h2:first-of-type{ margin-top:clamp(16px,2.4vw,28px); }
@media (max-width:640px){
  #home.screen{ min-height:auto; }
  #game-guide{ margin-top:28px !important; }
}


/* ===== 收尾：首屏不再写死视口高度，杜绝正文前的大块黑场 ===== */
#home.screen{
  min-height:auto;
  padding-top:clamp(72px,8vh,96px);
  padding-bottom:clamp(16px,2.4vh,28px);
}
#home.screen .hero-board{ max-height:min(560px,58svh); }
#home.screen + #game-guide{ margin-top:clamp(20px,3vw,40px) !important; }
