/* ==========================================================================
   Snake Eyes Backgammon — design tokens
   Garnet (deep wine-red) + brass/gold, "leather case" identity shared with
   the DOUBLE OR DIE companion book. Dark, high-contrast, real material
   weight — not a flat parlor-game board.
   ========================================================================== */

:root {
  /* -- neutrals / void -- */
  --void: #0b0708;
  --void-soft: #130c0d;
  --panel: #1a1214;
  --panel-raised: #221618;
  --panel-line: #3a262a;
  --panel-line-soft: #2a1c1f;

  /* -- garnet family -- */
  --garnet-950: #240810;
  --garnet-900: #380f18;
  --garnet-800: #4c1420;
  --garnet-700: #631a28;
  --garnet-600: #7f2231;
  --garnet-500: #9c2c3c;
  --garnet-glow: #d4475a;

  /* -- brass family -- */
  --brass-900: #4a3814;
  --brass-700: #7d5e24;
  --brass-500: #c19a44;
  --brass-400: #d6b262;
  --brass-300: #e8cb85;
  --brass-100: #f5e6bd;

  /* -- checkers / wood -- */
  --bone: #efe4d0;
  --bone-dim: #c9bda6;
  --ink: #141010;
  --ink-rim: #050403;
  --walnut-dark: #2a1509;
  --walnut-mid: #3d2010;

  /* -- text -- */
  --text-primary: #f2e9db;
  --text-muted: #a89c8b;
  --text-faint: #7d7166;

  /* -- semantic -- */
  --danger: #c0394a;
  --success: #6f9c6e;

  /* -- last-move highlight: a bright cyan, deliberately unlike anything
     else on the board (garnet/brass are both spoken for), so a bot's move
     is unmissable even at speed -- */
  --move-glow: #35e0e0;
  --move-glow-soft: #35e0e070;

  /* -- type -- */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Archivo', system-ui, -apple-system, sans-serif;

  /* -- shape -- */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }

/* Guard against author display:flex/block rules (below) beating the UA's
   [hidden]{display:none} on specificity/source-order - every screen state
   in this app is toggled via the `hidden` attribute, so it must always win. */
[hidden] { display: none !important; }

::selection { background: var(--brass-500); color: var(--ink); }

html, body {
  height: 100%;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(ellipse 1200px 700px at 50% -10%, #23121455 0%, transparent 60%),
    var(--void);
  color: var(--text-primary);
  margin: 0;
  padding: 20px clamp(14px, 3vw, 36px) 48px;
  min-height: 100%;
}

/* ==========================================================================
   Header / brand
   ========================================================================== */

.site-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 1180px;
  margin: 0 auto 18px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--brass-700);
  position: sticky;
  top: 0;
  z-index: 65;
  background: var(--void);
}

.exit-game-btn {
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.exit-game-btn:hover { color: var(--text-primary); border-color: var(--brass-700); }

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s ease;
}
.brand:hover { opacity: 0.82; }

.brand-mark {
  display: inline-block;
  vertical-align: middle;
  transform: translateY(-1px);
}

.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: 0.01em;
  color: var(--text-primary);
  line-height: 1;
  display: flex;
  flex-direction: column;
}

.brand-sub {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--brass-400);
  margin-top: 4px;
}

/* -- live stats ticker: real numbers only (see server/routes/stats.js) -
   playersOnline/activeMatches come straight from Colyseus's own room
   registry, gamesCompleted from an all-time counter incremented whenever a
   match actually ends. Never a placeholder or estimated figure. -- */

.site-ticker {
  max-width: 1180px;
  margin: 0 auto 18px;
  overflow: hidden;
  background: #fbf8f3;
  border-radius: var(--radius-sm);
  padding: 0 4px;
}

.site-ticker-track {
  display: flex;
  align-items: center;
  width: max-content;
  animation: ticker-scroll 32s linear infinite;
}

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.site-ticker:hover .site-ticker-track {
  animation-play-state: paused;
}

.site-ticker-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.site-ticker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px 1px #6f9c6e80;
  flex: none;
}

.site-ticker-item strong {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--brass-100);
  background: linear-gradient(160deg, var(--garnet-600), var(--garnet-800));
  border-radius: 999px;
  padding: 1px 9px;
  box-shadow: 0 1px 0 #ffffff20 inset;
}

.site-ticker-sep {
  padding: 0 22px;
  color: var(--bone-dim);
}

/* Three-way "H2H + Bot = Total" breakdown (per Sir's "totally transparent"
   direction) - same pill-badge look as the plain .site-ticker-item strong
   numbers above, just three of them per stat with a plain-text operator
   between. */
.site-ticker-breakdown-op {
  color: var(--bone-dim);
  font-weight: 600;
}

.site-ticker-recent .ticker-recent-text {
  font-weight: 600;
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  .site-ticker-track { animation: none; }
  .site-ticker { overflow-x: auto; }
}

.status {
  min-height: 20px;
  color: var(--brass-300);
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  max-width: 480px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--text-faint);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-nav a:hover,
.site-nav a.site-nav-current {
  color: var(--brass-300);
  border-color: var(--brass-500);
}

.site-nav-book {
  color: var(--brass-400) !important;
}
.site-nav-book:hover {
  color: var(--brass-100) !important;
}

.nav-bruce { display: none; }

@media (max-width: 640px) {
  .site-nav { gap: 14px; order: 3; width: 100%; justify-content: center; }
}

/* -- desktop: a fixed left sidebar instead of a top row. Plain CSS position
   flips this from "third item in the header row" to "docked to the
   viewport" - no markup change needed, since position:fixed escapes the
   header's max-width/margin:auto container entirely. -- */

