/* Sheets laid over the plate: archive, sign-in, duels, leaderboard.
 * Same language everywhere: paper, ink rules, serif headings, one terracotta
 * mark for "selected" and "primary". */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(23, 33, 58, 0.58);
  animation: overlayIn var(--dur) var(--ease-std);
}

.overlay.hidden { display: none; }

@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.archiveCard,
.authCard,
.duelCard,
.lbCard,
.scoreCard {
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--sheet);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 8px 8px 0 rgba(23, 33, 58, 0.22);
  animation: sheetIn var(--dur) var(--ease);
}

@keyframes sheetIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.archiveCard { width: min(780px, 100%); padding: 32px 32px 28px; }

/* the country list: two columns of tiles, alphabetical in the player's language */
.countryCard { width: min(620px, 100%); }
.countryCard h2 .testTag { margin-left: 6px; font-size: 12px; vertical-align: 0.45em; }
.countryNote { margin: -8px 0 18px; max-width: 56ch; font-size: 14px; line-height: 1.5; color: var(--ink-3); }
.countryList {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--ink);
}
.countryRow {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 7px 8px 7px 6px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  border-left: 3px solid transparent;
  transition: background var(--dur-fast) var(--ease-std), border-color var(--dur-fast) var(--ease-std);
}
.countryRow:hover { background: rgba(23, 33, 58, 0.05); }
.countryRow.active { border-left-color: var(--terra-deep); background: var(--terra-soft); }
.countryRow .regionIcon { display: flex; flex: 0 0 auto; width: 34px; height: 26px; }
.countryRow .regionIcon svg { display: block; width: 100%; height: 100%; color: var(--ink-4); }
.countryRow:hover .regionIcon svg { color: var(--ink-2); }
.countryRow.active .regionIcon svg { color: var(--terra-deep); }
.countryText { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.countryName { font-size: 15px; font-weight: 650; line-height: 1.25; color: var(--ink); }
.countryCap { font-size: 12px; line-height: 1.3; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.countryRow:focus-visible { outline: 2px solid var(--terra-deep); outline-offset: -2px; }

@media (max-width: 560px) {
  .countryList { grid-template-columns: 1fr; }
}
.duelCard { width: min(560px, 100%); padding: 32px; }
.lbCard { width: min(700px, 100%); padding: 32px; }
.authCard { width: min(400px, 100%); padding: 56px 28px 28px; overflow: visible; }

.archiveCard h2,
.duelCard h2,
.lbCard h2,
.scoreCard h2,
.authCodeView h2 {
  margin: 0 44px 20px 0;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.4px;
  color: var(--ink);
}

.archiveCard h3,
.duelCard h3,
.scoreCard h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 18px;
  font-style: italic;
  font-weight: 600;
  color: var(--ink-2);
}

.overlayClose {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 1;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--sheet);
  transition: background var(--dur-fast) var(--ease-std);
}

.overlayClose:hover { background: var(--sunk); }
.overlayClose:active { background: var(--rule-strong); }

.archiveEmpty {
  padding: 28px 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  color: var(--ink-3);
}

/* ---------- Archive ---------- */

.archiveRegionTabs { display: flex; flex-wrap: wrap; gap: 2px 4px; margin-bottom: 22px; padding-bottom: 2px; border-bottom: 1px solid var(--rule-strong); }

.archiveTab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 7px 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -3px;
  transition: color var(--dur-fast) var(--ease-std), border-color var(--dur-fast) var(--ease-std);
}

.archiveTab:hover { color: var(--ink); }
.archiveTab.active { color: var(--ink); border-color: var(--terra-deep); }
.archiveTab.isEmpty { opacity: 0.55; }

.archiveTab .tabIcon { display: flex; width: 26px; height: 20px; }
.archiveTab .tabIcon svg { display: block; width: 100%; height: 100%; color: var(--ink-4); }
.archiveTab.active .tabIcon svg { color: var(--terra-deep); }

.archiveTab .tabCount {
  min-width: 18px;
  padding: 0 5px;
  font-size: 11px;
  text-align: center;
  color: var(--ink-3);
  background: var(--sunk);
  border-radius: 2px;
  font-variant-numeric: tabular-nums;
}

