.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 var(--sp-4); }
.topbar { position: sticky; top: 0; z-index: var(--z-sticky); background: var(--color-primary); color: var(--color-primary-fg); }
.topbar-in { display: flex; align-items: center; gap: var(--sp-2); min-height: 56px; }
.event-name { font-size: var(--fs-18); font-weight: 700; line-height: 1.5; min-width: 0; padding: var(--sp-2) 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.back { color: var(--color-primary-fg); margin-left: calc(-1 * var(--sp-2)); min-width: 44px; min-height: 44px; }
.back:hover { background: rgba(255, 255, 255, .12); }
#offline { padding-top: var(--sp-3); }
main.wrap { padding-top: var(--sp-6); padding-bottom: 120px; }

.section-title { font-size: var(--fs-14); color: var(--color-text-muted); font-weight: 600; margin: var(--sp-6) 0 var(--sp-2); }
.section-title:first-child { margin-top: 0; }

.topic-list { display: grid; gap: var(--sp-3); list-style: none; padding: 0; margin: 0; }
.topic-item {
  width: 100%; text-align: left; display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4); min-height: 72px; cursor: pointer;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card);
  transition: border-color var(--duration-fast) var(--ease);
}
.topic-item:hover { border-color: var(--color-primary); }
.topic-item .grow { flex: 1; min-width: 0; display: grid; gap: var(--sp-1); }
.topic-item .title { font-weight: 700; font-size: var(--fs-18); line-height: 1.4; }
.topic-item .meta { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; font-size: var(--fs-14); color: var(--color-text-muted); }

.topic-head { display: grid; gap: var(--sp-1); margin-bottom: var(--sp-4); }
.topic-head h2 { font-size: var(--fs-28); }

.choices { display: grid; gap: var(--sp-2); list-style: none; padding: 0; margin: 0; }
.choice {
  width: 100%; display: flex; align-items: center; gap: var(--sp-3); text-align: left; cursor: pointer;
  padding: var(--sp-2); padding-right: var(--sp-4); min-height: 88px;
  background: var(--color-surface); border: 2px solid var(--color-border); border-radius: var(--radius-card);
  transition: border-color var(--duration-fast) var(--ease), background var(--duration-fast) var(--ease);
}
.choice[aria-pressed="true"] { border-color: var(--color-primary); background: var(--color-primary-bg); }
.choice[disabled] { cursor: default; opacity: .7; }
.choice .num { font-size: var(--fs-14); font-weight: 700; color: var(--color-primary); }
.choice .name { font-size: var(--fs-18); font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.choice .grow { flex: 1; min-width: 0; }
.tick {
  width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--color-border); background: var(--color-surface); color: transparent;
}
.tick.square { border-radius: 8px; }
.choice[aria-pressed="true"] .tick { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

.vote-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sticky);
  background: var(--color-surface); border-top: 1px solid var(--color-border);
  padding: var(--sp-3) 0 calc(var(--sp-3) + env(safe-area-inset-bottom));
}
.vote-bar .wrap { display: grid; gap: var(--sp-2); }
.vote-bar .status { font-size: var(--fs-14); color: var(--color-text-muted); text-align: center; }

