:root {
  color-scheme: dark;
  --page: #171915;
  --panel: #20221e;
  --panel-border: #30322c;
  --text: #eeeae0;
  --muted: #898b80;
  --lime: #d7ed9b;
  --wood: #b27846;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 42% 33%, rgba(86, 91, 65, .12), transparent 49%),
    var(--page);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

button, a { font: inherit; }
button { color: inherit; }

.app {
  width: min(1240px, calc(100% - 64px));
  margin: 0 auto;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(238, 234, 224, .09);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.8px;
}

.brand-mark {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background: var(--lime);
  color: #24271e;
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 600;
}

.brand-period, .heading-period { color: var(--lime); }
.top-note, .footer { color: var(--muted); font-size: 12px; }
.top-note { display: flex; align-items: center; gap: 9px; }
.live-dot, .status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 278px;
  gap: clamp(24px, 5vw, 66px);
  align-items: start;
  padding: 48px 0 42px;
}

.heading-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 25px;
}

.eyebrow, .player-colour, .queen-state, .board-hint, .footer span:last-child {
  font-family: Consolas, "Courier New", monospace;
  font-size: 9px;
  letter-spacing: 1.45px;
}
.eyebrow { margin: 0 0 10px; color: #a7ae91; }
h1 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(30px, 4vw, 43px);
  font-weight: 500;
  letter-spacing: -.8px;
  line-height: 1.05;
}

.new-game-button {
  border: 1px solid #393b34;
  border-radius: 5px;
  background: transparent;
  padding: 10px 13px;
  color: #d3d1c7;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.new-game-button:hover, .mode-button:hover { background: #2a2d26; border-color: #535747; }
.new-game-button span { margin-right: 5px; font-size: 16px; vertical-align: -1px; }

.scoreboard {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 13px;
}

.player-card {
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
  gap: 11px;
  padding: 11px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--panel);
  opacity: .58;
  transition: opacity .2s, border-color .2s;
}
.player-card.is-active { border-color: #69734d; opacity: 1; }
.player-dot { flex: 0 0 auto; width: 13px; height: 13px; border-radius: 50%; }
.white-dot { background: #ece9dc; box-shadow: inset -2px -2px 3px #bab7aa; }
.black-dot { background: #33352f; border: 1px solid #77796f; }
.player-info { display: grid; gap: 3px; min-width: 0; }
.player-name { overflow: hidden; color: #e6e3d9; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.player-colour { color: #808277; font-size: 8px; letter-spacing: 1px; }
.player-score { margin-left: auto; font-size: 18px; font-weight: 500; }
.versus { color: #6d7065; font-family: Consolas, "Courier New", monospace; font-size: 9px; }

.board-shell {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(243, 217, 171, .18);
  border-radius: 7px;
  background: #4a2d1f;
  box-shadow: 0 17px 45px rgba(0, 0, 0, .35), 0 2px 8px rgba(0, 0, 0, .3);
  touch-action: none;
  user-select: none;
}

#board { display: block; width: 100%; aspect-ratio: 1; cursor: crosshair; }
.board-hint {
  position: absolute;
  bottom: 13px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(57, 48, 34, .67);
  font-size: 7px;
  letter-spacing: 1.2px;
  pointer-events: none;
  white-space: nowrap;
}

.game-status {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #c5c6b8;
  font-size: 12px;
}
.status-message { display: flex; min-width: 0; align-items: center; gap: 10px; }
.status-message #status { line-height: 1.5; }
.status-indicator { width: 6px; height: 6px; flex: 0 0 auto; }
.status-indicator.is-muted { background: #77796f; }
.power-meter { flex: 0 0 150px; }
.power-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: #8d907e;
  font-family: Consolas, "Courier New", monospace;
  font-size: 8px;
  letter-spacing: .8px;
}
.power-labels strong { color: var(--lime); font-size: 9px; font-weight: 500; }
.power-track { height: 5px; overflow: hidden; border-radius: 5px; background: #34372f; }
.power-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a4b67a, #d7ed9b);
  transition: width 50ms linear;
}

.side-panel {
  margin-top: 89px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  background: rgba(32, 34, 30, .78);
}
.panel-section { padding: 21px 20px; border-bottom: 1px solid var(--panel-border); }
.section-title { display: flex; align-items: center; gap: 9px; }
.section-icon { color: var(--lime); font-size: 15px; }
h2 { margin: 0; color: #e7e5dc; font-size: 13px; font-weight: 600; }
.turn-copy {
  margin: 14px 0 17px;
  color: #a9aa9f;
  font-size: 12px;
  line-height: 1.65;
}
.queen-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 13px;
  border-top: 1px solid #34362f;
  color: #c6c5ba;
  font-size: 11px;
}
.queen-dot { width: 9px; height: 9px; border-radius: 50%; background: #ae4c43; box-shadow: inset -1px -1px 2px #642b26; }
.queen-state { margin-left: auto; color: #8d907e; font-size: 7px; letter-spacing: .8px; }
.how-to { padding-bottom: 20px; }
.how-to ol { display: grid; gap: 14px; margin: 17px 0 0; padding: 0; list-style: none; }
.how-to li { display: grid; grid-template-columns: 24px 1fr; gap: 7px; color: #a5a69c; font-size: 11px; line-height: 1.55; }
.how-to li span { color: #a6b27f; font-family: Consolas, "Courier New", monospace; font-size: 9px; padding-top: 1px; }
.rules-section p { margin: 13px 0 0; color: #989a90; font-size: 10px; line-height: 1.7; }
.rules-section p.match-note { color: #707368; font-size: 9px; }

.mode-button {
  display: flex;
  width: calc(100% - 32px);
  align-items: center;
  gap: 9px;
  margin: 16px;
  padding: 11px 12px;
  border: 1px solid #3b3e34;
  border-radius: 5px;
  background: #252820;
  color: #d8d8ca;
  text-align: left;
  font-size: 11px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.mode-icon { color: var(--lime); font-size: 13px; }
.mode-arrow { margin-left: auto; color: #a5ae8a; }
.mode-caption { margin: -9px 16px 14px; color: #76786e; font-size: 9px; }
.footer {
  display: flex;
  justify-content: space-between;
  padding: 14px 0 24px;
  border-top: 1px solid rgba(238, 234, 224, .08);
  font-size: 10px;
}
.footer span:last-child { color: #707268; font-size: 8px; }

@media (max-width: 880px) {
  .app { width: min(700px, calc(100% - 36px)); }
  .game-layout { grid-template-columns: 1fr; gap: 10px; padding-top: 34px; }
  .side-panel { margin-top: 0; }
}

@media (max-width: 480px) {
  .app { width: calc(100% - 24px); }
  .topbar { height: 58px; }
  .top-note { font-size: 10px; }
  .game-layout { padding-top: 26px; }
  .heading-row { align-items: start; margin-bottom: 19px; }
  h1 { font-size: 30px; }
  .new-game-button { padding: 8px 9px; font-size: 10px; }
  .scoreboard { gap: 8px; }
  .player-card { gap: 7px; padding: 10px 9px; }
  .player-name { font-size: 10px; }
  .board-hint { bottom: 8px; font-size: 6px; }
  .game-status { align-items: stretch; flex-direction: column; gap: 8px; padding: 8px 0 12px; }
  .status-message { min-height: 28px; }
  .power-meter { flex-basis: auto; width: 100%; }
  .side-panel { margin-bottom: 6px; }
  .footer { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
