/* Experience layer: 3D stage, model lab, tactile feedback. Uses the tokens from styles.css. */

/* ---------- smooth scroll (Lenis) ---------- */
html.has-lenis, html.lenis { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- 3D reveal ---------- */
.rv { transform: perspective(1000px) translateY(34px) rotateX(9deg) scale(0.985); transform-origin: 50% 0; }
.rv.in { transform: none; }

/* ---------- scroll progress ---------- */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 80; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--brand), #6fdcb7, var(--s1)); pointer-events: none; }

/* ---------- ripple, press, tilt, glare ---------- */
.rippling { overflow: hidden; isolation: isolate; }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: 0.22; transform: scale(0);
  animation: ripple 0.65s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; z-index: 0; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
.btn:active, .tab:active, .fbtn:active, .preset:active, .stage-card:active, .fact:active, .imp-row:active { transform: scale(0.97); }
.kpress { animation: kpress 0.3s ease; }
@keyframes kpress { 40% { transform: scale(0.96); } }
.tilt { position: relative; transform-style: preserve-3d; will-change: transform; }
.tilt::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 0.3s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.14), transparent 45%); }
.tilt:hover::after { opacity: 1; }
:root[data-theme="light"] .tilt::after { background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(11, 122, 92, 0.08), transparent 45%); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .tilt::after { background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(11, 122, 92, 0.08), transparent 45%); } }
.btn-brand, .btn-primary { transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s, background 0.2s; }
.deep { isolation: isolate; }
.deep::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(600px circle at var(--sx, 50%) var(--sy, 30%), rgba(53, 196, 151, 0.09), transparent 60%); }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 95; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-radius: 999px; background: var(--ink); color: var(--paper);
  font-size: 14px; font-weight: 600; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.5); opacity: 0; transform: translateY(14px) scale(0.96);
  transition: opacity 0.3s, transform 0.4s cubic-bezier(0.2, 1.4, 0.4, 1); max-width: min(92vw, 520px); }
.toast.in { opacity: 1; transform: none; }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; background: #35c497; box-shadow: 0 0 0 4px rgba(53, 196, 151, 0.25); flex: none; }

/* ---------- 3D stage (hero) ---------- */
.stage { position: relative; margin-top: clamp(36px, 5vw, 64px); height: clamp(560px, 64vw, 700px); border-radius: 28px; overflow: hidden;
  background: radial-gradient(120% 90% at 40% 30%, var(--surface), var(--surface-2)); border: 1px solid var(--line); box-shadow: var(--shadow); isolation: isolate; }
.stage::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(500px circle at var(--sx, 40%) var(--sy, 40%), var(--brand-glow), transparent 60%); opacity: 0.6; }
.stage-canvas { position: absolute; inset: 0; z-index: 0; }
.stage-canvas canvas { width: 100% !important; height: 100% !important; display: block; outline: none; }
.stage-fallback { position: absolute; inset: 60px 30% 60px 4%; width: auto; height: auto; z-index: 0; }
.stage.webgl .stage-fallback { display: none; }
.glass { background: color-mix(in srgb, var(--surface) 72%, transparent); backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.35); }
.stage-top { position: absolute; z-index: 2; top: 16px; left: 16px; right: 16px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; pointer-events: none; }
.stage-top > * { pointer-events: auto; }
.stage-title { display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-size: 14px; flex-wrap: wrap; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); position: relative; }
.live-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--good); animation: ping 1.8s infinite; }
.stage-kpis { display: flex; gap: 0; padding: 4px; }
.stage-kpis > div { padding: 8px 16px; display: grid; }
.stage-kpis > div + div { border-left: 1px solid var(--line); }
.stage-kpis b { font: 650 22px var(--display); letter-spacing: -0.02em; }
.stage-kpis span { font-size: 11px; color: var(--muted); }
.stage-legend { position: absolute; z-index: 2; left: 16px; top: 84px; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; font-size: 12px; color: var(--ink-2); }
.stage-legend span { display: flex; align-items: center; gap: 8px; }
.stage-legend i { width: 10px; height: 18px; border-radius: 3px 3px 1px 1px; background: var(--c); }
.stage-legend .mono { color: var(--muted); font-size: 10px; margin-top: 2px; }
.stage-ticker { position: absolute; z-index: 2; left: 16px; bottom: 16px; width: min(360px, 40%); padding: 4px; }
.stage-ticker .ticker { margin: 0; border: 0; height: 186px; }
.stage-memo { position: absolute; z-index: 2; right: 16px; top: 84px; bottom: 16px; width: min(360px, 34%); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.stage-memo .stamp { top: 46px; }
.stage-hint { position: absolute; z-index: 2; left: 50%; bottom: 20px; transform: translateX(-60%); font: 600 11px var(--mono); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); padding: 8px 14px; border-radius: 999px; border: 1px dashed var(--line-2); transition: opacity 0.4s; pointer-events: none;
  animation: hintbob 2.4s ease-in-out infinite; }
