:root {
  color-scheme: dark;
  --bg: #000000;
  --panel: #0b0b0b;
  --line: #49483f;
  --ink: #d7d7ce;
  --muted: #aaa99c;
  --lime: #e8dfa3;
  --orange: #ff9d5c;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    15px/1.5 system-ui,
    -apple-system,
    Segoe UI,
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button,
.button {
  border: 1px solid var(--line);
  background: #151515;
  color: var(--ink);
  padding: 12px 17px;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
button:hover,
.button:hover {
  border-color: var(--lime);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 4px;
}
button:disabled {
  opacity: 0.45;
  cursor: wait;
}
.primary {
  background: var(--lime);
  color: #111111;
  border-color: var(--lime);
  font-weight: 700;
}
header {
  height: 82px;
  max-width: 1440px;
  margin: auto;
  padding: 0 5%;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 2px;
}
.mark {
  font-size: 29px;
  color: var(--lime);
  margin-right: 12px;
}
.muted,
.note {
  color: var(--muted);
}
.header-right {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 12px;
}
.tag {
  border: 1px solid var(--line);
  padding: 4px 9px;
  font:
    10px ui-monospace,
    monospace;
  letter-spacing: 1px;
  color: var(--muted);
}
.tag.online {
  color: var(--lime);
}
.text-button {
  padding: 4px;
  border: 0;
  background: none;
  color: var(--muted);
}
main {
  max-width: 1260px;
  padding: 0 30px;
  margin: auto;
}
.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 66px 0 48px;
  gap: 25px;
}
.eyebrow {
  font:
    11px ui-monospace,
    Consolas,
    monospace;
  letter-spacing: 2px;
  color: var(--muted);
}
h1 {
  font-size: clamp(38px, 5vw, 68px);
  line-height: 1.05;
  letter-spacing: -3px;
  margin: 25px 0;
}
h1 span {
  color: var(--lime);
}
.lede {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}
.intro-art {
  width: 220px;
  height: 220px;
  position: relative;
  transform: rotate(-12deg);
  margin: 15px 80px;
}
.intro-art i {
  position: absolute;
  width: 72px;
  height: 72px;
  border: 1px solid #e8dfa3;
  background: linear-gradient(145deg, #e8dfa32b, #e8dfa308);
  box-shadow: inset 0 0 0 6px #e8dfa309;
}
.intro-art i:nth-child(1) {
  left: 0;
  top: 72px;
}
.intro-art i:nth-child(2) {
  left: 72px;
  top: 72px;
}
.intro-art i:nth-child(3) {
  left: 144px;
  top: 72px;
}
.intro-art i:nth-child(4) {
  left: 72px;
  top: 144px;
}
.lobby {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.mode {
  padding: 28px;
  background: var(--panel);
}
.mode + .mode {
  border-left: 1px solid var(--line);
}
h2 {
  font-size: 25px;
  letter-spacing: -0.7px;
  margin: 12px 0;
}
.mode p {
  color: var(--muted);
  min-height: 48px;
  max-width: 420px;
}
.actions {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}
label {
  font-size: 11px;
  color: var(--muted);
}
select {
  display: block;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px;
  border-radius: 4px;
  margin-top: 4px;
}
input {
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 4px;
  padding: 12px;
  width: 145px;
}
.join {
  display: flex;
  gap: 5px;
}
.login-card {
  padding: 30px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.login-card p {
  color: var(--muted);
}
.section-head,
.arena-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}
.leaderboard {
  margin-top: 60px;
}
.table-scroll {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  font-variant-numeric: tabular-nums;
}
th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 17px 15px;
  border-bottom: 1px solid #292929;
  font-size: 14px;
}
td:nth-child(3) {
  color: var(--lime);
  font:
    19px ui-monospace,
    monospace;
}
.note {
  font-size: 12px;
  margin: 17px 0;
}
.rules {
  margin: 45px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
  color: var(--muted);
}
summary {
  cursor: pointer;
  color: var(--ink);
  list-style: none;
  display: flex;
  justify-content: space-between;
}
.rules p {
  max-width: 960px;
}
.arena-top {
  margin-bottom: 25px;
}
.arena-top .actions {
  margin: 0;
}
.boards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}
.boards.solo {
  grid-template-columns: minmax(300px, 520px);
  justify-content: center;
}
.player {
  background: var(--panel);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.player.mine {
  border-color: #e8e3b4;
}
.player-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.player h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  overflow-wrap: anywhere;
}
.player-head span {
  color: var(--lime);
  font:
    16px ui-monospace,
    monospace;
}
.play-area {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(80px, 1fr);
  gap: 20px;
}
.well {
  position: relative;
  line-height: 0;
  background: #000000;
  border: 1px solid #777568;
}
canvas {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}
aside {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 8px;
}
aside strong {
  font:
    clamp(20px, 2.4vw, 30px) ui-monospace,
    monospace;
  color: var(--lime);
  margin-bottom: 10px;
}
aside b {
  font:
    24px ui-monospace,
    monospace;
  margin-bottom: 14px;
}
aside canvas {
  margin-bottom: 12px;
  width: 120px;
}
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000d9;
  font-size: 26px;
  line-height: 1.2;
  text-align: center;
  padding: 15px;
  white-space: pre-line;
  color: var(--lime);
}
.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  margin-top: 23px;
  font-size: 12px;
  color: var(--muted);
}
kbd {
  background: #242424;
  padding: 3px 6px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 3px;
}
.sound {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sound input {
  width: auto;
}
.touch-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
}
.touch-controls button {
  touch-action: none;
  user-select: none;
  font-size: 24px;
  padding: 8px 25px;
}
.touch-controls button.pressed {
  background: var(--lime);
  color: var(--bg);
}
#notice {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  background: #e8dfa3;
  color: #111111;
  padding: 15px 25px;
  box-shadow: 0 5px 30px #0008;
  border-radius: 6px;
  z-index: 5;
}
footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 30px 35px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font:
    10px ui-monospace,
    monospace;
  letter-spacing: 1px;
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
body.in-game .intro {
  display: none;
}
body.in-game #arena {
  margin-top: 28px;
}
@media (max-width: 850px) {
  .intro-art {
    margin-right: 30px;
    transform: scale(0.7) rotate(-12deg);
  }
  .lobby {
    grid-template-columns: 1fr;
  }
  .mode + .mode {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .boards {
    gap: 14px;
  }
  .play-area {
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) 75px;
  }
  .player {
    padding: 12px;
  }
  aside strong {
    font-size: 17px;
  }
  aside b {
    font-size: 18px;
    margin-bottom: 5px;
  }
  aside .eyebrow {
    font-size: 9px;
  }
  .arena-top {
    align-items: start;
    flex-direction: column;
  }
}
@media (max-width: 580px) {
  main {
    padding: 0 16px;
  }
  .intro {
    padding: 35px 0;
  }
  .intro-art {
    display: none;
  }
  h1 {
    letter-spacing: -2px;
  }
  .header-right {
    gap: 9px;
  }
  header {
    height: 65px;
    padding: 0 16px;
  }
  .brand {
    font-size: 10px;
    letter-spacing: 1px;
  }
  #username {
    max-width: 80px;
    overflow: hidden;
  }
  .tag {
    display: none;
  }
  .login-card {
    flex-direction: column;
    align-items: start;
  }
  .boards {
    grid-template-columns: 1fr;
  }
  .boards.solo {
    grid-template-columns: 1fr;
  }
  .play-area {
    grid-template-columns: minmax(0, 240px) minmax(75px, 1fr);
  }
  .player:not(.mine) {
    max-width: 270px;
    justify-self: center;
  }
  .player:not(.mine) .play-area {
    grid-template-columns: minmax(0, 130px) 75px;
  }
  .player:not(.mine) aside .eyebrow,
  .player:not(.mine) aside b {
    font-size: 10px;
    margin: 0;
  }
  .player:not(.mine) aside canvas {
    width: 65px;
    margin: 0;
  }
  .player:not(.mine) .player-head {
    margin-bottom: 8px;
  }
  .touch-controls {
    position: sticky;
    bottom: 0;
    background: #000000ed;
    padding: 12px 0;
    z-index: 2;
  }
  .touch-controls button {
    padding: 9px 17px;
  }
  .section-head h2 {
    font-size: 22px;
  }
  footer span:last-child {
    display: none;
  }
  .actions button {
    padding: 11px 13px;
  }
}

