:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --panel: #ffffff;
  --accent: #0e7c66;
  --accent-strong: #075c4b;
  --danger: #b42318;
  --soft: #edf7f4;
  --shadow: 0 18px 50px rgba(20, 31, 43, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

button,
.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0 18px;
}

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

button.ghost,
.button.ghost {
  background: #fff;
  color: var(--accent-strong);
}

button.danger {
  border-color: #f6d2cf;
  background: #fff5f4;
  color: var(--danger);
}

button.compact,
.button.compact {
  min-height: 34px;
  padding: 0 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 12px 14px;
}

textarea {
  resize: vertical;
}

label span {
  display: block;
  margin-bottom: 8px;
  color: #344054;
  font-size: 0.92rem;
  font-weight: 800;
}

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

.session-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto -14px;
  padding-top: 14px;
}

.live-body .session-bar {
  display: none;
}

.shell.narrow {
  width: min(840px, calc(100% - 32px));
}

.topbar {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}

.topbar h1,
.live-header h1 {
  margin: 0;
  font-size: clamp(2.4rem, 4vw, 4.5rem);
  line-height: 1.02;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.panel h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.active-control {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
}

.publish-control {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
}

.participant-mode-panel {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
}

.active-control h2 {
  margin-bottom: 8px;
  font-size: clamp(1.3rem, 2.4vw, 2rem);
  line-height: 1.12;
}

.active-control p {
  margin: 0;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
}

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

.row-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

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

.event-list,
.question-list {
  display: grid;
  gap: 12px;
}

.event-row,
.question-row {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.question-row.active {
  border-color: rgba(14, 124, 102, 0.42);
  background: var(--soft);
}

.event-row span,
.muted {
  color: var(--muted);
}

.event-row nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.question-row h3 {
  margin: 8px 0 0;
  font-size: 1.04rem;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #475467;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 4px 8px;
}

.badge.green {
  border-color: rgba(14, 124, 102, 0.3);
  background: #dff5ee;
  color: var(--accent-strong);
}

.checkline {
  display: flex;
  gap: 10px;
  align-items: center;
}

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

.checkline span {
  margin: 0;
}

.link-box {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
  padding: 14px;
}

.link-box span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.link-box code {
  overflow-wrap: anywhere;
  color: var(--ink);
}

.participant {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
}

.answer-panel {
  width: min(620px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: clamp(22px, 5vw, 42px);
}

.answer-panel h1 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 7vw, 3rem);
  line-height: 1.08;
}

.answer-panel textarea {
  min-height: 150px;
  font-size: 1.05rem;
}

.answer-panel button {
  min-height: 52px;
}

.mode-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border: 0;
  margin: 0;
  padding: 0;
}

.mode-control legend {
  grid-column: 1 / -1;
  color: #344054;
  font-size: 0.92rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.mode-control label {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  padding: 0 10px;
}

.participant-mode-control {
  min-width: min(420px, 100%);
}

.participant-mode-control button {
  grid-column: 1 / -1;
}

.mode-control input {
  width: 1px;
  height: 1px;
  opacity: 0;
  position: absolute;
}

.mode-control span {
  margin: 0;
  color: var(--ink);
}

.mode-control label:has(input:checked) {
  border-color: rgba(14, 124, 102, 0.45);
  background: var(--soft);
}

.previous-answer[hidden] {
  display: none;
}

.question-chooser[hidden] {
  display: none;
}

.question-chooser {
  margin-bottom: 18px;
}

.status-line {
  min-height: 1.4em;
  color: var(--accent-strong);
  font-weight: 800;
}

.danger-text {
  color: var(--danger);
}

.auth-panel h1 {
  margin: 0 0 18px;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.auth-link {
  margin-bottom: 0;
}

.response-admin-list {
  display: grid;
  gap: 12px;
}

.marked-response {
  border: 1px solid var(--line);
  border-left: 8px solid var(--mark-color, var(--line));
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.marked-response.pending-response {
  background: #f8fafc;
  border-left-style: dashed;
}

.marked-response.hero-response {
  border-color: rgba(14, 124, 102, 0.38);
  background: #f4fbf8;
}

.marked-response p {
  margin: 0 0 14px;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.35;
}

.mark-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 86px minmax(180px, 1.2fr);
  gap: 10px;
  align-items: end;
}

.color-input {
  min-height: 45px;
  padding: 4px;
}

.live-body {
  overflow: hidden;
  background: #101820;
  color: #f8fbff;
}

.live-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
  padding: clamp(18px, 4vw, 48px);
}

.live-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: start;
  padding-bottom: 24px;
}

