/* Tokens from DESIGN_SYSTEM.md (poke-dojo reference). --sun is the one project-specific accent. */
:root {
  --bg: #0f0f1a; --surface: #1a1a2e; --surface2: #16213e; --border: #2a2a4a;
  --accent: #6c63ff; --accent-hover: #8b85ff; --accent-end: #a78bfa;
  --green: #22c55e; --yellow: #f59e0b; --red: #ef4444;
  --text: #e2e8f0; --muted: #94a3b8;
  --radius: 12px; --radius-sm: 8px; --radius-pill: 999px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --sun: #fde047;
  --font: 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-weight: 500; }
#map { position: fixed; inset: 0; }
.maplibregl-ctrl-attrib { background: rgba(15, 15, 26, 0.7) !important; color: var(--muted) !important; }
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }

.card { background: rgba(26, 26, 46, 0.92); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.btn { font: inherit; font-weight: 700; border-radius: var(--radius-sm); padding: 0.5rem 0.9rem; cursor: pointer; color: var(--text); border: 1px solid transparent; transition: transform .15s, border-color .15s, background .15s; }
.btn.small { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.btn.primary { background: linear-gradient(90deg, var(--accent), var(--accent-end)); color: #fff; }
.btn.primary:hover { transform: translateY(-1px); background: linear-gradient(90deg, var(--accent-hover), var(--accent-end)); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.ghost:hover { border-color: var(--accent); }
.pill { display: inline-block; padding: 0.15rem 0.6rem; border-radius: var(--radius-pill); font-size: 0.78rem; font-weight: 700; color: var(--accent); background: rgba(108, 99, 255, 0.15); border: 1px solid rgba(108, 99, 255, 0.3); white-space: nowrap; }
.pill.sun { color: var(--sun); background: rgba(253, 224, 71, 0.15); border-color: rgba(253, 224, 71, 0.3); }

#search { position: fixed; top: 12px; left: 12px; display: flex; gap: 0.5rem; padding: 0.5rem; width: min(340px, calc(100vw - 24px)); z-index: 5; }
#search input { flex: 1; min-width: 0; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem 0.7rem; }
#search input:focus { outline: none; border-color: var(--accent); }

#panel { position: fixed; top: 12px; right: 12px; width: 360px; padding: 0.9rem 1rem 0.8rem; z-index: 5; display: flex; flex-direction: column; gap: 0.7rem; }
.row { display: flex; align-items: center; gap: 0.6rem; }
.row.head { gap: 0.5rem; }
.clock { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.5px; flex: 1; font-variant-numeric: tabular-nums; }
.clock .ampm { font-size: 0.85rem; color: var(--muted); margin-left: 0.25rem; font-weight: 700; }
.slider-row { display: flex; align-items: center; gap: 0.6rem; }
.slider-row .end { font-size: 0.72rem; color: var(--muted); min-width: 2.6rem; font-variant-numeric: tabular-nums; }
.slider-row .end:last-child { text-align: right; }
.date-row { flex-wrap: wrap; }
#date { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.3rem 0.5rem; color-scheme: dark; }
.seasons { display: flex; gap: 0.35rem; width: 100%; }
.seasons button { flex: 1; white-space: nowrap; }
.seasons button { font: inherit; font-size: 0.74rem; font-weight: 700; cursor: pointer; border-radius: var(--radius-pill); padding: 0.22rem 0.3rem; color: var(--sun); background: rgba(253, 224, 71, 0.12); border: 1px solid rgba(253, 224, 71, 0.28); transition: transform .15s, border-color .15s; }
.seasons button:hover { transform: translateY(-1px); border-color: var(--sun); }
.toggles { gap: 0.9rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--muted); }
.chk { display: flex; align-items: center; gap: 0.35rem; cursor: pointer; }
.chk input { accent-color: var(--accent); }

input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 6px; border-radius: var(--radius-pill); background: var(--border); outline: none; min-width: 0; }
#time { background: linear-gradient(90deg, var(--accent), var(--accent-end)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--sun); border: 2px solid var(--bg); box-shadow: 0 0 8px rgba(253, 224, 71, 0.7); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--sun); border: 2px solid var(--bg); cursor: pointer; }

#info { position: fixed; left: 12px; bottom: 34px; display: grid; grid-template-columns: repeat(2, auto); gap: 0.45rem 1.6rem; padding: 0.75rem 1rem; z-index: 5; }
.stat { display: flex; flex-direction: column; }
.stat .k { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.stat .v { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.legend { grid-column: 1 / -1; width: 270px; display: flex; flex-direction: column; gap: 0.3rem; }
.legend[hidden] { display: none; }
.legend-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.legend-head .k { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.legend-head .v { font-size: 0.95rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.legend-bar { display: flex; height: 12px; border-radius: 3px; overflow: hidden; border: 1px solid var(--border); }
.legend-bar span { flex: 1; transition: transform .1s; }
.legend-bar span.on { outline: 2px solid var(--text); outline-offset: -2px; }
.legend-ticks { position: relative; height: 0.9rem; font-size: 0.66rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend-ticks span { position: absolute; transform: translateX(-50%); }
.legend-ticks span:first-child { transform: none; }
.status { grid-column: 1 / -1; font-size: 0.74rem; color: var(--muted); min-height: 1em; }

/* labels projected from the 3D dome */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.lbl { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); white-space: nowrap; will-change: transform; }
.lbl.deg { font-size: 11px; font-weight: 800; color: #1e293b; text-shadow: 0 0 3px rgba(255, 255, 255, 0.9); }
.lbl.cardinal { font-size: 15px; font-weight: 800; color: #0f172a; text-shadow: 0 0 4px rgba(255, 255, 255, 0.95); }
.lbl.cardinal.n { color: var(--red); }
.lbl.sunpill { font-size: 12px; font-weight: 800; padding: 0.15rem 0.5rem; border-radius: var(--radius-pill); background: rgba(15, 15, 26, 0.88); color: var(--sun); border: 1px solid rgba(253, 224, 71, 0.5); }
.lbl.sunpill small { font-size: 9px; color: var(--muted); margin-left: 2px; }
.lbl.sunpill.big { font-size: 13px; background: var(--sun); color: #1a1a2e; border-color: var(--sun); }
.lbl.sunpill.big small { color: #3b3b52; }
.lbl.hidden { display: none; }

@media (max-width: 640px) {
  #panel { top: auto; bottom: 0; right: 0; left: 0; width: auto; border-radius: var(--radius) var(--radius) 0 0; padding-bottom: calc(0.8rem + env(safe-area-inset-bottom)); }
  #search { width: calc(100vw - 24px); }
  #info { bottom: auto; top: 70px; padding: 0.5rem 0.8rem; gap: 0.2rem 1rem; }
  .toggles { font-size: 0.76rem; }
  .legend { width: min(270px, calc(100vw - 48px)); }
}
