/* Orbital Lab. Same palette and type as the rest of the boards. */

:root {
  --bg: #121a21; --panel: #141d25; --edge: #2b3945; --edge2: #34506a;
  --ink: #e7eef3; --dim: #8a99a5; --faint: #7f909c;
  --blue: #8fd8ff; --amber: #f4a63a; --amber2: #ffc76b; --rose: #e86a85;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
  --sans: 'IBM Plex Sans', Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", Palatino, "Book Antiqua", Georgia, serif;
  --gutter: clamp(12px, 2vw, 24px);
}

* { box-sizing: border-box; }
/* Several rules below set `display` on elements that are also toggled with the hidden
   attribute, and an author rule beats the user-agent one. Keep hidden controls hidden. */
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); }
body {
  font-family: var(--sans); color: var(--ink); -webkit-font-smoothing: antialiased;
  background: radial-gradient(120% 110% at 50% -12%, #223038 0%, #18212a 46%, #121a21 100%);
  min-height: 100vh; padding: var(--gutter) clamp(12px, 2.2vw, 28px) 30px;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--amber); }
.wrap { max-width: 1640px; margin: 0 auto; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.brand { font: 600 20px var(--sans); letter-spacing: -.045em; color: var(--ink); line-height: 1; }
.brand::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 7px; border-radius: 50%; background: var(--amber); vertical-align: .2em; box-shadow: 0 0 10px #f4a63a66; }
.title-row { margin: 29px 0 23px; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .18em; color: var(--blue); text-transform: uppercase; margin-bottom: 9px; }
h1 { margin: 0; font-size: clamp(30px, 3.3vw, 48px); font-weight: 500; letter-spacing: -.045em; line-height: 1; }
.back { display: flex; align-items: center; gap: 22px; font-size: 13px; }
.back a { color: var(--ink); }
.back a:hover { color: var(--blue); }
.back .language { font-family: var(--mono); color: var(--blue); }
.topbar a:focus-visible { outline: 2px solid var(--amber); outline-offset: 4px; }
@media (max-width: 760px) { .title-row { margin: 24px 0 17px; } }
@media (max-width: 420px) { .back { font-size: 11px; gap: 10px; } .brand { font-size: 17px; } }
html[lang="ru"] .eyebrow { letter-spacing: .16em; }
html[lang="ru"] .cap, html[lang="ru"] .chips button { letter-spacing: .05em; }

/* ---------------- layout ---------------- */

.board { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .board { grid-template-columns: 215px minmax(0, 1fr); } }
@media (min-width: 1450px) { .board { grid-template-columns: 215px minmax(0, 1fr) 320px; } }

.rail, .panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

@media (max-width: 1099px) {
  .stage { order: 1; }
  .rail { order: 2; flex-direction: row; overflow-x: auto; gap: 10px; padding-bottom: 4px; scrollbar-width: thin; }
  .rail .group { flex: 0 0 240px; }
  .panel { order: 3; }
}
@media (min-width: 1100px) and (max-width: 1449px) {
  .panel { order: 3; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
}
.stage { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

.timebar { flex: 0 0 auto; }

.block, .group {
  border: 1px solid var(--edge); border-radius: 10px; background: var(--panel); padding: 11px 12px 12px;
}
.cap {
  font-family: var(--mono); font-size: 10px; letter-spacing: .17em; color: var(--faint);
  text-transform: uppercase; margin-bottom: 8px; display: flex; justify-content: space-between; gap: 8px;
}
.cap span { color: var(--amber2); text-transform: none; letter-spacing: .04em; }
.cap span.hot { color: var(--rose); }

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

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
button {
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--ink);
  background: transparent; border: 1px solid var(--edge); border-radius: 999px; padding: 6px 11px;
  cursor: pointer; transition: border-color .18s, background .18s, color .18s;
}
button:hover { border-color: var(--edge2); background: rgba(143, 216, 255, .07); }
button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
button.on { border-color: var(--amber); color: var(--amber); }
.chips button { width: 100%; text-align: left; }

/* ---------------- canvas ---------------- */

.canvas-wrap {
  position: relative; border: 1px solid var(--edge); border-radius: 10px; overflow: hidden;
  background: #0b1016; height: clamp(380px, 62vh, 760px);
}
canvas#sky {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none;
}
canvas#sky:active { cursor: grabbing; }

/* Reserve the real header/title height before distributing the remaining viewport.
   The canvas absorbs size changes; controls keep their readable natural height.
   Short or narrow windows retain normal page scrolling. */
@media (min-width: 1100px) and (min-height: 640px) {
  body { min-height: 100dvh; padding-bottom: var(--gutter); }
  .wrap {
    height: calc(100vh - var(--gutter) * 2);
    height: calc(100dvh - var(--gutter) * 2);
    display: grid; grid-template-rows: auto auto minmax(0, 1fr);
  }
  .title-row { margin: 20px 0 18px; }
  .board {
    min-height: 0; grid-template-rows: minmax(0, 1fr);
    grid-template-columns: clamp(160px, 13.5vw, 215px) minmax(0, 1fr) clamp(300px, 22vw, 320px);
  }
  .board > .rail, .board > .panel {
    order: initial; grid-column: auto; display: flex; align-items: stretch;
    min-height: 0; overflow-y: auto; overscroll-behavior-y: contain;
    scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: var(--edge2) var(--panel);
    padding: 2px 6px 2px 2px;
  }
  .rail > .group, .panel > .block { flex-shrink: 0; }
  .stage { height: 100%; min-height: 0; }
  .canvas-wrap { height: auto; flex: 1 1 auto; min-height: 0; }
}
@media (min-width: 1100px) and (min-height: 640px) and (max-height: 800px) {
  .title-row { margin: 16px 0 14px; }
  h1 { font-size: clamp(30px, 3.3vw, 40px); }
  .eyebrow { margin-bottom: 7px; }
}
.drag-hint {
  position: absolute; right: 10px; bottom: 8px; font-family: var(--mono); font-size: 10px;
  letter-spacing: .08em; color: #4f5e6a; pointer-events: none;
}
.badges { position: absolute; left: 10px; top: 10px; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; pointer-events: none; }
.badge {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid var(--edge2); border-radius: 999px; padding: 3px 9px; color: var(--dim);
  background: rgba(10, 16, 21, .7);
}
.badge.warn { border-color: var(--amber); color: var(--amber2); }

/* ---------------- the time bar ---------------- */

.timebar {
  display: grid; gap: 12px 16px; align-items: center; grid-template-columns: auto 1fr;
  border: 1px solid var(--edge); border-radius: 10px; background: var(--panel); padding: 11px 14px;
}
@media (min-width: 760px) { .timebar { grid-template-columns: auto minmax(220px, 1.2fr) minmax(220px, 1fr); } }
@media (max-width: 759px) {
  .timebar { grid-template-columns: 42px minmax(0, 1fr); gap: 10px; }
  .timebar .readout { grid-column: 1 / -1; }
  .timebar .slider label { flex-wrap: wrap; gap: 4px 8px; }
  .drag-hint { left: 10px; bottom: 30px; line-height: 1.5; }
}

.play {
  width: 30px; height: 30px; padding: 0; border-radius: 50%; color: var(--dim);
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.play svg { width: 11px; height: 11px; fill: currentColor; }
.play.paused { border-color: var(--amber); color: var(--amber); background: rgba(244, 166, 58, .12); }

.slider label {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--faint); margin-bottom: 6px;
}
.slider label b { font-weight: 500; color: var(--amber2); font-size: 12px; letter-spacing: .03em; }
.slider label i {
  font-style: normal; font-size: 9px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--faint); border: 1px solid var(--edge); border-radius: 999px; padding: 1px 7px;
}
.ends { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 9px; letter-spacing: .12em; color: #4f5e6a; margin-top: 3px; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 16px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 3px; background: #26323d; border-radius: 2px; }
input[type=range]::-moz-range-track { height: 3px; background: #26323d; border-radius: 2px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -5px; border-radius: 50%; background: var(--amber); border: none; transition: background .2s, box-shadow .2s; }
input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border: none; border-radius: 50%; background: var(--amber); transition: background .2s; }
input[type=range]:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }

