/* XSKY — The Open Sky Observatory
   Design language: deep space ground, instrument-panel typography,
   glass surfaces that never fight the map for attention. */

:root {
  --bg: #04060d;
  --bg-2: #070b16;
  --surface: rgba(12, 18, 32, 0.78);
  --surface-2: rgba(18, 26, 44, 0.9);
  --line: rgba(126, 168, 220, 0.16);
  --line-strong: rgba(126, 168, 220, 0.32);
  --text: #e8eefb;
  --text-dim: #9fb0cc;
  --text-faint: #6a7b98;
  --accent: #5fd6ff;
  --accent-2: #7dffb0;
  --warn: #ffc457;
  --danger: #ff5d78;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --rail-w: 236px;
  --panel-w: 340px;
}

* { box-sizing: border-box; }

/* Layout rules below set `display`, which would otherwise beat `hidden`. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body.app { overflow: hidden; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb {
  background: rgba(126, 168, 220, 0.22);
  border-radius: 6px;
}
::-webkit-scrollbar-track { background: transparent; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- app */

.stage {
  position: fixed;
  inset: 0;
}
.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
.stage canvas:active { cursor: grabbing; }
.stage canvas[hidden] { display: none; }

/* ------------------------------------------------------------- header */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(4, 6, 13, 0.92) 0%, rgba(4, 6, 13, 0.55) 60%, transparent 100%);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.brand:hover { text-decoration: none; }
.brand .mark {
  font-weight: 800;
  font-size: 21px;
  letter-spacing: 0.16em;
  background: linear-gradient(92deg, #7fe6ff 0%, #b6a2ff 55%, #ffd18a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand .tagline {
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.spacer { flex: 1; }

.seg {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  backdrop-filter: blur(14px);
}
.seg button {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.seg button[aria-pressed='true'] {
  background: rgba(95, 214, 255, 0.16);
  color: #d8f4ff;
  box-shadow: inset 0 0 0 1px rgba(95, 214, 255, 0.35);
}

.search {
  position: relative;
  width: min(300px, 34vw);
}
.search input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  backdrop-filter: blur(14px);
}
.search input::placeholder { color: var(--text-faint); }
.search .icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 12px;
  pointer-events: none;
}
.results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: hidden;
  max-height: 46vh;
  overflow-y: auto;
}
.results:empty { display: none; }
.results button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(126, 168, 220, 0.08);
  font-size: 13px;
}
.results button:hover, .results button:focus { background: rgba(95, 214, 255, 0.1); }
.results .sub { color: var(--text-faint); font-size: 11px; }

.iconbtn {
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-dim);
  backdrop-filter: blur(14px);
  font-size: 15px;
}
.iconbtn:hover { color: var(--text); border-color: var(--line-strong); }
.iconbtn[aria-pressed='true'] {
  color: #d8f4ff;
  border-color: rgba(95, 214, 255, 0.5);
  background: rgba(95, 214, 255, 0.14);
}

.navlinks {
  display: flex;
  gap: 4px;
  align-items: center;
}
.navlinks a {
  padding: 7px 11px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}
.navlinks a:hover { background: rgba(126, 168, 220, 0.1); color: var(--text); text-decoration: none; }

/* --------------------------------------------------------------- rail */

.rail {
  position: fixed;
  left: 14px;
  top: 66px;
  bottom: 54px;
  width: var(--rail-w);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.layer {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(16px);
  text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.layer:hover { border-color: var(--line-strong); }
.layer:active { transform: scale(0.99); }
.layer[aria-pressed='false'] { opacity: 0.42; }
.layer[aria-pressed='true'] { box-shadow: inset 3px 0 0 var(--layer-color, var(--accent)); }
.layer .glyph { font-size: 16px; text-align: center; }
.layer .name { font-weight: 600; font-size: 13px; letter-spacing: 0.01em; }
.layer .meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-faint);
  margin-top: 2px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}
