:root {
  --bg: #f6f2ea;
  --paper: #fffdf8;
  --paper-2: #f1eadf;
  --ink: #17211f;
  --muted: #65726d;
  --line: #d9d0c3;
  --line-strong: #aa9d8c;
  --accent: #087f6f;
  --accent-dark: #055f54;
  --accent-soft: #d8eee8;
  --good: #14724d;
  --bad: #b64242;
  --shadow: 0 20px 50px rgba(47, 40, 30, 0.13);
  --display: "Fraunces", Georgia, serif;
  --body: "Public Sans", system-ui, sans-serif;
}

.a-teal { --accent: #087f6f; --accent-dark: #055f54; --accent-soft: #d8eee8; }
* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  font-family: var(--body);
  color: var(--ink);
  background: #fff;
}

button, input, select { font: inherit; }
button { border: 0; }

.frame {
  width: min(100% - 32px, 1560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 36px;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 16px;
}

.masthead-inner {
  max-width: 820px;
}

.masthead-eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.masthead-title {
  margin: 0;
  max-width: 760px;
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 3.5rem);
  line-height: 1;
  letter-spacing: 0;
}

.masthead-desc {
  max-width: 700px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.16rem);
  line-height: 1.6;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar-left,
.stage-under,
.winner-block,
.rank-badges,
.column-tools {
  display: flex;
  align-items: center;
}

.toolbar-left { gap: 10px; flex-wrap: wrap; }

.act-btn {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 2px 0 rgba(23, 33, 31, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.act-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 0 rgba(23, 33, 31, 0.12); }
.act-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(23, 33, 31, 0.12); }
.act-btn:disabled { cursor: not-allowed; opacity: 0.45; transform: none; }
.act-icon { margin-right: 6px; vertical-align: -2px; }
.act-primary { background: var(--accent); border-color: var(--accent-dark); color: #fff; }

.cell-input,
.column-input,
.column-number {
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fffefa;
  color: var(--ink);
  outline: 0;
}

.cell-input:focus,
.column-input:focus,
.column-number:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.stage-card {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: transparent;
}

.stage-scroll { overflow-x: auto; }

.comparison-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

.comparison-table.is-centered { margin-inline: auto; }
.comparison-table.is-full { min-width: 100%; }

.comparison-table th,
.comparison-table td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.comparison-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #ece3d4;
  border-bottom: 3px solid var(--accent);
  color: #2d352f;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.comparison-table tbody tr:nth-child(even) { background: rgba(23, 33, 31, 0.025); }
.comparison-table tbody tr.is-best-price { background: color-mix(in srgb, var(--accent-soft) 62%, white); }
.comparison-table tbody tr.is-best-overall { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: -2px; }

.cell-input { width: 92px; min-height: 36px; padding: 0 9px; }
.name-input { width: 220px; }
.column-input { width: 150px; min-height: 30px; padding: 0 8px; }
.column-number { width: 66px; min-height: 30px; padding: 0 7px; }
.column-tools { gap: 8px; margin-top: 7px; }
.mini-label { gap: 5px; color: var(--muted); font-size: 0.72rem; text-transform: none; letter-spacing: 0; }
.mini-label input { accent-color: var(--accent); }

.metric-note { margin-top: 5px; font-size: 0.76rem; font-weight: 700; }
.text-good { color: var(--good); }
.text-bad { color: var(--bad); }
.money, .score { font-weight: 800; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
}

.badge.secondary { background: #33423c; }
.rank-badges { gap: 7px; flex-wrap: wrap; }
.rank-number { color: var(--muted); font-size: 0.78rem; font-weight: 700; }

.text-button {
  padding: 5px 8px;
  border-radius: 6px;
  background: transparent;
  color: var(--bad);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
}

.text-button:hover { background: #f8e2de; }
.sortable { cursor: pointer; user-select: none; }

.stage-under {
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
}

.winner-block {
  gap: 10px;
  min-height: 42px;
  max-width: 100%;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: transparent;
}

.article-hub {
  width: min(100% - 32px, 900px);
  margin: 3rem auto;
  text-align: center;
}

.article-hub h2 { margin: 0; font: 600 0.9rem var(--body); text-transform: uppercase; letter-spacing: 0.1em; }
.article-hub p { margin: 0.6rem 0 1rem; color: var(--muted); font-size: 0.82rem; }
.article-hub ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1rem; margin: 0; padding: 0; list-style: none; }
.article-hub a { color: var(--accent-dark); font-size: 0.78rem; text-underline-offset: 3px; }

.winner-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.winner-value {
  overflow-wrap: anywhere;
  font-weight: 800;
}

.network-footer {
  width: min(100% - 32px, 1560px);
  margin: 0 auto 24px;
  padding: 20px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.network-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.network-footer a { color: var(--accent-dark); font-weight: 700; text-decoration-thickness: 1px; text-underline-offset: 3px; }

@media (max-width: 720px) {
  .frame { width: min(100% - 20px, 1560px); padding-top: 20px; }
  .toolbar { align-items: stretch; }
  .toolbar-left, .act-btn { width: 100%; }
  .comparison-table th, .comparison-table td { padding: 11px 10px; }
  .name-input { width: 180px; }
  .stage-under { align-items: stretch; }
  .winner-block { align-items: flex-start; flex-direction: column; height: auto; padding: 10px 12px; }
}