.archiveStats { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 28px; }

.archiveStat { padding: 0 20px; border-left: 1px solid var(--rule-strong); }
.archiveStat:first-child { padding-left: 0; border-left: 0; }

.archiveStat .statLabel { font-size: 12.5px; color: var(--ink-3); }

.archiveStat .statValue {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.5px;
  color: var(--ink);
  font-variant-numeric: lining-nums tabular-nums;
}

.archiveError { font-family: var(--font-ui); font-style: normal; font-size: 14.5px; color: var(--brick); }
#archiveLoading { justify-content: center; min-height: 120px; }

.archiveSection { margin-bottom: 30px; }
.archiveSection:last-child { margin-bottom: 0; }
.archiveHint { margin: 0 0 12px; font-size: 12.5px; color: var(--ink-3); }
.archiveChart { width: 100%; overflow-x: auto; }
.archiveChart svg { display: block; }

.weakRegions { display: flex; flex-direction: column; gap: 9px; }

.weakRegionRow { display: grid; grid-template-columns: 120px 1fr 48px; align-items: center; gap: 12px; }
.weakRegionName { font-size: 13.5px; color: var(--ink-2); }
.weakRegionTrack { height: 8px; background: var(--sunk); overflow: hidden; }
.weakRegionFill { height: 100%; background: var(--slate); transition: width var(--dur-slow) var(--ease); }
.weakRegionFill.low { background: var(--brick); }
.weakRegionFill.mid { background: var(--terra); }
.weakRegionPct { font-size: 13px; font-weight: 600; text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.archiveList { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }

/* one game: what and how on the left, the score on the right, then its actions */
.archiveRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  column-gap: 18px;
  align-items: center;
  padding: 12px 2px;
  border-bottom: 1px solid var(--rule);
}

.gameMain { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.gameTitle { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.gameKind {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
}
.gameKind svg { flex-shrink: 0; color: var(--ink-3); }
.gameMeta { font-size: 12.5px; line-height: 1.45; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* a duel's outcome, in the colours the duel sheet uses for it */
.gameOutcome { padding: 1px 7px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.2px; border-radius: 2px; }
.gameOutcome.isWin { color: var(--moss-ink); background: rgba(148, 163, 120, 0.2); }
.gameOutcome.isLoss { color: var(--brick); background: rgba(154, 69, 53, 0.1); }
.gameOutcome.isDraw { color: var(--ink-2); background: var(--sunk); }
.gameOutcome.isPending { color: var(--ink-3); font-weight: 600; font-style: italic; background: var(--sunk); }

.gameScore { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.gameScoreNum {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: lining-nums tabular-nums;
}
.gameScoreOf { font-size: 12px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

.archiveRowActions { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }

.archiveRowDelete,
.archiveRowResults {
  padding: 4px 8px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius);
}

.archiveRowDelete { min-width: 72px; color: var(--ink-3); transition: color var(--dur-fast) var(--ease-std), background var(--dur-fast) var(--ease-std); }
.archiveRowDelete:hover { color: var(--brick); background: rgba(154, 69, 53, 0.1); }
/* first press arms it; the second one deletes */
.archiveRowDelete.armed,
.archiveRowDelete.armed:hover { color: #fff; background: var(--brick); }
.archiveRowResults { color: var(--terra-ink); }
.archiveRowResults:hover { background: var(--terra-soft); }

/* ---------- Sign in ---------- */

.authCard .overlayClose { top: 12px; right: 12px; }
.authCard.revealing { padding-top: 28px; }
.authCard.revealing .overlayClose { display: none; }

.authTabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 22px; border-bottom: 1px solid var(--rule-strong); }

.authTab {
  padding: 9px 8px;
  margin-bottom: -1px;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  transition: color var(--dur-fast) var(--ease-std), border-color var(--dur-fast) var(--ease-std);
}

.authTab:hover { color: var(--ink); }
.authTab.active { color: var(--ink); border-color: var(--terra-deep); }

#authForm { display: flex; flex-direction: column; gap: 6px; }
#authForm .fieldLabel { grid-row: auto; margin-top: 12px; padding-top: 0; }
#authForm .fieldLabel:first-child { margin-top: 0; }

#authNickname,
#authCode {
  width: 100%;
  padding: 11px 13px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #FBFAF5;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
}

#authNickname:focus,
#authCode:focus { outline: none; border-color: var(--terra-deep); box-shadow: 0 0 0 3px var(--terra-soft); }

#authCode {
  font-family: var(--font-mono);
  font-size: 17px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#authCode::placeholder { letter-spacing: 0.14em; color: var(--ink-4); }

#authCodeField { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }

.authHint { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); }
.authError { margin-top: 4px; }
.authSubmitBtn { width: 100%; margin-top: 18px; }

.authNote {
  margin: 16px 0 0;
  padding-top: 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-3);
  border-top: 1px solid var(--rule-strong);
}

.authCodeView { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.authCodeView h2 { margin: 0; font-size: 24px; }
.authCodeFor { margin: -6px 0 0; font-size: 13.5px; color: var(--ink-3); }
.authCodeFor b { color: var(--ink); }

.codeDisplay {
  width: 100%;
  padding: 18px 10px;
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--ink);
  background: var(--sunk);
  border: 1px dashed var(--ink);
  user-select: all;
}

.authCopyBtn { min-width: 150px; }
.authWarn { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-2); }

