@font-face {
  font-family: Rubik;
  src: url('assets/fonts/rubik.ttf') format('truetype');
  font-weight: 300 900;
  font-display: swap;
}

@font-face {
  font-family: 'PT Serif';
  src: url('assets/fonts/pt-serif.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --display: Rubik, 'Segoe UI', sans-serif;
  --reading: 'PT Serif', Georgia, serif;
  font-family: var(--display);
  color: #fff3dc;
  background: #1b1b18;
  --ink: #fff3dc;
  --deep: #2a231c;
  --panel: #352c23;
  --deck: #493b2d;
  --line: #78644e;
  --muted: #dfceb4;
  --gold: #ffd584;
  --dark-gold: #2f1e0a;
  --blue: #2c4657;
  --red: #78343a;
  --radius: 14px;
  --control-radius: 8px;
  --surface-depth: inset 0 1px #ffffff22, inset 0 -3px #180f0965, 0 6px 16px #100b0870;
  scrollbar-color: #937958 #1b1b18;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  isolation: isolate;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, #1a1b18c9 0%, #27241e66 62%, #171a1773 100%),
    linear-gradient(0deg, #1b1b18ee 0%, #1b1b1810 42%, #1b1b1877 100%),
    url('assets/winter-campaign.png') center 53% / cover no-repeat;
  filter: saturate(.72);
}
::selection { color: var(--deep); background: var(--gold); }
main {
  width: min(calc(100% - 32px), 1010px);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom));
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--display); }
h1 {
  font-size: clamp(1.52rem, 3.8vw, 2.85rem);
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -.035em;
  text-shadow: 0 3px #1c130d, 0 4px 8px #110c0890;
}
h2 { font-size: 1.65rem; line-height: 1.12; font-weight: 850; }
p, summary { line-height: 1.5; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #816b4c;
  border-radius: var(--radius);
  background: linear-gradient(165deg, #484035, #2b251e 68%);
  box-shadow: var(--surface-depth);
}
.game-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.title-portrait {
  flex: 0 0 55px;
  aspect-ratio: 1;
  border-radius: 9px;
  border: 2px solid #d5ae69;
  background: #251e17 url('assets/victory-portrait.png') 51% 31% / 171% auto no-repeat;
  box-shadow: 0 2px 6px #18110d;
}
.game-title p {
  margin-top: 3px;
  font-family: var(--reading);
  font-size: clamp(.82rem, 1.8vw, 1rem);
  color: #e8c995;
}
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.game-modes {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: #251d16;
}
.match {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(285px, 30vw, 350px);
  gap: 14px;
  align-items: start;
}
.field-column, .match-info { min-width: 0; }

button, select {
  font: inherit;
  font-weight: 700;
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid var(--button-line, #978060);
  border-radius: var(--control-radius);
  background: var(--button-surface, linear-gradient(#5e4d3b, #483a2d));
  color: var(--button-ink, var(--ink));
  cursor: pointer;
}
button:not(.cell):not(.rule-piece) {
  box-shadow: inset 0 1px #ffffff35, inset 0 -3px #25180c60, 0 2px 3px #22160d45;
  transition: filter 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}
button:not(:disabled):not(.cell):hover, select:hover { filter: brightness(1.13); }
button:not(:disabled):not(.cell):active {
  transform: translateY(2px);
  box-shadow: inset 0 1px #ffffff30, inset 0 -1px #25180c60;
}
button:focus-visible, select:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 3px solid #ffe4a0;
  outline-offset: 3px;
}
button:disabled {
  --button-line: #796953;
  --button-ink: #decfb9;
  --button-surface: #3f372d;
  cursor: default;
}
button:not(.cell):not(.rule-piece):disabled { box-shadow: inset 0 1px #ffffff18; }
.game-modes button { min-height: 44px; padding-inline: 9px; font-size: .82rem; }
.game-modes button[aria-pressed="false"] { --button-line: #6c5943; --button-surface: #3c3227; --button-ink: #eadac0; }
.game-modes button[aria-pressed="true"], .profile-switch button[aria-pressed="true"] {
  --button-line: #d4b377;
  --button-surface: linear-gradient(#886a48, #64492f);
}
.page-actions > button { font-size: .82rem; }
.primary {
  --button-line: #ffe3a2;
  --button-surface: linear-gradient(#ffe49c, #eaa646);
  --button-ink: var(--dark-gold);
  font-weight: 850;
}
button.primary:not(.cell):not(:disabled) {
  box-shadow: inset 0 1px #fff3cf, inset 0 -4px #a861247d, 0 3px 6px #20140c90;
}

.field {
  padding: clamp(8px, 1.2vw, 13px);
  border: 1px solid #89724f;
  border-radius: var(--radius);
  background: linear-gradient(#3f352a, #28221b 57%, #342b22);
  box-shadow: var(--surface-depth);
}
.side-summary {
  margin: 0 0 4px var(--coordinates);
  padding: 0 0 5px;
  border-radius: var(--control-radius);
  overflow: hidden;
  font-size: .8rem;
  background: #21191085;
}
.side-summary.blue { margin-top: 7px; margin-bottom: 0; }
.summary-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2px 8px;
  padding: 4px 9px;
  margin-bottom: 3px;
  border-bottom: 1px solid #ffffff24;
  background: linear-gradient(90deg, var(--team), #3b3127 93%);
  color: #fff7eb;
}
.summary-total {
  padding: 2px 7px;
  border-radius: 5px;
  background: #241910bd;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.stock { display: grid; gap: clamp(2px, .7vw, 5px); padding-inline: 5px; }
.stock-item { display: grid; justify-items: center; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.stock-count {
  color: #f0e2c9;
  font-size: clamp(.55rem, 1.3vw, .71rem);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  line-height: 1.1;
  white-space: nowrap;
}
.stock-item.depleted .stock-count { color: #d3c3a9; }
.stock-item.depleted .stock-piece { filter: grayscale(1); opacity: .7; }
.stock-item.depleted .stock-piece::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 2px;
  background: #e0ddd7;
  transform: rotate(-45deg);
}
.side-summary.blue .stock-count { order: 1; }
.stock-piece { width: min(100%, 28px); aspect-ratio: 1; font-size: clamp(.62rem, 1.6vw, .89rem); }
.side-summary strong { font-size: .98rem; line-height: 1.15; font-weight: 800; }
.side-summary.winner { outline: 2px solid var(--gold); animation: winner-emphasis 600ms ease-out; }
.blue { --team: var(--blue); --team-light: #c3dce6; }
.red { --team: var(--red); --team-light: #ffd0c9; }
.field { --coordinates: 21px; }
.board-frame { display: grid; grid-template: var(--coordinates) auto / var(--coordinates) minmax(0, 1fr); }
.columns { grid-area: 1 / 2; display: grid; grid-template-columns: repeat(10, 1fr); }
.rows { grid-area: 2 / 1; display: grid; grid-template-rows: repeat(10, 1fr); }
.columns span, .rows span { display: grid; place-items: center; font: 800 .72rem var(--display); color: var(--gold); }


.board {
  position: relative;
  grid-area: 2 / 2;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-template-rows: repeat(10, minmax(0, 1fr));
  aspect-ratio: 1;
  border: 2px solid #d5ad68;
  border-radius: 5px;
  background: #d3bb86;
  box-shadow: 0 0 0 3px #201912, 0 4px 7px #1d150fba;
  isolation: isolate;
}
.board::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: -1; background: url('assets/borodino-plan.jpg') 53% 55% / 157% auto no-repeat; filter: grayscale(1) sepia(.77) contrast(1.06); opacity: .83; }

.cell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #cfa75f45;
  box-shadow: inset 0 0 0 1px #544c357c;
  touch-action: manipulation;
}

.cell.shaded { background: #fff0c167; }
.cell.obstacle { background: #9c8052b3; color: #fff; box-shadow: inset 0 0 0 1px #64543b; }
.cell:not(.obstacle):not([aria-disabled="true"]):hover { filter: brightness(1.12); }
.cell.obstacle:hover { background: #9c8052b3; }
.fortress-tower { width: 73%; height: 83%; position: relative; filter: drop-shadow(0 2px 1px #3a291d9c); }
.fortress-tower::before, .fortress-tower::after { content: ''; position: absolute; }
.fortress-tower::before { inset: 36% 16% 8%; background: linear-gradient(90deg, #5e3328 0 12%, #0000 25% 77%, #613328 89%), linear-gradient(#884d38 49%, #6d3b2a 50%); background-size: auto, 100% 23%; border: 1px solid #502f21; clip-path: polygon(0 0, 100% 0, 94% 95%, 85% 100%, 12% 100%, 4% 92%); }
.fortress-tower::after { inset: 3% 6% 48%; background: linear-gradient(100deg, #332820 25%, #673f2a 47%, #3c2a22 82%); clip-path: polygon(50% 1%, 80% 47%, 100% 91%, 75% 98%, 23% 98%, 0 91%, 21% 45%); }
.fortress-window { position: absolute; z-index: 1; left: 44%; top: 57%; width: 12%; height: 24%; background: #372416; border: 1px solid #aa7348; border-radius: 45% 45% 0 0; }
.cell[aria-disabled="true"] { cursor: default; }
.cell:focus-visible { z-index: 1; outline-offset: -3px; }
.cell.selected { box-shadow: inset 0 0 0 3px #a75e21; background: #ffe4a5; }
.cell.target { background: #aecb98df; box-shadow: inset 0 0 0 2px #427348; }
.cell.target:not(:has(.piece))::after { content: ''; width: 25%; aspect-ratio: 1; border-radius: 50%; background: #295a3c; box-shadow: 0 0 0 2px #fff3cc; }
.cell.bonus-target { background: #f7debd; box-shadow: inset 0 0 0 2px #a45420; }
.cell.shield-target { background: #d7eced; box-shadow: inset 0 0 0 2px #24646b; }
.cell.deployment-target { background: #f1d293; box-shadow: inset 0 0 0 2px #946926; }
.cell.deployment-target::after { content: ''; width: 56%; aspect-ratio: 1; border: 1px dashed #765027; }
.cell.cannon-target { background: #e8c776; box-shadow: inset 0 0 0 2px #5d442a; }

.arrows { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.move-arrow { position: absolute; height: clamp(9px, 2vw, 14px); transform-origin: left center; filter: drop-shadow(0 1px 1px white) drop-shadow(0 -1px 1px white); }
.move-arrow::before { content: ''; display: block; height: 100%; background: var(--team); clip-path: polygon(0 36%, calc(100% - 9px) 36%, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, calc(100% - 9px) 64%, 0 64%); }
.move-arrow.red::before { opacity: .85; }

.piece, .stock-piece, .log-piece, .inline-piece {
  display: grid;
  place-items: center;
  position: relative;
  aspect-ratio: 1;
  border-radius: 5px;
  color: #fff7e2;
  font-family: var(--display);
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px #120e0bb0;
  background: linear-gradient(160deg, #ffffff35, transparent 48%, #1b130f66), var(--team);
  box-shadow: inset 0 0 0 1px #fff2d07c, inset 0 -3px #150f0b72, 0 2px 3px #21170d9c;
}
.piece { width: 84%; font-size: clamp(.82rem, 2.45vw, 1.45rem); }
.piece-face { display: grid; place-items: center; width: 100%; height: 100%; min-width: 0; }

.piece.unknown { background: linear-gradient(#fff0cc, #debc85); color: var(--team); border: 2px solid currentColor; box-shadow: inset 0 1px #fff9e6, inset 0 -3px #79432663, 0 2px 3px #21170d9c; }
.hidden-portrait { display: block; width: 96%; aspect-ratio: 1; background: url('assets/soldier-portraits.webp') 0 0 / 200% 200% no-repeat; }
.portrait-1 { background-position: 100% 0; }
.portrait-2 { background-position: 0 100%; }
.portrait-3 { background-position: 100% 100%; }
.piece.exposed { box-shadow: inset 0 0 0 2px #ff7266, inset 0 -3px #30171da0, 0 2px 3px #21170d9c; }
.piece.exposed::after {
  content: '';
  position: absolute;
  inset: 9% auto auto 9%;
  width: 14%;
  min-width: 4px;
  aspect-ratio: 1;
  border: 1px solid #fff3dc;
  background: #b9353d;
  transform: rotate(45deg);
}
.carrier-mark { position: absolute; top: -4%; right: -4%; width: 46%; min-width: 11px; aspect-ratio: 1; border-radius: 3px; background: #272d26; outline: 1px solid #fff2aa; display: grid; place-items: center; }
.carrier-mark .token-icon { width: 94%; }
.piece.shielded { outline: 2px solid #79bdc3; outline-offset: 1px; }
.shield-mark { position: absolute; bottom: -5%; left: -5%; width: 43%; aspect-ratio: 1; background: #e4d7a3; clip-path: polygon(5% 10%, 95% 10%, 90% 64%, 82% 78%, 50% 100%, 18% 78%, 10% 64%); }
.shield-mark::after { content: ''; position: absolute; inset: 12% 17% 15%; background: linear-gradient(105deg, #4a8390 49%, #23444d 51%); clip-path: polygon(0 0, 100% 0, 88% 62%, 50% 100%, 12% 62%); }
.piece.travelling { z-index: 4; }
.board-fx { position: absolute; inset: 3%; border: 3px solid #a34a10; background: #ffd99c; border-radius: 50%; pointer-events: none; z-index: 5; }
.board-fx.impact { border-color: #b75120; background: radial-gradient(circle, #fff5c9 0 15%, #f6a750 30%, #ab5a3190 49%, #6c473c42 66%, transparent 76%); }
.board-fx.impact::after { content: ''; position: absolute; inset: 10%; background: #f3bb64c0; clip-path: polygon(50% 0,58% 32%,86% 12%,72% 44%,100% 50%,72% 58%,88% 88%,58% 70%,50% 100%,42% 70%,12% 88%,30% 58%,0 50%,30% 44%,12% 12%,42% 32%); }
.board-fx.shield { border-color: #20717b; background: #b6efed; }
.board-fx.blast { border-color: #b73529; background: #ffd18a; border-radius: 18%; }
.board-fx.move-origin { border-color: #ffe1a0; border-radius: 10%; background: transparent; box-shadow: 0 0 0 2px #712f35; }
.cannonball { position: absolute; z-index: 8; width: clamp(6px, 1.4vw, 13px); aspect-ratio: 1; border-radius: 50%; pointer-events: none; background: radial-gradient(circle at 34% 26%, #d4ae73, #68594b 33%, #161818 67%); box-shadow: 0 2px 6px #ab531e, 0 0 0 1px #2c221b; }

.token-icon { position: relative; display: block; width: 76%; aspect-ratio: 1; }
.token-icon::before, .token-icon::after, .icon-detail { content: ''; position: absolute; display: block; }
.icon-spy::before { inset: 9% 0 48%; background: #f3edc9; clip-path: polygon(0 76%, 20% 60%, 31% 8%, 69% 8%, 80% 60%, 100% 76%, 100% 93%, 0 93%); }
.icon-spy::after { inset: 48% 23% 8%; background: #ebbd8c; clip-path: polygon(0 0, 100% 0, 87% 68%, 69% 100%, 31% 100%, 13% 68%); }
.icon-spy .icon-detail { z-index: 1; inset: 51% 18% 33%; background: #26333b; clip-path: polygon(0 0, 43% 13%, 50% 40%, 57% 13%, 100% 0, 90% 100%, 10% 100%); }
.icon-mine::before { inset: 32% 14% 6%; border-radius: 50%; background: radial-gradient(circle at 32% 29%, #898c88, #252c30 42%, #151819 75%); outline: 1px solid #e8e1c4; }
.icon-mine::after { top: 15%; left: 52%; width: 23%; height: 26%; border-top: 2px solid #f6dbac; border-left: 2px solid #f6dbac; border-radius: 60% 0 0 0; }
.icon-mine .icon-detail { z-index: 1; inset: 1% 6% 65% 62%; background: #ffcb5c; clip-path: polygon(50% 0, 62% 35%, 100% 35%, 70% 58%, 82% 100%, 50% 74%, 18% 100%, 30% 58%, 0 35%, 38% 35%); }
.icon-flag, .icon-decoy, .icon-carried { --cloth: #ff4d4d; }
.icon-decoy { --cloth: #1d2027; }
.icon-carried { --cloth: #ffe189; }
.icon-flag::before, .icon-decoy::before, .icon-carried::before { left: 15%; top: 7%; bottom: 6%; width: 10%; border-radius: 2px; background: #fff1d2; }
.icon-flag::after, .icon-decoy::after, .icon-carried::after { inset: 12% 3% 35% 22%; background: var(--cloth); clip-path: polygon(0 0, 100% 9%, 84% 47%, 100% 91%, 47% 100%, 0 90%); }
.icon-decoy .icon-detail { z-index: 1; inset: 23% 34% 45% 37%; background: radial-gradient(circle at 32% 40%, #23242a 11%, transparent 13%), radial-gradient(circle at 68% 40%, #23242a 11%, transparent 13%), #fff1d2; clip-path: polygon(12% 6%, 88% 6%, 100% 29%, 100% 69%, 77% 69%, 77% 100%, 23% 100%, 23% 69%, 0 69%, 0 29%); }
.icon-cannon { --iron: #e4c686; --hub: #382922; }
.icon-cannon::before { inset: 25% 9% 43% 11%; background: var(--iron); transform: rotate(-18deg); clip-path: polygon(0 37%, 14% 37%, 14% 20%, 81% 20%, 81% 0, 100% 0, 100% 100%, 81% 100%, 81% 79%, 14% 79%, 14% 65%, 0 65%); }
.icon-cannon::after { left: 20%; top: 50%; width: 31%; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--iron); background: var(--hub); }
.icon-cannon .icon-detail { left: 31%; top: 64%; width: 13%; aspect-ratio: 1; z-index: 1; border-radius: 50%; background: var(--iron); }

.match-info, .rules-panel {
  padding: 14px;
  border: 1px solid #8a7454;
  border-radius: var(--radius);
  background: linear-gradient(160deg, #4e4032, var(--panel) 62%);
  box-shadow: var(--surface-depth);
}
.match-info p { color: var(--muted); }
.outcome {
  padding: 10px 12px;
  border-radius: var(--control-radius);
  background: #2b2219;
  box-shadow: inset 0 1px #c9a47736, inset 0 -2px #1b120a80;
}
.outcome h2 { color: var(--ink); }
.outcome p { margin-top: 5px; color: var(--muted); font: 400 .93rem/1.35 var(--reading); }
.outcome p:empty { display: none; }
.setup-phase .outcome { padding: 0; background: none; box-shadow: none; }
.setup-phase .outcome h2 { font-size: clamp(1.42rem, 3vw, 1.8rem); }
.match-metrics { display: flex; gap: 5px; margin-top: 8px; font-size: .79rem; }
.match-metrics div {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  flex: 1;
  padding: 5px 8px;
  border-radius: 6px;
  background: #2a2119d5;
  color: var(--muted);
}
.match-metrics strong, .match-metrics time { color: var(--ink); font-weight: 750; font-variant-numeric: tabular-nums; }
.strike-display {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 12px;
  margin-top: 8px;
  padding: 7px 12px;
  border: 1px solid #ffd28b;
  border-radius: var(--control-radius);
  background: linear-gradient(155deg, #8c4923, #572b23);
  color: #fff3cc;
  box-shadow: inset 0 1px #ffefa85e, inset 0 -3px #33182180, 0 3px 6px #1e140d72;
  animation: strike-enter 280ms cubic-bezier(.22,.74,.34,1);
}
.strike-display.red { background: linear-gradient(155deg, #a0463f, #6e2d38); }
.strike-label { font-size: .78rem; text-transform: uppercase; font-weight: 800; }
.strike-multiplier {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-size: clamp(1.56rem, 3.5vw, 2rem);
  line-height: 1;
  font-weight: 900;
  color: #ffe28c;
  text-shadow: 0 2px #341c0f;
}
.strike-steps { display: flex; gap: 3px; }
.strike-steps i { width: .68rem; height: .3rem; background: #d6ad7270; transform: skew(-14deg); }
.strike-steps .filled { background: #ffd483; }
@keyframes strike-enter { from { opacity: .75; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }

.actions { display: grid; gap: 10px; margin-top: 10px; }
.formations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.formations button {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-height: 50px;
  padding-inline: 5px;
  font-size: .89rem;
}
.formations button[aria-pressed="true"], .reserve-pieces button[aria-pressed="true"] {
  --button-line: #f5cd82;
  --button-surface: linear-gradient(#ac773c, #845426);
  color: #fff8e4;
}
.formations button[aria-pressed="true"]::after {
  content: '';
  position: absolute;
  right: 6px;
  top: 5px;
  width: 7px;
  height: 4px;
  border: solid #ffe6a5;
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg);
}
.preset-icon { position: relative; display: block; width: 17px; height: 17px; flex: 0 0 17px; color: #ffe1a0; }
.preset-icon::before, .preset-icon::after { content: ''; position: absolute; }
.preset-attack::before, .preset-attack::after {
  inset: 0 5px;
  background: currentColor;
  clip-path: polygon(50% 0, 74% 14%, 74% 62%, 100% 62%, 100% 75%, 68% 75%, 68% 100%, 32% 100%, 32% 75%, 0 75%, 0 62%, 26% 62%, 26% 14%);
}
.preset-attack::before { transform: rotate(45deg); }
.preset-attack::after { transform: rotate(-45deg); }
.preset-defense::before { inset: 2px 2px 0; background: currentColor; clip-path: polygon(0 0, 100% 0, 91% 61%, 50% 100%, 9% 61%); }
.preset-defense::after { inset: 5px 6px 5px; background: #584230; clip-path: polygon(0 0, 100% 0, 82% 72%, 50% 100%, 18% 72%); }
.preset-random::before { inset: 2px; border: 1px solid currentColor; border-radius: 3px; transform: rotate(-11deg); }
.preset-random::after { top: 8px; left: 8px; width: 3px; height: 3px; border-radius: 50%; background: currentColor; box-shadow: -3px -3px, 3px 3px; }
.preset-manual::before { inset: 2px 1px 1px; border: 1px solid currentColor; border-radius: 2px; }
.preset-manual::after { width: 5px; height: 5px; left: 4px; top: 5px; background: currentColor; box-shadow: 5px 4px 0 -1px; }
#confirm-setup {
  width: 100%;
  min-height: 54px;
  font-size: 1.36rem;
  font-weight: 900;
  text-transform: uppercase;
}
.setup-reserve {
  display: grid;
  gap: 7px;
  padding-block: 8px;
  border-top: 1px solid var(--line);
}
.setup-reserve .reserve-instruction { margin: 0; color: var(--muted); font: 400 .86rem/1.35 var(--reading); }
#reserve-count { color: var(--gold); font-size: .83rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.reserve-pieces { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.reserve-pieces button { display: grid; place-items: center; gap: 3px; min-height: 49px; padding: 4px 1px; line-height: 1; }
.reserve-pieces button:disabled .stock-piece { filter: grayscale(1); opacity: .58; }
.reserve-pieces button > span:last-child { font-size: .72rem; font-variant-numeric: tabular-nums; }
.reserve-pieces .stock-piece { width: min(100% - 4px, 26px); }
#return-piece { justify-self: start; font-size: .82rem; }
.setup-options { display: grid; gap: 8px; }
.setup-settings {
  margin: 0;
  min-width: 0;
  padding: 5px 10px 9px;
  border: 1px solid #806b52;
  border-radius: 8px;
  background: #2c231aa8;
}
.setup-settings legend { padding-inline: 5px; color: var(--gold); font-weight: 800; font-size: .91rem; }
.blind-setting { display: flex; width: fit-content; align-items: center; gap: 8px; cursor: pointer; min-height: 44px; font-weight: 750; }
.blind-setting input { width: 18px; height: 18px; margin: 0; accent-color: var(--gold); }
.setup-settings #blind-description { margin-top: -3px; font: 400 .86rem/1.35 var(--reading); color: var(--muted); }
.strategy-control { display: grid; gap: 4px; padding-top: 8px; }
.strategy-control label { font-size: .81rem; color: var(--muted); }
.strategy-control select { width: 100%; }
select option { background: #33281e; color: var(--ink); }
.victory-conditions p { color: var(--muted); font: 400 .88rem/1.42 var(--reading); }
.victory-conditions p + p { margin-top: 4px; }
.flag-label { white-space: nowrap; color: var(--ink); }

.bonus-panel, .game-log { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 9px; }
.battle-overview { display: grid; gap: 7px; grid-template-columns: minmax(0, 1fr) minmax(81px, .53fr); }
.tactic-scores, .finale-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.score-badge {
  min-width: 0;
  display: grid;
  gap: 2px;
  justify-items: center;
  align-content: center;
  padding: 5px 5px 6px;
  border: 1px solid #ffffff51;
  border-radius: var(--control-radius);
  color: #fff7e2;
  text-align: center;
  background: linear-gradient(170deg, #ffffff24, #1a120d60), var(--team);
  box-shadow: inset 0 -3px #1c140d68;
}
.score-badge strong { font: 900 clamp(1.52rem, 3vw, 2.45rem)/1 var(--display); font-variant-numeric: tabular-nums; }
.score-badge span { color: #fff4e8; font-size: .72rem; font-weight: 700; line-height: 1.12; }
.salvo-controls { display: grid; grid-template-areas: "button" "count"; gap: 4px; min-width: 0; text-align: center; }
#salvo-count { grid-area: count; color: var(--muted); font-size: .72rem; line-height: 1.12; font-variant-numeric: tabular-nums; }
.field-order { grid-area: button; width: 100%; font-size: .98rem; line-height: 1.03; font-weight: 900; padding-inline: 3px; }
.counter-order { width: 100%; margin-top: 6px; }
.field-order.ready { --button-line: #ffc97d; --button-surface: linear-gradient(#b95543, #842f39); color: #fff2d6; animation: ready-order 2.8s ease-in-out infinite; }
@keyframes ready-order {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.23); }
}
.orders-heading { margin: 12px 0 6px; }
.orders-title { color: var(--gold); font-weight: 800; font-size: .97rem; }
.tactic-orders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.tactic-orders button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  min-height: 49px;
  padding: 4px 6px;
  text-align: left;
  font-size: .79rem;
  line-height: 1.12;
}
.tactic-orders button:not(:disabled) { --button-line: #c6aa80; }
.tactic-orders button strong {
  padding: 2px 4px;
  border-radius: 4px;
  background: #2b2117;
  color: var(--gold);
  font: 800 .85rem/1.15 var(--display);
  font-variant-numeric: tabular-nums;
}
.tactic-orders button:disabled strong { color: #e4d3b2; }
.order-name { display: inline-flex; align-items: center; gap: 5px; }
.order-compact { display: none; }
.order-icon { display: inline-block; flex: 0 0 1.1rem; width: 1.1rem; height: 1.1rem; position: relative; color: var(--gold); }
.order-icon::before, .order-icon::after { content: ''; position: absolute; }
.order-icon.icon-cannon { --iron: #ffda92; --hub: #4c3525; }
.icon-order-shield::before { inset: 5% 12%; background: #fed996; clip-path: polygon(0 0,100% 0,90% 63%,50% 100%,10% 63%); }
.icon-order-shield::after { inset: 18% 26% 24%; background: #9a582b; clip-path: polygon(0 0,100% 0,88% 61%,50% 100%,12% 61%); }
.icon-order-shot::before { inset: 22% 5% 11% 29%; border-radius: 50%; background: radial-gradient(circle at 35% 22%, #fff5b4, #c08237 57%, #814522); }
.icon-order-shot::after { left: 7%; top: 45%; width: 37%; height: 2px; background: #d7aa69; transform: rotate(-18deg); }
.icon-order-reinforcement::before { inset: 9% 12%; background: #f6d395; border-radius: 3px; }
.icon-order-reinforcement::after { inset: 20% 27%; background: #734f32; clip-path: polygon(40% 0,60% 0,60% 40%,100% 40%,100% 60%,60% 60%,60% 100%,40% 100%,40% 60%,0 60%,0 40%,40% 40%); }
.tactic-used { margin-top: 7px; font-size: .78rem; }
.bonus-panel button[aria-pressed="true"] { --button-surface: linear-gradient(#a8773b, #74491f); --button-line: #ffda90; color: #fff7dd; }
.placement { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 7px; }
.placement button, .placement select { padding: 4px 7px; }
.placement label { font-size: .85rem; }

.game-log h2 { color: var(--gold); font-size: 1.14rem; }
.game-log ol, .game-log ul { padding: 0; margin: 5px 0 0; list-style: none; }
.game-log li { padding: 5px 0; font-size: .85rem; line-height: 1.45; }
.game-log ol > li + li { border-top: 1px solid var(--line); }
.game-log ol ul { margin-left: 12px; }
.log-token { color: var(--team-light); font-weight: 750; }
.move-number { display: inline-block; margin-right: 5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.move-gains { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; font-size: .77rem; color: var(--muted); }
.move-gains .log-token { color: var(--gold); }
.log-point { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; }
.log-piece { display: inline-grid; width: 1.34rem; font-size: .75rem; border-radius: 3px; vertical-align: middle; }
.outcome.won { background: #204d40; animation: winner-emphasis 600ms ease-out; }
.outcome.lost { background: #693339; animation: defeat-emphasis 430ms ease-out; }
.outcome.tied { background: #594d3d; }
@keyframes winner-emphasis { from { transform: scale(.96); opacity: .48; } to { transform: scale(1); opacity: 1; } }
@keyframes defeat-emphasis { 25%, 75% { transform: translateX(-3px); } 50% { transform: translateX(3px); } }


.rules-panel { margin-top: 12px; padding: 0 14px; }
.rules-panel summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding-block: 9px;
  cursor: pointer;
  font: 800 1rem/1.35 var(--display);
  list-style: none;
}
.rules-panel summary::-webkit-details-marker { display: none; }
.rules-panel summary::after {
  content: '';
  width: 8px;
  height: 8px;
  margin-right: 3px;
  border: solid var(--gold);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.rules-panel[open] summary::after { transform: rotate(225deg); }
.rules-panel[open] { padding-bottom: 12px; }
.rules { max-width: 69ch; margin: 4px 0 2px; padding-left: 19px; color: #f1e4ce; font: 400 .99rem/1.5 var(--reading); }
.rules li + li { margin-top: 8px; }
.inline-piece { display: inline-grid; vertical-align: middle; width: 1.48rem; font-size: .88rem; }
.rule-piece {
  display: inline-grid;
  place-items: center;
  vertical-align: middle;
  min-width: 44px;
  min-height: 44px;
  margin-inline-end: 4px;
  padding: 3px;
}
.rule-piece[aria-expanded="true"] { --button-line: #f1cd83; --button-surface: #60472f; }
.rules .inline-piece { width: 30px; font-size: 1rem; }
.rule-note { margin: 7px 0 9px; padding: 7px 10px; border-radius: 6px; background: #281f16; color: #eee0c7; }
.rule-note strong { color: var(--gold); }
.handoff { display: grid; min-height: 280px; place-content: center; justify-items: center; text-align: center; padding: 16px; }
.handoff p { margin-top: 6px; color: var(--muted); }
.handoff button { margin-top: 16px; }

.profile-dialog {
  width: min(660px, 100% - 24px);
  max-height: calc(100dvh - 26px);
  margin: auto;
  padding: clamp(12px, 3.6vw, 24px);
  border: 1px solid #9d845f;
  border-radius: var(--radius);
  color: var(--ink);
  background: linear-gradient(155deg, #4c3e30, #31281f 68%);
  box-shadow: var(--surface-depth);
}
.profile-dialog::backdrop { background: #16100cdb; }
.profile-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 0 9px;
  border-bottom: 1px solid var(--line);
  background: #47392d;
}
.profile-header h2 { font-size: clamp(1.45rem, 5vw, 2.2rem); }
.profile-switch { display: flex; gap: 5px; margin-bottom: 14px; }
.profile-switch button { flex: 1; padding-inline: 5px; }
.profile-name-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; margin-bottom: 12px; }
.profile-name-form label { grid-column: 1 / -1; color: var(--muted); font-size: .86rem; font-weight: 650; }
.profile-name-form input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px;
  border: 1px solid #967c5a;
  border-radius: var(--control-radius);
  background: #30261d;
  caret-color: var(--gold);
  color: var(--ink);
  font: inherit;
}
.profile-name-form input::placeholder { color: #dbc8ac; }
.profile-caption, .profile-storage-status { margin-bottom: 8px; color: var(--muted); font-size: .86rem; }
.profile-stats, .profile-awards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 0; padding: 0; }
.profile-stats > div, .profile-awards > li { min-width: 0; padding: 9px 10px; border-radius: var(--control-radius); background: #2d241b; }
.profile-stats dt { font-weight: 650; line-height: 1.3; }
.profile-stats dt small { display: block; margin-top: 3px; color: var(--muted); font-weight: 400; }
.profile-stats dd { margin: 5px 0 0; color: var(--gold); font: 850 clamp(1.32rem, 4vw, 1.85rem)/1 var(--display); font-variant-numeric: tabular-nums; }
.profile-awards { list-style: none; }
.profile-awards > li { display: grid; grid-template-rows: 1fr auto auto; }
.profile-awards h3 { font: 750 1.02rem/1.2 var(--display); }
.profile-awards p { margin: 4px 0 8px; color: var(--muted); font-size: .8rem; }
.achievement-tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; list-style: none; margin: 0; padding: 0; }
.achievement-tiers li { display: grid; gap: 2px; justify-items: center; padding: 4px 1px; border: 1px solid #826e54; border-radius: 5px; color: #e7d8bd; font-size: .71rem; white-space: nowrap; }
.achievement-tiers li.earned { border-color: #efc378; color: #291b10; background: #f6d799; }
.achievement-tiers li span:first-child { font-size: 1.17rem; line-height: 1; }

.finale {
  width: min(740px, 100% - 28px);
  max-height: calc(100dvh - 28px);
  min-height: min(412px, 75dvh);
  padding: clamp(18px, 5vw, 48px);
  border: 2px solid #e6b974;
  border-radius: 18px;
  color: var(--ink);
  background: var(--deep);
  box-shadow: 0 12px 30px #110a06a0;
  isolation: isolate;
  overflow: auto;
}
.finale::backdrop { background: #170f09dd; }
.finale::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, #2b2117 7%, #2b2117f0 31%, #2b211746 74%), url('assets/victory-portrait.png') right 35% / cover no-repeat;
}
.finale.lost { border-color: #ad9e88; }
.finale.lost::before { background: linear-gradient(90deg, #29251e 7%, #29251ee0 35%, #29251e51 83%), url('assets/winter-campaign.png') right center / cover no-repeat; }
.finale.tied::before { background: linear-gradient(90deg, #392e21 20%, #392e21a8), url('assets/borodino-plan.jpg') center / cover no-repeat; }
.finale[open] { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; animation: finale-enter 620ms cubic-bezier(.16,.76,.23,1) both; }
.finale[open]::before { animation: finale-scene 1250ms ease-out both; }
.finale-copy { max-width: 20rem; }
.finale h2 {
  color: var(--gold);
  font-size: clamp(1.92rem, 7.3vw, 4.2rem);
  font-weight: 900;
  line-height: .96;
  text-transform: uppercase;
  letter-spacing: -.03em;
  text-shadow: 0 3px #1f150d, 0 5px 8px #130d07b3;
}
.finale.lost h2, .finale.tied h2 { color: #f5e8d2; }
.finale p { margin: 10px 0 0; color: #fff3dc; font-family: var(--reading); }
.finale-score { display: grid; gap: 6px; margin-top: 13px; padding-top: 10px; border-top: 1px solid #d5bc8d80; }
.finale-score h3, .finale-awards h3 { color: var(--gold); font: 800 .98rem var(--display); }
.finale-totals .score-badge { justify-items: start; padding: 7px 10px; gap: 3px; }
.finale-totals .score-badge strong { font-size: 1.8rem; }
.finale-awards { margin-top: 12px; }
.finale-awards h3 { margin-bottom: 5px; }
.finale-awards ul { display: grid; gap: 5px; list-style: none; margin: 0; padding: 0; }
.finale-awards li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid #d8ad67b0;
  border-radius: 7px;
  color: #fff0cf;
  background: #34271cf0;
  font-size: .88rem;
  font-weight: 650;
}
.finale-stars { display: flex; gap: 2px; color: #dbc49c; font-size: 1.16rem; line-height: 1; }
.finale-stars .new-star { color: #ffdb78; }
.finale[open] .finale-awards li { animation: finale-award-enter 340ms var(--award-delay) ease-out both; }
.finale[open] .finale-stars .new-star { animation: finale-star-enter 420ms calc(var(--award-delay) + var(--star-delay)) cubic-bezier(.18,.7,.25,1) both; }
.finale-actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 7px; }
@keyframes finale-enter { from { opacity: 0; transform: translateY(18px); clip-path: inset(8% 0 8%); } to { opacity: 1; transform: translateY(0); clip-path: inset(0); } }
@keyframes finale-scene { from { opacity: .18; filter: brightness(.7); } to { opacity: 1; filter: brightness(1); } }
@keyframes finale-award-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes finale-star-enter {
  from { opacity: 0; transform: translateY(5px) scale(.6); }
  62% { opacity: 1; transform: scale(1.25); text-shadow: 0 0 7px #ffcf69; }
  to { opacity: 1; transform: scale(1); text-shadow: 0 0 3px #ffcf6960; }
}

@media (min-width: 741px) {
  main { width: min(100% - 36px, calc(clamp(400px, 100dvh - 162px, 650px) + 360px)); }
}

@media (max-width: 740px) {
  main {
    width: min(580px, calc(100% - max(12px, env(safe-area-inset-left) + env(safe-area-inset-right))));
    padding-top: max(7px, env(safe-area-inset-top));
  }
  .page-header { margin-bottom: 8px; padding: 7px 8px; gap: 7px; }
  .game-title { gap: 8px; }
  .game-title h1 { font-size: clamp(1.38rem, 6vw, 2.35rem); }
  .title-portrait { flex-basis: 44px; }
  .page-actions { display: grid; grid-template-columns: minmax(0, 2.03fr) minmax(0, 1.17fr) minmax(0, .78fr); width: 100%; gap: 4px; }
  .game-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0; background: none; }
  .page-actions > button, .game-modes button { min-width: 0; padding: 4px 2px; font-size: clamp(.65rem, 2.55vw, .81rem); text-wrap: balance; }
  .match { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .match-info { padding: 8px; }
  .field { --coordinates: 16px; padding: 5px 6px 6px 4px; }
  .side-summary { padding-bottom: 4px; }
  .summary-heading { padding-block: 3px; }
  .stock { padding-inline: 3px; }
  .stock-piece { width: min(100%, 26px); }
  .columns span, .rows span { font-size: .64rem; }

  .setup-phase .outcome p { margin-top: 2px; }
  .actions { margin-top: 7px; gap: 6px; }
  .formations { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
  .formations button { display: grid; place-content: center; justify-items: center; min-height: 44px; gap: 2px; padding: 3px 1px; font-size: clamp(.67rem, 2.7vw, .82rem); }
  .formations button[aria-pressed="true"]::after { top: 4px; right: 4px; }
  .preset-icon { width: 13px; height: 13px; }
  .preset-random::after { left: 5px; top: 5px; }
  .preset-manual::after { width: 4px; height: 4px; left: 3px; top: 4px; box-shadow: 4px 3px 0 -1px; }
  .preset-defense::after { inset-inline: 4px; }
  #confirm-setup { min-height: 44px; font-size: 1.08rem; }
  .reserve-pieces { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .field-column > .setup-options { margin-top: 10px; }
  .rules-panel { margin-top: 8px; }

  .phone-battle > .page-header { margin-top: 8px; margin-bottom: 0; }
  .phone-battle > .battle-controls {
    display: grid;
    gap: 5px;
    margin-bottom: 8px;
    padding: 6px;
    border: 1px solid #907859;
    border-radius: 11px;
    background: linear-gradient(160deg, #514233, #352c23 64%);
    box-shadow: var(--surface-depth);
  }
  .phone-battle .battle-state {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 4px 6px;
  }
  .phone-battle .battle-state .outcome { padding: 3px 5px; background: transparent; box-shadow: none; }
  .phone-battle .battle-state .outcome h2 { font-size: clamp(.92rem, 4vw, 1.1rem); }
  .phone-battle .battle-state #hint { margin-top: 3px; font-size: .77rem; line-height: 1.24; }
  .phone-battle > .battle-controls:not(.aiming) #hint { display: none; }
  .phone-battle .battle-state .match-metrics { margin: 0; gap: 2px; font-size: .67rem; }
  .phone-battle .battle-state .match-metrics div { padding: 3px 4px; gap: 3px; }
  .phone-battle .strike-display { grid-column: 1/-1; margin: 0; padding: 3px 7px; gap: 1px 5px; }
  .phone-battle .strike-label { font-size: .68rem; }
  .phone-battle .strike-multiplier { font-size: 1.19rem; }
  .phone-battle .strike-steps i { width: .44rem; height: .2rem; }
  .phone-battle .bonus-panel { border: 0; margin: 0; padding: 0; }
  .phone-battle .battle-overview { gap: 4px; }
  .phone-battle .tactic-scores { gap: 4px; }
  .phone-battle .score-badge { gap: 1px; padding: 3px 2px; }
  .phone-battle .score-badge strong { font-size: 1.56rem; }
  .phone-battle .score-badge span { font-size: .66rem; }
  .phone-battle .salvo-controls { gap: 2px; }
  .phone-battle #salvo-count { font-size: .63rem; }
  .phone-battle .field-order { min-height: 44px; font-size: .91rem; }
  .phone-battle .orders-heading { margin: 6px 0 3px; }
  .phone-battle .orders-title { font-size: .76rem; }
  .phone-battle .tactic-orders { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .phone-battle .tactic-orders button {
    display: grid;
    grid-template: "icon cost" auto "label label" auto / 1fr 1fr;
    align-content: center;
    align-items: center;
    min-height: 44px;
    gap: 2px 3px;
    padding: 2px 1px;
    font-size: .73rem;
    text-align: center;
  }
  .phone-battle .order-name { display: contents; }
  .phone-battle .order-full { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
  .phone-battle .order-compact { display: block; grid-area: label; }
  .phone-battle .tactic-orders button strong { grid-area: cost; justify-self: start; font-size: .73rem; }
  .phone-battle .order-icon { grid-area: icon; justify-self: end; width: .95rem; height: .95rem; }
  .phone-battle .tactic-used { margin-top: 4px; font-size: .70rem; }
  .phone-battle .game-log { border: 0; margin: 0; padding: 0; }
}

@media (max-width: 520px) {
  .profile-awards { grid-template-columns: minmax(0, 1fr); }
  .finale { padding-top: clamp(124px, 38vw, 196px); }
  .finale::before {
    background: linear-gradient(0deg, #2b2117 3%, #2b2117 34%, #2b211712 84%), url('assets/victory-portrait.png') center 18% / 100% auto no-repeat;
  }
  .finale.lost::before {
    background: linear-gradient(0deg, #29251e 15%, #29251e 32%, #29251e18 83%), url('assets/winter-campaign.png') center top / 100% auto no-repeat;
  }
  .finale-copy { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  button:not(.cell), .outcome, .side-summary, .field-order.ready, .strike-display, .finale[open], .finale[open]::before,
  .finale[open] .finale-awards li, .finale[open] .finale-stars .new-star { animation: none !important; transition: none !important; }
}

main:not([data-screen="home"]) > .main-menu,
main:not([data-screen="online"]) > .online-menu,
main:not([data-screen="game"]) > :is(.page-header, .match, .battle-controls) { display: none; }

.game-title .game-heading, .main-menu h1 {
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(1.47rem, 3.8vw, 2.85rem);
  font-weight: 900;
  letter-spacing: -.035em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 3px #1c130d;
}

.main-menu, .online-menu {
  border: 1px solid #816b4c;
  border-radius: var(--radius);
  background: linear-gradient(155deg, #42352aec, #262019e8 70%);
  box-shadow: var(--surface-depth);
}
.main-menu {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(16px, 3.5vh, 36px);
  min-height: min(670px, calc(100dvh - 45px));
  padding: clamp(14px, 3vw, 29px);
}
.menu-top, .menu-footer, .online-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.menu-footer { justify-content: flex-end; }
.menu-modes {
  display: grid;
  align-content: center;
  width: min(100%, 340px);
  margin-inline: auto;
  gap: 8px;
}
.menu-modes button { min-height: 53px; font-size: 1.05rem; }
.menu-modes button small { margin-inline-start: .45em; font-weight: 500; }
.menu-modes button:last-child { min-height: 44px; margin-top: 5px; font-size: .88rem; }
.online-menu { width: min(100%, 490px); margin: clamp(0px, 6vh, 60px) auto 0; padding: clamp(11px, 3vw, 23px); }
.online-header { justify-content: flex-start; }
.online-message { margin: 8px 0; color: var(--muted); font-size: .88rem; }
.online-message:empty { display: none; }
.online-options { display: grid; gap: 9px; }
.online-options input[type="text"], .online-options input[type="url"] {
  width: 100%;
  min-height: 44px;
  padding: 6px 9px;
  border: 1px solid #a68e69;
  border-radius: var(--control-radius);
  background: var(--deep);
  color: var(--ink);
  font: inherit;
}
.join-room { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.menu-dialog .rules-panel { margin-top: 0; border: 0; padding-inline: 0; background: none; box-shadow: none; }
.menu-dialog .rules-panel summary { display: none; }
#turn-clock-box { color: var(--ink); }
#turn-clock-box.urgent {
  background: #932a32;
  color: #fff3dc;
  animation: turn-clock-warning 850ms ease-in-out infinite alternate;
}
@keyframes turn-clock-warning {
  from { background: #842931; }
  to { background: #b33340; }
}
@media (max-width: 740px) {
  .game-title .game-heading { font-size: clamp(1.38rem, 6vw, 2.35rem); }
  .main-menu .menu-top { align-items: flex-start; }
  .main-menu .menu-top > button { margin-left: auto; }
  .phone-battle #turn-clock-box { white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  #turn-clock-box.urgent { animation: none; }
}