.layer .state {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}
.layer .state[data-status='live'] { background: var(--accent-2); animation: pulse 2.4s infinite; }
.layer .state[data-status='cached'] { background: var(--warn); }
.layer .state[data-status='error'] { background: var(--danger); }
.layer .state[data-status='loading'] { background: var(--accent); animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.rail-section {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 6px 4px 0;
  font-weight: 700;
}

/* -------------------------------------------------------------- panel */

.panel {
  position: fixed;
  right: 14px;
  top: 66px;
  bottom: 54px;
  width: var(--panel-w);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 2px;
}

.card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(18px);
  padding: 13px 14px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 2px;
  font-size: 14px;
  letter-spacing: 0.01em;
}
.card h3 {
  margin: 0 0 8px;
  font-size: 10.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
}
.card p { margin: 0 0 8px; color: var(--text-dim); line-height: 1.5; font-size: 12.5px; }
.card p:last-child { margin-bottom: 0; }

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 12.5px;
}
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; font-family: var(--mono); text-align: right; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.stat {
  background: rgba(126, 168, 220, 0.06);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.stat .label {
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
}
.stat .value {
  font-family: var(--mono);
  font-size: 17px;
  margin-top: 3px;
  line-height: 1.1;
}
.stat .unit { font-size: 11px; color: var(--text-faint); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: rgba(126, 168, 220, 0.08);
  color: var(--text-dim);
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.list { display: flex; flex-direction: column; gap: 6px; }
.row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  font-size: 12.5px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(126, 168, 220, 0.08);
}
.row:last-child { border-bottom: none; }
.row .r { font-family: var(--mono); color: var(--text-dim); white-space: nowrap; }
.row button.r-link { color: var(--accent); font-size: 12px; }

.bar {
  height: 5px;
  border-radius: 3px;
  background: rgba(126, 168, 220, 0.14);
  overflow: hidden;
  margin-top: 5px;
}
.bar > span { display: block; height: 100%; border-radius: 3px; }

.sparkline { width: 100%; height: 38px; display: block; }

.panel-close {
  position: absolute;
  right: 10px; top: 10px;
  color: var(--text-faint);
  font-size: 16px;
  line-height: 1;
  padding: 4px;
}
.card.relative { position: relative; }

.source-note {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.45;
}
.source-note a { color: var(--text-dim); }

/* ----------------------------------------------------------- statusbar */

.statusbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  font-size: 11.5px;
  color: var(--text-dim);
  background: linear-gradient(0deg, rgba(4, 6, 13, 0.94) 0%, rgba(4, 6, 13, 0.6) 55%, transparent 100%);
  pointer-events: none;
  flex-wrap: wrap;
}
.statusbar > * { pointer-events: auto; }
.statusbar .mono { font-family: var(--mono); }
.statusbar .sep { color: var(--text-faint); opacity: 0.5; }
.statusbar button.linklike {
  color: var(--text-dim);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.statusbar button.linklike:hover { color: var(--text); }

.timectl {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 4px 3px 10px;
  backdrop-filter: blur(14px);
}
.timectl .clock { font-family: var(--mono); font-size: 12px; letter-spacing: 0.03em; }
.timectl button {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 600;
}
.timectl button:hover { color: var(--text); background: rgba(126, 168, 220, 0.12); }
.timectl button[aria-pressed='true'] { color: #d8f4ff; background: rgba(95, 214, 255, 0.16); }

/* ------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  bottom: 46px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 12.5px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  animation: rise 0.3s ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* -------------------------------------------------------------- intro */

.intro {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, rgba(12, 22, 46, 0.9), rgba(3, 5, 11, 0.97));
  backdrop-filter: blur(6px);
  transition: opacity 0.5s;
}
.intro[hidden] { display: none; }
.intro .inner { text-align: center; max-width: 460px; padding: 24px; }
.intro .mark {
  font-size: 46px;
  font-weight: 800;
  letter-spacing: 0.2em;
  background: linear-gradient(92deg, #7fe6ff, #b6a2ff 55%, #ffd18a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.intro p { color: var(--text-dim); line-height: 1.6; }
.intro .loading {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
}
.intro .track {
  margin: 14px auto 0;
  width: 220px; height: 3px;
  background: rgba(126, 168, 220, 0.16);
  border-radius: 2px;
  overflow: hidden;
}
.intro .track > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #7fe6ff, #b6a2ff);
  transition: width 0.3s;
}

/* -------------------------------------------------------------- pages */

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 96px 22px 80px;
  line-height: 1.65;
}
.page h1 {
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.1;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}
.page h2 {
  font-size: 20px;
  margin: 40px 0 10px;
  letter-spacing: -0.01em;
}
.page h3 { font-size: 15px; margin: 26px 0 6px; }
.page p, .page li { color: var(--text-dim); }
.page .lead { font-size: 17px; color: var(--text); }
.page code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: rgba(126, 168, 220, 0.1);
  padding: 2px 6px;
  border-radius: 5px;
}
.page pre {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 12.5px;
}
.page pre code { background: none; padding: 0; }
.page table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 12px 0; }
.page th, .page td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.page th { color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.page td { color: var(--text-dim); }
.page blockquote {
  margin: 18px 0;
  padding: 12px 18px;
  border-left: 2px solid var(--accent);
  background: rgba(95, 214, 255, 0.06);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.page blockquote p:last-child { margin-bottom: 0; }
.page hr { border: none; border-top: 1px solid var(--line); margin: 40px 0; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.cards .card h3 { color: var(--text); font-size: 14px; text-transform: none; letter-spacing: 0; margin-bottom: 6px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 13.5px;
  border: 1px solid var(--line-strong);
  background: rgba(95, 214, 255, 0.12);
  color: #d8f4ff;
}
.btn:hover { background: rgba(95, 214, 255, 0.2); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--text-dim); }
.btn.ghost:hover { color: var(--text); background: rgba(126, 168, 220, 0.08); }

.pagenav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: rgba(4, 6, 13, 0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.footer {
  border-top: 1px solid var(--line);
  padding: 26px 22px 40px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1180px) {
  :root { --panel-w: 300px; --rail-w: 200px; }
}

@media (max-width: 900px) {
  .topbar { gap: 8px; padding: 8px 10px; }
  .brand .tagline { display: none; }
  .search { width: 34vw; }
  .navlinks { display: none; }

  .rail {
    left: 0; right: 0;
    top: auto;
    bottom: 44px;
    width: auto;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 10px;
    gap: 6px;
    scroll-snap-type: x proximity;
  }
  .layer {
    flex: 0 0 auto;
    width: auto;
    grid-template-columns: auto auto;
    padding: 7px 12px;
    scroll-snap-align: start;
  }
  .layer .meta, .layer .state { display: none; }

  .panel {
    left: 0; right: 0;
    top: auto;
    bottom: 0;
    width: auto;
    max-height: 52vh;
    padding: 10px 10px 46px;
    background: linear-gradient(0deg, rgba(4, 6, 13, 0.96), rgba(4, 6, 13, 0.75));
    transform: translateY(100%);
    transition: transform 0.28s ease;
  }
  .panel.open { transform: none; }
  .panel.open ~ .rail { bottom: 52vh; }

  .statusbar { font-size: 10.5px; gap: 8px; padding: 6px 10px; }
  .statusbar .hide-sm { display: none; }
  .page { padding-top: 78px; }
}

/* Phones: the search needs a full row of its own to stay usable. */
@media (max-width: 620px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .brand .mark { font-size: 18px; }
  .seg button { padding: 6px 10px; font-size: 12px; }
  .search {
    order: 10;
    width: 100%;
    flex-basis: 100%;
  }
  .spacer { display: none; }
  .rail { bottom: 40px; }
  .panel.open ~ .rail { bottom: 52vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ================================================================== *
   Tonight — the screen people land on
   ================================================================== */

.tonight {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 72px 18px calc(84px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}
.tonight[hidden] { display: none; }
.tonight > * {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.tn-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tn-place {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 0;
  color: var(--text);
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.tn-place-edit {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  border-bottom: 1px dotted currentColor;
}
.tn-place:hover .tn-place-edit { color: var(--accent); }
.tn-date { font-size: 12.5px; color: var(--text-faint); }

/* --- verdict --- */

.tn-verdict {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(20, 30, 52, 0.85), rgba(10, 15, 28, 0.85));
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.tn-ring { width: 116px; height: 116px; flex: 0 0 auto; }
.tn-ring-value {
  fill: var(--text);
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 600;
}
.tn-verdict-text { min-width: 0; flex: 1; }
.tn-verdict-label {
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.tn-verdict-headline {
  font-size: 14px;
  color: var(--text-dim);
  margin-top: 3px;
}
.tn-best {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(125, 255, 176, 0.12);
  border: 1px solid rgba(125, 255, 176, 0.3);
  color: #b9ffd6;
  font-size: 12.5px;
  font-weight: 600;
}
.tn-best-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  animation: pulse 2.4s infinite;
}
.tn-reasons {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.tn-reasons li {
  font-size: 12.5px;
  color: var(--text-dim);
  padding-left: 20px;
  position: relative;
  line-height: 1.45;
}
.tn-reasons li::before {
  position: absolute;
  left: 0; top: 0;
  font-size: 12px;
}
.tn-reasons li.good::before { content: '✓'; color: var(--accent-2); }
.tn-reasons li.bad::before { content: '•'; color: var(--warn); }
.tn-reasons li.unknown::before { content: '?'; color: var(--text-faint); }

/* --- cards --- */

.tn-card {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 15px 16px;
  margin-bottom: 12px;
}
.tn-card h3 {
  margin: 0 0 10px;
  font-size: 10.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
}
.tn-muted { color: var(--text-faint); font-size: 12.5px; line-height: 1.5; margin: 0; }

.tn-highlights { display: flex; flex-direction: column; gap: 12px; }
.tn-item { display: flex; gap: 12px; align-items: flex-start; }
.tn-item-icon { font-size: 19px; line-height: 1.2; flex: 0 0 24px; text-align: center; }
.tn-item-title { font-size: 14px; font-weight: 620; }
.tn-when { color: var(--accent); font-weight: 600; font-family: var(--mono); font-size: 12.5px; }
.tn-item-detail { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; margin-top: 2px; }

/* --- cloud timeline --- */

.tn-timeline {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 84px;
}
.tn-bar-wrap { flex: 1; display: flex; flex-direction: column; height: 100%; gap: 4px; }
.tn-bar-track {
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: rgba(126, 168, 220, 0.07);
  border-radius: 4px;
  overflow: hidden;
}
.tn-bar { width: 100%; border-radius: 4px 4px 0 0; transition: height 0.3s; }
.tn-bar.clear { background: linear-gradient(180deg, #7dffb0, #3fd08a); }
.tn-bar.part { background: linear-gradient(180deg, #ffd166, #e0a63c); }
.tn-bar.cloud { background: linear-gradient(180deg, #8ea8c8, #55688a); }
.tn-bar.unknown { background: repeating-linear-gradient(45deg, #3a4761, #3a4761 3px, #2a3346 3px, #2a3346 6px); }
.tn-bar-label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-faint);
  text-align: center;
}
.tn-legend {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-faint);
  flex-wrap: wrap;
}
.tn-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tn-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.tn-legend i.clear { background: #7dffb0; }
.tn-legend i.part { background: #ffd166; }
.tn-legend i.cloud { background: #8ea8c8; }

/* --- pass --- */

.tn-pass-time { font-size: 15px; margin-bottom: 6px; }
.tn-pass-line { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; margin-bottom: 4px; }
.tn-pass-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.tn-pass-actions .btn { padding: 8px 14px; font-size: 12.5px; }

/* --- alerts --- */

.tn-alerts-row { display: flex; align-items: flex-start; gap: 14px; justify-content: space-between; }
.tn-alerts-row h3 { margin-bottom: 4px; }
.tn-note { font-size: 11.5px; color: var(--text-faint); margin: 10px 0 0; line-height: 1.5; }
.tn-switch {
  flex: 0 0 auto;
  width: 46px; height: 27px;
  border-radius: 999px;
  background: rgba(126, 168, 220, 0.18);
  border: 1px solid var(--line);
  position: relative;
  transition: background 0.18s;
}
.tn-switch .knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: #8ea8c8;
  transition: transform 0.18s, background 0.18s;
}
.tn-switch.on { background: rgba(125, 255, 176, 0.28); border-color: rgba(125, 255, 176, 0.5); }
.tn-switch.on .knob { transform: translateX(19px); background: var(--accent-2); }

.tn-actions { display: flex; gap: 10px; margin: 16px 0 10px; }
.tn-actions .btn { flex: 1; justify-content: center; }
.tn-foot { text-align: center; padding: 6px 0 10px; }
.tn-foot .linklike {
  color: var(--text-faint);
  font-size: 12px;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.tn-foot .linklike:hover { color: var(--text-dim); }

/* ================================================================== *
   Bottom tab bar
   ================================================================== */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 45;
  display: none;
  background: rgba(6, 9, 18, 0.94);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar button {
  flex: 1;
  padding: 9px 4px 10px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  letter-spacing: 0.02em;
}
.tabbar button .ico { font-size: 17px; line-height: 1; }
.tabbar button[aria-pressed='true'] { color: var(--accent); }

/* ================================================================== *
   Info sheet
   ================================================================== */

.sheet { position: fixed; inset: 0; z-index: 70; }
.sheet[hidden] { display: none; }
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 9, 0.72);
  opacity: 0;
  transition: opacity 0.22s;
}
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet-body {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: min(520px, 100%);
  background: #080c16;
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 26px 26px calc(40px + env(safe-area-inset-bottom, 0px));
  transform: translateX(100%);
  transition: transform 0.24s ease;
}
.sheet.open .sheet-body { transform: none; }
.sheet-close {
  position: absolute;
  top: 14px; right: 16px;
  font-size: 24px;
  line-height: 1;
  color: var(--text-faint);
  padding: 4px 8px;
}
.sheet-close:hover { color: var(--text); }
.sheet-body h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -0.02em; }
.sheet-lead { color: var(--text-dim); line-height: 1.6; margin: 0 0 6px; }
.sheet-section { margin-top: 22px; }
.sheet-section h3 {
  font-size: 10.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 8px;
  font-weight: 700;
}
.sheet-section p { color: var(--text-dim); font-size: 13px; line-height: 1.6; margin: 0 0 8px; }
.sheet-list { margin: 0; padding-left: 18px; }
.sheet-list li { color: var(--text-dim); font-size: 12.5px; line-height: 1.65; }
.sheet-foot {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ================================================================== *
   Night vision — answers the "ruins my dark adaptation" complaint
   ================================================================== */

body.night { background: #0a0000; }
body.night .stage,
body.night .topbar,
body.night .tabbar,
body.night .rail,
body.night .panel,
body.night .statusbar,
body.night .toasts,
body.night .sheet {
  filter: sepia(1) saturate(5.5) hue-rotate(-42deg) brightness(0.75);
}
body.night .brand .mark { -webkit-text-fill-color: #ff6a4a; }
body.night .iconbtn[aria-pressed='true'] { box-shadow: 0 0 0 1px rgba(255, 90, 60, 0.6); }

/* ================================================================== *
   Responsive
   ================================================================== */

@media (max-width: 900px) {
  .tabbar { display: flex; }
  .seg { display: none; }
  .topbar { flex-wrap: nowrap; }
  .tonight { padding-top: 62px; }
  .statusbar { bottom: 58px; }
  .rail { bottom: 102px; }
  .panel.open ~ .rail { bottom: 52vh; }
  .tonight { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .tn-verdict { gap: 14px; padding: 15px; }
  .tn-ring { width: 92px; height: 92px; }
  .tn-verdict-label { font-size: 21px; }
  .sheet-body { width: 100%; border-left: none; }
}

@media (max-width: 620px) {
  body[data-mode='tonight'] .search { order: 10; }
  .tn-timeline { height: 70px; }
  .topbar { gap: 6px; padding: 8px 10px; }
  .iconbtn { width: 32px; height: 32px; font-size: 14px; }
  .tn-head { margin-top: 4px; }
}
