:root {
  --bg: #07080b;
  --glass: rgba(14, 16, 22, 0.74);
  --glass-hi: rgba(28, 32, 42, 0.86);
  --line: rgba(255, 255, 255, 0.09);
  --line-hi: rgba(255, 255, 255, 0.18);
  --text: #eef1f6;
  --muted: #98a1b0;
  --accent: #3a6bff;
  --accent2: #ffc72c;
  --accent3: #e4002b;
  --radius: 14px;
  --font: 'Titillium Web', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; outline: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.ui { transition: opacity 0.5s ease, transform 0.5s ease; }
body.film .ui { opacity: 0; pointer-events: none; }
body.record *, body.record *::before { transition: none !important; animation: none !important; }

/* ——— brand */
.brand { position: fixed; left: 24px; top: 18px; text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6); }
.kicker { font-size: 11.5px; letter-spacing: 0.24em; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.kicker .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent3); box-shadow: 0 0 12px var(--accent3); }
.brand h1 { margin: 2px 0 0; font-size: 58px; line-height: 0.95; font-weight: 900; font-style: italic; letter-spacing: -0.01em; }
.brand .sub { font-size: 15px; font-weight: 600; color: #dfe4ec; margin-top: 4px; }
.brand-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.brand .pu { display: inline-block; margin-top: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent2); border: 1px solid color-mix(in srgb, var(--accent2) 45%, transparent); padding: 3px 9px; border-radius: 999px; background: rgba(0, 0, 0, 0.3); }
.seg { display: inline-grid; grid-auto-flow: column; gap: 3px; background: rgba(0, 0, 0, 0.45); padding: 3px; border-radius: 10px; border: 1px solid var(--line); }
.seg-btn { background: transparent; border: 0; border-radius: 7px; padding: 5px 14px; font-weight: 800; font-size: 14px; color: var(--muted); }
.seg-btn.on { background: var(--glass-hi); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-hi); }
.seg-btn:hover { color: var(--text); }
.chip-btn { background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; font-weight: 700; font-size: 13px; color: #d6dce6; }
.chip-btn:hover { border-color: var(--line-hi); color: #fff; }

/* ——— systems panel */
.systems { position: fixed; left: 20px; top: 214px; width: 272px; max-height: calc(100vh - 214px - 120px); overflow: auto; padding: 10px; border-radius: var(--radius); background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4); scrollbar-width: thin; }
.sys-top { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 8px; font-size: 13px; color: var(--muted); }
.sys-top b { color: var(--text); font-size: 14px; letter-spacing: 0.02em; margin-right: 4px; }
.mini { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 7px; padding: 3px 9px; font-size: 12px; font-weight: 700; color: #cfd6e0; }
.mini:hover { color: #fff; border-color: var(--line-hi); }
.sys-row { display: flex; align-items: center; gap: 8px; padding: 7px 6px; border-radius: 8px; }
.sys-row:hover { background: rgba(255, 255, 255, 0.05); }
.sys-row .name { flex: 1; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; text-align: left; font-size: 14px; font-weight: 700; color: #e3e8ef; }
.sys-row .name i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.sys-row .name .chev { margin-left: auto; opacity: 0.45; transition: transform 0.2s; width: 14px; height: 14px; }
.sys-row.open .name .chev { transform: rotate(90deg); }
.sys-row .n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 18px; text-align: right; }
.sys-row.off .name { color: #6f7887; }
.switch { position: relative; width: 30px; height: 18px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); border: 0; padding: 0; flex: none; transition: background 0.2s; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.switch[aria-checked='true'] { background: var(--accent); }
.switch[aria-checked='true']::after { transform: translateX(12px); }
.sys-parts { padding: 2px 0 6px 20px; }
.part-item { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 4px 8px; font-size: 13px; font-weight: 600; color: #c4ccd8; }
.part-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.part-item.on { background: color-mix(in srgb, var(--accent) 30%, transparent); color: #fff; }

/* ——— search */
.search { position: fixed; top: 20px; right: 92px; width: 300px; display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 42px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); color: var(--muted); }
.search:focus-within { border-color: color-mix(in srgb, var(--accent) 70%, transparent); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 14.5px; color: var(--text); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd { font: 700 11px var(--font); border: 1px solid var(--line-hi); border-radius: 5px; padding: 1px 6px; color: var(--muted); }
.results { position: absolute; left: 0; right: 0; top: 48px; max-height: 50vh; overflow: auto; padding: 6px; border-radius: 12px; background: #10131a; border: 1px solid var(--line-hi); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); }
.result { display: flex; width: 100%; align-items: center; gap: 8px; text-align: left; background: none; border: 0; border-radius: 8px; padding: 7px 9px; font-size: 14px; font-weight: 600; color: #dfe5ee; }
.result i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.result small { margin-left: auto; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.result.active, .result:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.results .empty { padding: 8px 10px; color: var(--muted); font-size: 13px; }

/* ——— tool strip */
.tools { position: fixed; top: 20px; right: 16px; width: 64px; display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.tool { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px 6px; border-radius: 11px; border: 1px solid transparent; background: none; color: #c3cad6; font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em; }
.tool svg { width: 20px; height: 20px; }
.tool:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.tool[aria-pressed='true'] { background: color-mix(in srgb, var(--accent) 26%, transparent); border-color: color-mix(in srgb, var(--accent) 60%, transparent); color: #fff; }
.mobile-only { display: none; }

/* ——— part card */
.card { position: fixed; right: 92px; top: 76px; width: 360px; max-height: calc(100vh - 76px - 130px); overflow: auto; padding: 18px 20px 16px; background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); animation: rise 0.35s ease; scrollbar-width: thin; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.chip { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; border: 1px solid currentColor; }
.count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 26px; }
.card h2 { margin: 10px 0 6px; font-size: 25px; line-height: 1.08; font-weight: 900; }
.card p { margin: 0 0 12px; color: #d3d9e3; font-size: 14.5px; line-height: 1.45; }
.card dl { margin: 0 0 12px; display: grid; grid-template-columns: auto 1fr; font-size: 13.5px; }
.card dt, .card dd { padding: 6px 0; border-top: 1px solid var(--line); margin: 0; }
.card dt { color: var(--muted); padding-right: 14px; font-weight: 600; }
.card dd { font-weight: 700; }
.fact { font-size: 13.5px; line-height: 1.45; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); border-left: 3px solid var(--accent2); color: #d8dde6; }
.fact b { color: var(--accent2); }
.card-actions { display: flex; gap: 6px; margin-top: 12px; }
.card-actions button { flex: 1; padding: 8px; border-radius: 9px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); font-weight: 800; }
.card-actions .toggle { flex: 2; }
.card-actions .toggle[aria-pressed='true'] { border-color: color-mix(in srgb, var(--accent) 70%, transparent); background: color-mix(in srgb, var(--accent) 22%, rgba(0, 0, 0, 0.3)); }
.close { position: absolute; right: 10px; top: 8px; width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; }
.close:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }

/* ——— bottom dock */
.dock { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); width: min(620px, calc(100vw - 32px)); display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }
.play { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000)); box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 40%, transparent); color: #fff; }
.play svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.play:hover { filter: brightness(1.12); }
.dock-main { flex: 1; min-width: 0; }
.dock-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 800; letter-spacing: 0.04em; }
.dock-ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-weight: 600; margin-top: -2px; }
.val { color: var(--text); font-variant-numeric: tabular-nums; }
.reset { width: 38px; height: 38px; flex: none; border-radius: 11px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.3); display: grid; place-items: center; color: #c9d0db; }
.reset:hover { color: #fff; border-color: var(--line-hi); }

input[type='range'] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; }
input[type='range']::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) var(--p, 0%), rgba(255, 255, 255, 0.14) var(--p, 0%)); }
input[type='range']::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.14); }
input[type='range']::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 40%, transparent); }
input[type='range']::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 40%, transparent); }

