/* Widget only. The page around it — nav, copy, calls to action — belongs to the landing page. */

/* Vendored, never a CDN: a webfont request hands the visitor's IP to whoever serves it, on the
   page arguing for the opposite. Licences sit beside the files. Latin subsets only, and no
   unicode-range — a glyph they lack (the arrows) falls through to the next family in the stack. */
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('fonts/bricolage-grotesque-latin-wght-normal.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #0a0d0c;
  --bg2: #0f1413;
  --panel: #101614;
  --line: rgba(255, 255, 255, .07);
  --line2: rgba(255, 255, 255, .12);
  --ink: #e9efe9;
  --dim: #979a99;
  --dimmer: #46524c;
  --you: #b6ff3a;
  --server: #ff8a42;
  --cyan: #54d8ff;
  --tile: #161d1a;
  --tile-hi: #1e2723;
  --valuable: #142019;
  --water: #0c1c24;
  --radius: 4px;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --disp: 'Bricolage Grotesque', system-ui, sans-serif;
  /* seq, ts, actor, event, subject, outcome. In ch, so the header and the rows only line up
     while they share a font size — that is why both sit inside .logwrap and neither sets one. */
  --cols: 3ch 12ch 6ch 8ch 14ch auto;
  /* --dimmer reads 2.43:1 on the log background, under AA, and seq and ts carry the
     "nothing was dropped" claim. */
  /* ponytail: its own token rather than lifting --dimmer, whose other uses are the tile dots
     and the dead LED — not text. */
  --log-dim: #909391;
}

* { box-sizing: border-box; margin: 0; padding: 0 }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1400px; margin: 0 auto; padding: 40px 22px }

.widget {
  display: grid;
  /* The console takes the larger share, and the widget more width than the page's prose
     column: one log line is ~81ch. */
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  border: 1px solid var(--line2);
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg2), var(--bg));
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, .9);
}

.pane { padding: 22px }
.pane.left { border-right: 1px solid var(--line) }
.pane.right { background: linear-gradient(180deg, rgba(84, 216, 255, .03), transparent 30%), var(--panel) }
.paneTop { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px }
.paneLabel { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim) }

.board { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; aspect-ratio: 8/6 }

.tile {
  position: relative;
  border-radius: var(--radius);
  background: var(--tile);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform .12s, background .2s, border-color .2s;
  animation: pop .5s cubic-bezier(.2, .8, .2, 1) both;
}

/* Only a tile that could still be taken, and only its background: an owned or water tile
   carries information hover must not repaint, and the border belongs to legality. */
