:root {
  --bg: #f5f7f2;
  --panel: #ffffff;
  --ink: #17221b;
  --muted: #607067;
  --line: #d9e3da;
  --soft: #eaf2ea;
  --accent: #0d8f5f;
  --accent-dark: #087047;
  --accent-2: #118a9a;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(23, 34, 27, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

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

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid rgba(217, 227, 218, 0.86);
  background: rgba(245, 247, 242, 0.9);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.nav a:hover,
.nav a.active {
  background: var(--soft);
  color: var(--ink);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 28px;
  align-items: stretch;
}

.hero-copy {
  display: flex;
  min-height: 520px;
  flex-direction: column;
  justify-content: center;
  padding: 54px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(13, 143, 95, 0.92), rgba(17, 138, 154, 0.82)),
    url("https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=1400&q=82") center / cover;
  color: #fff;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 12px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hero h1,
.section-head h1,
.section-head h2 {
  margin: 0;
  line-height: 1.04;
}

.hero h1 {
  max-width: 660px;
  font-size: clamp(42px, 7vw, 78px);
  letter-spacing: 0;
}

.hero p {
  max-width: 640px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 18px;
}

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

.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 760;
  text-align: center;
}

.btn:hover {
  background: var(--accent-dark);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.btn.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.btn.secondary:hover {
  background: var(--soft);
}

.btn.ghost {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.2);
}

.play-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.panel,
.card,
.metric,
.result-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel {
  padding: 24px;
  box-shadow: 0 12px 30px rgba(23, 34, 27, 0.08);
}

.panel h2,
.panel h3,
.card h3 {
  margin: 0 0 8px;
}

.panel p,
.card p {
  margin: 0;
  color: var(--muted);
}

.mode-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.mode-tile,
.metric {
  padding: 16px;
}

.mode-tile {
  display: flex;
  flex-direction: column;
  min-height: 134px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.mode-tile strong,
.metric strong {
  display: block;
  font-size: 24px;
}

.mode-tile span,
.metric span {
  color: var(--muted);
  font-size: 13px;
}

.mode-tile .btn {
  margin-top: auto;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.section-head h1,
.section-head h2 {
  font-size: clamp(30px, 5vw, 52px);
}

.section-head p {
  max-width: 620px;
  margin: 10px 0 0;
  color: var(--muted);
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.map-card {
  overflow: hidden;
}

.map-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.card-body {
  padding: 18px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  background: var(--soft);
  padding: 4px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.game-shell {
  width: min(1440px, calc(100% - 24px));
  margin: 0 auto;
  padding: 16px 0 24px;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 14px;
  min-height: calc(100vh - 108px);
}

.pano-wrap {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dfe8e1;
}

.pano-viewer {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 126px);
  background: #141915;
}

#pano-fallback {
  display: block;
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 126px);
  object-fit: cover;
}

.pano-viewer .pnlm-container {
  background: #141915;
}

.pano-message {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 126px);
  place-items: center;
  padding: 24px;
  color: #fff;
  text-align: center;
}

.hud {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  pointer-events: none;
}

.hud-item {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  padding: 8px 12px;
  box-shadow: 0 8px 24px rgba(23, 34, 27, 0.16);
  font-size: 13px;
  font-weight: 760;
}

.photo-credit {
  position: absolute;
  right: 12px;
  bottom: 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.52);
  color: #fff;
  padding: 5px 8px;
  font-size: 12px;
}

.guess-panel {
  display: flex;
  min-height: 560px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.guess-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.guess-head h2 {
  margin: 0;
  font-size: 20px;
}

.guess-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

#guess-map {
  flex: 1 1 auto;
  min-height: 330px;
}

.guess-actions {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.result-box {
  padding: 14px;
}

.result-box h3 {
  margin: 0 0 8px;
}

.result-box p {
  margin: 4px 0;
  color: var(--muted);
}

.result-score {
  color: var(--accent-dark);
  font-size: 28px;
  font-weight: 860;
}

.table-panel {
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.input,
select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 12px;
  color: var(--ink);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .wide {
  grid-column: span 2;
}

.room-code {
  display: inline-flex;
  margin: 16px 0;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  background: #f0faf5;
  padding: 10px 14px;
  color: var(--accent-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.room-panel {
  margin-top: 18px;
}

.empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.alert {
  margin-top: 14px;
  border: 1px solid #ffd8c2;
  border-radius: 8px;
  background: #fff6ed;
  padding: 12px;
  color: #8a3b12;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .hero,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    min-height: 430px;
    padding: 34px;
  }

  .map-grid,
  .mode-grid {
    grid-template-columns: 1fr 1fr;
  }

  .guess-panel {
    min-height: 520px;
  }

  .pano-wrap img {
    min-height: 460px;
  }

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

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .nav {
    justify-content: flex-start;
  }

  .shell,
  .game-shell {
    width: min(100% - 20px, 1180px);
  }

  .hero-copy {
    min-height: 380px;
    padding: 26px;
  }

  .hero h1 {
    font-size: 40px;
  }

  .map-grid,
  .mode-grid,
  .stats-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .wide {
    grid-column: auto;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  th,
  td {
    padding: 10px 8px;
    font-size: 13px;
  }
}
