:root {
  --bg: #080b11;
  --panel: rgba(12, 16, 24, 0.82);
  --ink: #eef6fa;
  --ink-2: rgba(214, 232, 242, 0.7);
  --ink-3: rgba(214, 232, 242, 0.45);
  --holo: #62dcff;
  --hot: #ff9a3d;
  --stroke: rgba(255, 255, 255, 0.1);
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --text: "Inter", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--text); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#scene:active { cursor: grabbing; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.lbl { position: absolute; left: 0; top: 0; white-space: nowrap; font: 600 11px/1.2 var(--text); padding: 3px 7px; border-radius: 7px; background: rgba(8, 12, 18, 0.72); border: 1px solid var(--stroke); color: var(--ink); will-change: transform; pointer-events: auto; cursor: pointer; }
.lbl::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: var(--lead, 14px); background: rgba(98, 220, 255, 0.55); }
.lbl:hover, .lbl.on { border-color: var(--holo); color: var(--holo); }

.top { position: fixed; left: 16px; top: 14px; display: flex; align-items: center; gap: 14px; z-index: 5; }
.back { color: var(--ink-2); text-decoration: none; font-size: 13px; padding: 7px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--stroke); backdrop-filter: blur(8px); }
.back:hover { color: var(--ink); }
.brand { font: 800 20px/1 var(--display); letter-spacing: 0.01em; }
.brand span { display: block; margin-top: 4px; font: 500 11px var(--text); color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase; }

#parts { position: fixed; left: 16px; top: 74px; bottom: 96px; width: 208px; z-index: 4; display: flex; flex-direction: column; pointer-events: none; }
#parts-toggle { align-self: flex-start; pointer-events: auto; font: 600 11px var(--text); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); background: var(--panel); border: 1px solid var(--stroke); border-radius: 999px; padding: 6px 12px; margin-bottom: 8px; cursor: pointer; backdrop-filter: blur(8px); }
#parts-toggle:hover { color: var(--ink); }
#parts-toggle i { font-style: normal; display: inline-block; width: 1em; }
#parts.collapsed #partlist { display: none; }
#partlist { list-style: none; margin: 0; padding: 6px; overflow-y: auto; pointer-events: auto; background: var(--panel); border: 1px solid var(--stroke); border-radius: 14px; backdrop-filter: blur(8px); scrollbar-width: thin; }
#partlist button { display: flex; width: 100%; gap: 8px; align-items: baseline; text-align: left; background: none; border: 0; border-radius: 8px; padding: 6px 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
#partlist button small { margin-left: auto; white-space: nowrap; color: var(--ink-3); font-size: 10.5px; font-variant-numeric: tabular-nums; }
#partlist button:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
#partlist button.on { background: rgba(98, 220, 255, 0.14); color: var(--holo); }
#partlist button.key { color: var(--ink); font-weight: 600; }

#info { position: fixed; right: 16px; top: 14px; width: min(330px, calc(100vw - 32px)); z-index: 5; padding: 16px 18px 16px; background: var(--panel); border: 1px solid var(--stroke); border-radius: 16px; backdrop-filter: blur(10px); }
#info h2 { margin: 2px 0 8px; font: 700 19px/1.15 var(--display); }
#info p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-2); }
#info .loc { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--holo); }
#info-close { position: absolute; right: 8px; top: 6px; background: none; border: 0; font-size: 20px; color: var(--ink-3); cursor: pointer; }

