:root {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #fafafa;
  --card-bg: #d6dadb;
  --card-bg-hover: #dae7d0;
  --card-bg-chosen: #e0ffa0;
  --ratings-row-bg: #f3f3f3;
  --ratings-row-alt-bg: #fafafa;
  --border: #e8e8e8;
  --border-strong: #222222;
  --text: #1f1a1f;
  --text-muted: #9a9f9f;
  --accent: #1f1a1f;
  --radius: 12px;
  --font-ui: Arial, Verdana, sans-serif;
  --font-content: Arial, Verdana, sans-serif;
  --text-ui-size: 12px;
  --text-ui-line: 15px;
  --text-content-size: 12px;
  --text-content-line: 15px;
  --text-heading-size: 12px;
  --text-heading-line: 15px;
  --text-label-size: 10px;
  --motion-hover: 480ms;
  --motion-choice: 620ms;
  --motion-progress: 560ms;
  --card-height: 580px;
  --card-max-width: 460px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: var(--text-ui-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.page {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 56px 0 48px;
}

.hero {
  max-width: 640px;
  margin: 0 auto 40px;
  text-align: center;
}

.eyebrow {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: var(--text-ui-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
}

.hero h1 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-content);
  font-size: var(--text-heading-size);
  font-weight: normal;
  line-height: var(--text-heading-line);
}

.subtitle {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-family: var(--font-content);
  font-size: var(--text-content-size);
  font-weight: normal;
  line-height: var(--text-content-line);
}

.progress-panel {
  max-width: 640px;
  margin: 0 auto 36px;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: var(--text-ui-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
}

.progress-copy strong {
  color: var(--text);
  font-weight: normal;
}

.progress-track {
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width var(--motion-progress) cubic-bezier(0,0,.83,.67);
}

.prompt {
  text-align: center;
  margin: 0 0 6px;
  color: var(--text);
  font-family: var(--font-content);
  font-size: var(--text-content-size);
  font-weight: normal;
  line-height: var(--text-content-line);
}

.context-note {
  text-align: center;
  margin: 0 0 28px;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: var(--text-ui-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
}

.matchup {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, var(--card-max-width)));
  justify-content: center;
  gap: 20px;
  width: 100%;
  max-width: calc(var(--card-max-width) * 2 + 20px);
  margin: 0 auto;
  align-items: stretch;
}

.versus {
  align-self: center;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: var(--text-ui-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
}

.civ-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  height: var(--card-height);
  padding: 0;
  border: 0px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: inherit;
  font-family: var(--font-ui);
  font-size: var(--text-ui-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color var(--motion-hover) cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow var(--motion-hover) cubic-bezier(0.4, 0, 0.2, 1),
    background-color var(--motion-hover) cubic-bezier(0.4, 0, 0.2, 1),
    opacity var(--motion-choice) cubic-bezier(0.4, 0, 0.2, 1);
}

.civ-card:hover,
.civ-card:focus,
.civ-card:focus-visible {
  background-color: var(--card-bg-hover);
  outline: none;
}

.matchup--locked .civ-card {
  cursor: default;
  pointer-events: none;
}

.matchup--locked .civ-card:not(.chosen) {
  opacity: 0.72;
}

.civ-card.chosen {
  border-color: var(--border-strong);
  background-color: var(--card-bg-chosen);
  opacity: .9;
}

.civ-card__header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
  padding: 16px 18px;
  border-bottom: 0px solid var(--border);
}

.civ-card__icon {
  flex: 0 0 auto;
  border-radius: 6px;
}

.civ-card__title {
  min-width: 0;
}

.card-name {
  margin: 0;
  color: var(--text);
  font-family: var(--font-content);
  font-size: var(--text-heading-size);
  font-weight: normal;
  line-height: var(--text-heading-line);
}

.card-archetype {
  margin: 2px 0 0;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--text-ui-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
}

.civ-card__bonus {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 18px 40px;
  background: var(--surface);
  color: var(--text);
  overflow-y: auto;
}

.bonus-card {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.bonus-card__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  flex: 0 0 auto;
}

.bonus-card__label {
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: var(--text-label-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
  text-transform: uppercase;
}

.bonus-card__content {
  min-width: 0;
  align-self: start;
}

.bonus-card__line {
  margin: 0 0 8px;
  color: var(--text);
  font-family: var(--font-content);
  font-size: var(--text-content-size);
  font-weight: normal;
  line-height: var(--text-content-line);
}

.bonus-card__line--title {
  margin-bottom: 2px;
}

.bonus-card__line--detail {
  margin-bottom: 0;
  color: var(--text-muted);
}

.bonus-card__group--unique-tech .bonus-card__entry .bonus-card__line--title {
  margin-bottom: 1px;
}

.bonus-card__group--unique-tech .bonus-card__entry .bonus-card__line--detail {
  line-height: var(--text-content-line);
}

.bonus-card__group--unique-tech .bonus-card__content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.bonus-card__line:last-child,
.bonus-card__entry:last-child .bonus-card__line--detail,
.bonus-card__entry:last-child .bonus-card__line--title:last-child {
  margin-bottom: 0;
}

.card-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: var(--text-ui-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
}

.complete-view {
  display: grid;
  place-items: center;
  min-height: 280px;
}

.complete-view[hidden],
.compare-view[hidden] {
  display: none !important;
}

.complete-card {
  width: min(480px, 100%);
  padding: 32px 24px;
  text-align: center;
}

.complete-card h2 {
  margin: 0 0 10px;
  color: var(--text);
  font-family: var(--font-content);
  font-size: var(--text-heading-size);
  font-weight: normal;
  line-height: var(--text-heading-line);
}

.complete-card p {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-family: var(--font-content);
  font-size: var(--text-content-size);
  font-weight: normal;
  line-height: var(--text-content-line);
}

.primary-btn {
  border: 0px solid var(--accent);
  border-radius: 999px;
  padding: 11px 22px;
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font-ui);
  font-size: var(--text-ui-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
  cursor: pointer;
  transition: opacity 140ms ease;
}

.primary-btn:hover {
  opacity: 0.85;
}

.site-footer {
  max-width: 640px;
  margin: 48px auto 0;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: var(--text-ui-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
}

.site-footer a {
  color: var(--text);
  font-weight: normal;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--text);
  color: #ffffff;
  font-family: var(--font-ui);
  font-size: var(--text-ui-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
}

.page-nav {
  margin: 12px 0 12px;
}

.page-nav a {
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: var(--text-ui-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
  text-decoration: none;
}

.page-nav a:hover {
  color: var(--text);
  text-decoration: underline;
}

.ratings-page {
  max-width: 760px;
  margin: 0 auto;
}

.ratings-summary {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: var(--text-ui-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
}

.ratings-error {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-family: var(--font-content);
  font-size: var(--text-content-size);
  font-weight: normal;
  line-height: var(--text-content-line);
  text-align: center;
}

.ratings-table-wrap {
  overflow-x: auto;
}

.ratings-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
}

.ratings-table thead th {
  padding: 0 12px 4px;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: var(--text-label-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
  text-align: left;
  text-transform: uppercase;
  vertical-align: bottom;
}

.ratings-table__sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.ratings-table__num .ratings-table__sort-btn {
  justify-content: flex-end;
  width: 100%;
}

.ratings-table__sort-btn:hover,
.ratings-table__sort-btn--active {
  color: var(--text);
}

.ratings-table__sort-indicator {
  display: inline-block;
  min-width: 0.75em;
  font-size: 0.9em;
  line-height: 1;
}

.ratings-table__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ratings-table__row td {
  padding: 0 12px;
  height: 36px;
  vertical-align: middle;
  line-height: var(--text-ui-line);
}

.ratings-table tbody tr:nth-child(odd) td {
  background: var(--ratings-row-bg);
}

.ratings-table tbody tr:nth-child(even) td {
  background: var(--ratings-row-alt-bg);
}

.ratings-table__row td:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.ratings-table__row td:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.ratings-table__row--unranked td {
  opacity: 0.72;
}

.ratings-table__rank {
  width: 48px;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: var(--text-ui-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
  text-align: right;
}

.ratings-table__civ {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
  height: 100%;
}

.ratings-table__icon {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: block;
}

.ratings-table__name {
  color: var(--text);
  font-family: var(--font-content);
  font-size: var(--text-content-size);
  font-weight: normal;
  line-height: var(--text-content-line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ratings-table__row .ratings-table__num {
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--text-ui-size);
  font-weight: normal;
  line-height: var(--text-ui-line);
}

@media (max-width: 980px) {
  .page {
    padding-top: 32px;
  }

  :root {
    --card-height: 520px;
  }

  .matchup {
    grid-template-columns: minmax(0, var(--card-max-width));
    max-width: var(--card-max-width);
  }

  .versus {
    justify-self: center;
  }

  .progress-copy {
    flex-direction: column;
    gap: 4px;
  }
}
