:root { --accent: #f0b45a; --accent-soft: rgba(240, 180, 90, .2); }

/* ------------------------------------------------ list */
.lede { color: var(--dim); font-size: 14.5px; margin: 4px 0 2px; }
.crow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; text-align: left; }
.crow .glyph {
  flex: none; width: 48px; height: 48px; border-radius: 13px; background: var(--card-2); display: grid; place-items: center;
}
.crow .glyph svg { width: 34px; height: 34px; }
.crow .txt { flex: 1; min-width: 0; }
.crow .txt b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crow .txt span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--dim); font-size: 13.5px; line-height: 1.3; margin-top: 1px; }
.crow .txt small { display: block; color: var(--faint); font-size: 12px; margin-top: 3px; }
.crow.busy { opacity: .5; }
.foot { color: var(--faint); font-size: 12.5px; margin: 14px 6px; line-height: 1.45; }

/* ------------------------------------------------ viewer */
#viewer { position: fixed; inset: 0; background: #000; overflow: hidden; touch-action: none; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.vtop {
  position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 10px;
  padding: calc(var(--top) + 6px) 12px 10px;
  background: linear-gradient(rgba(0, 0, 0, .78), rgba(0, 0, 0, .35) 70%, rgba(0, 0, 0, 0)); pointer-events: none;
}
.vtop > * { pointer-events: auto; }
.round { width: 40px; height: 40px; border-radius: 20px; background: rgba(40, 40, 44, .72); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); color: var(--fg); display: grid; place-items: center; flex: none; }
.round svg { width: 22px; height: 22px; }
.round[hidden], #list-page[hidden] { display: none; }
.vtitle { flex: 1; min-width: 0; text-shadow: 0 1px 3px rgba(0, 0, 0, .9), 0 0 10px rgba(0, 0, 0, .7); }
.vtitle b { display: block; font-size: 18px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vtitle span { display: block; font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vtitle small { display: block; font-size: 12px; color: var(--accent); opacity: .85; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vtitle small[hidden] { display: none; }
.picked {
  position: absolute; left: 50%; top: calc(var(--top) + 62px); transform: translateX(-50%); z-index: 6;
  background: rgba(30, 30, 34, .88); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  padding: 8px 14px; border-radius: 14px; font-size: 14px; pointer-events: none; text-align: center; width: max-content; max-width: calc(100% - 32px);
}
.picked small { display: block; color: var(--dim); font-size: 12px; }
.picked b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pick-acts { display: flex; gap: 6px; justify-content: center; margin-top: 7px; pointer-events: auto; }
.pick-acts button { height: 30px; padding: 0 12px; border-radius: 10px; background: rgba(255, 255, 255, .1); font-size: 13px; font-weight: 600; color: var(--fg); }
.pick-acts button:first-child { background: var(--accent-soft); color: var(--accent); }
.vstatus {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--dim); font-size: 14px; text-align: center; pointer-events: none; max-width: 80%;
}
.vstatus[hidden] { display: none; }
.spinner.small { margin: 0; }
.vstatus.error { color: var(--bad); }
.vempty, .scrim { display: none; }

/* ------------------------------------------------ the control sheet (phone: along the bottom) */
.sheet {
  position: absolute; left: 8px; right: 8px; bottom: calc(var(--bottom) + 6px); z-index: 5;
  display: flex; flex-direction: column; max-height: min(52vh, calc(100% - var(--top) - 120px));
  background: rgba(22, 22, 25, .86); -webkit-backdrop-filter: saturate(160%) blur(22px); backdrop-filter: saturate(160%) blur(22px);
  border-radius: 24px; padding: 2px 14px 12px;
}
.sheet .handle { display: block; width: 100%; height: 20px; flex: none; }
.sheet .handle i { display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--card-3); margin: 6px auto 0; }
.sheet .info { font-size: 13px; color: var(--dim); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 2px 0 2px; flex: none; }
.sheet .tabs { margin: 6px 0 8px; flex: none; }
.sheet .tabs button .dot { width: 6px; height: 6px; border-radius: 3px; background: var(--accent); }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior: contain; margin: 0 -14px; padding: 0 14px; }
.sheet.collapsed .sheet-body { display: none; }
body:not(.pad) .sheet-body { flex: none; height: min(27vh, 236px); }  /* one height for every tab, so the cell doesn't jump */
.pane[hidden], .sheet .chips[hidden], .sheet .label[hidden] { display: none; }
.sheet .label { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; margin: 4px 2px 2px; }
.sheet .chips { margin: 0 -14px; padding: 4px 14px 6px; }
.sheet .chip { height: 32px; font-size: 13.5px; background: rgba(255, 255, 255, .08); }
.sheet .chip.on { background: var(--accent); color: #000; }
.toggles { display: flex; gap: 8px; margin-top: 6px; }
.tog { flex: 1; height: 34px; border-radius: 12px; background: rgba(255, 255, 255, .08); font-size: 14px; font-weight: 600; color: var(--dim); }
.tog.on { background: var(--accent-soft); color: var(--accent); }
.slider { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--dim); }
.slider span { width: 62px; flex: none; font-weight: 600; }
.slider em { font-style: normal; width: 84px; flex: none; text-align: right; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.slider input { flex: 1; min-width: 0; accent-color: var(--accent); height: 28px; }

/* slicing planes */
.presets .chip { background: rgba(255, 255, 255, .06); color: var(--fg); font-weight: 500; }
.presets .chip svg { width: 16px; height: 16px; color: var(--accent); }
.planes { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.prow { display: flex; align-items: center; gap: 4px; border-radius: 12px; background: rgba(255, 255, 255, .04); }
.prow.sel { background: rgba(255, 255, 255, .1); }
.prow .pmain { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 10px; text-align: left; }
.prow .sw { flex: none; width: 14px; height: 14px; border-radius: 4px; }
.prow b { font-size: 14.5px; font-weight: 600; white-space: nowrap; }
.prow small { flex: 1; min-width: 0; color: var(--dim); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .ib { flex: none; width: 40px; height: 40px; display: grid; place-items: center; color: var(--dim); }
.prow .ib svg { width: 19px; height: 19px; }
.prow.off .pmain { opacity: .4; }
.add-plane { height: 38px; border-radius: 12px; border: 1px dashed rgba(255, 255, 255, .2); color: var(--accent); font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.add-plane:disabled { opacity: .35; }
.add-plane svg { width: 16px; height: 16px; }
.editor { margin-top: 6px; padding-bottom: 4px; }
.editor .axes { display: flex; gap: 6px; margin-top: 6px; }
.editor .axes button { flex: 1; height: 32px; border-radius: 10px; background: rgba(255, 255, 255, .07); font-size: 13px; font-weight: 600; color: var(--dim); }
.editor .axes button.on { background: var(--accent-soft); color: var(--accent); }
.editor .row2 { display: flex; gap: 6px; margin-top: 10px; }
.editor .row2 button { flex: 1; height: 32px; border-radius: 10px; background: rgba(255, 255, 255, .07); font-size: 13px; font-weight: 600; color: var(--fg); }
.editor .row2 button.on { background: var(--accent-soft); color: var(--accent); }
.empty-planes { color: var(--dim); font-size: 13.5px; padding: 6px 4px 8px; line-height: 1.4; }

/* molecules */
.mhead { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.mhead small { flex: 1; color: var(--dim); font-size: 12.5px; }
.mlink { height: 30px; padding: 0 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13.5px; }
.mlink[hidden] { display: none; }
.mfilter { width: 100%; margin: 6px 0 0; height: 36px; padding: 0 12px; border-radius: 11px; border: 0; background: var(--card-2); font-size: 15px; }
.mhint { color: var(--faint); font-size: 11.5px; margin: 6px 0 4px; }
.tlegend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 2px 0 6px; font-size: 12px; color: var(--fg); }
.tlegend[hidden] { display: none; }
.tlegend .tkey { display: inline-flex; align-items: center; gap: 5px; }
.tlegend .tkey i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.mrow { display: flex; align-items: center; border-radius: 12px; }
.mrow.foc { background: rgba(240, 180, 90, .12); }
.mrow .mmain { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 4px 8px 6px; text-align: left; }
.mrow .sw { flex: none; width: 18px; height: 18px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.mrow .mtxt { flex: 1; min-width: 0; }
.mrow .mtxt b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14.5px; font-weight: 600; line-height: 1.25; }
.mrow.foc .mtxt b { color: var(--accent); }
.mrow .mtxt small { display: block; color: var(--faint); font-size: 12px; margin-top: 1px; }
.mrow .eye { flex: none; width: 40px; height: 40px; display: grid; place-items: center; color: var(--dim); }
.mrow .eye svg { width: 20px; height: 20px; }
.mrow.hid .mmain { opacity: .38; }
.mrow.hid .eye { color: var(--faint); }
.mrow.part .sw { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25), 0 0 0 2px rgba(240, 180, 90, .5); }
.mrow .chev { flex: none; width: 26px; height: 40px; display: grid; place-items: center; color: var(--faint); margin-right: -6px; }
.mrow .chev svg { width: 15px; height: 15px; transition: transform .15s; }
.mrow .chev.open svg { transform: rotate(90deg); }
.mrow.sub { margin-left: 30px; }
.mrow.sub .mtxt b { font-size: 13.5px; font-weight: 500; }
.mrow.sub .sw { width: 14px; height: 14px; border-radius: 5px; }

/* ------------------------------------------------ iPad (body.pad, set by app.js), as in Molecules:
   landscape docks the list beside the 3D view, portrait slides it over; the controls become a
   card down the right-hand side, so the slicing sliders sit beside the cell rather than under it */
body.pad { --side: 320px; --panel: 360px; overflow: hidden; }
body.pad #list-page {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--side); z-index: 40;
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: #0b0b0d; border-right: .5px solid var(--line);
  transform: translateX(-100%); transition: transform .3s cubic-bezier(.3, .8, .3, 1);
}
body.pad.side-open #list-page { transform: none; }
body.pad:not(.docked).side-open #list-page { box-shadow: 0 0 40px rgba(0, 0, 0, .6); }
body.pad #list-page .nav { background: rgba(11, 11, 13, .82); }
body.pad #list-page main { padding-bottom: calc(var(--bottom) + 24px); }
body.pad .crow.sel { background: rgba(240, 180, 90, .12); }
body.pad .crow.sel .txt b { color: var(--accent); }
body.pad #viewer { left: 0; transition: left .3s cubic-bezier(.3, .8, .3, 1); }
body.pad.docked.side-open #viewer { left: var(--side); }
body.pad .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(0, 0, 0, .35); opacity: 0; pointer-events: none; transition: opacity .3s; }
body.pad:not(.docked).side-open .scrim { opacity: 1; pointer-events: auto; }
body.pad .vtop { padding: calc(var(--top) + 10px) 16px 14px; gap: 12px; right: calc(var(--panel) + 16px); }
body.pad .round { width: 44px; height: 44px; border-radius: 22px; }
body.pad .vtitle b { font-size: 20px; }
body.pad .vtitle span { font-size: 14px; }
body.pad #viewer.empty .vtitle, body.pad #viewer.empty #v-reset, body.pad #viewer.empty .sheet { visibility: hidden; }
body.pad .vempty { display: block; position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); text-align: center; color: var(--dim); font-size: 15px; pointer-events: none; }
body.pad .vempty[hidden] { display: none; }
body.pad .vempty b { display: block; color: var(--fg); font-size: 20px; margin-bottom: 6px; }
body.pad .sheet {
  left: auto; right: 16px; width: var(--panel); top: calc(var(--top) + 16px); bottom: calc(var(--bottom) + 16px); max-height: none;
  padding: 10px 16px 14px;
}
body.pad .sheet .handle { display: none; }
body.pad .sheet.collapsed .sheet-body { display: block; }
body.pad .sheet .chips { flex-wrap: wrap; overflow: visible; }
body.pad .picked { top: calc(var(--top) + 72px); left: calc(50% - var(--panel) / 2 - 8px); font-size: 15px; max-width: min(520px, calc(100% - var(--panel) - 64px)); }
body.pad .vstatus { left: calc(50% - var(--panel) / 2); }
body.pad .toast { top: calc(var(--top) + 78px); bottom: auto; }
@media (hover: hover) {
  body.pad .crow:hover { background: var(--card-2); }
  body.pad .mrow:hover, body.pad .prow:hover { background: rgba(255, 255, 255, .06); }
}