.stage-hint.off { opacity: 0; }
@keyframes hintbob { 50% { transform: translateX(-60%) translateY(-4px); } }
.stage-sel { position: absolute; z-index: 3; left: 50%; bottom: 18px; transform: translateX(-60%); width: min(340px, 90%); padding: 16px 18px; display: grid; gap: 6px; }
.stage-sel.in { animation: selin 0.45s cubic-bezier(0.2, 1.3, 0.4, 1); }
@keyframes selin { from { opacity: 0; transform: translateX(-60%) translateY(16px) scale(0.95); } }
.sel-n { font: 650 18px var(--display); letter-spacing: -0.01em; }
.sel-m { font-size: 13px; color: var(--muted); }
.sel-r { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 4px 0 8px; }
.sel-x { position: absolute; right: 10px; top: 8px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 16px; line-height: 1; }
.stage-sel .btn { justify-self: start; }

/* ---------- model lab ---------- */
.anatomy { display: flex; align-items: stretch; gap: 0; perspective: 1200px; margin-bottom: 14px; }
.stage-card { flex: 1; text-align: left; display: grid; gap: 4px; padding: 18px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; transition: border-color 0.25s, box-shadow 0.25s, background 0.25s; box-shadow: var(--shadow); color: inherit; min-width: 0; }
.stage-card .sc-i { font-size: 11px; color: var(--muted); }
.stage-card b { font: 700 clamp(22px, 2.4vw, 30px) var(--display); letter-spacing: -0.03em; }
.stage-card .sc-t { font-weight: 600; font-size: 14px; }
.stage-card .sc-s { font-size: 12px; color: var(--muted); }
.stage-card[aria-pressed="true"] { border-color: var(--brand); background: linear-gradient(160deg, var(--brand-soft), var(--surface) 70%); box-shadow: 0 0 0 4px var(--brand-glow), var(--shadow); }
.stage-card[aria-pressed="true"] b { color: var(--brand-ink); }
.sc-flow { flex: 0 0 34px; display: grid; place-items: center; position: relative; }
.sc-flow i { width: 100%; height: 2px; background: repeating-linear-gradient(90deg, var(--brand) 0 6px, transparent 6px 12px); background-size: 24px 2px; animation: flow 0.8s linear infinite; opacity: 0.7; }
.sc-flow::after { content: "›"; position: absolute; right: 2px; color: var(--brand); font-weight: 800; }
@keyframes flow { to { background-position: 24px 0; } }
.anatomy-detail { padding: 24px 26px; margin-bottom: 18px; min-height: 160px; }
.anatomy-detail.swap { animation: swapin 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes swapin { from { opacity: 0; transform: translateY(8px); } }
.anatomy-detail h3 { font-size: 21px; letter-spacing: -0.01em; margin-bottom: 8px; }
.anatomy-detail p { color: var(--ink-2); max-width: 80ch; margin: 0 0 12px; }
.feat-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.feat-cloud .chip { animation: chipin 0.4s both; }
.feat-cloud .chip:nth-child(3n) { animation-delay: 0.05s; } .feat-cloud .chip:nth-child(3n+1) { animation-delay: 0.1s; }
@keyframes chipin { from { opacity: 0; transform: translateY(6px) scale(0.9); } }
.imp { display: grid; gap: 4px; max-width: 760px; }
.imp-row { display: grid; grid-template-columns: 220px 1fr 56px; gap: 12px; align-items: center; padding: 6px 8px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; text-align: left; color: inherit; font-size: 14px; }
.imp-row:hover { background: var(--surface-2); }
.imp-bar { height: 10px; border-radius: 0 4px 4px 0; }
.imp-bar i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--brand); animation: growx 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; transform-origin: 0 50%; }
@keyframes growx { from { transform: scaleX(0); } }
.imp-row b { text-align: right; font-size: 12px; }

