@font-face { font-family: Geist; src: url(geist-latin-ext.woff2) format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0100-024F,U+1E00-1EFF; }
@font-face { font-family: Geist; src: url(geist-latin.woff2) format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF,U+2000-206F,U+20AC; }

:root {
    color-scheme: dark;
    font-family: Geist, system-ui, sans-serif;
    color: #f3ecda;
    background: #111817;
    --brass: #edc681;
    --mint: #b7d4aa;
    --muted: #bac3b8;
    --line: #3f4b40;
    --panel: #1d2723;
    --header-accent: #edc681;
    --arcade-audio-surface: #242d25;
    --arcade-audio-border: #736749;
    --arcade-audio-accent: #edc681;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; background: radial-gradient(ellipse at 59% 23%,#253526,#141d1b 65%); }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }
.tb-visually-hidden { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

.arcade-topbar { --header-accent: #f3ce86; }
.arcade-mark.tb-insignia { position: relative; background: #2e3221; border: 1px solid #7b6642; border-radius: 6px; }
.tb-insignia::before { content: ''; width: 12px; height: 10px; position: absolute; top: 10px; border: solid #d6ab62; border-width: 0 2px 2px; transform: skew(-17deg); }
.tb-insignia i { position: absolute; width: 14px; height: 2px; background: #e8bc77; transform: rotate(-32deg) translateY(-2px); }

.tb-lobby, .tb-rooms { width: min(1160px,calc(100% - 36px)); margin: 26px auto 20px; }
.tb-hero { display: flex; position: relative; isolation: isolate; min-height: clamp(360px,58dvh,560px); align-items: end; overflow: hidden; border: 1px solid #5e6756; border-radius: 16px; background: #152722; box-shadow: 0 20px 65px #030b09aa; }
.tb-hero > img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: 67% 50%; }
.tb-hero::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg,#081715de 3%,#0c1a18aa 37%,#0b19160c 78%),linear-gradient(0deg,#091517a8,transparent 46%); }
.tb-hero-copy { padding: clamp(24px,5.5vw,70px); max-width: 660px; }
.tb-hero h1 { font-size: clamp(47px,8.5vw,111px); letter-spacing: -.087em; line-height: .92; font-weight: 730; color: #ffdfab; text-shadow: 0 3px 24px #101a16; }
.tb-hero p { font-size: clamp(13px,1.5vw,18px); color: #e6e5d1; margin: 15px 0 22px; line-height: 1.5; }
.tb-modes, .tb-room-controls, .tb-room-controls form, .tb-command-actions, .tb-battle-actions, .tb-dialog-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tb-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 8px 13px; border: 1px solid transparent; border-radius: 7px; font-weight: 630; font-size: 13px; white-space: nowrap; }
.tb-primary { color: #201911; background: var(--brass); border-color: #f0cf97; }
.tb-primary:hover:not(:disabled) { background: #ffe0aa; }
.tb-outline { color: #f4e4c4; background: #273029; border-color: #777457; }
.tb-outline:hover:not(:disabled), .tb-subtle:hover:not(:disabled) { border-color: var(--brass); color: #ffe1ac; }
.tb-subtle { color: var(--muted); background: #1b2622; border-color: #455348; }
.tb-lobby-strip { margin-top: 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.tb-progress { flex: 1; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 19px; padding: 11px 14px; border: 1px solid #4b5447; border-radius: 9px; background: #1d2824; font-size: 13px; }
.tb-progress:empty { visibility: hidden; }
.tb-progress strong { color: var(--brass); }
.tb-progress small { color: var(--muted); font-size: 12px; }
.tb-progress progress { width: min(124px,29vw); height: 7px; accent-color: var(--brass); }
.tb-footer { width: min(1160px,calc(100% - 36px)); margin: 12px auto; display: flex; flex-wrap: wrap; gap: 15px; color: var(--muted); font-size: 12px; }
.tb-footer button { background: none; color: inherit; border: 0; font: inherit; padding: 0; }
body:has(.tb-battle:not([hidden])) .tb-footer { display: none; }

.tb-rooms { max-width: 760px; }
.tb-section-head { display: flex; align-items: center; gap: 14px; margin: 12px 0 20px; flex-wrap: wrap; }
.tb-section-head h1 { font-size: clamp(25px,5vw,41px); letter-spacing: -.046em; }
.tb-room-controls { justify-content: space-between; margin: 12px 0; }
select, .tb-room-controls input { min-height: 38px; padding: 7px 10px; border: 1px solid #657265; border-radius: 7px; color: #f6edda; background: #151e1b; }
.tb-room-controls input { width: clamp(96px,27vw,160px); text-transform: uppercase; }
.tb-panel { padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); }
.tb-panel h2, .tb-field h2 { font-size: 16px; font-weight: 680; letter-spacing: -.02em; }
.tb-room-row { border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-block: 9px; }
.tb-room-row:first-child { margin-top: 12px; }
.tb-room-row b { display: block; overflow-wrap: anywhere; }
.tb-room-row small, .tb-empty { color: var(--muted); font-size: 12px; }
.tb-empty { padding: 12px 0 4px; }

body[data-screen=battle] .tb-footer { display: none; }
.tb-battle { --board-width: min(100%, max(275px, calc(100dvh - 219px)), 535px); width: min(1190px,calc(100% - 24px)); margin: 7px auto 0; }
.tb-battle-head, .tb-command { display: flex; justify-content: space-between; align-items: center; gap: 5px 10px; }
.tb-battle-head { margin-bottom: 6px; }
.tb-status { display: grid; align-content: center; min-width: 0; gap: 2px; }
.tb-status span { color: var(--brass); font-size: 10px; font-weight: 720; letter-spacing: .12em; text-transform: uppercase; }
.tb-status strong { font-size: clamp(14px,2.2vw,21px); }
.tb-battle-actions { flex-shrink: 0; gap: 4px; }
.tb-battle-actions .tb-btn { min-height: 29px; font-size: 11px; padding: 4px 8px; }
.tb-room-copy { font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.tb-command { padding: 5px 9px; margin-bottom: 6px; min-height: 43px; background: #222b24; border: 1px solid #55604f; border-radius: 8px; color: #e4ddc9; font-size: 12px; }
.tb-command .tb-btn { min-height: 30px; padding: 4px 9px; font-size: 12px; }
.tb-command-actions { gap: 4px; }
.tb-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: clamp(7px,1.8vw,24px); justify-items: center; }
.tb-field { width: var(--board-width); min-width: 0; border: 1px solid #515c4b; padding: 5px 7px 7px; border-radius: 9px; background: #17231f; box-shadow: 0 9px 28px #080f0d6e; }
.tb-field.tb-enemy { border-color: #685547; background: #211f1a; }
.tb-field-head { display: flex; justify-content: space-between; align-items: center; min-height: 23px; gap: 4px; padding-inline-start: 4px; margin: 1px 0 3px; }
.tb-field-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-field-head > span { color: var(--mint); font-size: 11px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.tb-enemy .tb-field-head > span { color: #e5bca3; }
.tb-coordinates { --axis: 19px; display: grid; grid-template: 15px minmax(0,1fr) / var(--axis) minmax(0,1fr); }
.tb-letters { grid-area: 1/2; display: grid; grid-template-columns: repeat(12,minmax(0,1fr)); }
.tb-numbers { grid-area: 2/1; display: grid; grid-template-rows: repeat(12,minmax(0,1fr)); }
.tb-letters span, .tb-numbers span { display: grid; place-items: center; color: #ebd6ad; font-size: 10px; font-variant-numeric: tabular-nums; }
.tb-board { position: relative; isolation: isolate; grid-area: 2/2; width: 100%; aspect-ratio: 1; overflow: hidden; border: 1px solid #60888d; border-radius: 4px; }
.tb-grid, .tb-machines, .tb-effects { position: absolute; inset: 0; }
.tb-grid { z-index: 1; display: grid; grid-template: repeat(12,minmax(0,1fr)) / repeat(12,minmax(0,1fr)); }
.tb-machines, .tb-effects { pointer-events: none; }
.tb-machines { z-index: 2; }
.tb-effects { z-index: 3; }
.tb-cell { min-width: 0; min-height: 0; position: relative; padding: 0; display: grid; place-items: center; touch-action: manipulation; background: transparent; border: 0; border-right: 1px solid #e6d6a734; border-bottom: 1px solid #e6d6a734; border-radius: 0; color: #f7dbab; }
.tb-cell:nth-child(12n) { border-right: 0; }
.tb-cell:nth-last-child(-n+12) { border-bottom: 0; }
.tb-cell[aria-disabled=true] { cursor: default; }
.tb-cell:not([aria-disabled=true]):hover, .tb-cell:focus-visible { outline: 0; box-shadow: inset 0 0 0 2px #ffd997; background: #dfbe6136; }
.tb-cell.tb-placed { background: #d5bd6d38; }
.tb-cell.tb-preview { background: #b6cf755b; box-shadow: inset 0 0 0 1px #cde8a3; }
.tb-cell.tb-invalid { background: #a64a4363; box-shadow: inset 0 0 0 1px #ff9587; }
.tb-cell[data-mark=miss] { background: radial-gradient(circle,#0b0f0d80 21%,#393229ad 29%,transparent 51%); }
.tb-cell[data-mark=hit] { background: #952e1799; box-shadow: inset 0 0 7px #f176347a; }
.tb-cell[data-mark=destroyed] { background: repeating-linear-gradient(132deg,#291610d9 0 4px,#6e3718be 4px 7px); box-shadow: inset 0 0 0 1px #df9258; }
.tb-cell.tb-selected { background: #b98b3391; box-shadow: inset 0 0 0 2px #ffdc9a; }
.tb-cell .tb-cell-mark { font-size: clamp(9px,1.5vw,15px); font-weight: 800; line-height: 1; position: relative; z-index: 3; text-shadow: 0 1px 2px #090403; }
.tb-engine { position: absolute; left: calc(var(--x) * 100% / 12); top: calc(var(--y) * 100% / 12); width: calc(200% / 12); height: calc(100% / 12); transform-origin: 25% 50%; padding: 0 5%; }
.tb-engine.tb-vertical { transform: rotate(90deg); }
.tb-engine[data-hp="0"] { opacity: .47; filter: grayscale(.8); }
.tb-tabs { display: none; }
.tb-report { margin: 5px 0 6px; color: var(--muted); font-size: 11px; min-height: 18px; text-align: center; overflow-wrap: anywhere; }
.tb-blast { position: absolute; width: min(32px,8%); aspect-ratio: 1; border-radius: 50%; translate: -50% -50%; border: 1px solid #fbd284; animation: tb-blast .47s ease-out both; }
@keyframes tb-blast { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.65); opacity: 0; } }

.tb-toast { position: fixed; z-index: 28; bottom: 12px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 20px); display: flex; align-items: center; gap: 10px; background: #382b21; color: #fff0d5; border: 1px solid #957352; border-radius: 8px; padding: 9px 12px; font-size: 13px; }
dialog { width: min(510px,calc(100% - 20px)); max-height: calc(100dvh - 20px); padding: 16px; border: 1px solid #7b7055; border-radius: 14px; background: #202922; color: #f9eed8; box-shadow: 0 21px 70px #050c09b3; }
dialog::backdrop { background: #060d0bc5; }
.tb-dialog-head, .tb-rank-filters, .tb-page-buttons { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tb-dialog-head { margin-bottom: 10px; }
.tb-dialog-head h2 { font-size: clamp(18px,5.4vw,25px); }
.tb-dialog-head .arcade-control { --control-size: 34px; }
.tb-dialog-actions { margin-top: 12px; }
dialog p, .tb-rules-list { margin-block: 11px; color: #d2dacb; font-size: 13px; line-height: 1.55; }
.tb-rules-list { padding-inline-start: 21px; }
.tb-rank-filters { justify-content: start; flex-wrap: wrap; margin-bottom: 10px; }
#tb-rank-content table { width: 100%; border-collapse: collapse; }
#tb-rank-content :is(th,td) { text-align: start; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 13px; overflow-wrap: anywhere; }
#tb-rank-content :is(th,td):nth-child(n+3) { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tb-page-buttons { margin-top: 8px; }
#tb-result-copy strong { display: block; color: var(--brass); font-size: clamp(21px,7vw,41px); margin: 10px 0; letter-spacing: -.045em; }
.syca-consent { position: fixed; z-index: 27; bottom: 12px; left: 12px; width: min(390px,calc(100% - 24px)); padding: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; font-size: 13px; }
.syca-consent p { margin: 5px 0; color: var(--muted); }
.syca-consent button { border: 1px solid #6b7257; border-radius: 6px; background: #394535; color: #fff; margin: 7px 6px 0 0; padding: 6px 8px; }

@media(max-width: 720px) {
    .tb-battle { --board-width: min(100%, max(210px, calc(100dvh - 209px)), 465px); width: calc(100% - 16px); }
    .tb-fields { grid-template-columns: minmax(0,1fr); }
    .tb-tabs { display: flex; gap: 4px; justify-content: center; margin: 4px 0; }
    .tb-tabs button { padding: 5px 9px; color: #e7e8d8; background: #202b25; border: 1px solid #4d5c4e; border-radius: 5px; font-size: 11px; min-height: 29px; }
    .tb-tabs button[aria-pressed=true] { color: var(--brass); border-color: var(--brass); }
    .tb-battle[data-board=own] .tb-enemy, .tb-battle[data-board=enemy] .tb-own { display: none; }
}
@media(max-width: 470px) {
    .tb-lobby, .tb-rooms { width: calc(100% - 20px); margin-top: 12px; }
    .tb-hero { min-height: 375px; border-radius: 10px; }
    .tb-hero > img { object-position: 71% center; }
    .tb-hero::after { background: linear-gradient(0deg,#071411f7 7%,#091812a3 39%,#15252114 74%); }
    .tb-hero-copy { padding: 20px 15px 24px; }
    .tb-hero h1 { font-size: clamp(45px,13vw,63px); }
    .tb-hero p { margin-block: 9px 15px; }
    .tb-lobby-strip { align-items: start; flex-direction: column; }
    .tb-progress { width: 100%; gap: 6px 11px; }
    .tb-status span { letter-spacing: .024em; }
    .tb-battle-actions .tb-btn { font-size: 10px; padding-inline: 5px; }
    .tb-command { padding: 4px; gap: 5px; }
    .tb-command .tb-btn { font-size: 10px; padding-inline: 5px; min-height: 28px; }
    .tb-coordinates { --axis: 16px; }
    .tb-field { padding: 4px 4px 4px; }
    .tb-field-head { min-height: 18px; margin-bottom: 1px; }
    .tb-field h2 { font-size: 13px; }
}
@media(prefers-reduced-motion:reduce) { *, *::before, *::after { animation-duration: .001s !important; } }
