:root { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #eaf4ff; background: #0b1422; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: radial-gradient(ellipse 60% 35% at 50% -10%, #273c5d, transparent), #0b1422; }
.shell { width: 100%; max-width: 1600px; height: 100vh; height: 100dvh; min-height: 480px; padding: 10px 14px; margin: auto; display: flex; flex-direction: column; gap: 8px; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none; min-height: 38px; }
.eyebrow, .intro { display: none; }
h1 { font-size: clamp(25px, 3vw, 36px); letter-spacing: -.06em; line-height: 1; margin: 0; }
h1 span { color: #66e2bf; }
.top-actions { display: flex; align-items: center; gap: 12px; }
#status { font-size: 12px; color: #a6c6d9; text-align: right; max-width: 180px; }
button, select { font: inherit; }
button { border: 1px solid #496078; border-radius: 9px; padding: 8px 13px; background: #213249; color: #eaf4ff; cursor: pointer; font-weight: 700; transition: background .15s, transform .15s; }
button:hover:not(:disabled) { background: #31506f; transform: translateY(-1px); }
button:disabled { opacity: .48; cursor: default; }
.primary { background: #6be4bf; color: #092534; border-color: #6be4bf; }
.primary:hover:not(:disabled) { background: #8bf1d2; }
.play-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 10px; flex: 1; min-height: 0; }
.arena { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: 0; min-height: 0; }
.player-panel { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; padding: 7px 10px; border: 1px solid #31506d; border-radius: 13px; background: linear-gradient(160deg, #192a42, #101d31); box-shadow: 0 16px 36px #050b167a; }
.player-panel.human { border-top: 3px solid #6be4bf; }
.player-panel.ai { border-top: 3px solid #ffa96a; }
.panel-heading, .panel-footer { display: flex; justify-content: space-between; align-items: center; }
.panel-heading { margin-bottom: 4px; }
.panel-kicker, .match-caption, .score-label { font-size: 10px; font-weight: 800; letter-spacing: .14em; color: #77b7df; }
.panel-heading h2 { font-size: 17px; margin: 1px 0 0; }
.badge { font-size: 10px; font-weight: 800; padding: 4px 8px; border: 1px solid #49627a; border-radius: 999px; color: #bbd1e0; }
.board-slot { container-type: size; display: flex; align-items: center; justify-content: center; min-height: 0; min-width: 0; }
.board-wrap { position: relative; width: min(100%, calc(100cqh * 5 / 12)); aspect-ratio: 5 / 12; }
.board-wrap canvas { display: block; width: 100%; height: 100%; background: #0b1628; border: 2px solid #4b6684; border-radius: 4px; box-shadow: inset 0 0 25px #02070e; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; background: #081424c9; font-weight: 800; font-size: 16px; padding: 12px; }
.overlay[hidden] { display: none; }
.panel-footer { margin-top: 4px; color: #a9bfd1; font-size: 11px; }
.panel-footer strong { color: #eaf4ff; margin-left: 3px; }
.side-rail { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.scorebar { display: flex; flex-direction: column; gap: 10px; padding: 16px 12px; border: 1px solid #314660; border-radius: 13px; background: #142239; box-shadow: 0 12px 35px #050b1680; text-align: center; }
.score { display: flex; align-items: baseline; justify-content: center; gap: 7px; }
.score strong { font-size: 36px; line-height: 1; font-variant-numeric: tabular-nums; }
.score small { font-size: 9px; letter-spacing: .16em; color: #8da8ba; }
.match-center { display: flex; flex-direction: column; gap: 3px; padding: 10px 0; border-top: 1px solid #2c415c; border-bottom: 1px solid #2c415c; }
.match-center strong { font-size: 16px; }
.match-center > span:last-child { font-size: 10px; color: #8ca9bd; overflow-wrap: anywhere; }
.bottom-panel { display: flex; flex-direction: column; gap: 15px; padding: 14px; border: 1px solid #30445f; border-radius: 11px; background: #142239; }
.bottom-panel h3 { display: block; margin: 0 0 8px; font-size: 14px; }
.bottom-panel p { display: block; margin: 0; color: #b5c9d9; font-size: 12px; line-height: 2.2; }
kbd { font: 700 11px inherit; background: #273e59; border: 1px solid #53708c; border-radius: 4px; padding: 2px 5px; color: #e9f4ff; white-space: nowrap; }
.settings { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 8px; font-size: 11px; }
.settings label { grid-column: 1 / -1; }
.settings select { min-width: 0; padding: 7px; background: #213249; color: #eaf4ff; border: 1px solid #496078; border-radius: 8px; }
.touch-controls { display: none; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.touch-controls button { min-width: 42px; min-height: 42px; padding: 7px; touch-action: manipulation; }
.touch-controls .wide { min-width: 68px; }
.error { color: #ffd5d5; background: #5a2735; border-radius: 8px; padding: 8px; margin: 0; }
.side-rail footer { margin-top: auto; color: #7894a9; font-size: 10px; line-height: 1.4; text-align: left; }
@media (max-height: 750px) { .side-rail footer { display: none; } }
@media (max-width: 850px) {
  .shell { padding: 8px; gap: 6px; min-height: 430px; }
  .play-layout { display: flex; flex-direction: column; gap: 6px; }
  .side-rail { display: contents; }
  .scorebar { order: -1; display: grid; grid-template-columns: 1fr 1.4fr 1fr; align-items: center; gap: 0; padding: 4px 8px; flex: none; }
  .score { flex-direction: column; gap: 0; align-items: center; }
  .score strong { font-size: 23px; }
  .score small { display: none; }
  .score-label, .match-caption { font-size: 8px; }
  .match-center { padding: 0 5px; border-top: 0; border-bottom: 0; border-left: 1px solid #2c415c; border-right: 1px solid #2c415c; }
  .match-center strong { font-size: 12px; }
  .match-center > span:last-child { font-size: 8px; }
  .arena { flex: 1; gap: 6px; }
  .player-panel { padding: 5px; border-radius: 9px; }
  .panel-heading { margin-bottom: 3px; }
  .panel-heading h2 { font-size: 13px; }
  .panel-kicker { display: none; }
  .badge { font-size: 8px; padding: 2px 4px; }
  .panel-footer { font-size: 9px; margin-top: 3px; }
  .bottom-panel { order: 1; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 9px; flex: none; }
  .bottom-panel h3 { display: none; }
  .bottom-panel p { font-size: 10px; line-height: 1.7; }
  .settings { display: flex; flex: none; gap: 5px; white-space: nowrap; }
  .settings label { display: none; }
  .side-rail footer { display: none; }
  #error { order: 2; }
}
@media (max-width: 600px) {
  h1 { font-size: clamp(21px, 5vw, 30px); }
  #status { font-size: 10px; max-width: 110px; }
  .top-actions { gap: 7px; }
  .top-actions button { padding: 7px 9px; font-size: 11px; white-space: nowrap; }
  .bottom-panel { flex-direction: column; align-items: stretch; }
  .bottom-panel p { display: none; }
  .touch-controls { display: flex; justify-content: center; margin: 0; }
  .settings { width: 100%; justify-content: space-between; }
}
@media (max-width: 430px) {
  .panel-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
  .panel-footer { flex-direction: column; align-items: flex-start; gap: 2px; }
}
