/* Rungs
   ---------------------------------------------------------------------------
   Light, roomy and rounded. The tiles are the graphic language: soft squares of
   blue and red with a number on them, and they turn up inline in the headlines
   as well as on the board, so the page is built out of the thing you play with.

   Blue and red mean the two players everywhere. The interface borrows the blue
   only for the action you are most likely to want next. */

:root {
  --bg: #EEF0F4;          /* the surround the sheet sits on */
  --card: #FFFFFF;
  --sunk: #F5F6F9;        /* inputs, the board bed, quiet fills */
  --ink: #0F1218;
  --ink-2: #4A515E;
  --ink-3: #8A92A3;
  --hair: #E6E9EF;
  --raised: #FFFFFF;      /* the chosen option inside a group */

  --blue: #2E7DFF;
  --blue-soft: #EAF2FF;
  --red: #FF5747;
  --green: #1FBF75;
  --amber: #FFB020;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 34px;

  --lift: 0 1px 2px rgba(15, 18, 24, 0.05), 0 8px 24px -12px rgba(15, 18, 24, 0.16);
  --lift-tile: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 2px 6px rgba(15, 18, 24, 0.16);

  --gap-cell: clamp(6px, 1.4vw, 10px);
  --page: 1040px;         /* one content width for header, pages and footer */
  --gutter: clamp(1rem, 3.5vw, 2.5rem);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0C10; --card: #14171D; --sunk: #1B1F27;
    --ink: #F3F5F8; --ink-2: #B4BCC9; --ink-3: #7B8494; --hair: #242933; --raised: #2A303B;
    --blue: #4A8CFF; --blue-soft: #16233A; --red: #FF6A5B;
    --lift: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 30px -14px rgba(0, 0, 0, 0.85);
    --lift-tile: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 2px 8px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A0C10; --card: #14171D; --sunk: #1B1F27;
  --ink: #F3F5F8; --ink-2: #B4BCC9; --ink-3: #7B8494; --hair: #242933; --raised: #2A303B;
  --blue: #4A8CFF; --blue-soft: #16233A; --red: #FF6A5B;
  --lift: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 30px -14px rgba(0, 0, 0, 0.85);
  --lift-tile: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 2px 8px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Outfit, "Segoe UI", system-ui, sans-serif;
  font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1.03rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.05; letter-spacing: -0.03em; font-weight: 600; text-wrap: balance; }
