/* Phones (voting) and the host remote */
:root {
  --ink: #22130F;
  --ink-2: #311C16;
  --ink-3: #43281F;
  --ink-4: #563428;
  --cream: #F5ECDD;
  --cream-2: #EADCC6;
  --pumpkin: #E8742A;
  --rust: #A9431A;
  --berry: #C2405C;
  --body-d: #DCC9B2;
  --muted-d: #A88F7A;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --accent: var(--pumpkin);
  --on-accent: var(--ink);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--ink); }
body { min-height: 100vh; min-height: 100svh; background: var(--ink); color: var(--body-d); font-family: var(--sans); font-size: 17px; line-height: 1.4; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
#app { max-width: 560px; margin: 0 auto; padding: 18px 20px 150px; }

.brand { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; color: var(--muted-d); padding: 4px 0 18px; }
.brand b { color: var(--pumpkin); font-weight: 700; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; color: var(--accent); }
h1 { font-family: var(--serif); font-weight: 800; font-size: 42px; line-height: 1.04; letter-spacing: -.5px; color: var(--cream); margin: 8px 0 10px; }
.sub { color: var(--muted-d); font-size: 16px; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }
.view > * { animation: rise .45s cubic-bezier(.2,.7,.2,1) both; }
.view > *:nth-child(2) { animation-delay: .06s; }
.view > *:nth-child(3) { animation-delay: .12s; }
.view > *:nth-child(4) { animation-delay: .18s; }
.view > *:nth-child(5) { animation-delay: .24s; }

.g-girls { --accent: var(--berry); --on-accent: var(--cream); }

/* avatars */
.av { position: relative; flex: none; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--ink-3); }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.init { background: var(--tone); }
.av.init span { font-family: var(--serif); font-weight: 800; font-style: italic; color: var(--cream); }
.av.empty { border: 2px dashed var(--muted-d); }
.av.empty span { font-family: var(--serif); color: var(--muted-d); }
.av.pav { width: 60px; height: 60px; border-radius: 50%; }
.av.pav span { font-size: 24px; }
.av.pbig { width: 112px; height: 112px; border-radius: 50%; }
.av.pbig span { font-size: 44px; }

/* timer bar */
.tbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 12px 0 14px; margin: -6px 0 6px; background: var(--ink); }
.ttrack { flex: 1; height: 6px; border-radius: 3px; background: var(--ink-3); overflow: hidden; }
.tfill { height: 100%; width: 100%; background: var(--accent); border-radius: 3px; transition: width .25s linear; }
.tnum { font-family: var(--serif); font-weight: 800; font-size: 22px; color: var(--cream); font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
.tbar.urgent .tnum { color: var(--pumpkin); }

/* boys / girls banner */
.gbanner { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0 14px; padding: 14px 16px; border-radius: 16px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 20px; letter-spacing: 4px; text-transform: uppercase; }

/* ballot */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.pcard { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; background: var(--ink-2); border: 2px solid transparent; text-align: left; transition: background .15s, border-color .15s, transform .1s; }
.pcard:active { transform: scale(.97); }
.pname { font-weight: 700; font-size: 17px; color: var(--cream); line-height: 1.15; overflow-wrap: anywhere; }
.pcard .tick { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 14px; font-weight: 700; display: none; align-items: center; justify-content: center; }
.pcard.on { background: var(--ink-3); border-color: var(--accent); }
.pcard.on .tick { display: flex; animation: pop .3s ease-out both; }
.grid.duo { grid-template-columns: 1fr 1fr; }
.grid.duo .pcard { flex-direction: column; justify-content: center; padding: 20px 12px 18px; text-align: center; }
.grid.duo .pname { font-family: var(--serif); font-size: 24px; }

.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--ink) 70%, rgba(34,19,15,0)); }
.dock > * { max-width: 520px; margin-left: auto; margin-right: auto; }
.go { display: block; width: 100%; height: 58px; border-radius: 16px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 18px; letter-spacing: .5px; transition: background .2s, color .2s, transform .1s; }
.go:active { transform: scale(.98); }
.go:disabled { background: var(--ink-3); color: var(--muted-d); }
.msg { min-height: 22px; margin-bottom: 8px; text-align: center; font-size: 15px; color: var(--pumpkin); }

