:root {
  --bg: #f7f0e5;
  --bg-soft: #fffaf3;
  --surface: rgba(255, 252, 246, 0.94);
  --surface-strong: #fffdf9;
  --line: #e8dac4;
  --text: #2a1e15;
  --muted: #6d5b4c;
  --accent: #c06a2a;
  --accent-dark: #9d4f1d;
  --accent-soft: #f5dfc9;
  --danger: #c45847;
  --success: #2f7a56;
  --pending: #8f6b1a;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-pill: 999px;
  --shadow: 0 18px 44px rgb(121 82 39 / 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgb(247 214 174 / 0.45), transparent 28%),
    radial-gradient(circle at right 14%, rgb(255 232 211 / 0.65), transparent 30%),
    linear-gradient(180deg, #fbf6ef 0%, #f7f0e5 100%);
}

button, input, textarea, select, a { font: inherit; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf9;
  color: var(--text);
  padding: 12px 14px;
}
textarea { min-height: 96px; resize: vertical; }
a { color: var(--accent-dark); text-decoration: none; }

.warm-shell { padding: 24px 14px; }
.app-frame { width: min(1220px, 100%); margin: 0 auto; }
.admin-frame { padding-bottom: 24px; }
.brand-mark {
  margin: 0 0 14px;
  color: var(--accent-dark);
  font-family: "Trebuchet MS", "Source Sans 3", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.brand-mark span {
  font-size: 0.5em;
}
.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 380px;
  gap: 16px;
  align-items: start;
}
.hero-panel.compact { margin-top: 6vh; }
.hero-copy,
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.hero-copy { padding: 28px; }
.card { padding: 20px; border-radius: var(--radius-lg); }
.panel-card { padding: 22px; }
.side-card { padding: 18px; }
.auth-card { display: grid; gap: 12px; align-content: start; }
.page-shell { display: grid; gap: 18px; }
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tab-button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-strong);
  color: var(--muted);
  cursor: pointer;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
}
.tab-button.active {
  background: var(--accent);
  color: #fff8f1;
  border-color: var(--accent);
}
.tab-panel { display: grid; gap: 18px; }
.content-grid {
  display: grid;
  gap: 16px;
}
.audience-grid {
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
}
.admin-quiz-grid,
.admin-attendee-grid,
.admin-pulse-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}
.main-column,
.side-column {
  display: grid;
  gap: 16px;
}
.lower-panel { margin-top: 2px; }

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-family: "Manrope", sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4, .button { font-family: "Manrope", sans-serif; }
h1 {
  margin-bottom: 14px;
  font-size: clamp(2.8rem, 5vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: -0.06em;
}
h2 {
  margin-bottom: 8px;
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.045em;
}
h3 { margin-bottom: 6px; font-size: 1.2rem; }
h4 { margin-bottom: 8px; font-size: 1rem; }
.lede, .status-line, .empty-state, .stack-list p, .stack-list li, .quiz-panel, .timer-card-shell span, .help-copy {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.5;
}

.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-weight: 700;
  transition: transform 120ms ease, background 120ms ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--accent); color: #fff7f1; }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary { background: var(--accent-soft); color: var(--text); }
.button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.export-link { width: 100%; }
.button.small-button {
  min-height: 38px;
  padding: 8px 12px;
}
.button.stuck-button {
  background: #f0be38;
  color: #4a3310;
}
.button.stuck-button:hover {
  background: #d7a62c;
}

.section-head,
.inline-actions,
.inline-form,
.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.section-head {
  align-items: start;
  justify-content: space-between;
  margin-bottom: 14px;
}
.compact-head { margin-bottom: 12px; }
.inline-actions { margin: 10px 0 14px; }
.stack-form,
.stack-list {
  display: grid;
  gap: 10px;
}
.split-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.split-form input[name="email"] { grid-column: 1 / -1; }
.split-form button { grid-column: 1 / -1; }

