:root {
  --navy: #222e50;
  --navy-deep: #171f38;
  --navy-soft: #33406b;
  --accent: #e3a92c;
  --accent-soft: #f6d68a;
  --teal: #2f8f83;
  --ink: #12172a;
  --muted: #5f6880;
  --line: #dfe3ec;
  --surface: #f6f7fb;
  --white: #ffffff;
  --ok: #2e7d5b;
  --danger: #b3402f;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(18, 23, 42, .09);
  --font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--navy); }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 18px 60px;
}

.wrap-wide { max-width: 1100px; }

/* ------------------------------------------------------------- brand header */

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0 18px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: block;
  flex: none;
  object-fit: cover;
}

.brand-text { line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 15px; color: var(--navy); }
.brand-event { font-size: 13px; color: var(--muted); }

/* --------------------------------------------------------------------- card */

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}

.card h1 { font-size: 22px; margin: 0 0 6px; line-height: 1.3; }
.card h2 { font-size: 17px; margin: 0 0 12px; }
.sub { color: var(--muted); font-size: 15px; margin: 0 0 18px; line-height: 1.5; }

.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(34, 46, 80, .08);
  color: var(--navy);
  margin-bottom: 14px;
}

.pill-open { background: rgba(46, 125, 91, .12); color: var(--ok); }
.pill-closed { background: rgba(179, 64, 47, .1); color: var(--danger); }

/* ------------------------------------------------------------------ options */

.options { display: grid; gap: 10px; margin: 0 0 18px; }

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  cursor: pointer;
  font-size: 17px;
  line-height: 1.35;
  transition: border-color .12s ease, background .12s ease;
  user-select: none;
}

.option:active { background: #f2f4f9; }

.option input { position: absolute; opacity: 0; pointer-events: none; }

.option .box {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 2px solid var(--line);
  flex: none;
  display: grid;
  place-items: center;
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
}

.option.selected { border-color: var(--navy); background: rgba(34, 46, 80, .04); }
.option.selected .box { background: var(--navy); border-color: var(--navy); }
.option.selected .box::after { content: "\2713"; }

/* -------------------------------------------------------------------- forms */

label.field { display: block; font-size: 14px; font-weight: 600; margin: 0 0 6px; }

input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}

textarea { min-height: 110px; resize: vertical; line-height: 1.5; }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(34, 46, 80, .12);
}

.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border: 0;
  border-radius: 11px;
  background: var(--navy);
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { background: var(--navy-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn-ghost:hover { background: #eef0f6; }
.btn-accent { background: var(--accent); color: var(--navy-deep); }
.btn-accent:hover { background: #d09a22; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(179, 64, 47, .35); }
.btn-danger:hover { background: rgba(179, 64, 47, .07); }
.btn-sm { padding: 8px 13px; font-size: 14px; border-radius: 9px; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grow { flex: 1 1 auto; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }

.notice {
  padding: 13px 15px;
  border-radius: 10px;
  font-size: 15px;
  margin-bottom: 16px;
  line-height: 1.45;
}
.notice-ok { background: rgba(46, 125, 91, .1); color: #1f5a41; }
.notice-err { background: rgba(179, 64, 47, .1); color: #8a3123; }
.notice-info { background: rgba(34, 46, 80, .07); color: var(--navy); }

/* ------------------------------------------------------------------ results */

.result-row { margin-bottom: 14px; }

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 15px;
  margin-bottom: 6px;
}
.result-label { font-weight: 600; }
.result-num { color: var(--muted); white-space: nowrap; }

.bar {
  height: 14px;
  border-radius: 999px;
  background: #e9ecf3;
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-soft) 100%);
  transition: width .5s cubic-bezier(.2, .8, .2, 1);
}
.result-row.top .bar span { background: linear-gradient(90deg, var(--accent) 0%, var(--accent-soft) 100%); }

.text-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.text-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 14px 15px;
  font-size: 16px;
  line-height: 1.45;
}
.text-card .who { display: block; margin-top: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---------------------------------------------------------------- presenter */

body.present {
  background: var(--navy);
  color: var(--white);
  overflow-x: hidden;
}

.present-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 3vh 4vw;
}

.present-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: clamp(13px, 1.1vw, 18px);
  color: rgba(255, 255, 255, .62);
  letter-spacing: .6px;
  text-transform: uppercase;
  font-weight: 600;
}

.present-brand {
  display: flex;
  align-items: center;
  gap: .75em;
  min-width: 0;
}

.present-logo {
  height: clamp(22px, 2.5vw, 42px);
  width: auto;
  display: block;
  flex: none;
}

.present-brand-sep { color: rgba(255, 255, 255, .35); }

.present-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1.5fr .8fr;
  gap: 4vw;
  align-items: center;
  padding: 3vh 0;
}

.present-body.solo { grid-template-columns: 1fr; }
.present-body.results { align-items: start; padding-top: 2vh; }
.present-body.results .present-sub { max-width: none; margin-bottom: 1.5vh; }

.present-q {
  font-size: clamp(28px, 4.2vw, 68px);
  line-height: 1.14;
  font-weight: 700;
  margin: 0 0 2vh;
  letter-spacing: -.5px;
}

.present-sub {
  font-size: clamp(16px, 1.6vw, 26px);
  color: rgba(255, 255, 255, .72);
  line-height: 1.45;
  margin: 0 0 3vh;
  max-width: 34ch;
}

.present-opts { display: grid; gap: 1.4vh; max-width: 30ch; }
.present-opt {
  font-size: clamp(15px, 1.5vw, 24px);
  color: rgba(255, 255, 255, .88);
  padding: 1.1vh 0 1.1vh 1.6em;
  position: relative;
}
.present-opt::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: .7em;
  height: .7em;
  border-radius: 4px;
  background: var(--accent);
  opacity: .85;
}

