:root {
  --bg: #05070c;
  --panel: #0c111b;
  --panel-2: #131a28;
  --line: #1f2a3d;
  --text: #dfe6f2;
  --muted: #8b97ab;
  --accent: #5fd3ff;
  --accent-2: #3ff0c8;
  --warn: #ffb35c;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
button, select, input { font: inherit; color: inherit; }

#app { display: flex; height: 100vh; }
#stage { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#panel { width: 380px; flex: none; overflow-y: auto; background: var(--panel);
  border-left: 1px solid var(--line); padding: 16px 18px 40px; }

#tabs { display: flex; gap: 4px; padding: 8px 10px 0; background: var(--bg); }
#tabs button { background: none; border: 1px solid transparent; border-bottom: none; padding: 7px 14px;
  border-radius: 8px 8px 0 0; color: var(--muted); cursor: pointer; }
#tabs button.active { background: var(--panel-2); color: var(--text); border-color: var(--line); }
#viewport { position: relative; flex: 1; min-height: 0; border-top: 1px solid var(--line); overflow: hidden; }
#gl, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#overlay { pointer-events: none; }
#viewport.shells #overlay { pointer-events: auto; }
#viewport.shells #gl { visibility: hidden; }

#loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted);
  background: var(--bg); font-size: 16px; }
#viewnote { position: absolute; left: 12px; top: 10px; max-width: min(520px, calc(100% - 290px));
  color: var(--muted); font-size: 13px; pointer-events: none; text-shadow: 0 1px 3px #000; }
#viewnote b { color: var(--text); }
.floatbar { position: absolute; left: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
#viewport:not(.globe) .floatbar { display: none; }
#tooltip { position: absolute; pointer-events: none; background: rgba(12,17,27,.95); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 12.5px; max-width: 320px; }

h1 { font-size: 20px; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
section { border-top: 1px solid var(--line); padding: 14px 0; }
.lede { margin: 0 0 12px; color: var(--muted); }
.lede b { color: var(--text); }
.row { display: flex; align-items: center; gap: 10px; }
.row input[type=range] { flex: 1; accent-color: var(--accent); }
output { font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; font-weight: 600; }
#clock { text-align: left; font-weight: 500; }
.btnrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
button { background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 5px 10px; cursor: pointer; }
button:hover { border-color: #33476a; }
button.active { border-color: var(--accent); color: var(--accent); }
select { background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; color: var(--text); font-size: 13px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.hint { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.tag { font-size: 10.5px; border: 1px solid #3a4560; color: var(--muted); border-radius: 4px; padding: 0 4px; white-space: nowrap; }
.obs label { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.obs input { width: 90px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }

#planList { list-style: none; margin: 8px 0; padding: 0; font-size: 12.5px; }
#planList li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 4px 6px; border-radius: 6px;
  cursor: pointer; color: var(--muted); position: relative; overflow: hidden; }
#planList li:hover { background: var(--panel-2); }
#planList li .bar { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(63,240,200,.09); z-index: 0; }
#planList li > span { position: relative; z-index: 1; }
#planList li.on { color: var(--text); }
#planList li .n { font-variant-numeric: tabular-nums; text-align: right; }
#planList li .src { grid-column: 1 / -1; font-size: 11px; color: #6c788d; }

#stats { margin: 0; display: grid; grid-template-columns: 1fr; gap: 10px; }
#stats div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
#stats dt { font-size: 12px; color: var(--muted); }
#stats dd { margin: 2px 0 0; font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
#stats dd small { display: block; font-size: 12.5px; font-weight: 400; color: var(--muted); margin-top: 2px; }
#about p { color: var(--muted); font-size: 12.5px; }
#about b { color: var(--text); }
summary { cursor: pointer; color: var(--text); }

@media (max-width: 860px) {
  #app { flex-direction: column; height: auto; }
  #stage { height: 68vh; flex: none; }
  #panel { width: 100%; border-left: none; padding: 12px 16px 40px; }
  #tabs button { padding: 6px 9px; font-size: 13px; }
}

.warn { margin: 0 0 12px; padding: 8px 10px; border: 1px solid #6b4a1f; background: #241a0e; color: #f3d2a6;
  border-radius: 8px; font-size: 12.5px; }
.warn b { color: var(--warn); }
code { font: 12px ui-monospace, Consolas, monospace; background: rgba(255,255,255,.07); padding: 1px 4px; border-radius: 4px; }
@media (max-width: 760px) { #viewnote { max-width: calc(100% - 24px); } }

.pairline { margin-bottom: 6px; color: var(--text); font-size: 14px; }
.pairline b { color: #ffb35c; font-size: 20px; font-variant-numeric: tabular-nums; margin-left: 4px; }
.pairline span { display: block; font-size: 12px; color: var(--muted); }