/* ---------- Duels ---------- */

.duelIntro { margin: 0 0 20px; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); max-width: 52ch; }
.duelHint { margin: 0 0 10px; font-size: 13px; color: var(--ink-3); }

.duelLoginNote {
  margin: 0 0 20px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  background: var(--sunk);
  border-left: 3px solid var(--terra-deep);
}

.duelSection { margin-bottom: 18px; padding: 16px 0 4px; border-top: 1px solid var(--ink); }
.duelSection.hidden { display: none; }

.duelChips { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 0 0 14px; }
.duelCard .duelChips { margin-top: 16px; }

.duelChip {
  padding: 2px 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--sunk);
  border-radius: 2px;
}

.duelBtnRow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

.duelJoinForm { display: flex; gap: 10px; }

#duelJoinInput {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
  color: var(--ink);
  background: #FBFAF5;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
}

#duelJoinInput::placeholder { color: var(--ink-4); letter-spacing: 0.16em; }
#duelJoinInput:focus { outline: none; border-color: var(--terra-deep); box-shadow: 0 0 0 3px var(--terra-soft); }

.duelError { margin: 0 0 14px; }

.duelCodeLabel { margin-bottom: 6px; font-size: 12.5px; color: var(--ink-3); }

.duelCodeBig {
  margin-bottom: 14px;
  padding: 16px 12px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 46px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--ink);
  background: var(--sunk);
  border: 1px dashed var(--ink);
  user-select: all;
}

.duelWaiting { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; font-size: 14px; color: var(--ink-3); }
.duelCancelBtn { margin-top: 10px; }

.duelJoinedLine { margin: -8px 0 10px; font-size: 15px; font-weight: 700; color: var(--moss-ink); }

.duelActiveRow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); }
.duelActiveRow:first-of-type { border-top: 0; }
.duelActiveCode { font-family: var(--font-mono); font-size: 16px; font-weight: 700; letter-spacing: 0.12em; }
.duelActiveMeta { margin-top: 2px; font-size: 12.5px; color: var(--ink-3); }

.duelBanner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.5px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--ink);
}

.duelBanner.win { color: var(--moss-ink); }
.duelBanner.draw { color: var(--ink); }
.duelBanner.pending { font-family: var(--font-ui); font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--ink-3); }

.duelScoreboard { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 18px; }

.duelScoreSide { padding: 0 16px; border-left: 1px solid var(--rule-strong); }
.duelScoreSide:first-child { padding-left: 0; border-left: 0; }
.duelScoreSide.lead .duelScoreNum { color: var(--moss-ink); }

.duelScoreName { overflow: hidden; font-size: 13px; color: var(--ink-3); text-overflow: ellipsis; white-space: nowrap; }

.duelScoreNum {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.5px;
  font-variant-numeric: lining-nums tabular-nums;
}

.duelScoreMax { font-size: 12px; color: var(--ink-3); }

.duelTable { border-top: 1px solid var(--ink); }

.duelRow {
  display: grid;
  grid-template-columns: 28px 1.1fr 1fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 2px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
}