/* ——— aero HUD (above the dock) */
.hud { position: fixed; left: 50%; bottom: 106px; transform: translateX(-50%); display: flex; align-items: stretch; gap: 2px; padding: 8px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 32px); }
.hud-cell { padding: 4px 12px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; font-variant-numeric: tabular-nums; }
.hud-cell small { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.hud-cell small i { font-style: normal; letter-spacing: 0.02em; text-transform: none; opacity: 0.8; }
.hud-cell b { font-size: 16px; font-weight: 800; }
.hud-cell.big b { font-size: 26px; font-weight: 900; font-style: italic; }
.hud-cell.speed { border-right: 0; min-width: 190px; }
.hud-cell.speed small b { font-size: 11px; color: var(--text); letter-spacing: 0.06em; }
.hud-note { width: 100%; text-align: center; font-size: 12px; color: var(--accent2); font-weight: 600; padding-top: 2px; }

/* ——— compare modal */
.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(3, 4, 6, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 20; }
.modal-card { position: relative; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; padding: 22px 24px; background: #0e1016; border: 1px solid var(--line-hi); border-radius: 16px; }
.modal-card h2 { margin: 0 0 12px; font-size: 28px; font-weight: 900; font-style: italic; }
.modal-card table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.modal-card th, .modal-card td { text-align: left; padding: 9px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.modal-card th { color: var(--muted); font-weight: 600; width: 26%; }
.modal-card thead td { font-weight: 900; font-size: 18px; border-top: 0; }
.modal-card td.diff { color: var(--accent2); }
.modal-note { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }

/* ——— labels / tip */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.lbl { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); white-space: nowrap; font-size: 12px; font-weight: 700; padding: 3px 8px 3px 16px; border-radius: 999px; background: rgba(8, 10, 14, 0.74); border: 1px solid var(--line-hi); color: #e9edf3; opacity: 0; transition: opacity 0.25s; will-change: transform, opacity; pointer-events: auto; cursor: pointer; }
.lbl::before { content: ''; position: absolute; left: 6px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--c, #fff); }
.lbl.show { opacity: 1; }
.lbl.sel { background: var(--accent); border-color: transparent; }
.tip { position: fixed; left: 0; top: 0; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: rgba(8, 10, 14, 0.9); border: 1px solid var(--line-hi); font-size: 13px; font-weight: 700; opacity: 0; transform: translate(14px, 14px); white-space: nowrap; z-index: 10; }
.tip small { display: block; font-weight: 600; color: var(--muted); font-size: 11px; }
.tip.show { opacity: 1; }

.hint { position: fixed; left: 50%; top: 22px; transform: translateX(-50%); font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; pointer-events: none; }
.foot { position: fixed; right: 16px; bottom: 12px; font-size: 11px; color: #6f7888; display: flex; gap: 6px; max-width: 30vw; text-align: right; justify-content: flex-end; flex-wrap: wrap; }
.foot b { color: #c9d0db; }
.film-caption { position: fixed; left: 50%; bottom: 9vh; transform: translateX(-50%); font-size: clamp(22px, 3.4vw, 46px); font-weight: 900; font-style: italic; text-align: center; opacity: 0; transition: opacity 0.6s; text-shadow: 0 4px 30px rgba(0, 0, 0, 0.8); pointer-events: none; max-width: 90vw; }
.film-caption small { display: block; font-size: 0.42em; font-style: normal; font-weight: 700; letter-spacing: 0.2em; color: var(--accent2); }
body.film .film-caption.show { opacity: 1; }

.loader { position: fixed; inset: 0; display: grid; place-content: center; gap: 14px; background: var(--bg); z-index: 50; transition: opacity 0.6s; text-align: center; color: var(--muted); font-weight: 600; letter-spacing: 0.08em; }
.loader.done { opacity: 0; pointer-events: none; }
.loader .bar { width: 240px; height: 3px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; overflow: hidden; }
.loader .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.3s; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; }

@media (max-width: 1180px) {
  .foot { display: none; }
  .hint { display: none; }
}

/* ——— phones */
@media (max-width: 820px) {
  .brand { left: 14px; top: 10px; }
  .brand h1 { font-size: 36px; }
  .brand .sub { font-size: 12.5px; }
  .brand .pu { display: none; }
  .brand-row { margin-top: 6px; }
  .search { top: auto; bottom: 150px; left: 12px; right: 12px; width: auto; height: 40px; }
  .search kbd { display: none; }
  .results { top: auto; bottom: 46px; }
  .tools { top: auto; bottom: 94px; left: 12px; right: 12px; width: auto; flex-direction: row; justify-content: space-between; padding: 4px; border-radius: 14px; }
  .tool { flex: 1; padding: 6px 0 4px; }
  .mobile-only { display: flex; }
  .systems { display: none; left: 12px; right: 12px; top: auto; bottom: 200px; width: auto; max-height: 48vh; }
  body.show-systems .systems { display: block; }
  .card { left: 12px; right: 12px; width: auto; top: auto; bottom: 200px; max-height: 44vh; padding: 14px 16px 12px; }
  .card h2 { font-size: 21px; }
  .card p { font-size: 14px; }
  .dock { bottom: 12px; padding: 8px 10px; }
  .dock-ends { display: none; }
  .hud { bottom: 200px; padding: 6px; }
  .hud-cell { padding: 2px 8px; }
  .hud-cell.big b { font-size: 20px; }
  .hud-cell.speed { min-width: 140px; }
}
