/* Family Lanes — dark alley, neon pink / cyan / gold. Big type for family play. */
@font-face {
  font-family: "Nunito Local";
  src: url("fonts/nunito-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Russo Local";
  src: url("fonts/russo-one.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #110818;
  --bg-deep: #07040d;
  --ink: #f0e6c8;
  --muted: #cbbbe0;
  --pink: #ff2d95;
  --pink-deep: #ff4fa3;
  --cyan: #2ee6ff;
  --gold: #d4b872;
  --gold-2: #f0d78c;
  --purple: #7c3aed;
  --panel: rgba(16, 8, 28, 0.88);
  --line: rgba(240, 230, 200, 0.18);
  --danger: #e23b32;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --sans: "Nunito Local", "Nunito", "Trebuchet MS", "Segoe UI", sans-serif;
  --display: "Russo Local", "Russo One", "Trebuchet MS", sans-serif;
  --radius: 18px;
  --hit: 56px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 800;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body {
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
button, a { font-family: inherit; }

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  display: block;
}

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.screen {
  pointer-events: auto;
  margin: auto;
  width: min(460px, calc(100% - 28px));
  max-height: calc(100% - 24px);
  overflow: auto;
  padding: 22px 18px 18px;
  border-radius: 28px;
  background: var(--panel);
  border: 2px solid rgba(255, 45, 149, 0.45);
  box-shadow: var(--shadow), 0 0 40px rgba(255, 45, 149, 0.18);
}
.screen h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-wrap: balance;
  line-height: 1.15;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.lede, .fine {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 1.05rem;
  text-wrap: pretty;
}
.fine { font-size: 0.92rem; margin: 12px 0 0; }
.file {
  color: var(--gold-2);
  word-break: break-all;
}

.sign {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.5rem, 12vw, 4.2rem);
  line-height: 0.92;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff8fc;
  text-shadow:
    0 0 8px #fff,
    0 0 18px var(--pink),
    0 0 36px var(--pink),
    0 0 64px var(--cyan);
}
.sign span { display: block; }
.sign span:last-child {
  color: var(--gold-2);
  text-shadow:
    0 0 8px #fff,
    0 0 16px var(--gold),
    0 0 34px var(--pink);
}

.stack, .size-row { display: flex; flex-direction: column; gap: 10px; }
.opt-row { display: flex; gap: 10px; }
.opt-row .btn {
  flex: 1;
  min-height: 52px;
  padding: 8px 8px;
  font-size: 0.98rem;
  line-height: 1.15;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--hit);
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 3px solid transparent;
  font-size: 1.22rem;
  font-weight: 800;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  color: #1a0610;
  background: var(--pink-deep);
}
.btn:active { transform: translateY(1px); }
.btn-cyan { background: var(--cyan); color: #042028; }
.btn-gold { background: var(--gold-2); color: #2a1c04; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: rgba(240, 230, 200, 0.45);
}
.btn[aria-pressed="false"] { opacity: 0.85; }

.ball-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.ball-pick {
  min-height: 112px;
  border-radius: 16px;
  border: 3px solid rgba(240, 230, 200, 0.2);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  cursor: pointer;
  font-size: 1rem;
}
.ball-pick canvas { width: 72px; height: 72px; }
.ball-pick.is-on {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 184, 114, 0.35);
}
.size-row { flex-direction: row; margin: 8px 0 14px; }
.size-row .btn { flex: 1; min-height: 64px; font-size: 1.05rem; flex-direction: column; gap: 0; }
.size-row small { display: block; font-size: 0.78rem; font-weight: 800; opacity: 0.8; }
.size-row .btn.is-on { outline: 3px solid var(--gold); outline-offset: 2px; }

#screen-play {
  pointer-events: none;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin: 0;
  width: auto;
  max-height: none;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  overflow: visible;
}
#hud {
  pointer-events: auto;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(7, 4, 13, 0.94) 70%, rgba(7, 4, 13, 0));
}
#turn-banner {
  font-family: var(--display);
  font-size: clamp(1.35rem, 5.4vw, 1.8rem);
  letter-spacing: 0.03em;
  margin: 0 0 6px;
  text-shadow: 0 0 16px rgba(255, 45, 149, 0.8);
}
#turn-banner.p2 { text-shadow: 0 0 16px rgba(46, 230, 255, 0.8); color: #e8fbff; }
#hint {
  margin: 6px 0 0;
  font-size: 1.12rem;
  color: var(--gold-2);
}
#cards { display: flex; flex-direction: column; gap: 6px; }
.card {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  padding-bottom: 2px;
  border-radius: 12px;
  border: 2px solid transparent;
}
.card.is-live { border-color: rgba(212, 184, 114, 0.7); }
.who {
  flex: 0 0 auto;
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 10px;
  background: #3a1230;
  color: #ffd0e8;
  font-size: 0.85rem;
}
.card.p2 .who { background: #0c3038; color: #d7fbff; }
.frame-ten { flex: 1.4 1 0; min-width: 46px; }
.frame {
  flex: 1 1 0;
  min-width: 26px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  text-align: center;
  padding: 3px 1px 4px;
  font-variant-numeric: tabular-nums;
}
.frame.is-now { background: rgba(212, 184, 114, 0.22); }
.fn { display: block; color: var(--muted); font-size: 0.72rem; }
.marks { display: flex; justify-content: center; gap: 2px; min-height: 1.35rem; }
.marks i {
  font-style: normal;
  min-width: 0;
  font-size: clamp(0.95rem, 2.8vw, 1.2rem);
  color: white;
}
.tot { display: block; color: var(--gold-2); font-size: 0.95rem; min-height: 1.15rem; }

.mini {
  pointer-events: auto;
  position: absolute;
  top: calc(8px + env(safe-area-inset-top));
  right: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 2px solid rgba(240, 230, 200, 0.45);
  background: rgba(7, 4, 13, 0.72);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

#cele {
  pointer-events: auto;
  position: absolute;
  left: 50%;
  bottom: 28%;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 24px));
  text-align: center;
  padding: 8px 10px 14px;
}
#cele h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3rem, 14vw, 5.4rem);
  line-height: 0.9;
  letter-spacing: 0.03em;
  color: white;
  text-shadow:
    0 0 10px #fff,
    0 0 24px var(--pink),
    0 0 48px var(--gold);
  animation: pop 0.45s cubic-bezier(0.18, 0.9, 0.32, 1.2) both;
}
#cele.spare h2 { font-size: clamp(2rem, 8vw, 3.2rem); text-shadow: 0 0 12px #fff, 0 0 28px var(--cyan); }
#cele.gutter h2 { font-size: clamp(2rem, 8vw, 3rem); text-shadow: 0 0 12px #fff, 0 0 20px #888; }
#cele.turkey h2 { color: var(--gold-2); }
#cele-kicker, #cele-sub {
  margin: 0;
  font-size: 1.15rem;
  color: var(--ink);
  text-shadow: 0 2px 8px #000;
}
#over-scores { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 14px; }
.final {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 1.35rem;
}
.final b { font-family: var(--display); font-size: 2rem; font-weight: 400; color: var(--gold-2); }
.winner { color: var(--gold-2); margin: 0 0 10px; font-size: 1.25rem; }

@keyframes pop {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  #cele h2 { animation: none; }
  .sign { text-shadow: 0 0 12px var(--pink); }
}

@media (min-width: 800px) {
  .frame { min-width: 54px; }
  .marks i { font-size: 1.2rem; }
}