.lab-grid { display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 14px; margin-bottom: 14px; }
.lab-grid.off, .lab-grid.readonly .knobs, .lab-grid.readonly .presets { opacity: 0.55; }
.lab-card { padding: 22px; }
.lab-card h3 { font-size: 18px; letter-spacing: -0.01em; }
.lab-select { width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); margin: 12px 0; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.preset { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-2); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink);
  transition: transform 0.15s, background 0.2s, border-color 0.2s; }
.preset:hover { border-color: var(--brand); background: var(--brand-soft); }
.preset.ghost { background: transparent; }
.knobs { display: grid; gap: 14px; margin-bottom: 12px; }
.knob-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.knob-top output { font-size: 13px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); transition: background 0.3s, color 0.3s; }
.knob.changed .knob-top output { background: var(--brand); color: #fff; }
.knob-note { font-size: 11px; color: var(--muted); }
.range-wrap { position: relative; }
.base-tick { position: absolute; top: 20px; width: 2px; height: 8px; background: var(--muted); transform: translateX(-1px); border-radius: 1px; pointer-events: none; }
.knob input[type="range"] { --fill: 0%; width: 100%; appearance: none; -webkit-appearance: none; height: 26px; background: transparent; cursor: pointer; margin: 0; }
.knob input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--brand) var(--fill), var(--line-2) var(--fill)); }
.knob input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--line-2); }
.knob input[type="range"]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--brand); }
.knob input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; margin-top: -8px; background: #fff;
  border: 3px solid var(--brand); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.knob input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--brand); }
.knob input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.25); }
.knob input[type="range"]:disabled { cursor: not-allowed; }