.join {
  background: var(--white);
  color: var(--ink);
  border-radius: 22px;
  padding: 2.6vh 2vw;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}

.join canvas, .join img, .join svg {
  width: 100%;
  height: auto;
  max-width: 340px;
  display: block;
  margin: 0 auto;
  image-rendering: pixelated;
}

.join-label {
  font-size: clamp(12px, 1vw, 16px);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 1.4vh;
}

.join-url {
  margin-top: 1.6vh;
  font-size: clamp(14px, 1.15vw, 20px);
  font-weight: 700;
  color: var(--navy);
  word-break: break-all;
}

.join-code {
  margin-top: 1vh;
  font-size: clamp(13px, 1.05vw, 18px);
  color: var(--muted);
  letter-spacing: .5px;
}
.join-code strong {
  color: var(--navy);
  letter-spacing: 4px;
  font-size: clamp(16px, 1.4vw, 24px);
}

.counter {
  display: flex;
  align-items: baseline;
  gap: .5em;
  margin-top: 3vh;
}
.counter-num {
  font-size: clamp(40px, 6vw, 96px);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.counter-label {
  font-size: clamp(14px, 1.3vw, 22px);
  color: rgba(255, 255, 255, .7);
}

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--accent);
}

.present-status {
  font-size: clamp(15px, 1.5vw, 24px);
  color: rgba(255, 255, 255, .75);
}

.present .result-head { color: var(--white); font-size: clamp(15px, 1.5vw, 26px); }
.present .result-num { color: rgba(255, 255, 255, .65); }
.present .bar { background: rgba(255, 255, 255, .14); height: clamp(14px, 1.7vw, 26px); }
.present .bar span { background: linear-gradient(90deg, #6f83c4 0%, #9aabdd 100%); }
.present .result-row.top .bar span { background: linear-gradient(90deg, var(--accent) 0%, var(--accent-soft) 100%); }
.present .result-row { margin-bottom: clamp(10px, 1.6vh, 22px); }
.present .text-card { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .12); border-left-color: var(--accent); color: var(--white); font-size: clamp(15px, 1.25vw, 21px); padding: 18px 20px; }
.present .text-card .who { color: rgba(255, 255, 255, .6); }
.present .text-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); max-height: 74vh; overflow-y: auto; }

.results-scroll { max-height: 78vh; overflow-y: auto; padding-right: 8px; scrollbar-width: none; }
.results-scroll::-webkit-scrollbar { width: 0; height: 0; }

.scroll-note {
  font-size: .72em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, .45);
  margin-left: .6em;
}

/* If a question draws more comments than the screen holds, tighten the cards
   rather than hiding answers below an invisible scroll line. */
.present .results-scroll.dense .text-cards {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 10px;
}
.present .results-scroll.dense .text-card {
  font-size: clamp(13px, 1vw, 17px);
  padding: 12px 14px;
}
.present .results-scroll.denser .text-cards {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 8px;
}
.present .results-scroll.denser .text-card {
  font-size: clamp(11px, .82vw, 14px);
  padding: 9px 11px;
  line-height: 1.35;
}
.present .results-scroll.denser .text-card .who { margin-top: 5px; font-size: 11px; }

@media (max-width: 900px) {
  .present-body { grid-template-columns: 1fr; }
  .join { max-width: 380px; margin: 0 auto; }
}

/* -------------------------------------------------------------------- admin */

.admin-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.qlist { display: grid; gap: 14px; }

.qitem {
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.qitem.active { border-left-color: var(--accent); }
.qitem h3 { margin: 0 0 4px; font-size: 17px; line-height: 1.35; }
.qmeta { font-size: 13px; color: var(--muted); margin-bottom: 12px; }

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #eef0f6;
  color: var(--navy);
  margin-right: 6px;
}
.tag-open { background: rgba(46, 125, 91, .14); color: var(--ok); }
.tag-closed { background: rgba(179, 64, 47, .12); color: var(--danger); }
.tag-revealed { background: rgba(227, 169, 44, .2); color: #8a6410; }
.tag-live { background: var(--navy); color: var(--white); }

table.mini { width: 100%; border-collapse: collapse; font-size: 14px; }
table.mini td { padding: 6px 0; border-bottom: 1px solid var(--line); }
table.mini td:last-child { text-align: right; color: var(--muted); white-space: nowrap; }

.footer-note { font-size: 13px; color: var(--muted); text-align: center; margin-top: 30px; line-height: 1.6; }

.fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.fieldset legend { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 0 6px; }

.check { display: flex; align-items: center; gap: 10px; font-size: 15px; margin: 10px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--navy); }
