/* cosmoflight — прототип. Тёмная «космическая» тема, стеклянные панели. */
* { box-sizing: border-box; margin: 0; padding: 0; }
/* авторский display (например, #nogl{display:grid}) перебивает UA-правило для [hidden] —
   возвращаем атрибуту hidden его силу */
[hidden] { display: none !important; }
:root {
  --bg: #04060c;
  --ink: #e8edf6;
  --ink-dim: #9aa7bd;
  --line: rgba(255, 255, 255, 0.10);
  --accent: #7ee0ff;
  --bgs: #ffe8c8; --lrg: #ffb347; --elg: #45e0c8; --qso: #b06bff;
  --glass: rgba(10, 16, 28, 0.72);
  font-size: 15px;
}
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
b { font-weight: 600; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
#scene.dragging { cursor: grabbing; }
#scene.hoverpt { cursor: pointer; }

.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

/* ---------- бренд ---------- */
#brand {
  position: fixed; top: 18px; left: 22px; z-index: 5; pointer-events: none;
  padding: 9px 16px 10px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 12px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
}
#brand h1 {
  font-size: 21px; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase;
  background: linear-gradient(90deg, #fff, #9fd8ff 55%, #c9a6ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#brand .sub { margin-top: 3px; font-size: 12.5px; color: var(--ink-dim); letter-spacing: 0.03em; }
#brand .sub b { color: #cfe3ff; }
#brand .credit { margin-top: 6px; font-size: 11px; color: var(--ink-dim); letter-spacing: 0.02em; }
/* плашка вся pointer-events:none (клики уходят на сцену) — ссылку включаем точечно */
#brand .credit a { color: #cfe3ff; text-decoration: none; pointer-events: auto; }
#brand .credit a:hover { color: #fff; text-decoration: underline; }

/* ---------- правая колонка ---------- */
#panel-right { position: fixed; top: 18px; right: 18px; z-index: 6; display: flex; flex-direction: column; gap: 10px; width: 240px; }
#legend { padding: 12px 14px; }
.legend-title { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 9px; display:flex; justify-content:space-between; }
.legend-title .hint { cursor: default; }
.lg-row { display: flex; align-items: center; gap: 9px; padding: 4px 2px; cursor: pointer; border-radius: 6px; user-select: none; }
.lg-row:hover { background: rgba(255,255,255,0.06); }
.lg-row.off { opacity: 0.35; }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 8px currentColor; }
.lg-name { flex: 1; font-size: 13px; }
.lg-count { font-size: 12px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
#controlrow, #controlrow2 { display: flex; gap: 8px; padding: 8px; }
/* «Режим» — на всю ширину первой строки; ?, EN, «О проекте» переносятся
   на вторую и делят её (иначе в русском 4 кнопки не влезают в 240px). */
#controlrow #btn-about { flex: 1 1 auto; }
#controlrow2 { flex-direction: column; }
#controlrow2 .btn { width: 100%; }

/* ---------- скорость ---------- */
#speedrow { padding: 8px 12px 5px; }
.speed-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); }
.speed-top b { font-size: 12px; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: 0; }
#speed-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; cursor: pointer; }
#speed-slider::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(126,224,255,0.2), rgba(126,224,255,0.75));
  box-shadow: inset 0 0 3px rgba(0,0,0,.6);
}
#speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; margin-top: -5px;
  border-radius: 50%; background: #fff; border: 2px solid #0a1834;
  box-shadow: 0 0 8px rgba(126, 224, 255, 0.7);
}
#speed-slider::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, rgba(126,224,255,0.2), rgba(126,224,255,0.75)); }
#speed-slider::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid #0a1834; }

/* ---------- автономное путешествие ---------- */
#ambientbar {
  position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%);
  z-index: 25; display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 8px 16px; border-color: rgba(126, 224, 255, 0.35);
}
#ambient-label { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); }
#ambient-exit { padding: 3px 9px; }
@media (max-width: 760px) {
  #ambientbar { bottom: 132px; }
}