.item-card,
.qa-card,
.quiz-choice,
.email-row {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
}
.subtle-tag {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: var(--radius-pill);
  background: #f4e1ce;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}
.subtle-time {
  color: var(--muted);
  font-size: 0.92rem;
}
.tag-success { background: #dceee4; color: var(--success); }
.tag-danger { background: #f6d7d1; color: var(--danger); }
.tag-pending { background: #f3ead4; color: var(--pending); }
.tag-stuck { background: #f7e398; color: #7b5b07; }

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}
.workspace-main,
.right-pane-shell,
.header-actions,
.os-picker-inline,
.pane-section,
.setup-instructions,
.attendee-progress-details,
.progress-chip-group,
.inline-meta,
.attendee-summary-grid {
  display: grid;
  gap: 12px;
}
.header-actions {
  justify-items: end;
}
.os-picker-inline {
  justify-items: end;
}
.os-chip {
  display: flex;
  align-items: center;
  gap: 8px;
}
.compact-actions {
  margin: 0;
}
.active-choice {
  border-color: var(--accent);
  color: var(--accent-dark);
}
.right-pane-shell {
  position: sticky;
  top: 18px;
}
.right-pane {
  display: grid;
  gap: 16px;
}
.pane-toggle {
  display: none;
}
.code-block {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: #2c221b;
  color: #fff4e7;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.command-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.command-copy-shell {
  display: grid;
  gap: 8px;
}
.expected-output {
  margin-bottom: 0;
}
.setup-card.is-complete {
  border-color: #badbc8;
  background: #f7fcf9;
}
.attendee-header {
  align-items: start;
}
.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(42 30 21 / 0.36);
}
.modal-card {
  width: min(720px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}
.modal-textarea {
  min-height: 220px;
}
.setup-card-form,
.setup-admin-card,
.snippet-card,
.attendee-progress-details,
.attendee-summary-grid {
  display: grid;
  gap: 12px;
}
.command-editor-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fffdf9;
}
.admin-setup-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}
.attendee-progress-row summary {
  list-style: none;
  cursor: pointer;
}
.attendee-progress-row summary::-webkit-details-marker {
  display: none;
}
.attendee-summary-grid {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: start;
}
.progress-chip-group {
  justify-items: start;
}
.attendee-progress-details {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}
.mini-card {
  padding: 10px 12px;
}

.timer-card-shell {
  display: grid;
  gap: 6px;
  text-align: center;
}
.timer-card-shell strong {
  font-family: "Manrope", sans-serif;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.05em;
}

.link-card a {
  display: inline-flex;
  margin-top: 6px;
  font-weight: 700;
}
.question-meta {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.qa-actions,
.email-actions,
.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.email-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}
.email-actions {
  flex-direction: column;
  min-width: 150px;
}

.quiz-panel,
.quiz-stage {
  display: grid;
  gap: 12px;
}
.pulse-panel,
.pulse-card,
.cardless-block,
.pulse-options {
  display: grid;
  gap: 12px;
}
.pulse-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
}
.pulse-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.pulse-option {
  min-height: 60px;
  white-space: normal;
  text-align: center;
}
.pulse-result-card p:last-child {
  margin-bottom: 0;
}
.quiz-options {
  display: grid;
  gap: 10px;
}
.quiz-choice {
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.quiz-choice.selected {
  border-color: var(--accent);
  background: #fff1e1;
}
.quiz-choice.correct {
  border-color: var(--success);
  background: #edf8f2;
}
.quiz-choice.reveal {
  border-color: var(--accent-dark);
}

.status-line { min-height: 1.4em; margin-bottom: 0; }
.status-error { color: var(--danger); }
.status-success { color: var(--success); }

@media (max-width: 980px) {
  .hero-panel,
  .audience-grid,
  .admin-quiz-grid,
  .admin-attendee-grid,
  .admin-pulse-grid,
  .admin-setup-grid,
  .workspace-grid {
    grid-template-columns: 1fr;
  }
  .page-header { align-items: start; }
  .right-pane-shell {
    position: static;
  }
}

@media (max-width: 640px) {
  .warm-shell { padding: 18px 10px; }
  .card, .panel-card, .side-card, .hero-copy { padding: 18px; }
  .split-form { grid-template-columns: 1fr; }
  .split-form input[name="email"] { grid-column: auto; }
  .split-form button { grid-column: auto; }
  .email-row {
    flex-direction: column;
  }
  .pulse-options {
    grid-template-columns: 1fr;
  }
  .email-actions {
    width: 100%;
    min-width: 0;
  }
  .header-actions,
  .os-picker-inline {
    justify-items: stretch;
  }
  .command-row,
  .attendee-summary-grid,
  .attendee-progress-details {
    grid-template-columns: 1fr;
  }
  .pane-toggle {
    display: inline-flex;
  }
  .right-pane {
    margin-top: 8px;
  }
}