/* centred states */
.center { min-height: 62vh; display: flex; flex-direction: column; justify-content: center; }
.badge { width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 700; margin-bottom: 18px; animation: pop .45s ease-out both !important; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px 8px 8px; border-radius: 999px; background: var(--ink-2); color: var(--cream); font-weight: 700; }
.tag .av { width: 28px; height: 28px; border-radius: 50%; }
.tag .av span { font-size: 12px; }
.pulse-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--pumpkin); margin-right: 8px; animation: blink 1.6s ease-in-out infinite; vertical-align: middle; }
@keyframes blink { 50% { opacity: .25; } }

body.offline::before { content: 'Reconnecting…'; position: fixed; top: 0; left: 0; right: 0; z-index: 20; padding: 8px; text-align: center; font-size: 13px; font-weight: 700; background: var(--rust); color: var(--cream); }

/* ── host remote ── */
.host #app { padding-bottom: 120px; }
.panel { background: var(--ink-2); border-radius: 20px; padding: 18px; margin-bottom: 14px; }
.panel h2 { font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--cream); margin-bottom: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel p + p { margin-top: 6px; }
.hhead { padding: 4px 0 16px; }
.hhead h1 { font-size: 32px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.btn { padding: 12px 16px; border-radius: 12px; background: var(--ink-3); color: var(--cream); font-weight: 700; font-size: 16px; }
.btn.primary { background: var(--pumpkin); color: var(--ink); }
.btn.ghost { background: transparent; border: 1.5px solid var(--ink-4); color: var(--body-d); }
.btn.small { padding: 8px 12px; font-size: 14px; }
.btn:disabled { opacity: .4; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { padding: 10px 14px; border-radius: 999px; background: var(--ink-3); color: var(--cream); font-weight: 700; border: 2px solid transparent; }
.chip.on { border-color: var(--pumpkin); background: var(--ink-4); }
.chip.big { padding: 14px 18px; font-size: 18px; }
.gtag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.gtag.boys { background: var(--pumpkin); color: var(--ink); }
.gtag.girls { background: var(--berry); color: var(--cream); }
.pstat { display: flex; align-items: baseline; gap: 14px; }
.pstat .big { font-family: var(--serif); font-size: 44px; font-weight: 800; color: var(--cream); font-variant-numeric: tabular-nums; }
.tally { list-style: none; margin-top: 10px; }
.tally li { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--ink-3); }
.tally b { color: var(--cream); font-variant-numeric: tabular-nums; }
.tie { margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--ink-3); }
.cblock, .wblock { padding: 10px 0; border-top: 1px solid var(--ink-3); }
.cblock:first-of-type, .wblock:first-of-type { border-top: 0; padding-top: 0; }
.cblock p { color: var(--cream); font-weight: 700; margin: 6px 0; }
.answers { list-style: none; counter-reset: q; }
.answers li { padding: 8px 0; border-top: 1px solid var(--ink-3); color: var(--muted-d); }
.answers li b { color: var(--cream); }
.answers li.now { color: var(--cream); }
.answers li.now b { color: var(--pumpkin); }
select { width: 100%; padding: 12px; border-radius: 12px; background: var(--ink-3); color: var(--cream); border: 0; font: inherit; font-size: 16px; }
input { width: 100%; padding: 14px; border-radius: 12px; background: var(--ink-2); color: var(--cream); border: 1.5px solid var(--ink-4); font: inherit; font-size: 18px; margin: 14px 0; }
.navbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: 10px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--ink) 70%, rgba(34,19,15,0)); }
.navbar .btn { flex: 1; height: 60px; font-size: 18px; }
.navbar .btn.primary { flex: 2; }
.danger { background: transparent; padding: 0; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 30; padding: 10px 16px; border-radius: 12px; background: var(--cream); color: var(--ink); font-weight: 700; font-size: 15px; box-shadow: 0 8px 30px rgba(0,0,0,.35); max-width: 90vw; }
