/* NV Four in a Row — a games-room table: a walnut board, ivory and terracotta discs, brass trim. Fonts: IBM Plex (SIL OFL). */
@font-face { font-family: 'Plex Mono'; src: url('./fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Condensed'; src: url('./fonts/ibm-plex-sans-condensed-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Plex Condensed'; src: url('./fonts/ibm-plex-sans-condensed-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
:root {
  --felt: #1f3b2d; --felt-2: #16291f; --wood: #6b4226; --wood-2: #4a2c18; --wood-3: #8a5a36; --brass: #c9a24a; --cream: #f2e8d2; --soft: #b9c7b4;
  --ivory: #f3ead4; --terra: #c4553a; --hole: #1a110b;
  --mono: 'Plex Mono', ui-monospace, Consolas, monospace; --sans: 'Plex Condensed', 'Arial Narrow', system-ui, sans-serif;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --cell: min(64px, calc((100vw - 56px) / 7));
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; color: var(--cream); font: 500 16px/1.45 var(--sans);
  background: radial-gradient(circle at 50% 30%, #2a4d3b, var(--felt-2) 75%); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
a { color: var(--brass); }
.room { width: min(640px, calc(100% - 24px)); margin: clamp(12px, 3vw, 28px) auto; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); justify-items: center; }
.top { text-align: center; }
.brand { margin: 0; font-size: 11px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--soft); }
.brand span { color: var(--cream); font-weight: 600; }
h1 { margin: 2px 0 0; font: 700 clamp(32px, 8vw, 50px)/1.05 var(--serif); letter-spacing: 0.01em; color: var(--cream); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }

.bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.seg { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; border-radius: 999px; background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(201, 162, 74, 0.35); }
.seg button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--soft); cursor: pointer; font-weight: 600; font-size: 14px; }
.seg button:hover { color: var(--cream); }
.seg button[aria-pressed='true'] { background: var(--brass); color: #2b1d0c; }

.score { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.side { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); border: 2px solid transparent; transition: border-color 0.2s; }
#side-2 { justify-content: flex-end; }
.side.turn { border-color: var(--brass); box-shadow: 0 0 16px rgba(201, 162, 74, 0.25); }
.side span { font-weight: 600; }
.side b, .draws b { font: 400 26px/1 var(--mono); }
.draws { display: grid; justify-items: center; color: var(--soft); font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; }
.draws b { color: var(--cream); font-size: 20px; }
.chip { width: 22px; height: 22px; border-radius: 50%; flex: none; }
.status { margin: 0; min-height: 1.5em; font: italic 400 18px var(--serif); text-align: center; }

.table { display: grid; gap: 6px; }
.rail { display: grid; grid-template-columns: repeat(7, var(--cell)); height: var(--cell); padding: 0 calc(var(--cell) * 0.18); }
.rail i { width: calc(var(--cell) * 0.8); height: calc(var(--cell) * 0.8); margin: auto; border-radius: 50%; opacity: 0; transition: opacity 0.15s; }
.rail i.show { opacity: 0.95; }
.board { padding: calc(var(--cell) * 0.18); border-radius: 14px; background: var(--wood);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.18), inset 0 -4px 0 rgba(0, 0, 0, 0.35), 0 18px 30px -12px rgba(0, 0, 0, 0.7), 0 0 0 3px var(--brass); }
.grid { position: relative; display: grid; grid-template-columns: repeat(7, var(--cell)); overflow: hidden; background: var(--hole); }
/* The front of the board: wood with a hole per cell, so discs fall behind it and show through the holes. */
.face, .rings { position: absolute; inset: 0; pointer-events: none; }
.face { z-index: 2; background: repeating-linear-gradient(100deg, rgba(255, 255, 255, 0.035) 0 3px, transparent 3px 11px), linear-gradient(160deg, var(--wood-3), var(--wood) 45%, var(--wood-2));
  -webkit-mask: radial-gradient(circle calc(var(--cell) * 0.38), transparent 97%, #000 100%) 0 0 / var(--cell) var(--cell) repeat;
  mask: radial-gradient(circle calc(var(--cell) * 0.38), transparent 97%, #000 100%) 0 0 / var(--cell) var(--cell) repeat; }
.rings { z-index: 3; background: radial-gradient(circle calc(var(--cell) * 0.38), transparent 78%, rgba(0, 0, 0, 0.5) 100%, transparent 100%) 0 0 / var(--cell) var(--cell) repeat; }
.col { display: flex; flex-direction: column-reverse; padding: 0; border: 0; background: transparent; cursor: pointer; }
.col:disabled { cursor: default; }
.cell { width: var(--cell); height: var(--cell); display: grid; place-items: center; }
.disc { position: relative; width: 80%; height: 80%; border-radius: 50%; }
.p1, .rail i.p1 { background: radial-gradient(circle at 38% 32%, #fffaf0, var(--ivory) 45%, #d8cba9); box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0.06), inset 0 -3px 5px rgba(0, 0, 0, 0.18); }
.p2, .rail i.p2 { background: radial-gradient(circle at 38% 32%, #e98a6f, var(--terra) 50%, #8e3622); box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0.08), inset 0 -3px 5px rgba(0, 0, 0, 0.25); }
.disc::after { content: ''; position: absolute; inset: 22%; border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.08); }
.disc.drop { animation: drop var(--dur, 0.4s) cubic-bezier(0.45, 0, 0.9, 0.6) both; }
@keyframes drop { 0% { transform: translateY(calc(var(--from) * -125%)); } 78% { transform: translateY(0); } 88% { transform: translateY(-8%); } 100% { transform: translateY(0); } }
.disc.win { animation: glow 0.9s ease-in-out infinite alternate; }
.disc.win::after { border-color: var(--brass); border-width: 3px; }
@keyframes glow { to { filter: brightness(1.3) saturate(1.2); } }
.rail i.hint { opacity: 0.95; animation: hinted 0.8s ease-in-out 4; }
@keyframes hinted { 50% { transform: translateY(18%); box-shadow: 0 0 0 3px var(--brass); } }
.board.done .disc:not(.win) { opacity: 0.5; }
.board.done .col { cursor: default; }

.tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.btn { min-height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid rgba(201, 162, 74, 0.55); background: rgba(0, 0, 0, 0.22); cursor: pointer; font-weight: 600; }
.btn:hover:not(:disabled) { background: rgba(201, 162, 74, 0.15); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn--brass { background: var(--brass); color: #2b1d0c; border-color: var(--brass); }
.btn--brass:hover { background: #dbb75f; }

.card { width: 100%; padding: 14px 16px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); border: 1px solid rgba(201, 162, 74, 0.25); overflow-x: auto; }
.card__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
h2 { margin: 0; font: 700 18px var(--serif); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--soft); font-size: 12px; padding: 4px 8px 4px 0; border-bottom: 1px solid rgba(201, 162, 74, 0.25); }
td { padding: 6px 8px 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-family: var(--mono); font-size: 13px; }
td:first-child { font-family: var(--sans); font-size: 14px; }
.link { border: 0; background: none; padding: 0; color: var(--soft); text-decoration: underline; cursor: pointer; font-size: 13px; }
.keys { margin: 0; text-align: center; font-size: 13px; color: var(--soft); }
kbd { font: 400 11px var(--mono); border: 1px solid rgba(201, 162, 74, 0.5); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: rgba(0, 0, 0, 0.3); color: var(--cream); }
.foot { text-align: center; font-size: 12px; color: var(--soft); }
.thinking::after { content: ''; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@media (prefers-reduced-motion: reduce) { .disc.drop, .disc.win, .rail i.hint, .thinking::after { animation: none; } }