@media (min-width: 901px) {
  body { padding-left: 196px; }

  .site-nav {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 20;
    width: 196px;
    height: 100vh;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    padding: 84px 16px 24px;
    background: #fbf8f3;
    border-right: 1px solid var(--panel-line);
  }

  .site-nav a {
    padding: 12px 12px;
    border-radius: var(--radius-sm);
    border-bottom: none;
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
  }

  .site-nav a:hover,
  .site-nav a.site-nav-current {
    background: var(--void);
    color: var(--brass-300);
    border-color: transparent;
  }

  .site-nav-book {
    color: var(--garnet-700) !important;
  }
  .site-nav-book:hover {
    color: var(--brass-300) !important;
  }

  /* Bruce, peeking out of the bottom of the sidebar - deliberately bleeds
     past the sidebar's right edge into the page rather than sitting boxed
     inside it. Hidden below the sidebar breakpoint since the nav becomes a
     horizontal top row there and has no room for him. */
  .nav-bruce {
    display: block;
    width: 210px;
    height: auto;
    margin: 14px -30px 0 auto;
    filter: drop-shadow(0 10px 20px #00000090);
    pointer-events: none;
  }

  /* Hover/focus flyouts for Play and Field Notes - a real link list, not a
     decorative tooltip, so keyboard users get it too via :focus-within. */
  .site-nav-item { position: relative; }

  /* The trigger link is a normal inline <a>, not a direct flex child like
     the plain sidebar links (blockified automatically by the flex
     container) - without this it sizes to its line-height only, while its
     own padding still paints past that box, overlapping the next item. */
  .site-nav-item > a { display: block; }

  .site-nav-flyout {
    display: none;
    flex-direction: column;
    gap: 1px;
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 6px;
    min-width: 230px;
    max-width: 300px;
    background: linear-gradient(160deg, var(--panel-raised), var(--panel));
    border: 1px solid var(--panel-line);
    border-radius: var(--radius-sm);
    padding: 8px;
    box-shadow: 0 10px 24px -14px #000000a0;
    z-index: 30;
  }

  .site-nav-item:hover .site-nav-flyout,
  .site-nav-item:focus-within .site-nav-flyout {
    display: flex;
  }

  .site-nav-flyout a {
    padding: 8px 10px;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.35;
    white-space: normal;
    color: var(--text-muted);
    background: none;
  }

  .site-nav-flyout a:hover {
    color: var(--brass-100);
    background: var(--void-soft);
  }
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding-top: clamp(24px, 5vh, 56px);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(24px, 5vw, 64px);
}

.hero-eyebrow { text-align: left; }

.hero-headline {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(40px, 6.4vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
  color: var(--text-primary);
}

.hero-headline-line1 {
  position: relative;
}

.hero-headline-dice {
  position: absolute;
  top: 4px;
  left: calc(100% + 22px);
  width: 130px;
  height: auto;
  transform: rotate(-43deg);
}

.hero-headline-accent {
  color: var(--garnet-glow);
  text-shadow: 0 0 34px #d4475a55;
}

.hero-sub {
  color: var(--text-muted);
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.55;
  max-width: 46ch;
  margin: 0 0 30px;
}

.hero-cta-row {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.hero-cta {
  width: auto;
  padding: 15px 30px;
  font-size: 15px;
  letter-spacing: 0.02em;
}


/* -- hero modes list: same numbered format as .notes-preview-item in the
   Field Notes showcase card, so the two lists read as one house style. -- */

/* Two columns instead of one long stacked list - same six items, half the
   vertical footprint, freeing up the space below for whatever goes there
   next. */
.hero-modes-list {
  margin-top: 14px;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 16px;
  background: linear-gradient(160deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--brass-700);
  border-radius: var(--radius-lg);
  padding: 4px 16px;
  box-shadow: 0 1px 0 #ffffff08 inset, 0 10px 24px -14px #000000a0;
}

.hero-modes-col {
  display: flex;
  flex-direction: column;
}

.hero-modes-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--panel-line-soft);
  text-decoration: none;
  color: var(--text-primary);
  transition: color 0.15s ease;
}
.hero-modes-col > .hero-modes-item:last-child,
.hero-modes-col > .hero-modes-group:last-child .hero-modes-item-grouped:last-child {
  border-bottom: none;
}
.hero-modes-item:hover { color: var(--brass-300); }
.hero-modes-item:hover .hero-modes-sub { color: var(--brass-100); }

/* Invite/Join a Friend share a single "02" - one gold-bordered box, same
   treatment as the matched pair further down the page in Choose Your
   Table, since they're two ends of the same feature. */
.hero-modes-group {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 9px 4px 9px 0;
}

.hero-modes-group-num {
  margin-left: 4px;
}

.hero-modes-group-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--brass-700);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.hero-modes-item-grouped {
  padding: 7px 8px;
  border-bottom: 1px solid var(--panel-line-soft);
}
.hero-modes-item-grouped:last-child { border-bottom: none; }

.hero-modes-num {
  flex: none;
  width: 13px;
  height: 13px;
  margin-top: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, var(--brass-100), var(--brass-500) 55%, var(--brass-900) 100%);
  box-shadow: 0 1px 2px #00000070, inset 0 1px 1px #ffffff70;
}

.hero-modes-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.hero-modes-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}

.hero-modes-sub {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .hero-modes-list { max-width: none; margin-left: auto; margin-right: auto; }
  .hero-modes-item { justify-content: center; }
}

/* -- hero visual: a static mid-game board built from the same board
   classes as the live game view (board-frame, row/quad/bar/point,
   checker-stack/checker), scaled down and re-scoped so nothing here can
   ever collide with the interactive board's ids. -- */

.hero-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 12px;
}

.hero-visual::before {
  content: "";
  position: absolute;
  inset: -10%;
  background: radial-gradient(ellipse 60% 55% at 50% 45%, #7f223140 0%, transparent 72%);
  pointer-events: none;
  z-index: -1;
}

.hero-board-frame {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hero-board-frame .off-tray-wrap {
  width: 26px;
}
.hero-board-frame .off-tray {
  min-height: 132px;
  padding: 5px 0;
}
.hero-board-frame .off-tray .checker {
  width: 13px;
  height: 13px;
}

.board-mock {
  background:
    radial-gradient(ellipse at 50% 0%, #3a2011 0%, transparent 70%),
    var(--walnut-dark);
  border: 5px solid var(--garnet-950);
  border-radius: var(--radius-sm);
  width: 420px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px #00000080, inset 0 2px 10px #00000090;
}

.board-mock .row { height: 132px; }
.board-mock .bar { width: 20px; }
.board-mock .checker { width: 16px; height: 16px; }
.board-mock .checker::after { inset: 2px; }
.board-mock .point-label { font-size: 7px; }
.board-mock .checker-count { font-size: 8px; padding: 0 4px; }
.board-mock .checker-stack { gap: 2px; }

/* -- hero video: real competition footage, right under the board mock.
   Starts muted+looping (browsers block unmuted autoplay outright - there
   is no reliable way around this), one click hands it real sound via the
   YouTube postMessage API since a click is a genuine user gesture. -- */

.hero-video {
  width: 510px;
  max-width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--panel-line);
  box-shadow: 0 10px 24px -14px #000000a0;
  background: var(--panel);
}

.hero-video-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.hero-video-frame-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.hero-video-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-top: 1px solid var(--panel-line);
}

.hero-video-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass-400);
}

