:root {
  color-scheme: light;
  --bg: #efe7dc;
  --bg-accent: #e7d9c8;
  --ink: #1c1612;
  --muted: #4f473f;
  --card: #fffaf4;
  --input: #fff;
  --line: #ddd2c3;
  --accent: #0c5f58;
  --accent-strong: #084942;
  --accent-ink: #f7fffd;
  --accent-soft: #e5f3f1;
  --danger: #8d2b2b;
  --danger-soft: #fdecec;
  --shadow: 0 16px 40px rgba(48, 32, 16, 0.08);
  --radius: 20px;
  --font: "Segoe UI", system-ui, sans-serif;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #141210;
    --bg-accent: #231e19;
    --ink: #f6f0e8;
    --muted: #d2c6b8;
    --card: #221e1a;
    --input: #1a1714;
    --line: #3c342c;
    --accent: #8fd4cc;
    --accent-strong: #c6f3ee;
    --accent-ink: #10211f;
    --accent-soft: #1a3330;
    --danger: #ffb4b4;
    --danger-soft: #3a2222;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 50% -12%, var(--bg-accent), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  transform: translateY(-150%);
  background: var(--ink);
  color: var(--card);
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  z-index: 2;
}

.skip-link:focus {
  transform: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: min(100% - 1.5rem, 64rem);
  margin: 0 auto;
  padding: 0.9rem 0;
}

.brand {
  color: inherit;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
}

nav {
  display: flex;
  gap: 0.9rem;
}

nav a {
  color: inherit;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

nav a[aria-current="page"] {
  font-weight: 700;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.22em;
}

.sheet {
  width: min(100% - 1.5rem, 40rem);
  margin: 0 auto 2.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.1rem 1.5rem;
}

.sheet--wide {
  width: min(100% - 1.5rem, 64rem);
}

h1,
h2,
legend,
p {
  overflow-wrap: anywhere;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 7vw, 2.7rem);
  font-weight: 700;
  line-height: 1.12;
  margin: 0 0 0.45rem;
}

h2 {
  font-size: 1.25rem;
  margin: 1.4rem 0 0.7rem;
}

.lede,
.hint,
.fine-print {
  color: var(--muted);
}

.lede {
  margin: 0 0 1rem;
}

.hint,
.fine-print,
.q-meta {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
}

.eyebrow {
  margin: 0 0 0.3rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

a:hover {
  color: var(--accent-strong);
}

.qr-frame {
  display: grid;
  justify-items: center;
  margin: 0.4rem 0 1rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fffaf4;
  color: #1c1612;
}

.qr-frame canvas {
  width: 100%;
  max-width: 22rem;
  height: auto;
}

.url {
  margin: 0.8rem 0 0;
}

.fine-print {
  margin-bottom: 0;
  word-break: break-all;
}

fieldset {
  border: 0;
  margin: 0 0 1.15rem;
  padding: 0;
  min-inline-size: 0;
}

legend {
  margin-bottom: 0.45rem;
  padding: 0;
  font-weight: 700;
}

.field {
  margin-bottom: 1rem;
}

label,
.field > label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 700;
}

input[type="date"],
input[type="email"],
input[type="password"] {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--input);
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem;
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 48px;
  margin: 0 0 0.45rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--input);
  font-weight: 500;
}

.choice input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--accent);
}

.scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
}

.scale label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--input);
  font-weight: 700;
}

.scale input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
}

.choice:has(:checked),
.scale label:has(:checked) {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.choice:focus-within,
.scale label:focus-within,
button:focus-visible,
a:focus-visible,
input:focus-visible,
.table-wrap:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.notice,
.field-error,
.message {
  border-radius: 12px;
}

.notice {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
}

.field-error {
  margin: 0.35rem 0 0;
  color: var(--danger);
  font-size: 0.95rem;
}

.banner-error {
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--danger);
  background: var(--danger-soft);
}

button,
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

a.button:hover,
button:hover {
  background: var(--accent-strong);
  color: var(--accent-ink);
}

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

button.secondary:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

button:disabled {
  background: var(--line);
  color: var(--muted);
  cursor: not-allowed;
}

.question {
  margin-bottom: 1.2rem;
  padding-top: 0.2rem;
}

.thanks h1 {
  font-size: clamp(2.6rem, 10vw, 4.2rem);
}

.panel-bar {
  display: grid;
  gap: 0.8rem;
}

.panel-actions {
  display: grid;
  gap: 0.5rem;
}

.count-card {
  margin: 0 0 0.8rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--input);
}

.count-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.counts {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.bar-track {
  height: 0.55rem;
  margin-top: 0.25rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--input);
}

table {
  width: 100%;
  min-width: 40rem;
  border-collapse: collapse;
}

th,
td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.92rem;
  min-width: 8rem;
}

td {
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty {
  margin: 0.4rem 0 0;
}

.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;
}

@media (min-width: 40rem) {
  .sheet {
    padding: 1.6rem 1.5rem 1.8rem;
  }

  .panel-bar {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .panel-actions {
    grid-auto-flow: column;
  }

  .panel-actions button {
    width: auto;
  }
}
