
/* Layout: a walnut tabletop; the felt map sits in the middle like a game board, a card-stock panel at its side. */
:root {
  --wood-0: #1d1510;
  --wood-1: #2a1e16;
  --wood-2: #3a2a1e;
  --paper: #efe6d2;
  --paper-2: #e2d6bc;
  --ink: #241a13;
  --ink-2: #6c5c4b;
  --brass: #dca54a;
  --brass-ink: #2a1c08;
  --display: 'Saira Stencil One', 'Arial Narrow', Impact, sans-serif;
  --ui: 'Barlow Semi Condensed', 'Arial Narrow', system-ui, sans-serif;
  color-scheme: dark;
}
/* Map workshop: the game artwork and palette remain legible on small screens. */
.editor-inner { width: min(1440px, 100%); display: grid; gap: 16px; min-width: 0; }
.editor-screen { box-sizing: border-box; padding-top: 22px; }
.editor-library, .editor-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.editor-library { margin: 12px 0; }
.editor-library .field { flex: 1 1 220px; margin: 0; }
.editor-meta { display: grid; grid-template-columns: minmax(160px, 1fr) repeat(3, 80px) auto; gap: 10px; align-items: end; }
.editor-meta .field { margin: 0; min-width: 0; }
.editor-inner input, .editor-inner select { min-width: 0; width: 100%; box-sizing: border-box; }
.editor-inner input[type="checkbox"] { width: auto; }
.editor-actions { margin-bottom: 16px; align-items: center; }
.editor-actions .note { flex-basis: 100%; margin: 4px 0 0; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 16px; align-items: start; }
.editor-board { min-width: 0; position: sticky; top: 12px; }
.editor-board-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.editor-board-bar > b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.editor-pan { min-height: 48px; padding: 12px 20px; font-size: 18px; font-weight: 800; flex: none; }
.editor-pan span { margin-right: 6px; font-size: 24px; line-height: 1; }
.editor-pan[aria-pressed="true"] { background: var(--brass); color: var(--brass-ink); box-shadow: inset 0 0 0 2px #68431a; }
.editor-navigation { margin: 0 0 10px; }
.editor-zoom { display: flex; gap: 4px; flex: none; }
#edScroll { overflow: auto; max-height: 68vh; background: #4a3424; border-radius: 6px; padding: 8px; box-sizing: border-box; touch-action: none; overflow-anchor: none; }
#edBoard { display: block; touch-action: none; cursor: crosshair; image-rendering: pixelated; }
#edScroll.panning, #edScroll.panning canvas { cursor: grabbing !important; }
#edTileInfo { margin: 10px 0 0; min-height: 20px; }
.editor-palette { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin: 12px 0; max-height: 380px; overflow: auto; padding: 3px; }
.palette-item { display: grid; justify-items: center; align-content: start; gap: 4px; padding: 5px 3px; font-size: 13px; line-height: 1.1; border: 1px solid #c9bb9c; background: var(--paper-2); color: var(--ink); border-radius: 5px; }
.palette-item canvas { display: block; pointer-events: none; }
.palette-item img { display: block; pointer-events: none; image-rendering: pixelated; }
.palette-item span { max-width: 100%; overflow-wrap: anywhere; }
#edArtPalette { max-height: 260px; }
#edArtTools { border-top: 1px dashed #b9ab8e; padding-top: 12px; }
#edArtFile { overflow-wrap: anywhere; font-size: 12px; }
.editor-rename { display: flex; gap: 6px; }
.editor-rename input { flex: 1; }
.editor-rename button { flex: none; }
.editor-palette-tabs { display: flex; gap: 6px; margin: 12px 0; }
.editor-palette-tabs [aria-pressed="true"] { background: #e9bd6d; border-color: #68431a; }
.editor-art-categories { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.editor-art-categories [aria-pressed="true"] { background: #e9bd6d; border-color: #68431a; }
.palette-item[aria-pressed="true"] { border-color: #68431a; background: #e9bd6d; box-shadow: inset 0 0 0 2px #68431a; }
.editor-tools .check { font-size: 14px; }
.editor-validation { border-top: 1px dashed #b9ab8e; padding-top: 10px; font-size: 14px; }
.editor-validation.is-invalid { color: #962c1e; }
.editor-assets { margin-top: 16px; }
.editor-assets summary { cursor: pointer; font-weight: bold; }
.editor-assets ul { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; max-height: 300px; overflow: auto; }
.editor-assets li { display: flex; gap: 8px; align-items: center; min-width: 0; font-size: 13px; }
.editor-assets img { flex: none; image-rendering: pixelated; }
.editor-assets li div { min-width: 0; overflow-wrap: anywhere; }
.editor-assets small { display: block; color: #75644e; }
@media (max-width: 860px) {
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .editor-board { position: static; }
  .editor-tools { grid-row: 1; }
  .editor-tools .field { display: inline-grid; width: calc(50% - 8px); vertical-align: top; margin-right: 4px; }
  .editor-palette { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); max-height: 155px; }
  .editor-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .editor-meta .ed-name, .editor-meta > button { grid-column: 1 / -1; }
  .editor-inner .hero h1 { font-size: 34px; }
  #edScroll { max-height: 60vh; }
}
@media (max-width: 520px) { .editor-pan { order: 1; width: 100%; } }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--wood-1);
  background-image:
    repeating-linear-gradient(92deg, rgba(255,255,255,0.018) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(88deg, rgba(0,0,0,0.12) 0 1px, transparent 1px 23px),
    radial-gradient(ellipse at 50% 40%, var(--wood-2), var(--wood-0) 80%);
  color: var(--paper);
  font: 500 16px/1.35 var(--ui);
  font-variant-numeric: tabular-nums;
}
.app { height: 100%; display: grid; grid-template-rows: auto 1fr; }

/* Header */
.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 10px 16px; border-bottom: 1px solid rgba(0,0,0,0.5);
  background: linear-gradient(var(--wood-0), rgba(29,21,16,0.85));
}
.brand { display: flex; align-items: baseline; gap: 10px; margin-right: auto; }
.brand h1 { margin: 0; font: 400 26px/1 var(--display); letter-spacing: 0.02em; color: var(--brass); }
.brand span { color: #b9a78f; font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase; }
.turnchip { display: flex; align-items: center; gap: 10px; }
.daybox { text-transform: uppercase; letter-spacing: 0.08em; font-size: 13px; color: #b9a78f; }
.daybox b { display: block; font: 400 22px/1 var(--display); color: var(--paper); letter-spacing: 0; }
.swatch { display: inline-block; width: 22px; height: 22px; border: 2px solid var(--ink); box-shadow: 0 0 0 1px rgba(255,255,255,0.2); flex: none; }
.swatch[data-shape="circle"] { border-radius: 50%; }
.swatch[data-shape="square"] { border-radius: 5px; }
.swatch[data-shape="diamond"] { transform: rotate(45deg) scale(0.85); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
button { font: 700 18px/1 var(--ui); cursor: pointer; border-radius: 8px; }
.btn { padding: 12px 18px; border: 1px solid rgba(239,230,210,0.35); background: transparent; color: var(--paper); }
.btn:hover { background: rgba(239,230,210,0.08); }
.btn[aria-pressed="true"] { background: rgba(200,68,47,0.3); border-color: #e27a64; }
.btn-primary { padding: 12px 20px; border: 1px solid #f0c372; background: var(--brass); color: var(--brass-ink); box-shadow: 0 2px 0 #8a5f1c; }
.btn-primary:hover { background: #e8b65e; }
button:focus-visible, input:focus-visible, canvas:focus-visible { outline: 3px solid #f6d58c; outline-offset: 2px; }

/* Stage */
.stage { position: relative; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; padding: 16px; }
.board-wrap { min-width: 0; min-height: 0; }
.board-frame { padding: 10px; border-radius: 10px; background: #4a3424; box-shadow: inset 0 0 0 2px #5d4330, 0 14px 30px rgba(0,0,0,0.55), 0 2px 0 #160f0b; }
#board { display: block; border-radius: 3px; touch-action: manipulation; image-rendering: pixelated; }

/* Panel */
.panel { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--paper); color: var(--ink); border-radius: 6px; padding: 12px 14px; box-shadow: 0 2px 0 #b9ab8e, 0 8px 18px rgba(0,0,0,0.35); }
.card h2 { margin: 0 0 8px; font: 700 13px/1 var(--ui); text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-2); }
.seats { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.seat { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: start; padding: 8px; border-radius: 6px; background: color-mix(in srgb, var(--seat, transparent) 34%, transparent); }
/* The counters float at the top right: the lines beside them wrap around, the stars below get the full width. */
.seat-body { display: flow-root; min-width: 0; }
.seat-body > .seat-name, .seat-body > .seat-funds, .seat-body > .seat-value, .seat-body > .seat-co-name, .seat-body > .seat-stat, .seat-body > .seat-power { display: block; }
.seat .co-bust { width: 76px; }
.seats .seat .meter { gap: 3px; margin: 4px 0 2px; align-items: center; flex-wrap: wrap; }
.seats .seat .meter i { width: 19px; height: 19px; background: var(--ink); }
.seats .seat .meter i::after { inset: 2.5px; width: auto; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); background: linear-gradient(90deg, #e9a923 var(--f, 0%), #fbf6ea 0); }
.seats .seat .meter i.sp { width: 32px; height: 32px; }
.seats .seat .meter i.sp::after { inset: 4px; }
.seats .seat .meter i.ready::after { background: var(--seat, var(--brass)); }
/* --t (set to the page clock on every redraw) keeps the star animations in step when the panel is rebuilt. */
.seats .seat .meter i.ready { animation: star-bob 1.6s ease-in-out infinite; animation-delay: calc(var(--t, 0) * -1ms + var(--k) * -0.25s); }
@property --hue { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.seats .seat .meter i.rainbow::after { background: hsl(calc(var(--k) * 50deg + var(--hue)) 100% 55%); animation: star-hue 1.8s linear infinite; animation-delay: calc(var(--t, 0) * -1ms); }
.seats .seat .meter i.rainbow { animation: star-dance 0.8s ease-in-out infinite; animation-delay: calc(var(--t, 0) * -1ms + var(--k) * -0.12s); }
@keyframes star-bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-2px) rotate(-6deg); } }
@keyframes star-dance { 0%, 100% { transform: translateY(0) rotate(0) scale(1); } 30% { transform: translateY(-5px) rotate(-15deg) scale(1.12); } 70% { transform: translateY(1px) rotate(12deg) scale(0.95); } }
@keyframes star-hue { to { --hue: 360deg; } }
@media (prefers-reduced-motion: reduce) { .seats .seat .meter i.ready, .seats .seat .meter i.rainbow, .seats .seat .meter i.rainbow::after { animation: none; } }
.seats .seat #meter2 i { width: 14px; height: 14px; }
.seats .seat #meter2 i::after { inset: 2px; }
.seat-power { margin-top: 2px; font: 400 18px/1.05 var(--display); color: #b23d29; letter-spacing: 0.03em; }
.seat-power b { display: block; font: 800 14px/1.2 var(--ui); text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink); }
.seat-powers { display: grid; gap: 6px; margin-top: 6px; }
.seat-powers[hidden] { display: none; }
.pbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.history { position: absolute; left: 12px; bottom: 24px; z-index: 5; display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 6px; max-width: min(380px, calc(100% - 24px)); }
.history .btn { background: rgba(28,20,14,0.88); padding: 10px 14px; font-size: 16px; }
.history .log { background: var(--paper); color: var(--ink); border-radius: 6px; padding: 10px 12px; max-height: 40vh; overflow: auto; box-shadow: 0 8px 18px rgba(0,0,0,0.45); }
.history .log[hidden] { display: none; }
.idle { position: absolute; right: 4px; bottom: 4px; z-index: 5; display: grid; gap: 6px; padding: 7px 8px 8px; border-radius: 8px; background: rgba(28,20,14,0.9); box-shadow: 0 6px 14px rgba(0,0,0,0.45); }
.idle[hidden], .idle-row:empty { display: none; }
.idle-row { display: flex; align-items: center; gap: 4px; }
.idle-arrow { width: 24px; height: 50px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--paper); font-size: 14px; }
.idle-arrow:hover:not(:disabled) { background: rgba(239,230,210,0.12); }
.idle-arrow:disabled { opacity: 0.25; cursor: default; }
.idle-pick { position: relative; width: 54px; height: 54px; padding: 3px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 6px; background: var(--paper); }
.idle-pick canvas { display: block; }
.idle-pick b { position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; background: var(--brass); color: var(--brass-ink); font-size: 13px; line-height: 20px; text-align: center; }
.idle-pick:hover:not(:disabled) { background: #fff7e2; }
.idle-pick:disabled { opacity: 0.55; cursor: default; }
.seat .swatch { width: 18px; height: 18px; margin-top: 3px; }
.seat-name { font-weight: 700; font-size: 17px; }
.seat-co-name { margin-top: 2px; font: 400 22px/1.1 var(--display); color: var(--ink); }
.seat-counts { float: right; display: grid; gap: 4px; margin-left: 8px; }
.seat-count { display: flex; align-items: center; gap: 6px; font-size: 19px; }
.seat-count b { min-width: 1.4em; }
/* Funds like the top bar: gold figure outlined in ink, small uppercase label. */
.seat-funds { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); }
.seat-funds b, .seat-value b { font-size: 22px; font-weight: 800; letter-spacing: 0; color: #eab54e; text-shadow: 1px 0 0 var(--ink), -1px 0 0 var(--ink), 0 1px 0 var(--ink), 0 -1px 0 var(--ink); }
.seat.is-turn .seat-funds b { font-size: 28px; }
.seat-value { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); }
.seat-value b { font-size: 18px; color: var(--seat); }
.seat-count canvas { padding: 2px; border: 2px solid var(--ink); border-radius: 4px; background: var(--paper-2); image-rendering: pixelated; }
.seat-stat { color: var(--ink-2); font-size: 14px; }
.seat-stat b { color: var(--ink); }
.seat.is-turn { background: color-mix(in srgb, var(--seat, transparent) 50%, transparent); box-shadow: inset 3px 0 0 var(--ink); }
.seat.is-out { opacity: 0.5; }
.tile-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; margin-bottom: 4px; }
.tile-thumb { display: block; border: 2px solid var(--ink); border-radius: 4px; image-rendering: pixelated; }
.info-title { font-weight: 800; font-size: 18px; }
.stars { color: #a8721c; letter-spacing: 1px; }
.stars i { font-style: normal; color: #cbbd9f; }
.def-squares { display: inline-flex; gap: 3px; }
.def-squares i { width: 12px; height: 12px; border: 2px solid var(--ink); border-radius: 2px; background: #fff; box-sizing: border-box; }
.def-squares i.up { background: #3c9a4a; }
.def-squares i.down { background: #c8442f; }
.reference-stats .def-squares i { width: 15px; height: 15px; }
.reference-stats .def-pct { margin-left: 6px; font-weight: 600; color: var(--ink-2); }
.muted { color: var(--ink-2); margin: 2px 0 0; font-size: 14px; }
.unit-card { display: flex; gap: 10px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #c9bb9c; }
.stats { margin: 10px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stats div { background: var(--paper-2); border-radius: 4px; padding: 4px 6px; }
.stats dt { display: flex; align-items: center; gap: 5px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }
.stats dt img { image-rendering: pixelated; }
.stats dd { margin: 0; font-weight: 700; }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.log li { padding-left: 10px; border-left: 3px solid var(--seat, #b5aa94); }
.concede { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.concede[hidden] { display: none; }
#concedeBtn:disabled { opacity: 0.55; cursor: not-allowed; }
.linkish { background: none; border: none; padding: 0; color: var(--ink-2); text-decoration: underline; font-weight: 600; font-size: 16px; }
.confirm { font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mini-btn { padding: 8px 12px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); font-size: 16px; }
.mini-btn.danger { background: #b23d29; color: var(--paper); border-color: #6d2416; }

/* Floating menus */
.menu { position: absolute; z-index: 5; display: grid; gap: 4px; padding: 6px; min-width: 150px; background: var(--paper); border-radius: 8px; box-shadow: 0 2px 0 #b9ab8e, 0 12px 26px rgba(0,0,0,0.5); }
.menu button { text-align: left; padding: 11px 14px; border: none; background: transparent; color: var(--ink); font-size: 19px; }
.menu button:hover, .menu button:focus-visible { background: var(--ink); color: var(--paper); outline: none; }
.menu button.quiet { color: var(--ink-2); font-weight: 600; }
.forecast { position: absolute; z-index: 5; min-width: 230px; padding: 10px 16px; background: rgba(36,30,26,0.9); color: #fff; border-radius: 8px; box-shadow: 0 12px 26px rgba(0,0,0,0.5); pointer-events: none; }
.forecast hr { margin: 8px 0; border: 0; border-top: 2px solid rgba(255,255,255,0.85); }
.fc-row { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; font: 600 22px/1.1 var(--ui); }
.fc-row b { font-size: 30px; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fc-row b i { font-style: normal; }
.fc-deal span { color: #3fd14f; }
.fc-take span { color: #f06e5c; }
.fc-hint { margin: 8px 0 0; font-size: 15px; color: #e4d6c2; }

/* Overlays */
.overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(18,12,8,0.55); }
.sheet { width: min(460px, 100%); max-height: calc(100% - 32px); overflow: auto; background: var(--paper); color: var(--ink); border-radius: 10px; padding: 16px; box-shadow: 0 3px 0 #b9ab8e, 0 20px 50px rgba(0,0,0,0.6); }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.sheet h2 { margin: 0; font: 400 24px/1 var(--display); }
.build-list { display: grid; gap: 4px; }
.build-item { display: grid; grid-template-columns: 40px 1fr auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; padding: 6px 8px; border: 1px solid transparent; background: transparent; color: var(--ink); }
.build-item canvas { grid-row: span 2; }
.bi-name { font-size: 17px; font-weight: 700; }
.bi-meta { font-size: 13px; color: var(--ink-2); font-weight: 600; grid-column: 2; }
.bi-cost { grid-row: 1 / span 2; grid-column: 3; font-weight: 800; font-size: 17px; }
.build-item:hover:not(:disabled), .build-item:focus-visible { background: var(--paper-2); border-color: #c9bb9c; }
.build-item:disabled { opacity: 0.4; cursor: not-allowed; }
.turn-card { width: min(380px, 100%); text-align: center; background: var(--paper); color: var(--ink); border-radius: 10px; padding: 22px 20px 20px; border-top: 10px solid var(--seat); box-shadow: 0 3px 0 #b9ab8e, 0 20px 50px rgba(0,0,0,0.6); }
.turn-card .eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.turn-card h2 { margin: 6px 0 4px; font: 400 32px/1.05 var(--display); text-wrap: balance; }
.turn-card p { margin: 0 0 16px; color: var(--ink-2); }
.turn-card .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.field { display: grid; gap: 4px; margin-bottom: 10px; text-align: left; }
.field span { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }
.field input { font: 600 17px var(--ui); padding: 9px 10px; border-radius: 6px; border: 1px solid #b9ab8e; background: #fbf7ee; color: var(--ink); }
.dark-btn { padding: 12px 18px; border: 1px solid var(--ink); background: transparent; color: var(--ink); }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 30; background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 8px; border: 1px solid #5a4636; }

@media (max-width: 860px) {
  .app { height: auto; min-height: 100%; }
  .stage { grid-template-columns: 1fr; }
  .board-wrap { place-items: start center; }
  .panel { overflow: visible; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Home, join and lobby screens */
.screen { min-height: 100%; padding: 32px 16px 48px; display: grid; justify-items: center; align-content: start; gap: 18px; }
.screen-inner { width: min(720px, 100%); display: grid; gap: 16px; }
/* Home: three columns on wide screens (matches and shortcuts, online match, hot-seat), stacked below. */
.home-inner { width: min(1400px, 100%); }
.home-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; align-items: start; }
.home-col { display: grid; gap: 16px; min-width: 0; }
.home-inner .card { padding: 16px 18px; }
.home-inner .card h3 { font-size: 28px; margin-bottom: 10px; }
.home-inner .note { font-size: 17px; }
.home-inner .field span { font-size: 15px; }
.home-inner .field select, .home-inner .field input { font-size: 19px; }
.home-inner .check { font-size: 18px; }
.home-inner .check input { width: 20px; height: 20px; }
.home-inner .hero p { font-size: 21px; }
.home-inner .match-row .mr-title { font-size: 19px; }
.home-inner .match-row .mr-sub { font-size: 16px; }
.home-inner .account-card { font-size: 18px; }
.hero { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.hero h1 { margin: 0; font: 400 clamp(34px, 6vw, 52px)/1 var(--display); color: var(--brass); }
.hero p { margin: 0; color: #b9a78f; font-size: 17px; }
.card h3 { margin: 0 0 6px; font: 400 22px/1.1 var(--display); color: var(--ink); }
.card p { margin: 0 0 10px; }
.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.form-row .field { flex: 1 1 180px; margin: 0; }
.field select { font: 600 17px var(--ui); padding: 9px 10px; border-radius: 6px; border: 1px solid #b9ab8e; background: #fbf7ee; color: var(--ink); }
.matches { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.match-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 10px 12px; background: var(--paper-2); border-radius: 6px; }
.match-row .mr-title { font-weight: 800; font-size: 17px; }
.match-row .mr-sub { color: var(--ink-2); font-size: 14px; }
.match-row .mr-actions { grid-row: span 2; display: flex; gap: 6px; align-items: center; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 700; background: #d8ccb1; color: var(--ink); }
.pill.go { background: #e7b552; color: var(--brass-ink); }
.pill.done { background: #c9c1b0; color: var(--ink-2); }
a.dark-btn, a.btn-primary { display: inline-block; text-decoration: none; border-radius: 8px; font: 700 18px/1 var(--ui); }
.linkbox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.linkbox code { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; font: 600 14px/1.3 ui-monospace, Consolas, monospace; background: #fbf7ee; border: 1px solid #c9bb9c; border-radius: 6px; padding: 8px 10px; color: var(--ink); }
.seat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.seat-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--paper-2); border-radius: 6px; flex-wrap: wrap; }
.seat-list .sl-name { font-weight: 700; flex: 1 1 auto; }
.seat-list .open { color: var(--ink-2); font-style: italic; font-weight: 600; }
.note { font-size: 14px; color: var(--ink-2); }
.empty { color: var(--ink-2); font-size: 15px; padding: 6px 0; }
.waiting { color: #b9a78f; font-size: 15px; }
.you-tag { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; background: var(--ink); color: var(--paper); border-radius: 4px; padding: 2px 6px; }
.btn-primary:disabled, .dark-btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.seat .rekey { align-self: start; margin-top: 2px; }

/* Commanders */
.pb-text { line-height: 1.1; min-width: 92px; }
.pb-text small { display: block; color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.pb-text b { font-size: 16px; }
.meter { display: flex; gap: 2px; margin-top: 3px; }
.meter i { width: 11px; height: 11px; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); background: rgba(239,230,210,0.22); position: relative; overflow: hidden; }
.meter i::after { content: ''; position: absolute; inset: 0; width: var(--f, 0%); background: var(--brass); }
.meter i.big { width: 14px; height: 14px; }
.pbtn { padding: 8px 11px; font-size: 16px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); }
.pbtn:disabled { opacity: 0.35; cursor: not-allowed; }
.pbtn.ready { background: var(--brass); color: var(--brass-ink); box-shadow: 0 0 0 2px rgba(176,122,28,0.4); }
.pbtn.on { background: #b23d29; color: var(--paper); border-color: #6d2416; opacity: 1; }
.weather { padding: 6px 10px; border-radius: 999px; background: #c9a35b; color: var(--brass-ink); font-weight: 800; font-size: 14px; }
.weather[data-type="rain"] { background: #7fa6c4; color: #10202c; }
.co-list { display: grid; gap: 10px; }
.co-row { display: grid; grid-template-columns: 34px 1fr; gap: 2px 10px; align-items: start; }
.co-row .co-title { font-weight: 800; font-size: 18px; }
.co-row p { margin: 0; font-size: 16px; color: var(--ink); line-height: 1.4; }
.co-row .co-title + p, .co-row p + p { margin-top: 8px; }
.co-row .co-power { font-size: 17px; }
.co-row .co-super { font-size: 18px; }
.co-power .pw { color: #1f55a3; }
.co-super .pw { color: #a8281a; }
.commander-body .co-power { font-size: 18px; }
.commander-body .co-super { font-size: 19px; }
.co-row p b { color: var(--ink); }
.co-row .badge { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 4px; background: var(--ink); color: #ffd36b; font-size: 12px; font-weight: 800; }
/* Columns rather than a grid: each card keeps its own height, the next one fits right under it. */
.co-guide { columns: 300px; column-gap: 12px; }
.co-guide > .co-row { break-inside: avoid; margin-bottom: 12px; }
.co-guide .co-row { background: var(--paper-2); border-radius: 6px; padding: 8px 10px; }
/* Army of origin of a commander, as a tint behind its card. */
.co-row[data-faction="os"] { --faction: #c8442f; }
.co-row[data-faction="bm"] { --faction: #2f6fb5; }
.co-row[data-faction="ge"] { --faction: #3f8f4a; }
.co-row[data-faction="yc"] { --faction: #d39a17; }
.co-row[data-faction="bh"] { --faction: #3a3540; }
.co-row[data-faction="b12"] { --faction: #c8442f; }
.co-row[data-faction="lz"] { --faction: #2f6fb5; }
.co-row[data-faction="nr"] { --faction: #d39a17; }
.co-row[data-faction="ids"] { --faction: #3a3540; }
.co-guide .co-row[data-faction] { background: color-mix(in srgb, var(--faction) 32%, var(--paper-2)); box-shadow: inset 4px 0 0 var(--faction); }
.commanders-sheet { width: min(840px, 100%); }
.commanders-sheet .sheet-head .muted { margin-top: 4px; }
.commanders-sheet .note { margin: 0 0 14px; }
.co-pick { font: 600 17px var(--ui); padding: 8px 10px; border-radius: 6px; border: 1px solid #b9ab8e; background: #fbf7ee; color: var(--ink); max-width: 100%; }
.seat-co { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.hs-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; }
.splash { position: fixed; left: 50%; top: 18%; transform: translateX(-50%); z-index: 25; display: flex; gap: 14px; align-items: center; padding: 14px 20px; background: var(--paper); color: var(--ink); border-radius: 10px; border-left: 10px solid var(--seat, var(--brass)); box-shadow: 0 3px 0 #b9ab8e, 0 20px 50px rgba(0,0,0,0.6); max-width: calc(100% - 32px); animation: splash-in 0.25s ease-out; }
.splash small { text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; color: var(--ink-2); font-size: 12px; }
.splash h2 { margin: 2px 0; font: 400 30px/1 var(--display); }
.splash p { margin: 0; color: var(--ink-2); font-size: 15px; }
@keyframes splash-in { from { transform: translate(-50%, -10px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .splash { animation: none; } }
.turn-banner { position: fixed; left: 50%; top: 38%; z-index: 24; display: grid; justify-items: center; gap: 2px; padding: 12px 22px 10px; min-width: 150px; background: var(--paper); color: var(--ink); border-radius: 10px; border-top: 8px solid var(--seat, var(--brass)); box-shadow: 0 3px 0 #b9ab8e, 0 20px 50px rgba(0,0,0,0.6); pointer-events: none; transform: translate(-50%, -50%); opacity: 0; }
.turn-banner.shown { animation: banner-in 0.25s ease-out forwards; }
.turn-banner.leaving { animation: banner-out 0.3s ease-in forwards; }
.turn-banner .tb-co.co-bust { width: 84px; margin-bottom: 6px; }
.turn-banner canvas.tb-co:not(.co-bust) { width: 64px; height: 64px; margin-bottom: 6px; }
.turn-banner .swatch.tb-co { width: 40px; height: 40px; margin-bottom: 8px; }
.turn-banner b { font: 400 26px/1.05 var(--display); }
.turn-banner small { text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; color: var(--ink-2); font-size: 13px; }
@keyframes banner-in { from { opacity: 0; transform: translate(-50%, -40%); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes banner-out { from { opacity: 1; transform: translate(-50%, -50%); } to { opacity: 0; transform: translate(-50%, -60%); } }
@media (prefers-reduced-motion: reduce) { .turn-banner.shown, .turn-banner.leaving { animation: none; opacity: 1; } }
.card .meter i { background: #cdbf9f; }
.card .meter i::after { background: #b07a1c; }
@media (max-width: 1280px) { .brand span { display: none; } }
.uc-name { min-width: 0; }
.atkdef { margin: 0 0 0 auto; display: grid; gap: 2px; text-align: right; }
.atkdef div { display: flex; gap: 8px; justify-content: flex-end; align-items: baseline; }
.atkdef dt { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--ink-2); }
.atkdef dd { margin: 0; font-weight: 800; font-size: 17px; min-width: 48px; }
.up { color: #2f7a3a; }
.down { color: #b23d29; }

/* Bar right above the map with End turn */
.board-wrap { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; overflow: hidden; }
.board-bar { flex: none; }
.board-scroll { flex: 1 1 auto; min-height: 0; width: 100%; overflow: auto; display: flex; justify-content: safe center; align-items: safe center; overscroll-behavior: contain; cursor: grab; touch-action: none; user-select: none; overflow-anchor: none; }
.board-scroll .board-frame { flex: none; margin: auto; }
.board-scroll.panning, .board-scroll.panning canvas { cursor: grabbing; }
.zoom { display: inline-flex; border: 1px solid rgba(239,230,210,0.35); border-radius: 8px; overflow: hidden; }
.zoom .btn { border: none; border-radius: 0; padding: 9px 12px; }
.zbtn { font-size: 22px; line-height: 0.8; min-width: 40px; }
.zlabel { font-size: 16px; min-width: 64px; border-left: 1px solid rgba(239,230,210,0.25) !important; border-right: 1px solid rgba(239,230,210,0.25) !important; font-variant-numeric: tabular-nums; }
.board-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; max-width: 100%; }
.bb-turn { margin-right: auto; display: flex; align-items: center; gap: 12px; font: 400 26px/1.05 var(--display); min-width: 0; }
.bb-turn .swatch { width: 28px; height: 28px; }
.bb-turn .bb-co.co-bust { width: 56px; }
.bb-turn canvas.bb-co:not(.co-bust) { width: 48px; height: 48px; }
.bb-turn small { color: #b9a78f; font: 600 14px/1 var(--ui); }
#endTurn { padding: 12px 22px; font-size: 18px; }
#endTurn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
@media (max-width: 860px) { .board-scroll { max-height: 75vh; } }

.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--ink); cursor: pointer; padding: 8px 0; }
.check input { width: 18px; height: 18px; accent-color: #b07a1c; }

.opt-row { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 8px; }
.tagbox { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding-top: 6px; border-top: 1px solid rgba(36,26,19,0.2); }
.tagbox[hidden] { display: none; }
.tagbox .pb-text { min-width: 70px; }
.replay { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.rbtn { padding: 10px 12px; min-width: 40px; font-size: 18px; }
.rp-label { color: #d9cbb4; font-weight: 700; font-size: 14px; margin-left: 6px; font-variant-numeric: tabular-nums; }
.team-tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; font-size: 12px; font-weight: 800; background: var(--ink); color: var(--paper); vertical-align: 2px; }

.swatch[data-shape="tri"] { clip-path: polygon(50% 4%, 98% 92%, 2% 92%); border: none; box-shadow: none; }
.swatch[data-shape="hex"] { clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%); border: none; box-shadow: none; }
.army-pick { font: 600 17px var(--ui); padding: 8px 10px; border-radius: 6px; border: 1px solid #b9ab8e; background: #fbf7ee; color: var(--ink); }
.hs-row.hs-3 { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.4fr); }
.hs-row .field { min-width: 0; }
.hs-row input, .hs-row select { box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; }
@media (max-width: 520px) {
  .hs-row.hs-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hs-row.hs-3 .field:last-child { grid-column: 1 / -1; }
}
#nmForm { box-sizing: border-box; width: 100%; }
#nmNames { display: grid; gap: 8px; margin-bottom: 12px; }
#hotSeat { scroll-margin-top: 16px; }
.form-row .mode-first { flex-basis: 100%; }
.setup-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
#createSetup { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; width: 100%; }
.setup-fields[hidden] { display: none !important; }
#nmSetup { width: 100%; text-align: left; }
#nmModeNote { text-align: left; }

/* Damage chart */
/* Reference cards share the game's terrain and unit art. */
#referenceSheet { z-index: 35; }
.reference-sheet { width: min(1000px, 100%); max-height: calc(100vh - 64px); box-sizing: border-box; display: flex; flex-direction: column; overflow: hidden; }
.reference-sheet .sheet-head, .reference-controls { flex-shrink: 0; }
.reference-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 16px; }
.reference-controls .field { flex: 1; min-width: 170px; }
.reference-controls [aria-pressed="true"] { background: var(--brass); }
.reference-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 20px; flex: 1; min-height: 0; }
#referenceList { display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow: auto; }
#referenceDetail { min-height: 0; overflow: auto; padding-right: 5px; font-size: 19px; }
#referenceDetail .note, #referenceDetail .muted { font-size: 17px; }
.reference-choice { text-align: left; padding: 9px 10px; color: var(--ink); border: 1px solid transparent; border-radius: 5px; background: var(--paper-2); font: 600 18px var(--ui); cursor: pointer; }
.reference-choice[aria-pressed="true"] { background: var(--brass); border-color: #9d752f; }
.reference-identity { display: flex; gap: 16px; align-items: center; }
.reference-identity canvas { flex: 0 0 72px; border-radius: 4px; image-rendering: pixelated; }
.reference-identity h3 { margin: 2px 0; font: 400 32px var(--display); }
.reference-identity p { margin: 2px 0; }
.reference-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
.reference-stats div { background: var(--paper-2); padding: 9px; border-radius: 5px; }
.reference-stats dt { font-size: 16px; color: var(--ink-2); }
.reference-stats dd { margin: 3px 0 0; font-weight: 700; font-size: 21px; }
#referenceDetail h4 { margin: 18px 0 6px; font-size: 22px; }
.reference-notes { margin: 6px 0 14px; padding-left: 20px; }
.reference-notes li { margin: 5px 0; }
.reference-matchup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.reference-matchups { list-style: none; padding: 0; margin: 0; }
.reference-matchups li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid #d3c6ac; }
.reference-matchups .linkish { text-align: left; font-size: 19px; }
.reference-table { width: 100%; border-collapse: collapse; font-size: 18px; }
.reference-table th, .reference-table td { padding: 7px 8px; text-align: left; border-bottom: 1px solid #d3c6ac; }
.reference-table thead { background: var(--paper-2); }
.reference-table td { font-variant-numeric: tabular-nums; }
.reference-damage summary { cursor: pointer; font-weight: 700; padding: 10px 0; }
.reference-sources { font-size: 17px; color: var(--ink-2); margin-top: 18px; }
.reference-sources a { color: var(--ink); }
@media (max-width: 650px) {
  .reference-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
  #referenceList { flex-direction: row; overflow-x: auto; max-height: none; }
  .reference-choice { flex: 0 0 auto; }
  .reference-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reference-matchup-grid { grid-template-columns: 1fr; gap: 0; }
  .reference-table th, .reference-table td { padding: 6px 3px; }
}
.chart-sheet { width: min(1180px, 100%); }
.chart-sheet .muted { margin-top: 4px; font-size: 18px; }
.chart-scroll { overflow: auto; max-height: min(62vh, 640px); border: 1px solid #c9bb9c; border-radius: 6px; background: #f6efdf; }
table.dmg { border-collapse: separate; border-spacing: 0; font: 600 17px/1 var(--ui); font-variant-numeric: tabular-nums; }
table.dmg th, table.dmg td { padding: 0; text-align: center; border-right: 1px solid rgba(36,26,19,0.08); border-bottom: 1px solid rgba(36,26,19,0.08); }
table.dmg thead th { position: sticky; top: 0; z-index: 2; background: var(--paper-2); padding: 4px 1px 3px; min-width: 46px; vertical-align: bottom; }
table.dmg thead th .ab { display: block; font: 700 14px/1 var(--ui); letter-spacing: 0.04em; color: var(--ink-2); margin-top: 2px; }
table.dmg tbody th { position: sticky; left: 0; z-index: 1; background: var(--paper-2); text-align: left; padding: 2px 8px 2px 4px; white-space: nowrap; font-weight: 700; }
table.dmg tbody th canvas { vertical-align: middle; margin-right: 4px; }
table.dmg thead th.corner { left: 0; z-index: 3; text-align: left; padding-left: 8px; font: 700 14px/1.2 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
table.dmg td { height: 36px; min-width: 46px; color: var(--ink); cursor: default; }
table.dmg td.none { color: rgba(36,26,19,0.22); }
table.dmg td.hot { color: #fff8ea; }
table.dmg td.mg { font-style: italic; box-shadow: inset 0 -3px 0 rgba(36,26,19,0.35); }
table.dmg .hl-row th, table.dmg th.hl-col { background: #d8c49b; }
table.dmg td.hl { outline: 1px solid rgba(36,26,19,0.25); outline-offset: -1px; }
table.dmg td.cur { outline: 2px solid var(--ink); outline-offset: -2px; }
table.dmg tr.mine th { box-shadow: inset 3px 0 0 var(--ink); }
.chart-info { min-height: 1.3em; margin: 8px 2px 4px; font-weight: 600; font-size: 19px; }
.chart-foot { font-size: 17px; color: var(--ink-2); }
.chart-foot p { margin: 4px 0; }
.chart-foot .key { display: inline-block; min-width: 26px; padding: 1px 4px; text-align: center; border-radius: 3px; background: rgba(178,58,38,0.45); color: var(--ink); font-weight: 700; }
.chart-foot .key-mg { font-style: italic; box-shadow: inset 0 -3px 0 rgba(36,26,19,0.35); }
.chart-source a { color: var(--ink); font-weight: 700; }
.match-options { margin: 10px 0; }
.match-options summary { cursor: pointer; font-weight: 700; }
.match-option { margin-top: 8px; }
.match-option .note { margin: 2px 0 0; }
[data-co-open] { cursor: pointer; }
.co-row[data-co-open]:hover, .co-row[data-co-open]:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 2px; }
.commander-sheet { width: min(720px, 100%); }
.commander-body { display: grid; grid-template-columns: minmax(0, 320px) 1fr; gap: 16px; align-items: start; }
.commander-body canvas { width: 100%; height: auto; border-radius: 8px; background: var(--paper-2); }
.commander-body p { margin: 0 0 14px; font-size: 17px; line-height: 1.45; }
@media (max-width: 560px) { .commander-body { grid-template-columns: 1fr; } .commander-body canvas { max-height: 50vh; width: auto; max-width: 100%; justify-self: center; } }
.commanders-sheet, .chart-sheet, .reference-sheet { width: min(1100px, 100%); height: min(calc(100vh - 64px), 860px); box-sizing: border-box; }
.ency-tabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 12px; flex-shrink: 0; }
.ency-tabs [aria-pressed="true"] { background: var(--brass); }
.ency-tabs .ency-mode { margin-left: auto; display: flex; gap: 6px; align-items: center; font-weight: 700; font-size: 13px; }
.ency-tabs .ency-mode[hidden] { display: none; }
.reference-controls [role="group"], .reference-controls .field:has(#referenceGameMode) { display: none; }
.co-bust { display: block; aspect-ratio: 3 / 4; width: 72px; border-radius: 6px; border: 2px solid var(--ink); background: var(--paper-2); box-sizing: border-box; }
.co-row.has-bust { grid-template-columns: 72px 1fr; column-gap: 12px; }
.co-guide .co-row.has-bust { grid-template-columns: 116px 1fr; }
.co-guide .co-bust { width: 116px; }

/* Account */
.account-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.account-card p { margin: 0; }
.account-card .row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-primary.danger { background: #b23d29; border-color: #6d2416; color: var(--paper); box-shadow: 0 2px 0 #6d2416; }
.form-error { margin: 0 0 10px; color: #b23d29; font-weight: 700; font-size: 15px; }

/* Match stats */
#victoryCard:has(.stats-table) { width: min(620px, 100%); }
.match-stats { overflow-x: auto; margin: 0 0 16px; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.stats-table th, .stats-table td { padding: 5px 8px; text-align: right; border-bottom: 1px solid rgba(36,26,19,0.15); }
.stats-table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); }
.stats-table th:first-child { text-align: left; }
.stats-table tbody th { font-weight: 800; box-shadow: inset 4px 0 0 var(--seat); padding-left: 10px; }

/* Profile and leaderboard */
.hero-links { display: flex; gap: 8px; }
.hero-links a, .account-card a { text-decoration: none; }
.mode-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.mode-tabs [aria-pressed="true"] { background: var(--brass); }
.profile-totals { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 0; }
.profile-totals div { background: var(--paper-2); border-radius: 6px; padding: 8px 10px; }
.profile-totals dt { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }
.profile-totals dd { margin: 2px 0 0; font: 400 24px/1 var(--display); }
.co-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.co-chips li { background: var(--paper-2); border-radius: 999px; padding: 5px 12px; font-weight: 700; }
.co-chips li small { color: var(--ink-2); font-weight: 600; }
.stats-table td a { color: var(--ink); font-weight: 700; }
.stats-table td.left, .stats-table th.left { text-align: left; }

/* Replays */
.rp-speed { display: inline-flex; align-items: center; gap: 6px; color: #d9cbb4; font-weight: 700; font-size: 14px; margin-left: 6px; }
.rp-speed select { font: 700 14px var(--ui); padding: 6px; border-radius: 6px; background: #2c211a; color: var(--paper); border: 1px solid rgba(239,230,210,0.35); }
.replay-players { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.replay-players span { display: inline-flex; align-items: center; gap: 5px; }
.replay-players .swatch { width: 12px; height: 12px; }
.replay-players b.win { color: #2f7a3a; }
.replay-players a { color: inherit; font-weight: 700; }
