:root {
  --bg: #f5f1e7;
  --panel: #fffdf8;
  --panel-strong: #f0eadf;
  --ink: #1f2528;
  --muted: #586067;
  --border: #cfc5b5;
  --accent: #234a58;
  --accent-soft: #dbe8ed;
  --success: #176234;
  --success-soft: #bfe7cb;
  --warning: #9a6500;
  --warning-soft: #f0d08e;
  --danger: #a22f20;
  --danger-soft: #f3dfdb;
  --shadow: 0 1px 0 rgba(31, 37, 40, 0.08);
}

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

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

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

.shell {
  width: min(1120px, calc(100vw - 2rem));
  margin: 0 auto;
}

.site-header {
  border-bottom: 1px solid rgba(207, 197, 181, 0.8);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}

.shell-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 4.2rem;
}

.page-shell {
  padding: 1.25rem 0 3rem;
}

.brand {
  text-decoration: none;
  font-weight: 700;
  padding-right: 10px;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.site-nav a {
  text-decoration: none;
  font-weight: 600;
}

.hero,
.admin-layout {
  display: grid;
  gap: 1rem;
}

.hero {
  grid-template-columns: minmax(0, 1.6fr) minmax(18rem, 1fr);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem;
  box-shadow: var(--shadow);
}

.panel-note {
  background: linear-gradient(180deg, rgba(240, 234, 223, 0.85), rgba(255, 253, 248, 0.95));
}

.panel-danger {
  border-color: #cf9d92;
  background: var(--danger-soft);
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

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

h1,
h2,
h3 {
  margin: 0 0 0.65rem;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

h2 {
  font-size: 1.35rem;
}

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

.actions,
.split,
.copy-row,
.status-stack,
.link-stack,
.stack-sm,
.stack-md,
.stack-lg {
  display: flex;
  gap: 0.8rem;
}

.stack-sm,
.stack-md,
.stack-lg,
.status-stack,
.link-stack {
  flex-direction: column;
}

.stack-sm {
  gap: 0.65rem;
}

.stack-md {
  gap: 1rem;
}

.stack-lg {
  gap: 1.5rem;
}

.split {
  justify-content: space-between;
  align-items: start;
  flex-wrap: wrap;
}

.button {
  appearance: none;
  border: 1px solid var(--border);
  background: #f9f6ef;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.75rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
}

.button:hover {
  background: #f2ece1;
}

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.button-primary:hover {
  background: #1e404b;
}

.button-danger {
  background: #fff5f2;
  border-color: #d1aaa2;
  color: var(--danger);
}

.button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

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

.full {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 0.4rem;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid #bfb5a5;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.plain-list {
  margin: 0;
  padding-left: 1.1rem;
}

.bulk-tools {
  display: grid;
  gap: 1rem;
}

.option-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr auto;
  gap: 0.8rem;
  align-items: end;
}

.option-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.option-card,
.ranking-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  background: #fff;
}

.option-card-best,
.ranking-item-best,
.best-column {
  background: var(--success-soft);
}

.option-card-final,
.ranking-item-final,
.final-column {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.vote-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.choice {
  position: relative;
  flex: 1 1 5rem;
}

.choice input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.choice span {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 3rem;
  border-radius: 12px;
  border: 1px solid #b8ae9f;
  font-weight: 600;
  background: #fffdfa;
}

.choice input:checked + span {
  border-color: currentColor;
  box-shadow: inset 0 0 0 1px currentColor;
}

.choice-yes span {
  color: var(--success);
  background: rgba(23, 98, 52, 0.14);
  border-color: rgba(23, 98, 52, 0.34);
}

.choice-maybe span {
  color: var(--warning);
  background: rgba(154, 101, 0, 0.16);
  border-color: rgba(154, 101, 0, 0.34);
}

.choice-no span {
  color: var(--danger);
  background: rgba(162, 47, 32, 0.14);
  border-color: rgba(162, 47, 32, 0.32);
}

.choice-yes input:checked + span {
  background: rgba(23, 98, 52, 0.26);
}

.choice-maybe input:checked + span {
  background: rgba(154, 101, 0, 0.28);
}

.choice-no input:checked + span {
  background: rgba(162, 47, 32, 0.24);
}

.banner {
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  background: #f9f6ef;
}

.banner-soft {
  background: var(--accent-soft);
}

.banner-success {
  background: var(--success-soft);
}

.banner-final {
  background: #e8eef0;
  border-color: #aebcc3;
}

.ranking-list {
  display: grid;
  gap: 0.75rem;
}

.matrix-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

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

.results-table th,
.results-table td {
  border-bottom: 1px solid #e6ddd0;
  border-right: 1px solid #e6ddd0;
  padding: 0.65rem 0.55rem;
  text-align: center;
  vertical-align: top;
}

.results-table thead th:first-child,
.results-table tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fffdf8;
  text-align: left;
}

.results-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fffdf8;
}

.table-option-label {
  min-width: 6.5rem;
  white-space: nowrap;
  font-size: 0.9rem;
}

.column-totals,
.table-comment {
  color: var(--muted);
  font-size: 0.82rem;
}

.value-yes {
  background: rgba(23, 98, 52, 0.28);
}

.value-maybe {
  background: rgba(154, 101, 0, 0.26);
}

.value-no {
  background: rgba(162, 47, 32, 0.24);
}

.value-unset {
  background: rgba(88, 96, 103, 0.1);
}

.option-list {
  display: grid;
  gap: 0.75rem;
}

.option-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid #e6ddd0;
  border-radius: 12px;
  padding: 0.85rem;
  background: #fff;
}

.copy-row {
  align-items: stretch;
}

.copy-row input {
  flex: 1 1 auto;
}

.empty-state {
  text-align: center;
  display: grid;
  gap: 1rem;
  place-items: center;
  min-height: 18rem;
}

.home-minimal {
  min-height: calc(100vh - 8.5rem);
  display: grid;
  place-items: center;
}

.home-minimal .button {
  min-height: 4.5rem;
  padding: 1.15rem 2rem;
  font-size: 1.3rem;
  min-width: min(22rem, 100%);
}

.table-participant {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.table-edit-button {
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.84rem;
  white-space: nowrap;
}

@media (min-width: 1200px) {
  .panel-results {
    width: min(1400px, calc(100vw - 2rem));
    margin-left: 50%;
    transform: translateX(-50%);
  }

  .results-table thead th:first-child,
  .results-table tbody th {
    min-width: 12rem;
  }
}

@media (max-width: 900px) {
  .hero,
  .admin-layout,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .page-head {
    display: grid;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 1rem, 1120px);
  }

  .site-header {
    position: static;
  }

  .option-row {
    grid-template-columns: 1fr;
  }

  .copy-row,
  .actions {
    flex-direction: column;
  }

  .button,
  .choice span {
    min-height: 3.1rem;
  }

  .results-table {
    width: max(100%, 640px);
  }
}
