/* Collective Patterns — shared tokens & primitives (mobile-first), the
   same family as Collective Deeds: a dark felt page, one warm accent for
   the cue ball's path and the Shoot button, gold for attention. */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
:root {
  --felt: #0f4a2f;
  --felt-deep: #0a3421;
  --panel: rgba(0, 0, 0, .28);
  --panel-solid: #123d29;
  --line: rgba(255, 255, 255, .14);
  --text: #f4f1e8;
  --muted: #b9c7bd;
  --accent: #ff9f1c;      /* where the cue ball goes */
  --accent-ink: #241a00;
  --gold: #f2c53d;        /* attention: the pocket, the ball in hand */
  --gold-ink: #241a00;
  --ok: #3ccb6e;
  --danger: #ff5c5c;
  --radius: 10px;
  --tap: 44px;
  --shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
html { -webkit-text-size-adjust: 100%; }
body {
  background: radial-gradient(ellipse at 50% 20%, #17603d 0%, var(--felt) 45%, var(--felt-deep) 100%) fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
}
a { color: var(--gold); text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 8px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: rgba(255, 255, 255, .08); color: var(--text);
  font-weight: 700; cursor: pointer; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); filter: brightness(1.15); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn.ghost { background: transparent; }
.btn.big { font-size: 18px; min-height: 52px; width: 100%; }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.small { min-height: 36px; padding: 4px 10px; font-size: 13px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 800;
  background: rgba(255, 255, 255, .1); border: 1px solid var(--line); color: var(--muted);
  letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.chip.gold { color: var(--gold-ink); background: var(--gold); border-color: var(--gold); }
.chip.red { color: #fff; background: var(--danger); border-color: var(--danger); }
.chip.ok { color: var(--ok); border-color: var(--ok); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* bottom sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 90; display: none; }
.sheet-backdrop.on { display: block; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 91; display: none;
  background: var(--panel-solid); border-top: 3px solid var(--gold);
  border-radius: 16px 16px 0 0; padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
  max-height: 88vh; max-height: 88dvh; overflow-y: auto;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .5);
}
.sheet.on { display: block; animation: rise .18s ease-out; }
.sheet.locked { border-top-color: var(--accent); }
@keyframes rise { from { transform: translateY(40px); opacity: .4; } }
.sheet h3 { margin-bottom: 8px; font-size: 18px; }
.sheet p { margin-bottom: 10px; }
.sheet .opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 50px; padding: 8px 12px; margin-bottom: 8px;
  background: rgba(255, 255, 255, .07); border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; text-align: left; font-weight: 700;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.sheet .opt:active { filter: brightness(1.2); }
.sheet .opt.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.sheet .opt.gold { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.sheet .opt.ghostopt { background: transparent; color: var(--muted); min-height: 44px; }
.sheet .opt .grow { flex: 1; }
.sheet .group { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin-bottom: 12px; }
.sheet .group .opt { margin: 0; justify-content: center; text-align: center; padding: 8px 6px; font-size: 14px; }
.sheet .group .opt.on { background: rgba(242, 197, 61, .18); border-color: var(--gold); color: var(--text); }
.sheet label.lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

/* toast */
#toast {
  position: fixed; left: 50%; top: calc(54px + env(safe-area-inset-top)); transform: translateX(-50%);
  background: #000; color: #fff; border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 999px; font-weight: 700; z-index: 120;
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 92vw; text-align: center;
}
#toast.on { opacity: .96; }
#toast.err { background: var(--danger); border-color: var(--danger); }

@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; transform: translateX(-50%); width: 560px; border-radius: 16px; bottom: 24px; border: 1px solid var(--line); border-top: 3px solid var(--gold); }
  .sheet.on { animation: rise-centered .18s ease-out; }
  @keyframes rise-centered { from { transform: translate(-50%, 40px); opacity: .4; } to { transform: translate(-50%, 0); } }
}
