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

:root {
  color-scheme: light;
  --bg: #e2e8dd;
  --card: #ffffff;
  --text: #582c4d;
  --muted: #4d5a53;
  --border: #95a3a4;
  --accent: #a26769;
  --accent-dark: #582c4d;
  --danger: #a26769;
  --focus: #582c4d;
  --button-bg: #5a2f36;
  --button-bg-hover: #4a252b;
  --button-text: #f7f1ee;
  --trophy: #b8860b;
  --winner-bg: #f7e6b5;
  --winner-text: #2b1915;
  --wrong-bg: rgba(141, 47, 47, 0.12);
  --wrong-border: rgba(141, 47, 47, 0.5);
  --wrong-text: #6b1e1e;
  --sans: "Source Sans 3", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", "Times New Roman", Times, serif;
  --radius: 4px;
  --select-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23582c4d' d='M6 8 0 2.2 1.4.8 6 5.4 10.6.8 12 2.2z'/%3E%3C/svg%3E");
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1e1c1c;
  --card: #2b2626;
  --text: #f0e9e4;
  --muted: #c9bdb5;
  --border: #4a403c;
  --accent: #c07c6f;
  --accent-dark: #e0b5ac;
  --danger: #c07c6f;
  --focus: #f0e9e4;
  --button-bg: #d2a79b;
  --button-bg-hover: #c59689;
  --button-text: #2b1915;
  --trophy: #d4a017;
  --winner-bg: #f3d7a2;
  --winner-text: #2b1915;
  --wrong-bg: #5a1f1f;
  --wrong-border: #8d2f2f;
  --wrong-text: #f7e9e9;
  --select-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23f0e9e4' d='M6 8 0 2.2 1.4.8 6 5.4 10.6.8 12 2.2z'/%3E%3C/svg%3E");
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: inherit;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.eyebrow-icon svg {
  width: 1rem;
  height: 1rem;
  fill: #b8860b;
  display: block;
}

html[data-theme="dark"] .eyebrow-icon svg {
  fill: #d4a017;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  padding: 0.75rem 1rem;
  background: var(--focus);
  color: #fff;
  border-radius: 0 0 var(--radius) var(--radius);
}

.skip-link:focus {
  left: 1rem;
  z-index: 10;
}

.container {
  width: min(960px, 90vw);
  margin: 0 auto;
}

.site-header .container {
  width: min(1200px, 95vw);
}

.site-header {
  background: var(--card);
  color: var(--text);
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
}

.site-header h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 3vw, 2.6rem);
  font-family: var(--serif);
  letter-spacing: 0.01em;
}

.lede {
  margin: 0;
  font-size: 1.05rem;
}

.site-footer {
  padding: 2rem 0 3rem;
}

.stack > * + * {
  margin-top: 1rem;
}

.hero {
  display: grid;
  gap: 2rem;
  align-items: center;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.language-switch select {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 0.4rem 2rem 0.4rem 0.6rem;
  background-color: var(--card);
  color: var(--text);
}

.theme-switch select {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 0.4rem 2rem 0.4rem 0.6rem;
  background-color: var(--card);
  color: var(--text);
}

.hero-full {
  width: 100%;
  max-width: none;
}

.hero-text {
  max-width: none;
}

.hero-card {
  background: var(--bg);
}

.card-title {
  margin: 0;
}

.section-heading {
  text-align: center;
  margin-bottom: 1.5rem;
}

.how-it-works {
  padding: 0;
}

.steps-grid {
  display: grid;
  gap: 1.25rem;
}

.step-card h3 {
  margin-top: 0;
}

.main-grid {
  display: grid;
  gap: 1.5rem;
}

.main-grid > div {
  min-width: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  min-width: 0;
}

.nominee-group {
  display: grid;
  gap: 0.5rem;
}

.nominee-title {
  margin: 0;
  font-weight: 600;
}

.nominees-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.nominees-list li {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.nominee-name {
  flex: 1 1 auto;
  min-width: 0;
}

.nominees-list li.is-winner {
  background: var(--winner-bg);
  color: var(--winner-text);
  border-color: var(--trophy);
}

.nominees-list li.is-wrong-pick {
  background: var(--wrong-bg);
  border-color: var(--wrong-border);
}

.nominees-list li.is-wrong-pick .nominee-name {
  color: var(--wrong-text);
}

.pick-result {
  font-weight: 700;
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  white-space: nowrap;
}

.pick-result.is-correct {
  background: #2f6b3a;
  color: #ffffff;
}

.pick-result.is-wrong {
  background: #8d2f2f;
  color: #ffffff;
}

.pick-result.is-pending {
  background: var(--muted);
  color: var(--bg);
}

#picks-results-updated {
  margin-top: 1rem;
}

.winner-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

.winner-icon svg {
  width: 1rem;
  height: 1rem;
  fill: var(--trophy);
  display: block;
}

.winner-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--trophy);
  color: var(--winner-text);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  white-space: nowrap;
}

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

