/* ============================================================
   WHO'S FIRST?  —  styles
   Warm-ink brand (matches the hub) + per-player colors.
   ============================================================ */

:root {
  --ink:    #15110d;
  --ink-2:  #211a13;
  --ink-3:  #2c231a;
  --paper:  #f4ece0;
  --muted:  #b8a98f;
  --faint:  #6f6552;
  --gold:   #e7b53c;
  --line:   rgba(244, 236, 224, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }

body {
  min-height: 100dvh;
  background:
    radial-gradient(1100px 520px at 50% -12%, rgba(231, 181, 60, 0.10), transparent 60%),
    var(--ink);
  color: var(--paper);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.app {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: clamp(16px, 5vw, 28px) 16px calc(20px + env(safe-area-inset-bottom));
}

/* ---------------- TOP BAR ---------------- */
.topbar { display: flex; align-items: center; gap: 10px; }
.topbar__titles { flex: 1; min-width: 0; }
.topbar__home { font-size: 30px; line-height: 1; color: var(--muted); text-decoration: none; padding: 0 4px 4px 0; }
.topbar__home:hover { color: var(--paper); }
.standings-btn {
  flex: 0 0 auto;
  font: 600 12px "Inter", sans-serif;
  color: var(--paper);
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 13px;
  cursor: pointer;
  transition: border-color 140ms ease;
}
.standings-btn:hover { border-color: var(--muted); }
.topbar__kicker {
  font-family: "Special Elite", monospace;
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted);
}
.topbar__title { font-family: "Fraunces", Georgia, serif; font-weight: 900; font-size: 30px; line-height: 1; }

/* ---------------- PRESENCE ---------------- */
.presence { display: flex; flex-direction: column; gap: 8px; }
.presence__label {
  font-family: "Special Elite", monospace;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted);
}
.presence__chips { display: flex; gap: 8px; flex-wrap: wrap; }
.pchip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--paper);
  font: 600 13.5px "Inter", sans-serif;
  cursor: pointer;
  transition: opacity 140ms ease, border-color 140ms ease;
}
.pchip__dot { width: 11px; height: 11px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); flex: 0 0 auto; }
.pchip.on { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); }
.pchip.off { opacity: 0.4; }
.pchip.off .pchip__dot { box-shadow: none; }
.pchip.off .pchip__name { text-decoration: line-through; }
.pchip:disabled { cursor: default; }

/* ---------------- INSTRUCTION ---------------- */
.instruction {
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
  min-height: 1.4em;
}

/* ---------------- PADS ---------------- */
.pads {
  flex: 1;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  min-height: 0;
}
.pads--1 { grid-template-columns: 1fr; }
.pads--3 .pad:nth-child(3) { grid-column: span 2; }

.pad {
  position: relative;
  border-radius: 20px;
  border: 2px solid color-mix(in srgb, var(--c) 45%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 10%, var(--ink-2)), var(--ink-2));
  color: var(--paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 124px;
  cursor: pointer;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
  transition: transform 110ms ease, box-shadow 150ms ease, background 150ms ease, border-color 150ms ease, opacity 150ms ease;
}
.pad__name { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: clamp(24px, 7vw, 30px); }
.pad__hint { font: 600 11px "Inter", sans-serif; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }

.pad.is-down {
  border-color: var(--c);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 42%, var(--ink-2)), color-mix(in srgb, var(--c) 14%, var(--ink-2)));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 28%, transparent), 0 14px 44px -16px var(--c);
  transform: scale(0.98);
}
.pad.is-down .pad__hint { color: var(--c); }

.pad.is-spinning { opacity: 0.42; border-color: var(--line); background: var(--ink-2); transform: scale(0.97); }
.pad.is-spinning .pad__hint { visibility: hidden; }
.pad.is-lit {
  opacity: 1;
  border-color: var(--c);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 62%, var(--ink-2)), color-mix(in srgb, var(--c) 22%, var(--ink-2)));
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 42%, transparent), 0 18px 54px -14px var(--c);
  transform: scale(1.04);
}

/* ---------------- HOLD METER ---------------- */
.holdmeter { display: flex; justify-content: center; gap: 10px; padding: 2px 0; }
.holddot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--c) 50%, var(--line));
  transition: background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.holddot.on { background: var(--c); border-color: var(--c); box-shadow: 0 0 10px var(--c); transform: scale(1.15); }

/* ---------------- RESULT ---------------- */
.result {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center;
  animation: pop 340ms cubic-bezier(.2,.9,.2,1) both;
}
.result__eyebrow {
  color: var(--c);
  font: 700 13px "Inter", sans-serif; text-transform: uppercase; letter-spacing: 0.22em;
}
.result__name {
  font-family: "Fraunces", Georgia, serif; font-weight: 900;
  font-size: clamp(56px, 22vw, 108px); line-height: 0.92;
  color: var(--c);
  text-shadow: 0 0 60px color-mix(in srgb, var(--c) 45%, transparent);
}
.result__sub { color: var(--muted); font-size: 16px; margin-top: 2px; }
.result__again {
  margin-top: 26px;
  font: 600 15px "Fraunces", serif;
  color: var(--ink);
  background: var(--gold);
  border: none;
  padding: 12px 26px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}
.result__again:hover { background: #fff; transform: translateY(-2px); }

@keyframes pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------------- STANDINGS ---------------- */
.standings { width: 100%; max-width: 360px; margin: 0 auto; }
.standings--compact { margin-top: 30px; }
.standings__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.standings__title { font: 700 12px "Inter", sans-serif; text-transform: uppercase; letter-spacing: 0.18em; color: var(--muted); }
.standings__total { font-size: 12px; color: var(--faint); }
.standings__empty { color: var(--muted); font-size: 13px; text-align: center; padding: 10px 0; }
.standings__list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.srow {
  display: grid;
  grid-template-columns: 12px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border-radius: 12px;
  background: var(--ink-2);
  border: 1px solid var(--line);
}
.srow.is-win {
  border-color: var(--c);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 16%, var(--ink-2)), var(--ink-2));
}
.srow__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.srow__name { font: 600 15px "Inter", sans-serif; color: var(--paper); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow__rate { font: 600 12px "Inter", sans-serif; color: var(--muted); }
.srow__wins { font-family: "Fraunces", Georgia, serif; font-weight: 700; font-size: 18px; color: var(--paper); }
.srow__of { font-family: "Inter", sans-serif; font-weight: 500; font-size: 12px; color: var(--faint); }

/* ---------------- STANDINGS SHEET ---------------- */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(8, 6, 4, 0.66);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
  animation: fade 160ms ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: 100%; max-width: 480px;
  background: var(--ink-2);
  border: 1px solid var(--line); border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  animation: rise 200ms cubic-bezier(.2,.9,.2,1) both;
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.sheet__close {
  margin-top: 16px; width: 100%; padding: 12px;
  border-radius: 12px; border: 1px solid var(--line);
  background: transparent; color: var(--paper);
  font: 600 14px "Inter", sans-serif; cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .pad, .holddot, .result, .result__again, .sheet, .sheet-backdrop { transition: none; animation: none; }
}
