:root {
  --bg: #000;
  --fg: #dee2e6;
  --dim: #8a9099;
  --line: rgba(222, 226, 230, .22);
  --accent: #e8743b;
  --ui: "Jura", "Segoe UI", Roboto, Arial, sans-serif;
  --text: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); overflow: hidden; font-family: var(--text); -webkit-font-smoothing: antialiased; }
button { font-family: inherit; color: inherit; }
a { color: inherit; }

#sky { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; cursor: grab; touch-action: none; outline: none; }
#sky:active { cursor: grabbing; }

.ico { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; color: var(--fg); cursor: pointer; opacity: .85; padding: 0; }
.ico:hover, .ico.is-on { opacity: 1; color: #fff; }
.ico.is-on { color: var(--accent); }

.tools { position: fixed; z-index: 10; top: max(8px, env(safe-area-inset-top)); left: 8px; display: flex; gap: 2px; }
.topright { position: fixed; z-index: 10; top: max(8px, env(safe-area-inset-top)); right: 10px; display: flex; align-items: center; gap: 10px; transition: right .3s; }
.count { font-family: var(--ui); font-size: 13px; color: var(--dim); text-align: right; border-top: 1px solid var(--dim); padding-top: 3px; min-width: 120px; }
body.panel-open .topright { right: calc(min(600px, 44vw) + 10px); }

.time { position: fixed; z-index: 10; left: 18px; bottom: max(14px, env(safe-area-inset-bottom)); font-family: var(--ui); }
.year { font-size: 15px; font-weight: 600; letter-spacing: .3px; }
.speed { font-size: 13px; color: var(--dim); margin: 2px 0 8px; }
.tctl { display: flex; gap: 4px; margin-left: -8px; }

.tip { position: fixed; z-index: 20; pointer-events: none; max-width: 360px; padding: 8px 12px; background: rgba(0,0,0,.88); border: 1px solid var(--line); font-size: 13px; line-height: 1.35; }
.tip[hidden] { display: none; }
.tip b { display: block; font-family: var(--ui); font-weight: 600; font-size: 11px; letter-spacing: .4px; text-transform: uppercase; margin-bottom: 3px; }
.tip span { display: block; color: var(--dim); margin-top: 3px; }

/* ---------- панель ---------- */
.panel {
  position: fixed; z-index: 30; top: 0; right: 0; bottom: 0; width: min(600px, 44vw);
  background: #000; border-left: 1px solid var(--pc, var(--accent)); overflow-y: auto;
  transform: translateX(102%); transition: transform .3s ease; padding: 0 18px 40px;
}
.panel.is-open { transform: none; }
.corner { position: absolute; width: 10px; height: 10px; border-color: var(--pc, var(--accent)); border-style: solid; pointer-events: none; }
.panel .c1, .modal-box .c1 { top: 4px; left: 4px; border-width: 1px 0 0 1px; }
.panel .c2, .modal-box .c2 { top: 64px; right: 6px; border-width: 0 1px 1px 0; }
.close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; background: none; border: 0; color: var(--fg); font-size: 26px; line-height: 1; cursor: pointer; }
.close:hover { color: #fff; }

.p-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 18px 46px 16px 0; border-bottom: 1px solid var(--pc, var(--accent)); margin: 0 -18px 0 0; }
.p-head h2 { font-family: var(--ui); font-weight: 700; font-size: 26px; line-height: 1.15; margin: 0; color: #fff; }
.p-head .kind { font-family: var(--ui); font-size: 14px; color: var(--dim); white-space: nowrap; }
.p-head.long h2 { font-size: 21px; flex-basis: 100%; }

.read { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 18px; }
.read-btn { display: inline-block; background: var(--pc, var(--accent)); color: #000; text-decoration: none; font-family: var(--ui); font-weight: 700; font-size: 14px; padding: 8px 16px; }
.read-btn:hover { filter: brightness(1.15); }
.read-btn.ghost { background: none; color: var(--fg); border: 1px solid var(--pc, var(--accent)); }
.read-src { font-size: 12px; color: var(--dim); flex-basis: 100%; }
.li .pdf { color: var(--accent); font-family: var(--ui); }
.panel h3 { font-family: var(--ui); font-weight: 700; font-size: 18px; color: #fff; margin: 28px 0 10px; }
.facts { display: grid; grid-template-columns: minmax(150px, 38%) 1fr; gap: 7px 14px; font-size: 13px; }
.facts dt { color: var(--dim); }
.facts dd { margin: 0; color: var(--fg); }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 12px; text-decoration: none; margin: 0 6px 6px 0; background: rgba(255,255,255,.04); cursor: pointer; color: var(--fg); }
.pill:hover { border-color: #fff; color: #fff; }
.pill i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.gost { font-size: 13px; line-height: 1.5; color: var(--fg); border-left: 2px solid var(--pc, var(--accent)); padding: 2px 0 2px 12px; }
.copy { margin-top: 10px; background: none; border: 1px solid var(--line); color: var(--fg); padding: 5px 12px; font-family: var(--ui); font-size: 12px; cursor: pointer; }
.copy:hover { border-color: #fff; }
.warn { font-size: 13px; line-height: 1.5; color: #f3c37a; border-left: 2px solid #f3c37a; padding-left: 12px; }
.plain { font-size: 13px; line-height: 1.55; color: var(--fg); }
.list { border-top: 1px solid var(--line); }
.li { display: grid; grid-template-columns: 46px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; line-height: 1.35; }
.li:hover .lt { color: #fff; text-decoration: underline; }
.li .ly { font-family: var(--ui); color: var(--dim); }
.li .la { color: var(--dim); font-size: 12px; margin-top: 2px; }
.more { margin-top: 10px; background: none; border: 1px solid var(--line); color: var(--fg); padding: 6px 12px; font-family: var(--ui); font-size: 12px; cursor: pointer; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; border: 1px solid var(--line); }
.gallery figcaption { font-size: 11px; color: var(--dim); margin-top: 4px; line-height: 1.3; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 64px; border-bottom: 1px solid var(--line); }
.bars span { flex: 1; background: var(--pc, var(--accent)); opacity: .75; min-height: 1px; }
.bars-x { display: flex; justify-content: space-between; font-family: var(--ui); font-size: 11px; color: var(--dim); margin-top: 4px; }

/* ---------- модальные окна ---------- */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px 16px; }
.modal[hidden] { display: none; }
.modal-box { position: relative; width: min(720px, 100%); max-height: calc(100vh - 80px); overflow-y: auto; background: #000; border: 1px solid var(--line); padding: 0 22px 26px; }
.modal-box .p-head { margin-right: -22px; border-color: var(--line); }
.modal input[type=search] { width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--line); color: #fff; font-family: var(--ui); font-size: 18px; padding: 14px 0 10px; outline: none; }
.modal input[type=search]:focus { border-color: var(--accent); }
.res-h { font-family: var(--ui); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--dim); margin: 18px 0 6px; }
.chk { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; cursor: pointer; }
.chk input { accent-color: var(--accent); width: 16px; height: 16px; }
.chk i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chk small { color: var(--dim); margin-left: auto; font-family: var(--ui); }
.src li { font-size: 13px; line-height: 1.5; margin-bottom: 8px; word-break: break-word; }

@media (max-width: 760px) {
  .panel { width: 100%; top: auto; height: 74vh; border-left: 0; border-top: 1px solid var(--pc, var(--accent)); }
  body.panel-open .topright { right: 10px; }
  .p-head h2 { font-size: 21px; }
  .facts { grid-template-columns: 1fr 1.4fr; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .count { min-width: 0; font-size: 12px; }
  .modal { padding-top: 50px; }
}
