/* crosskink — sultry, dark, editorial. Deep plum + ember accent. Phone-first. */
:root {
  --bg: #14090f;
  --bg-raise: #1e0f18;
  --panel: #241019;
  --ink: #f3e7ec;
  --ink-dim: #b59aa6;
  --line: #3a1f2c;
  --accent: #e0577f;
  --accent-deep: #b23a5e;
  --gold: #e7b16b;
  --cell: #f3e7ec;
  --cell-ink: #1a0c12;
  --cell-active: #ffd9a8;
  --cell-word: #f6c9d6;
  --good: #1f8a4c;
  --bad: #ff6b6b;
  --radius: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  --dock-h: 64px; /* updated from JS to the dock's real height */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
}

/* `hidden` must always win: several components set display:flex, which would
   otherwise override it (an invisible splash then swallows every tap). */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, #3a1220 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 20%, #2a0f2e 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  min-height: 100dvh;
  /* No double-tap zoom or tap flashes: it should feel like an app. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  font-size: 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-raise);
  color: var(--ink);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s;
  -webkit-user-select: none;
  user-select: none;
}
button:hover {
  border-color: var(--accent-deep);
}
button:active {
  transform: translateY(1px);
}
button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  border-color: transparent;
  color: #240912;
  font-weight: 600;
}
button.ghost {
  background: transparent;
  color: var(--ink-dim);
}
button.small {
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
}

/* ── header ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  flex-wrap: wrap;
  padding: max(0.8rem, var(--safe-top)) max(1.5rem, var(--safe-right)) 0.8rem
    max(1.5rem, var(--safe-left));
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(30, 15, 24, 0.95), rgba(20, 9, 15, 0.8));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.brandrow {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.brand {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 2rem;
  margin: 0;
  letter-spacing: 0.5px;
}
.brand span {
  color: var(--accent);
  font-style: italic;
}

.date {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--ink-dim);
}

/* Phone-only: collapsed spice/difficulty switcher (see the 600px media query). */
.variant-pill {
  display: none;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  min-width: 4.2rem;
}
.timer.stopped {
  color: var(--gold);
  border-color: var(--gold);
}

.controls {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  background: var(--bg-raise);
}
.seg button {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 0.4rem 1rem;
  color: var(--ink-dim);
}
.seg button.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #240912;
  font-weight: 600;
}

/* ── layout ─────────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(300px, 460px);
  gap: 1.5rem;
  align-items: start;
  padding: 1.25rem max(1.5rem, var(--safe-right)) calc(var(--dock-h) + 1.5rem)
    max(1.5rem, var(--safe-left));
  max-width: 1200px;
  margin: 0 auto;
}

.board-pane {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.board-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.board-tools .spacer {
  flex: 1;
}
.status {
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.clear-wrap {
  position: relative;
}
.clear-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.3rem);
  z-index: 15;
  display: flex;
  flex-direction: column;
  min-width: 11rem;
  padding: 0.3rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.clear-menu button {
  margin: 0;
  border: none;
  background: transparent;
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  white-space: nowrap;
}
.clear-menu button:hover {
  background: var(--bg-raise);
}
.clear-menu button.danger {
  color: var(--bad);
}

.board-wrap {
  position: relative;
  /* JS caps the grid's width so its height fits above the dock; center it. */
  width: 100%;
  margin: 0 auto;
}

.grid {
  display: grid;
  gap: 2px;
  background: var(--line);
  padding: 2px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  /* Columns are set inline from the puzzle width; rows size to the (square)
     cells, so the grid's height always matches the puzzle exactly. */
  grid-auto-rows: auto;
  align-content: start;
  -webkit-user-select: none;
  user-select: none;
}
.grid.locked {
  filter: blur(9px);
}

