/* Crowvio audience app – vibrant, thumb-first, readable outdoors. */

body { overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; display: flex; flex-direction: column; }

/* ---------- app bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: calc(var(--space-3) + env(safe-area-inset-top)) var(--space-4) var(--space-3);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.appbar-event { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.appbar-mark { width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0; background: conic-gradient(from 210deg, var(--brand-1), var(--brand-2), var(--brand-3), var(--brand-1)); }
.appbar .brand-logo { height: 32px; width: auto; max-width: 120px; object-fit: contain; border-radius: 6px; background: #fff; padding: 2px 6px; flex-shrink: 0; }
.appbar-title { font-family: var(--font-display); font-weight: 700; font-size: var(--text-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; font-size: var(--text-sm); font-weight: 600; }
.me-nick { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.me-score { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--radius-full); background: var(--primary); color: var(--on-primary); font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---------- view ---------- */
.view { position: relative; z-index: var(--z-base); flex: 1; width: 100%; max-width: 540px; margin: 0 auto; padding: var(--space-6) var(--space-4) var(--space-8); display: flex; flex-direction: column; gap: var(--space-5); outline: none; animation: enter var(--dur-slow) var(--ease-out); }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--space-4); }
.title { font-size: var(--text-3xl); line-height: var(--leading-tight); }
.lead { font-size: var(--text-lg); color: var(--text-muted); }
.kicker { font-size: var(--text-xs); font-weight: 700; letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--primary-text); }
.powered { position: relative; z-index: var(--z-base); text-align: center; font-size: var(--text-xs); color: var(--text-subtle); padding: 0 0 calc(var(--space-3) + env(safe-area-inset-bottom)); }
.powered b { color: var(--text-muted); }

