:root {
  --brand: #0020b0;
  --brand-deep: #001a8a;
  --brand-mid: #4860c0;
  --brand-soft: #6b7fd0;
  --brand-tint: #e8ecfa;
  --brand-glow: #c5cdf0;
  --bg: #f4f6fc;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --text: #12162b;
  --muted: #5c6588;
  --line: #d8def2;
  --line-strong: #b7c2e8;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --danger: #b42318;
  --ok: #0f7a57;
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Outfit", system-ui, sans-serif;
  --font-write: "Source Serif 4", "Times New Roman", serif;
  --shadow: 0 12px 32px rgba(18, 22, 43, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  background:
    radial-gradient(ellipse 70% 45% at 0% 0%, rgba(0, 32, 176, 0.10), transparent 55%),
    radial-gradient(ellipse 55% 40% at 100% 0%, rgba(72, 96, 192, 0.10), transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(128, 144, 208, 0.08), transparent 55%),
    linear-gradient(180deg, #eef1fb 0%, var(--bg) 35%, #f7f8fd 100%);
  background-attachment: fixed;
}

a { color: var(--brand); }

.preview-banner {
  background: var(--warn-soft);
  color: var(--warn);
  text-align: center;
  padding: 10px 16px;
  font-weight: 500;
  border-bottom: 1px solid rgba(154, 91, 0, 0.18);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}
/* Brand PNGs are blue-on-black — sit them on a black plate so they read correctly on light UI */
.brand-plate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  background: #000;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(18, 22, 43, 0.12);
}
.brand-mark {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}
.brand-wordmark {
  height: 18px;
  width: auto;
  display: block;
}
.brand-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.1;
}
.brand-tag {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--brand-soft);
  font-weight: 600;
}
.topbar-end {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.stage-nav { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.stage-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  background: var(--surface);
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease, color .18s ease;
}
.stage-dot:hover {
  border-color: var(--brand-soft);
  transform: translateY(-1px);
}
.stage-dot.is-current {
  background: linear-gradient(145deg, var(--brand-mid), var(--brand));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px rgba(0, 32, 176, 0.22);
}
.who {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 16px 72px;
  animation: rise .45s ease both;
}
.page-center {
  text-align: center;
  padding-top: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.page-center .brand-hero {
  margin-bottom: 28px;
}
.brand-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.brand-hero .brand-plate {
  padding: 18px 22px;
  border-radius: 16px;
  flex-direction: column;
  gap: 12px;
}
.brand-hero .brand-mark {
  width: 64px;
  height: 64px;
}
.brand-hero .brand-wordmark {
  height: 32px;
}
.brand-hero .brand-tag {
  font-size: 13px;
}

.eyebrow {
  margin: 0;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h1 {
  margin: 8px 0 10px;
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
}
.intro {
  margin: 0 0 20px;
  color: var(--muted);
  max-width: 42rem;
}

.counter {
  display: inline-block;
  margin: 0 0 18px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--brand-tint);
  border: 1px solid var(--line);
  color: var(--brand);
  font-size: 14px;
  font-weight: 600;
}
.counter.is-warning {
  background: var(--warn-soft);
  border-color: rgba(154, 91, 0, 0.2);
  color: var(--warn);
}
.counter.is-full {
  background: #e6f7ef;
  border-color: rgba(15, 122, 87, 0.25);
  color: var(--ok);
}
.counter:empty { display: none; }

.toast {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  border: 1px solid rgba(154, 91, 0, 0.2);
  color: var(--warn);
  font-weight: 500;
}

.prompts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.prompt {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
  animation: rise .5s ease both;
}
.prompt:nth-child(1) { animation-delay: .02s; }
.prompt:nth-child(2) { animation-delay: .05s; }
.prompt:nth-child(3) { animation-delay: .08s; }
.prompt:nth-child(4) { animation-delay: .11s; }
.prompt:nth-child(5) { animation-delay: .14s; }
.prompt:nth-child(6) { animation-delay: .17s; }
.prompt:nth-child(7) { animation-delay: .2s; }
.prompt:nth-child(8) { animation-delay: .23s; }
.prompt:nth-child(9) { animation-delay: .26s; }
.prompt:nth-child(10) { animation-delay: .29s; }
.prompt:hover { border-color: var(--line-strong); }
.prompt.is-selected {
  border-color: var(--brand-mid);
  box-shadow:
    0 0 0 1px rgba(0, 32, 176, 0.18) inset,
    0 12px 28px rgba(0, 32, 176, 0.08);
}
.prompt.is-locked .pick { opacity: .5; cursor: not-allowed; }
.pick {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
}
.pick-box {
  width: 20px;
  height: 20px;
  margin-top: 4px;
  flex-shrink: 0;
  accent-color: var(--brand);
}
.prompt-text {
  flex: 1;
  white-space: pre-line;
  text-align: start;
  font-size: 1.02rem;
}

.writer { margin-top: 14px; }
.writer[hidden], .kept-note[hidden], .toast[hidden] { display: none; }
.answer {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-write);
  font-size: 1.05rem;
  color: var(--text);
  background: #fafbff;
  line-height: 1.65;
}
.answer:focus {
  outline: 2px solid var(--brand-mid);
  outline-offset: 2px;
  border-color: transparent;
  background: #fff;
}
.answer::placeholder { color: #9aa3c0; }
.status {
  display: block;
  min-height: 20px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  text-align: end;
}
.status[data-state="saving"] { color: var(--brand-soft); }
.status[data-state="retrying"],
.status[data-state="signedOut"] { color: var(--danger); font-weight: 600; }
.status[data-state="saved"] { color: var(--ok); }

.kept-note {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--muted);
  padding-inline-start: 32px;
}
.empty { color: var(--muted); }

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  gap: 12px;
}
.pager form { margin: 0; }
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .15s ease, filter .15s ease, border-color .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(145deg, var(--brand-mid), var(--brand));
  color: #fff;
  box-shadow: 0 10px 24px rgba(0, 32, 176, 0.22);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-strong);
}
.btn-secondary:hover { border-color: var(--brand-soft); color: var(--brand); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .brand-wordmark { height: 18px; }
  .brand-tag { display: none; }
  .who { display: none; }
  .prompt { padding: 14px; }
  .kept-note { padding-inline-start: 0; }
  .topbar-inner { padding: 10px 12px; }
}