.cell {
  position: relative;
  aspect-ratio: 1 / 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  line-height: 1;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: clamp(0.7rem, 3.4cqw, 1.2rem);
  color: var(--cell-ink);
  cursor: pointer;
  text-transform: uppercase;
}
.grid {
  container-type: inline-size;
}
.cell.block {
  background: transparent;
  cursor: default;
}
.cell.fillable {
  background: var(--cell);
}
.cell.in-word {
  background: var(--cell-word);
}
.cell.active {
  background: var(--cell-active);
  box-shadow: inset 0 0 0 2px var(--accent-deep);
}
.cell .num {
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: max(0.45rem, 1.6cqw);
  font-weight: 600;
  color: #6b4152;
  line-height: 1;
}
.cell.correct {
  color: var(--good);
}
.cell.wrong::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 45%, var(--bad) 46%, var(--bad) 54%, transparent 55%);
  opacity: 0.7;
}
/* Revealed letters get a small corner flag, NYT-style. */
.cell.revealed::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border-style: solid;
  border-width: 0 7px 7px 0;
  border-color: transparent var(--accent-deep) transparent transparent;
}
.cell.revealed .val {
  color: var(--accent-deep);
}

.paused {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: rgba(20, 9, 15, 0.55);
  border: none;
  border-radius: var(--radius);
  color: var(--ink);
}
.paused-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 2.2rem;
  font-style: italic;
}
.paused-sub {
  color: var(--ink-dim);
}

.solved-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.6rem 0.9rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
}

/* ── clue lists ─────────────────────────────────────────────────────────── */
.clues-pane {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}
.clue-col h2 {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.3rem;
  margin: 0 0 0.5rem;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.3rem;
}
.clue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: calc(100dvh - var(--dock-h) - 11rem);
  overflow: auto;
}
.clue-list li {
  display: flex;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  font-size: 0.92rem;
  line-height: 1.3;
  cursor: pointer;
  color: var(--ink-dim);
}
.clue-list li:hover {
  background: var(--bg-raise);
  color: var(--ink);
}
.clue-list li.active {
  background: var(--panel);
  color: var(--ink);
  outline: 1px solid var(--accent-deep);
}
.clue-list li.cross {
  color: var(--ink);
}
.clue-list li.done {
  color: #7a5c68;
  text-decoration: line-through;
}
.clue-list .cnum {
  color: var(--gold);
  font-weight: 600;
  min-width: 1.4rem;
  text-align: right;
}
.clue-list .spice-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 0.4rem;
  flex: 0 0 auto;
}
.spice-mild {
  background: #9ad;
}
.spice-spicy {
  background: var(--gold);
}
.spice-filthy {
  background: var(--accent);
}

/* ── dock: clue bar + on-screen keyboard ────────────────────────────────── */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 0.5rem max(0.75rem, var(--safe-right)) calc(0.5rem + var(--safe-bottom))
    max(0.75rem, var(--safe-left));
  background: linear-gradient(0deg, rgba(20, 9, 15, 0.98), rgba(30, 15, 24, 0.94));
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.cluebar {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  max-width: 900px;
  margin: 0 auto;
}
.cluebar .arrow {
  flex: 0 0 auto;
  width: 2.6rem;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0;
  background: var(--panel);
}
.active-clue {
  flex: 1;
  min-width: 0;
  min-height: 2.9rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-align: left;
  padding: 0.45rem 0.8rem;
  background: var(--panel);
  border-left: 3px solid var(--accent);
  font-size: 1rem;
  line-height: 1.25;
}
/* The clue text is capped at two lines so a long clue can't grow the dock
   (and push the grid under it) on small phones. When it's cut off, a chevron
   shows, and tapping opens the whole clue above the bar (.clue-full). */
.active-clue {
  position: relative;
}
.active-clue > .clue-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.active-clue.truncated {
  padding-right: 1.6rem;
}
.active-clue.truncated::after {
  content: "⌃";
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-40%);
  color: var(--accent);
  font-size: 1rem;
}
.active-clue.expanded::after {
  content: "⌄";
}

