* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0e1a;
  --bg-2: #131830;
  --accent: #4ade80;
  --accent-2: #22d3ee;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.1);
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); }

.screen {
  display: none;
  position: absolute;
  inset: 0;
}
.screen.active { display: block; }

#setup, #final {
  display: none;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(800px 600px at 20% 0%, rgba(74, 222, 128, 0.10), transparent 60%),
    radial-gradient(700px 500px at 80% 100%, rgba(34, 211, 238, 0.10), transparent 60%),
    var(--bg);
}
#setup.active, #final.active { display: flex; }

#result {
  display: none;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}
#result.active { display: flex; align-items: center; justify-content: center; }

/* Cards */
.card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  max-width: 480px;
  width: calc(100% - 32px);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.logo {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 16px rgba(34, 211, 238, 0.4));
}

h1 {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.tagline {
  color: var(--muted);
  margin-bottom: 24px;
  font-size: 1rem;
}

/* Forms */
.key-form { text-align: left; margin: 24px 0 16px; }
.key-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
}
input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-size: 0.95rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}
input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-2);
}

button {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.1s, background 0.15s;
  font-family: inherit;
}
button.primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #062021;
  padding: 14px 24px;
  font-size: 1rem;
}
button.primary:hover { transform: translateY(-1px); }
button.primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
button.ghost {
  background: transparent;
  color: var(--muted);
  margin-top: 8px;
  width: 100%;
}
button.ghost:hover { color: var(--text); }

/* How-to disclosure */
.how-to {
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}
.how-to summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.875rem;
  user-select: none;
}
.how-to summary:hover { color: var(--text); }
.how-to ol {
  margin: 12px 0 0 20px;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
}

/* Game screen */
#game { background: #000; }
#street-view { width: 100%; height: 100%; }

#hud {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 5;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.hud-item { display: flex; flex-direction: column; align-items: flex-start; }
.hud-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.hud-value { font-weight: 700; font-size: 1rem; }
#reset-view {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  font-size: 1.1rem;
}
#reset-view:hover { background: rgba(255, 255, 255, 0.15); }

/* Mini map */
#map-container {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 5;
  width: 320px;
  height: 240px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease, height 0.2s ease;
  border: 1px solid var(--border);
}
#map-container:hover {
  width: min(520px, 50vw);
  height: min(360px, 50vh);
}
#map { flex: 1; background: #1a1f3a; }
#guess-btn {
  border-radius: 0;
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #062021;
  padding: 12px;
}
#guess-btn:disabled {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  cursor: not-allowed;
}

/* Result screen */
.result-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: min(900px, 92vw);
  max-height: 92vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
#result-map {
  width: 100%;
  height: 50vh;
  min-height: 320px;
  background: #1a1f3a;
}
.result-info { padding: 24px 32px 28px; }
.result-info h2 { margin-bottom: 16px; }
.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.stat-label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.stat-value { font-size: 1.25rem; font-weight: 700; }
.location-name {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
  text-align: center;
}

/* Final screen */
.final-score {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.final-rank {
  color: var(--muted);
  margin-bottom: 24px;
  font-size: 1.05rem;
}

/* Mobile */
@media (max-width: 640px) {
  #map-container {
    width: 180px;
    height: 140px;
  }
  #map-container:hover {
    width: 90vw;
    height: 60vh;
  }
  .result-stats { grid-template-columns: 1fr; }
  #result-map { min-height: 220px; height: 40vh; }
  .result-info { padding: 16px 20px 20px; }
  h1 { font-size: 2rem; }
  .card { padding: 28px 20px; }
}