.gauge-card { position: relative; display: flex; flex-direction: column; gap: 14px; }
.gauge-card.pulse { animation: cardpulse 0.6s ease; }
@keyframes cardpulse { 30% { box-shadow: 0 0 0 6px var(--brand-glow), var(--shadow); } }
.lab-run { position: absolute; top: 16px; right: 16px; display: flex; gap: 8px; align-items: center; font: 600 11px var(--mono); color: var(--muted); }
.run-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.lab-run.busy .run-dot { background: var(--warning); animation: blink 0.5s steps(1) infinite; }
.lab-run.busy #labMs::after { content: " · running…"; }
.gauge { position: relative; margin-top: 18px; }
.gauge svg { width: 100%; max-width: 320px; margin: 0 auto; overflow: visible; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.15)); }
.g-track { fill: none; stroke: var(--line-2); stroke-width: 18; stroke-linecap: round; }
.g-arc { fill: none; stroke-width: 18; stroke-linecap: round; opacity: 0.9; }
.g-mark { stroke: var(--surface); stroke-width: 2; stroke-dasharray: 3 3; }
.needle { transform-origin: 110px 112px; transform: rotate(-90deg); transition: transform 0.9s cubic-bezier(0.3, 1.5, 0.5, 1); }
.needle line { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.needle circle { fill: var(--ink); stroke: var(--surface); stroke-width: 3; }
.g-read { text-align: center; margin-top: -6px; }
.g-read b { display: block; font: 700 clamp(46px, 5vw, 60px)/1 var(--display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.g-read span { font-size: 13px; color: var(--muted); }
.g-meta { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; font-size: 13px; }
.delta { color: var(--muted); }
.delta.up { color: var(--critical); font-weight: 600; }
.delta.down { color: var(--good); font-weight: 600; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-stats div { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); display: grid; }
.mini-stats span { font-size: 12px; color: var(--muted); }
.mini-stats b { font: 650 22px var(--display); }
.range-viz { display: grid; gap: 6px; }
.rv-l { font-size: 12px; color: var(--muted); }
.rv-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; font-size: 12px; }
.rv-track { position: relative; height: 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.rv-band { position: absolute; top: 2px; bottom: 2px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 45%, transparent); transition: left 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.rv-mid { position: absolute; top: -3px; bottom: -3px; width: 3px; border-radius: 2px; background: var(--brand-ink); transform: translateX(-1px); transition: left 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.rv-row b { font-size: 11px; font-weight: 600; min-width: 92px; text-align: right; }
.order-box { padding: 14px; border-radius: 14px; background: var(--deep); color: var(--on-deep); display: grid; gap: 6px; }
.order-box .eyebrow { color: #6fdcb7; }
.order-q { display: flex; align-items: baseline; gap: 8px; }
.order-q b { font: 700 40px/1 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.order-q span { color: var(--on-deep-2); font-size: 14px; }
.order-box .chip { background: rgba(255, 255, 255, 0.08); color: var(--on-deep); border-color: transparent; font-size: 10px; }

.shap-card { --wf-l: 44%; --wf-r: 52px; }
.wf-legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin: 8px 0; }
.wf-legend span { display: flex; gap: 6px; align-items: center; }
.wf-legend i { width: 12px; height: 12px; border-radius: 3px; }
.wf-legend i.up, .wf-bar.up { background: var(--critical); }
.wf-legend i.down, .wf-bar.down { background: var(--good); }
.waterfall { position: relative; margin-top: 6px; transition: height 0.4s; }
.wf-row { position: absolute; left: 0; right: 0; height: 34px; display: grid; grid-template-columns: var(--wf-l) 1fr var(--wf-r); align-items: center; font-size: 13px;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s; border-radius: 8px; }
.wf-row.flash { animation: flash 1.4s ease; }
@keyframes flash { 0%, 60% { background: var(--brand-soft); box-shadow: 0 0 0 2px var(--brand); } }
.wf-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 10px; color: var(--ink-2); }
.wf-x { color: var(--muted); font-size: 12px; }
.wf-track { position: relative; height: 16px; }
.wf-bar { position: absolute; top: 0; bottom: 0; border-radius: 4px; transition: left 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.3s; }
.wf-bar.base { background: var(--base-2); }
.wf-v { text-align: right; font-size: 12px; }
.wf-zero { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--axis); pointer-events: none; transition: left 0.6s; }
.wf-total { font-size: 14px; margin: 8px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }

.tree-card { padding: 24px; }
.tree-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-end; margin-bottom: 8px; }
.tree-head h3 { font-size: 22px; margin-top: 8px; }
.tree-head .sub { max-width: 52ch; margin: 0; }
.tree svg { width: 100%; height: auto; overflow: visible; }
.t-edge { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
.t-edge.hot { stroke: var(--brand); stroke-width: 3.5; stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 1.6s ease forwards; }
.t-node rect { fill: var(--surface-2); stroke: var(--line-2); }
.t-node.hot rect { fill: var(--brand-soft); stroke: var(--brand); stroke-width: 2; }
.t-node { cursor: help; transition: transform 0.2s; }
.t-l { font: 600 11px var(--font); fill: var(--ink); }
.t-t { font: 600 11px var(--mono); fill: var(--muted); }
.t-node.hot .t-t { fill: var(--brand-ink); }
.t-dot { fill: var(--surface-2); stroke: var(--line-2); cursor: help; }
.t-dot.hot { fill: var(--brand); stroke: var(--surface); stroke-width: 2; }
.t-more { font: 600 12px var(--mono); fill: var(--brand-ink); }
.t-packet { fill: #fff; stroke: var(--brand); stroke-width: 3; filter: drop-shadow(0 0 6px var(--brand)); }

.risk-table tbody tr { cursor: pointer; transition: background 0.2s; }
.risk-table tbody tr:hover, .risk-table tbody tr:focus-visible { background: rgba(255, 255, 255, 0.04); }
#map .fac:hover { stroke: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .stage { height: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px; }
  .stage-canvas { position: relative; inset: auto; height: 420px; border-radius: 18px; overflow: hidden; order: 1; }
  .stage-fallback { position: relative; inset: auto; height: 380px; order: 1; }
  .stage-top { position: static; order: 0; }
  .stage-legend { position: static; flex-direction: row; flex-wrap: wrap; order: 2; }
  .stage-ticker, .stage-memo { position: static; width: auto; order: 3; }
  .stage-memo { min-height: 300px; }
  .stage-hint { left: 50%; bottom: auto; top: 470px; }
  .stage-sel { position: relative; left: auto; bottom: auto; transform: none; width: auto; order: 2; }
  @keyframes selin { from { opacity: 0; transform: translateY(16px) scale(0.95); } }
  .anatomy { flex-wrap: wrap; gap: 8px; }
  .stage-card { flex: 1 1 30%; }
  .sc-flow { display: none; }
  .lab-grid { grid-template-columns: 1fr 1fr; }
  .shap-card { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  .stage-kpis { width: 100%; }
  .stage-kpis > div { flex: 1; padding: 8px 10px; }
  .stage-canvas { height: 360px; }
  .stage-hint { top: 410px; }
  .stage-card { flex: 1 1 45%; }
  .lab-grid { grid-template-columns: 1fr; }
  .shap-card { --wf-l: 50%; }
  .imp-row { grid-template-columns: 1fr 70px 46px; }
  .tree { overflow-x: auto; }
  .tree svg { min-width: 760px; }
}
@media (prefers-reduced-motion: reduce) {
  .rv { transform: none; }
  .needle, .rv-band, .rv-mid, .wf-bar, .wf-row { transition: none; }
}

/* medicine switcher in the 3D stage */
.stage-meds { position: absolute; z-index: 2; top: 84px; left: 50%; transform: translateX(-62%); display: flex; flex-wrap: wrap; gap: 4px; padding: 5px; border-radius: 999px; max-width: 46%; justify-content: center; }
.med { border: 0; background: transparent; color: var(--ink-2); font-size: 12px; font-weight: 600; padding: 6px 11px; border-radius: 999px; cursor: pointer; transition: background 0.2s, color 0.2s; }
.med:hover { background: var(--surface-2); color: var(--ink); }
.med[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
@media (max-width: 1020px) { .stage-meds { position: static; transform: none; max-width: none; border-radius: 18px; order: 0; justify-content: flex-start; } }
[hidden] { display: none !important; }
.stage-memo .stamp { top: auto; bottom: 168px; right: 22px; }
.stage-meds { max-width: 50%; }
/* let grid items shrink below their content's natural width (long select options, tables) */
.lab-grid > *, .res-grid > *, .story > *, .calc > *, .playground > *, .outlook-grid > *, .trio > *, .personas > * { min-width: 0; }
.lab-select { max-width: 100%; text-overflow: ellipsis; }
.anatomy-detail, .chart-card { overflow-x: auto; }
.feat-cloud .chip { white-space: normal; }
/* pre-reveal tilt can poke past the viewport edge; never allow sideways page scroll */
html, body { overflow-x: clip; }
@media (max-width: 680px) { .rv { transform: translateY(26px); } .rv.in { transform: none; } }