.leaderboard-heading-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: nowrap;
  flex: 1;
  min-width: 0;
}

.leaderboard-year-group {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-bottom: 1rem;
}

.leaderboard-heading-row select {
  font-size: 0.9rem;
  padding: 0.25rem 1.5rem 0.25rem 0.5rem;
  min-width: 4rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 0.65rem;
}

.icon-button {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 999px;
  color: var(--text);
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-button:hover {
  background: var(--text);
  color: var(--bg);
}

.icon-button svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
  display: block;
}

.icon-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 30;
}

.modal-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

body.modal-open {
  overflow: hidden;
}

.expandable-card.is-expanded {
  position: fixed;
  inset: 1.5rem;
  z-index: 40;
  max-width: none;
  width: calc(100% - 3rem);
  height: calc(100% - 3rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.expandable-card.is-expanded .table-wrap {
  overflow: auto;
  flex: 1;
}

.field {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

label {
  font-weight: 600;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  letter-spacing: 0.01em;
  font-weight: 600;
  margin-top: 0;
}

p.alone {
  padding-top: 1em;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background-color: var(--bg);
  color: var(--text);
  width: 100%;
  max-width: 100%;
}

select {
  text-overflow: ellipsis;
  appearance: none;
  background-image: var(--select-caret);
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 0.7rem;
  padding-right: 2rem;
}

.field.is-missing select {
  border-color: var(--accent);
  background-color: rgba(162, 103, 105, 0.18);
  box-shadow: 0 0 0 3px rgba(162, 103, 105, 0.18);
}

.field.is-missing label {
  color: var(--accent-dark);
}

button,
.file-button {
  border: none;
  background: var(--button-bg);
  color: var(--button-text);
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

button:hover,
.file-button:hover {
  background: var(--button-bg-hover);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.file-button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

button.danger {
  background: var(--danger);
}

.help,
.muted {
  color: var(--muted);
  margin: 0;
}

.status {
  margin: 1rem 0 0;
  color: var(--text);
  font-weight: 600;
}

.notice {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: var(--radius);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.link-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: var(--bg);
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.link-row input {
  flex: 1 1 220px;
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 0.5rem;
  text-align: left;
}

th {
  font-weight: 700;
  background: var(--bg);
}

.heatmap {
  table-layout: auto;
  min-width: 100%;
  width: max-content;
}

.heatmap th,
.heatmap td {
  text-align: center;
  padding: 0.5rem 0.4rem;
  font-size: 0.85rem;
}

.heatmap th:first-child,
.heatmap td:first-child {
  text-align: left;
  font-weight: 600;
  width: 40%;
}

.heatmap th:not(:first-child),
.heatmap td:not(:first-child) {
  min-width: 4.5rem;
  white-space: nowrap;
}

.heatmap-cell {
  font-variant-numeric: tabular-nums;
}

.heat-0 { background: #f8f8f8; }
.heat-1 { background: #efe2e2; }
.heat-2 { background: #e6c8c8; }
.heat-3 { background: #ddb0b0; }
.heat-4 { background: #d49898; }
.heat-5 { background: #cb8080; }

.heatmap .is-self {
  background: var(--bg);
  font-weight: 700;
}

html[data-theme="dark"] .heatmap-cell {
  color: #1e1c1c;
}

html[data-theme="dark"] .heatmap .is-self {
  color: var(--text);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 720px) {
  .site-header {
    padding: 2rem 0 1.5rem;
  }

  .card {
    padding: 1.2rem;
  }
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .steps-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .main-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    align-items: start;
  }

  .main-grid > div:last-child {
    position: sticky;
    top: 1.5rem;
  }
}
