:root {
  color-scheme: dark;
  --background: #07090d;
  --background-soft: #0b0f14;
  --surface: #111720;
  --surface-soft: #17202b;
  --surface-high: #202b38;
  --surface-warm: #241d12;
  --surface-rose: #24151c;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f7fb;
  --muted: #a4afbe;
  --subtle: #6f7d8e;
  --green: #27e7a4;
  --green-dark: #0e7d5b;
  --cyan: #27d8ef;
  --cyan-dark: #14677a;
  --amber: #f3b447;
  --amber-dark: #7b5415;
  --rose: #fb7185;
  --ink: #05070a;
  --on-accent: #06130e;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 16px 34px rgba(0, 0, 0, 0.35);
  --shadow-raised: 0 20px 60px rgba(0, 0, 0, 0.48);
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  scroll-behavior: smooth;
}

body {
  background: var(--background);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.site-header {
  align-items: center;
  background: rgba(7, 9, 13, 0.84);
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 18px;
  grid-template-columns: auto 1fr auto;
  left: 0;
  padding: 12px 24px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
}

.brand {
  align-items: center;
  display: flex;
  font-size: 18px;
  font-weight: 900;
  gap: 10px;
  min-width: 0;
  white-space: nowrap;
}

.brand img {
  height: 40px;
  width: 40px;
}

.brand span span {
  color: var(--green);
}

.nav {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: center;
  min-width: 0;
}

.nav a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
}

.nav a:hover,
.nav a:focus {
  color: var(--text);
}

