:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #08120f;
  color: #f4f1df;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% 10%, rgba(177, 119, 47, 0.18), transparent 34rem),
    linear-gradient(145deg, #101c18, #06100d 65%);
}

button, a { font: inherit; }

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 24px 0;
}

.site-brand {
  color: #f4f1df;
  font-weight: 800;
  text-decoration: none;
}

.site-nav nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.site-nav nav a {
  color: #aebdb5;
  text-decoration: none;
}

.site-nav nav a:hover,
.site-nav nav a[aria-current="page"] { color: #dfbd79; }

main {
  display: grid;
  grid-template-columns: minmax(0, 760px) minmax(260px, 340px);
  gap: 24px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px;
}

.game-panel, .scores-panel {
  border: 1px solid rgba(226, 204, 149, 0.18);
  border-radius: 18px;
  background: rgba(14, 26, 22, 0.88);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  padding: 20px;
}

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

.eyebrow {
  margin: 0 0 3px;
  color: #dfbd79;
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1, h2 { margin: 0; line-height: 1; }
h1 { font-size: clamp(1.9rem, 4vw, 3rem); }
h2 { font-size: 1.7rem; }

button {
  border: 1px solid #6f795f;
  border-radius: 999px;
  background: #26372e;
  color: #f4f1df;
  cursor: pointer;
  padding: 9px 14px;
}

button:hover { background: #34493c; }

.player {
  width: 100%;
  aspect-ratio: 10 / 7;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.game-panel:fullscreen,
.game-panel.mobile-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #000;
}

.game-panel:fullscreen .heading,
.game-panel.mobile-fullscreen .heading {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 2147483647;
  margin: 0;
}

.game-panel:fullscreen .heading > div,
.game-panel:fullscreen .help,
.game-panel.mobile-fullscreen .heading > div,
.game-panel.mobile-fullscreen .help {
  display: none;
}

.game-panel:fullscreen .player,
.game-panel.mobile-fullscreen .player {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  aspect-ratio: auto;
  border-radius: 0;
}

html.mobile-fullscreen-active,
body.mobile-fullscreen-active {
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

.loading {
  display: grid;
  height: 100%;
  place-items: center;
  color: #b8c7bf;
}

.loading.error { color: #ffb4a5; padding: 24px; text-align: center; }
.help, .status { color: #b8c7bf; line-height: 1.5; }
.help { margin: 14px 2px 0; }
.status { min-height: 24px; margin: 0 0 12px; }
.score-filters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0 0 14px;
}

.score-filters button {
  padding: 8px 6px;
  border-color: rgba(226, 204, 149, 0.25);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
}

.score-filters button[aria-pressed="true"] {
  border-color: #dfbd79;
  background: #dfbd79;
  color: #17231d;
  font-weight: 750;
}

.score-list { list-style: none; margin: 0; padding: 0; }

.score-list li {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 10px;
  align-items: center;
  border-top: 1px solid rgba(226, 204, 149, 0.12);
  padding: 11px 4px;
}

.rank { color: #7f968a; font-variant-numeric: tabular-nums; }
.score-player { min-width: 0; }
.score-player strong { display: block; overflow-wrap: anywhere; }
.score-date { display: block; margin-top: 3px; color: #a4b5a9; font-size: 0.75rem; font-weight: 400; }
.score { color: #dfbd79; font-weight: 750; font-variant-numeric: tabular-nums; }

@media (max-width: 850px) {
  main { grid-template-columns: 1fr; padding: 16px; }
  .site-nav { align-items: flex-start; flex-direction: column; gap: 12px; padding: 18px 16px 0; }
}