/* ------------------------------------------------ close-ups (levels of detail) */
.lodpill {
  position: absolute; left: 50%; top: calc(var(--top) + 62px); transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  pointer-events: auto; user-select: none; position: absolute; overflow: hidden;
  background: rgba(30, 30, 34, .78); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  font-size: 13px; width: max-content; max-width: calc(100% - 32px); white-space: nowrap; overflow: hidden;
}
.lodpill[hidden], .picked:not([hidden]) ~ .lodpill { display: none; }
.lodpill span { overflow: hidden; text-overflow: ellipsis; }
.lodpill small { color: var(--dim); font-size: 12px; }
.lodpill .spinner.small { width: 14px; height: 14px; border-width: 2px; }
.lodpill .pbar { position: absolute; left: 0; bottom: 0; height: 2px; width: calc(var(--p, 0) * 100%); background: var(--accent); transition: width .3s; }
.lodpill .pill-act { flex: none; margin: -2px -6px -2px 2px; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
@media (max-width: 420px) { .lodpill small { display: none; } }
.lod-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.lodlist { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.lodlist[hidden] { display: none; }
.lrow { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, .05); color: var(--fg); }
.lrow b { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.lrow b .spinner.small { width: 12px; height: 12px; border-width: 2px; }
.lrow.home { background: rgba(255, 255, 255, .03); border: 1px solid rgba(255, 255, 255, .08); }
.lrow small { color: var(--dim); font-size: 12px; line-height: 1.3; }
.lrow.on { background: var(--accent-soft); }
.lrow.on b { color: var(--accent); }
.lrow.bad small { color: var(--bad); }
body.pad .lodpill { top: calc(var(--top) + 72px); left: calc(50% - var(--panel) / 2 - 8px); }

/* ------------------------------------------------ explore tab, zoom slider, scale bar */
.segmented button[hidden] { display: none; }
body:not(.pad) .sheet .tabs button { font-size: 13.5px; }
#tab-explore .mhint { margin-top: 0; }

.zrail { position: absolute; left: 10px; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 36px; }
.zrail[hidden], .scalebar[hidden] { display: none; }
.zbtn { width: 36px; height: 36px; border-radius: 18px; display: grid; place-items: center; color: var(--fg);
  background: rgba(40, 40, 44, .72); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.zbtn svg { width: 16px; height: 16px; }
.ztrack { position: relative; width: 36px; touch-action: none; cursor: ns-resize; }
.ztrack::before { content: ""; position: absolute; left: 16px; top: 0; bottom: 0; width: 4px; border-radius: 2px; background: rgba(255, 255, 255, .16); box-shadow: 0 0 6px rgba(0, 0, 0, .6); }
.zfill { position: absolute; left: 16px; bottom: 0; width: 4px; border-radius: 2px; background: var(--accent); opacity: .75; pointer-events: none; }
.zthumb { position: absolute; left: 9px; width: 18px; height: 18px; margin-bottom: -9px; border-radius: 9px; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .6); pointer-events: none; }
.zstops { position: absolute; inset: 0; pointer-events: none; }
.zstop { position: absolute; left: 12px; height: 26px; margin-bottom: -13px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 0; pointer-events: auto; color: var(--dim); white-space: nowrap; }
.zstop i { width: 12px; height: 2px; background: rgba(255, 255, 255, .55); margin-left: 0; }
.zstop span { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 9px; background: rgba(30, 30, 34, .7); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); margin-left: 8px; }
.zstop.on { color: var(--accent); }
.zstop.on span { background: rgba(60, 44, 20, .85); }
@media (hover: hover) { .zstop:hover span { color: var(--fg); } .zbtn:hover { background: rgba(60, 60, 66, .8); } }

.scalebar { position: absolute; z-index: 3; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; pointer-events: none;
  font-size: 11.5px; font-weight: 600; color: var(--fg); text-shadow: 0 1px 3px #000, 0 0 6px #000; font-variant-numeric: tabular-nums; }
.scalebar i { display: block; height: 5px; border: 2px solid #fff; border-top: 0; box-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
body.pad .zrail { left: 16px; }
