/* The Emperor's Poll: one column, system fonts, no external resources. */

:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1c1b19;
  --muted: #5f5c55;
  --line: #d9d6cf;
  --accent: #2f5d8a;
  --accent-ink: #ffffff;
  --accent-soft: #e6eef7;
  --danger: #a13e2f;
  --ok: #2e6b3f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14151a;
    --surface: #1e2027;
    --text: #ebe9e3;
    --muted: #a5a29a;
    --line: #34363f;
    --accent: #8fb6e0;
    --accent-ink: #0f1620;
    --accent-soft: #24303f;
    --danger: #e08a7b;
    --ok: #8fcf9f;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2rem 16px 6rem;
}

.masthead { margin: 0 0 1.25rem; }
.masthead h1 { font-size: 2rem; line-height: 1.15; margin: 0 0 0.35rem; letter-spacing: -0.01em; }
.lede { margin: 0; color: var(--muted); }

h2 { font-size: 1.15rem; line-height: 1.35; margin: 0 0 0.6rem; }
p { margin: 0 0 0.9rem; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  margin: 0 0 1rem;
}

.card.muted, .muted { color: var(--muted); }

details.card summary { cursor: pointer; font-weight: 600; }
details.card[open] summary { margin-bottom: 0.6rem; }

ul { padding-left: 1.2rem; margin: 0; }
ul li { margin: 0 0 0.4rem; }
ul.plain { list-style: none; padding: 0; columns: 2; column-gap: 1.5rem; }
@media (max-width: 520px) { ul.plain { columns: 1; } }

.hint { color: var(--muted); font-size: 0.93rem; }

.row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.row input { flex: 1 1 14rem; }

input[type="email"], input[type="text"], textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  width: 100%;
  min-width: 0;
}
input:focus-visible, textarea:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
textarea { min-height: 7rem; resize: vertical; }

button {
  font: inherit;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0.55rem 1rem;
  cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button:disabled { opacity: 0.55; cursor: default; }
button.link {
  border: 0; background: none; padding: 0; color: var(--muted);
  font-weight: 500; font-size: 0.9rem; text-decoration: underline;
}

.status { min-height: 1.4em; margin: 0.6rem 0 0; font-size: 0.95rem; }
.status.error { color: var(--danger); }
.status.ok { color: var(--ok); }

/* Questions */
.question { position: relative; }
.q-title { font-weight: 600; }
.q-title label { cursor: pointer; }
.q-title .req { font-weight: 500; font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.question.missing { border-color: var(--danger); box-shadow: 0 0 0 2px var(--danger) inset; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }

.choice {
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  align-items: start;
  gap: 0.35rem;
  padding: 0.35rem 0;
}
.choice input[type="radio"], .choice input[type="checkbox"] {
  width: 1.15rem; height: 1.15rem; margin: 0.2rem 0 0; accent-color: var(--accent);
}
.choice label { cursor: pointer; }
.choice.other { grid-template-columns: 1.5rem auto 1fr; align-items: center; }

/* Grouped options (Q4 scope): a left-aligned group heading, its options indented beneath it. */
.choice-group { font-weight: 600; margin: 0.6rem 0 0.1rem; }
.choice-group + .choice-group { margin-top: 0.2rem; }
.choice.grouped { margin-left: 1.5rem; }
.choice.grouped + .choice:not(.grouped) { margin-top: 0.6rem; }
.choice.other input[type="text"] { padding: 0.35rem 0.55rem; }

.q-actions { margin-top: 0.4rem; text-align: right; }

.section-header {
  margin: 2.75rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.section-header h2 { font-size: 1.35rem; margin: 0; }

/* Grid question */
.grid-wrap { overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; font-size: 0.97rem; }
table.grid th, table.grid td { padding: 0.5rem 0.4rem; border-top: 1px solid var(--line); vertical-align: middle; }
table.grid thead th { border-top: 0; font-weight: 600; text-align: center; font-size: 0.9rem; color: var(--muted); }
table.grid th[scope="row"] { text-align: left; font-weight: 500; }
table.grid td { text-align: center; width: 7.5rem; }
table.grid input { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); margin: 0; }
@media (max-width: 520px) { table.grid td { width: 5rem; } }

/* Submit bar */
.submit-bar {
  position: sticky;
  bottom: 0;
  margin-top: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
  display: flex;
  gap: 0.8rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.submit-bar .status { margin: 0; flex: 1 1 12rem; }
.submit-bar button.primary { padding: 0.7rem 1.5rem; font-size: 1.05rem; box-shadow: 0 2px 8px rgba(47, 93, 138, 0.3); }

/* Link box on the confirmation page */
.linkbox {
  display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
  background: var(--accent-soft); border-radius: 8px; padding: 0.6rem 0.75rem;
}
.linkbox code {
  flex: 1 1 16rem; font-size: 0.85rem; word-break: break-all; overflow-wrap: anywhere;
}

.notice { border-left: 4px solid var(--accent); }
.notice.danger { border-left-color: var(--danger); }

.foot { margin-top: 2rem; color: var(--muted); font-size: 0.9rem; }

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