.duelRowHead { font-size: 12px; color: var(--ink-3); border-bottom: 1px solid var(--rule-strong); }
.duelRowHead > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duelRoundNo { color: var(--ink-3); }
.duelPts { font-size: 12px; color: var(--ink-3); }
.duelCellBox.lead .duelPts { color: var(--moss-ink); font-weight: 700; }
.duelDim { color: var(--ink-3); }

/* ---------- Daily challenge (shares the duel sheet's parts) ---------- */

.dailyCard h2 { margin-bottom: 2px; }
.dailyDate {
  margin: 0 44px 18px 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 17px;
  color: var(--ink-3);
}

/* the streak: two readings side by side, like the duel scoreboard */
.dailyStreak {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 4px 0 8px;
  padding: 14px 0 10px;
  border-top: 1px solid var(--ink);
}
.dailyStreakStat { padding: 0 16px; border-left: 1px solid var(--rule-strong); }
.dailyStreakStat:first-child { padding-left: 0; border-left: 0; }
.dailyStreakLabel { font-size: 12.5px; color: var(--ink-3); }
.dailyStreakNum {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.4px;
  color: var(--ink-3);
  font-variant-numeric: lining-nums tabular-nums;
}
.dailyStreak.isLive .dailyStreakStat:first-child .dailyStreakNum { color: var(--terra-ink); }
.dailyStreakBest { color: var(--ink); }
.dailyAtRisk { color: var(--terra-ink); font-weight: 650; }

.dailyActions { margin-top: 14px; }

.dailyResult {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.dailyPlace {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 19px;
  font-weight: 600;
  color: var(--ink-2);
  text-align: right;
}
.dailyCard .duelTable { margin-bottom: 4px; }
/* the table's own rules close it; the streak needs no second line on top */
.dailyCard .duelTable + .dailyStreak { border-top: 0; }
.duelRow.dailyRow { grid-template-columns: 28px 1fr 1fr; }

.dailyFoot {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 18px 0 0;
  padding-top: 12px;
  font-size: 12.5px;
  color: var(--ink-3);
  border-top: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
}

/* ---------- Leaderboard ---------- */

.lbTabs { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-bottom: 10px; border-bottom: 1px solid var(--rule-strong); }

.lbTab {
  padding: 7px 0 8px;
  margin-bottom: -1px;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  transition: color var(--dur-fast) var(--ease-std), border-color var(--dur-fast) var(--ease-std);
}

.lbTab:hover { color: var(--ink); }
/* sets the daily challenge's boards apart from the all-time stats */
.lbTabSep { align-self: center; width: 1px; height: 16px; background: var(--rule-strong); }
.lbTab.active { color: var(--ink); border-color: var(--terra-deep); }

.lbHint { margin: 0 0 16px; font-size: 13px; line-height: 1.5; color: var(--ink-3); }
.lbRegions { margin-bottom: 18px; }
.lbScales { margin-bottom: 10px; }

.lbList { display: flex; flex-direction: column; border-top: 1px solid var(--ink); }
.lbListMe { margin-top: 10px; }

.lbRow {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px 6px;
  border-bottom: 1px solid var(--rule);
}

.lbRow.me { background: var(--terra-soft); box-shadow: inset 3px 0 0 var(--terra-deep); }

.lbRank {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-3);
  text-align: center;
  font-variant-numeric: lining-nums tabular-nums;
}

.lbRank1 { color: var(--terra-ink); font-size: 28px; }
.lbRank2 { color: var(--ink); font-size: 24px; }
.lbRank3 { color: var(--ink); font-size: 22px; }

.lbName { overflow: hidden; font-size: 15px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }

.lbValue { display: flex; flex-direction: column; text-align: right; }

.lbMain {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: lining-nums tabular-nums;
}

.lbSub { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.lbMeBox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  background: var(--sunk);
  border-left: 3px solid var(--terra-deep);
}

.lbResults { transition: opacity var(--dur-fast) var(--ease-std); }
.lbResults.isLoading { opacity: 0.45; pointer-events: none; }

.lbFoot { margin: 16px 0 0; font-size: 12px; line-height: 1.55; color: var(--ink-3); }