.live-header .eyebrow {
  color: #75e0c8;
}

.live-count {
  display: grid;
  min-width: 128px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 14px;
  text-align: center;
}

.live-count strong {
  font-size: clamp(2.6rem, 5vw, 4rem);
  line-height: 1;
}

.live-count span {
  color: #c9d5df;
  font-size: 1.1rem;
  font-weight: 800;
}

.live-content {
  min-height: 0;
}

.live-start-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: clamp(24px, 5vw, 80px);
  align-items: center;
  min-height: 100%;
}

.live-start-screen h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(2rem, 3.8vw, 4.2rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.word-cloud {
  display: flex;
  min-height: 100%;
  align-content: center;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(12px, 2vw, 28px);
  padding: 18px 0 0;
}

.word-cloud span {
  color: hsl(var(--hue), 78%, 72%);
  font-weight: 900;
  line-height: 1;
  transform: rotate(var(--rotate));
  transition: transform 160ms ease, opacity 160ms ease;
}

.response-wall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  align-content: start;
  max-height: 100%;
  overflow: hidden;
}

.response-hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(240px, 0.7fr);
  gap: clamp(16px, 2vw, 28px);
  align-items: stretch;
  height: 100%;
  min-height: 0;
  animation: hero-layout-in 240ms ease-out;
}

.response-side-wall {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 0;
  overflow: hidden;
}

.response-card {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: clamp(1.35rem, 1.7vw, 1.7rem);
  font-weight: 750;
  line-height: 1.22;
  padding: 18px;
  transition: transform 220ms ease, opacity 220ms ease, font-size 220ms ease, padding 220ms ease;
}

.response-card.hero {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: center;
  font-size: clamp(3rem, 4.8vw, 6rem);
  line-height: 1.08;
  padding: clamp(28px, 5vw, 72px);
}

.response-card.compact {
  font-size: clamp(1.15rem, 1.2vw, 1.35rem);
  line-height: 1.2;
  padding: 12px;
}

.response-card.marked {
  border-color: var(--mark-color);
  box-shadow: inset 6px 0 0 var(--mark-color);
}

.response-card p {
  margin: 0;
}

.response-card small {
  display: block;
  margin-top: 10px;
  color: #c9d5df;
  font-size: 1rem;
}

.response-card.compact small {
  display: none;
}

.response-mark {
  display: inline-flex;
  border-radius: 999px;
  background: var(--mark-color, rgba(255, 255, 255, 0.16));
  color: #fff;
  font-size: 1rem;
  font-weight: 900;
  margin-bottom: 10px;
  padding: 4px 8px;
}

@keyframes hero-layout-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.empty-state {
  display: grid;
  min-height: 45vh;
  place-items: center;
  color: #c9d5df;
  font-size: clamp(2rem, 3vw, 2.8rem);
  font-weight: 800;
  text-align: center;
}

.start-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: clamp(24px, 5vw, 80px);
  align-items: center;
  min-height: 100vh;
  padding: clamp(22px, 6vw, 72px);
}

.start-copy h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(3rem, 9vw, 8rem);
  line-height: 0.96;
}

.start-url {
  margin: 24px 0 0;
  color: #c9d5df;
  font-size: clamp(1rem, 2vw, 1.6rem);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.qr-panel {
  display: grid;
  gap: 18px;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: clamp(18px, 3vw, 28px);
  text-align: center;
}

.qr-panel img {
  width: 100%;
  aspect-ratio: 1;
  display: block;
}

.qr-panel span {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.qr-panel strong {
  display: block;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  line-height: 1;
}

@media (max-width: 760px) {
  .topbar,
  .active-control,
  .publish-control,
  .participant-mode-panel,
  .live-header,
  .event-row,
  .question-row {
    display: grid;
  }

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

  .row-actions form,
  .row-actions button,
  .actions,
  .actions .button {
    width: 100%;
  }

  .live-body {
    overflow: auto;
  }

  .live-screen {
    min-height: 100svh;
  }

  .live-count {
    width: 100%;
  }

  .mode-control,
  .start-screen,
  .live-start-screen,
  .response-hero-layout,
  .mark-form {
    grid-template-columns: 1fr;
  }

  .start-screen {
    align-content: center;
  }
}
