/* Awards Vote Template styles. Colors come from the admin Setup tab
   through the CSS variables below (see applyTheme in js/ui.js). */
:root {
  --bg: #f4eee4;
  --text: #4a2410;
  --accent: #6e2f0f;
  --option: #3b3b3b;
  --option-text: #ffffff;
  --card: rgba(255, 255, 255, 0.72);
  --line: rgba(0, 0, 0, 0.12);
  --muted: rgba(0, 0, 0, 0.55);
  --ok: #1f7a3a;
  --warn: #9a5b00;
  --bad: #a3271f;
  --radius: 999px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(120% 60% at 110% 110%, rgba(255, 255, 255, 0.65) 0 38%, transparent 39%),
    radial-gradient(90% 70% at -20% 120%, rgba(0, 0, 0, 0.035) 0 42%, transparent 43%),
    radial-gradient(70% 50% at 120% -10%, rgba(0, 0, 0, 0.03) 0 45%, transparent 46%);
  background-attachment: fixed;
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- banner and layout ---------- */
.banner {
  height: 64px;
  background-repeat: repeat-x;
  background-size: auto 100%;
  background-position: center;
  border-bottom: 1px solid var(--line);
}
.demo-bar {
  background: #2b2b2b;
  color: #fff;
  font-size: 13px;
  text-align: center;
  padding: 6px 10px;
}
.demo-bar a { color: #ffd38a; }
.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 20px 16px 120px; }
.wrap.wide { max-width: 980px; }
.event-title {
  text-align: center;
  font-weight: 800;
  font-size: clamp(22px, 6vw, 30px);
  margin: 10px 0 18px;
  letter-spacing: 0.2px;
  overflow-wrap: anywhere;
}
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

/* ---------- welcome / status ---------- */
.welcome { text-align: center; padding-top: 6vh; }
.welcome .blurb { font-size: 18px; max-width: 460px; margin: 0 auto 18px; overflow-wrap: anywhere; }
.phase-pill {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.06);
  margin-bottom: 14px;
}
.notice {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 14px auto;
  max-width: 460px;
}
.who { font-size: 14px; color: var(--muted); margin-top: 26px; }
.who button { background: none; border: 0; color: var(--accent); text-decoration: underline; padding: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 22px;
  border-radius: var(--radius);
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn.big { min-height: 54px; padding: 12px 30px; font-size: 18px; }
.btn.ghost { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
.btn.quiet { background: rgba(0, 0, 0, 0.07); color: var(--text); }
.btn.danger { background: var(--bad); }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 14px; }
.btn.twitch { background: #6441a5; }
.btn.discord { background: #5865f2; }
.btn.full { width: 100%; }
.linkish { background: none; border: 0; color: var(--accent); text-decoration: underline; padding: 8px 4px; min-height: 44px; }

/* ---------- ballot ---------- */
.question { margin-top: 8vh; }
.q-label {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 15px;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}
.q-help { font-size: 14px; color: var(--muted); margin: -6px 0 12px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 16px;
  border: 2px solid transparent;
  background: var(--option);
  color: var(--option-text);
  text-align: left;
  font-size: 16px;
  overflow-wrap: anywhere;
}
.option:hover { filter: brightness(1.15); }
.option .dot {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0.85;
}
.option[aria-checked="true"], .option[aria-selected="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9) inset;
  filter: brightness(1.25);
}
.option[aria-checked="true"] .dot, .option[aria-selected="true"] .dot { background: currentColor; box-shadow: 0 0 0 3px var(--option) inset; }
.option.active { outline: 3px solid var(--accent); outline-offset: 2px; }
.search {
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 16px;
  border: 2px solid var(--option);
  background: #fff;
  font-size: 16px;
}
.listbox {
  margin-top: 10px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px;
}
.pick-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.pick-chip .spacer { flex: 1; }
.writein { margin-top: 12px; }
.writein input { margin-top: 8px; }
.nav { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.nav .hint { font-size: 13px; font-style: italic; color: var(--muted); }
.nav .hint b { font-style: normal; }
.progress {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.progress-inner { max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.progress .count { font-size: 13px; font-weight: 700; min-width: 54px; }
.progress .bar { flex: 1; height: 8px; border-radius: 99px; background: rgba(0, 0, 0, 0.12); overflow: hidden; }
.progress .fill { height: 100%; background: var(--accent); width: 0; transition: width 0.25s ease; }
.progress .pct { font-size: 13px; min-width: 38px; text-align: right; }
.arrow-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}
.arrow-btn:disabled { opacity: 0.35; }

/* ---------- review ---------- */
.review-list { list-style: none; padding: 0; margin: 0; }
.review-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.review-list .cat { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.3px; }
.review-list .choice { font-size: 16px; overflow-wrap: anywhere; }
.review-list .choice.skip { color: var(--muted); font-style: italic; }
.review-list .grow { flex: 1; min-width: 0; }

/* ---------- messages ---------- */
.error-box, .ok-box, .warn-box {
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
  font-size: 15px;
}
.error-box { background: #fdecea; color: var(--bad); border: 1px solid #f5c2bd; }
.ok-box { background: #e9f6ee; color: var(--ok); border: 1px solid #b9e2c6; }
.warn-box { background: #fff4e0; color: var(--warn); border: 1px solid #f3d29a; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  background: #222;
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 15px;
  z-index: 50;
  max-width: calc(100% - 32px);
}
.spinner { text-align: center; padding: 18vh 0; color: var(--muted); }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 18px; }
.tab {
  border: 0;
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--radius);
  padding: 10px 16px;
  min-height: 44px;
  font-weight: 700;
}
.tab[aria-selected="true"] { background: var(--accent); color: #fff; }
.badge { display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 12px; margin-left: 4px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
}
.card h3 { margin: 0 0 8px; font-size: 17px; overflow-wrap: anywhere; }
.card h4 { margin: 14px 0 6px; font-size: 15px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.status { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px; }
.status.open { background: #d9f2e1; color: var(--ok); }
.status.closed { background: #eee; color: #555; }
.status.scheduled, .status.unscheduled { background: #fff1d6; color: var(--warn); }
.status.not_ready { background: #f3e3e1; color: var(--bad); }
.kv { font-size: 14px; color: var(--muted); }
.tally { width: 100%; border-collapse: collapse; font-size: 15px; }
.tally td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.tally td.n { text-align: right; font-variant-numeric: tabular-nums; width: 60px; font-weight: 700; }
.tally td.mark { width: 34px; text-align: center; }
.tally tr.adv td { background: rgba(31, 122, 58, 0.09); }
.tally tr.tie td { background: rgba(154, 91, 0, 0.12); }
.flag { border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 14px; }
.flag.tie { background: #fff1d6; color: #6b4200; }
.flag.short { background: #e8f0fb; color: #1d4c8f; }
.flag.none { background: #eee; color: #444; }
.flag.pending { background: #fdecea; color: var(--bad); }
.flag .row { margin-top: 8px; }
label.field { display: block; font-size: 14px; font-weight: 700; margin: 10px 0 4px; }
.input, select.input, textarea.input {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  background: #fff;
  font-size: 16px;
}
textarea.input { min-height: 120px; font-family: inherit; }
.input.narrow { width: 110px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; }
.check input { width: 20px; height: 20px; }
.table-wrap { overflow-x: auto; }
.edit-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.edit-table th { text-align: left; font-size: 13px; color: var(--muted); padding: 6px; }
.edit-table td { padding: 6px; border-top: 1px solid var(--line); vertical-align: middle; }
.icon-btn { min-width: 40px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 15px; }
.nominee-row { display: flex; gap: 8px; margin: 6px 0; align-items: center; }
.nominee-row .input { flex: 1; }
.group-texts { list-style: none; padding: 0; margin: 6px 0; }
.group-texts li { padding: 4px 0; }
.confirm-panel { margin-top: 10px; padding: 12px; border-radius: 12px; background: #fff4e0; border: 1px solid #f3d29a; }

/* ---------- results ---------- */
.result-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin-bottom: 16px; }
.result-card .cat { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.result-card .winner { font-size: 26px; font-weight: 800; margin: 6px 0 10px; overflow-wrap: anywhere; }
.result-card .winner::before { content: "\1F3C6  "; }
.result-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 15px; }
.result-row .name { flex: 0 0 42%; overflow-wrap: anywhere; }
.result-row .bar { flex: 1; height: 10px; border-radius: 99px; background: rgba(0, 0, 0, 0.1); overflow: hidden; }
.result-row .bar span { display: block; height: 100%; background: var(--accent); }
.result-row .pct { width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.result-row.win .name { font-weight: 800; }

body.obs { background: transparent !important; background-image: none !important; }
body.obs .wrap { max-width: 900px; padding-bottom: 20px; }
body.obs .result-card { background: rgba(0, 0, 0, 0.55); color: #fff; border: 0; }
body.obs .result-card .cat { color: rgba(255, 255, 255, 0.8); font-size: 22px; }
body.obs .result-card .winner { font-size: 56px; }
body.obs .result-row { font-size: 24px; }
body.obs .result-row .bar { background: rgba(255, 255, 255, 0.2); }
body.obs .event-title { color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); font-size: 40px; }

@media (min-width: 720px) {
  .banner { height: 76px; }
  .question { margin-top: 10vh; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
