:root {
  --bg: #12161d; --bg2: #1a202b; --fg: #d8dee9; --dim: #8d97a8; --line: #2a3242; --accent: #ff9d2e; --sun: #ffc83d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 13px/1.4 system-ui, -apple-system, Segoe UI, sans-serif; }
#app { position: relative; height: 100%; overflow: hidden; }
#map { position: absolute; inset: 0; }
#sky { position: absolute; inset: 0; pointer-events: none; transition: background .15s; mix-blend-mode: multiply; }
a { color: var(--accent); }
button, input, select { font: inherit; color: var(--fg); background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
button { cursor: pointer; } button:hover { border-color: var(--accent); }
button.mini { padding: 3px 8px; font-size: 12px; }
input[type=checkbox] { vertical-align: middle; }
input[type=range] { flex: 1; padding: 0; accent-color: var(--accent); }
input[type=date], input[type=time] { color-scheme: dark; }

#panel { position: absolute; top: 10px; left: 10px; bottom: 10px; width: 390px; max-width: calc(100vw - 20px); overflow-y: auto;
  background: rgba(18,22,29,.95); border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 8px 30px #0008; z-index: 5; }
#panel.collapsed { width: 44px; overflow: hidden; padding: 8px; }
#panel.collapsed > :not(header) { display: none; }
#panel.collapsed h1 { display: none; }
header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
h1 { font-size: 17px; margin: 0; } .logo { color: var(--sun); }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); margin: 14px 0 6px; font-weight: 600; }
.row { display: flex; gap: 6px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.row > input[type=search], .row > input#search { flex: 1; min-width: 0; }
.row.between { justify-content: space-between; }
.grid3 label { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 11px; color: var(--dim); }
.grid3 input { width: 100%; }
.row label { color: var(--dim); font-size: 11px; display: flex; flex-direction: column; gap: 2px; }
label.inline { display: inline; text-transform: none; letter-spacing: 0; font-weight: 400; float: right; }
.dim { color: var(--dim); } .small { font-size: 11px; }
#results { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 6px; max-height: 180px; overflow: auto; }
#results li { padding: 6px 8px; cursor: pointer; border-bottom: 1px solid var(--line); } #results li:hover { background: var(--bg2); }

#readout { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; background: var(--bg2); border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-variant-numeric: tabular-nums; }
#readout b { color: var(--sun); font-weight: 600; } #readout .full { grid-column: 1 / -1; }
#readout .warn { color: #ff8a8a; }

#tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-top: 10px; }
#tabs button { flex: 1; border: 0; border-radius: 6px 6px 0 0; background: none; color: var(--dim); }
#tabs button.on { color: var(--fg); background: var(--bg2); box-shadow: inset 0 -2px var(--accent); }
.tab { display: none; } .tab.on { display: block; }
canvas { width: 100%; display: block; border-radius: 6px; cursor: crosshair; }
.events { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 2px 10px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.events .k { color: var(--dim); } .events .full { grid-column: 1 / -1; }
.legend { color: var(--dim); font-size: 11px; margin: 4px 0; } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 3px 0 8px; vertical-align: -1px; } .legend i:first-child { margin-left: 0; }

.runs .card { background: var(--bg2); border-left: 3px solid var(--sun); border-radius: 6px; padding: 7px 10px; margin: 6px 0; cursor: pointer; }
.runs .card.night { border-color: #5aa9ff; } .runs .card:hover { outline: 1px solid var(--accent); }
.runs .big { font-size: 15px; font-weight: 600; color: var(--sun); } .runs .night .big { color: #8fc2ff; }
.list .item { background: var(--bg2); border-radius: 6px; padding: 7px 10px; margin: 6px 0; cursor: pointer; border-left: 3px solid #555; }
.list .item.vis { border-color: var(--sun); } .list .item.sel { outline: 1px solid var(--accent); } .list .item:hover { outline: 1px solid var(--line); }
.list .tag { font-size: 11px; padding: 1px 6px; border-radius: 9px; background: #333b4d; margin-left: 4px; }
.list .tag.total { background: #7a1f1f; } .list .tag.annular { background: #7a4a1f; }
.seg { display: flex; gap: 2px; margin: 8px 0; } .seg button { flex: 1; } .seg button.on { border-color: var(--accent); color: var(--accent); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; } th, td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: 500; font-size: 11px; } tr.row-click { cursor: pointer; } tr.row-click:hover { background: var(--bg2); }
td .x { color: var(--dim); cursor: pointer; padding: 0 4px; } td .x:hover { color: #ff8a8a; }
footer { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 8px; }

#mapctl { position: absolute; top: 10px; right: 56px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end;
  background: rgba(18,22,29,.88); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; z-index: 4; max-width: calc(100vw - 460px); }
#timebar { position: absolute; left: 420px; right: 10px; bottom: 24px; background: rgba(18,22,29,.92); border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px; z-index: 4; }
.sunmarker { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(#fff 0 25%, var(--sun) 26% 60%, #ff9d2e 61%); border: 2px solid #fff; box-shadow: 0 0 14px 3px #ffb33a99; cursor: grab; }
.ecl-marker { width: 14px; height: 14px; border-radius: 50%; background: #ff6b6b; border: 2px solid #fff; cursor: pointer; }

@media (max-width: 800px) {
  #panel { top: auto; bottom: 120px; height: 45vh; width: auto; right: 10px; }
  #timebar { left: 10px; bottom: 10px; } #mapctl { max-width: none; right: 50px; top: 4px; }
}