/* icon orb: the hero illustration for each state (replaces emoji) */
.orb { --_c1: var(--primary); --_c2: var(--accent); width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: radial-gradient(circle at 30% 25%, color-mix(in srgb, #fff 30%, var(--_c1)), var(--_c1) 45%, var(--_c2)); box-shadow: 0 12px 32px color-mix(in srgb, var(--_c1) 40%, transparent); animation: pop var(--dur-slow) var(--ease-spring); }
.orb .icon { width: 46px; height: 46px; }
.orb-success { --_c1: var(--green-600); --_c2: var(--cyan-500); }
.orb-danger { --_c1: var(--red-600); --_c2: var(--pink-600); }
.orb-gold { --_c1: var(--gold-500); --_c2: var(--pink-500); }
.orb-muted { --_c1: var(--ink-500); --_c2: var(--ink-700); }

/* ---------- tiles (lobby activities) ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); width: 100%; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); min-height: 120px; padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); font-weight: 700; font-size: var(--text-base); text-align: left; box-shadow: var(--shadow-sm); transition: transform var(--dur-instant), border-color var(--dur-fast); }
.tile:active { transform: scale(0.97); }
.tile .tile-icon { width: 44px; height: 44px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); }
.tile .tile-icon.alt { background: var(--accent-soft); color: var(--accent-text); }
.tile small { font-weight: 500; color: var(--text-muted); font-size: var(--text-sm); }

/* ---------- power-up ---------- */
.power-btn {
  position: relative; width: min(70vw, 280px); aspect-ratio: 1; border-radius: 50%; border: 0;
  display: grid; place-items: center; align-content: center; gap: var(--space-1);
  background: radial-gradient(circle at 32% 28%, color-mix(in srgb, #fff 35%, var(--gold-400)), var(--gold-400) 40%, var(--gold-500) 75%);
  color: var(--ink-950); font-family: var(--font-display); font-size: var(--text-4xl); font-weight: 700;
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--gold-400) 22%, transparent), 0 0 60px color-mix(in srgb, var(--gold-400) 55%, transparent), 0 10px 0 var(--gold-700);
  touch-action: manipulation; user-select: none; transition: transform var(--dur-instant);
}
.power-btn .icon { width: 44px; height: 44px; }
.power-btn.hit { transform: scale(0.94); }
.power-meter { width: 100%; height: 18px; }
.power-stats { display: flex; justify-content: space-between; width: 100%; font-size: var(--text-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.power-stats b { color: var(--text); }

.big-number { font-family: var(--font-display); font-size: min(44vw, 240px); font-weight: 700; line-height: 1; color: var(--primary-text); font-variant-numeric: tabular-nums; animation: pop var(--dur-slow) var(--ease-spring); }

/* ---------- trivia ---------- */
.q-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.timer { height: 8px; border-radius: var(--radius-full); background: var(--surface-sunken); overflow: hidden; }
.timer > div { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); transform-origin: left; }
.question { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700; line-height: var(--leading-snug); text-align: center; }
.answers { display: grid; gap: var(--space-3); }
.answer {
  display: flex; align-items: center; gap: var(--space-4); min-height: 68px; padding: var(--space-4);
  border: 0; border-radius: var(--radius-lg); background: var(--_ans); color: var(--_on);
  font-size: var(--text-lg); font-weight: 700; text-align: left; line-height: 1.3;
  box-shadow: 0 5px 0 color-mix(in srgb, var(--_ans) 60%, #000); transition: transform var(--dur-instant), box-shadow var(--dur-instant);
}
.answer:active { transform: translateY(3px); box-shadow: 0 2px 0 color-mix(in srgb, var(--_ans) 60%, #000); }
.answer .shape { width: 36px; height: 36px; border-radius: var(--radius-sm); display: grid; place-items: center; background: rgba(0, 0, 0, 0.16); flex-shrink: 0; }
.answer .shape .icon { width: 22px; height: 22px; }
.answer.is-picked { outline: 4px solid var(--text); outline-offset: 3px; }
.verdict { font-family: var(--font-display); font-size: var(--text-4xl); font-weight: 700; }
.verdict.right { color: var(--success); }
.verdict.wrong { color: var(--danger); }
.points { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700; color: var(--primary-text); }

/* ---------- polls ---------- */
.option { position: relative; overflow: hidden; display: flex; align-items: center; min-height: 60px; padding: var(--space-4); border: 2px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); font-size: var(--text-lg); font-weight: 600; text-align: left; }
.option:not(:disabled):active { transform: scale(0.98); }
.option .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--primary-soft); transition: width var(--dur-slow) var(--ease-out); }
.option .row { position: relative; display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); width: 100%; }
.option .pct { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: var(--text-base); }
.option.is-picked { border-color: var(--primary); }
.option.is-picked .row::after { content: none; }
.option:disabled { cursor: default; }

/* ---------- draw ---------- */
.prompt-card { text-align: center; padding: var(--space-4); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
.prompt-card .prompt-title { display: block; font-family: var(--font-display); font-size: var(--text-2xl); line-height: var(--leading-snug); color: var(--accent-text); margin-top: var(--space-1); }
.canvas-wrap { width: 100%; aspect-ratio: 1; border-radius: var(--radius-lg); overflow: hidden; background: #fff; box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.canvas-wrap canvas { width: 100%; height: 100%; touch-action: none; display: block; }
.palette { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); padding: 0; transition: transform var(--dur-fast) var(--ease-spring); }
.swatch[aria-pressed='true'] { box-shadow: 0 0 0 3px var(--text); transform: scale(1.08); }
.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.tool { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--touch-min); border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: var(--text-sm); }
.tool[aria-pressed='true'] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.dot { display: inline-block; border-radius: 50%; background: currentColor; }

/* ---------- selfie ---------- */
.selfie-preview { width: 100%; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md); background: var(--surface-sunken); }
.selfie-preview canvas { width: 100%; display: block; }
.frames { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 200px; }
.btn-row { display: flex; gap: var(--space-3); }
.btn-row > * { flex: 1; }
.count { text-align: right; font-size: var(--text-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ---------- light show takeover ---------- */
.lights { position: fixed; inset: 0; z-index: var(--z-takeover); background: #05070d; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: calc(var(--space-8) + env(safe-area-inset-top)) var(--space-5) calc(var(--space-8) + env(safe-area-inset-bottom)); }
.lights-hint { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700; color: #fff; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7); transition: opacity 1s; }
.lights-stop { min-height: var(--touch-min); border: 0; border-radius: var(--radius-full); padding: 0 var(--space-5); background: rgba(0, 0, 0, 0.55); color: #fff; font-weight: 600; }

/* ---------- winner takeover ---------- */
.won { position: fixed; inset: 0; z-index: var(--z-takeover); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-5); padding: var(--space-6); text-align: center; color: #fff; background: radial-gradient(circle at 50% 30%, var(--pink-500), var(--violet-700) 70%); }
.won h2 { font-size: var(--text-5xl); }
.won p { font-size: var(--text-lg); max-width: 30ch; }

@media (min-width: 600px) {
  .view { padding-top: var(--space-10); }
}
