:root {
  --bg: #fbf4e6;
  --card: #fffdf8;
  --ink: #3a2418;
  --muted: #7d6656;
  --line: #e6d7bd;
  --accent: #b5451b;
  --accent-ink: #fff8ec;
  --gold: #f4b942;
  --ok: #4f7a3a;
  --danger: #a32a1e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

h1, h2, h3, legend { font-family: Georgia, "Iowan Old Style", serif; line-height: 1.2; }
h2 { margin: 0 0 .4rem; font-size: 1.35rem; }
h3 { margin: 1.1rem 0 .3rem; font-size: 1rem; }
p { margin: .4rem 0; }
a { color: var(--accent); }

.wrap { max-width: 640px; margin: 0 auto; padding: 16px 16px 64px; }
.masthead { text-align: center; padding: 20px 0 12px; }
.masthead h1 { margin: 0; font-size: 1.9rem; text-wrap: balance; }
/* The logo has a white background, so it sits on a white disc. */
.logo {
  width: 190px; aspect-ratio: 1; margin: 0 auto 12px; padding: 10px;
  background: #fff; border-radius: 50%; overflow: hidden;
  box-shadow: 0 2px 10px rgba(58, 36, 24, .12);
}
.logo img { display: block; width: 100%; height: 100%; object-fit: cover; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin: 14px 0;
  box-shadow: 0 1px 2px rgba(58, 36, 24, .05);
}
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.stack { display: grid; gap: 10px; margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

input[type=text], input[type=password], input:not([type]), textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.btn {
  display: inline-block;
  padding: 11px 18px;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: #f3e6cc;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { padding: 6px 10px; font-size: .85rem; }
.btn.danger { color: var(--danger); background: transparent; }
.btn:disabled { opacity: .4; cursor: default; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }

.error, .notice { padding: 10px 14px; border-radius: 10px; margin: 12px 0; }
.error { background: #fbe4df; color: var(--danger); }
.notice { background: #e6f0dc; color: #2f4d22; }

/* Ballot */
.whoami { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 0 4px; }
.question { min-width: 0; }
.question legend { float: left; width: 100%; padding: 0; margin-bottom: 12px; font-size: 1.2rem; font-weight: 700; }
.num {
  display: inline-grid; place-items: center;
  width: 1.7em; height: 1.7em; margin-right: 4px;
  font: 700 .8rem system-ui, sans-serif;
  color: var(--accent-ink); background: var(--accent); border-radius: 50%;
  vertical-align: .15em;
}
.chips { clear: both; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: block;
  padding: 9px 15px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.submit-bar { text-align: center; margin-top: 20px; }
.submit-bar .btn { width: 100%; padding: 14px; font-size: 1.05rem; }

/* Admin */
.list { list-style: none; margin: 8px 0 14px; padding: 0; }
.list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.badge { font-size: .78rem; padding: 2px 9px; border-radius: 999px; background: #efe5d2; color: var(--muted); white-space: nowrap; }
.badge.yes { background: #dcebd0; color: var(--ok); font-weight: 600; }
summary { cursor: pointer; font-weight: 600; }
.tally { list-style: none; margin: 0; padding: 0; }
.tally li { display: flex; justify-content: space-between; padding: 2px 0; font-variant-numeric: tabular-nums; }

/* Awards screen */
body.awards {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  color: #fff3d6;
  background: radial-gradient(ellipse at 50% 30%, #5b2a17 0%, #2a120b 70%);
  overflow-x: hidden;
}
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#stage { flex: 1; display: grid; place-items: center; padding: 24px 16px; cursor: pointer; }
.slide { width: 100%; max-width: 1100px; text-align: center; animation: rise .5s ease both; }
.slide h1 { font-size: clamp(2.2rem, 7vw, 5rem); margin: .2em 0; text-wrap: balance; }
.slide h2 { font-size: clamp(1.8rem, 5.5vw, 4rem); margin: .2em 0 .6em; text-wrap: balance; }
.awards .logo { width: clamp(180px, 34vmin, 380px); padding: 1.6vmin; margin-bottom: 20px; box-shadow: 0 0 60px rgba(244, 185, 66, .35); }
.eyebrow { text-transform: uppercase; letter-spacing: .2em; font-size: .9rem; color: var(--gold); }
.goes-to { font: italic clamp(1.2rem, 3vw, 2rem) Georgia, serif; opacity: .85; }
.hint { margin-top: 2.5em; font-size: .95rem; opacity: .55; }
.winner {
  font: 700 clamp(2.6rem, 10vw, 7rem)/1.1 Georgia, serif;
  color: var(--gold);
  text-shadow: 0 0 40px rgba(244, 185, 66, .45);
  text-wrap: balance;
  overflow-wrap: anywhere;
  animation: pop .7s cubic-bezier(.2, 1.4, .4, 1) both;
}
.recap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 24px; }
.recap-card { padding: 16px; border: 1px solid rgba(244, 185, 66, .35); border-radius: 14px; background: rgba(255, 243, 214, .06); }
.recap-title { font-size: .95rem; opacity: .8; }
.recap-winner { font: 700 1.5rem Georgia, serif; color: var(--gold); overflow-wrap: anywhere; }
.awards-nav { display: flex; justify-content: center; align-items: center; gap: 18px; padding: 12px; opacity: .6; font-variant-numeric: tabular-nums; }
.awards-nav button { font-size: 1.3rem; width: 44px; height: 44px; color: inherit; background: transparent; border: 1px solid rgba(255, 243, 214, .4); border-radius: 50%; cursor: pointer; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes pop { from { opacity: 0; transform: scale(.5); } }
@media (prefers-reduced-motion: reduce) { .slide, .winner { animation: none; } }