.hero-video-unmute {
  flex: none;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--brass-100);
  background: #050303d0;
  border: 1px solid var(--brass-700);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.hero-video-unmute:hover { border-color: var(--brass-400); }
.hero-video-unmute:disabled {
  opacity: 0.65;
  cursor: default;
}

.hero-cube-float {
  position: absolute;
  right: -6px;
  bottom: -14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transform: rotate(-6deg);
  filter: drop-shadow(0 14px 22px #000000a0);
}
.hero-cube-float .cube-object {
  width: 58px;
  height: 58px;
  margin: 0;
}
.hero-cube-caption {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-300);
  background: #050303c0;
  border: 1px solid var(--panel-line);
  border-radius: 999px;
  padding: 3px 9px;
}

/* the borne-off checker tray, relocated under the cube so the game
   pieces sit below the die instead of out in the board row. */
.hero-cube-float .off-tray-wrap {
  width: auto;
}
.hero-cube-float .off-tray {
  min-height: auto;
  padding: 0;
  display: flex;
  gap: 3px;
}
.hero-cube-float .off-tray .checker {
  width: 13px;
  height: 13px;
}

/* -- hero chat/voice float: same floating-card language as the cube,
   opposite corner, showing a live text exchange plus a mic/voice cue. -- */

/* the "Live Voice & Text" label stands alone, sitting in the existing gap
   above the board frame - it never touches the board's own layout box, so
   the board never has to shift to make room for it. */
.hero-chat-label {
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 10px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  filter: drop-shadow(0 10px 18px #000000a0);
}

.hero-chat-float {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  max-width: 460px;
  filter: drop-shadow(0 18px 28px #000000b0);
}

.chat-float-mic {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 44px;
}
.mic-bar {
  width: 9px;
  border-radius: 4px;
  background: var(--brass-400);
  animation: mic-bounce 1.1s ease-in-out infinite;
}
.mic-bar:nth-child(1) { height: 19px; animation-delay: 0s; }
.mic-bar:nth-child(2) { height: 44px; animation-delay: 0.15s; }
.mic-bar:nth-child(3) { height: 28px; animation-delay: 0.3s; }

@keyframes mic-bounce {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}

.hero-chat-caption {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brass-300);
}

.chat-float-bubbles {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.chat-float-bubble {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  padding: 8px 13px;
  border-radius: 14px;
  background: #050303c0;
  border: 1.5px solid var(--brass-500);
  color: var(--text-muted);
  box-shadow: 0 1px 0 #ffffff08 inset;
}
.chat-float-bubble-you {
  color: var(--brass-100);
  border-color: var(--brass-700);
  background: #1a1214c0;
}

@media (prefers-reduced-motion: reduce) {
  .mic-bar { animation: none; }
}

/* -- value row -- */

.hero-values {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 1180px;
  margin: clamp(48px, 8vh, 84px) auto 0;
  padding: 28px 32px;
  background: linear-gradient(160deg, var(--brass-400), var(--brass-700));
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 0 #ffffff50 inset, 0 10px 26px -14px #000000a0;
}

.hero-value {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hero-value-icon {
  font-size: 20px;
  color: var(--void);
  margin-bottom: 2px;
}

.hero-value h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  margin: 0;
  color: var(--void);
}

.hero-value p {
  font-size: 13px;
  color: var(--walnut-dark);
  line-height: 1.5;
  margin: 0;
}

.hero-value-link {
  font-weight: 700;
  color: var(--void);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.hero-value-link:hover { color: var(--garnet-glow); }

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-copy { text-align: center; }
  .hero-eyebrow { text-align: center; }
  .hero-sub { margin-left: auto; margin-right: auto; }
  .hero-cta-row { justify-content: center; }
  .hero-visual { margin-top: 8px; }
  .hero-values { grid-template-columns: repeat(2, 1fr); }
  .showcase-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .hero-values { grid-template-columns: 1fr; }
  .board-mock { width: 300px; }
  .board-mock .row { height: 100px; }
  .board-mock .checker { width: 12px; height: 12px; }
  .hero-board-frame { flex-wrap: wrap; justify-content: center; }
  .hero-chat-float {
    position: static;
    order: -1;
    width: 100%;
    max-width: none;
    align-items: center;
    text-align: center;
    transform: none;
    margin: 0 0 14px;
    filter: none;
  }
  .chat-float-bubble-you { align-self: center; }
  .chat-float-bubble { align-self: center; }
  .hero-video { width: 300px; }
  .showcase-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Showcase — the book, Field Notes, Watch, and Bruce, given real visual
   weight instead of being buried as footer links. Same card language as
   .mode-card, reused rather than reinvented.
   ========================================================================== */

.showcase {
  max-width: 1180px;
  margin: clamp(48px, 8vh, 84px) auto 0;
  padding-top: 28px;
  border-top: 1px solid var(--panel-line);
}

.showcase-intro {
  text-align: center;
  margin-bottom: 28px;
}

.showcase-intro h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(26px, 4vw, 38px);
  margin: 0 0 12px;
  color: var(--text-primary);
}

.showcase-lede {
  color: var(--text-muted);
  font-size: 14.5px;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.55;
}

.showcase-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: start;
}

.showcase-card {
  display: flex;
  flex-direction: column-reverse;
  background: linear-gradient(160deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  box-shadow: 0 1px 0 #ffffff08 inset, 0 10px 24px -14px #000000a0;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.showcase-card:hover,
.showcase-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--brass-700);
  box-shadow: 0 1px 0 #ffffff10 inset, 0 16px 30px -14px #000000c0;
  outline: none;
}

.showcase-card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.showcase-card-tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-400);
}

.showcase-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  margin: 0;
  color: var(--text-primary);
}