.join { display: grid; gap: var(--sp-4); padding: var(--sp-6); margin-top: var(--sp-4); }
.join h2 { font-size: var(--fs-20); }
.code-input { text-transform: uppercase; /* codes are Latin only */ font-size: var(--fs-28); font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.me { font-size: var(--fs-14); color: var(--color-text-muted); margin-bottom: var(--sp-4); display: flex; gap: var(--sp-2); align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ==== voter page on the stage: the same dark stage as the projector screen, so phone and big screen
   read as one event. Remapping the tokens here re-themes every shared component (cards, inputs, banners). ==== */
body {
  --color-surface: var(--stage-panel);
  --color-surface-2: var(--stage-bg);
  --color-border: var(--stage-line);
  --color-text: var(--stage-text);
  --color-text-muted: var(--stage-muted);
  --color-primary-bg: rgba(232, 185, 49, .14);
  background: var(--stage-bg); color: var(--stage-text);
}
.topbar { background: var(--stage-bg); border-bottom: 1px solid var(--stage-line); }
.event-name { color: var(--stage-text); }
.back, .back:hover { color: var(--stage-text); }
.input { background: #fff; color: #1f1715; border-color: var(--stage-muted); }
.hint, .muted { color: var(--stage-muted); }
.field-error { color: var(--stage-danger); }
.banner { background: var(--stage-panel); color: var(--stage-text); border: 1px solid var(--stage-line); }
.banner-info .icon { color: var(--stage-muted); }
.banner-warning .icon { color: var(--stage-bar); }
.banner-error, .banner-error .icon { color: var(--stage-danger); }
.banner-success .icon { color: var(--stage-success); }
.btn { background: var(--stage-panel-2); border-color: var(--stage-line); color: var(--stage-text); }
.btn:hover { background: var(--stage-line); }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.vote-bar { background: var(--stage-bg); border-top: 1px solid var(--stage-line); }
.section-title { color: var(--stage-muted); }
.toast { background: var(--stage-text); color: var(--stage-bg); border-radius: var(--radius-control); width: max-content; max-width: min(420px, calc(100vw - 32px)); line-height: 1.5; text-align: center; }

/* progress */
.tally { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.tally .row1 { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; }
.tally b { font-size: var(--fs-20); line-height: 1.4; }
.tally .row1 span { font-size: var(--fs-14); color: var(--stage-muted); }
.segs { display: flex; gap: var(--sp-1); }
.segs > span { flex: 1; height: 6px; border-radius: var(--radius-pill); background: var(--stage-panel-2); }
.segs > span.on { background: var(--stage-bar); }
.tally .next-btn { width: 100%; min-width: 0; margin-top: var(--sp-2); }
.tally .next-btn > span, .saved .btn > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; line-height: 1.5; }
.tally .done { font-size: var(--fs-14); color: var(--stage-muted); line-height: 1.5; }

/* topic cards */
.t-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.t-card {
  width: 100%; text-align: left; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); cursor: pointer;
  padding: var(--sp-4); background: var(--stage-panel); color: var(--stage-text);
  border: 1px solid var(--stage-line); border-radius: var(--radius-card); transition: border-color var(--duration-fast) var(--ease);
}
.t-card:hover { border-color: var(--stage-muted); }
.t-card .t-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-12); font-weight: 600; color: var(--stage-muted); line-height: 1.5; }
.t-card .t-title { font-size: var(--fs-20); font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.t-card .t-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-14); color: var(--stage-muted); line-height: 1.5; }
.t-card .go { color: var(--stage-bar); font-weight: 700; display: inline-flex; align-items: center; gap: var(--sp-1); white-space: nowrap; }
.t-card.closed { background: transparent; }
.t-card.closed .t-title, .t-card.closed .strip { opacity: .6; }
.live { display: inline-flex; align-items: center; gap: var(--sp-1); color: var(--stage-success); }
.live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: live 1.6s ease-in-out infinite; }
@keyframes live { 50% { opacity: .35; } }
.new-chip { color: var(--stage-bg); background: var(--stage-bar); border-radius: var(--radius-pill); padding: 0 var(--sp-2); }

/* contestant photo strip */
.strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-2); max-width: 340px; }
.strip .ph { position: relative; aspect-ratio: 4 / 5; border-radius: 6px; overflow: hidden; background: var(--stage-panel-2); display: grid; place-items: center; color: var(--stage-muted); font-weight: 700; }
.strip .ph img { width: 100%; height: 100%; object-fit: cover; }
.strip .ph b { position: absolute; left: 0; bottom: 0; min-width: 20px; padding: 0 4px; background: var(--stage-bar); color: var(--stage-bg); font-size: var(--fs-12); line-height: 1.5; text-align: center; border-top-right-radius: 6px; }
.strip .more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(20, 12, 11, .7); color: var(--stage-text); font-size: var(--fs-16); }

/* your pick */
.mine { display: grid; gap: var(--sp-2); }
.mine .p { display: flex; align-items: center; gap: var(--sp-2); line-height: 1.5; overflow-wrap: anywhere; }
.mine .p .ph { position: relative; flex: none; width: 40px; height: 50px; border-radius: 6px; overflow: hidden; background: var(--stage-panel-2); }
.mine .p .ph img { width: 100%; height: 100%; object-fit: cover; }
.mine .p .ph b { display: none; }
.mine .p .num { color: var(--stage-bar); font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.mine .p .nm { min-width: 0; }
.mine .tick { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--stage-bar); color: var(--stage-bg); flex: none; }
.mine .tick .icon { width: 14px; height: 14px; stroke-width: 3; }