/* ---------- Narrow screens ---------- */

@media (max-width: 640px) {
  .overlay { padding: 12px; }
  .archiveCard, .duelCard, .lbCard { padding: 24px 18px 22px; }
  .archiveCard h2, .duelCard h2, .lbCard h2 { font-size: 25px; }
  /* a phone: the actions move under the entry, on the right */
  .archiveRow { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; column-gap: 12px; }
  .archiveRowActions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }
  .gameKind { font-size: 14px; }
  .gameScoreNum { font-size: 18px; }
  .archiveStat { padding: 0 10px; }
  .archiveStat .statValue { font-size: 30px; }
  .weakRegionRow { grid-template-columns: 92px 1fr 42px; }
  .duelCodeBig { font-size: 34px; }
  .duelRow { grid-template-columns: 20px 1fr 1fr 1fr; font-size: 12px; }
  .duelScoreNum { font-size: 30px; }
  .lbRow { grid-template-columns: 38px 1fr auto; gap: 8px; }
  .dailyStreakNum { font-size: 26px; }
  .dailyResult { flex-wrap: wrap; }
  .dailyPlace { text-align: left; }
  .dailyFoot { flex-direction: column; }
  .dailyFoot [aria-hidden="true"] { display: none; }
}


/* ---------- How we score ---------- */

.scoreCard { width: min(1020px, 100%); padding: 32px 36px 30px; }

.scoreCols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 0 40px; align-items: start; }
@media (max-width: 880px) { .scoreCols { grid-template-columns: 1fr; } }

.scoreLead { margin: 0 0 18px; max-width: 56ch; font-size: 16px; line-height: 1.55; color: var(--ink-2); }

.scoreRules { display: flex; flex-direction: column; margin: 0 0 28px; padding: 0; list-style: none; border-top: 1px solid var(--ink); }

.scoreRules li {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}

.scoreMark {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.5px;
  color: var(--terra-ink);
  font-variant-numeric: lining-nums tabular-nums;
}

.scoreRules p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink); max-width: 54ch; }

.scoreDemo { margin-bottom: 8px; }
.scoreTable, .scoreTiers { margin-top: 24px; }
.scoreRules { margin-bottom: 0; }

.demoTruth { margin: 0 0 14px; font-size: 15px; color: var(--ink-2); }
.demoTruth b { font-weight: 700; color: var(--ink); }

.demoChart { position: relative; height: 150px; padding-bottom: 24px; margin: 0 8px; }
.demoChart svg { display: block; width: 100%; height: 126px; overflow: visible; border-bottom: 1.5px solid var(--ink); }
.demoArea { fill: var(--terra-soft); }
.demoLine { fill: none; stroke: var(--terra-deep); stroke-width: 2.5; vector-effect: non-scaling-stroke; }

.demoTruthLine { position: absolute; top: 0; height: 126px; width: 0; border-left: 1.5px dashed var(--ink-3); }

.demoMarker {
  position: absolute;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  background: var(--sheet);
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  /* top is a share of the plot's height (126px of 150px) */
  transform: translateY(0);
}

.demoTicks { position: absolute; left: 0; right: 0; bottom: 0; height: 18px; }

.demoTick {
  position: absolute;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
}

.demoSlider { display: block; width: calc(100% - 16px); margin: 10px 8px 6px; -webkit-appearance: none; appearance: none; height: 28px; background: transparent; }
.demoSlider::-webkit-slider-runnable-track { height: 2px; background: var(--ink); }
.demoSlider::-moz-range-track { height: 2px; background: var(--ink); }
.demoSlider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -10px; background: var(--terra); border: 2px solid var(--ink); border-radius: 50%; cursor: grab; }
.demoSlider::-moz-range-thumb { width: 20px; height: 20px; background: var(--terra); border: 2px solid var(--ink); border-radius: 50%; cursor: grab; }
.demoSlider:focus-visible { outline-offset: 6px; }

.demoReadout { display: grid; grid-template-columns: 1fr 1fr auto; gap: 18px; align-items: end; margin-top: 8px; }
.demoLabel { display: block; font-size: 12.5px; color: var(--ink-3); }

.demoGuess, .demoRating {
  display: block;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: lining-nums tabular-nums;
}

