:root {
  --pink: #ff2e88; --pink-dk: #a80052; --grape: #23063d; --grape-2: #3a1660; --yel: #ffe14d; --yel-dk: #b89600; --lpink: #ffb3d4;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--grape); color: #fff; font-family: Rubik, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: var(--yel); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* layout: one phone column; on wide screens a groups list sits beside it */
#app { min-height: 100%; display: flex; justify-content: center; }
.side { display: none; }
@media (min-width: 900px) {
  #app { gap: 28px; padding: 24px; }
  .side { display: flex; flex-direction: column; gap: 10px; width: 260px; padding-top: 10px; }
  .side h2 { font-family: Bungee, sans-serif; font-size: 18px; margin: 0 0 4px; color: var(--yel); }
  .screen { border-radius: 36px; height: calc(100vh - 48px) !important; box-shadow: 0 0 0 10px #160226; }
}
.side-btn { all: unset; cursor: pointer; padding: 12px 14px; border-radius: 14px; background: var(--grape-2); font-weight: 600; }
.side-btn.on { background: var(--pink); }
.side-btn:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--yel); outline-offset: 2px; }

.screen { width: 100%; max-width: 480px; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; container-type: inline-size; background: var(--grape); }
.screen.light { background: var(--yel); color: var(--grape); }
.pad { padding: calc(18px + var(--safe-t)) 20px 0; }
.scroll { flex: 1; overflow-y: auto; min-height: 0; padding: 0 20px 16px; display: flex; flex-direction: column; gap: 12px; }
.dock { flex-shrink: 0; padding: 12px 20px calc(16px + var(--safe-b)); display: flex; flex-direction: column; gap: 10px; }
.light .dock { background: var(--yel); box-shadow: 0 -10px 16px -12px rgba(35, 6, 61, .45); }

