:root {
  --navy-primary: #284256;
  --navy-deep: #192530;
  --navy-tint: #2D495F;
  --green-primary: #00B48A;
  --green-text: #008C6C;
  --green-hover: #00A47E;
  --ink: #070707;
  --ink-secondary: #454545;
  --surface: #F5F8FA;
  --border: #E6E6E6;
  --sage: #8AB0AB;
  --pale-blue: #A4C1D5;
  --gold: #ECD67F;
  --white: #FFFFFF;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--navy-deep), var(--navy-tint) 130%);
  background-attachment: fixed;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--white);
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand img.logo {
  height: 28px;
  width: auto;
  display: block;
}

.brand-divider {
  width: 1px;
  align-self: stretch;
  min-height: 24px;
  background: rgba(255, 255, 255, 0.25);
}

.topbar h1 {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
}

.badge {
  background: var(--green-primary);
  color: var(--navy-deep);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 20px 40px rgba(9, 15, 24, 0.35);
  margin-bottom: 20px;
}

.card h2 {
  margin-top: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--navy-primary);
  border-left: 3px solid var(--green-primary);
  padding-left: 10px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.group-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--white);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group-card .name {
  font-weight: 700;
  font-size: 15px;
  color: var(--navy-primary);
}

.group-card .product {
  font-size: 13px;
  color: var(--ink-secondary);
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  display: block;
  margin-bottom: 4px;
}

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

input[type="text"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--green-primary);
  box-shadow: 0 0 0 3px rgba(0, 180, 138, 0.15);
}

textarea { resize: vertical; min-height: 60px; }

.field { flex: 1; min-width: 160px; margin-bottom: 12px; }

.option-field {
  flex: 1;
  min-width: 180px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface);
}

.option-field label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  color: var(--navy-primary);
}

.option-field input[type="radio"] {
  accent-color: var(--green-primary);
  width: 15px;
  height: 15px;
}

.option-field input[type="text"] {
  border-color: var(--border);
  background: var(--white);
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  transition: transform .1s ease, opacity .15s ease, background .15s ease;
}

button:active { transform: scale(0.97); }

.btn-primary {
  background: var(--green-primary);
  color: var(--white);
}

.btn-primary:hover { background: var(--green-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--navy-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--navy-primary);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--white);
  color: var(--navy-primary);
  border: 1px solid var(--border);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.option-btn {
  width: 100%;
  text-align: left;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 12px;
}

.option-btn .dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--navy-primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.option-btn:hover { border-color: var(--green-primary); }
.option-btn.correct { border-color: var(--green-primary); background: #E6F7F2; }
.option-btn.incorrect { border-color: var(--border); background: var(--surface); }
.option-btn:disabled { cursor: default; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th, td {
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
}

thead th {
  background: var(--navy-primary);
  color: var(--white);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: none;
}

thead th:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
thead th:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }

tbody tr:nth-child(even) { background: var(--surface); }

.qr-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(25, 37, 48, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.qr-modal {
  background: var(--white);
  border-radius: 16px;
  padding: 28px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.qr-modal h2 {
  color: var(--navy-primary);
  font-size: 18px;
}

.qr-modal #qr-canvas {
  display: flex;
  justify-content: center;
  margin: 16px 0;
  padding: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.link-box {
  font-size: 12px;
  word-break: break-all;
  background: var(--surface);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink-secondary);
  margin-bottom: 14px;
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.pill.correct { background: #E6F7F2; color: var(--green-text); }
.pill.wrong { background: var(--surface); color: var(--ink-secondary); }
.pill.pending { background: var(--pale-blue); color: var(--navy-deep); }

.empty {
  color: var(--ink-secondary);
  font-size: 14px;
  text-align: center;
  padding: 30px 10px;
}

.center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.muted { color: var(--ink-secondary); font-size: 13px; }

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--green-primary);
}

.guess-header {
  color: var(--white);
  text-align: center;
  margin-bottom: 18px;
}

.guess-header .brand {
  justify-content: center;
  margin-bottom: 14px;
}

.guess-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

/* Audience display (projector screen) */

.display-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.display-wrap {
  width: 100%;
  max-width: 900px;
  padding: 40px 24px;
  text-align: center;
}

.display-brand {
  margin-bottom: 40px;
  display: flex;
  justify-content: center;
}

.display-brand img.logo {
  height: 36px;
}

.display-screen {
  color: var(--white);
}

.display-eyebrow {
  color: var(--green-primary);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin: 0 0 12px;
}

.display-title {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 700;
  margin: 0 0 16px;
  line-height: 1.1;
}

.display-sub {
  font-size: clamp(16px, 2.2vw, 22px);
  color: rgba(255, 255, 255, 0.75);
  margin: 0 0 28px;
}

.display-qr {
  display: inline-flex;
  padding: 20px;
  background: var(--white);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(9, 15, 24, 0.45);
}

.display-count {
  margin-top: 28px;
  font-size: 20px;
  font-weight: 600;
  color: var(--green-primary);
}

.display-answer {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 700;
  color: var(--green-primary);
  margin: 0 0 14px;
}

.display-accuracy {
  font-size: 20px;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 32px;
}

.display-bars {
  max-width: 520px;
  margin: 0 auto;
  text-align: left;
}

.display-bar-row {
  margin-bottom: 16px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.85);
}

.display-bar-row.is-correct { color: var(--white); font-weight: 700; }

.display-bar-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.display-bar-track {
  background: rgba(255, 255, 255, 0.15);
}

/* Admin passphrase gate */

body.gated .wrap { display: none; }
body.gated .qr-modal-backdrop { display: none !important; }

.admin-gate {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

body.gated .admin-gate { display: flex; }

.admin-gate-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 36px 32px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(9, 15, 24, 0.35);
}

.admin-gate-card img.logo {
  height: 26px;
  margin-bottom: 20px;
}

.admin-gate-card h1 {
  font-size: 19px;
  font-weight: 700;
  color: var(--navy-primary);
  margin: 0 0 6px;
}

.admin-gate-card form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.admin-gate-error {
  color: var(--gold);
  background: var(--navy-deep);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  margin-top: 12px;
}