/* ---------- экскурсии ---------- */
#tourbar {
  position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%);
  z-index: 25; display: flex; flex-direction: column; gap: 9px;
  width: min(430px, calc(100vw - 24px)); padding: 12px 16px;
  border-color: rgba(126, 224, 255, 0.4);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55), 0 0 26px rgba(126, 224, 255, 0.12);
}
.tourbar-head { display: flex; align-items: center; gap: 10px; }
#tour-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-dim);
}
#tour-step { color: var(--accent); font-size: 13px; flex: none; }
#tour-exit { flex: none; padding: 3px 9px; }
/* во время перелёта титров нет — блок схлопывается, плашка становится компактной */
#tour-caption {
  font-size: 15.5px; line-height: 1.5; color: #eaf2ff;
  max-height: 0; overflow: hidden; opacity: 0;
  transition: opacity 0.8s, max-height 0.55s ease;
}
#tour-caption.show { opacity: 1; max-height: 170px; }
.tourbar-foot { display: flex; align-items: center; gap: 8px; }
#tour-prev { padding: 8px 12px; }
#tour-prev:disabled { opacity: 0.35; cursor: default; }
#tour-prev:disabled:hover { background: rgba(255, 255, 255, 0.07); border-color: var(--line); }
#tour-next {
  flex: 1; font-size: 13.5px; padding: 8px 12px;
  background: rgba(126, 224, 255, 0.16); border-color: rgba(126, 224, 255, 0.45);
}
#tour-next:hover { background: rgba(126, 224, 255, 0.28); border-color: var(--accent); }
.tour-auto {
  display: flex; align-items: center; gap: 6px; flex: none;
  cursor: pointer; font-size: 11.5px; color: var(--ink-dim); user-select: none;
}
.tour-auto:hover { color: var(--ink); }
.tour-auto input { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; margin: 0; }
.tour-item {
  display: block; width: 100%; text-align: left; background: rgba(255,255,255,0.05);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px;
  cursor: pointer; color: var(--ink); font-family: inherit;
}
.tour-item:hover { background: rgba(126,224,255,0.1); border-color: var(--accent); }
.tour-item b { display: block; font-size: 14.5px; margin-bottom: 3px; }
.tour-item span { font-size: 12.5px; color: var(--ink-dim); line-height: 1.4; }

/* ---------- «Как полетим?» + памятка после автополёта ---------- */
#flightq .modal-box, #memo .modal-box { width: min(560px, calc(100vw - 28px)); }
#fq-intro p { font-size: 14.5px; line-height: 1.55; color: #dfe9fa; margin: 0 0 12px; }
#fq-intro p b { color: #fff; }
.fq-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.fq-big {
  display: block; width: 100%; text-align: left; cursor: pointer; font-family: inherit;
  color: var(--ink); background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px;
  transition: background .15s, border-color .15s;
}
.fq-big b { display: block; font-size: 15.5px; margin-bottom: 4px; }
.fq-big span { display: block; font-size: 12.5px; color: var(--ink-dim); line-height: 1.45; }
.fq-big:hover { background: rgba(126, 224, 255, 0.1); border-color: var(--accent); }
#fq-auto { background: rgba(126, 224, 255, 0.12); border-color: rgba(126, 224, 255, 0.4); }
#fq-auto:hover { background: rgba(126, 224, 255, 0.22); }
.ob-row {
  display: flex; gap: 14px; align-items: baseline; padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06); font-size: 14px;
}
.ob-row:last-of-type { border-bottom: none; }
.ob-key { flex: none; width: 150px; color: var(--accent); }
.ob-val { color: #dfe9fa; }
.ob-hint { margin-top: 12px; font-size: 13px; color: var(--ink-dim); }
.memo-buttons { display: flex; gap: 8px; margin-top: 16px; }
.memo-buttons .btn { flex: 1; font-size: 13px; padding: 9px 12px; }
#memo-manual { background: rgba(126, 224, 255, 0.16); border-color: rgba(126, 224, 255, 0.45); }
#memo-manual:hover { background: rgba(126, 224, 255, 0.28); border-color: var(--accent); }

.btn {
  background: rgba(255,255,255,0.07); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 11px; font-size: 12.5px; cursor: pointer; font-family: inherit;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.25); }
.btn-small { padding: 3px 8px; font-size: 11.5px; }