p { margin: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--blue); outline-offset: 3px; border-radius: 4px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -9999px; background: var(--ink); color: var(--card); padding: 0.7rem 1.1rem; z-index: 100; border-radius: var(--r-sm); }
.skip:focus { left: 0.75rem; top: 0.75rem; }
.num, .mono { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* the site sits in one rounded sheet, the way a board sits on a table */
.shell {
  background: var(--card);
  border-radius: var(--r-xl);
  margin: clamp(0.5rem, 1.6vw, 1.25rem);
  box-shadow: var(--lift);
  overflow: clip;
}

/* ---------------------------------------------------------------- masthead */
.masthead {
  display: flex; align-items: center; gap: clamp(0.75rem, 3vw, 2rem);
  /* edges line up with the content below, however wide the window is */
  padding: clamp(0.9rem, 2vw, 1.35rem) max(var(--gutter), calc((100% - var(--page)) / 2));
}
.brand { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; color: inherit; }
.brand-mark { position: relative; width: 26px; height: 26px; flex: none; }
.brand-mark i { position: absolute; width: 17px; height: 17px; border-radius: 6px; }
.brand-mark i:first-child { left: 0; top: 0; background: var(--blue); }
.brand-mark i:last-child { right: 0; bottom: 0; background: var(--red); }
.brand-mark.small { width: 18px; height: 18px; }
.brand-mark.small i { width: 12px; height: 12px; border-radius: 4px; }
.brand-name { font-weight: 700; font-size: 1.25rem; letter-spacing: -0.04em; }

.nav { display: flex; gap: clamp(0.15rem, 1vw, 0.4rem); }
.nav-link {
  background: none; border: 0; cursor: pointer; color: var(--ink-2);
  font-weight: 500; font-size: 0.95rem; padding: 0.45rem 0.8rem; border-radius: 100px;
  transition: background 140ms ease, color 140ms ease;
}
.nav-link:hover { color: var(--ink); background: var(--sunk); }
.nav-link[aria-current="page"] { color: var(--ink); background: var(--sunk); font-weight: 600; }

.masthead-end { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.sound-toggle {
  display: inline-flex; align-items: center; gap: 0.45rem; background: none; border: 0;
  cursor: pointer; color: var(--ink-3); font-size: 0.88rem; padding: 0.4rem 0.6rem;
  border-radius: 100px;
}
.sound-toggle:hover { background: var(--sunk); }
.sound-bars { display: flex; align-items: flex-end; gap: 2px; height: 13px; }
.sound-bars i { width: 3px; border-radius: 2px; background: currentColor; transition: height 140ms ease; }
.sound-bars i:nth-child(1) { height: 6px; }
.sound-bars i:nth-child(2) { height: 13px; }
.sound-bars i:nth-child(3) { height: 9px; }
.sound-toggle[aria-pressed="true"] { color: var(--blue); }
.sound-toggle[aria-pressed="false"] .sound-bars i { height: 4px; }

.account { display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; }
.account-name { font-weight: 600; }
.account-rating { color: var(--ink-3); }

/* ---------------------------------------------------------------- buttons */
.btn {
  border: 0; border-radius: 100px; padding: 0.6rem 1.2rem; cursor: pointer;
  font-weight: 600; font-size: 0.93rem; line-height: 1.25; background: var(--sunk);
  color: var(--ink); transition: transform 120ms ease, background 140ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-blue { background: var(--blue); color: #fff; box-shadow: 0 6px 16px -8px var(--blue); }
.btn-blue:hover { background: color-mix(in srgb, var(--blue) 88%, #fff); }
.btn-dark { background: var(--ink); color: var(--card); }
.btn-dark:hover { background: var(--ink-2); }
.btn-plain { background: var(--sunk); color: var(--ink-2); }
.btn-plain:hover { background: var(--hair); color: var(--ink); }
.btn-wide { flex: 1; }
.btn-big { padding: 0.85rem 1.6rem; font-size: 1rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }

/* ---------------------------------------------------------------- shared */
.card { background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-md); padding: clamp(1rem, 2vw, 1.35rem); }
.card-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.7rem; }
.note { font-size: 0.87rem; color: var(--ink-3); line-height: 1.55; }

main { padding: clamp(0.25rem, 1vw, 0.75rem) var(--gutter) clamp(2rem, 5vw, 3.5rem); }

.table { display: grid; gap: clamp(1rem, 2.5vw, 1.5rem); align-items: start; max-width: var(--page); margin-inline: auto; }
@media (min-width: 980px) { .table { grid-template-columns: minmax(0, 1fr) 23rem; } }
/* the board fills its column, so the gap to the rail is the grid gap and nothing else */
.board-column { max-width: 640px; width: 100%; margin-inline: auto; }
@media (min-width: 980px) { .board-column { max-width: none; } }
.board-card { padding: clamp(0.9rem, 2vw, 1.25rem); }
.rail { display: grid; gap: clamp(0.75rem, 1.6vw, 1rem); }

/* ---------------------------------------------------------------- scoreline */
.scoreline { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 0.75rem; margin-bottom: 0.9rem; }
.side { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
/* fixed columns: red keeps the right edge even while the clock is hidden */
.side-blue { grid-column: 1; }
.scoreline .clock { grid-column: 2; }
.side-red { grid-column: 3; justify-content: flex-end; }
.side-dot { width: 11px; height: 11px; border-radius: 4px; flex: none; }
.side-blue .side-dot { background: var(--blue); }
.side-red .side-dot { background: var(--red); }
.side-name { font-weight: 500; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the display face, not the mono: a slashed zero reads badly as a score */
.side-score { font-variant-numeric: tabular-nums; font-size: clamp(1.55rem, 5vw, 2.1rem); font-weight: 600; line-height: 1; letter-spacing: -0.04em; }
.side.waiting { opacity: 0.4; }
.clock { font-size: 0.85rem; color: var(--ink-3); background: var(--sunk); padding: 0.2rem 0.65rem; border-radius: 100px; white-space: nowrap; }
.clock:empty { display: none; }
.clock.urgent { color: #fff; background: var(--red); }

/* ---------------------------------------------------------------- board */
.board-frame { position: relative; background: var(--sunk); padding: var(--gap-cell); border-radius: var(--r-md); }
.board { display: grid; grid-template-columns: repeat(var(--board-size, 4), minmax(0, 1fr)); gap: var(--gap-cell); }
.links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.cell {
  aspect-ratio: 1; border: 0; border-radius: var(--r-sm); padding: 0;
  background: var(--card); color: transparent;
  font-family: Outfit, sans-serif; font-weight: 600; letter-spacing: -0.04em;
  font-size: clamp(1.3rem, 6vw, 2.1rem);
  display: grid; place-items: center; cursor: default;
  box-shadow: inset 0 0 0 1px var(--hair);
}
.cell[data-own="0"] { background: var(--blue); color: #fff; box-shadow: var(--lift-tile); }
.cell[data-own="1"] { background: var(--red); color: #fff; box-shadow: var(--lift-tile); }
.cell:not([data-own]) { transition: background 130ms ease, box-shadow 130ms ease; }
.cell.playable { cursor: pointer; background: var(--blue-soft); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--blue) 35%, transparent); }
.cell.playable:hover { background: color-mix(in srgb, var(--blue) 20%, var(--card)); }
.cell.landed { animation: land 260ms cubic-bezier(0.2, 1.3, 0.4, 1); }

/* Tiles that just scored light up. A link glows in the owner's own colour, a
   completed rung in amber, because a rung is the bigger event and deserves to
   look like one. The glow fades in rather than snapping, so it reads as a
   consequence of the move instead of part of the tile. */
.cell { transition: box-shadow 240ms ease; }
.cell.linked { position: relative; z-index: 1; }
.cell.linked[data-own="0"] {
  box-shadow: var(--lift-tile), 0 0 0 2px color-mix(in srgb, var(--blue) 30%, transparent),
              0 0 8px 1px color-mix(in srgb, var(--blue) 25%, transparent);
}
.cell.linked[data-own="1"] {
  box-shadow: var(--lift-tile), 0 0 0 2px color-mix(in srgb, var(--red) 30%, transparent),
              0 0 8px 1px color-mix(in srgb, var(--red) 25%, transparent);
}
.cell.runged {
  position: relative; z-index: 2;
  box-shadow: var(--lift-tile), 0 0 0 2px var(--amber),
              0 0 10px 1px color-mix(in srgb, var(--amber) 30%, transparent);
}
.cell.correct { box-shadow: var(--lift-tile), 0 0 0 3px var(--green); }
.cell.mistake { box-shadow: inset 0 0 0 3px var(--red); }
.cell.pointed { box-shadow: inset 0 0 0 3px var(--amber); }
@keyframes land { from { transform: scale(0.72); } to { transform: scale(1); } }

/* ---------------------------------------------------------------- hand */
/* inset like the board frame, so each tile sits under its column */
.hand { display: grid; grid-template-columns: repeat(var(--tile-count, 4), minmax(0, 1fr)); gap: var(--gap-cell); margin-top: var(--gap-cell); padding-inline: var(--gap-cell); }
.chip {
  border: 0; border-radius: var(--r-sm); background: var(--sunk); cursor: pointer;
  padding: 0.55rem 0 0.45rem; display: grid; justify-items: center; gap: 1px;
  box-shadow: inset 0 0 0 1px var(--hair);
  transition: transform 120ms ease, background 130ms ease, box-shadow 130ms ease;
}
.chip-value { font-weight: 600; font-size: 1.4rem; letter-spacing: -0.04em; line-height: 1.1; }
.chip-left { font-size: 0.68rem; color: var(--ink-3); }
.chip:hover:not(:disabled) { transform: translateY(-2px); }
.chip[aria-pressed="true"] { background: var(--blue); color: #fff; box-shadow: var(--lift-tile); }
.chip[aria-pressed="true"] .chip-left { color: rgba(255, 255, 255, 0.8); }
.chip:disabled { opacity: 0.35; cursor: not-allowed; }

.status { margin-top: 0.9rem; font-size: 0.92rem; color: var(--ink-3); min-height: 2.7em; }
.status strong { color: var(--ink); font-weight: 600; }
.status .gain { color: var(--blue); font-weight: 500; }

/* ---------------------------------------------------------------- timer */
/* A bar that drains, because a number alone is easy to miss mid game. */
.timer { height: 4px; border-radius: 100px; background: var(--hair); margin-top: 0.85rem; overflow: hidden; }
.timer-fill { height: 100%; width: 100%; background: var(--blue); border-radius: 100px; transition: width 200ms linear; }
.timer.urgent .timer-fill { background: var(--red); }

/* ---------------------------------------------------------------- stats */
.stat-grid { display: grid; gap: clamp(0.75rem, 1.6vw, 1rem); max-width: var(--page); margin: 0 auto; }
@media (min-width: 760px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1180px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.big-figure { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.75rem; }
.big-figure span:first-child { font-size: 2.6rem; font-weight: 600; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.big-figure-unit { font-size: 0.85rem; color: var(--ink-3); }
.facts { display: grid; gap: 0.4rem; margin: 0; font-size: 0.88rem; }
.facts div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0; border-top: 1px solid var(--hair); }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; font-weight: 600; }
.progress { height: 6px; border-radius: 100px; background: var(--hair); overflow: hidden; margin-bottom: 0.6rem; }
.progress-fill { height: 100%; background: var(--green); border-radius: 100px; transition: width 300ms ease; }
.recent-card { max-width: var(--page); margin: clamp(0.75rem, 1.6vw, 1rem) auto 0; }
.result-win { color: var(--green); font-weight: 600; }
.result-loss { color: var(--red); font-weight: 600; }
.result-draw { color: var(--ink-3); font-weight: 600; }

/* ---------------------------------------------------------------- rail */
.control { display: grid; gap: 0.3rem; margin-top: 0.6rem; }
.control label { font-size: 0.8rem; color: var(--ink-3); }
select, input[type="text"], input[type="password"] {
  border: 0; box-shadow: inset 0 0 0 1px var(--hair); border-radius: var(--r-sm);
  background: var(--sunk); padding: 0.6rem 0.7rem; width: 100%; font-size: 0.93rem;
}
select:hover, input:hover { box-shadow: inset 0 0 0 1px var(--ink-3); }

.log, .review { display: grid; gap: 0.1rem; max-height: 14rem; overflow-y: auto; font-size: 0.86rem; }
.log li, .review li { display: grid; grid-template-columns: 1.5rem 1fr auto; gap: 0.5rem; align-items: center; padding: 0.28rem 0.4rem; border-radius: 8px; }
.log li:nth-child(odd), .review li:nth-child(odd) { background: var(--sunk); }
.log-no, .rv-no { color: var(--ink-3); font-size: 0.78rem; }
.log-gain, .rv-grade { font-weight: 500; }
.log li[data-seat="0"] .log-who { color: var(--blue); font-weight: 600; }
.log li[data-seat="1"] .log-who { color: var(--red); font-weight: 600; }
.review li[data-kind="best"] .rv-grade { color: var(--green); }
.review li[data-kind="slip"] .rv-grade { color: var(--amber); }
.review li[data-kind="blunder"] .rv-grade { color: var(--red); }

.scoring { display: grid; gap: 0.6rem; font-size: 0.87rem; color: var(--ink-3); }
.scoring li { display: grid; grid-template-columns: 2.6rem 1fr; gap: 0.65rem; align-items: center; }
.pts { font-size: 0.8rem; text-align: center; padding: 0.15rem 0; border-radius: 100px; }
.pts-one { background: var(--blue-soft); color: var(--blue); }
.pts-two { background: var(--blue); color: #fff; }
.pts-rung { background: var(--amber); color: #3A2600; }

.card-review .accuracy { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.25rem; }
.accuracy span:first-child { font-size: 2.7rem; font-weight: 600; line-height: 1; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.accuracy-unit { font-size: 0.8rem; color: var(--ink-3); }

.pz-index { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pz-index button {
  border: 0; box-shadow: inset 0 0 0 1px var(--hair); border-radius: 9px; background: var(--sunk);
  width: 2.1rem; height: 2.1rem; cursor: pointer; 
  font-size: 0.8rem; color: var(--ink-3); transition: transform 110ms ease;
}
.pz-index button:hover { transform: translateY(-2px); color: var(--ink); }
.pz-index button[aria-pressed="true"] { background: var(--blue); color: #fff; box-shadow: none; }
.pz-index button.solved { background: var(--green); color: #fff; box-shadow: none; }

/* ---------------------------------------------------------------- hero */
.hero { max-width: 60rem; margin: 0 auto clamp(2.5rem, 6vw, 4rem); padding-top: clamp(1rem, 4vw, 3rem); text-align: center; }
.hero-tight { margin-bottom: 1.5rem; }
.hero-kicker { color: var(--ink-3); font-size: 0.95rem; margin-bottom: 1rem; }
.hero-title { font-size: clamp(2.2rem, 1rem + 6vw, 4.6rem); font-weight: 600; letter-spacing: -0.045em; }
.hero-title.small { font-size: clamp(2rem, 1rem + 4vw, 3.2rem); }
.hero-lede { margin: 1.25rem auto 0; max-width: 44ch; color: var(--ink-2); font-size: clamp(1rem, 0.95rem + 0.4vw, 1.2rem); }
.hero-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; margin-top: 1.75rem; }

/* the tiles are the graphic language, so they sit in the sentence itself */
.tile-row { display: inline-flex; gap: 0.22em; vertical-align: -0.16em; margin: 0 0.14em; }
.tile-inline {
  display: inline-grid; place-items: center; width: 1.05em; height: 1.05em;
  border-radius: 0.26em; color: #fff; font-weight: 600; font-size: 0.84em;
  box-shadow: var(--lift-tile);
}
.tile-inline.blue { background: var(--blue); }
.tile-inline.red { background: var(--red); }
.tile-inline.big { vertical-align: -0.14em; }

/* ---------------------------------------------------------------- beats */
.beats { display: grid; gap: clamp(1rem, 2.5vw, 1.5rem); max-width: var(--page); margin: 0 auto clamp(2.5rem, 6vw, 4rem); }
@media (min-width: 720px) { .beats { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1060px) { .beats { grid-template-columns: repeat(4, 1fr); } }
.beat { display: grid; gap: 0.85rem; align-content: start; }
.beat h2 { font-size: 1.12rem; }
.beat p { color: var(--ink-3); font-size: 0.9rem; }
.beat strong { color: var(--ink); font-weight: 600; }

.mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; background: var(--sunk); padding: 6px; border-radius: var(--r-sm); width: min(11rem, 100%); }
.mini span { aspect-ratio: 1; background: var(--card); border-radius: 6px; display: grid; place-items: center; color: transparent; font-weight: 600; font-size: 0.85rem; box-shadow: inset 0 0 0 1px var(--hair); }
.mini span[data-own="0"] { background: var(--blue); color: #fff; box-shadow: var(--lift-tile); }
.mini span[data-own="1"] { background: var(--red); color: #fff; box-shadow: var(--lift-tile); }

/* ---------------------------------------------------------------- split */
.split { display: grid; gap: clamp(1.25rem, 3vw, 2.5rem); max-width: var(--page); margin: 0 auto clamp(2.5rem, 6vw, 4rem); }
@media (min-width: 900px) { .split { grid-template-columns: 22rem minmax(0, 1fr); } }
.section-title { font-size: clamp(1.6rem, 1rem + 2vw, 2.3rem); font-weight: 600; }
.split-lead { display: grid; gap: 0.75rem; align-content: start; }
.split-body { display: grid; gap: 1rem; }
.idea { display: grid; gap: 0.4rem; background: var(--sunk); border-radius: var(--r-md); padding: clamp(1rem, 2vw, 1.4rem); }
.idea h3 { font-size: 1.05rem; }
.idea p { color: var(--ink-2); font-size: 0.93rem; }

.ranks { max-width: 34rem; margin: 0 auto; display: grid; gap: 0.8rem; }
table { border-collapse: collapse; width: 100%; }
.tiers, .standings { font-size: 0.92rem; }
th { text-align: left; font-size: 0.75rem; font-weight: 500; color: var(--ink-3); padding-bottom: 0.6rem; border-bottom: 1px solid var(--hair); }
td { padding: 0.55rem 0; border-bottom: 1px solid var(--hair); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr.you td { color: var(--blue); font-weight: 600; }
.standings td:nth-child(2) { font-weight: 600; }

/* ---------------------------------------------------------------- dialog */
.sheet { border: 0; border-radius: var(--r-lg); padding: clamp(1.4rem, 3vw, 2rem); background: var(--card); color: var(--ink); width: min(25rem, calc(100vw - 2rem)); box-shadow: var(--lift); }
.sheet::backdrop { background: rgba(12, 15, 22, 0.45); }
.sheet h2 { font-size: 1.5rem; margin-bottom: 0.35rem; }
.sheet-close-form { position: absolute; top: 0.7rem; right: 0.9rem; }
.sheet-close { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--ink-3); }
.form-error { color: var(--red); font-size: 0.86rem; min-height: 1.3em; margin-top: 0.6rem; }

.footer { display: flex; align-items: center; gap: 0.7rem; padding: clamp(1.25rem, 3vw, 2rem) max(var(--gutter), calc((100% - var(--page)) / 2)); border-top: 1px solid var(--hair); color: var(--ink-3); font-size: 0.87rem; }

@media (max-width: 780px) {
  .masthead { flex-wrap: wrap; row-gap: 0.6rem; }
  .nav { order: 3; width: 100%; justify-content: space-between; overflow-x: auto; }
  .masthead-end { margin-left: auto; }
  #soundLabel { display: none; }
  .live-more { display: none; }
  .hero-title { letter-spacing: -0.035em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .btn:hover, .chip:hover, .pz-index button:hover { transform: none; }
}

.cell.blocked { background: var(--sunk); color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--hair); cursor: not-allowed; opacity: 0.65; }

/* ---------------------------------------------------------------- live */
/* Who is here right now. The dot only breathes when somebody is. */
.live {
  display: inline-flex; align-items: center; gap: 0.55rem; border: 0; cursor: pointer;
  background: var(--sunk); color: var(--ink-3); font-size: 0.84rem; line-height: 1.2;
  padding: 0.38rem 0.85rem 0.38rem 0.7rem; border-radius: 100px; white-space: nowrap;
  transition: background 140ms ease, color 140ms ease;
}
.live:hover { background: var(--hair); color: var(--ink-2); }
.live b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; display: inline-block; }
.live b.bump { animation: bump 520ms ease; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.live.is-live .live-dot { background: var(--green); animation: pulse 2.4s ease-out infinite; }
.live-more::before { content: "\00B7"; margin-right: 0.55rem; color: var(--ink-3); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); }
  70%, 100% { box-shadow: 0 0 0 7px transparent; }
}
@keyframes bump { 35% { color: var(--blue); transform: translateY(-2px); } }

/* ---------------------------------------------------------------- pools */
.pools { display: grid; gap: 0.35rem; margin-top: 0.8rem; }
.pool {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.6rem;
  width: 100%; border: 0; text-align: left; cursor: pointer; background: var(--sunk);
  border-radius: var(--r-sm); padding: 0.5rem 0.7rem; font-size: 0.85rem;
  box-shadow: inset 0 0 0 1px transparent; transition: box-shadow 130ms ease;
}
.pool:hover:not(:disabled) { box-shadow: inset 0 0 0 1px var(--ink-3); }
.pool[aria-pressed="true"] { background: var(--blue-soft); box-shadow: inset 0 0 0 1.5px var(--blue); }
.pool:disabled { cursor: default; opacity: 0.6; }
.pool-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pool-meta { color: var(--ink-3); font-size: 0.78rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pool-meta .hot { color: color-mix(in srgb, var(--green) 80%, var(--ink)); font-weight: 600; }

/* ---------------------------------------------------------------- result */
/* The end of a game is the start of the next one, so the button to go again
   sits exactly where the eye already is. */
.result {
  display: grid; gap: 0.85rem; margin-top: 0.3rem; padding-top: 1rem; border-top: 1px solid var(--hair);
  animation: rise 340ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.result .actions { margin-top: 0; }
.result-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; }
.result-title { font-size: clamp(1.35rem, 1rem + 1.4vw, 1.8rem); font-weight: 600; letter-spacing: -0.035em; line-height: 1.1; }
.result-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pill {
  display: inline-flex; align-items: center; font-size: 0.79rem; font-weight: 600; line-height: 1.3;
  padding: 0.22rem 0.65rem; border-radius: 100px; background: var(--sunk); color: var(--ink-2);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.pill.up { background: color-mix(in srgb, var(--green) 16%, var(--card)); color: color-mix(in srgb, var(--green) 72%, var(--ink)); }
.pill.down { background: color-mix(in srgb, var(--red) 14%, var(--card)); color: color-mix(in srgb, var(--red) 78%, var(--ink)); }
.pill.gold { background: var(--amber); color: #3A2600; }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
@keyframes rise { from { opacity: 0.35; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.climb { display: grid; gap: 0.35rem; }
.climb-labels { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.climb-labels strong { color: var(--ink); font-weight: 600; }
.climb .progress, .standing .progress { height: 8px; margin: 0; }
.climb-fill { background: var(--blue); transition: width 900ms cubic-bezier(0.2, 0.8, 0.2, 1); }

/* ---------------------------------------------------------------- today */
.today-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.55rem; }
.today-head .card-title { margin-bottom: 0; }
.streak {
  font-size: 0.78rem; font-weight: 600; color: #3A2600; background: var(--amber);
  padding: 0.14rem 0.6rem; border-radius: 100px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.goals { display: grid; gap: 0.15rem; margin-inline: -0.45rem; }
.goal {
  display: grid; grid-template-columns: 1.35rem minmax(0, 1fr) auto; align-items: center; gap: 0.65rem;
  width: 100%; border: 0; background: none; text-align: left; cursor: pointer; color: var(--ink);
  padding: 0.42rem 0.45rem; border-radius: var(--r-sm); font-size: 0.9rem;
}
.goal:hover { background: var(--sunk); }
/* the checkbox is a tile, the same shape as everything you play with */
.goal-mark { width: 1.35rem; height: 1.35rem; border-radius: 7px; box-shadow: inset 0 0 0 1.5px var(--hair); display: grid; place-items: center; transition: background 200ms ease; }
.goal-count { font-size: 0.8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.goal.done .goal-mark { background: var(--green); box-shadow: var(--lift-tile); }
.goal.done .goal-mark::after {
  content: ""; width: 0.5rem; height: 0.27rem; border: solid #fff; border-width: 0 0 2px 2px;
  transform: translateY(-1px) rotate(-45deg);
}
.goal.done .goal-label { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--hair); }
.goal.just .goal-mark { animation: land 420ms cubic-bezier(0.2, 1.3, 0.4, 1); }
.today .note { margin-top: 0.55rem; }

/* ---------------------------------------------------------------- ladder */
.ladder { max-width: var(--page); margin: 0 auto; display: grid; gap: clamp(0.75rem, 1.6vw, 1rem); }
.standing { display: grid; gap: 1rem; align-items: center; padding: clamp(1.1rem, 2.4vw, 1.6rem); }
@media (min-width: 860px) { .standing { grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 2.25rem; } }
.standing:empty { display: none; }
.standing h2 { font-size: clamp(1.25rem, 1rem + 1vw, 1.55rem); }
.standing .actions { margin-top: 0; }
.standing-rank { display: flex; align-items: baseline; gap: 0.45rem; }
.standing-rank strong { font-size: clamp(2.6rem, 2rem + 2.5vw, 3.7rem); font-weight: 600; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.standing-rank span { color: var(--ink-3); font-size: 0.9rem; }
.standing-body { display: grid; gap: 0.5rem; min-width: 0; }
.standing-title { font-size: 1.12rem; font-weight: 600; letter-spacing: -0.02em; }
.standing-body .note strong { color: var(--ink); font-weight: 600; }

.podium { display: grid; gap: clamp(0.75rem, 1.6vw, 1rem); }
@media (min-width: 720px) {
  .podium { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; }
  .podium .place-1 { order: 2; }
  .podium .place-2 { order: 1; }
  .podium .place-3 { order: 3; }
}
.place { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0.9rem; }
.place-1 { padding-block: clamp(1.25rem, 3vw, 1.9rem); }
.place.you { box-shadow: inset 0 0 0 2px var(--blue); }
.place-tile {
  width: 3rem; height: 3rem; border-radius: 12px; display: grid; place-items: center; color: #fff;
  font-weight: 600; font-size: 1.35rem; letter-spacing: -0.04em; box-shadow: var(--lift-tile);
  font-variant-numeric: tabular-nums;
}
.place-1 .place-tile { background: var(--amber); color: #3A2600; width: 3.7rem; height: 3.7rem; font-size: 1.7rem; border-radius: 14px; }
.place-2 .place-tile { background: var(--blue); }
.place-3 .place-tile { background: var(--red); }
.place-name { font-weight: 600; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-meta { font-size: 0.85rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.ladder-main { display: grid; gap: clamp(0.75rem, 1.6vw, 1rem); align-items: start; }
@media (min-width: 900px) { .ladder-main { grid-template-columns: minmax(0, 1fr) 19rem; } }
.ladder-side { display: grid; gap: clamp(0.75rem, 1.6vw, 1rem); }
.tabs { display: inline-flex; gap: 0.2rem; background: var(--sunk); padding: 0.22rem; border-radius: 100px; margin-bottom: 0.9rem; }
.tabs button {
  border: 0; background: none; cursor: pointer; padding: 0.35rem 0.95rem; border-radius: 100px;
  font-size: 0.87rem; font-weight: 500; color: var(--ink-2);
}
.tabs button[aria-selected="true"] { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 18, 24, 0.14); }
.table-scroll { overflow-x: auto; }
.standings th, .standings td { padding-inline: 0.45rem; }
.standings th:first-child, .standings td:first-child { padding-left: 0; }
.standings th:last-child, .standings td:last-child { padding-right: 0; }
.player-cell { display: grid; gap: 0.05rem; min-width: 0; }
.player-cell small { font-size: 0.76rem; color: var(--ink-3); font-weight: 400; }
tbody tr.you .player-cell small { color: color-mix(in srgb, var(--blue) 70%, var(--ink-3)); }
.gain-up { color: color-mix(in srgb, var(--green) 72%, var(--ink)); font-weight: 600; }
tr.gap-row td { text-align: center; color: var(--ink-3); padding-block: 0.15rem; letter-spacing: 0.3em; }
.empty { display: grid; gap: 0.3rem; justify-items: start; padding: 0.5rem 0; }
.empty strong { font-size: 1rem; font-weight: 600; }
.active-list { display: grid; }
.active-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem; padding: 0.42rem 0; border-bottom: 1px solid var(--hair); font-size: 0.9rem; }
.active-list li:last-child { border-bottom: 0; }
.active-list li span:last-child { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.active-list li.you span:first-child { color: var(--blue); font-weight: 600; }

/* ---------------------------------------------------------------- segmented */
/* Choices you can see at once, instead of dropdowns and paragraphs about them. */
.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.2rem;
  background: var(--sunk); padding: 0.22rem; border-radius: 12px;
}
.seg button {
  border: 0; background: none; cursor: pointer; border-radius: 9px; padding: 0.5rem 0.4rem;
  font-size: 0.88rem; font-weight: 500; color: var(--ink-2); white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 18, 24, 0.14); }
.seg[data-locked] button { cursor: not-allowed; }
.seg[data-locked] button:not([aria-checked="true"]) { opacity: 0.45; }
.seg-opponent { padding: 0.28rem; border-radius: 14px; }
.seg-opponent button { padding: 0.72rem 0.4rem; font-size: 0.94rem; }
/* ranked is the one choice that gets the colour */
.seg-opponent button[data-value="online"][aria-checked="true"] { background: var(--blue); color: #fff; box-shadow: 0 6px 16px -8px var(--blue); }
.seg-live { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; font-weight: 600; font-variant-numeric: tabular-nums; opacity: 0.9; }
.seg-live .live-dot { width: 6px; height: 6px; background: var(--green); }
.control-label { font-size: 0.78rem; color: var(--ink-3); }
.control-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }

.switch { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.8rem; font-size: 0.85rem; color: var(--ink-2); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 2.1rem; height: 1.2rem; border-radius: 100px; background: var(--hair); flex: none; transition: background 160ms ease; }
.switch-track::after {
  content: ""; position: absolute; top: 0.15rem; left: 0.15rem; width: 0.9rem; height: 0.9rem; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(15, 18, 24, 0.25); transition: transform 160ms ease;
}
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { transform: translateX(0.9rem); }
.switch input:focus-visible + .switch-track { outline: 2.5px solid var(--blue); outline-offset: 2px; }

/* ---------------------------------------------------------------- faces */
.face { position: relative; display: inline-grid; place-items: center; flex: none; width: 2rem; height: 2rem; border-radius: 50%; background: var(--sunk); overflow: hidden; }
.face img { width: 100%; height: 100%; display: block; }
.face-xs { width: 1.4rem; height: 1.4rem; }
.face-sm { width: 1.8rem; height: 1.8rem; }
.face-lg { width: 2.7rem; height: 2.7rem; }
.face-xl { width: 4.2rem; height: 4.2rem; }
.face-bot { background: var(--ink); }
.face-bot i { position: absolute; width: 42%; height: 42%; border-radius: 28%; }
.face-bot i:first-child { left: 17%; top: 17%; background: var(--blue); }
.face-bot i:last-child { right: 17%; bottom: 17%; background: var(--red); }
.face-slot { display: inline-flex; flex: none; padding: 3px; }
.side-blue .face { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--blue); }
.side-red .face { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--red); }
.player { display: inline-flex; align-items: center; gap: 0.55rem; min-width: 0; }

.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.4rem, 1fr)); gap: 0.55rem; margin-top: 1rem; }
.avatar-option {
  border: 0; background: var(--sunk); border-radius: 50%; padding: 0; cursor: pointer; aspect-ratio: 1;
  display: grid; place-items: center; overflow: hidden; transition: transform 120ms ease, box-shadow 120ms ease;
}
.avatar-option:hover { transform: translateY(-2px); }
.avatar-option[aria-checked="true"] { box-shadow: 0 0 0 3px var(--blue); }
.avatar-option .face { width: 100%; height: 100%; background: none; }
.sheet-wide { width: min(30rem, calc(100vw - 2rem)); }

.profile-head { max-width: var(--page); margin: clamp(0.5rem, 2vw, 1.5rem) auto 1.25rem; display: flex; align-items: center; gap: 1rem; }
.profile-head > div { display: grid; gap: 0.15rem; }
.profile-head .btn { margin-left: auto; }
.profile-name { font-size: clamp(1.6rem, 1rem + 2vw, 2.3rem); }
.face-edit { position: relative; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.face-edit:hover .face { box-shadow: 0 0 0 3px var(--blue); }
.face-edit-badge { position: absolute; right: -0.25rem; bottom: -0.1rem; font-size: 0.68rem; font-weight: 600; background: var(--ink); color: var(--card); padding: 0.1rem 0.45rem; border-radius: 100px; }

/* ---------------------------------------------------------------- ladder, lighter */
.standing { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem; }
.standing-body { flex: 1 1 16rem; }
.standing-rank { display: inline; font-size: 1.7rem; font-weight: 600; letter-spacing: -0.04em; margin-right: 0.35rem; font-variant-numeric: tabular-nums; }
.minis { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; font-size: 0.85rem; color: var(--ink-3); }
.minis b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.place { grid-template-columns: auto auto minmax(0, 1fr); }

/* ---------------------------------------------------------------- alignment */
/* The play card is one column with one gap, so every row is spaced the same. */
.play-card { display: grid; gap: 0.9rem; }
.play-card .control, .play-card .actions, .play-card .switch, .play-card .pools { margin: 0; }
.play-card .control { gap: 0.4rem; }
#lobbyNote:empty { display: none; }
/* two result buttons share the row evenly; one takes all of it */
.result .actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
#logBlock:has(.log:empty) { display: none; }
.scoring-note { margin-top: 0.8rem; }
.face { font-size: 0.85rem; font-weight: 600; line-height: 1; color: var(--ink-2); }
.face-xs { font-size: 0.62rem; }
.face-sm { font-size: 0.74rem; }
.face-lg { font-size: 1.05rem; }
.face-xl { font-size: 1.55rem; }
@media (max-width: 1100px) { .live-more { display: none; } }

/* Small alignment refinements shared by the play and puzzle boards. */
.table > *, .rail > *, .control-pair > * { min-width: 0; }
.scoreline { grid-template-columns: minmax(0, 1fr) 3.5rem minmax(0, 1fr); padding-inline: var(--gap-cell); gap: 0.65rem; }
.side-blue { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
.side-red { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
.side-red .side-name { text-align: right; }
.side-score { min-width: 2ch; text-align: center; }
.scoreline .clock { justify-self: center; text-align: center; min-width: 3.2rem; }
.scoreline .clock:empty { display: block; visibility: hidden; }
.hand { margin-inline: 0; }
#draftNote { margin: 0.75rem var(--gap-cell) 0; }
.status { padding-inline: var(--gap-cell); line-height: 1.5; }
.control-label { line-height: 1.3; }
.seg button { min-height: 2.5rem; min-width: 0; }
.play-card .control-pair { gap: 0.75rem; }
.rail { gap: 1rem; }
.rail .card-title { line-height: 1.3; }
.scoring { align-items: start; }
.sheet .actions > .btn { min-height: 2.75rem; }

/* Account controls share equal columns, including the two recovery actions. */
#authForm .actions, .account-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
#authForm .actions .btn, .account-links .btn { width: 100%; min-width: 0; min-height: 2.8rem; padding: 0.65rem 0.6rem; font-size: 0.88rem; }
#authForm .auth-help { margin-top: 0.6rem; }
#authMessage:empty, #authError:empty, #authChallenge:empty { display: none; }
.sheet { max-height: calc(100dvh - 2rem); overflow-y: auto; overscroll-behavior: contain; }
.sheet h2 { padding-right: 1rem; }
.sheet-close { min-width: 2rem; min-height: 2rem; }
.account-trigger { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.6rem; }
.nav button, .account-rating { white-space: nowrap; }
.account-links { margin-block: 1rem; }
.sheet textarea { width: 100%; resize: vertical; min-height: 5rem; padding: 0.7rem; background: var(--sunk); border: 1px solid var(--hair); border-radius: var(--r-sm); color: var(--ink); font: inherit; }
#profileForm { display: grid; gap: 0.75rem; padding-block: 0.3rem 1rem; border-bottom: 1px solid var(--hair); margin-bottom: 1rem; }
#profileForm > .btn { min-height: 2.8rem; }
#accountEmail { overflow-wrap: anywhere; }
#accountLogoutAll { width: 100%; }
.profile-bio { color: var(--ink-2); font-size: 0.95rem; white-space: pre-wrap; overflow-wrap: anywhere; margin-block: 0.35rem; }
.profile-bio:empty { display: none; }
.profile-head > div { min-width: 0; }
.profile-head .profile-name { overflow-wrap: anywhere; }
.social-card { max-width: var(--page); margin: 0 auto 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.social-card .card-title { margin-bottom: 0.2rem; }
.social-card > .btn { flex-shrink: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.6rem; }
.section-heading .card-title { margin-bottom: 0; }
#friendsSheet .section-heading { padding-right: 1.3rem; }
.friend-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.6rem; align-items: end; margin-top: 1rem; }
.friend-search .control { margin: 0; }
.friend-search .btn { min-height: 2.7rem; }
.friends-section { margin-top: 1.2rem; }
.friends-section h3 { font-size: 0.95rem; margin-bottom: 0.6rem; }
.friend-row { display: flex; justify-content: space-between; align-items: center; gap: 0.7rem; padding: 0.8rem 0; border-top: 1px solid var(--hair); }
.friend-info { display: grid; min-width: 0; gap: 0.25rem; }
.friend-identity { display: flex; align-items: center; gap: 0.5rem; border: 0; padding: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; overflow-wrap: anywhere; text-align: left; }
.friend-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.friend-actions .btn { font-size: 0.82rem; padding: 0.5rem 0.75rem; }
.player-heading { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1rem; }
.player-heading > div { min-width: 0; overflow-wrap: anywhere; }
.history-sheet { width: min(44rem, calc(100vw - 2rem)); }
.history-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--hair); }
.history-row > div { min-width: 0; overflow-wrap: anywhere; }
.history-result { text-align: right; font-weight: 600; white-space: nowrap; }
.history-meta { display: block; font-size: 0.74rem; font-weight: 400; color: var(--ink-3); margin-top: 0.2rem; }
#recentRows td { overflow-wrap: anywhere; }
#recentRows .btn { font-size: 0.8rem; padding: 0.45rem 0.55rem; }
#moreHistory { width: 100%; margin-top: 1rem; }
.replay-board { gap: 0.45rem; margin-block: 0.7rem; }
.replay-board .cell { font-size: 1.55rem; }
.replay-scores { display: flex; justify-content: space-between; gap: 0.7rem; margin-top: 1rem; font-weight: 600; overflow-wrap: anywhere; }
.replay-blue { color: var(--blue); }
.replay-red { color: var(--red); text-align: right; }
@media (max-width: 520px) {
  .social-card { align-items: stretch; flex-direction: column; }
  .profile-head { flex-wrap: wrap; gap: 0.7rem; }
  .profile-head > div { flex: 1; }
  .profile-head > .btn { width: 100%; margin-left: 0; }
  .history-row { grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem; }
  .history-row > .btn { grid-column: 1 / -1; }
  .friend-row { align-items: flex-start; flex-wrap: wrap; }
  .friend-actions { margin-left: auto; }
  #recentCard { padding-inline: 0.6rem; }
  #recentCard th, #recentCard td { padding-inline: 0.3rem; font-size: 0.8rem; }
}
@media (min-width: 781px) and (max-width: 1350px) {
  .account-rating { display: none; }
  .masthead { column-gap: 0.75rem; }
  .masthead-end { gap: 0.5rem; }
}
@media (max-width: 359px) {
  #authForm .actions .btn, .account-links .btn { font-size: 0.8rem; min-height: 3.15rem; }
  .friend-search { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 979px) {
  .table { max-width: 640px; }
}
@media (max-width: 780px) {
  .masthead { gap: 0.75rem; }
  .nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; gap: 0.2rem; overflow: visible; }
  .nav-link { min-width: 0; min-height: 2.75rem; padding: 0.4rem 0.15rem; font-size: 0.78rem; line-height: 1.2; border-radius: 12px; }
  .masthead-end { gap: 0.4rem; }
  .account { min-width: 0; gap: 0.35rem; }
  .account-name { max-width: 6.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .account-rating { display: none; }
  .scoreline { gap: 0.25rem; grid-template-columns: minmax(0, 1fr) 2.8rem minmax(0, 1fr); }
  .scoreline .clock { min-width: 2.6rem; padding-inline: 0.3rem; font-size: 0.75rem; }
  .side { gap: 0.35rem; }
  .side-score { min-width: 1.5ch; font-size: 1.5rem; }
  .side-name { font-size: 0.82rem; }
  .face-slot .face { width: 1.5rem; height: 1.5rem; }
}
@media (max-width: 380px) {
  .masthead-end .live, .seg-opponent .seg-live { display: none; }
  .scoreline .face-slot { display: none; }
  .side-blue { grid-template-columns: minmax(0, 1fr) auto; }
  .side-red { grid-template-columns: auto minmax(0, 1fr); }
}

/* the current picture, rolled again on click */
.avatar-shuffle { position: relative; overflow: visible; }
.avatar-shuffle .face { border-radius: 50%; overflow: hidden; }
.avatar-shuffle-badge {
  position: absolute; left: 50%; bottom: -0.35rem; transform: translateX(-50%);
  font-size: 0.66rem; font-weight: 600; line-height: 1; padding: 0.18rem 0.45rem; border-radius: 100px;
  background: var(--blue); color: #fff; white-space: nowrap;
}

/* what the sign in button is waiting for */
.challenge-note { margin-top: 0.6rem; }
.challenge-note[data-state="error"] { color: var(--red); }
.link-button { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--blue); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* Continue with Google: the familiar G on a plain surface, in both themes */
.auth-google { display: grid; gap: 0.85rem; margin-top: 1rem; }
.btn-google {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.65rem; width: 100%;
  text-decoration: none; background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink-3);
}
.btn-google:hover { background: var(--sunk); }
.btn-google svg { width: 18px; height: 18px; flex: none; }
.auth-or { display: flex; align-items: center; gap: 0.75rem; color: var(--ink-3); font-size: 0.8rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--hair); }
