:root {
  color-scheme: light;
  --bg: #f5f1e8;
  --panel: #ffffff;
  --cream-dark: #ebe5d3;
  --ink: #1a1d3f;
  --navy-light: #2a2d5f;
  --muted: #6a6d80;
  --line: rgba(26, 29, 63, 0.12);
  --accent: #f5b942;
  --accent-dark: #d99a1f;
  --danger: #a33b2f;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body {
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  margin: 0;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  background:
    radial-gradient(circle at 82% 12%, rgba(245, 185, 66, 0.16), transparent 34%),
    var(--bg);
  color: var(--ink);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  width: min(100%, 560px);
  max-width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 132px;
  overflow-x: clip;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 2px 16px;
}

.eyebrow,
.kicker {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}

.brand-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

h1 {
  max-width: 360px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
}

h2 {
  font-size: 2.45rem;
  font-weight: 800;
  line-height: 0.95;
}

.lead {
  margin: 18px 0 26px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.42;
  letter-spacing: -0.01em;
}

.step-count {
  flex: 0 0 auto;
  min-width: 58px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
}

.progress-track {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  width: 100%;
  height: 3px;
  overflow: hidden;
  background: transparent;
}

.progress-bar {
  width: 9%;
  height: 100%;
  background: var(--accent);
  transition: width 260ms ease;
}

form {
  margin-top: 18px;
}

.slide {
  display: none;
  min-height: 68vh;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(26, 29, 63, 0.08);
}

.slide.active {
  display: block;
}

.cover-slide {
  border-color: rgba(26, 29, 63, 0.16);
  background:
    radial-gradient(circle at 88% 4%, rgba(245, 185, 66, 0.18), transparent 42%),
    #ffffff;
}

.slide-body {
  margin: 18px 0 8px;
}

.slide-body p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1.03rem;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.slide-body strong,
.slide-body em {
  color: var(--ink);
}

.event-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--bg);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

label,
fieldset {
  display: block;
  margin-top: 18px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.question-group {
  margin-top: 22px;
}

.question-group.group-error {
  border-radius: 12px;
  padding: 12px;
  background: rgba(163, 59, 47, 0.07);
  outline: 2px solid rgba(163, 59, 47, 0.32);
}

.question-group.group-error legend {
  color: var(--danger);
}

label span {
  color: var(--muted);
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  max-width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
}

textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.42;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-dark);
  outline: 3px solid rgba(245, 185, 66, 0.22);
}

input.field-error,
textarea.field-error,
select.field-error {
  border-color: var(--danger);
  outline: 3px solid rgba(163, 59, 47, 0.18);
}

fieldset {
  border: 0;
  padding: 0;
}

legend {
  margin-bottom: 10px;
  font-weight: 800;
}

.option-grid {
  display: grid;
  gap: 10px;
}

.option {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #ffffff;
  font-weight: 800;
  line-height: 1.25;
}

.option:has(input:checked) {
  border-color: rgba(217, 154, 31, 0.62);
  background: rgba(245, 185, 66, 0.16);
}

.option input {
  width: auto;
  margin: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  font-weight: 700;
}

.check input,
.pill-grid input {
  width: auto;
  margin: 0;
}

.pill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pill-grid label {
  display: flex;
  align-items: center;
  min-height: 48px;
  gap: 8px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #ffffff;
  font-size: 0.88rem;
}

.score-card,
.status-card,
.blueprint-output,
.diagnosis-card,
.poll-card,
.examples-card {
  margin-top: 18px;
  border: 1px solid rgba(245, 185, 66, 0.36);
  border-radius: 14px;
  padding: 16px;
  background: rgba(245, 185, 66, 0.12);
  color: var(--ink);
  font-weight: 800;
}

.examples-card {
  background: rgba(235, 229, 211, 0.48);
  font-weight: 600;
}

.examples-card ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.examples-card li {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.38;
}

.diagnosis-card {
  background: var(--ink);
  color: var(--bg);
}

.diagnosis-card h3 {
  margin: 4px 0 8px;
  color: var(--bg);
  font-size: 2.15rem;
  line-height: 0.98;
}

.diagnosis-card p {
  margin: 0;
  color: rgba(245, 241, 232, 0.82);
  line-height: 1.45;
}

