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

:root {
  --bg: #0e1418;
  --panel: #16202a;
  --panel-2: #1c2935;
  --ink: #dce8ee;
  --ink-dim: #8aa0ad;
  --ice: #5fd0ff;
  --line: #283a48;
  --accent: #46c07a;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: radial-gradient(circle at 50% -10%, #142430 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 1rem;
}

/* Top bar */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1.2rem;
}

.brand { display: flex; align-items: center; gap: 0.9rem; }
.brand .ice { font-size: 2.4rem; line-height: 1; filter: drop-shadow(0 0 8px rgba(95,208,255,0.4)); }
.brand h1 { font-size: 1.45rem; letter-spacing: 0.3px; }
.brand .tag { color: var(--ink-dim); font-size: 0.85rem; margin-top: 2px; }

.counters { display: flex; gap: 1.4rem; }
.counter { text-align: center; min-width: 4.5rem; }
.counter .num { display: block; font-size: 1.8rem; font-weight: 700; color: var(--ice); }
.counter .lbl { font-size: 0.7rem; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.5px; }

/* Content */
#content {
  flex: 1;
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1rem;
  min-height: 0;
}

#mapPanel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.map-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; }
#map { flex: 1; width: 100%; min-height: 0; }
.map-caption { color: var(--ink-dim); font-size: 0.72rem; margin-top: 0.4rem; }

.map-controls { margin-top: 0.8rem; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.scan-status { color: var(--ink-dim); font-size: 0.85rem; text-align: center; min-height: 1.1em; }

button {
  background: var(--ice);
  color: #06212e;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
button:hover { filter: brightness(1.08); }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.5; cursor: progress; }

/* Sidebar */
#sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem;
}
.card h2 { font-size: 1rem; margin-bottom: 0.6rem; color: var(--ink); display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.card-sub { font-size: 0.68rem; font-weight: 400; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.hint { color: var(--ink-dim); font-size: 0.8rem; margin-bottom: 0.6rem; }
.hint strong { color: var(--ice); }

.log {
  list-style: none;
  max-height: 30vh;
  overflow-y: auto;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.log li {
  background: var(--panel-2);
  border-left: 3px solid var(--ice);
  padding: 0.4rem 0.6rem;
  border-radius: 0 6px 6px 0;
  color: var(--ink-dim);
}
.log li.empty { border-left-color: var(--line); font-style: italic; }
.log li.ev-sighting { border-left-color: var(--accent); }
.log li time { color: var(--ice); font-variant-numeric: tabular-nums; margin-right: 0.4rem; }
.log li .who { color: var(--ink); font-weight: 600; margin-right: 0.4rem; }
.log li.ev-sighting .who { color: var(--accent); }

#reportForm { display: flex; gap: 0.5rem; flex-wrap: wrap; }
#reportForm input {
  flex: 1;
  min-width: 8rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 0.55rem 0.7rem;
  font-size: 0.9rem;
}
#reportForm input::placeholder { color: #5e7280; }
.report-result { margin-top: 0.6rem; font-size: 0.85rem; min-height: 1.1em; color: var(--accent); }

.facts ul { list-style: none; display: flex; flex-direction: column; gap: 0.55rem; }
.facts li { font-size: 0.82rem; color: var(--ink-dim); line-height: 1.4; padding-left: 1rem; position: relative; }
.facts li::before { content: "\2744"; position: absolute; left: 0; color: var(--ice); }
.facts strong { color: var(--ink); }

/* Leaderboard */
.leaderboard { list-style: none; display: flex; flex-direction: column; gap: 0.35rem; }
.leaderboard li {
  display: grid;
  grid-template-columns: 1.5rem 1fr auto;
  grid-template-areas: "rank name score" "rank detail score";
  align-items: center;
  column-gap: 0.5rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
}
.leaderboard li.is-me { border-color: var(--ice); box-shadow: 0 0 0 1px rgba(95,208,255,0.25) inset; }
.leaderboard li.lb-empty { display: block; color: var(--ink-dim); font-style: italic; font-size: 0.82rem; }
.lb-rank { grid-area: rank; color: var(--ink-dim); font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; }
.lb-name { grid-area: name; color: var(--ink); font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-detail { grid-area: detail; color: var(--ink-dim); font-size: 0.72rem; }
.lb-score { grid-area: score; color: var(--ice); font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.leaderboard li.is-me .lb-name { color: var(--ice); }
.lb-note { margin-top: 0.6rem; color: var(--ink-dim); font-size: 0.72rem; line-height: 1.4; }
.lb-note strong { color: var(--ink); }

/* Sponsored ad slot */
.ad-card { border-style: dashed; }
.ad-label { font-size: 0.62rem; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 0.5rem; }
.ad-banner {
  display: block;
  text-decoration: none;
  background: linear-gradient(135deg, #1d2c3a, #16202a);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  transition: border-color 0.15s ease, transform 0.08s ease;
}
.ad-banner:hover { border-color: var(--ice); }
.ad-banner:active { transform: scale(0.99); }
.ad-slogan { color: var(--ink); font-weight: 700; font-size: 0.98rem; line-height: 1.25; margin-bottom: 0.5rem; }
.ad-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.ad-cat { color: var(--ink-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; }
.ad-cta {
  background: var(--ice);
  color: #06212e;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.4px;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  white-space: nowrap;
}

@media (max-width: 820px) {
  #content { grid-template-columns: 1fr; overflow-y: auto; }
  #mapPanel { min-height: 50vh; }
  .counters { gap: 1rem; }
  .counter .num { font-size: 1.4rem; }
}