/* waiting for the first topic / the next one */
.waiting { display: grid; gap: var(--sp-2); padding: var(--sp-6) var(--sp-4); background: var(--stage-panel); border: 1px solid var(--stage-line); border-radius: var(--radius-card); }
.waiting h2 { font-size: var(--fs-28); line-height: 1.35; }
.waiting p { color: var(--stage-muted); line-height: 1.6; }
.waiting .live { margin-top: var(--sp-2); font-size: var(--fs-14); }

/* topic page */
.topic-head .kicker { font-size: var(--fs-14); font-weight: 600; color: var(--stage-muted); display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.choices .choice { background: var(--stage-panel); border-color: var(--stage-line); color: var(--stage-text); }
.choices .choice .bno { flex: none; min-width: 40px; font-size: var(--fs-28); font-weight: 700; line-height: 1.3; text-align: center; color: var(--stage-bar); font-variant-numeric: tabular-nums; }
.choices .choice[aria-pressed="true"] { border-color: var(--stage-bar); background: var(--color-primary-bg); }
.choice .mark { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--stage-muted); color: transparent; }
.choice .mark .icon { width: 22px; height: 22px; stroke-width: 3; }
.choice[aria-pressed="true"] .mark { background: var(--stage-bar); border-color: var(--stage-bar); color: var(--stage-bg); animation: pop var(--duration-base) var(--ease); }
@keyframes pop { 0% { transform: scale(.6); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }

.choices.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.choices.grid > li { position: relative; }
.choices.grid .choice { height: 100%; min-height: 0; padding: 0; display: grid; grid-template-rows: auto 1fr; align-items: stretch; gap: 0; border-width: 2px; overflow: hidden; }
.choices.grid .choice[aria-pressed="true"] { border-width: 3px; }
.choices.grid .pic { position: relative; aspect-ratio: 4 / 5; background: var(--stage-panel-2); }
.choices.grid .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.choices.grid .pic .none { position: absolute; inset: 0; display: grid; place-items: center; font-size: var(--fs-14); color: var(--stage-muted); }
.choices.grid .pic .bno { position: absolute; left: 0; top: 0; min-width: 44px; padding: 0 var(--sp-2); font-size: var(--fs-20); background: var(--stage-bar); color: var(--stage-bg); border-bottom-right-radius: 8px; line-height: 1.6; }
.choices.grid .cap { display: flex; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3) var(--sp-3); }
.choices.grid .cap .name { flex: 1; min-width: 0; font-size: var(--fs-16); font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.choices.grid .mark { width: 30px; height: 30px; }
.choices.grid .mark .icon { width: 18px; height: 18px; }
.zoom { position: absolute; right: var(--sp-2); top: var(--sp-2); width: 44px; height: 44px; border-radius: 8px; border: 0; cursor: pointer; display: grid; place-items: center; background: rgba(20, 12, 11, .6); color: #fff; }
.zoom:focus-visible { outline: 3px solid var(--color-info); outline-offset: 2px; }

.saved { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); justify-items: center; text-align: center; padding: var(--sp-6) var(--sp-4); margin-bottom: var(--sp-4); background: var(--stage-panel); border: 1px solid var(--stage-bar); border-radius: var(--radius-card); }
.saved .big { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--stage-bar); color: var(--stage-bg); animation: pop var(--duration-base) var(--ease); }
.saved .big .icon { width: 32px; height: 32px; stroke-width: 3; }
.saved h2 { font-size: var(--fs-20); }
.saved .mine { justify-items: start; text-align: left; }
.saved .btn { width: 100%; min-width: 0; }
.saved p { color: var(--stage-muted); font-size: var(--fs-14); }

dialog.viewer { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; }
dialog.viewer::backdrop { background: rgba(20, 12, 11, .9); }
.viewer-in { display: grid; gap: var(--sp-3); justify-items: center; padding: var(--sp-4); color: #fff; text-align: center; }
.viewer-in img { max-width: calc(100vw - 32px); max-height: calc(100vh - 160px); object-fit: contain; border-radius: 6px; }
.viewer-in p { line-height: 1.5; overflow-wrap: anywhere; max-width: 32rem; }
.saved .mine .tick { display: none; }
.picked-big { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2) var(--sp-6); }
.picked-big .lbl { flex-basis: 100%; font-size: var(--fs-14); color: var(--stage-muted); }
.picked-big .pk { display: grid; justify-items: center; max-width: 100%; }
.picked-big .pk b { font-size: 4rem; line-height: 1.1; color: var(--stage-bar); font-variant-numeric: tabular-nums; }
.picked-big .pk span { font-size: var(--fs-14); color: var(--stage-text); line-height: 1.5; overflow-wrap: anywhere; max-width: 14rem; }

