:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --panel: #ffffff;
  --ink: #1f2528;
  --muted: #687076;
  --border: #d9dee2;
  --blue: #1f6feb;
  --green: #178a49;
  --red: #c93636;
  --yellow: #f2b705;
  --shadow: 0 18px 48px rgba(31, 37, 40, 0.11);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

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

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

button {
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
}

.participant {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  min-height: 100vh;
  padding: clamp(16px, 4vw, 32px);
}

.participant-top {
  display: grid;
  gap: 12px;
}

.participant-title,
.presenter-title {
  margin: 0;
  font-size: clamp(28px, 6vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

.participant-subtitle,
.status-line,
.muted {
  color: var(--muted);
}

.name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
}

.textarea {
  min-height: 150px;
  resize: vertical;
}

.vote-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 3vw, 28px);
  align-content: center;
}

.vote-button {
  min-height: min(56vh, 420px);
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-size: clamp(48px, 12vw, 132px);
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: var(--shadow);
}

.vote-button.yes {
  background: var(--green);
}

.vote-button.no {
  background: var(--red);
}

.freeform-panel {
  display: grid;
  align-content: center;
  gap: 16px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 14px;
  font-weight: 800;
}

.primary-button {
  background: var(--blue);
  color: #fff;
}

.secondary-button {
  background: #fff;
  border-color: var(--border);
  color: var(--ink);
}

.danger-button {
  background: var(--red);
  color: #fff;
}

.participant-status {
  min-height: 26px;
  color: var(--muted);
  font-weight: 700;
}

.presenter {
  display: grid;
  gap: 18px;
  padding: clamp(18px, 3vw, 34px);
}

.presenter-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
}

.round-pill {
  justify-self: start;
  border-radius: 999px;
  background: #24313a;
  color: #fff;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 800;
}

.presenter-grid {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel,
.history-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

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

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.segment {
  min-height: 44px;
  border: 0;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.segment.active {
  background: #24313a;
  color: #fff;
}

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

.queue-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.queue-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.queue-textarea {
  min-height: 74px;
}

.queue-bulk {
  min-height: 110px;
}

.queue-list {
  display: grid;
  gap: 8px;
}

.queue-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 9px;
}

.queue-index {
  color: var(--blue);
  font-weight: 900;
}

.queue-question {
  overflow-wrap: anywhere;
  font-weight: 800;
}

.queue-mode {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.icon-button {
  min-width: 38px;
  padding: 0;
  background: #fff;
  border-color: var(--border);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.qr-block {
  display: grid;
  grid-template-columns: 144px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.qr-block img {
  width: 144px;
  height: 144px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.url-text {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 14px;
}

.results-panel {
  display: grid;
  gap: 18px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.metric-value {
  display: block;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
  font-weight: 900;
}

.metric-label {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 800;
}

.pie-layout {
  display: grid;
  grid-template-columns: minmax(180px, 300px) minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.pie {
  width: min(100%, 300px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0deg, var(--green) var(--yes-deg), var(--red) var(--yes-deg), var(--red) 360deg);
  border: 12px solid #fff;
  box-shadow: inset 0 0 0 1px var(--border), var(--shadow);
}

.legend {
  display: grid;
  gap: 10px;
}

.legend-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  font-weight: 800;
}

.swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.swatch.yes {
  background: var(--green);
}

.swatch.no {
  background: var(--red);
}

.freeform-list,
.history-list {
  display: grid;
  gap: 10px;
}

.freeform-row {
  display: grid;
  grid-template-columns: 56px minmax(130px, 180px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.rank {
  color: var(--blue);
  font-weight: 900;
}

.answer-name {
  font-weight: 900;
}

.answer-text {
  overflow-wrap: anywhere;
}

.redacted-answer {
  display: block;
  width: min(260px, 100%);
  height: 32px;
}

.time-badge {
  justify-self: end;
  border-radius: 999px;
  background: #eef3f8;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 13px;
  font-weight: 800;
}

.history-item {
  padding: 12px;
}

.history-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 900;
}

.history-detail {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.hidden-state {
  display: grid;
  min-height: 300px;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: clamp(24px, 5vw, 54px);
  font-weight: 900;
  text-align: center;
}

.error {
  color: var(--red);
  font-weight: 800;
}

@media (max-width: 880px) {
  .presenter-header,
  .presenter-grid,
  .pie-layout,
  .qr-block {
    grid-template-columns: 1fr;
  }

  .round-pill {
    justify-self: start;
  }

  .metric-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .vote-grid {
    grid-template-columns: 1fr;
  }

  .vote-button {
    min-height: 30vh;
  }

  .freeform-row {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .answer-text,
  .time-badge {
    grid-column: 2;
    justify-self: start;
  }
}