/* top bar */
.top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; padding-bottom: 10px; }
.pill { border: 0; display: inline-flex; align-items: center; gap: 6px; background: var(--pink); color: #fff; padding: 8px 14px; border-radius: 999px; font-weight: 800; max-width: 70%; }
.pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.daynum { color: var(--yel); white-space: nowrap; }
.light .daynum { color: var(--grape); }
.iconbtn { border: 0; background: transparent; color: inherit; padding: 6px; border-radius: 10px; }

/* the item */
.item { display: flex; flex-direction: column; gap: 6px; }
.item-icon { width: 34cqi; max-width: 160px; }
.item-icon svg { width: 100%; height: auto; display: block; }
.stretch { font-family: Bungee, sans-serif; line-height: .92; margin: 0; transform: scaleX(1.12); transform-origin: left; width: 89.3%; overflow-wrap: normal; word-break: normal; }
.item-name { color: var(--yel); }
.light .item-name { color: var(--grape); }
.ask { margin: 0; font-size: 16px; font-weight: 600; color: var(--lpink); }

/* vote buttons */
.vote { border: 0; width: 100%; font-family: Bungee, sans-serif; border-radius: 20px; padding: 16px 0; }
.vote.chewy { background: var(--pink); color: #fff; font-size: 30px; box-shadow: 0 6px 0 var(--pink-dk); letter-spacing: .04em; }
.vote.not { background: var(--yel); color: var(--grape); font-size: 26px; box-shadow: 0 6px 0 var(--yel-dk); margin-top: 4px; }
.vote:active { transform: translateY(4px); box-shadow: none; }
.vote[disabled] { opacity: .6; }
.locked { background: var(--pink); color: #fff; border-radius: 16px; padding: 12px 14px; font-family: Bungee, sans-serif; font-size: 18px; display: flex; justify-content: space-between; align-items: center; }
.locked.not { background: var(--yel); color: var(--grape); }

/* people */
.people { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.chip.waiting { opacity: .45; }
.head { width: 28px; height: 30px; object-fit: contain; flex-shrink: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.small { font-size: 12px; color: var(--lpink); margin: 0; }
.light .small { color: #5b2a6e; }
.links { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; font-weight: 800; }
.link { border: 0; background: none; color: var(--yel); font-weight: 800; padding: 6px 0; text-decoration: underline; text-underline-offset: 3px; }
.light .link { color: var(--pink-dk); }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 800; color: var(--yel); letter-spacing: .04em; }
.light .field { color: var(--grape); }
.input { font-weight: 600; font-size: 16px; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--lpink); background: var(--grape-2); color: #fff; width: 100%; }
.light .input { background: #fff; color: var(--grape); border-color: var(--grape); }
.row { display: flex; gap: 8px; align-items: stretch; }
.btn { border: 0; font-family: Bungee, sans-serif; font-size: 18px; padding: 14px 18px; border-radius: 18px; background: var(--pink); color: #fff; box-shadow: 0 5px 0 var(--pink-dk); }
.btn.grape { background: var(--grape); color: var(--yel); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--yel); border: 2.5px solid var(--yel); box-shadow: none; }
.light .btn.ghost { color: var(--grape); border-color: var(--grape); }
.btn.wide { width: 100%; }
.btn.sm { font-size: 14px; padding: 10px 14px; border-radius: 14px; box-shadow: none; }

/* results */
.kicker { font-family: Bungee, sans-serif; font-size: 22px; margin: 4px 0 0; }
.verdict { color: var(--pink); }
.verdict.not { color: var(--grape); }
.banner { background: var(--grape); color: #fff; border-radius: 12px; padding: 8px 12px; font-size: 13px; font-weight: 600; }
.rope svg { width: 100%; height: auto; display: block; overflow: visible; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.col { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tag { align-self: flex-start; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: var(--pink); color: #fff; white-space: nowrap; }
.tag.not { background: var(--grape); color: var(--yel); }
.col .chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heckle { background: var(--grape); color: #fff; border-radius: 14px; padding: 10px 13px; display: flex; flex-direction: column; gap: 2px; }
.heckle b { font-size: 10px; letter-spacing: .12em; color: var(--yel); }
.heckle span { font-size: 15px; font-weight: 600; }
.defense { display: flex; gap: 8px; align-items: flex-start; }
.defense .say { background: #fff; color: var(--grape); border-radius: 14px; padding: 8px 11px; font-size: 14px; line-height: 1.35; }
.defense .say b { display: block; font-size: 10px; letter-spacing: .1em; color: var(--pink-dk); }
.past { border-top: 2px dashed var(--grape); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.past h3 { margin: 0; font-family: Bungee, sans-serif; font-size: 16px; }
.past-row { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.past-row svg { width: 40px; height: 40px; flex-shrink: 0; }
.past-row .v { margin-left: auto; font-weight: 800; white-space: nowrap; }

/* sheets and toasts */
.sheet-bg { position: fixed; inset: 0; background: rgba(10, 0, 20, .6); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet { width: 100%; max-width: 480px; background: var(--grape-2); color: #fff; border-radius: 24px 24px 0 0; padding: 18px 20px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 10px; max-height: 85vh; overflow-y: auto; }
.sheet h2 { margin: 0; font-family: Bungee, sans-serif; font-size: 20px; color: var(--yel); }
.sheet .opt { border: 0; text-align: left; background: var(--grape); color: #fff; border-radius: 14px; padding: 13px 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.sheet .opt.on { background: var(--pink); }
.sheet img.preview { width: 100%; border-radius: 14px; }
#toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--yel); color: var(--grape); font-weight: 800; padding: 10px 16px; border-radius: 999px; opacity: 0; transition: .2s; pointer-events: none; z-index: 30; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%); }
.err { color: var(--yel); font-weight: 600; font-size: 14px; min-height: 1em; margin: 0; }
.light .err { color: var(--pink-dk); }

/* welcome */
.hero { font-family: Bungee, sans-serif; color: var(--yel); }

/* big head maker */
.maker { position: relative; background: var(--grape-2); border-radius: 18px; overflow: hidden; }
.maker canvas { width: 100%; aspect-ratio: 1; display: block; touch-action: none; cursor: crosshair; background: #3fb8ff; }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.seg button { border: 2px solid var(--lpink); background: transparent; color: #fff; font-weight: 800; padding: 10px 0; border-radius: 12px; }
.seg button.on { background: var(--yel); color: var(--grape); border-color: var(--yel); }
.bighead { width: 120px; height: 120px; object-fit: contain; }

/* TV view */
.tv { width: 100vw; height: 100vh; padding: 4vh 5vw; display: flex; flex-direction: column; gap: 3vh; background: var(--grape); color: #fff; container-type: inline-size; overflow: hidden; }
.tv.light { background: var(--yel); color: var(--grape); }
.tv .bar { display: flex; justify-content: space-between; font-family: Bungee, sans-serif; font-size: 2.2vw; color: var(--yel); }
.tv.light .bar { color: var(--grape); }
.tv .main { flex: 1; display: flex; gap: 4vw; align-items: center; min-height: 0; }
.tv .main svg.icon { width: 24vw; height: auto; flex-shrink: 0; }
.tv .say { font-family: Bungee, sans-serif; font-size: 3vw; color: var(--pink); }
.tv .people { gap: 1.2vw 2vw; }
.tv .chip { font-size: 1.6vw; gap: .6vw; }
.tv .head { width: 4vw; height: 4.3vw; }
.tv .dot { width: 1.4vw; height: 1.4vw; }
.pop { animation: pop .35s ease-out; }
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .pop { animation: none; } #toast { transition: none; } }
.light .dot, .tv.light .dot { box-shadow: 0 0 0 2px var(--grape); }
[hidden] { display: none !important; }
