:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2330;
  --ink: #e6edf3;
  --muted: #8b98a5;
  --accent: #3fb950;
  --accent-2: #58a6ff;
  --danger: #f85149;
  --ocean: #0b1f33;
  --land: #223044;
  --land-stroke: #3a4a60;
  --border: #2a3441;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #11161d, #0d1117);
}
.brand { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.brand-mark { color: var(--accent); margin-right: 4px; }
.brand .accent { color: var(--accent); }
.hud { display: flex; gap: 22px; }
.hud-item { display: flex; flex-direction: column; align-items: flex-end; }
.hud-label { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: 1px; }
.hud-item span:last-child { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- Screens ---- */
.screen { display: none; flex: 1; }
.screen.active { display: flex; }
#start-screen, #end-screen { align-items: center; justify-content: center; padding: 30px; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 34px; max-width: 460px; width: 100%; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.card h1 { margin: 0 0 10px; font-size: 28px; }
.subtitle { color: var(--muted); line-height: 1.55; margin: 0 0 22px; }

/* ---- Form ---- */
.field { display: block; text-align: left; margin: 0 0 16px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field small { color: #5f6b78; }
input[type="text"], input[type="number"], select {
  width: 100%; padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--ink);
  font-size: 15px;
}
input[type="range"] { width: 100%; margin-top: 8px; accent-color: var(--accent-2); }
.checkbox { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; margin: 4px 0 18px; cursor: pointer; }
.checkbox input { width: auto; }

/* ---- Buttons ---- */
.btn {
  width: 100%; padding: 12px 16px; border-radius: 10px; border: none;
  font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 8px;
  transition: transform .05s ease, filter .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #06210d; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn.daily { background: linear-gradient(135deg, #58a6ff, #7c5cff); color: #fff; }
.btn.daily:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.daily-note { color: #5f6b78; font-size: 12px; margin: 14px 0 0; }

/* ---- Daily badge + share ---- */
.daily-badge {
  display: inline-block; background: rgba(88,166,255,.15); color: var(--accent-2);
  border: 1px solid rgba(88,166,255,.35); padding: 5px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; margin-bottom: 14px;
}
.share-box { margin: 8px 0 22px; }
.share-grid {
  font-size: 30px; letter-spacing: 4px; margin: 6px 0 14px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px;
}
.share-actions { display: flex; gap: 8px; }
.btn.share-btn {
  flex: 1; margin-top: 0; font-size: 13px; padding: 10px 6px;
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--border);
}
.btn.share-btn:hover { border-color: var(--accent-2); }
.copy-toast {
  margin-top: 10px; font-size: 13px; color: var(--accent); font-weight: 600;
}

/* ---- Leaderboard tabs ---- */
.lb-tabs { display: flex; gap: 6px; justify-content: center; margin: 6px 0 10px; }
.lb-tab {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 6px 16px; border-radius: 999px; font-size: 13px; cursor: pointer;
}
.lb-tab.active { background: var(--panel-2); color: var(--ink); border-color: var(--accent-2); }

/* ---- Game layout ---- */
#game-screen { flex-direction: row; gap: 0; }
.map-wrap { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; padding: 16px; min-width: 0; }
#map-mount { width: 100%; }
#map-mount svg { width: 100%; height: auto; display: block; border-radius: 12px; border: 1px solid var(--border); background: var(--ocean); }
.map-hint {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(13,17,23,.85); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; color: var(--muted);
}

.panel {
  width: 340px; flex-shrink: 0; background: var(--panel);
  border-left: 1px solid var(--border); padding: 24px; overflow-y: auto;
}
.panel h2 { margin: 0 0 18px; font-size: 20px; }

/* ---- Result ---- */
.result-points { font-size: 52px; font-weight: 800; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.result-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.result-stats { list-style: none; padding: 0; margin: 0 0 20px; }
.result-stats li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.result-stats span { color: var(--muted); }
.result-stats b { font-variant-numeric: tabular-nums; }

.final-score { font-size: 64px; font-weight: 800; color: var(--accent); line-height: 1; }
.leaderboard { text-align: left; padding-left: 22px; margin: 10px 0 22px; }
.leaderboard li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.leaderboard li b { float: right; color: var(--accent); font-variant-numeric: tabular-nums; }

.hidden { display: none; }

/* ---- Map markers ---- */
.pin-target { animation: pulse 1.6s ease-in-out infinite; transform-origin: center; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.reveal-line { stroke: var(--accent-2); stroke-width: 1.5; stroke-dasharray: 4 3; }

.footer { text-align: center; padding: 14px; color: #4d5866; font-size: 12px; border-top: 1px solid var(--border); }

@media (max-width: 820px) {
  #game-screen { flex-direction: column; }
  .panel { width: 100%; border-left: none; border-top: 1px solid var(--border); }
}
