/* Paint Pushers.
   Portrait, phone-first, two thumbs. The arena fills the window between two thin bands, and
   nothing interactive sits in either band, so a stray thumb never fires. The two inks are the
   only colour on the board. */

@font-face { font-family: "Space Grotesk"; src: url("/fonts/space-grotesk-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/fonts/space-grotesk-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/fonts/space-grotesk-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  /* the ink look's dark warm furniture, from Ink Cannons */
  --bg: #1a1713;
  --panel: rgba(26, 23, 19, 0.92);
  --ink: #f2ece0;
  --dim: #a89c88;
  --faint: #7a7062;
  --edge: rgba(242, 236, 224, 0.14);
  --edge-strong: rgba(242, 236, 224, 0.28);
  --go: #e4d9c2;
  --go-deep: #cbbfa5;
  --go-text: #1a1713;
  --warn: #e8b13f;
  --s0: #ef6a4a;
  --s1: #4fa8e8;
  --scrim: rgba(18, 15, 11, 0.62);

  --gap: 12px;
  --radius: 18px;
  --band-top: 42px;
  --band-bottom: 50px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.45 "Space Grotesk", system-ui, -apple-system, sans-serif;
  letter-spacing: -0.01em;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
[hidden] { display: none !important; }

/* a film of grain over everything, so flat fills read as paper rather than plastic */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  z-index: 6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* ---- controls ------------------------------------------------------------------------------- */
button {
  font: inherit;
  letter-spacing: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  transition: transform 0.12s var(--ease), background 0.15s, box-shadow 0.15s, opacity 0.15s;
}
button:active { transform: scale(0.97); }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.go {
  background: linear-gradient(180deg, var(--go), var(--go-deep));
  color: var(--go-text);
  font-weight: 700;
  font-size: clamp(17px, 4.4vw, 19px);
  padding: 16px 34px;
  min-height: 56px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.ghost {
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px var(--edge);
  padding: 13px 22px;
  min-height: 48px;
  font-weight: 500;
}
.ghost:hover { background: rgba(255, 255, 255, 0.08); }
.link { color: var(--dim); padding: 10px 4px; font-size: 15px; text-decoration: underline; text-underline-offset: 4px; }
.link:hover { color: var(--ink); }
.icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px var(--edge);
}
.icon svg { width: 19px; height: 19px; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.key, kbd {
  font: 500 13px/1 "Space Grotesk", system-ui, sans-serif;
  display: inline-block;
  padding: 5px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px var(--edge);
  color: var(--ink);
  white-space: nowrap;
}

/* ---- screens -------------------------------------------------------------------------------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: flex-end;             /* phone: sheets rise from the bottom */
  justify-content: center;
  padding: calc(var(--safe-t) + 12px) 0 var(--safe-b);
  background: var(--scrim, radial-gradient(120% 80% at 50% 40%, rgba(18, 17, 16, 0.55), rgba(10, 10, 9, 0.88)));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s var(--ease), visibility 0.28s;
}
.screen.on { opacity: 1; visibility: visible; }
.screen.bare { background: none; pointer-events: none; align-items: center; }

.sheet {
  width: min(560px, 100%);
  max-height: calc(100dvh - var(--safe-t) - 24px);
  overflow: auto;
  background: var(--panel);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -1px 0 var(--edge-strong), 0 -30px 70px rgba(0, 0, 0, 0.55);
  padding: 22px 20px calc(22px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform: translateY(14px);
  transition: transform 0.32s var(--ease);
}
.screen.on .sheet { transform: none; }
.sheet::before {
  content: "";
  width: 38px; height: 4px;
  border-radius: 99px;
  background: var(--edge-strong);
  margin: -8px auto 2px;
}
.sheet-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.eyebrow { margin: 0 0 2px; font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.sheet h2 { margin: 0; font-size: clamp(26px, 7vw, 32px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }

/* home */
#home { align-items: center; }
.hero { display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; padding: 24px; max-width: 620px; }
.lede { margin: 0; font-size: clamp(16px, 4.2vw, 19px); color: var(--dim); max-width: 34em; }
.lede em { color: var(--ink); font-style: normal; }
.cta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.wait { margin: 0; color: var(--dim); font-size: 15px; }

/* lobby */
.seats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seats li {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  font-weight: 500;
  min-height: 52px;
}
.seats li .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 12px currentColor; }
.seats li .who { color: var(--faint); font-weight: 400; margin-left: auto; font-size: 13px; }
.seats li.you { box-shadow: inset 0 0 0 1.5px var(--edge-strong); background: rgba(255, 255, 255, 0.08); }

.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field .eyebrow { margin: 0; }
.seg { display: inline-flex; border-radius: 12px; padding: 3px; background: rgba(255, 255, 255, 0.05); box-shadow: inset 0 0 0 1px var(--edge); }
.seg button { border-radius: 10px; padding: 9px 15px; font-size: 15px; font-weight: 500; color: var(--dim); min-height: 42px; }
.seg button.on { background: var(--ink); color: var(--bg); font-weight: 700; }
.seg button:disabled { cursor: default; opacity: 0.55; }

.how { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.how li { color: var(--dim); font-size: 15px; line-height: 1.5; }

.tally { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tally li { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.tally .dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 12px currentColor; }
.tally .pips { margin-left: auto; letter-spacing: 4px; color: var(--dim); }

#creditList { display: flex; flex-direction: column; gap: 10px; max-height: 46dvh; overflow: auto; }
#creditList p { margin: 0; color: var(--dim); font-size: 15px; }
#creditList b { color: var(--ink); font-weight: 500; }
#creditList a { color: var(--ink); }

/* ---- the two bands ------------------------------------------------------------------------ */
.hud { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.band {
  position: fixed;
  left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l));
  background: var(--bg);
}
.band.top { top: 0; height: calc(var(--band-top) + var(--safe-t)); padding-top: var(--safe-t); }
.band.bottom { bottom: 0; height: calc(var(--band-bottom) + var(--safe-b)); padding-bottom: var(--safe-b); }
.band .who { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.band .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex: none; }
.band .pips { color: var(--faint); letter-spacing: 2px; font-size: 12px; margin-left: 2px; }
.band .icon { pointer-events: auto; margin-left: auto; flex: none; }
.meter {
  position: relative;
  flex: 1;
  display: flex;
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(242, 236, 224, 0.07);
  box-shadow: inset 0 0 0 1px var(--edge);
}
.meter.them { height: 5px; opacity: 0.85; }
.meter i { display: block; height: 100%; transition: width 0.12s linear; }
.meter .pool { background: var(--me, var(--ink)); }
.meter .wall { background: var(--me, var(--ink)); opacity: 0.42; }
.meter .out { background: var(--me, var(--ink)); opacity: 0.16; }
.meter .cap { position: absolute; top: -1px; bottom: -1px; width: 2px; background: rgba(242, 236, 224, 0.5); border-radius: 2px; }
.num { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 17px; min-width: 2ch; text-align: right; }
.clock { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--dim); white-space: nowrap; min-width: 4ch; text-align: right; }
.clock.warn { color: var(--warn); font-weight: 700; }

.banner {
  /* a slip of paper laid on the sheet, so the words read over any amount of paint */
  font-weight: 700;
  font-size: clamp(30px, 10vw, 60px);
  letter-spacing: -0.04em;
  text-align: center;
  line-height: 1;
  color: #2b251c;
  background: #efe5cf;
  padding: 18px 26px 16px;
  margin: 0 16px;
  border-radius: 3px;
  transform: rotate(-1.2deg);
  box-shadow: 0 10px 30px rgba(20, 14, 8, 0.35), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  animation: pop 0.35s var(--ease);
}
.banner:empty { display: none; }
.banner small { display: block; font-size: clamp(14px, 3.8vw, 18px); font-weight: 500; letter-spacing: -0.01em; color: #5b5042; margin-top: 8px; }
@keyframes pop { from { opacity: 0; transform: rotate(-1.2deg) scale(0.94) translateY(8px); } }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--band-bottom) + var(--safe-b) + 14px);
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 15px;
  border-radius: 12px;
  z-index: 7;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s var(--ease);
}
#toast.on { opacity: 1; transform: translateX(-50%); }

@media (min-width: 720px) {
  .screen { align-items: center; padding: 24px; }
  .sheet {
    border-radius: 22px;
    padding: 26px 28px;
    box-shadow: 0 0 0 1px var(--edge), 0 40px 90px rgba(0, 0, 0, 0.55);
    transform: translateY(10px) scale(0.99);
  }
  .sheet::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* The front door is the sheet of paper itself: the painted wordmark, the words in ink, a button of
   dark paint. Everything is sized to the sheet (--sheet-w, set by the page from the board), so on a
   wide screen nothing hangs off the paper. */
#home { background: none; padding: 0; }
#home .hero { width: calc(var(--sheet-w, 100vw) * 0.86); max-width: none; padding: 0; gap: calc(var(--sheet-w, 390px) * 0.05); }
#home .wordmark { display: block; width: 100%; }
#home .wordmark img { display: block; width: 100%; height: auto; filter: drop-shadow(0 2px 1px rgba(40, 30, 18, 0.18)); }
#home .lede { color: #2b251c; font-weight: 500; font-size: clamp(14px, calc(var(--sheet-w, 390px) * 0.043), 19px); max-width: none; text-shadow: 0 0 10px rgba(239, 229, 207, 0.95), 0 0 2px rgba(239, 229, 207, 0.9); }
#home .go { background: #2b251c; color: #efe5cf; box-shadow: 0 6px 18px rgba(40, 30, 18, 0.35); }
#home .ghost { color: #2b251c; background: rgba(239, 229, 207, 0.7); box-shadow: inset 0 0 0 1.5px rgba(43, 37, 28, 0.5); }
#home .link { color: #2b251c; text-shadow: 0 0 8px rgba(239, 229, 207, 0.95); }

/* the paint picker: a row of dabs, the one you hold ringed */
.paints { display: flex; flex-direction: column; gap: 8px; }
.paints .eyebrow { margin: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.25), inset 0 2px 3px rgba(255, 255, 255, 0.18);
  position: relative;
  display: grid; place-items: center;
}
.swatch.on { outline: 2.5px solid var(--ink); outline-offset: 3px; }
.swatch:disabled { cursor: default; }
.swatch.held { opacity: 0.35; }
.swatch.locked { background: rgba(242, 236, 224, 0.06); box-shadow: inset 0 0 0 1.5px var(--c); }
.swatch.locked svg { width: 16px; height: 16px; fill: none; stroke: var(--dim); stroke-width: 2; stroke-linecap: round; }
.note { margin: 0; color: var(--dim); font-size: 14px; }
.seats li .dot.open { background: transparent !important; box-shadow: inset 0 0 0 1.5px var(--faint); }

/* the match's painting on the end sheet */
.art { margin: 0; display: flex; justify-content: center; }
.art img { display: block; height: min(46dvh, 420px); aspect-ratio: 3 / 5; border-radius: 6px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); background: #e8ddc7; }