.store-nav {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.store-button,
.button {
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: inline-flex;
  font-size: 14px;
  font-weight: 900;
  justify-content: center;
  min-height: 46px;
  padding: 0 16px;
  text-align: center;
  white-space: nowrap;
}

.store-button-ios {
  background: var(--text);
  border-color: var(--text);
  color: var(--ink);
}

.store-button-play {
  background: var(--green);
  border-color: var(--green);
  color: var(--on-accent);
}

.button.primary {
  background: var(--green);
  border-color: var(--green);
  color: var(--on-accent);
}

.button.secondary {
  background: var(--surface-soft);
  border-color: var(--border-strong);
  color: var(--text);
}

.button.compact {
  min-height: 44px;
  padding: 0 14px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.section-inner {
  margin: 0 auto;
  max-width: var(--max);
  width: 100%;
}

.home-hero {
  background:
    linear-gradient(180deg, #0b0f14 0%, #090b10 58%, #0e1116 100%);
  border-bottom: 1px solid var(--border);
  min-height: 82vh;
  overflow: hidden;
  padding: 112px 24px 44px;
  position: relative;
}

.home-hero::before {
  background-image: url("/assets/onetapworld-logo.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  content: "";
  height: 520px;
  opacity: 0.07;
  position: absolute;
  right: -140px;
  top: 110px;
  width: 760px;
}

.hero-grid {
  align-items: center;
  display: grid;
  gap: 48px;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 540px);
  position: relative;
  z-index: 1;
}

.hero-copy {
  min-width: 0;
}

.kicker {
  color: var(--cyan);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 86px;
  line-height: 0.95;
  margin: 12px 0 20px;
  max-width: 760px;
}

h2 {
  font-size: 46px;
  line-height: 1.03;
  margin-top: 10px;
  max-width: 780px;
}

h3 {
  font-size: 24px;
  line-height: 1.12;
}

.lead {
  color: var(--muted);
  font-size: 21px;
  line-height: 1.45;
  max-width: 660px;
}

.daily-card {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  display: grid;
  gap: 18px;
  grid-template-columns: 116px minmax(0, 1fr);
  margin-top: 34px;
  max-width: 720px;
  padding: 20px;
}

.tap-orb {
  align-items: center;
  aspect-ratio: 1;
  background:
    linear-gradient(180deg, rgba(39, 216, 239, 0.14), rgba(39, 231, 164, 0.08)),
    var(--surface-soft);
  border: 1px solid rgba(39, 216, 239, 0.36);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  position: relative;
}

.tap-orb::before,
.tap-orb::after,
.tap-orb span {
  border-radius: 50%;
  content: "";
  position: absolute;
}

.tap-orb::before {
  border: 2px solid rgba(39, 216, 239, 0.5);
  height: 72px;
  width: 72px;
}

.tap-orb::after {
  border: 2px solid rgba(39, 231, 164, 0.55);
  height: 48px;
  width: 48px;
}

.tap-orb span {
  background: var(--amber);
  box-shadow: 0 0 26px rgba(243, 180, 71, 0.45);
  height: 18px;
  width: 18px;
}

.daily-content {
  min-width: 0;
}

.daily-overline {
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.daily-card h2 {
  font-size: 28px;
  line-height: 1.1;
  margin: 6px 0 8px;
}

.daily-card p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.daily-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.daily-meta span {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  padding: 7px 9px;
}

.daily-metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
  max-width: 720px;
}

.daily-metrics div,
.country-stats div {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 0;
  padding: 14px;
}

.daily-metrics span,
.country-stats span {
  color: var(--subtle);
  display: block;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.daily-metrics strong,
.country-stats strong {
  color: var(--text);
  display: block;
  font-size: 22px;
  line-height: 1.15;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.hero-world-board {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-raised);
  min-width: 0;
  padding: 18px;
}

.hero-board-heading {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.hero-board-heading h2 {
  font-size: 30px;
  line-height: 1.08;
  margin-top: 6px;
}

.hero-board-heading span {
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.hero-leader-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hero-leader-card {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 34px 34px minmax(0, 1fr);
  min-height: 76px;
  padding: 10px;
}

.hero-leader-card:first-child {
  background: var(--surface-warm);
  border-color: rgba(243, 180, 71, 0.38);
}

.hero-leader-card .leader-flag {
  align-items: center;
  display: flex;
  justify-content: center;
  text-align: center;
}

.hero-leader-card strong,
.hero-leader-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-leader-card strong {
  display: block;
  font-size: 14px;
}

.hero-leader-card span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

.challenge-invite {
  padding: 80px 0 70px;
  position: relative;
  z-index: 1;
}

.challenge-invite h1 {
  max-width: 820px;
}

.challenge-hint {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  margin-top: 16px;
  max-width: 620px;
}

.challenge-route .home-hero {
  min-height: 74vh;
}

.section {
  border-bottom: 1px solid var(--border);
  padding: 68px 24px;
}

.section-heading {
  align-items: end;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 24px;
}

.race-section {
  background: var(--background-soft);
}

.race-layout {
  align-items: start;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.race-map-area {
  min-width: 0;
}

.leaderboard-controls {
  display: grid;
  gap: 8px;
  min-width: 320px;
}

.control-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.search-row {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.search-row input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  min-height: 44px;
  min-width: 0;
  outline: none;
  padding: 0 14px;
}

.search-row input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(39, 216, 239, 0.16);
}

.map-panel {
  background:
    linear-gradient(180deg, rgba(39, 216, 239, 0.08), transparent 62%),
    #0a151a;
  border: 1px solid rgba(39, 216, 239, 0.18);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  min-height: 540px;
  overflow: hidden;
  position: relative;
}

#world-map {
  cursor: grab;
  display: block;
  height: 100%;
  min-height: 540px;
  shape-rendering: geometricPrecision;
  touch-action: none;
  width: 100%;
}

#world-map.is-dragging {
  cursor: grabbing;
}

.map-sphere {
  fill: #081217;
  vector-effect: non-scaling-stroke;
}

.map-graticule {
  fill: none;
  stroke: rgba(164, 175, 190, 0.17);
  stroke-width: 0.7;
  vector-effect: non-scaling-stroke;
}

.country {
  cursor: pointer;
  fill: var(--country-fill, var(--surface-high));
  outline: none;
  stroke: rgba(245, 247, 251, 0.24);
  stroke-width: 0.7;
  transition:
    fill 160ms ease,
    opacity 160ms ease,
    stroke 160ms ease;
  vector-effect: non-scaling-stroke;
}

.country:hover,
.country:focus {
  fill: var(--cyan);
  stroke: var(--text);
}

.country.has-race-data {
  stroke: rgba(245, 247, 251, 0.34);
}

.country.is-winner {
  stroke: var(--amber);
  stroke-width: 1.5;
}

.country.is-selected {
  fill: var(--green);
  stroke: var(--text);
  stroke-width: 1.8;
}

.country.is-muted {
  opacity: 0.28;
}

.country.is-unmapped {
  cursor: default;
  fill: #10161d;
  opacity: 0.55;
}

.map-status {
  background: rgba(7, 9, 13, 0.84);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  bottom: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  left: 16px;
  padding: 10px 12px;
  position: absolute;
}

.map-zoom-controls {
  display: grid;
  gap: 8px;
  position: absolute;
  right: 16px;
  top: 16px;
  z-index: 2;
}

.map-zoom-button {
  align-items: center;
  background: rgba(7, 9, 13, 0.88);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 15px;
  font-weight: 900;
  height: 40px;
  justify-content: center;
  min-width: 40px;
  padding: 0 10px;
}

.map-zoom-button:hover,
.map-zoom-button:focus {
  border-color: var(--cyan);
  outline: none;
}

.country-detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  margin-top: 14px;
  min-width: 0;
  padding: 18px;
}

.nation-panel,
.board-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  min-width: 0;
  padding: 18px;
}

.country-summary {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: 58px minmax(0, 1fr);
}

.country-summary p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin-top: 4px;
}

.country-flag {
  align-items: center;
  aspect-ratio: 1;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--green);
  display: flex;
  font-size: 18px;
  font-weight: 900;
  justify-content: center;
  overflow: hidden;
}

.flag-img {
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 3px;
  display: inline-block;
  flex: 0 0 auto;
  height: 22px;
  object-fit: cover;
  width: 30px;
}

.flag-img-large {
  border-radius: 4px;
  height: 36px;
  width: 48px;
}

.flag-img-inline {
  height: 16px;
  width: 22px;
}