.showcase-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* -- book cover -- */

.book-cover-img {
  display: block;
  width: 50%;
  height: auto;
  margin: 0 auto;
  padding: 6px;
  box-sizing: border-box;
  background: radial-gradient(ellipse at 50% 0%, var(--garnet-700), var(--garnet-950) 75%);
  border-top: 1px solid var(--panel-line);
}

/* -- Field Notes preview -- */

.notes-preview {
  min-height: 168px;
  padding: 16px 18px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
/* Rule of thumb for any title added to this list: keep it under ~34
   characters. The card is narrow enough that a longer title will wrap to
   a second line and break the row rhythm - .notes-preview-text below
   truncates with an ellipsis as a hard backstop, but a title that has to
   be truncated is already too long. */
.notes-preview-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11.5px;
  line-height: 1.25;
  color: var(--text-primary);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--panel-line-soft);
}
.notes-preview-item:last-child { border-bottom: none; padding-bottom: 0; }
.notes-preview-num {
  flex: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 10px;
  color: var(--brass-500);
}
.notes-preview-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* -- Watch preview -- */

.watch-preview {
  position: relative;
  min-height: 168px;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid var(--panel-line);
}
.watch-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #05030320 0%, #050303a0 100%);
}
.watch-preview-play {
  position: relative;
  z-index: 1;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #050303c0;
  border: 1px solid var(--brass-500);
  color: var(--brass-300);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  padding-left: 3px;
}
.watch-preview-tag {
  position: absolute;
  z-index: 1;
  left: 10px;
  bottom: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-100);
  background: #050303c0;
  padding: 3px 8px;
  border-radius: 999px;
}

/* -- Bruce badge -- */

.bruce-badge {
  min-height: 168px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, var(--garnet-800), var(--garnet-950) 72%);
  border-top: 1px solid var(--panel-line);
}
.bruce-badge-icon {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  background: linear-gradient(160deg, var(--brass-300), var(--brass-500) 45%, var(--brass-900) 100%);
  box-shadow: 0 1px 0 #ffffff70 inset, 0 -6px 10px #00000050 inset, 0 8px 18px -6px #00000090;
}

/* ==========================================================================
   Mode select / landing
   ========================================================================== */

.mode-select {
  max-width: 880px;
  margin: 6vh auto 0;
  scroll-margin-top: 24px;
}

.mode-select-intro {
  text-align: center;
  margin-bottom: 24px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass-400);
  margin: 0 0 10px;
}

.mode-select h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 5vw, 46px);
  margin: 0 0 12px;
  color: var(--text-primary);
}

.mode-select-lede {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Two independent columns (human modes left, bot modes right) rather than
   a single grid, so the right column's Play a Bot card can grow to match
   the left column's total height without dragging every left-column row
   up to the same track height (a single CSS grid couples row heights
   across both columns; two stretched flex columns don't). */
.mode-grid {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.mode-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.mode-col-header {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  color: var(--brass-100);
  margin: 0;
  padding: 10px 0;
  background: linear-gradient(160deg, var(--brass-400), var(--brass-700));
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 0 #ffffff50 inset, 0 4px 10px -4px #00000090;
}

.mode-col-note {
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  margin: -4px 0 4px;
}

.mode-card {
  appearance: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  background: linear-gradient(160deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-lg);
  padding: 16px 18px 14px;
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-body);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 0 #ffffff08 inset, 0 10px 24px -14px #000000a0;
}

.mode-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, var(--brass-500)55, transparent 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.mode-card:hover,
.mode-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--brass-700);
  box-shadow: 0 1px 0 #ffffff10 inset, 0 16px 30px -14px #000000c0, 0 0 0 1px #00000000;
  outline: none;
}
.mode-card:hover::before,
.mode-card:focus-visible::before { opacity: 1; }

.mode-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
}

.mode-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.mode-card-join { cursor: default; }

.mode-card-bot { flex: 1; min-width: 0; }

/* Invite/Join a Friend are two ends of one feature (send a code / receive
   a code) - wrapped in one gold-bordered box instead of two separate
   floating cards so they read as a matched pair. */
.mode-friend-group {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--brass-700);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 1px 0 #ffffff08 inset, 0 10px 24px -14px #000000a0;
}

.mode-card-grouped {
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.mode-card-grouped:hover,
.mode-card-grouped:focus-visible {
  transform: none;
}
.mode-friend-group .mode-card-grouped:first-child {
  border-bottom: 1px solid var(--panel-line-soft);
}

.mode-card-title-tag {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brass-500);
  margin-top: 2px;
}

.join-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
}
/* .btn-brass/.btn-primary default to width:100% for standalone use elsewhere
   on the page - inside a join-row that would fight the input's flex:1 (Join)
   or just look like an oversized bare button (Send Code), so pin these back
   to their natural size instead. */
.join-row .btn-brass {
  width: auto;
  flex: 0 0 auto;
  padding: 9px 22px;
}

.mode-select input {
  flex: 1;
  min-width: 0;
  background: var(--void-soft);
  border: 1px solid var(--panel-line);
  color: var(--text-primary);
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mode-select input:focus {
  outline: none;
  border-color: var(--brass-500);
}
.mode-select input::placeholder { color: var(--text-faint); text-transform: none; }

@media (max-width: 640px) {
  .mode-grid { flex-direction: column; }
  .mode-card-bot { flex: none; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.bot-table-wrap {
  align-self: stretch;
  width: 100%;
  min-width: 0;
  margin-top: 14px;
  overflow-x: auto;
}
.bot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.bot-table th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 10px 8px;
  border-bottom: 2px solid var(--brass-500);
  white-space: nowrap;
}
.bot-table td {
  padding: 10px;
  border-bottom: 1px solid var(--panel-line-soft);
  color: var(--text-muted);
  vertical-align: middle;
}
.bot-table tbody tr:last-child td { border-bottom: none; }
.bot-table-level {
  font-weight: 700;
  color: var(--text-primary);
}
.bot-table-year {
  color: var(--text-faint);
  font-weight: 400;
  font-size: 11px;
}
.bot-table a { color: var(--brass-400); text-decoration: none; border-bottom: 1px solid transparent; }
.bot-table a:hover { color: var(--brass-100); border-color: var(--brass-500); }
.bot-table-nolink { color: var(--text-faint); }
.bot-table td:last-child { text-align: right; white-space: nowrap; }
.bot-table .bot-tier-btn {
  width: auto;
  margin: 0;
  padding: 7px 18px;
}

@media (max-width: 640px) {
  .bot-table { font-size: 11.5px; }
  .bot-table th:nth-child(2),
  .bot-table td:nth-child(2) { display: none; }
}

/* ==========================================================================
   Game screen layout
   ========================================================================== */

/* The "game room" - a neutral dark grey (not the site's warm garnet/void
   theme) specifically so the walnut-and-brass board reads as the obvious
   focal point rather than blending into the surrounding page chrome. */
#game-screen {
  background: #232326;
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  margin-top: 4px;
}

#stats-bar {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}
#stats-bar .panel {
  flex: 1;
  min-width: 150px;
}
#cube-panel { flex: none; }
#dice-panel { flex: none; min-width: 120px; }

