:root {
  --ink: #161614;
  --paper: #f4f1ea;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-border: rgba(29, 27, 25, 0.12);
  --accent: #5e1f17;
  --accent-soft: rgba(94, 31, 23, 0.08);
  --success: #1f4b39;
  --error: #7a1f1f;
  --muted: #5e5a55;
  --shadow: 0 24px 60px rgba(20, 18, 15, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(94, 31, 23, 0.18), transparent 34%),
    linear-gradient(180deg, #ded7cb 0%, #efebe2 38%, #f7f4ef 100%);
  font-family: "Source Sans 3", "Helvetica Neue", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.18)),
    repeating-linear-gradient(
      0deg,
      rgba(50, 42, 38, 0.022),
      rgba(50, 42, 38, 0.022) 1px,
      transparent 1px,
      transparent 5px
    );
  mix-blend-mode: multiply;
}

.page-shell {
  position: relative;
  padding: 56px 24px 72px;
}

.hero {
  max-width: 980px;
  margin: 0 auto 28px;
  padding: 0 6px;
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  max-width: 10ch;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(2.4rem, 5vw, 4.9rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.intro {
  max-width: 62ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.65;
}

.layout {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  align-items: start;
}

.panel {
  backdrop-filter: blur(20px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.ballot-panel {
  padding: 28px;
}

.memo-panel {
  padding: 18px;
}

.panel-heading h2 {
  margin: 0 0 6px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.55rem;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.ballot-form {
  margin-top: 22px;
}

.field {
  display: block;
}

.field span,
.choices legend,
.metric-label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.field input[type="text"] {
  width: 100%;
  padding: 15px 16px;
  border: 1px solid rgba(20, 20, 20, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  font: inherit;
  font-size: 1rem;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input[type="text"]:focus,
.choice-card:has(input:focus-visible) {
  outline: none;
  border-color: rgba(94, 31, 23, 0.5);
  box-shadow: 0 0 0 4px rgba(94, 31, 23, 0.09);
}

.choices {
  margin: 22px 0 0;
  padding: 0;
  border: 0;
}

.choice-card {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 14px;
  align-items: start;
  padding: 16px 18px;
  border: 1px solid rgba(20, 20, 20, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.choice-card + .choice-card {
  margin-top: 12px;
}

.choice-card:hover {
  transform: translateY(-1px);
  border-color: rgba(94, 31, 23, 0.28);
}

.choice-card input {
  margin-top: 4px;
  accent-color: var(--accent);
}

.choice-card:has(input:checked) {
  border-color: rgba(94, 31, 23, 0.42);
  background: var(--accent-soft);
}

.choice-content {
  display: block;
}

.choice-content strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1rem;
}

.choice-content small {
  display: block;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.5;
}

.submit-button,
.memo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #6c281f 0%, #4e1711 100%);
  color: #fff;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: 0 16px 30px rgba(78, 23, 17, 0.26);
  cursor: pointer;
}

.submit-button {
  width: 100%;
  margin-top: 22px;
}

.submit-button:hover,
.memo-link:hover {
  filter: brightness(1.03);
}

.notice {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  font-weight: 600;
}

.notice.success {
  background: rgba(31, 75, 57, 0.1);
  color: var(--success);
}

.notice.error {
  background: rgba(122, 31, 31, 0.09);
  color: var(--error);
}

.totals {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.totals div {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(20, 20, 20, 0.08);
}

.totals strong {
  display: block;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.6rem;
}

.summary-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.summary-note strong {
  font-size: 1.1rem;
  line-height: 1.35;
}

.memo-heading {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 18px;
}

.memo-frame {
  overflow: hidden;
  min-height: 78vh;
  border: 1px solid rgba(20, 20, 20, 0.1);
  border-radius: 16px;
  background: #fbfaf7;
}

.memo-frame iframe {
  width: 100%;
  height: 78vh;
  border: 0;
}

.admin-layout {
  max-width: 980px;
  margin: 0 auto;
}

.admin-summary {
  padding: 24px;
}

.totals-admin {
  margin-top: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-table-panel {
  margin-top: 24px;
  padding: 24px;
}

.results-table-wrap {
  overflow-x: auto;
  margin-top: 20px;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
}

.results-table th,
.results-table td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(20, 20, 20, 0.08);
  text-align: left;
}

.results-table th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.empty-state {
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

@media (max-width: 920px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    max-width: none;
  }

  .memo-frame,
  .memo-frame iframe {
    min-height: 60vh;
    height: 60vh;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 32px 16px 48px;
  }

  .ballot-panel,
  .memo-panel {
    padding: 18px;
  }

  .memo-heading {
    align-items: start;
    flex-direction: column;
  }

  .totals-admin {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