.mini-label {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.foundation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.foundation-grid span {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #ffffff;
  color: var(--muted);
  font-weight: 800;
}

.foundation-grid strong {
  float: right;
  color: var(--ink);
}

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

.generation-card {
  align-items: flex-start;
}

.status-card p {
  margin: 0;
  line-height: 1.4;
}

.generation-card p + p,
.generation-card button {
  margin-top: 10px;
}

.generation-countdown strong {
  color: var(--ink);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.25rem;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(26, 29, 63, 0.14);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 850ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.blueprint-output {
  overflow-wrap: anywhere;
  background: #ffffff;
  color: var(--ink);
  font-weight: 500;
}

.blueprint-output h3 {
  margin: 18px 0 6px;
  color: var(--ink);
  font-size: 1rem;
}

.blueprint-output h3:first-child {
  margin-top: 0;
}

.blueprint-output p,
.blueprint-output li {
  color: var(--ink);
  line-height: 1.45;
}

.blueprint-output pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  border-radius: 12px;
  padding: 14px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.82rem;
  line-height: 1.45;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.poll-card {
  background: #ffffff;
}

.poll-row {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--ink);
  font-weight: 900;
}

.poll-row div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--cream-dark);
}

.poll-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 280ms ease;
}

.poll-total {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.sync-status {
  min-height: 18px;
  margin: 12px 2px 0;
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-actions {
  position: fixed;
  right: auto;
  bottom: 0;
  left: 50%;
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 10px;
  width: min(100dvw, 560px);
  max-width: 100dvw;
  margin: 0 auto;
  padding: 38px 16px calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid rgba(26, 29, 63, 0.1);
  background: rgba(245, 241, 232, 0.94);
  backdrop-filter: blur(16px);
}

.event-footer {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: -22px 2px 0;
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
  overflow-wrap: anywhere;
}

.event-footer span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button,
.primary-link,
.slide-cta {
  min-height: 50px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  background: var(--ink);
  color: var(--bg);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
}

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

.slide-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 16px;
}

.next-hint {
  margin: 16px 0 0;
  border: 1px solid rgba(217, 154, 31, 0.42);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(245, 185, 66, 0.14);
  color: var(--ink);
  font-weight: 900;
  line-height: 1.35;
}

.source-note {
  margin: 18px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.45;
  text-transform: uppercase;
}

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

button.is-success {
  border-color: rgba(217, 154, 31, 0.5);
  background: rgba(245, 185, 66, 0.18);
  color: var(--ink);
}

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

.form-error {
  min-height: 22px;
  margin: 12px 2px 0;
  color: var(--danger);
  font-size: 0.92rem;
  font-weight: 800;
}

@media (max-width: 380px) {
  h2 {
    font-size: 2.05rem;
  }

  .slide {
    padding: 18px;
  }

  .pill-grid,
  .foundation-grid,
  .result-actions {
    grid-template-columns: 1fr;
  }
}

@media (pointer: coarse) {
  input,
  textarea,
  select {
    font-size: 16px;
  }
}

.admin-shell {
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 18px 48px;
}

.admin-hero {
  margin-bottom: 22px;
}

.admin-hero h1 {
  max-width: none;
  color: var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.95;
  text-transform: none;
}

.admin-hero p:last-child {
  max-width: 720px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
}

.admin-panel,
.admin-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background: #ffffff;
  box-shadow: 0 12px 34px rgba(26, 29, 63, 0.07);
}

.admin-panel {
  margin-top: 18px;
}

.admin-panel h2 {
  margin-bottom: 14px;
  font-size: 1.45rem;
  line-height: 1;
}

.admin-dashboard[hidden],
.admin-panel[hidden] {
  display: none;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-actions .sync-status {
  flex: 1;
  margin: 0;
}

.admin-actions button,
.admin-actions .primary-link {
  width: auto;
  min-width: 132px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.admin-card strong {
  display: block;
  color: var(--ink);
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1;
}

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

.admin-bar {
  display: grid;
  grid-template-columns: 140px 1fr 42px;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 900;
}

.admin-bar div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--cream-dark);
}

.admin-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink);
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
}

.admin-table th {
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .admin-hero h1 {
    font-size: 2.4rem;
  }

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

  .admin-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-actions button,
  .admin-actions .primary-link {
    width: 100%;
  }

  .admin-bar {
    grid-template-columns: 110px 1fr 34px;
  }
}