#app {
  display: flex;
  gap: 16px;
  margin-top: 4px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}

#board-wrap {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.off-trays-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

/* -- board frame: a leather-and-brass case around the felt -- */

.board-frame {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  padding: 15px;
  background:
    linear-gradient(155deg, #2c1a1c 0%, #1c1113 55%, #170d0f 100%);
  border-radius: var(--radius-md);
  box-shadow:
    0 1px 0 #ffffff14 inset,
    0 0 0 1px var(--panel-line),
    0 24px 60px -20px #000000d0;
}

.board-frame-corner {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 2px solid var(--brass-500);
  opacity: 0.85;
  pointer-events: none;
}
.board-frame-corner.tl { top: 6px; left: 6px; border-right: none; border-bottom: none; }
.board-frame-corner.tr { top: 6px; right: 6px; border-left: none; border-bottom: none; }
.board-frame-corner.bl { bottom: 6px; left: 6px; border-right: none; border-top: none; }
.board-frame-corner.br { bottom: 6px; right: 6px; border-left: none; border-top: none; }

#board {
  background:
    radial-gradient(ellipse at 50% 0%, #3a2011 0%, transparent 70%),
    var(--walnut-dark);
  border: 7px solid var(--garnet-950);
  border-radius: var(--radius-sm);
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px #00000080, inset 0 2px 10px #00000090;
}

.row {
  display: flex;
  height: 248px;
}

.bar {
  width: 39px;
  background: linear-gradient(180deg, var(--garnet-950), #140708);
  border-left: 1px solid #00000060;
  border-right: 1px solid #00000060;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
}
.bar::before {
  content: "";
  position: absolute;
  top: 8px; bottom: 8px; left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, var(--brass-700), transparent);
}
.bar.selectable {
  cursor: pointer;
  box-shadow: inset 0 0 0 2px var(--brass-400), inset 0 0 14px #d6b26260;
}

.quad {
  flex: 1;
  display: flex;
}

.point {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 6px;
  padding-bottom: 6px;
}

.top .point { justify-content: flex-start; }
.bottom .point { justify-content: flex-end; }

.point::before {
  content: "";
  position: absolute;
  top: 0; left: 3px; right: 3px; bottom: 0;
  z-index: 0;
  filter: drop-shadow(0 0 0 transparent);
}
.top .point::before { clip-path: polygon(0 0, 100% 0, 50% 100%); }
.bottom .point::before { clip-path: polygon(0 100%, 100% 100%, 50% 0); }

.point:nth-child(odd)::before {
  background: linear-gradient(180deg, var(--brass-400), var(--brass-700));
}
.bottom .point:nth-child(odd)::before {
  background: linear-gradient(0deg, var(--brass-400), var(--brass-700));
}
.point:nth-child(even)::before {
  background: linear-gradient(180deg, var(--garnet-600), var(--garnet-900));
}
.bottom .point:nth-child(even)::before {
  background: linear-gradient(0deg, var(--garnet-600), var(--garnet-900));
}

.point.selectable::before {
  outline: 2px solid var(--brass-300);
  outline-offset: -2px;
  animation: point-pulse 1.6s ease-in-out infinite;
}
.point.selected::before {
  outline: 3px solid var(--brass-100);
  outline-offset: -3px;
  box-shadow: 0 0 14px 2px #f5e6bd80;
}
.point.target::before {
  outline: 3px solid var(--garnet-glow);
  outline-offset: -3px;
  animation: target-pulse 1.1s ease-in-out infinite;
}
.point.selectable,
.point.target { cursor: pointer; }

@keyframes point-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
@keyframes target-pulse {
  0%, 100% { box-shadow: 0 0 6px 1px #d4475a80; }
  50% { box-shadow: 0 0 16px 4px #d4475aa0; }
}

/* -- last move: where a checker (yours or the bot's) just came from/to.
   Bright cyan on purpose -- garnet and brass both already mean something
   else on this board, and a bot's move needs to read instantly, not blend
   in. -- */
.point.last-move-from::before {
  outline: 4px dashed var(--move-glow);
  outline-offset: -4px;
  box-shadow: 0 0 16px 3px var(--move-glow-soft);
  z-index: 1;
}
.point.last-move-to::before {
  outline: 5px solid var(--move-glow);
  outline-offset: -5px;
  z-index: 1;
  animation: last-move-flash 1.4s ease-out 1;
}
@keyframes last-move-flash {
  0% { box-shadow: 0 0 0 0 #ffffffe0; outline-color: #ffffff; }
  25% { box-shadow: 0 0 40px 14px var(--move-glow); outline-color: var(--move-glow); }
  100% { box-shadow: 0 0 20px 6px var(--move-glow-soft); outline-color: var(--move-glow); }
}
.bar.last-move-from {
  box-shadow: inset 0 0 0 4px var(--move-glow), inset 0 0 26px var(--move-glow-soft);
}
.off-tray.last-move-to {
  outline: 4px solid var(--move-glow);
  outline-offset: 3px;
  box-shadow: 0 0 26px 8px var(--move-glow-soft);
  animation: last-move-flash 1.4s ease-out 1;
}

.point-label {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  color: #39ff14;
  text-shadow: 0 0 2px #000000, 0 0 4px #000000c0;
  z-index: 2;
}
.top .point-label { top: 3px; bottom: auto; }

/* -- checkers: real dimensional objects, not flat circles -- */

.checker-stack {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.bottom .checker-stack { flex-direction: column-reverse; }

.checker {
  width: 31px;
  height: 31px;
  border-radius: 50%;
  position: relative;
  box-shadow:
    0 2px 3px #00000070,
    0 1px 0 #ffffff20 inset,
    0 -4px 6px #00000040 inset;
}
.checker::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 1px solid #00000030;
}
.checker.white {
  background: radial-gradient(circle at 32% 28%, #fffaf0, var(--bone) 55%, var(--bone-dim) 100%);
  border: 1px solid #8a7d67;
}
.checker.black {
  background: radial-gradient(circle at 32% 28%, #3a2a2c, var(--ink) 55%, var(--ink-rim) 100%);
  border: 1px solid #000;
}
.checker.white::after { border-color: #00000025; }
.checker.black::after { border-color: #d6b26240; }

.checker-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--brass-100);
  background: #000000d0;
  border: 1px solid var(--brass-700);
  border-radius: 8px;
  padding: 1px 6px;
}

.bar-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

/* ==========================================================================
   Off trays
   ========================================================================== */

.off-tray-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 50px;
}

.off-tray-label {
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
}

.off-tray {
  width: 50px;
  min-height: 248px;
  background: linear-gradient(180deg, var(--panel-raised), var(--void-soft));
  border: 3px solid var(--garnet-950);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 0;
  box-shadow: inset 0 2px 8px #00000090, 0 0 0 1px #00000060;
}
.off-tray .checker { width: 24px; height: 24px; }
.off-tray.target { outline: 2px solid var(--garnet-glow); outline-offset: 2px; }

/* White's off tray gets a white background (not the shared dark panel
   look) so which side is whose reads at a glance - testers were mixing
   the two up when both trays looked identical. */
#off-white {
  background: linear-gradient(180deg, #fffaf0, var(--bone-dim));
  border-color: #8a7d67;
}

/* ==========================================================================
   Sidebar panels
   ========================================================================== */

#sidebar {
  min-width: 208px;
  width: 208px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel {
  background: linear-gradient(160deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-md);
  padding: 9px 12px 9px;
  font-size: 13px;
  box-shadow: 0 1px 0 #ffffff0a inset, 0 6px 16px -10px #00000090;
}

.panel-head {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-400);
  margin-bottom: 5px;
  white-space: nowrap;
}

/* -- turn / pip -- */

.turn-row { margin-bottom: 6px; }
.turn-chip {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  text-transform: capitalize;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--void-soft);
  border: 1px solid var(--panel-line);
}

.pip-row {
  display: flex;
  gap: 10px;
}
.pip-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--void-soft);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  border: 1px solid var(--panel-line-soft);
}
.pip-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
}
.pip-label-white { color: var(--bone); }
.pip-label-black { color: var(--text-muted); }
.pip-value {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

/* -- doubling cube: a real dimensional object -- */

#cube-panel { display: flex; flex-direction: column; align-items: center; text-align: center; }

.cube-object {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--brass-300), var(--brass-500) 45%, var(--brass-900) 100%);
  border-radius: 8px;
  border: 1px solid var(--brass-900);
  box-shadow:
    0 1px 0 #ffffff70 inset,
    0 -6px 10px #00000050 inset,
    0 8px 18px -6px #00000090;
  position: relative;
  margin: 4px 0 10px;
  transition: box-shadow 0.2s ease;
}
.cube-object::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid #ffffff40;
  border-radius: 5px;
  pointer-events: none;
}

