/* Theme tokens and the warm wood / green felt games-room palette. */
:root {
  color-scheme: light;
  --accent: #166534;
  --accent-ink: #fffaf0;
  --bg: #f5f1e8;
  --surface: #fffdf6;
  --surface-2: #ebe5d7;
  --ink: #202d24;
  --ink-2: #6b7066;
  --font-display: Georgia, 'Times New Roman', serif;
  --radius: 18px;
  --max: 1140px;
  --shadow: 0 2px 3px #38291508, 0 8px 28px #38291508;
}
body {
  background: radial-gradient(ellipse at top right, #dfebd7, transparent 65%), var(--bg);
}
.app-header {
  background: #fffdf6db;
}
.brand {
  font-family: var(--font-display);
  letter-spacing: -0.4px;
}
.app-main {
  padding-bottom: 24px;
}
.eyebrow {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--accent);
}
/* Home screen and game cards. */
.welcome {
  padding: 8px 0 16px;
  margin: 0;
  font: 20px var(--font-display);
}
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.game-tile {
  background: var(--surface);
  border: 1px solid #d9d4c6;
  border-radius: 20px;
  padding: 0;
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.tile-art {
  height: 145px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 100px Georgia;
  color: #fff4da;
  text-shadow: 1px 5px 0 #0002;
  background-color: #826243;
  background-image: repeating-conic-gradient(#eedcb6 0% 25%, #8c6948 0% 50%);
  background-size: 64px 64px;
}
.tile-art.chess {
  color: #26392d;
}
.tile-art.checkers {
  color: #652f20;
  text-shadow:
    0 6px #3c1f14,
    0 10px 0 #ffffff60;
}
.tile-art.pool {
  background: #166534;
  font-size: 102px;
}
.tile-copy {
  padding: 20px 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.tile-copy strong {
  font: 30px var(--font-display);
}
.tile-copy span {
  font-size: 14px;
}
.tile-copy small {
  color: var(--ink-2);
  font-size: 12px;
}
.tile-bottom {
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 12px 22px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}
.room-note {
  margin-top: 22px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.8;
}
/* Shared play layout. */
.table-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.table-heading .btn {
  padding-left: 0;
}
.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 28px;
}
.game-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}
.game-heading h2 {
  font-size: 28px;
  margin: 0;
}
.status {
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  text-align: right;
}
/* Chess and checkers board. */
.board-frame {
  padding: 12px;
  background: #805b39;
  border-radius: 12px;
  box-shadow:
    inset 0 0 0 3px #503720,
    0 10px 28px #3e2b1c24;
  width: min(100%, calc(100dvh - 252px));
  margin: auto;
}
.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  aspect-ratio: 1;
  touch-action: none;
  user-select: none;
}
.square {
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  aspect-ratio: 1;
  cursor: pointer;
  touch-action: none;
}
.square.light {
  background: #eee2c5;
}
.square.dark {
  background: #9b7957;
}
.square.selected {
  background: #7b9d50;
}
.square.last {
  box-shadow: inset 0 0 0 4px #e6c95888;
}
.square.check {
  background: #c96750;
}
.piece {
  font-family: 'DejaVu Sans', 'Segoe UI Symbol', serif;
  font-size: clamp(24px, 5.4vw, 51px);
  line-height: 1;
  z-index: 1;
  pointer-events: none;
}
.piece.w {
  color: #fffcf0;
  text-shadow:
    0 1px 1px #302c25,
    1px 0 1px #302c25,
    -1px 0 1px #302c25;
}
.piece.b {
  color: #23382b;
  text-shadow: 0 1px #fff8;
}
.file,
.rank {
  position: absolute;
  font: 10px var(--font);
  opacity: 0.7;
}
.file {
  right: 3px;
  bottom: 0;
}
.rank {
  left: 3px;
  top: 0;
}
.legal-dot {
  position: absolute;
  width: 24%;
  height: 24%;
  background: #214d3c66;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
}
.legal-dot.capture {
  width: 85%;
  height: 85%;
  background: none;
  border: 4px solid #214d3c99;
}
.checker {
  width: 72%;
  height: 72%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow:
    inset 0 0 0 4px #fff3,
    0 3px 0 #0007;
  pointer-events: none;
}
.checker.w {
  background: #fff0cb;
  color: #805b39;
}
.checker.b {
  background: #382c23;
  color: #f4ddb0;
}
/* Controls and move book. */
.actions {
  justify-content: center;
  margin-top: 14px;
  gap: 6px;
}
.actions .btn {
  padding: 0 14px;
  font-size: 13px;
}
.scorecard {
  box-shadow: none;
  border: 1px solid var(--line);
  align-self: start;
}
.scorecard h3 {
  margin-top: 10px;
}
.captured {
  font-size: 26px;
  min-height: 105px;
}
.captured b {
  display: block;
  font: 11px var(--font);
  color: var(--ink-2);
  margin-top: 8px;
}
.captured div {
  min-height: 28px;
  line-height: 1.15;
}
.log-title {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.move-list {
  max-height: 220px;
  overflow: auto;
  padding-left: 30px;
  font-size: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 22px;
  font-family: var(--font-mono);
}
.empty-log {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--ink-2);
  padding: 16px 0;
}
.saved {
  margin: 16px 0 0;
  color: var(--accent);
}
/* Pool canvas and aiming controls. */
.pool-wrap {
  border: 14px solid #805b39;
  border-radius: 20px;
  box-shadow: inset 0 0 0 3px #51351c;
  overflow: hidden;
  margin-top: 35px;
}
canvas {
  width: 100%;
  touch-action: none;
}
.pool-controls {
  display: flex;
  gap: 18px;
  align-items: center;
  margin: 16px 0;
}
.pool-controls label {
  display: flex;
  gap: 15px;
  flex: 1;
  font-size: 13px;
  align-items: center;
}
.pool-controls input {
  width: 100%;
}
.pool-message {
  min-height: 25px;
}
.sheet-body .btn {
  margin: 5px;
}
.scorecard .notice {
  font-size: 13px;
}
/* Tablet and phone layouts. */
@media (max-width: 720px) {
  .tiles {
    gap: 10px;
  }
  .tile-art {
    height: 110px;
    font-size: 75px;
  }
  .tile-copy {
    padding: 14px;
  }
  .tile-copy strong {
    font-size: 25px;
  }
  .tile-copy span {
    font-size: 12px;
  }
  .tile-copy small {
    display: none;
  }
  .tile-bottom {
    padding: 12px;
    font-size: 12px;
  }
  .play-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .scorecard {
    display: none;
  }
  .board-frame {
    width: min(100%, calc(100dvh - 238px));
  }
  .piece {
    font-size: clamp(24px, 9vw, 48px);
  }
  .game-heading h2 {
    font-size: 25px;
  }
  .pool-wrap {
    margin-top: 18px;
  }
  .play-surface {
    min-width: 0;
  }
  .welcome {
    padding-top: 14px;
  }
}
/* Narrow phone layout. */
@media (max-width: 440px) {
  .tiles {
    grid-template-columns: 1fr;
  }
  .game-tile {
    display: grid;
    grid-template-columns: 90px 1fr;
  }
  .tile-art {
    height: 110px;
    grid-row: 1/3;
    font-size: 70px;
    background-size: 44px 44px;
  }
  .tile-copy {
    padding: 12px 16px 0;
  }
  .tile-copy strong {
    font-size: 25px;
  }
  .tile-bottom {
    border: 0;
    padding: 4px 16px 12px;
  }
  .room-note {
    font-size: 11px;
  }
  .table-heading .badge {
    font-size: 11px;
  }
  .table-heading .btn {
    font-size: 13px;
  }
  .app-main {
    padding: 12px;
  }
  .game-heading {
    margin-bottom: 10px;
  }
  .board-frame {
    padding: 8px;
  }
  .actions .btn {
    padding: 0 10px;
    font-size: 12px;
  }
  .actions {
    gap: 4px;
  }
  .square.last {
    box-shadow: inset 0 0 0 3px #e6c95888;
  }
  .pool-wrap {
    border-width: 10px;
  }
  .status {
    font-size: 12px;
  }
  .pool-controls {
    gap: 10px;
  }
}
/* Short landscape screens. */
@media (max-height: 500px) and (min-width: 721px) {
  .board-frame {
    width: calc(100dvh - 190px);
  }
  .app-header {
    padding: 4px 16px;
  }
  .table-heading {
    margin: 0;
  }
  .game-heading {
    margin-bottom: 5px;
  }
  .actions {
    margin-top: 6px;
  }
  .scorecard {
    max-height: 70dvh;
    overflow: auto;
  }
  .piece {
    font-size: 30px;
  }
}

/* Move book shortcut on smaller screens. */
.phone-only {
  display: none;
}
@media (max-width: 720px) {
  .phone-only {
    display: inline-flex;
  }
}

/* A compact, descriptive player picker anchored to the bottom edge. */
dialog.players-sheet {
  margin: auto auto 0;
  width: min(100%, 540px);
  border-radius: 24px 24px 0 0;
}
.picker-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.picker-heading h2 {
  margin: 5px 0 0;
  font-size: 28px;
}
.picker-close {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 28px;
  cursor: pointer;
}
.player-options {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg);
}
.player-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 78px;
  padding: 15px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.player-option:last-child {
  border-bottom: 0;
}
.player-option[aria-checked='true'] {
  background: #1665340d;
}
.player-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}
.option-copy {
  display: grid;
  gap: 5px;
}
.option-copy strong {
  font-size: 16px;
  font-weight: 650;
}
.option-copy > span {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.4;
}
.choice-check {
  width: 22px;
  flex-shrink: 0;
  color: var(--accent);
  font-size: 22px;
}
.picker-note {
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.5;
  margin: 16px 0 0;
}
.picker-actions {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}