.clue-full {
  position: absolute;
  left: max(0.75rem, var(--safe-left));
  right: max(0.75rem, var(--safe-right));
  bottom: calc(100% + 0.4rem);
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  text-align: left;
  padding: 0.8rem 1rem;
  font-size: 1.05rem;
  line-height: 1.35;
  background: #2c1320;
  border: 1px solid var(--accent-deep);
  border-radius: 12px;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45);
  animation: rise-in 0.15s ease-out;
}
.clue-full .badge {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  white-space: nowrap;
}
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.active-clue .badge {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  white-space: nowrap;
}

.keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0.5rem auto 0;
  max-width: 640px;
}
.kb-row {
  display: flex;
  justify-content: center;
  gap: 5px;
}
.kb-row button {
  flex: 1 1 0;
  max-width: 3.4rem;
  height: 2.9rem;
  padding: 0;
  font-size: 1.1rem;
  font-weight: 600;
  background: #3a2230;
  border-color: #4a2c3c;
  border-radius: 6px;
}
.kb-row button:active,
.kb-row button.pressed {
  background: var(--accent-deep);
  transform: none;
}
.kb-row button.wide {
  flex: 1.6 1 0;
  max-width: 5rem;
  font-size: 1.2rem;
}

/* ── completion splash ──────────────────────────────────────────────────── */
.splash {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(1rem + var(--safe-top)) 1rem calc(1rem + var(--safe-bottom));
  background: radial-gradient(circle at 50% 40%, rgba(90, 20, 48, 0.85), rgba(10, 4, 8, 0.92));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.35s ease-out;
}
.confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.splash-card {
  position: relative;
  width: min(26rem, 100%);
  text-align: center;
  padding: 2rem 1.5rem 1.4rem;
  background: linear-gradient(180deg, #2c1320, #1c0c15);
  border: 1px solid #5a2a40;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(224, 87, 127, 0.15);
  animation: pop-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  animation-delay: 0.1s;
}
.splash-num {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}
.splash-title {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(2.2rem, 9vw, 3rem);
  line-height: 1.05;
  margin: 0.4rem 0 0.3rem;
  background: linear-gradient(135deg, #ffd1dd, var(--accent) 60%, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.splash-sub {
  margin: 0 0 1.2rem;
  color: var(--ink-dim);
}
.splash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.3rem;
}
.splash-stats div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.2rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.splash-stats b {
  font-size: 1.4rem;
  font-variant-numeric: tabular-nums;
}
.splash-stats span {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}
.splash-card button {
  display: block;
  width: 100%;
  margin-top: 0.55rem;
}
button.big {
  padding: 0.9rem;
  font-size: 1.05rem;
}
button.secondary {
  padding: 0.75rem;
  background: var(--panel);
}
button.link {
  background: none;
  border: none;
  color: var(--ink-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.splash-rank {
  margin: -0.4rem 0 1rem;
  color: var(--ink);
}
.splash-rank b {
  color: var(--gold);
}

/* ── ad slots (house ad until sponsors fill them) ───────────────────────── */
.ad-slot {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "label copy" "label cta";
  gap: 0.2rem 0.7rem;
  align-items: center;
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  text-align: left;
  text-decoration: none;
  color: var(--ink-dim);
  background: repeating-linear-gradient(135deg, rgba(231, 177, 107, 0.05) 0 10px, transparent 10px 20px), var(--bg-raise);
  border: 1px dashed #5a3a2c;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.35;
}
.ad-slot:hover {
  border-color: var(--gold);
}
.ad-slot.wide {
  grid-column: 1 / -1;
}
.ad-label {
  grid-area: label;
  align-self: start;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #1a0c12;
  background: var(--gold);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
}
.ad-copy {
  grid-area: copy;
}
.ad-copy b {
  color: var(--ink);
}
.ad-cta {
  grid-area: cta;
  color: var(--gold);
  font-weight: 600;
}

/* ── header icon button, clue-share button ──────────────────────────────── */
.icon-btn {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 1.05rem;
  line-height: 1.3;
}
.cluebar .arrow.share {
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

/* ── the Board sheet ────────────────────────────────────────────────────── */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  justify-content: flex-end;
  background: rgba(10, 4, 8, 0.6);
  animation: fade-in 0.2s ease-out;
}
.sheet-panel {
  width: min(30rem, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #221019, #170a11);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: max(1rem, var(--safe-top)) max(1rem, var(--safe-right)) 0 1rem;
  animation: slide-in 0.25s ease-out;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet-head h2 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 1.8rem;
  color: var(--accent);
}
.sheet-tabs {
  margin: 0.8rem 0;
}
.sheet-tabs button {
  flex: 1;
}
.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(1.5rem + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}
.sheet-body h3 {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.3rem;
  margin: 1.4rem 0 0.4rem;
  color: var(--accent);
}
.sheet-sub {
  color: var(--gold);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0.2rem 0 0.8rem;
}
.muted {
  color: var(--ink-dim);
}
.small {
  font-size: 0.8rem;
}
.center {
  text-align: center;
}
.rank-callout {
  font-size: 1.1rem;
}
.rank-callout b {
  color: var(--gold);
}

.lb {
  list-style: none;
  margin: 0;
  padding: 0;
}
.lb li {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--line);
}
.lb li.me {
  background: rgba(224, 87, 127, 0.12);
  border-radius: 6px;
}
.lb li.empty {
  color: var(--ink-dim);
  justify-content: center;
}
.lb-rank {
  width: 1.8rem;
  text-align: right;
  color: var(--gold);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.lb-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.lb-time small {
  color: var(--ink-dim);
  font-weight: 400;
}

.sheet-body button.big {
  display: block;
  width: 100%;
  margin-top: 0.8rem;
}

.card {
  padding: 0.9rem;
  margin-bottom: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.card.invite {
  border-color: var(--accent-deep);
}

.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  margin: 0.9rem 0;
}
.inline-form label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--ink-dim);
}
.inline-form input,
.toggle-row select {
  font: inherit;
  /* 16px+ keeps iOS Safari from zooming in when the field is focused. */
  font-size: 16px;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.circle-list {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
}
.circle-list button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  padding: 0.75rem 0.9rem;
  background: var(--panel);
  font-size: 1rem;
  text-align: left;
}
.circle-list small {
  color: var(--ink-dim);
}
.circle-name {
  margin-top: 0.4rem !important;
  font-size: 1.6rem !important;
}
button.back {
  padding: 0;
  font-size: 0.9rem;
}
button.danger {
  color: var(--bad);
  display: block;
  margin: 1rem auto 0;
}
.code {
  letter-spacing: 0.15em;
  color: var(--ink);
}

.duel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  margin: 0.6rem 0 0.3rem;
}
.duel div {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 5.5rem;
}
.duel b {
  font-size: 2.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums; /* the serif's old-style 0 reads as an O */
  color: var(--gold);
  line-height: 1.1;
}
.duel span {
  color: var(--ink-dim);
  font-size: 0.85rem;
  max-width: 7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.duel .vs {
  min-width: 0;
  color: var(--accent);
  font-style: italic;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.3rem;
}

.table-wrap {
  overflow-x: auto;
}
.circle-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.circle-table th {
  text-align: left;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding: 0.4rem 0.3rem;
  border-bottom: 1px solid var(--line);
}
.circle-table td {
  padding: 0.55rem 0.3rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.circle-table tr.me td {
  color: var(--ink);
  font-weight: 600;
}
.circle-table small {
  color: var(--ink-dim);
}
.circle-table .ok {
  color: #6fcf97;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.stat-grid div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.7rem 0.2rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.stat-grid b {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}
.stat-grid span {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.toggle-row span {
  display: flex;
  flex-direction: column;
}
.toggle-row small {
  color: var(--ink-dim);
  font-size: 0.78rem;
}
.toggle-row input[type="checkbox"] {
  width: 1.4rem;
  height: 1.4rem;
  accent-color: var(--accent);
}

/* ── age gate ───────────────────────────────────────────────────────────── */
.age-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(900px 500px at 50% 30%, #3a1220 0%, transparent 60%),
    var(--bg);
}
.age-card {
  width: min(24rem, 100%);
  text-align: center;
}
.age-card .brand {
  font-size: 3rem;
}
.age-lede {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 1.3rem;
  color: var(--ink-dim);
  margin-top: 0;
}
.age-card button {
  width: 100%;
  margin: 1rem 0 0.8rem;
}
.age-no {
  color: var(--ink-dim);
  font-size: 0.9rem;
}

@keyframes slide-in {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.92);
  }
}

.toast {
  position: fixed;
  bottom: calc(var(--dock-h) + 1rem);
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #240912;
  font-weight: 600;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 60;
  white-space: nowrap;
}

/* ── tablets & phones ───────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .clue-list {
    max-height: none;
    overflow: visible;
  }
}

/* Touch devices (phones and iPads): the on-screen keyboard is in the dock. */
body.touch .board-tools .status {
  display: none;
}

@media (max-width: 600px) {
  .topbar {
    padding-left: max(0.75rem, var(--safe-left));
    padding-right: max(0.75rem, var(--safe-right));
    gap: 0.5rem;
  }
  .brandrow {
    width: 100%;
    gap: 0.6rem;
    align-items: center;
  }
  .brand {
    font-size: 1.6rem;
    flex: 1;
  }
  /* Every pixel of height matters on a phone: the date moves to the splash,
     and the tabs fold into the pill until tapped. */
  .date {
    display: none;
  }
  .variant-pill {
    display: block;
  }
  .controls {
    display: none;
    width: 100%;
    flex-wrap: nowrap;
  }
  body.controls-open .controls {
    display: flex;
  }
  .board-tools {
    justify-content: flex-end;
  }
  .kb-row button {
    height: 2.7rem;
  }
  .seg:first-child {
    flex: 3;
  }
  .seg:last-child {
    flex: 2;
  }
  .seg button {
    flex: 1;
    padding: 0.4rem 0.2rem;
  }
  .layout {
    padding-left: max(0.4rem, var(--safe-left));
    padding-right: max(0.4rem, var(--safe-right));
    padding-top: 0.6rem;
    gap: 1rem;
  }
  .grid {
    gap: 1px;
    padding: 1px;
    border-radius: 6px;
  }
  .board-tools button {
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
  }
  .clues-pane {
    grid-template-columns: 1fr;
    padding: 0 0.4rem;
  }
  .active-clue {
    font-size: 0.95rem;
  }
}

/* Small phones (iPhone SE and similar). */
@media (max-width: 360px) {
  .brandrow {
    gap: 0.25rem !important;
  }
  .brand {
    font-size: 1.25rem !important;
  }
  .variant-pill {
    padding: 0.25rem 0.45rem;
    font-size: 0.78rem;
  }
  .icon-btn {
    padding: 0.2rem 0.35rem;
    font-size: 0.9rem;
  }
  .timer {
    min-width: 3rem;
    padding: 0.2rem 0.45rem;
    font-size: 0.82rem;
  }
  .cluebar {
    gap: 0.25rem;
  }
  .cluebar .arrow {
    width: 2.1rem;
  }
  .active-clue {
    font-size: 0.85rem;
    padding: 0.35rem 0.55rem;
    gap: 0.4rem;
    min-height: 2.6rem;
  }
  .kb-row {
    gap: 4px;
  }
  .kb-row button {
    height: 2.5rem;
    font-size: 1rem;
  }
}

@media (max-width: 600px) {
  /* On phones the sheet is full-screen. */
  .sheet-panel {
    border-left: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .splash,
  .splash-card,
  .sheet,
  .sheet-panel {
    animation: none;
  }
}