#hud { position: fixed; right: 16px; bottom: 96px; width: min(320px, calc(100vw - 32px)); z-index: 4; padding: 12px 14px; background: var(--panel); border: 1px solid var(--stroke); border-radius: 16px; backdrop-filter: blur(10px); font-size: 12px; color: var(--ink-2); }
.hud-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.hud-head b { margin-right: auto; }
#hud-close { background: none; border: 0; padding: 0 2px; font-size: 18px; line-height: 1; color: var(--ink-3); cursor: pointer; }
#hud-close:hover { color: var(--ink); }
.hud-head b { font: 700 14px var(--display); color: var(--ink); }
#counts { font-variant-numeric: tabular-nums; color: var(--holo); }
.plots { display: flex; gap: 6px; align-items: stretch; }
#det2d { width: 38%; aspect-ratio: 1; border-radius: 8px; background: #000; }
#iq { width: 62%; min-width: 0; border-radius: 8px; background: rgba(0, 0, 0, 0.35); }
.seg { display: flex; gap: 4px; margin: 8px 0 6px; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.seg button { flex: 1; border: 0; background: none; border-radius: 8px; padding: 5px 0; font-size: 11.5px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: rgba(98, 220, 255, 0.18); color: var(--holo); }
#hud label { display: block; margin-top: 6px; }
#hud output { float: right; color: var(--ink); font-variant-numeric: tabular-nums; }
#hud input[type="range"] { width: 100%; margin: 3px 0 0; accent-color: var(--holo); }
.legend { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 10.5px; color: var(--ink-3); }
.legend i { flex: 1; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #a04dff, #3d6bff, #25d7e8, #3fe36d, #e9e23a, #ff8a2a, #ff3b3b); }
.hint { margin: 6px 0 0; font-size: 11px; line-height: 1.45; color: var(--ink-3); }

#actions { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); z-index: 6; display: flex; gap: 6px; padding: 6px; background: var(--panel); border: 1px solid var(--stroke); border-radius: 999px; backdrop-filter: blur(10px); max-width: calc(100vw - 16px); overflow-x: auto; }
#actions button { white-space: nowrap; border: 0; border-radius: 999px; padding: 10px 16px; font-weight: 600; font-size: 13px; background: none; color: var(--ink-2); cursor: pointer; transition: background 0.2s, color 0.2s; }
#actions button:hover { background: rgba(255, 255, 255, 0.07); color: var(--ink); }
#actions button.on { background: rgba(98, 220, 255, 0.16); color: var(--holo); }
#btn-explode, #btn-beam, #btn-tour { color: var(--ink) !important; }
#btn-tour.on { background: #7dffb2 !important; color: #062012 !important; }
#caption { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 6; margin: 0; width: min(560px, calc(100vw - 24px)); padding: 12px 16px; text-align: center; font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--panel); border: 1px solid rgba(125, 255, 178, 0.35); border-radius: 14px; backdrop-filter: blur(10px); }
#btn-explode.on { background: var(--hot) !important; color: #1a0d00 !important; }
#btn-beam.on { background: var(--holo) !important; color: #03222c !important; }

#loader { position: fixed; inset: 0; z-index: 20; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--bg); color: var(--ink-2); font-size: 13px; transition: opacity 0.5s; }
#loader.gone { opacity: 0; pointer-events: none; }
.ring { width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(98, 220, 255, 0.2); border-top-color: var(--holo); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
  .brand span { display: none; }
  #parts { top: 60px; bottom: auto; width: 190px; max-height: 46vh; }
  #info { top: 104px; right: 8px; left: 8px; width: auto; }
  #hud { right: 8px; bottom: 104px; width: 230px; padding: 10px; }
  #hud .hint, #hud label:has(#rs) { display: none; }
  #actions { bottom: 40px; }
  #actions button { padding: 9px 12px; font-size: 12px; }
}

#hide-menu { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 7; width: 270px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--stroke); border-radius: 14px; backdrop-filter: blur(10px); font-size: 13px; color: var(--ink-2); }
#hide-menu b { display: block; margin-bottom: 6px; font: 700 13px var(--display); color: var(--ink); }
#hide-menu label { display: flex; align-items: center; gap: 8px; padding: 5px 0; cursor: pointer; }
#hide-menu input { accent-color: var(--holo); width: 15px; height: 15px; margin: 0; }
#hide-all { margin-top: 8px; width: 100%; border: 1px solid var(--stroke); border-radius: 8px; padding: 6px; background: rgba(255, 255, 255, 0.05); font-size: 12px; color: var(--ink-2); cursor: pointer; }
#hide-all:hover { color: var(--ink); }
#partlist button.off span { text-decoration: line-through; opacity: 0.5; }

#tof { position: fixed; left: 16px; bottom: 96px; width: min(440px, calc(100vw - 32px)); z-index: 4; padding: 12px 14px; background: var(--panel); border: 1px solid var(--stroke); border-radius: 16px; backdrop-filter: blur(10px); font-size: 12px; color: var(--ink-2); }
#tofplot { display: block; width: 100%; aspect-ratio: 3 / 2; border-radius: 8px; background: rgba(0, 0, 0, 0.4); }
#tof-close { background: none; border: 0; padding: 0 2px; font-size: 18px; line-height: 1; color: var(--ink-3); cursor: pointer; }
#tof-close:hover { color: var(--ink); }
@media (max-width: 820px) {
  #tof { left: 8px; right: 8px; bottom: 104px; width: auto; padding: 10px; }
  #tof .hint { display: none; }
}

/* SNS site landing view */
#sitelabels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; display: none; }
.site-lbl { background: rgba(8, 12, 18, 0.78); transition: opacity 0.3s; }
.site-lbl.on { cursor: pointer; font-size: 12.5px; padding: 5px 10px; }
.site-lbl:not(.on) { pointer-events: none; }
#fade { position: fixed; inset: 0; z-index: 3; background: var(--bg); opacity: 0; pointer-events: none; transition: opacity 0.4s; }
#fade.on { opacity: 1; }
#landing { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 6; width: min(560px, calc(100vw - 24px)); padding: 18px 22px 16px; text-align: center; background: var(--panel); border: 1px solid var(--stroke); border-radius: 20px; backdrop-filter: blur(12px); transition: opacity 0.5s, transform 0.5s; display: none; }
#landing.gone { opacity: 0; transform: translate(-50%, 20px); pointer-events: none; }
#landing .loc { margin: 0; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--holo); }
#landing h1 { margin: 4px 0 8px; font: 800 30px/1.1 var(--display); }
#landing p { margin: 0 0 14px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
#landing small { display: block; margin-top: 12px; font-size: 11px; color: var(--ink-3); }
.landing-actions { display: flex; justify-content: center; gap: 10px; }
#btn-dive { border: 0; border-radius: 999px; padding: 12px 22px; font-weight: 700; font-size: 15px; background: var(--holo); color: #03222c; cursor: pointer; }
#btn-dive:hover { filter: brightness(1.1); }
#btn-site { cursor: pointer; }
body.site #landing { display: block; }
body.site #sitelabels { display: block; }
body.site #labels, body.site #parts, body.site #actions, body.site #hud, body.site #tof, body.site #info, body.site #hide-menu, body.site #caption, body.site #btn-site, body.site .brand { display: none !important; }
@media (max-width: 820px) {
  #landing { bottom: 42px; padding: 14px 16px; }
  #landing h1 { font-size: 23px; }
  #landing p { font-size: 12.5px; }
}

/* disclaimer strip: the model is approximate, not a CAD drawing or a survey */
#disclaimer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; display: flex; align-items: center; gap: 16px; margin: 0; padding: 5px 16px 6px; text-align: center; font-size: 11px; line-height: 1.35; color: var(--ink-2); background: var(--panel); border-top: 1px solid var(--stroke); backdrop-filter: blur(8px); pointer-events: none; }
#disclaimer p { margin: 0; flex: 1; }
#disclaimer .credit { flex: none; text-align: right; color: var(--ink); font-weight: 600; white-space: nowrap; }
#disclaimer i { font-style: normal; }
#disclaimer b { color: #ffcf6b; font-weight: 600; margin-right: 4px; }
#disclaimer .d-site { display: none; }
body.site #disclaimer .d-site { display: inline; }
body.site #disclaimer .d-inst { display: none; }
@media (max-width: 1400px) { #disclaimer i { display: none; } }   /* keep the note on one line */
@media (max-width: 720px) {
  #disclaimer { flex-direction: column; gap: 1px; font-size: 10px; padding: 4px 8px; } #disclaimer i { display: none; }
  #disclaimer .credit { text-align: center; }
  #actions { bottom: 52px !important; } #landing { bottom: 54px !important; }
  #hud, #tof { bottom: 116px !important; }
}