.cube-face-value span,
.cube-face-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  color: var(--garnet-950);
  text-shadow: 0 1px 0 #ffffff60;
}

.cube-owner {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--panel-line);
  background: var(--void-soft);
}

/* Stats bar only - shrink the cube here so it doesn't dictate the whole
   bar's height via flex stretch (the hero decorative cube keeps its full
   size, it isn't part of this constraint). */
#cube-panel .cube-object {
  width: 46px;
  height: 46px;
  margin: 2px 0 6px;
}
#cube-panel .cube-face-value,
#cube-panel .cube-face-value span {
  font-size: 22px;
}
#cube-panel .cube-owner {
  padding: 2px 8px;
}
.cube-owner.owned-white { color: var(--bone); border-color: var(--brass-700); }
.cube-owner.owned-black { color: var(--garnet-glow); border-color: var(--garnet-700); }

.cube-object.owned-white { box-shadow: 0 1px 0 #ffffff70 inset, 0 -6px 10px #00000050 inset, 0 0 0 2px var(--bone), 0 0 22px 2px #efe4d070; }
.cube-object.owned-black { box-shadow: 0 1px 0 #ffffff70 inset, 0 -6px 10px #00000050 inset, 0 0 0 2px var(--garnet-glow), 0 0 22px 2px #d4475a70; }

/* -- dice -- */

#dice-display {
  display: flex;
  gap: 8px;
  min-height: 40px;
  align-items: center;
}
.die {
  width: 36px;
  height: 36px;
  background: linear-gradient(160deg, #fffdf8, var(--bone-dim));
  color: var(--garnet-950);
  border: 1px solid #8a7d67;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 1px 0 #ffffffa0 inset, 0 3px 6px -1px #00000070;
}
.die.used { opacity: 0.32; text-decoration: line-through; box-shadow: none; }

/* -- controls / buttons -- */

button {
  font-family: var(--font-body);
  border: none;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 6px 6px 0;
  transition: filter 0.12s ease, transform 0.12s ease;
}
button:last-child { margin-right: 0; }
button:disabled {
  background: #3a3132 !important;
  color: #7d7166 !important;
  cursor: not-allowed;
  box-shadow: none !important;
  transform: none !important;
}
button:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(160deg, var(--garnet-600), var(--garnet-800));
  color: var(--brass-100);
  box-shadow: 0 1px 0 #ffffff20 inset, 0 4px 10px -4px #00000090;
  width: 100%;
}
.btn-brass {
  background: linear-gradient(160deg, var(--brass-400), var(--brass-700));
  color: var(--garnet-950);
  box-shadow: 0 1px 0 #ffffff50 inset, 0 4px 10px -4px #00000090;
  width: 100%;
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--panel-line);
  width: 100%;
}
.btn-ghost:hover:not(:disabled) { color: var(--text-primary); border-color: var(--brass-700); }