/* Ghosted, not disabled. It keeps every affordance -- pointer, focus ring, arrow keys --
   and only looks like it is not yet speaking for what is on screen. Hovering brings it
   most of the way back, so there is no doubt it can be taken. */
.slider.ghost { opacity: .52; transition: opacity .25s; }
.slider.ghost:hover, .slider.ghost:focus-within { opacity: .85; }
.slider.ghost input[type=range]::-webkit-slider-thumb { background: transparent; box-shadow: inset 0 0 0 1.5px var(--dim); }
.slider.ghost input[type=range]::-moz-range-thumb { background: transparent; box-shadow: inset 0 0 0 1.5px var(--dim); }
.slider.ghost label b { color: var(--dim); }

.readout { font-family: var(--mono); font-size: 11px; letter-spacing: .05em; color: var(--faint); line-height: 1.65; }
.readout b { display: block; font-weight: 500; font-size: 12.5px; color: var(--ink); letter-spacing: .03em; }
.readout span { color: var(--amber2); }
.readout em { display: block; font-style: normal; font-size: 10px; color: #5f6f7b; margin-top: 2px; line-height: 1.45; }
#turn-reading, #compression-reading { display: block; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------------- the side panel ---------------- */

.toggles { display: flex; flex-direction: column; gap: 6px; }
.tgl { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: var(--dim); cursor: pointer; }
.tgl input { accent-color: var(--amber); width: 13px; height: 13px; }
.tgl:hover { color: var(--ink); }

.slider.small { margin-top: 10px; }
.slider.small label { font-size: 10px; }
.note { font-family: var(--mono); font-size: 10px; line-height: 1.55; color: #647480; margin: 7px 0 0; }

dl { display: grid; gap: 6px; margin: 0; font-family: var(--mono); font-size: 10.5px; letter-spacing: .02em; }
/* A changing number must not resize the label column and make either column wrap.
   Eighteen mono characters hold the existing scientific notation and its units. */
.fact-row { display: grid; grid-template-columns: minmax(0, 1fr) 18ch; column-gap: 10px; align-items: baseline; line-height: 1.5; }
dt { color: var(--faint); min-width: 0; }
dd { margin: 0; color: var(--ink); text-align: right; }
.fact-value { white-space: nowrap; font-variant-numeric: tabular-nums; }
.fact-note { grid-column: 1 / -1; min-block-size: 1.5em; color: var(--dim); }

.eq { font-family: var(--serif); font-size: 17px; color: var(--ink); line-height: 1.9; }
.eq i { font-style: italic; }
.eq sup { font-size: .62em; vertical-align: super; line-height: 0; }
.eq .sep { color: var(--faint); }
.fr { display: inline-flex; flex-direction: column; text-align: center; vertical-align: middle; font-size: 14.5px; line-height: 1.25; margin: 0 3px; }
.fr .nu { padding: 0 5px 1px; border-bottom: 1px solid #55636e; }
.fr .de { padding: 1px 5px 0; }
.eq-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 12px; font-family: var(--mono); font-size: 10.5px; color: var(--dim); line-height: 1.75; margin-top: 7px; font-variant-numeric: tabular-nums; }
.eq-value { white-space: nowrap; }
.eq-formula { grid-column: 1 / -1; white-space: nowrap; }
.eq-values i { font-family: var(--serif); font-style: italic; font-size: 12px; }
.rad { border-top: 1px solid #55636e; padding: 0 2px; }

.viewbtns { display: flex; gap: 6px; margin-top: 10px; }
.viewbtns button { flex: 1 1 0; min-width: 0; }

#reset-all { margin-top: 10px; width: 100%; }

.boot-message { font-family: var(--mono); font-size: 12px; color: var(--dim); letter-spacing: .08em; padding: 40px 0; text-align: center; }

/* The composition is edited as a draft; the sky changes only after applying it. */
.scene-tools {
  flex: 0 0 auto; padding: 12px; border: 1px solid var(--edge); border-radius: 10px;
  background: var(--panel); min-width: 0;
}
.scene-heading, .group-actions, .focus-actions, .picker-bulk, .picker-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
}
.scene-heading { justify-content: space-between; }
#scene-title { font-size: 1rem; color: var(--ink); }
.scene-tools button, .group-picker button { font-size: .875rem; letter-spacing: 0; min-height: 40px; }
#select-objects, #apply-selection { border-color: var(--blue); color: var(--blue); }
.focus-controls { border-top: 1px solid var(--edge); padding-top: 10px; margin-top: 10px; }
.focus-controls label { display: block; font-size: .875rem; color: var(--dim); margin-bottom: 7px; }
.focus-actions select {
  flex: 1 1 180px; width: 100%; min-width: 0; max-width: 320px;
  font: 400 1rem var(--sans); color: var(--ink); color-scheme: dark;
  background: #18212a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%238fd8ff' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--edge2); border-radius: 6px; padding: 9px 32px 9px 10px;
  appearance: none;
}
.focus-actions select:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.group-picker {
  width: min(720px, calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 32px);
  padding: 0; color: var(--ink); background: var(--panel);
  border: 1px solid var(--edge2); border-radius: 14px; box-shadow: 0 20px 80px #0009;
}
.group-picker[open] { display: flex; flex-direction: column; }
.group-picker::backdrop { background: #060b11c9; }
.picker-heading { padding: 20px 20px 14px; flex: 0 0 auto; }
.picker-heading h2 { margin: 0 0 8px; font-weight: 400; font-size: 1.4rem; }
.picker-heading p { margin: 0 0 12px; color: var(--dim); font-size: 1rem; line-height: 1.5; }
.picker-catalogue { overflow-y: auto; min-height: 0; padding: 0 20px 20px; overscroll-behavior: contain; }
.picker-catalogue fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.picker-catalogue fieldset:last-child { margin-bottom: 0; }
.picker-catalogue legend { padding: 8px 0 10px; font-size: 1rem; color: var(--dim); }
.object-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.object-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px;
  border: 1px solid var(--edge); border-radius: 8px; background: #101820;
  padding: 20px 8px 12px; font-size: .875rem; line-height: 1.35; text-align: center; cursor: pointer;
}
.object-tile:hover { border-color: var(--edge2); }
.object-tile:has(input:checked) { border-color: var(--amber); background: #f4a63a12; }
.object-tile:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.object-tile input { position: absolute; top: 7px; right: 7px; width: 18px; height: 18px; accent-color: var(--amber); margin: 0; }
.planet-swatch { width: 28px; height: 28px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, var(--body-colour) 15%, #091018 95%); }
.picker-footer { padding: 14px 20px; border-top: 1px solid var(--edge); flex: 0 0 auto; }
#selection-count { display: block; margin-bottom: 10px; color: var(--dim); font-size: .875rem; }
.picker-actions { justify-content: flex-end; }
.group-picker button:disabled { opacity: .4; cursor: not-allowed; }
@media (max-width: 520px) {
  .object-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .picker-heading { padding: 14px 12px 10px; }
  .picker-catalogue { padding: 0 12px 14px; }
  .picker-footer { padding: 12px; }
  .picker-actions button { flex: 1 1 auto; }
  .focus-actions select { max-width: none; flex-basis: 100%; }
}

/* Touch screens: 13px thumbs and 30px circles are fine under a cursor, fiddly under one. */
@media (pointer: coarse) {
  input[type=range] { height: 38px; }
  input[type=range]::-webkit-slider-thumb { width: 19px; height: 19px; margin-top: -8px; }
  input[type=range]::-moz-range-thumb { width: 19px; height: 19px; }
  .play { width: 42px; height: 42px; }
  .chips button { padding: 11px 13px; }
  .tgl input { width: 18px; height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .slider.ghost, input[type=range]::-webkit-slider-thumb { transition: none; }
}