.board:not(.inert) .tile:not(.you):not(.server):not(.water):hover { background: var(--tile-hi); transform: translateY(-1px) }
.tile.valuable { background: var(--valuable) }
.tile.water { background: var(--water); cursor: not-allowed; border-color: rgba(84, 216, 255, .10) }
.tile.legal { border-color: rgba(182, 255, 58, .45); box-shadow: inset 0 0 0 1px rgba(182, 255, 58, .12) }
.tile.you { background: linear-gradient(145deg, #9be028, #c6ff52); border-color: #d8ff7a; box-shadow: 0 0 14px -4px var(--you) }
.tile.server { background: linear-gradient(145deg, #e9722c, #ff9a52); border-color: #ffb07a; box-shadow: 0 0 14px -4px var(--server) }
/* The second channel. Your tiles and the opponent's sit 1.89:1 apart in luminance, so hue
   is doing all the work until the dot's shape tells them apart. */
.tile .dot { position: absolute; inset: 0; margin: auto; width: 5px; height: 5px; border-radius: 99px; background: var(--dimmer) }
.tile.you .dot, .tile.server .dot { width: 7px; height: 7px; background: rgba(0, 0, 0, .55) }
.tile.server .dot { border-radius: 2px }
.tile.water .dot { width: 9px; height: 2px; border-radius: 1px; background: var(--cyan); opacity: .45 }

/* The socket is gone or the game is decided: the board stops pretending it is interactive. */
.board.inert .tile { cursor: default; opacity: .55 }

.stats { display: flex; gap: 22px; margin-top: 18px; align-items: flex-end }
.stat { display: flex; flex-direction: column; gap: 2px }
.stat .n { font-family: var(--disp); font-weight: 800; font-size: 34px; line-height: 1; letter-spacing: -.02em }
.stat.you .n { color: var(--you) }
.stat.server .n { color: var(--server) }
.stat .l { font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim) }
.turnpill { margin-left: auto; font-size: 13px; color: var(--dim); border: 1px solid var(--line2); padding: 6px 12px; border-radius: 99px }
.turnpill b { color: var(--ink) }

.conn { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim); margin-bottom: 4px }
.led { width: 7px; height: 7px; border-radius: 99px; background: var(--you); box-shadow: 0 0 8px var(--you); animation: blink 2s infinite }
.led.off { background: var(--dimmer); box-shadow: none; animation: none }
.endpoint { font-size: 12.5px; color: var(--cyan); opacity: .8; word-break: break-all; margin-bottom: 16px }

.metrics { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 16px }
.metric { border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 10px; background: rgba(0, 0, 0, .25) }
.metric .mn { font-family: var(--disp); font-weight: 700; font-size: 21px; letter-spacing: -.02em }
.metric .mn small { font-size: 12px }
.metric .ml { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin-top: 2px }
.metric.lag .mn { color: var(--cyan) }

/* One grid column, so the header is exactly as wide as the rows. A plain 1fr rather than
   max-content, which would size this to the widest row instead of letting it wrap. */
.logwrap { border: 1px solid var(--line); border-radius: var(--radius); background: #070a09; height: 232px; overflow-y: auto; font-size: 13px; display: grid; grid-template-columns: 1fr; align-content: start }
.logwrap::-webkit-scrollbar { width: 6px; height: 6px }
.logwrap::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 9px }
.loghead { position: sticky; top: 0; z-index: 1; color: var(--log-dim); background: #070a09; padding: 8px 11px 5px; border-bottom: 1px solid var(--line) }
.log { padding: 8px 11px; display: flex; flex-direction: column; gap: 3px }

.loghead .row, .ln { display: grid; grid-template-columns: var(--cols); gap: 7px; white-space: nowrap }
.ln { animation: slidein .3s ease both }
.ln .sq, .ln .ts { color: var(--log-dim) }
/* Sized for tile= and state=; a match id is longer and rare, so it ellipsises rather
   than pushing the outcome — the column a reader came for — off the panel. */
.ln .su { overflow: hidden; text-overflow: ellipsis }
.ln .ev { color: var(--dim) }
/* The actor column carries the side's colour, so the outcome never has to encode who acted. */
.ln.client .ac { color: var(--you) }
.ln.ai .ac { color: var(--server) }
.ln.server .ac { color: var(--cyan) }
/* The only cell allowed to wrap, and the reason nothing in this panel scrolls sideways: a
   gloss with no room left folds onto a second row rather than widening the line. */
.ln .ou { white-space: normal }
.ln .ou.rejected, .ln .ou.closed { color: var(--server) }
.ln .ou.accepted { color: var(--cyan); opacity: .85 }

.note { margin-top: 22px; font-size: 13px; line-height: 1.7; color: var(--dim); max-width: 62ch }
.note p { margin-bottom: 8px }
.note b { color: var(--ink); font-weight: 400 }

@keyframes pop { from { opacity: 0; transform: scale(.6) } to { opacity: 1; transform: scale(1) } }
@keyframes slidein { from { opacity: 0; transform: translateX(-6px) } to { opacity: 1; transform: none } }
@keyframes blink { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }

/* Stacks well before it has to: side by side, the console's fixed columns stop fitting
   below about 1050px. Full width, they fit again. */
@media (max-width: 1080px) {
  .widget { grid-template-columns: minmax(0, 1fr) }
  .pane.left { border-right: 0; border-bottom: 1px solid var(--line) }
}
