:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #627080;
  --line: #d7dde4;
  --paper: #fbfcfd;
  --panel: #ffffff;
  --stage-1: #0095da;
  --stage-2: #a6ce38;
  --stage-3: #c98900;
  --stage-4: #c6533f;
  --stage-5: #a54786;
  --shadow: 0 18px 50px rgba(20, 35, 55, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
a {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
}

button:hover,
a:hover {
  border-color: #9ba8b5;
}

.app-shell {
  width: min(1680px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar,
.status-band,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  min-height: 80px;
}

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

.brand-logo {
  width: clamp(180px, 18vw, 280px);
  height: auto;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.7rem, 3.5vw, 3.3rem);
  line-height: 1.02;
}

.page-subtitle {
  max-width: 780px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.32;
}

h2 {
  font-size: 1.25rem;
}

.top-actions,
.presenter-actions,
.cta-actions,
.offer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.top-actions {
  display: none;
}

.presenter-mode .top-actions {
  display: flex;
}

.cta-actions {
  display: none;
}

.cta-actions.is-visible {
  display: flex;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-weight: 800;
  font-size: 1rem;
}

.status-band {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 8px 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 28px rgba(26, 39, 52, 0.08);
}

.score-panel {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 10px;
  align-items: end;
  min-width: 240px;
}

.panel-label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

#scoreValue {
  font-size: 2.2rem;
  line-height: 1;
}

#scoreBand {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.25;
}

.meter {
  flex: 1;
  min-width: 180px;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #e7ebef;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--stage-1), var(--stage-2), var(--stage-3), var(--stage-4), var(--stage-5));
  transition: width 180ms ease;
}

.primary-action,
.secondary-action,
.presenter-actions button,
menu button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
  text-decoration: none;
}

.primary-action,
#registrationSubmit,
#participantSubmit {
  border: 1px solid #17212b;
  background: #17212b;
  color: #fff;
}

.secondary-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.continuum-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.live-row-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 1120px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: #eef5f6;
}

.live-row-banner span {
  font-weight: 800;
}

.live-row-banner em {
  margin-left: auto;
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.continuum-grid {
  display: grid;
  grid-template-columns: minmax(230px, 0.78fr) repeat(5, minmax(190px, 1fr));
  min-width: 1180px;
}

.grid-cell {
  min-height: 150px;
  padding: 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.grid-cell:nth-child(6n) {
  border-right: 0;
}

.header-cell {
  min-height: 118px;
  color: #fff;
}

.header-cell h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 1.15;
}

.header-cell p,
.category-cell p,
.choice-card p {
  margin: 0;
  line-height: 1.38;
}

.corner-cell {
  background: #1f2d3a;
  color: #fff;
}

.stage-1 { background: var(--stage-1); }
.stage-2 { background: var(--stage-2); color: var(--ink); }
.stage-3 { background: var(--stage-3); }
.stage-4 { background: var(--stage-4); }
.stage-5 { background: var(--stage-5); }

.category-cell {
  background: #f4f7f9;
}

.category-cell h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.row-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.choice-card {
  position: relative;
  display: block;
  width: 100%;
  min-height: 100%;
  padding: 13px 13px 36px;
  border: 2px solid transparent;
  border-radius: 8px;
  text-align: left;
  background: #fbfcfd;
}

.choice-card:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.choice-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.88rem;
}

.choice-card p {
  color: #314150;
  font-size: 0.9rem;
}

.choice-card.is-selected {
  border-color: currentColor;
  box-shadow: 0 10px 22px rgba(28, 43, 58, 0.14);
}