/* ==== cheers: floating button + bottom sheet ==== */
.cheer-fab {
  position: fixed; right: var(--sp-4); bottom: calc(var(--sp-4) + env(safe-area-inset-bottom)); z-index: var(--z-sticky);
  display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 48px; padding: 0 var(--sp-4);
  border: 0; border-radius: var(--radius-pill); background: var(--color-gold); color: #1f1715;
  font: inherit; font-weight: 700; box-shadow: 0 6px 20px rgba(0, 0, 0, .45); cursor: pointer;
}
.cheer-fab[hidden] { display: none; }
body:has(.vote-bar:not([hidden])) .cheer-fab { bottom: calc(140px + env(safe-area-inset-bottom)); }
main#app { padding-bottom: 88px; }

dialog.cheer-sheet {
  margin: auto 0 0; width: 100%; max-width: 100%; border: 0; padding: 0;
  background: var(--stage-panel); color: var(--stage-text); border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--stage-line);
}
dialog.cheer-sheet::backdrop { background: rgba(20, 12, 11, .6); }
.cs-in { max-width: 32rem; margin: 0 auto; padding: var(--sp-4) var(--sp-4) calc(var(--sp-6) + env(safe-area-inset-bottom)); display: grid; gap: var(--sp-3); }
.cs-head { display: flex; align-items: center; justify-content: space-between; }
.cs-head h2 { font-size: var(--fs-20); }
.cs-emoji { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--sp-2); }
.cs-emoji[hidden] { display: none; }
.cs-e { position: relative; aspect-ratio: 1; min-height: 48px; border: 1px solid var(--stage-line); border-radius: 14px;
  background: var(--stage-bg); font-size: 1.9rem; line-height: 1; cursor: pointer; touch-action: manipulation; }
.cs-e:active { transform: scale(.92); }
.cs-pop { position: absolute; left: 50%; top: 0; pointer-events: none; animation: cs-pop 700ms ease-out forwards; }
@keyframes cs-pop { from { transform: translate(-50%, 0) scale(1); opacity: 1; } to { transform: translate(-50%, -60px) scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cs-pop { animation: none; display: none; } .cs-e:active { transform: none; } }
.cs-text { display: grid; gap: var(--sp-2); }
.cs-text[hidden] { display: none; }
.cs-text label { font-weight: 600; }
.cs-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-2); }
.cs-ok { color: var(--stage-success); min-height: 1.5em; }

/* join: open from a picture of the card */
.or-pic { display: grid; gap: var(--sp-2); }
.or-pic .or { display: flex; align-items: center; gap: var(--sp-3); color: var(--stage-muted); font-size: var(--fs-14); }
.or-pic .or::before, .or-pic .or::after { content: ""; flex: 1; border-top: 1px solid var(--stage-line); }
.pic-btn { cursor: pointer; }
.or-pic:focus-within .pic-btn { outline: 2px solid var(--color-gold); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* who am I: name (this phone only) + hidden code */
.me-card { display: grid; gap: var(--sp-2); justify-content: stretch; background: var(--stage-panel); border: 1px solid var(--stage-line); border-radius: var(--radius-card); padding: var(--sp-3) var(--sp-4); }
.me-name { display: inline-flex; align-items: center; gap: var(--sp-2); justify-self: start; max-width: 100%; min-height: 44px; padding: 0; border: 0; background: none; color: var(--stage-text); font: inherit; font-size: var(--fs-16); cursor: pointer; text-align: left; }
.me-name b { overflow-wrap: anywhere; }
.me-name .icon { width: 16px; height: 16px; color: var(--stage-muted); flex: none; }
.me-edit { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-2); }
.me-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; }
.me-code { display: inline-flex; align-items: center; gap: var(--sp-1); }
.me-code .mono { font-family: ui-monospace, Menlo, monospace; letter-spacing: .05em; color: var(--stage-text); }
.me-eye { min-width: 44px; min-height: 44px; justify-content: center; }
.me-name.fixed { cursor: default; margin: 0; }
