/* Stardust. Three themes: pitch dark (default), bookish and light. */
:root {
  color-scheme: dark;
  --ground: #000000;
  --surface: rgba(16, 16, 18, 0.92);
  --surface-solid: #111113;
  --raised: #1c1c20;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #ededee;
  --muted: #a1a1a8;
  --faint: #6b6b73;
  --accent: #f2b84b;
  --accent-ink: #1a1204;
  --accent-soft: rgba(242, 184, 75, 0.14);
  --good: #5fd39a;
  --bad: #ff6b6b;
  --screen: #050506;
  --tile-bg: rgba(20, 20, 22, 0.92);
  --tile-ink: #ffffff;
  --tile-glow: 0.22;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  --blur: blur(14px);
  --radius: 12px;
  --display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --body: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --data: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --top: calc(60px + env(safe-area-inset-top, 0px));
  --ease: cubic-bezier(.2, .8, .2, 1);
}
:root[data-theme="bookish"] {
  color-scheme: light;
  --ground: #efe7d6;
  --surface: rgba(248, 243, 231, 0.94);
  --surface-solid: #f8f3e7;
  --raised: #ebe1cb;
  --line: rgba(74, 52, 24, 0.16);
  --line-strong: rgba(74, 52, 24, 0.3);
  --text: #2a2016;
  --muted: #6e5d46;
  --faint: #9a8a70;
  --accent: #8e3b1f;
  --accent-ink: #fbf5e8;
  --accent-soft: rgba(142, 59, 31, 0.1);
  --good: #2f7d4f;
  --bad: #b23a2a;
  --screen: #1c1712;
  --tile-bg: rgba(251, 247, 238, 0.97);
  --tile-ink: #2a2016;
  --tile-glow: 0.08;
  --shadow: 0 18px 50px rgba(60, 40, 10, 0.22);
  --body: 'Source Serif 4', 'Iowan Old Style', Georgia, serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --ground: #f4f5f7;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-solid: #ffffff;
  --raised: #eef0f3;
  --line: rgba(15, 23, 42, 0.1);
  --line-strong: rgba(15, 23, 42, 0.22);
  --text: #111827;
  --muted: #555e6e;
  --faint: #8a93a3;
  --accent: #1f5bd8;
  --accent-ink: #ffffff;
  --accent-soft: rgba(31, 91, 216, 0.09);
  --good: #11875a;
  --bad: #c9302c;
  --screen: #0e1015;
  --tile-bg: rgba(255, 255, 255, 0.97);
  --tile-ink: #111827;
  --tile-glow: 0.06;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--text);
  font: 15px/1.55 var(--body); overflow: hidden;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
  transition: background-color .3s;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; margin: 0; font-optical-sizing: auto; }