.choice-card.is-selected::after {
  content: "Selected";
  position: absolute;
  right: 10px;
  bottom: 9px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.row-active {
  box-shadow: inset 0 0 0 3px rgba(22, 124, 128, 0.2);
}

.row-paused {
  background: #fff8e8;
}

.row-locked {
  background: #f7f8fa;
}

.diagnostic,
.presenter-panel {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.diagnostic {
  overflow-x: auto;
}

.diagnostic.is-hidden {
  display: none;
}

.band-list {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  min-width: 1180px;
}

.band-card {
  flex: 1 0 220px;
  min-height: 112px;
  padding: 13px;
  border-left: 6px solid var(--line);
  background: #f8fafb;
}

.band-card strong {
  display: block;
  margin-bottom: 6px;
}

.band-card p {
  margin: 0;
  color: #314150;
  font-size: 0.9rem;
  line-height: 1.34;
}

.presenter-panel {
  display: none;
}

.presenter-panel.is-visible {
  display: block;
}

.presenter-workspace {
  display: none;
}

.presenter-mode .status-band,
.presenter-mode .continuum-wrap,
.presenter-mode .diagnostic {
  display: none;
}

.presenter-mode .presenter-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.presenter-mode .presenter-panel {
  display: block;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow: auto;
  margin-top: 0;
}

.presenter-script {
  padding: 20px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}

.script-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.script-head h2 {
  font-size: clamp(1.6rem, 2.4vw, 2.5rem);
  line-height: 1.08;
}

.script-notes {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.script-notes p {
  margin: 0;
  color: #253544;
  font-size: 1.02rem;
  line-height: 1.42;
}

.script-notes strong {
  color: var(--ink);
}

.presenter-stage-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.presenter-stage {
  padding: 14px;
  color: #fff;
}

.presenter-stage.stage-2 {
  color: var(--ink);
}

.presenter-stage h4 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.presenter-stage h4 span {
  font-size: 0.82rem;
  opacity: 0.9;
}

.presenter-stage p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.36;
}

.presenter-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 800;
}

.presenter-status span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.response-count {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #f8fafb;
}

.response-count strong {
  font-size: 2rem;
  line-height: 1;
}

.response-count span {
  color: var(--muted);
  font-weight: 800;
}

.audience-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.audience-card {
  min-height: 74px;
  padding: 9px;
  color: #fff;
}

.audience-card strong {
  display: block;
  font-size: 1.7rem;
  line-height: 1;
}

.audience-card span,
.audience-card small {
  display: block;
  margin-top: 5px;
  font-weight: 800;
}

.audience-card small {
  margin-top: 2px;
  font-size: 0.72rem;
}

.presenter-mode .audience-summary {
  grid-template-columns: 1fr;
  gap: 6px;
}

.presenter-mode .audience-card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  min-height: 46px;
  padding: 8px 10px;
}

.presenter-mode .audience-card strong {
  font-size: 1.55rem;
}

.presenter-mode .audience-card span,
.presenter-mode .audience-card small {
  margin-top: 0;
}

.presenter-mode .audience-card small {
  font-size: 0.78rem;
}

.chip-row {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.chip {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.row-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.row-summary-card {
  padding: 14px;
  border: 1px solid var(--line);
  background: #f8fafb;
}

.row-summary-card h3 {
  margin: 0 0 12px;
  font-size: 0.98rem;
}

.mini-bars {
  display: grid;
  gap: 7px;
}

.mini-bars div {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 8px;
  align-items: center;
}

.mini-bars span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.mini-bars b {
  min-width: 24px;
  padding: 3px 6px;
  color: #fff;
  font-size: 0.78rem;
  line-height: 1;
}

.registration-dialog,
.offer-dialog {
  width: min(620px, calc(100% - 28px));
  border: 0;
  padding: 0;
  box-shadow: var(--shadow);
}

.registration-dialog::backdrop,
.offer-dialog::backdrop {
  background: rgba(17, 29, 42, 0.58);
}

.registration-dialog form,
.offer-dialog form {
  padding: 18px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.dialog-copy,
.offer-copy,
.fine-print {
  margin: 0 0 16px;
  color: #314150;
  line-height: 1.42;
}

.fine-print {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid.single-field {
  grid-template-columns: 1fr;
}

label {
  display: grid;
  gap: 6px;
  color: #304050;
  font-size: 0.88rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.checkline {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-weight: 700;
}

.checkline input {
  width: 18px;
  min-height: 18px;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  max-width: min(520px, calc(100% - 24px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #17212b;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.toast.is-visible {
  opacity: 1;
}

@media (max-width: 900px) {
  .topbar,
  .status-band,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-band {
    position: static;
  }

  .audience-summary,
  .row-summary {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .presenter-mode .presenter-workspace {
    grid-template-columns: 1fr;
  }

  .presenter-mode .presenter-panel {
    position: static;
    max-height: none;
  }

  .brand-block {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-logo {
    width: min(260px, 76vw);
  }

  .continuum-wrap {
    overflow-x: visible;
  }

  .live-row-banner,
  .continuum-grid {
    min-width: 0;
  }

  .continuum-grid {
    display: block;
  }

  .header-cell:not(.corner-cell),
  .category-cell:not(.row-active),
  .choice-cell:not(.row-active) {
    display: none;
  }

  .corner-cell,
  .grid-cell {
    min-height: auto;
  }

  .grid-cell {
    border-right: 0;
  }

  .choice-card {
    min-height: auto;
  }
}