#controls .btn-primary,
#controls .btn-brass { display: block; padding: 8px 14px; margin-bottom: 4px; }

/* -- match log -- */

#log {
  max-height: 150px;
  overflow-y: auto;
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column-reverse;
  font-variant-numeric: tabular-nums;
}
#log div { padding: 3px 0; border-bottom: 1px solid var(--panel-line-soft); }
#log div:first-child { border-bottom: none; }

/* ==========================================================================
   Match / net panel
   ========================================================================== */

#net-panel #net-info { margin-bottom: 8px; color: var(--text-muted); }

.invite-plaque {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--void-soft);
  border: 1px solid var(--brass-700);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 6px;
}
.invite-plaque-label {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.invite-plaque strong {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.06em;
  color: var(--brass-300);
}
#invite-code-panel small { color: var(--text-faint); display: block; margin-bottom: 8px; }

.waiting-indicator {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: var(--brass-200);
  text-align: center;
  background: #030102d0;
}
.waiting-indicator .waiting-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(36px, 7vw, 72px);
  letter-spacing: 0.02em;
  max-width: 90vw;
}
.waiting-die {
  font-size: 72px;
  display: inline-block;
  animation: waiting-spin 1.8s ease-in-out infinite;
}
.waiting-leave-btn,
.waiting-bot-fallback-btn {
  width: auto;
  margin-top: 10px;
  padding: 10px 28px;
  font-size: 15px;
}
.waiting-bot-fallback-btn {
  margin-top: 30px;
}
.waiting-invite-code {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--void-soft);
  border: 1px solid var(--brass-700);
  border-radius: var(--radius-sm);
  padding: 16px 28px;
  margin-top: 10px;
}
.waiting-invite-code .invite-plaque-label {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.waiting-invite-code strong {
  font-family: var(--font-display);
  font-size: 40px;
  letter-spacing: 0.1em;
  color: var(--brass-300);
}
.waiting-invite-code small {
  color: var(--text-faint);
  font-size: 13px;
  max-width: 60vw;
  text-align: center;
}
@keyframes waiting-spin {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}

/* -- voice chat -- */

.voice-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--panel-line-soft);
}
.voice-status {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.4;
}
.voice-controls {
  display: flex;
  gap: 6px;
}
.voice-controls button { width: auto; flex: 1; margin: 0; }
.voice-hint {
  display: block;
  margin-top: 6px;
  color: var(--text-faint);
  font-size: 10.5px;
  line-height: 1.4;
}

/* -- text chat -- */

.chat-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--panel-line-soft);
}
.chat-log {
  max-height: 120px;
  overflow-y: auto;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.chat-line { line-height: 1.4; word-break: break-word; }
.chat-who { font-weight: 700; }
.chat-line-white .chat-who { color: var(--bone); }
.chat-line-black .chat-who { color: var(--garnet-glow); }
.chat-form {
  display: flex;
  gap: 6px;
}
.chat-form input {
  flex: 1;
  min-width: 0;
  background: var(--void-soft);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 12.5px;
  padding: 7px 9px;
}
.chat-form input:focus { outline: none; border-color: var(--brass-700); }
.chat-form input::placeholder { color: var(--text-faint); }
.chat-send-btn { width: auto; margin: 0; padding: 7px 14px; }

/* ==========================================================================
   Doubling cube offer — the dramatic moment
   ========================================================================== */

.cube-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: #050303c0;
  backdrop-filter: blur(2px);
}

.cube-modal-card {
  background: linear-gradient(160deg, var(--panel-raised), var(--void-soft));
  border: 1px solid var(--brass-700);
  border-radius: var(--radius-lg);
  padding: 36px 44px 30px;
  text-align: center;
  max-width: 360px;
  box-shadow: 0 0 0 1px #00000080, 0 30px 70px -20px #000000f0, 0 0 60px -10px #7f223160;
  animation: cube-modal-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes cube-modal-in {
  from { opacity: 0; transform: scale(0.85) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.cube-modal-cube {
  font-size: 52px;
  margin-bottom: 6px;
  color: var(--brass-400);
  filter: drop-shadow(0 6px 14px #00000090);
}

.cube-modal-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--garnet-glow);
  margin: 0 0 8px;
}

.cube-modal-detail {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 22px;
  line-height: 1.3;
}

.cube-modal-actions {
  display: flex;
  gap: 10px;
}
.cube-modal-actions button { width: auto; flex: 1; margin: 0; padding: 12px 16px; }
.btn-take { font-size: 14px; }
.btn-pass { font-size: 14px; color: var(--garnet-glow); border-color: var(--garnet-700); }
.btn-pass:hover:not(:disabled) { color: var(--brass-100); border-color: var(--garnet-glow); }

/* ==========================================================================
   Game over — the final word
   ========================================================================== */

.gameover-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  background: #030102d0;
}

.gameover-card {
  background:
    radial-gradient(ellipse at 50% 0%, #4c142055 0%, transparent 65%),
    linear-gradient(160deg, var(--panel-raised), var(--void-soft));
  border: 1px solid var(--brass-700);
  border-radius: var(--radius-lg);
  padding: 40px 48px 34px;
  text-align: center;
  max-width: 420px;
  box-shadow: 0 0 0 1px #00000090, 0 40px 90px -24px #000000f5;
  animation: cube-modal-in 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.gameover-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--garnet-950);
  background: linear-gradient(160deg, var(--brass-300), var(--brass-500));
  border-radius: 999px;
  padding: 5px 16px;
  margin-bottom: 18px;
  box-shadow: 0 3px 8px -2px #00000090;
}

.gameover-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 5vw, 38px);
  margin: 0 0 10px;
  color: var(--text-primary);
}

.gameover-detail {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 26px;
  line-height: 1.5;
}

.gameover-card .btn-primary { width: auto; padding: 12px 30px; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  #app { flex-direction: column; align-items: center; }
  #sidebar { width: 100%; max-width: 720px; }
  #board-wrap { flex-wrap: wrap; justify-content: center; }
}

/* The persistent left sidebar nav (see .site-nav's own min-width:901px
   block) reserves 196px of every desktop viewport, but this breakpoint
   was tuned before that nav existed - between ~901-1210px there's no
   longer room for #board-wrap + #sidebar side by side, so the base row
   layout's flex-wrap fires mid-layout instead of the deliberate stacked
   treatment above. Same stack, just at a width that accounts for the nav. */
