:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7f8;
  color: #172026;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-rows: 50vh 50vh;
  height: 100vh;
  overflow: hidden;
}

.map-panel {
  position: relative;
  min-height: 0;
}

#map {
  position: absolute;
  inset: 0;
}

/* Critical Leaflet layout rules, kept locally so map tiles cannot fall into normal page flow. */
.leaflet-container {
  overflow: hidden;
  background: #d8e1e5;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  user-select: none;
}

.leaflet-tile {
  border: 0;
  visibility: hidden;
}

.leaflet-tile-loaded {
  visibility: inherit;
}

.leaflet-map-pane {
  z-index: 400;
}

.leaflet-tile-pane {
  z-index: 200;
}

.leaflet-overlay-pane {
  z-index: 400;
}

.leaflet-marker-pane {
  z-index: 600;
}

.leaflet-control-container {
  position: relative;
  z-index: 800;
}

.bottom-panel {
  display: grid;
  grid-template-columns: 50% 50%;
  height: 50vh;
  min-height: 0;
  overflow: hidden;
  border-top: 1px solid #cbd5d9;
}

.photo-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #11181c;
}

#photo {
  width: auto !important;
  height: auto !important;
  max-width: calc(100% - 32px);
  max-height: calc(100% - 32px);
  display: block;
}

.status-bar {
  display: grid;
  align-content: center;
  grid-template-columns: 1fr;
  gap: 1px;
  background: #cbd5d9;
}

.status-bar > div {
  min-width: 0;
  padding: 12px 18px;
  background: #ffffff;
}

.label {
  display: block;
  margin-bottom: 3px;
  color: #56646b;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-bar strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.round-overlay {
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: 500;
  display: flex;
  gap: 14px;
  align-items: center;
  max-width: min(92vw, 520px);
  padding: 12px 16px;
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(23, 32, 38, 0.16);
  transform: translateX(-50%);
}

.round-overlay strong,
.round-overlay span {
  overflow-wrap: anywhere;
}

.end-screen {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 28, 0.72);
}

.end-content {
  width: min(520px, 100%);
  padding: 28px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.end-content h1 {
  margin: 0 0 18px;
}

dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 22px;
}

dl div {
  padding: 14px;
  border: 1px solid #d9e1e5;
  border-radius: 8px;
}

dt {
  color: #56646b;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

dd {
  margin: 4px 0 0;
  font-size: 1.35rem;
  font-weight: 800;
}

#playAgain {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: #146c94;
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
}

#playAgain:hover {
  background: #0f5a7c;
}

.guess-marker,
.actual-marker {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 3px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
}

.guess-marker {
  background: #d93636;
}

.actual-marker {
  background: #1b9a57;
}

@media (max-width: 720px) {
  .app-shell {
    grid-template-rows: 50vh 50vh;
  }

  .bottom-panel {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    height: 50vh;
  }

  .status-bar > div {
    padding: 10px 14px;
  }

  dl {
    grid-template-columns: 1fr;
  }
}