.mono, .num { font-family: var(--data); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.eyebrow { font: 600 13px/1.2 var(--data); color: var(--accent); letter-spacing: .01em; }
a { color: var(--accent); }

/* ---------- Stage ---------- */
#stage { position: fixed; inset: 0; }
#bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#css3d { position: absolute; inset: 0; touch-action: none; }
#css3d > div { touch-action: none; }

/* ---------- Tiles ---------- */
.tile {
  --c: #5cc8f0; --c15: rgba(92,200,240,.15); --c30: rgba(92,200,240,.3); --c60: rgba(92,200,240,.6);
  width: 120px; height: 150px; position: relative; border-radius: 10px;
  background: linear-gradient(var(--tile-tint, var(--c30)), var(--tile-tint, var(--c30))), var(--tile-bg);
  border: 1.5px solid var(--c60);
  box-shadow: var(--tile-shadow, 0 6px 18px rgba(0,0,0,.35));
  cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: opacity .35s, filter .35s, border-color .15s, box-shadow .15s;
  font-family: var(--data); color: var(--tile-ink); overflow: hidden;
}
:root[data-theme="bookish"] .tile, :root[data-theme="light"] .tile { --tile-tint: var(--c30); --tile-shadow: 0 2px 0 rgba(60,40,10,.12), 0 8px 18px rgba(60,40,10,.10); }
.tile::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 7px; background: var(--c); }
.tile:hover { border-color: var(--c); box-shadow: 0 0 0 3px var(--c60), 0 12px 30px rgba(0,0,0,.3); }
.tile .z { position: absolute; top: 12px; left: 11px; font: 700 16px var(--data); }
.tile .m { position: absolute; top: 14px; right: 11px; font: 600 12px var(--data); opacity: .65; }
.tile .s { position: absolute; top: 36px; left: 0; right: 0; text-align: center; font: 700 50px/1 var(--display); letter-spacing: -0.02em; }
.tile .nm { position: absolute; top: 96px; left: 6px; right: 6px; text-align: center; font: 600 14px var(--data); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .val { position: absolute; top: 114px; left: 6px; right: 6px; text-align: center; font: 500 12px var(--data); opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .stripe { position: absolute; left: 10px; right: 10px; bottom: 9px; height: 6px; display: flex; border-radius: 3px; overflow: hidden; gap: 1px; }
.tile .stripe i { display: block; height: 100%; }
.tile.dim { opacity: .1; filter: grayscale(1); }
.tile.ghost { opacity: .04; pointer-events: none; }
.tile.sel { border-color: var(--tile-ink); box-shadow: 0 0 0 4px var(--c), 0 0 50px var(--c60); }
.tile.ok { animation: ok .8s; }
.tile.bad { animation: shake .45s; }
.tile.hint { animation: hint 1s 2; }
@keyframes ok { 0%,100% { box-shadow: 0 0 0 0 var(--good); } 40% { box-shadow: 0 0 0 6px var(--good), 0 0 60px var(--good); } }
@keyframes hint { 50% { box-shadow: 0 0 0 5px var(--accent), 0 0 60px var(--accent); } }
@keyframes shake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }
.cluster-label { font: 600 38px var(--display); text-align: center; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .6s; }
.cluster-label small { display: block; font: 500 17px var(--data); color: var(--muted); }
.cluster-label.on { opacity: 1; }

/* ---------- Buttons & controls (one system everywhere) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: 10px; font: 600 14px var(--data); color: var(--text); transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.big { height: 46px; padding: 0 22px; font-size: 16px; }
.btn.small { height: 32px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; background: var(--raised); border-radius: 11px; max-width: 100%; }
.seg button { height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: 600 14px var(--data); transition: background .15s, color .15s; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.25), inset 0 0 0 1px var(--line-strong); }
select, input[type=text], input[type=number], input[type=search] {
  height: 38px; background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 12px; outline: none; font: 500 15px var(--data); color: var(--text); min-width: 0;
}
select:focus, input:focus { border-color: var(--accent); }
select option { background: var(--surface-solid); color: var(--text); }
input[type=range] { width: 100%; accent-color: var(--accent); height: 24px; }
input[type=checkbox] { accent-color: var(--accent); width: 17px; height: 17px; }
.icon-btn { font-family: var(--data); width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-solid); display: grid; place-items: center; font-size: 16px; line-height: 1; color: var(--text); }
.icon-btn:hover { border-color: var(--accent); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .ctl > label { font: 600 13px var(--data); color: var(--muted); display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.field > label b, .ctl > label b { color: var(--text); font-weight: 700; }
.field input[type=text], .field input[type=number], .field select { width: 100%; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.hint-text { font-size: 13.5px; color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Top bar ---------- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  height: var(--top); padding: env(safe-area-inset-top, 0px) 16px 0;
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; flex: none; color: var(--text); }
.brand-mark { width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #f2b84b 38%, #e0602b 72%, transparent 74%); box-shadow: 0 0 14px rgba(242,184,75,.55); }
.brand-name { font: 700 21px var(--display); letter-spacing: -0.01em; }
#nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
#nav::-webkit-scrollbar { display: none; }
#nav button { flex: none; background: none; border: 0; height: 36px; padding: 0 13px; border-radius: 10px; color: var(--muted); font: 600 15px var(--data); white-space: nowrap; transition: color .15s, background .15s; }
#nav button:hover { color: var(--text); background: var(--raised); }
#nav button.on { color: var(--accent-ink); background: var(--accent); }
.search { position: relative; flex: none; width: 240px; }
#search { width: 100%; border-radius: 999px; }
#search-results { position: absolute; top: 46px; right: 0; width: 290px; background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 6px; box-shadow: var(--shadow); }
#search-results button { display: flex; width: 100%; align-items: center; gap: 12px; background: none; border: 0; padding: 8px; border-radius: 8px; text-align: left; color: var(--text); }
#search-results button:hover, #search-results button.hl { background: var(--raised); }
#search-results .sym { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; font: 700 16px var(--display); background: var(--c); color: #111; flex: none; }
#settings-btn { flex: none; }
#settings { position: fixed; z-index: 50; top: calc(var(--top) + 6px); right: 16px; width: 290px; background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); display: grid; gap: 14px; }
#settings h3 { font-size: 17px; }

/* ---------- Table toolbar ---------- */
#dock {
  position: fixed; left: 16px; right: 16px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 20;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.dock-toggle { display: none; width: 100%; background: none; border: 0; height: 46px; padding: 0 16px; text-align: left; font: 700 15px var(--data); color: var(--text); }
.dock-body { padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: end; gap: 12px 26px; }
.ctl { display: grid; gap: 6px; flex: 0 1 auto; }
.ctl.grow { flex: 1 1 200px; min-width: 180px; }
.dock-body select { width: 240px; max-width: 100%; }
.marks { display: flex; gap: 4px; flex-wrap: wrap; }
.marks button { background: var(--raised); border: 0; border-radius: 999px; height: 26px; padding: 0 10px; font: 600 12px var(--data); color: var(--muted); }
.marks button:hover { color: var(--text); }

/* ---------- Legend & tooltip ---------- */
#legend { position: fixed; left: 16px; right: 16px; bottom: var(--legend-bottom, 110px); z-index: 19; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px; pointer-events: none; }
#legend > * { pointer-events: auto; }
#legend .rampbox { display: grid; gap: 4px; width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
#legend .items { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
#legend .item { white-space: nowrap; flex: none; display: flex; align-items: center; gap: 7px; background: none; border: 0; border-radius: 999px; height: 30px; padding: 0 11px 0 8px; font: 600 13.5px var(--data); color: var(--text); }
#legend .item:hover { background: var(--raised); }
#legend .item.off { opacity: .35; }
#legend .dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
#legend .bar { height: 10px; border-radius: 5px; }
#legend .ends { display: flex; justify-content: space-between; font: 600 12.5px var(--data); color: var(--muted); }
#legend .lnote { font-size: 13.5px; color: var(--muted); max-width: 64ch; text-align: center; background: var(--surface); border-radius: 999px; padding: 4px 12px; }
#tooltip { position: fixed; z-index: 40; pointer-events: none; background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 11px; font-size: 13.5px; max-width: 270px; box-shadow: var(--shadow); }
#tooltip b { font: 700 15px var(--display); }

/* ---------- Detail panel ---------- */
#panel {
  position: fixed; z-index: 25; top: calc(var(--top) + 10px); right: 16px; bottom: 16px; width: 500px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow);
  animation: panelIn .25s var(--ease);
}
@keyframes panelIn { from { transform: translateX(24px); opacity: 0; } }
.p-head { display: flex; gap: 14px; padding: 18px 18px 12px; align-items: center; position: relative; }
.p-sym { --c: #5cc8f0; width: 80px; height: 80px; border-radius: 16px; flex: none; position: relative; display: grid; place-items: center; font: 700 36px var(--display); color: var(--tile-ink);
  background: linear-gradient(150deg, var(--c60), var(--c15)), var(--tile-bg); border: 1.5px solid var(--c); }