.flag-fallback {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.country-inline,
.row-country-line {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  vertical-align: middle;
}

.country-inline span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-stats {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px 0;
}

.panel-headline,
.board-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-headline span,
.board-heading span {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.panel-headline strong {
  color: var(--amber);
  font-size: 13px;
  font-weight: 900;
}

.nation-rows,
.leaderboard-rows {
  display: grid;
  gap: 8px;
}

.nation-rows {
  max-height: 640px;
  overflow-y: auto;
  padding-right: 4px;
  scroll-behavior: smooth;
  scrollbar-color: var(--surface-high) transparent;
}

.nation-row {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  display: grid;
  font: inherit;
  gap: 10px;
  grid-template-columns: 40px 34px minmax(0, 1fr) auto;
  min-height: 58px;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.nation-row:first-child {
  background: var(--surface-warm);
  border-color: rgba(243, 180, 71, 0.38);
}

.nation-row.is-selected {
  border-color: var(--cyan);
}

.rank,
.row-rank {
  color: var(--cyan);
  font-size: 15px;
  font-weight: 900;
}

.flag {
  align-items: center;
  display: flex;
  justify-content: center;
  text-align: center;
}

#country-board-code {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  font-size: 18px;
  gap: 6px;
  text-transform: none;
}

.nation-info,
.row-player {
  min-width: 0;
}

.nation-info strong,
.row-player strong {
  display: block;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nation-info span,
.row-player span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-player .row-country-line,
.row-player .country-inline,
.row-player .country-inline span:last-child {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  margin-top: 2px;
  min-width: 0;
  max-width: 100%;
}

.row-player .country-inline span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.nation-score,
.row-score {
  text-align: right;
}

.nation-score strong,
.row-score strong {
  display: block;
  font-size: 14px;
}

.nation-score span,
.row-score span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 2px;
}

.leaderboard-section {
  background: #080a0f;
}

.leaderboard-shell {
  display: grid;
  gap: 24px;
}

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

.leaderboard-table {
  display: grid;
  gap: 8px;
}

.table-head {
  color: var(--subtle);
  display: grid;
  font-size: 11px;
  font-weight: 900;
  gap: 10px;
  grid-template-columns: 48px minmax(0, 1fr) 80px;
  padding: 0 8px;
  text-transform: uppercase;
}

.table-head span:last-child {
  text-align: right;
}

.leaderboard-row {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 48px minmax(0, 1fr) 80px;
  min-height: 58px;
  padding: 10px 8px;
}

.leaderboard-row:first-child {
  background: var(--surface-warm);
  border-color: rgba(243, 180, 71, 0.35);
}

.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  padding: 18px;
  text-align: center;
}

.store-section {
  background:
    linear-gradient(180deg, #0c1015 0%, #121017 100%);
}

.store-layout {
  display: block;
  max-width: 820px;
}

.legal-page {
  margin: 0 auto;
  max-width: 860px;
  padding: 112px 24px 72px;
}

.legal-page h1 {
  font-size: 56px;
  line-height: 1;
}

.legal-page h2 {
  font-size: 24px;
  margin-top: 38px;
}

.legal-page p,
.legal-page li {
  color: var(--muted);
  line-height: 1.65;
}

.legal-page ul {
  padding-left: 22px;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--subtle);
  padding: 30px 24px;
}

.footer-inner {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: var(--max);
}

.footer-links {
  display: flex;
  gap: 18px;
}

@media (max-width: 1040px) {
  .site-header {
    grid-template-columns: auto 1fr;
  }

  .nav {
    display: none;
  }

  .store-nav {
    grid-column: 2;
  }

  .hero-grid,
  .race-layout,
  .store-layout {
    grid-template-columns: 1fr;
  }

  .hero-world-board {
    max-width: 720px;
  }
}

@media (max-width: 760px) {
  .site-header {
    gap: 10px;
    padding: 10px 14px;
  }

  .brand img {
    height: 36px;
    width: 36px;
  }

  .brand > span {
    display: none;
  }

  .store-nav {
    gap: 8px;
  }

  .store-button {
    font-size: 12px;
    min-height: 42px;
    padding: 0 10px;
  }

  .home-hero {
    min-height: 0;
    padding: 96px 16px 34px;
  }

  h1 {
    font-size: 54px;
  }

  h2 {
    font-size: 32px;
  }

  .lead {
    font-size: 18px;
  }

  .daily-card {
    grid-template-columns: 1fr;
  }

  .tap-orb {
    width: 116px;
  }

  .daily-metrics,
  .section-heading,
  .board-grid,
  .country-stats {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: stretch;
  }

  .leaderboard-controls {
    min-width: 0;
  }

  .hero-leader-grid {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 48px 16px;
  }

  .map-panel,
  #world-map {
    min-height: 410px;
  }

  .nation-rows {
    max-height: 430px;
  }

  .nation-panel,
  .board-panel {
    padding: 14px;
  }

  .nation-row {
    grid-template-columns: 36px 30px minmax(0, 1fr);
  }

  .nation-score {
    grid-column: 3;
    text-align: left;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .store-button {
    min-width: 0;
    padding: 0 8px;
  }

  .actions .button {
    width: 100%;
  }

  .table-head,
  .leaderboard-row {
    grid-template-columns: 42px minmax(0, 1fr) 68px;
  }
}
