:root {
  color-scheme: dark;
  --ink: #f8f3e8;
  --muted: #b8ad9e;
  --dim: #817a70;
  --base: #080907;
  --surface: #151713;
  --surface-2: #20231d;
  --surface-3: #292317;
  --line: rgba(255, 255, 255, 0.15);
  --line-strong: rgba(255, 255, 255, 0.26);
  --cream: #f1dfb7;
  --gold: #d7a943;
  --green: #2cc06f;
  --green-deep: #0e6845;
  --rust: #c94f38;
  --blue: #87b6d7;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(130deg, rgba(14, 104, 69, 0.56), transparent 34rem),
    linear-gradient(24deg, rgba(65, 36, 12, 0.74), transparent 32rem),
    linear-gradient(180deg, rgba(241, 223, 183, 0.05), transparent 14rem),
    var(--base);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  align-items: center;
  border: 0;
  border-radius: 7px;
  background: var(--cream);
  color: #17140e;
  cursor: pointer;
  display: inline-flex;
  font-weight: 850;
  justify-content: center;
  letter-spacing: 0;
  min-height: 42px;
  padding: 0 16px;
  transition:
    border-color 160ms ease,
    filter 160ms ease,
    transform 160ms ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button:not(:disabled):hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

a {
  color: inherit;
}

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

.topbar {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  min-height: 88px;
  padding: 18px clamp(16px, 4vw, 38px);
}

.brand-block {
  min-width: 0;
}

.eyebrow {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 5px;
  text-transform: uppercase;
}

h1 {
  align-items: baseline;
  color: var(--ink);
  display: flex;
  font-size: 4.1rem;
  gap: 0.18em;
  line-height: 0.88;
  margin: 0;
  white-space: nowrap;
}

h1 span {
  font-size: 0.68em;
  font-weight: 850;
}

h1 strong {
  color: var(--cream);
  font-size: 1.1em;
  font-weight: 950;
  text-shadow: 0 0 22px rgba(215, 169, 67, 0.24);
}

.view-tabs {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px;
}

.view-tabs button {
  background: transparent;
  color: var(--muted);
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.view-tabs button[aria-pressed="true"] {
  background: var(--cream);
  color: #17140e;
}

.scoreboard {
  align-items: flex-end;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 128px;
  padding: 12px 14px;
}

.scoreboard span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.scoreboard strong {
  color: var(--cream);
  font-size: 1.6rem;
  line-height: 1;
}

main {
  padding: 0 clamp(16px, 4vw, 38px) 26px;
}

.app-shell {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(400px, 33vw);
  min-height: calc(100vh - 114px);
}

.photo-stage {
  background: #050604;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-height: 520px;
  overflow: hidden;
  position: relative;
}

.round-image {
  background: #050604;
  display: block;
  height: 100%;
  object-fit: contain;
  object-position: center;
  width: 100%;
}

.empty-state,
.loading-state {
  align-items: center;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  min-height: 520px;
  padding: 34px;
  text-align: center;
}

.empty-state {
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(241, 223, 183, 0.12) 50%, transparent calc(50% + 1px)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    #070806;
  position: relative;
}

.empty-state::before {
  color: rgba(241, 223, 183, 0.08);
  content: "G";
  font-size: 15rem;
  font-weight: 950;
  left: 50%;
  line-height: 0.8;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -52%);
}

.empty-state h2,
.empty-state p,
.loading-state h2,
.loading-state p,
.loading-rail,
.pint-loader {
  position: relative;
  z-index: 1;
}

.empty-state h2,
.loading-state h2 {
  color: var(--cream);
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 12px;
}

.empty-state p,
.loading-state p {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0;
  max-width: 34rem;
}

.loading-state {
  background:
    linear-gradient(180deg, rgba(44, 192, 111, 0.1), transparent 52%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.035) 0,
      rgba(255, 255, 255, 0.035) 1px,
      transparent 1px,
      transparent 44px
    ),
    #070806;
}

.pint-loader {
  border: 3px solid rgba(241, 223, 183, 0.64);
  border-radius: 12px 12px 20px 20px;
  height: 136px;
  margin-bottom: 24px;
  overflow: hidden;
  position: relative;
  width: 86px;
}

.pint-loader::after {
  border: 3px solid rgba(241, 223, 183, 0.4);
  border-left: 0;
  border-radius: 0 18px 18px 0;
  content: "";
  height: 58px;
  position: absolute;
  right: -24px;
  top: 32px;
  width: 22px;
}