.p-sym small { position: absolute; top: 5px; left: 8px; font: 700 13px var(--data); }
.p-title { flex: 1; min-width: 0; padding-right: 120px; }
.p-title h2 { font-size: 30px; line-height: 1.05; }
.p-title .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font: 600 13px var(--data); border-radius: 999px; height: 26px; padding: 0 10px; background: var(--raised); white-space: nowrap; }
.chip i { width: 9px; height: 9px; border-radius: 50%; display: block; }
.p-actions { display: flex; gap: 6px; position: absolute; top: 16px; right: 16px; }
.p-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.p-tabs::-webkit-scrollbar { display: none; }
.p-tabs button { flex: none; background: none; border: 0; border-bottom: 2.5px solid transparent; height: 44px; padding: 0 11px; color: var(--muted); font: 600 15px var(--data); }
.p-tabs button:hover { color: var(--text); }
.p-tabs button.on { color: var(--text); border-color: var(--accent); }
.p-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 18px; overscroll-behavior: contain; }
.p-body > * { flex: none; }
.photo { position: relative; border-radius: 14px; overflow: hidden; background: var(--screen); aspect-ratio: 16/10; width: 100%; max-width: 100%; cursor: zoom-in; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 12px 8px; font-size: 13px; background: linear-gradient(transparent, rgba(0,0,0,.8)); color: #eee; }
.photo .none { position: absolute; inset: 0; display: grid; place-items: center; color: #aaa; font-size: 14px; text-align: center; padding: 20px; }
.gallery { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.gallery:empty { display: none; }
.gallery img { height: 66px; width: 88px; object-fit: cover; border-radius: 8px; flex: none; cursor: zoom-in; background: var(--screen); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); background: var(--surface-solid); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin: 0; }
.facts > div { padding: 10px 13px; min-width: 0; box-shadow: inset -1px -1px 0 var(--line); }
.facts dt { font: 600 12.5px var(--data); color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: 15px; overflow-wrap: anywhere; }
.facts .wide { grid-column: 1 / -1; }
.prose { max-width: 68ch; }
.prose p { margin: 0 0 10px; }
.sec { display: grid; gap: 10px; }
.sec > h3, .card > h3 { font-size: 19px; }
.origin-bar { display: flex; height: 28px; border-radius: 9px; overflow: hidden; gap: 2px; }
.origin-bar button { border: 0; padding: 0; min-width: 4px; position: relative; }
.origin-bar button:hover { filter: brightness(1.15); }
.origin-bar button.on::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 2.5px var(--text); }
.origin-legend { display: grid; gap: 2px; }
.origin-legend button { display: flex; align-items: center; gap: 10px; background: none; border: 0; min-height: 36px; padding: 0 8px; border-radius: 8px; text-align: left; color: var(--text); font-weight: 600; }
.origin-legend button:hover, .origin-legend button.on { background: var(--raised); }
.origin-legend .pct { margin-left: auto; color: var(--muted); font-weight: 700; }
.anim-box { position: relative; border-radius: 14px; overflow: hidden; background: var(--screen); aspect-ratio: 16/10; width: 100%; max-width: 100%; }
.anim-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.anim-box .tag { position: absolute; left: 10px; top: 10px; font: 700 13px var(--data); padding: 4px 9px; border-radius: 7px; background: rgba(0,0,0,.6); }
.journey { list-style: none; margin: 0; padding: 0; counter-reset: j; }
.journey li { counter-increment: j; position: relative; padding: 0 0 12px 34px; }
.journey li::before { content: counter(j); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 700 12px var(--data); background: var(--c, var(--accent)); color: #111; }
.journey li::after { content: ''; position: absolute; left: 10.5px; top: 25px; bottom: 2px; width: 1px; background: var(--line-strong); }
.journey li:last-child::after { display: none; }
.note { border-left: 3px solid var(--accent); padding: 10px 14px; background: var(--accent-soft); border-radius: 0 10px 10px 0; }
.propbars { display: grid; gap: 12px; }
.propbar { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.propbar .k { color: var(--muted); font-weight: 600; font-size: 14px; }
.propbar .v { font-weight: 700; text-align: right; }
.propbar .track { grid-column: 1 / -1; height: 6px; background: var(--raised); border-radius: 3px; overflow: hidden; }
.propbar .track i { display: block; height: 100%; border-radius: 3px; }
.propbar .rank { grid-column: 1 / -1; font-size: 12.5px; color: var(--faint); }
.cfg { font: 600 17px var(--data); line-height: 1.9; }
.cfg sup { font-size: .65em; }
.shells { display: flex; gap: 5px; flex-wrap: wrap; }
.shells span { font: 600 13.5px var(--data); background: var(--raised); border-radius: 7px; padding: 3px 9px; }
.spectrum { width: 100%; height: 76px; border-radius: 10px; display: block; background: #000; }
.flame { display: flex; align-items: center; gap: 14px; }
.flame .f { width: 44px; height: 62px; border-radius: 50% 50% 45% 45% / 65% 65% 35% 35%; filter: blur(1px); animation: flick 1.4s infinite alternate; background-color: #000; }
@keyframes flick { to { transform: scaleY(1.06) skewX(2deg); filter: blur(2px) brightness(1.2); } }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; max-width: 100%; background: var(--surface-solid); }
table.data { width: 100%; border-collapse: collapse; font: 500 14.5px var(--data); }
table.data th, table.data td { padding: 8px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.data tr:last-child td { border-bottom: 0; }
table.data th { font: 700 13px var(--data); color: var(--muted); position: sticky; top: 0; background: var(--surface-solid); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--raised); }
table.data b { font-weight: 700; }
.pill { display: inline-block; font: 700 12px var(--data); padding: 1px 8px; border-radius: 999px; color: #111; }
.abar { display: inline-block; height: 7px; border-radius: 4px; background: var(--accent); vertical-align: middle; margin-right: 6px; }
.nl { display: inline-flex; align-items: center; font-weight: 700; }
.nl .ms { display: inline-flex; flex-direction: column; font-size: .6em; line-height: 1.05; text-align: right; margin-right: 1px; font-weight: 600; }
.atom-box { position: relative; border-radius: 14px; overflow: hidden; background: radial-gradient(circle at 50% 50%, #15151c, #030305 70%); aspect-ratio: 1/1; width: 100%; max-width: 100%; }
.atom-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.atom-box .tag { position: absolute; left: 12px; bottom: 10px; font: 600 13px var(--data); color: #bbb; }
.atom-ctl { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; }
.atom-ctl .icon-btn { background: rgba(20,20,24,.8); color: #eee; border-color: rgba(255,255,255,.2); }
.orb-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.orb-chips button { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-solid); font: 700 13.5px var(--data); color: var(--text); display: inline-flex; gap: 6px; align-items: center; }
.orb-chips button i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.orb-chips button.off { opacity: .4; }

/* ---------- Full-screen labs ---------- */
.view { position: fixed; inset: var(--top) 0 0 0; z-index: 22; overflow-y: auto; overscroll-behavior: contain; background: var(--ground); padding: 24px 16px 48px; animation: fadeIn .2s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }
.lab { max-width: 1320px; margin: 0 auto; display: grid; gap: 20px; }
.lab-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: end; justify-content: space-between; }
.lab-head h1 { font-size: clamp(30px, 4.4vw, 48px); line-height: 1.02; margin-top: 4px; }
.lab-head p { margin: 8px 0 0; color: var(--muted); max-width: 72ch; font-size: 16px; }
.card { background: var(--surface-solid); border: 1px solid var(--line); border-radius: 16px; padding: 18px; min-width: 0; }
.card > h3 { margin-bottom: 4px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.gridc { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stack > * { flex: none; }
.sticky { position: sticky; top: 0; }
.canvas-box { position: relative; width: 100%; max-width: 100%; border-radius: 14px; overflow: hidden; background: var(--screen); }
.canvas-box canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); background: var(--surface-solid); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stat-grid > div { padding: 10px 13px; min-width: 0; box-shadow: inset -1px -1px 0 var(--line); }
.stat-grid .k { font: 600 12.5px var(--data); color: var(--muted); }
.stat-grid .v { font: 700 16px var(--data); margin-top: 2px; overflow-wrap: anywhere; }
.src-list { display: grid; gap: 6px; }
.src-btn { display: grid; grid-template-columns: 14px 1fr auto; gap: 12px; align-items: center; text-align: left; background: var(--surface-solid); border: 1px solid var(--line); border-radius: 12px; padding: 10px 13px; color: var(--text); transition: border-color .15s, background .15s; }
.src-btn:hover { border-color: var(--line-strong); background: var(--raised); }
.src-btn.on { border-color: var(--c); background: linear-gradient(var(--c15), var(--c15)), var(--surface-solid); }
.src-btn .dot { display: block; width: 14px; height: 14px; border-radius: 50%; background: var(--c); }
.src-btn b { display: block; font-weight: 700; }
.src-btn span { font-size: 13.5px; color: var(--muted); }
.src-btn .n { font-weight: 700; color: var(--muted); }
.el-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.el-chip { --c: #888; display: inline-flex; align-items: baseline; gap: 5px; background: linear-gradient(var(--c15), var(--c15)), var(--surface-solid); border: 1px solid var(--c60); border-radius: 8px; height: 30px; padding: 0 9px; align-items: center; font: 600 13px var(--data); color: var(--text); }
.el-chip b { font: 700 14px var(--display); }
.el-chip small { color: var(--muted); }
.el-chip:hover { border-color: var(--c); }
.timeline { position: relative; padding: 10px 0 4px; }
.timeline .axis { position: relative; height: 4px; border-radius: 2px; background: linear-gradient(90deg, #8fd3ff, #ff6b5e 30%, #ffb347 55%, #ff5fd2 75%, #7cf29a); margin: 0 8px; }
.timeline .ev { position: absolute; top: -7px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; border: 3px solid var(--surface-solid); background: var(--muted); padding: 0; }
.timeline .ev.on { background: var(--accent); }
.timeline .lbl { display: flex; justify-content: space-between; font: 600 13px var(--data); color: var(--muted); margin-top: 12px; }
.tl-detail { margin-top: 10px; min-height: 64px; }
.tl-detail b { font: 600 18px var(--display); }
.big-num { font: 700 clamp(30px, 4vw, 46px)/1 var(--display); }
.warn { color: var(--bad); font-weight: 600; }
.status { font: 700 13.5px var(--data); padding: 5px 12px; border-radius: 999px; display: inline-block; }
.status.sub { background: rgba(92,160,240,.18); color: #5aa9ff; }
.status.crit { background: rgba(95,211,154,.18); color: var(--good); }
.status.sup { background: rgba(255,107,107,.18); color: var(--bad); }
.legend-inline { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; color: var(--muted); }
.legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.legend-inline i { width: 11px; height: 11px; border-radius: 3px; display: block; }
.tabs { display: flex; gap: 3px; flex-wrap: wrap; padding: 3px; background: var(--raised); border-radius: 11px; width: fit-content; max-width: 100%; }
.tabs button { height: 34px; background: none; border: 0; border-radius: 8px; padding: 0 13px; color: var(--muted); font: 600 14px var(--data); }
.tabs button:hover { color: var(--text); }
.tabs button.on { background: var(--surface-solid); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.eq { font: 600 clamp(17px, 2.3vw, 22px)/1.6 var(--data); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.eq .op { color: var(--muted); }
.eq .q { color: var(--accent); }
.panel-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Nuclide chooser (modal periodic table) ---------- */
.nuc-btn { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; height: 46px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--surface-solid); color: var(--text); text-align: left; }
.nuc-btn:hover { border-color: var(--accent); }
.nuc-btn .nl { font-size: 22px; }
.nuc-btn span.nm { color: var(--muted); font-weight: 600; flex: 1; }
.nuc-btn .chev { color: var(--muted); }
#chooser { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 12px; animation: fadeIn .15s; }
#chooser .box { width: min(980px, 100%); max-height: calc(100vh - 24px); overflow-y: auto; background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: 18px; padding: 18px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.mini-pt { display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); gap: 3px; }
.mini-pt button { aspect-ratio: 1; border: 0; border-radius: 5px; background: linear-gradient(var(--c30), var(--c30)), var(--surface-solid); color: var(--text); font: 700 clamp(9px, 1.4vw, 14px) var(--data); padding: 0; display: grid; place-items: center; line-height: 1; }
.mini-pt button:hover { background: linear-gradient(var(--c60), var(--c60)), var(--surface-solid); }
.mini-pt button.on { outline: 2.5px solid var(--text); }
.mini-pt .gap { grid-column: 1 / -1; height: 6px; }
.iso-list { display: flex; flex-wrap: wrap; gap: 5px; max-height: 190px; overflow-y: auto; }
.iso-list button { height: 34px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface-solid); color: var(--text); font: 600 14px var(--data); display: inline-flex; align-items: center; gap: 6px; }
.iso-list button small { color: var(--muted); font-weight: 600; }
.iso-list button.stable { border-color: var(--good); }
.iso-list button:hover { border-color: var(--accent); }
.parts-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Charts (collider session) ---------- */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.chart-grid > :first-child { grid-column: 1 / -1; }
.chart-fig { margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.chart-cap { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.guide { background: var(--surface-solid); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.guide summary { cursor: pointer; font-weight: 700; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 12px; }
.guide h4 { margin: 0 0 6px; font: 700 14px var(--data); color: var(--accent); }
.guide dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.guide dt { font-weight: 700; white-space: nowrap; }
.guide dd { margin: 0; color: var(--muted); }
.chart { background: var(--screen); border-radius: 14px; position: relative; height: 290px; }
.chart canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.proc-table td:first-child { white-space: normal; }

/* ---------- Human body ---------- */
.body-stage { background: radial-gradient(circle at 50% 42%, #141a26, #030305 72%); }
.body-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
.body-stage .overlay { position: absolute; left: 14px; top: 12px; right: 14px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; color: #eee; font-weight: 600; }
.body-stage .overlay > * { pointer-events: auto; }
.el-list { display: grid; gap: 4px; }
.el-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; background: var(--surface-solid); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; text-align: left; color: var(--text); }
.el-row:hover { border-color: var(--line-strong); }
.el-row.on { border-color: var(--accent); background: var(--accent-soft); }
.el-row .sym { width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; font: 700 17px var(--display); background: var(--c); color: #111; }
.el-row .bar { height: 5px; border-radius: 3px; background: var(--raised); margin-top: 4px; overflow: hidden; }
.el-row .bar i { display: block; height: 100%; }
.el-row .v { font-weight: 700; text-align: right; }
.el-row .v small { display: block; color: var(--muted); font-weight: 600; }

/* ---------- Quiz, compare, lightbox, loader, toast ---------- */
#quiz-hud { position: fixed; z-index: 26; top: calc(var(--top) + 10px); left: 50%; transform: translateX(-50%); width: min(640px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px; padding: 14px 16px; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); display: grid; gap: 8px; box-shadow: var(--shadow); }
#quiz-hud .q { font: 600 21px var(--display); text-wrap: balance; }
#quiz-hud .meta { display: flex; gap: 16px; font-size: 14px; color: var(--muted); align-items: center; flex-wrap: wrap; }
#quiz-hud .meta b { color: var(--text); }
#quiz-hud .timer { height: 4px; background: var(--raised); border-radius: 2px; overflow: hidden; }
#quiz-hud .timer i { display: block; height: 100%; background: var(--accent); }
#compare { position: fixed; z-index: 45; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; animation: fadeIn .2s; }
#compare .box { width: min(780px, 100%); max-height: 90vh; overflow-y: auto; background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: 18px; padding: 20px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.cmp-row { display: grid; grid-template-columns: 1fr 130px 1fr; gap: 12px; align-items: center; font-size: 15px; }
.cmp-row .l { text-align: right; font-weight: 700; }
.cmp-row .r { font-weight: 700; }
.cmp-row .k { text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; }
.cmp-bar { height: 7px; border-radius: 4px; display: block; margin-top: 3px; }
.cmp-row .l .cmp-bar { margin-left: auto; }
#lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.92); display: grid; place-items: center; padding: 16px; cursor: zoom-out; animation: fadeIn .2s; }
#lightbox img { max-width: 100%; max-height: 85vh; border-radius: 8px; }
#lightbox p { color: #ccc; font-size: 14px; text-align: center; max-width: 80ch; }
#loader { position: fixed; inset: 0; z-index: 100; background: var(--ground); display: grid; place-items: center; transition: opacity .5s; }
#loader.gone { opacity: 0; pointer-events: none; }
.loader-inner { display: grid; justify-items: center; gap: 18px; }
.loader-mark { width: 48px; height: 48px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #f2b84b 38%, #e0602b 72%, transparent 74%); box-shadow: 0 0 40px rgba(242,184,75,.7); animation: pulse 1.2s infinite alternate; }
@keyframes pulse { to { transform: scale(1.2); } }
.loader-inner p { font: italic 500 20px var(--display); color: var(--muted); margin: 0; }
.toast { position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: var(--text); color: var(--ground); padding: 10px 18px; border-radius: 999px; font-weight: 700; transition: all .25s var(--ease); max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .mobile-first { order: -1; }
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  :root { --top: calc(104px + env(safe-area-inset-top, 0px)); }
  #topbar { gap: 8px; flex-wrap: wrap; height: auto; min-height: var(--top); padding-bottom: 6px; padding-top: calc(6px + env(safe-area-inset-top, 0px)); }
  .brand-name { display: none; }
  .search { flex: 1; width: auto; order: 2; }
  #settings-btn { order: 3; }
  #nav { order: 4; flex-basis: 100%; }
  #search-results { width: 100%; }
  #dock { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .dock-toggle { display: block; }
  #dock.collapsed .dock-body { display: none; }
  .dock-body { padding-top: 0; max-height: 55vh; overflow-y: auto; display: grid; }
  .dock-body select { width: 100%; }
  #legend { top: calc(var(--top) + 6px); bottom: auto; left: 8px; right: 8px; }
  #legend .lnote { display: none; }
  #legend .items { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; border-radius: 12px; max-width: 100%; }
  #panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-width: 100%; height: 80vh; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); animation: sheetIn .25s var(--ease); }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
  .p-head::before { content: ''; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--line-strong); }
  .p-title { padding-right: 0; }
  .p-actions { position: static; flex-direction: column; }
  .p-title h2 { font-size: 26px; }
  .cmp-row { grid-template-columns: 1fr 90px 1fr; }
  .mini-pt { gap: 2px; }
  #settings { left: 8px; right: 8px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Lab workspace: sidebar + stage ---------- */
.view.ws { padding: 0; overflow: hidden; }
.workspace { display: grid; grid-template-columns: 390px minmax(0, 1fr); height: 100%; }
.ws-side { overflow-y: auto; overscroll-behavior: contain; border-right: 1px solid var(--line); background: var(--surface-solid); padding: 22px 20px 40px; display: flex; flex-direction: column; gap: 18px; }
.ws-side > * { flex: none; }
.ws-title h1 { font-size: 30px; line-height: 1.05; margin-top: 4px; }
.ws-title p { color: var(--muted); font-size: 14.5px; margin: 8px 0 0; }
.ws-group { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.ws-group > h3 { font: 700 12.5px var(--data); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.ws-main { overflow-y: auto; overscroll-behavior: contain; padding: 20px 24px 48px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.ws-main > * { flex: none; }
.stage { position: relative; width: 100%; border-radius: 16px; overflow: hidden; background: var(--screen); }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.stage-tall { height: clamp(360px, calc(100vh - var(--top) - 250px), 760px); }
.tabs-wrap { display: flex; flex-direction: column; }
.tabbar { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabbar::-webkit-scrollbar { display: none; }
.tabbar button { flex: none; height: 46px; padding: 0 16px; border: 0; background: none; border-bottom: 2.5px solid transparent; color: var(--muted); font: 600 15px var(--data); }
.tabbar button:hover { color: var(--text); }
.tabbar button.on { color: var(--text); border-color: var(--accent); }
.tabpanel { padding-top: 18px; display: flex; flex-direction: column; gap: 16px; }
.tabpanel > * { flex: none; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.result { display: grid; gap: 10px; }
.result h2 { font-size: 24px; }
.kpis { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.kpis div { display: grid; }
.kpis b { font: 700 18px var(--data); }
.kpis span { font: 600 12.5px var(--data); color: var(--muted); }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.progress { height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
@media (max-width: 900px) {
  .view.ws { overflow-y: auto; }
  .workspace { grid-template-columns: minmax(0, 1fr); height: auto; }
  .ws-side { border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; padding: 18px 16px 24px; }
  .ws-main { overflow: visible; padding: 16px 16px 40px; }
  .stage-tall { height: min(70vh, 520px); }
}

/* printed-chart furniture around the 3D table */
.pt-num, .pt-title, .pt-ph, .pt-flabel { opacity: 0; transition: opacity .6s; pointer-events: none; color: var(--text); }
.pt-num.on, .pt-title.on, .pt-ph.on, .pt-flabel.on { opacity: 1; }
.pt-num { font: 700 30px var(--data); color: var(--muted); }
.pt-title { text-align: center; width: 1300px; }
.pt-title .t1 { font: 700 76px/1.05 var(--display); letter-spacing: -0.01em; }
.pt-title .t2 { font: italic 500 34px var(--display); color: var(--muted); margin-top: 10px; }
.pt-ph { --c: #d88bf5; width: 120px; height: 150px; border-radius: 10px; border: 2px dashed var(--c60); display: grid; place-content: center; text-align: center; gap: 4px; background: linear-gradient(var(--c15), var(--c15)); }
.pt-ph b { font: 700 24px var(--data); }
.pt-ph span { font: 600 16px var(--data); color: var(--muted); }
.pt-flabel { font: 600 24px var(--display); color: var(--muted); width: 200px; text-align: right; }
#reset-float { position: absolute; right: 16px; top: calc(var(--top) + 12px); z-index: 5; box-shadow: var(--shadow); }

/* Human body: layers + radiation */
.layer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.range-ends { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.rad-badge { position: absolute; left: 14px; top: 12px; display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; pointer-events: none; }
.rad-badge b { font: 700 20px var(--data); }
.rad-badge span { font-size: 12px; color: var(--muted); }
.rad-card h4 { margin: 0; font: 700 14px var(--data); color: var(--accent); }
.rad-stage { border-left: 4px solid #ff5a3c; background: var(--raised); border-radius: 8px; padding: 10px 14px; }
.rad-stage.ok { border-left-color: #3ddc84; }
.dose-row { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 8px; align-items: center; font-size: 14px; }
.dose-row .sw { width: 12px; height: 12px; border-radius: 3px; }
.dose-row small { color: var(--muted); }
.rad-blood { width: 100%; height: 170px; display: block; }
.fx-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.fx { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; opacity: .6; background: var(--surface-solid); }
.fx.now { opacity: 1; border-color: #ff6a3c; }
.fx.late.now { border-color: #b58cff; }
.fx b { display: block; }
.fx small { color: var(--muted); font-weight: 600; }
.fx p { margin: 4px 0 0; font-size: 13.5px; }

/* Radioactivity */
.rad-hud { position: absolute; left: 14px; right: 14px; bottom: 12px; font-size: 13.5px; color: rgba(240,240,245,.85); text-shadow: 0 1px 4px #000; pointer-events: none; max-width: 760px; }
.gloss { margin: 0; display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 8px 16px; }
.gloss dt { font-weight: 700; }
.gloss dd { margin: 0; color: var(--muted); }
.eq-card { border-left: 4px solid; border-radius: 10px; background: var(--surface-solid); padding: 10px 14px; }
.eq-card .eq { font: 700 18px var(--data); margin: 6px 0; }
.eq-card p { margin: 0; font-size: 14px; color: var(--muted); }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.hcard { display: flex; flex-direction: column; background: var(--surface-solid); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.hphoto { position: relative; height: 150px; background: var(--raised); display: grid; place-items: center; }
.hphoto .ph-year { font: 700 40px var(--display); color: var(--line-strong); }
.hphoto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .3s; }
.hphoto.loaded img { opacity: 1; }
.hphoto.none img { display: none; }
.hbody { padding: 10px 14px 14px; display: grid; gap: 4px; }
.hbody .year { font: 700 13px var(--data); color: var(--accent); }
.hbody p { margin: 0; font-size: 14px; }
.hbody a { font-size: 13px; color: var(--accent); }
.hbar { display: grid; grid-template-columns: minmax(150px, 38%) 1fr 90px; gap: 10px; align-items: center; font-size: 14px; }
.hbar .track { height: 10px; background: var(--raised); border-radius: 5px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 5px; }
.hbar b { text-align: right; font-family: var(--data); }
.ladder { display: grid; gap: 6px; }
.rung { display: grid; grid-template-columns: 1fr 90px minmax(160px, 1.2fr); gap: 12px; align-items: center; font-size: 14px; }
.rung .lbar { height: 12px; background: var(--raised); border-radius: 6px; overflow: hidden; }
.rung .lbar i { display: block; height: 100%; background: #3ddc84; border-radius: 6px; }
.rung.lv-warn .lbar i { background: #f2b84b; }
.rung.lv-danger .lbar i { background: #ff4d5e; }
.rung b { font-family: var(--data); text-align: right; }
.use-card { text-align: left; color: var(--text); cursor: pointer; }
.use-card:hover { border-color: var(--line-strong); }
.mini-sym { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font: 700 15px var(--display); background: var(--accent-soft); color: var(--accent); flex: none; }
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chain-step { display: grid; text-align: center; background: var(--surface-solid); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; color: var(--text); cursor: pointer; }
.chain-step small { color: var(--muted); font-size: 12px; }
.chain-step.stable { border-color: #3ddc84; }
.chain-arrow { font: 700 13px var(--data); padding: 0 2px; }
.chain-arrow::after { content: ' →'; }
.chain-arrow.a { color: #ff5a4a; }
.chain-arrow.b { color: #3b8fe0; }
@media (max-width: 720px) {
  .hbar { grid-template-columns: 1fr 70px; }
  .hbar .track { grid-column: 1 / -1; grid-row: 2; }
  .rung { grid-template-columns: 70px 1fr; }
  .rung .lbar { grid-column: 1 / -1; }
  .gloss { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  #reset-float { top: auto; bottom: 76px; right: 12px; }
}