.pad-navigation :focus {
  outline: 3px solid var(--lime);
  outline-offset: 4px;
}
dialog {
  max-width: min(90vw, 480px);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--lime);
  border-radius: 8px;
  padding: 26px;
}
dialog::backdrop {
  background: #000a;
}
.touch-controls {
  flex-wrap: wrap;
}
#room-code::selection {
  background: var(--lime);
  color: var(--bg);
}

.control-choice {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.control-choice p {
  flex: 1;
  min-width: 220px;
}

/* Preparation is compact; game and results have separate visual hierarchies. */
body {
  background:
    radial-gradient(ellipse at 80% 0%, #00000055, transparent 55%), var(--bg);
}
.intro {
  padding: 32px 0 24px;
}
h1 {
  font-size: clamp(34px, 4vw, 52px);
  margin: 12px 0;
}
.intro-art {
  transform: scale(0.65) rotate(-12deg);
  height: 170px;
  margin: 0 40px;
}
.lede {
  max-width: 600px;
  margin-bottom: 0;
}
.control-choice {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #151515;
  padding: 16px 20px;
  margin: 16px 0 22px;
}
.control-choice p {
  margin: 0;
  font-size: 13px;
}
.pad-guide {
  font-size: 12px;
  color: var(--muted);
}
.pad-guide summary {
  cursor: pointer;
}
.lobby {
  border: 0;
  gap: 20px;
  align-items: stretch;
}
.mode {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(135deg, #151515, #111111);
  padding: 26px;
}
.mode + .mode {
  border: 1px solid var(--line);
}
.mode h2 {
  margin: 12px 0;
  font-size: 28px;
}
.mode > p {
  min-height: 45px;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
select,
input {
  min-height: 44px;
  max-width: 100%;
  border-radius: 8px;
}
.settings-grid select {
  width: 100%;
}
.actions {
  align-items: end;
}
.mode .actions > label {
  flex: 1;
  min-width: 140px;
}
.mode .actions > .primary {
  flex: 1;
  min-height: 46px;
}
.pace-hint {
  font-size: 12px;
  min-height: 36px;
}
.join {
  width: 100%;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 12px;
}
.join-caption {
  width: 100%;
  color: var(--muted);
  font-size: 12px;
}
.join input {
  flex: 1;
  min-width: 130px;
  width: auto;
}
button {
  transition:
    background 0.15s,
    border-color 0.15s;
}
.primary:hover {
  background: #fff2b8;
}
.match-context {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  font-size: 12px;
  color: var(--muted);
}
.match-context > span {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 6px 12px;
}
#pair-score {
  color: var(--lime);
}
#sync-state.stale {
  color: var(--orange);
}
.arena-top h2 {
  font-size: clamp(20px, 3vw, 30px);
}
.player {
  border-radius: 14px;
}
aside small {
  font-size: 11px;
  color: var(--muted);
  max-width: 110px;
}
.records {
  margin-top: 40px;
}
.record-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 24px;
}
.record-nav [aria-pressed="true"] {
  background: var(--lime);
  color: var(--bg);
}
.record-filters {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 14px 0;
}
.leaderboard {
  margin-top: 0;
}
.rivals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin: 24px 0;
}
.rival-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.rival-card strong {
  display: block;
  font-size: 30px;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
}
.rival-card small {
  display: block;
  color: var(--muted);
}
.match-list {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}
.match-entry {
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.match-entry summary {
  cursor: pointer;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.match-entry summary strong {
  color: var(--lime);
}
.match-entry summary small {
  color: var(--muted);
  margin-left: auto;
}
.match-entry ol {
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
}
body.in-game .records {
  display: none;
}
body.in-game .pad-guide {
  display: none;
}
body.in-game .control-choice {
  padding: 10px 16px;
  margin: 12px 0;
}
#arena:focus {
  outline: none;
}
@media (max-width: 850px) {
  .mode {
    padding: 20px;
  }
  .intro-art {
    margin: 0;
  }
  .settings-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 580px) {
  .intro {
    padding: 24px 0 16px;
  }
  .control-choice {
    gap: 10px;
  }
  .mode h2 {
    font-size: 24px;
  }
  .tag {
    display: inline-block;
    letter-spacing: 0;
    padding: 3px 5px;
    font-size: 9px;
  }
  #connection {
    display: none;
  }
  .record-nav button {
    flex: 1;
  }
  .match-entry summary small {
    width: 100%;
    margin: 0;
  }
  .header-right {
    gap: 7px;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .control-choice label {
    width: 100%;
  }
  body.in-game .control-choice p {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }
}

.intro {
  padding: 18px 0;
}
.intro h1 {
  font-size: clamp(30px, 3.5vw, 42px);
}
.intro-art {
  height: 120px;
}
.intro .lede {
  font-size: 15px;
}


/* Tournament arena: the wells start at the viewport edge, with match actions below. */
:root { --bg:#000; --panel:#0b0b0b; --line:#49483f; --ink:#d7d7ce; --muted:#aaa99c; --lime:#e8dfa3; --orange:#e8b86b; }
body { background:#000; }
button, select, input, .mode, .rival-card, .match-entry, .control-choice, .intro-art { border-radius:2px; }
.intro-art, .mode, .control-choice { background:#0b0b0b; box-shadow:none; }
button.primary { background:#e8dfa3; color:#000; }
body.in-game { overflow:hidden; }
body.in-game header, body.in-game .control-choice, body.in-game footer, body.in-game .rules { display:none; }
body.in-game main { max-width:none; padding:0; margin:0; }
body.in-game #arena { height:100dvh; margin:0; padding:8px 12px; display:flex; flex-direction:column; gap:8px; box-sizing:border-box; }
body.in-game .boards { order:-1; flex:1; min-height:0; display:flex; align-items:flex-start; justify-content:center; gap:24px; width:100%; }
body.in-game .player { --well: min(calc((100dvh - 174px) / 2), calc((100vw - 300px) / 4)); padding:0; border:0; background:#000; border-radius:0; display:flex; flex-direction:column; width:calc(var(--well) + 118px); }
body.in-game .boards.solo .player { --well: min(calc((100dvh - 174px) / 2), calc(100vw - 160px)); }
body.in-game .play-area, body.in-game .player:not(.mine) .play-area { display:grid; grid-template-columns:var(--well) 106px; gap:12px; }
body.in-game .well { width:var(--well); border:2px solid #e8e3b4; border-radius:0; background:#000; box-sizing:content-box; }
body.in-game .well canvas { display:block; width:100%; height:auto; image-rendering:pixelated; }
body.in-game .player-head { order:1; border:2px solid #e8e3b4; padding:6px 10px; margin:8px 0 0; min-height:34px; box-sizing:border-box; }
body.in-game .player-head h3 { font-family:monospace; font-size:14px; text-transform:uppercase; margin:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
body.in-game aside { display:flex; flex-direction:column; gap:3px; padding:6px 0; }
body.in-game aside strong, body.in-game aside b { font-family:monospace; font-weight:900; font-variant-numeric:tabular-nums; color:#d7d7ce; font-size:24px; margin:0 0 12px; letter-spacing:1px; }
body.in-game aside .eyebrow { color:#aaa99c; font-size:10px; }
body.in-game aside canvas { width:100%; margin:0 0 12px; border:1px solid #e8e3b4; image-rendering:pixelated; }
body.in-game aside small { font-size:10px; }
body.in-game .arena-top { margin:0; gap:12px; align-items:center; }
body.in-game .arena-top h2 { font-size:14px; margin:3px 0; }
body.in-game .arena-top .eyebrow { font-size:10px; }
body.in-game .arena-top button { padding:9px 12px; min-height:38px; font-size:12px; }
body.in-game .match-context { margin:0; font-size:11px; gap:12px; }
body.in-game .controls { margin:0; font-size:11px; }
body.in-game .note { display:none; }
body.in-game .overlay { border-radius:0; background:#000b; font-family:monospace; }
body.in-game .touch-controls { margin:0; }
@media (hover:hover) and (pointer:fine) { body.in-game .touch-controls { display:none; } }
@media (max-width:700px) {
 body.in-game #arena { padding:6px; gap:6px; }
 body.in-game .boards { gap:10px; }
 body.in-game .player, body.in-game .boards.solo .player { --well:min(calc((100dvh - 310px) / 2), calc((100vw - 30px) / 2)); width:var(--well); }
 body.in-game .boards.solo .player { --well:min(calc((100dvh - 310px) / 2), calc(100vw - 24px)); }
 body.in-game .play-area, body.in-game .player:not(.mine) .play-area { display:flex; flex-direction:column; gap:6px; }
 body.in-game aside { display:grid; grid-template-columns:1fr 1fr; gap:2px 8px; padding:0; }
 body.in-game aside .eyebrow { font-size:8px; }
 body.in-game aside strong, body.in-game aside b, body.in-game .player:not(.mine) aside b { font-size:14px; margin:0; text-align:right; }
 body.in-game aside canvas { width:52px; height:33px; margin:0 0 0 auto; }
 body.in-game aside small { grid-column:1 / -1; font-size:8px; }
 body.in-game .player-head { margin:6px 0 0; min-height:28px; padding:4px; }
 body.in-game .player-head h3 { font-size:10px; }
 body.in-game .arena-top { flex-wrap:wrap; gap:4px; }
 body.in-game .arena-top .actions { gap:4px; flex-wrap:wrap; }
 body.in-game .arena-top button { min-height:36px; padding:6px; font-size:11px; }
 body.in-game .match-context { font-size:9px; gap:5px; }
 body.in-game #game-control-hint { display:none; }
 body.in-game .controls { position:absolute; right:8px; bottom:8px; }
 body.in-game .touch-controls { padding-right:58px; gap:4px; }
 body.in-game .touch-controls button { min-width:0; height:42px; padding:4px; }
}

@font-face { font-family:Pixel; src:url("./pixel.ttf") format("truetype"); font-display:swap; }
button,select,input { background:#151515; }
body.in-game .match-context span { border-radius:0; }
body.in-game aside strong,body.in-game aside b { font-family:Pixel,monospace; font-size:15px; letter-spacing:0; line-height:1.6; }
body.in-game .player-head h3 { font-family:Pixel,monospace; font-size:9px; line-height:1.6; }
body.in-game .overlay { font-family:Pixel,monospace; font-size:14px; line-height:1.6; }
body.in-game .controls label { display:flex; flex-direction:row; align-items:center; gap:6px; }
body.in-game .controls input { width:auto; }
@media(max-width:700px) {
 body.in-game aside strong,body.in-game aside b,body.in-game .player:not(.mine) aside b { font-size:10px; }
 body.in-game .player-head h3 { font-size:7px; }
 body.in-game .overlay { font-size:9px; }
}

.score-delta { font-family:Pixel,monospace; font-size:11px; line-height:1.6; margin:-8px 0 12px; overflow-wrap:anywhere; }
.score-delta.ahead { color:#649675; }
.score-delta.behind { color:#b56b72; }
.score-delta.tied { color:var(--muted); }
@media(max-width:700px) { .score-delta { grid-column:1 / -1; text-align:right; font-size:8px; margin:0 0 3px; } }

body.in-game .arena-home {
  position:fixed; top:max(12px, env(safe-area-inset-top)); left:max(12px, env(safe-area-inset-left)); z-index:5;
  margin:0; padding:9px 12px; min-height:40px; width:auto;
  background:#101010; border:1px solid #373737; color:#94948c;
  font:12px/1.4 system-ui,sans-serif; border-radius:2px;
}
body.in-game .arena-home:hover { background:#1b1b1b; color:#b5b5ab; border-color:#53534d; }
body.in-game .arena-home:focus-visible { outline:2px solid #aaa58b; outline-offset:3px; }
@media(max-width:700px) {
  body.in-game #arena { padding-top:60px; }
  body.in-game .player { --well:min(calc((100dvh - 364px) / 2), calc((100vw - 30px) / 2)); }
  body.in-game .boards.solo .player { --well:min(calc((100dvh - 364px) / 2), calc(100vw - 24px)); }
}

.name-panel { display:flex; align-items:center; flex-wrap:wrap; gap:12px; margin:20px 0; padding:18px; border:1px solid var(--line); }
.name-panel input { max-width:260px; }
.name-panel small { color:var(--muted); }
body.in-game #name-panel, body.in-game #recent-panel { display:none; }
.recent-panel { margin:32px 0; }
body.in-game .room-name { display:flex; flex-direction:row; justify-content:center; align-items:center; gap:10px; font-size:12px; margin:0; }
body.in-game .room-name input { width:200px; padding:5px 8px; height:30px; }
body.in-game .boards.many { display:flex; gap:12px; }
body.in-game .boards.many .player { --well:min(calc((100dvh - 230px) / 2),calc((100vw - 640px) / 4)); width:calc(var(--well) + 96px); }
body.in-game .well { align-self:start; }
body.in-game .player-head span { flex-shrink:0; white-space:nowrap; }
body.in-game .boards.many aside b,body.in-game .boards.many aside strong { margin-bottom:4px; }
body.in-game .boards.many aside canvas { width:64px; margin-bottom:4px; }
body.in-game .boards.many .overlay { font-size:10px; }
body.in-game .boards.many .play-area { grid-template-columns:var(--well) 84px; gap:12px; }
body.in-game .boards.many aside strong { font-size:11px; }
@media(max-width:1000px) {
 body.in-game .boards.many { display:grid; grid-template-columns:1fr 1fr; gap:8px 20px; align-content:start; width:auto; margin:auto; }
 body.in-game .boards.many .player { --well:min(calc((100dvh - 290px) / 4),calc((100vw - 240px) / 4)); width:calc(var(--well) + 90px); }
 body.in-game .boards.many .play-area, body.in-game .boards.many .player:not(.mine) .play-area { display:grid; grid-template-columns:var(--well) 78px; gap:12px; }
 body.in-game .boards.many aside { display:flex; gap:1px; padding:0; }
 body.in-game .boards.many aside b,body.in-game .boards.many aside strong { font-size:9px; margin:0; }
 body.in-game .boards.many aside .eyebrow { font-size:7px; }
 body.in-game .boards.many aside canvas { width:44px; height:28px; margin:0; }
 body.in-game .boards.many aside small { display:none; }
 body.in-game .boards.many .player-head { min-height:22px; padding:2px; margin-top:3px; }
 body.in-game .boards.many .player-head h3 { font-size:6px; }
 body.in-game .boards.many .score-delta { font-size:7px; margin:0; }
}