.pint-fill {
  animation: pintRise 2.8s ease-in-out infinite;
  background:
    linear-gradient(180deg, rgba(215, 169, 67, 0.42), transparent 22%),
    linear-gradient(180deg, #241308, #080504);
  bottom: 0;
  height: 72%;
  left: 0;
  position: absolute;
  right: 0;
}

.pint-head {
  animation: pintHead 2.8s ease-in-out infinite;
  background: #f4ead5;
  border-bottom: 1px solid rgba(38, 25, 12, 0.24);
  height: 18px;
  left: 0;
  position: absolute;
  right: 0;
  top: 26%;
}

.pint-head::after {
  color: rgba(23, 19, 14, 0.42);
  content: "G";
  font-size: 1.2rem;
  font-weight: 950;
  left: 50%;
  line-height: 1;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -48%);
}

.loading-rail {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  height: 6px;
  margin-top: 24px;
  max-width: 360px;
  overflow: hidden;
  width: min(62vw, 360px);
}

.loading-rail span {
  animation: loadingSweep 1.8s ease-in-out infinite;
  background: linear-gradient(90deg, var(--green), var(--gold), var(--blue));
  border-radius: inherit;
  display: block;
  height: 100%;
  width: 42%;
}

.photo-attribution {
  align-items: center;
  background: rgba(7, 8, 6, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 7px;
  bottom: 14px;
  color: white;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  left: 14px;
  max-width: calc(100% - 28px);
  padding: 8px 10px;
  position: absolute;
}

.photo-attribution,
.reveal-attribution {
  font-size: 0.78rem;
}

.photo-attribution a,
.reveal-attribution a {
  color: white;
  font-weight: 850;
  text-decoration: none;
}

.photo-attribution a:hover,
.reveal-attribution a:hover {
  text-decoration: underline;
}

.game-panel {
  display: grid;
  gap: 12px;
  grid-template-rows: auto minmax(390px, 1fr) auto auto;
  min-height: 0;
}

.controls,
.actions,
.reveal {
  background: rgba(21, 23, 19, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.profile-row {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.78fr) auto;
  margin-bottom: 9px;
}

.profile-row button {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
}

.profile-stats {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.38;
  margin: 0 0 12px;
}

input {
  background: #10120f;
  border: 1px solid rgba(255, 255, 255, 0.19);
  border-radius: 7px;
  color: var(--ink);
  min-height: 42px;
  min-width: 0;
  outline: 0;
  padding: 0 12px;
}

input::placeholder {
  color: rgba(248, 243, 232, 0.42);
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(44, 192, 111, 0.18);
}

.start-global-button {
  background: var(--green);
  min-height: 54px;
  width: 100%;
}

.status-line {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.38;
  margin: 10px 0 0;
  min-height: 1.2em;
}

.map-area {
  background: #e8eee8;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(6, 20, 14, 0.16);
  min-height: 390px;
  overflow: hidden;
  position: relative;
}

.map,
.fallback-map {
  height: 100%;
  min-height: 390px;
  width: 100%;
}

.fallback-map {
  background:
    linear-gradient(90deg, rgba(46, 120, 153, 0.22), transparent),
    #dbe8df;
  cursor: crosshair;
  position: relative;
}

.fallback-grid {
  height: 100%;
  inset: 0;
  position: absolute;
  width: 100%;
}

.fallback-grid path {
  fill: none;
  stroke: rgba(13, 35, 28, 0.46);
  stroke-width: 0.38;
}

.fallback-watermark {
  bottom: 10px;
  color: rgba(12, 34, 27, 0.64);
  font-size: 0.76rem;
  font-weight: 750;
  left: 12px;
  position: absolute;
}

.fallback-pin {
  border: 2px solid white;
  border-radius: 999px;
  height: 15px;
  position: absolute;
  transform: translate(-50%, -50%);
  width: 15px;
  z-index: 3;
}

.fallback-pin.guess {
  background: var(--gold);
}

.fallback-pin.answer {
  background: var(--green);
}

.fallback-line {
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.fallback-line line {
  stroke: var(--rust);
  stroke-dasharray: 5 5;
  stroke-width: 2;
}

.actions {
  display: grid;
  gap: 8px;
}

.actions button {
  min-height: 48px;
}

#nextButton {
  background: var(--green);
}

#shareButton {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
}

.reveal {
  border-color: rgba(44, 192, 111, 0.46);
}

.result-line {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.result-line span {
  color: var(--muted);
  font-weight: 850;
}

.result-line strong {
  color: var(--cream);
  font-size: 1.85rem;
  line-height: 1;
  white-space: nowrap;
}

.reveal h2 {
  font-size: 1.35rem;
  line-height: 1.15;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.reveal p {
  color: var(--muted);
  line-height: 1.38;
  margin-bottom: 12px;
}

.maps-link {
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  display: inline-flex;
  font-weight: 850;
  margin-bottom: 12px;
  padding: 10px 12px;
  text-decoration: none;
}

.maps-link:hover {
  border-color: var(--green);
}

.review-meta {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  margin: 2px 0 12px;
  padding-top: 12px;
}

.review-meta p {
  color: var(--cream);
  font-size: 0.78rem;
  font-weight: 900;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.review-meta blockquote {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  margin: 0 0 8px;
}

.review-meta a {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: none;
}

.review-meta a:hover {
  color: var(--green);
  text-decoration: underline;
}

.reveal-attribution {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.reveal-attribution a {
  color: var(--ink);
}

.feedback-button {
  background: rgba(201, 79, 56, 0.14);
  border: 1px solid rgba(201, 79, 56, 0.64);
  color: var(--ink);
  width: 100%;
}

.feedback-button:not(:disabled):hover {
  background: rgba(201, 79, 56, 0.22);
}

.leaderboard-page {
  min-height: calc(100vh - 114px);
}

.leaderboard-hero {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin: 10px 0 18px;
}

.leaderboard-hero h2 {
  color: var(--ink);
  font-size: 4rem;
  line-height: 0.95;
  margin: 0;
}

.leaderboard-hero button {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
}

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

.board-panel {
  background: rgba(21, 23, 19, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

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

.board-heading h3 {
  font-size: 1rem;
  margin: 0;
}

.board-heading span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
  white-space: nowrap;
}

.rank-list {
  counter-reset: rank;
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.rank-list li {
  align-items: center;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  color: var(--muted);
  counter-increment: rank;
  display: grid;
  gap: 8px;
  grid-template-columns: 2.2rem minmax(0, 1fr) auto auto auto;
  min-height: 50px;
  padding: 8px 10px;
}

.rank-list li::before {
  color: var(--gold);
  content: counter(rank);
  font-weight: 900;
}

.rank-list li span {
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-list li span small {
  color: var(--muted);
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-list li strong {
  color: var(--cream);
  font-size: 1.05rem;
  white-space: nowrap;
}

.rank-list li em,
.rank-list li small {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  white-space: nowrap;
}

@keyframes loadingSweep {
  0% {
    transform: translateX(-105%);
  }
  55%,
  100% {
    transform: translateX(245%);
  }
}

@keyframes pintRise {
  0%,
  100% {
    height: 62%;
  }
  45% {
    height: 76%;
  }
}

@keyframes pintHead {
  0%,
  100% {
    top: 36%;
  }
  45% {
    top: 22%;
  }
}

@media (max-width: 1060px) {
  h1 {
    font-size: 3.3rem;
  }

  .empty-state h2,
  .loading-state h2 {
    font-size: 2.45rem;
  }

  .leaderboard-hero h2 {
    font-size: 3.25rem;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .view-tabs {
    order: 3;
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .photo-stage,
  .empty-state,
  .loading-state {
    min-height: 420px;
  }

  .game-panel {
    grid-template-rows: auto 390px auto auto;
  }

  .leaderboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: 2.7rem;
  }

  h1 span {
    font-size: 0.64em;
  }

  .empty-state h2,
  .loading-state h2 {
    font-size: 2rem;
  }

  .leaderboard-hero h2 {
    font-size: 2.5rem;
  }

  .topbar {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .scoreboard {
    align-items: flex-start;
    width: 100%;
  }

  .profile-row {
    grid-template-columns: 1fr;
  }

  .photo-stage,
  .empty-state,
  .loading-state {
    min-height: 320px;
  }

  .game-panel {
    grid-template-rows: auto 340px auto auto;
  }

  .map,
  .fallback-map,
  .map-area {
    min-height: 340px;
  }

  .leaderboard-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .rank-list li {
    grid-template-columns: 2rem minmax(0, 1fr) auto;
  }

  .rank-list li em,
  .rank-list li > small {
    display: none;
  }
}