.demoRating { font-style: italic; font-weight: 600; font-size: 22px; color: var(--ink-2); }

.demoPtsBox { text-align: right; }
.demoPts { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--terra-ink); white-space: nowrap; }
.demoHint { margin: 10px 0 0; font-size: 13px; color: var(--ink-3); }

.scoreCells { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule-strong); }
.scoreCell { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; border-left: 1px solid var(--rule); }
.scoreCell:first-child { border-left: 0; padding-left: 0; }
.scoreCellErr { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.scoreCellPts { font-family: var(--font-display); font-size: 21px; font-weight: 700; font-variant-numeric: lining-nums tabular-nums; }

.tierList { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 24px; margin: 0; padding: 0; list-style: none; }
.tierRow { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.tierName { font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 16px; }
.tierRow.tier-perfect .tierName, .tierRow.tier-great .tierName { color: var(--moss-ink); }
.tierRow.tier-weak .tierName, .tierRow.tier-miss .tierName { color: var(--ink-3); }
.tierFrom { color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* near-empty circles: a staircase of how often the n-th one comes */
.scoreSparse { margin: 24px 0 22px; }
.sparseLead { margin: 0 0 14px; max-width: 80ch; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.sparseCaption { margin: 0 0 8px; font-size: 12.5px; color: var(--ink-3); }
.sparseLadder {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule-strong);
}
.sparseStep { display: flex; flex-direction: column; gap: 6px; padding: 10px 8px; border-left: 1px solid var(--rule); }
.sparseStep:first-child { border-left: 0; padding-left: 0; }
.sparseNth { font-size: 12.5px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.sparseBar { display: flex; align-items: flex-end; height: 40px; }
.sparseBar span {
  width: 100%;
  max-width: 34px;
  height: calc(var(--h) * 100%);
  min-height: 2px;
  background: var(--slate);
  transform-origin: bottom;
  animation: barUp 520ms var(--ease) both;
  animation-delay: calc(var(--i) * 60ms);
}
.sparseVal {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: lining-nums tabular-nums;
}
.sparseVal.isUsual { font-size: 15px; font-style: italic; font-weight: 600; color: var(--ink-2); }
.sparseNote { margin: 10px 0 0; max-width: 80ch; font-size: 13px; line-height: 1.5; color: var(--ink-3); }

.scoreFormula { margin: 0; padding-top: 14px; font-size: 13px; line-height: 1.55; color: var(--ink-3); border-top: 1px solid var(--rule-strong); }

@media (max-width: 640px) {
  .scoreCard { padding: 24px 18px 22px; }
  .scoreRules li { grid-template-columns: 74px 1fr; gap: 12px; }
  .scoreMark { font-size: 26px; }
  .demoTick.minor { display: none; }
  .demoReadout { grid-template-columns: 1fr 1fr; }
  .demoPtsBox { grid-column: 1 / -1; text-align: left; }
  .scoreCells { grid-template-columns: repeat(4, 1fr); }
  .scoreCell:nth-child(5) { border-left: 0; padding-left: 0; }
  .scoreCell:nth-child(n+5) { border-top: 1px solid var(--rule); }
  .tierList { grid-template-columns: 1fr 1fr; }
  .sparseLadder { grid-template-columns: repeat(3, 1fr); }
  .sparseStep:nth-child(4) { border-left: 0; padding-left: 0; }
  .sparseStep:nth-child(n+4) { border-top: 1px solid var(--rule); }
}

@media (pointer: coarse) {
  .overlayClose { width: 40px; height: 40px; top: 10px; right: 10px; }
  .archiveTab, .lbTab, .authTab { min-height: 40px; }
  .archiveRowDelete, .archiveRowResults { min-height: 36px; }
}

@media (max-width: 640px) {
  /* a phone shows the whole sheet height; nothing hides under the browser chrome */
  .archiveCard, .duelCard, .lbCard, .scoreCard { max-height: calc(100dvh - 24px); }
}

/* "By creating an account you accept the Terms and Privacy Policy" */
.authNote.authLegal { margin-top: 8px; padding-top: 0; border-top: 0; }
.authLegal a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.authLegal a:hover { color: var(--terra-ink); }