/* ---------- машина времени ---------- */
#timemachine {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  z-index: 6; width: min(680px, calc(100vw - 32px)); padding: 12px 18px 12px;
}
.tm-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.tm-label { font-size: 11px; letter-spacing: 0.18em; color: var(--accent); }
.tm-readout { font-size: 12.5px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.tm-readout b { color: var(--ink); }
.tm-sep { margin: 0 6px; opacity: 0.5; }
#tm-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; margin: 2px 0 4px; cursor: pointer; }
#tm-slider::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, #fff3dd 0%, #ffb347 30%, #45e0c8 55%, #b06bff 85%, #6a3fd8 100%);
  box-shadow: inset 0 0 4px rgba(0,0,0,.6);
}
#tm-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; margin-top: -6px;
  border-radius: 50%; background: #fff; border: 2px solid #0a1834;
  box-shadow: 0 0 10px rgba(126, 224, 255, 0.9);
}
#tm-slider::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, #fff3dd, #ffb347 30%, #45e0c8 55%, #b06bff 85%, #6a3fd8); }
#tm-slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid #0a1834; }
.tm-epochs { display: flex; gap: 8px; flex-wrap: wrap; }
.epoch { flex: 1; min-width: 150px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); color: var(--ink-dim); border-radius: 7px; padding: 5px 8px; font-size: 11.5px; cursor: pointer; font-family: inherit; }
.epoch:hover { color: var(--ink); background: rgba(255,255,255,0.1); }
.epoch.on { color: var(--ink); border-color: var(--accent); box-shadow: 0 0 8px rgba(126,224,255,.25) inset; }

/* ---------- статус ---------- */
#statusline {
  position: fixed; left: 18px; bottom: 20px; z-index: 5;
  padding: 6px 12px; font-size: 11.5px; color: var(--ink-dim); font-variant-numeric: tabular-nums;
}
#statusline .ok { color: #7fe3a8; }

/* ---------- тултип ---------- */
#tooltip {
  position: fixed; z-index: 20; pointer-events: none;
  background: rgba(8, 13, 24, 0.92); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; font-size: 12px; max-width: 260px;
  box-shadow: 0 4px 18px rgba(0,0,0,.5);
}
#tooltip .tt-cls { font-weight: 600; }
#tooltip .tt-sub { color: var(--ink-dim); margin-top: 2px; }
#tooltip .tt-hint { color: #6f7d95; margin-top: 3px; font-size: 11px; }