@media (min-width: 901px) and (max-width: 1210px) {
  #app { flex-direction: column; align-items: center; }
  #sidebar { width: 100%; max-width: 720px; }
  #board-wrap { flex-wrap: wrap; justify-content: center; }
}

/* ==========================================================================
   Visitor email signup - "we might as well collect emails". Same card
   language as .support-card: one centered card, no fanfare.
   ========================================================================== */

.signup {
  max-width: 1180px;
  margin: clamp(48px, 8vh, 84px) auto 0;
  padding-top: 28px;
  border-top: 1px solid var(--panel-line);
}

.signup-card {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  background: linear-gradient(160deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-lg);
  padding: 32px clamp(20px, 5vw, 40px) 36px;
  box-shadow: 0 1px 0 #ffffff08 inset, 0 10px 24px -14px #000000a0;
}

.signup-card h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(22px, 4vw, 28px);
  margin: 10px 0 12px;
  color: var(--text-primary);
}

.signup-lede {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
  max-width: 44ch;
  margin: 0 auto 22px;
}

.signup-form {
  display: flex;
  gap: 10px;
  max-width: 420px;
  margin: 0 auto;
}

.signup-form input {
  flex: 1;
  min-width: 0;
  background: var(--void-soft);
  border: 1px solid var(--panel-line);
  color: var(--text-primary);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-body);
}

.signup-form .btn-primary {
  width: auto;
  margin: 0;
  white-space: nowrap;
  padding: 11px 22px;
}

.signup-message {
  font-size: 13px;
  color: var(--brass-300);
  margin: 14px 0 0;
}
.signup-message-error { color: var(--danger); }

@media (max-width: 480px) {
  .signup-form { flex-direction: column; }
}

/* ==========================================================================
   Player identity modal - screen name + optional email, no password.
   Reuses .cube-modal's overlay/card mechanics (see above) with copy/tone
   matching .signup-card rather than a new visual language.
   ========================================================================== */

.player-modal-card {
  max-width: 420px;
  text-align: left;
}
.player-modal-card .cube-modal-eyebrow { text-align: center; }

.player-modal-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(20px, 4vw, 24px);
  margin: 0 0 10px;
  color: var(--text-primary);
  text-align: center;
}

.player-modal-lede {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 18px;
  text-align: center;
}

.player-modal-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-modal-form input[type="text"],
.player-modal-form input[type="email"] {
  background: var(--void-soft);
  border: 1px solid var(--panel-line);
  color: var(--text-primary);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-body);
  width: 100%;
}

.player-modal-optin {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
.player-modal-optin input { margin-top: 3px; flex: none; }

.player-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.player-modal-actions button { width: auto; flex: 1; margin: 0; padding: 11px 16px; }

.player-modal-note {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-faint);
  margin: 2px 0 0;
}

@media (max-width: 480px) {
  .player-modal-actions { flex-direction: column; }
}

/* ==========================================================================
   Footer - deliberately low-key: a single quiet link, not a paywall banner.
   ========================================================================== */

.site-footer {
  max-width: 1180px;
  margin: 40px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--panel-line);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.site-footer a {
  color: var(--text-faint);
  font-size: 12.5px;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-footer a:hover {
  color: var(--brass-300);
  border-color: var(--brass-500);
}

.footer-sep {
  color: var(--panel-line);
  font-size: 12.5px;
}

.footer-book-link {
  color: var(--brass-400) !important;
}
.footer-book-link:hover {
  color: var(--brass-100) !important;
}

/* ==========================================================================
   Bot mode picker + Teacher's Notes panel
   ========================================================================== */

.mode-card-bot { cursor: default; }

.bot-tier-btn {
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  white-space: normal;
  line-height: 1.3;
  cursor: pointer;
}


#teacher-panel .teacher-line {
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 8px;
}
#teacher-panel .teacher-line:empty { display: none; }

.teacher-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-faint);
  text-transform: none;
  letter-spacing: normal;
  margin: 6px 0 8px;
  cursor: pointer;
}
.teacher-toggle input { accent-color: var(--brass-500); }

/* ==========================================================================
   Legal pages - Terms/Privacy/Cookies/Community Rules/etc. One shared
   template rather than a per-page <style> block (unlike strategy/support/
   about) since there are 8 of these and they're otherwise identical.
   ========================================================================== */

.legal-page {
  max-width: 760px;
  margin: 0 auto;
  padding-top: clamp(24px, 6vh, 56px);
}

.legal-intro {
  text-align: center;
  margin-bottom: 30px;
}

.legal-intro h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 5vw, 40px);
  margin: 0 0 10px;
  color: var(--text-primary);
}

.legal-effective {
  color: var(--text-faint);
  font-size: 13px;
}

.legal-doc {
  background: linear-gradient(160deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-lg);
  padding: 28px clamp(20px, 5vw, 40px) 34px;
  box-shadow: 0 1px 0 #ffffff08 inset, 0 10px 24px -14px #000000a0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.65;
}

.legal-doc > p:first-child,
.legal-doc > h4:first-child { margin-top: 0; }

.legal-doc p { margin: 0 0 14px; }
.legal-doc p:last-child { margin-bottom: 0; }

.legal-doc h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  margin: 26px 0 10px;
  padding-top: 18px;
  border-top: 1px solid var(--panel-line-soft);
}
.legal-doc h3:first-child { margin-top: 0; padding-top: 0; border-top: none; }

.legal-doc h4 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-primary);
  margin: 16px 0 4px;
}

.legal-doc ul {
  margin: 0 0 14px;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.legal-doc li { font-size: 14px; }

.legal-doc strong { color: var(--text-primary); }

.legal-back {
  display: block;
  text-align: center;
  margin-top: 24px;
  color: var(--brass-300);
  font-size: 14px;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.legal-back:hover { color: var(--brass-100); border-color: var(--brass-500); }

/* -- footer legal row + copyright -- */

.site-footer-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--panel-line-soft);
  width: 100%;
}
.site-footer-legal a { font-size: 11.5px; }

.site-footer-copyright {
  width: 100%;
  text-align: center;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-faint);
}
