:root {
  color-scheme: light;
  --paper: #f7f5f0;
  --white: #fffefa;
  --ink: #24201c;
  --muted: #615951;
  --line: #d9d0c4;
  --orange: #a53d0c;
  --tint: #f9e6d9;
  --red: #943126;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .62; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
a { color: var(--orange); }
h1, h2, h3, p { margin: 0; }
.shell { max-width: 720px; margin-inline: auto; padding: 0 clamp(20px, 5vw, 48px); }
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 83px;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; gap: .28em; align-items: center; font-size: clamp(20px, 5vw, 27px); font-weight: 850; letter-spacing: -.065em; }
.brand-mark { width: .32em; height: .7em; background: var(--orange); transform: skewX(-17deg); }
.event { font-size: .73rem; font-weight: 650; line-height: 1.3; color: var(--muted); text-align: right; }
.intro, .result { padding: clamp(28px, 6vw, 60px) 0 30px; }
.product { color: var(--orange); font-weight: 750; margin-bottom: 8px; }
h1 { max-width: 13ch; font-size: clamp(2.5rem, 8vw, 4.6rem); font-weight: 780; letter-spacing: -.075em; line-height: .98; }
.intro > :last-child, .result > p { max-width: 46ch; margin-top: 16px; color: var(--muted); }
.progress { display: grid; gap: 8px; padding: 22px 0; color: var(--muted); font-size: .82rem; font-weight: 700; }
progress { display: block; width: 100%; height: 5px; border: 0; border-radius: 0; background: var(--line); color: var(--orange); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--orange); }
progress::-moz-progress-bar { background: var(--orange); }
h2 { font-size: clamp(1.7rem, 5vw, 2.6rem); line-height: 1.12; letter-spacing: -.05em; }
h3 { font-size: 1.13rem; }
h1:focus, h2:focus { outline: none; }
.question { margin: 22px 0 0; min-width: 0; border: 0; padding: 0; }
.question + .question { margin-top: 28px; }
legend { padding: 0; font-weight: 720; line-height: 1.35; }
.hint { margin-top: 5px; color: var(--muted); font-size: .84rem; }
.options { display: grid; gap: 7px; margin-top: 10px; }
.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--white);
  cursor: pointer;
}
.choice:has(input:checked) { background: var(--tint); border-color: var(--orange); }
.choice:has(input:focus-visible) { outline: 2px solid var(--orange); outline-offset: 2px; }
.choice input { appearance: auto; flex: 0 0 auto; width: 18px; height: 18px; margin: 0; accent-color: var(--orange); }
textarea, .admin input, select {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 5px;
}
textarea { margin-top: 10px; min-height: 108px; resize: vertical; }
textarea[aria-invalid="true"] { border-color: var(--red); }
.field-error { margin-top: 6px; color: var(--red); font-size: .88rem; font-weight: 660; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }
.primary, .secondary {
  min-height: 48px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-weight: 710;
}
.primary { color: #fff; background: var(--orange); }
.primary:hover:enabled { background: #893108; }
.secondary { color: var(--ink); border-color: var(--line); background: var(--white); }
.secondary:hover:enabled { border-color: var(--orange); }
.survey .primary { flex: 1; }
.message { margin-top: 16px; padding: 11px 13px; border-left: 3px solid var(--orange); background: var(--tint); }
footer { display: flex; justify-content: space-between; gap: 10px; margin: 38px 0 0; padding: 14px 0 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: .74rem; }
.result { min-height: 55vh; }

.admin { max-width: 1120px; }
.admin h1 { max-width: none; margin: 28px 0 16px; font-size: clamp(2.1rem, 6vw, 3.8rem); }
.login { display: grid; max-width: 390px; gap: 8px; }
.admin-bar, .filters { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.admin-bar p { flex: 1 1 12rem; }
.filters label { display: grid; flex: 1 1 180px; gap: 6px; font-weight: 650; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 10px 8px; vertical-align: top; border-bottom: 1px solid var(--line); }
th { font-size: .85rem; }
td { font-size: .92rem; }
.record-link { color: var(--orange); border: 0; padding: 0 6px 6px 0; background: none; text-decoration: underline; font-weight: 700; }
details { border-top: 1px solid var(--line); margin-top: 24px; padding: 13px 0; }
summary { cursor: pointer; font-weight: 700; }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 18px; margin: 16px 0; }
.totals section { border-top: 2px solid var(--line); padding-top: 8px; }
.totals dl { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; font-size: .91rem; }
dd { margin: 0; }
dialog { width: min(660px, calc(100% - 32px)); max-height: 90vh; padding: clamp(16px, 4vw, 30px); border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--ink); }
dialog::backdrop { background: #241e19a8; }
dialog dt { font-weight: 700; margin-top: 16px; }
dialog dd { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (min-width: 560px) {
  .options { grid-template-columns: 1fr 1fr; }
  .survey .primary { flex: 0 1 58%; }
}