/* ---------- карточка объекта ---------- */
#card {
  position: fixed; top: 16px; right: 16px; bottom: 16px; z-index: 30;
  width: min(400px, calc(100vw - 24px));
  display: flex; flex-direction: column;
  animation: cardin 0.25s ease;
}
@keyframes cardin { from { transform: translateX(24px); opacity: 0; } }
.card-head { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.chip { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 10px currentColor; }
.card-titles { flex: 1; min-width: 0; }
#card-title { font-size: 15px; font-weight: 600; }
#card-name { font-size: 11.5px; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#card-close { padding: 4px 10px; font-size: 16px; line-height: 1; }
.card-scroll { overflow-y: auto; padding: 13px 14px 16px; scrollbar-width: thin; scrollbar-color: #2a3a55 transparent; }

.imgtabs { display: flex; gap: 6px; margin-bottom: 8px; }
.imgtabs button { flex: 1; background: rgba(255,255,255,0.05); border: 1px solid var(--line); color: var(--ink-dim); border-radius: 6px; padding: 4px; font-size: 11.5px; cursor: pointer; font-family: inherit; }
.imgtabs button.on { color: var(--ink); border-color: var(--accent); }
#card-imgwrap { position: relative; width: 100%; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #060a14; border: 1px solid var(--line); }
#card-imgwrap.loading::after {
  content: "получаем настоящий снимок…"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 12px; color: var(--ink-dim); background:
    linear-gradient(110deg, rgba(255,255,255,0) 30%, rgba(255,255,255,0.05) 50%, rgba(255,255,255,0) 70%) #060a14;
  background-size: 220% 100%; animation: shim 1.4s infinite;
}
@keyframes shim { to { background-position-x: -120%; } }
#card-imgwrap.failed::after { content: "снимок временно недоступен (503 у сервиса вырезок)"; animation: none; }
#card-img { width: 100%; height: 100%; object-fit: cover; display: block; }

dl#card-facts { display: grid; grid-template-columns: 42% 58%; gap: 5px 8px; margin: 12px 0 4px; font-size: 12.8px; }
dl#card-facts dt { color: var(--ink-dim); }
dl#card-facts dd { font-variant-numeric: tabular-nums; }
dl#card-facts dd.big { font-size: 14px; font-weight: 600; color: #d7ecff; }

.card-block { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.blocktitle { display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 8px; }
.blocktitle .spacer { flex: 1; }
.badge { font-size: 10px; letter-spacing: 0.06em; border: 1px solid var(--line); border-radius: 5px; padding: 1.5px 6px; color: var(--ink-dim); text-transform: none; }
.badge.warn { color: #ffd27e; border-color: rgba(255, 210, 126, 0.4); }
#spec-canvas, #p3d-canvas { width: 100%; border-radius: 8px; background: #05080f; border: 1px solid var(--line); display: block; }
.note { font-size: 11px; color: #77839a; margin-top: 6px; line-height: 1.45; }
.card-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.card-links a, .card-links button { font-size: 12px; color: var(--accent); background: none; border: 1px solid rgba(126,224,255,0.3); border-radius: 7px; padding: 5px 10px; text-decoration: none; cursor: pointer; font-family: inherit; }
.card-links a:hover, .card-links button:hover { background: rgba(126,224,255,0.1); }

/* ---------- загрузка ---------- */
#loading { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 40%, #0a1226 0%, #04060c 70%); transition: opacity 0.7s; }
#loading.hide { opacity: 0; pointer-events: none; }
.load-inner { text-align: center; max-width: 420px; padding: 20px; }
.load-inner h1 { font-size: 26px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 650;
  background: linear-gradient(90deg, #fff, #9fd8ff 55%, #c9a6ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.load-sub { color: var(--ink-dim); margin: 10px 0 26px; font-size: 13.5px; }
.load-bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.09); overflow: hidden; }
#load-fill { height: 100%; width: 0%; border-radius: 2px; background: linear-gradient(90deg, #45e0c8, #7ee0ff, #b06bff); transition: width 0.15s; box-shadow: 0 0 12px rgba(126,224,255,.7); }
.load-note { margin-top: 12px; font-size: 12px; color: #6f7d95; font-variant-numeric: tabular-nums; }

/* ---------- модалки ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(2,4,9,0.6); backdrop-filter: blur(3px); }
.modal-box { width: min(460px, calc(100vw - 30px)); max-height: calc(100vh - 60px); overflow-y: auto; padding: 18px 20px; }
.modal-box.wide { width: min(640px, calc(100vw - 30px)); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h2 { font-size: 17px; letter-spacing: 0.05em; }
table.keys { width: 100%; border-collapse: collapse; font-size: 13px; }
table.keys td { padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,0.06); }
table.keys td:first-child { color: var(--accent); font-family: ui-monospace, Consolas, monospace; font-size: 12px; white-space: nowrap; }
#about-body { font-size: 13.5px; line-height: 1.6; color: #c7d2e4; }
#about-body h3 { margin: 14px 0 6px; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); }
#about-body p { margin: 7px 0; }
#about-body a { color: var(--accent); }
#about-body .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; }
#about-body .stat { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
#about-body .stat b { display: block; font-size: 16px; }
#about-body .stat span { font-size: 11px; color: var(--ink-dim); }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; top: 24px; transform: translateX(-50%); z-index: 90;
  background: rgba(10, 20, 36, 0.95); border: 1px solid var(--accent); color: var(--ink);
  border-radius: 9px; padding: 9px 16px; font-size: 13px; box-shadow: 0 4px 20px rgba(0,0,0,.6); }

#nogl { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--bg); text-align: center; padding: 20px; }
#nogl p { color: var(--ink-dim); max-width: 420px; margin-top: 10px; line-height: 1.55; }

/* ---------- мобильная раскладка ---------- */
@media (max-width: 760px) {
  /* панель управления занимает почти всю ширину — бренд с ней сталкивался бы;
     название и так есть на сплэше и во вкладке, поэтому в углу его прячем */
  #brand { display: none; }
  #panel-right { width: auto; right: 12px; top: 12px; }
  #legend { display: none; }
  #statusline { display: none; }
  #timemachine { bottom: 10px; padding: 9px 12px; }
  .tm-epochs { display: none; }
  #tourbar { bottom: 132px; }
  #tour-caption { font-size: 14px; }
  #tour-caption.show { max-height: 200px; }
  #card { top: auto; height: 62vh; left: 8px; right: 8px; bottom: 8px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  #card { animation: none; }
}
