/* QORA prototype — visual system.
   One light source (top left). Graphite ink on porcelain. Cobalt means proven, focused or active — nothing else. */

:root {
  --porcelain: #EFEDE7;
  --bone: #FAF9F5;
  --stone: #DCD8CE;
  --stone-2: #CFC9BC;
  --ink: #1D1D1B;
  --ink-2: #5F5D57;
  --ink-3: #8E8B84;
  --line: rgba(29, 29, 27, .12);
  --line-2: rgba(29, 29, 27, .26);
  --cobalt: #2440FF;
  --cobalt-wash: rgba(36, 64, 255, .08);
  --rust: #B4381E;
  --amber: #9A6A12;
  --shadow-warm: 60, 50, 30;

  --display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --sans: 'Instrument Sans', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --ruler: 22px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0; min-height: 100vh; background: var(--porcelain); color: var(--ink);
  font: 400 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: clip;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; border-radius: 2px; }
kbd {
  font: 500 10px/1 var(--mono); color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 3px;
  padding: 2px 4px 1px; margin-left: 8px; vertical-align: 2px;
}

/* ---------------------------------------------------------------- ground, grain, rulers */
.ground { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.ground::before {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(rgba(29, 29, 27, .045) 1px, transparent 1px) 0 0 / 8px 8px,
    linear-gradient(90deg, rgba(29, 29, 27, .045) 1px, transparent 1px) 0 0 / 8px 8px,
    linear-gradient(rgba(29, 29, 27, .07) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(90deg, rgba(29, 29, 27, .07) 1px, transparent 1px) 0 0 / 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 70% 65% at 50% 52%, #000 20%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 65% at 50% 52%, #000 20%, transparent 100%);
}
.ground::after {
  content: ''; position: absolute; inset: 0; opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .27 0 0 0 0 .2 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.ruler { position: fixed; z-index: 20; background: color-mix(in srgb, var(--porcelain) 88%, transparent); pointer-events: none; }
.ruler-x {
  top: 0; left: 0; right: 0; height: var(--ruler); border-bottom: 1px solid var(--line);
  background-image:
    linear-gradient(90deg, var(--line-2) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 10px, 8px 5px; background-position: var(--ruler) 100%, var(--ruler) 100%; background-repeat: repeat-x;
}
.ruler-y {
  top: 0; bottom: 0; left: 0; width: var(--ruler); border-right: 1px solid var(--line);
  background-image:
    linear-gradient(var(--line-2) 1px, transparent 1px), linear-gradient(var(--line) 1px, transparent 1px);
  background-size: 10px 64px, 5px 8px; background-position: 100% var(--ruler), 100% var(--ruler); background-repeat: repeat-y;
}
.ruler-cursor { position: absolute; background: var(--cobalt); }
.ruler-x .ruler-cursor { top: 6px; bottom: 0; width: 1px; transform: translateX(var(--mx, -10px)); }
.ruler-y .ruler-cursor { left: 6px; right: 0; height: 1px; transform: translateY(var(--my, -10px)); }

/* ---------------------------------------------------------------- masthead */
.masthead {
  position: fixed; z-index: 15; top: var(--ruler); left: var(--ruler); right: 0; height: 64px;
  display: flex; align-items: center; gap: 18px; padding: 0 40px 0 50px;
}
.wordmark { font: 900 23px/1 var(--display); font-stretch: 125%; letter-spacing: -.03em; color: var(--ink); text-decoration: none; }
.wordmark-note { font: 500 13px var(--sans); color: var(--ink-3); padding-left: 16px; border-left: 1px solid var(--line-2); }
.mode { margin-left: auto; display: flex; align-items: center; gap: 2px; position: relative; }
.mode-opt { font: 600 13px var(--sans); padding: 7px 12px; border-radius: 2px; color: var(--ink-3); }
.mode-opt.is-on { color: var(--ink); box-shadow: inset 0 -1.5px 0 var(--ink); border-radius: 0; }
.mode-opt[aria-disabled="true"] { text-decoration: line-through; text-decoration-color: var(--line-2); cursor: help; }
.mode-why {
  position: absolute; top: calc(100% + 8px); right: 0; width: 300px; padding: 12px 14px; background: var(--ink); color: var(--bone);
  font-size: 13px; line-height: 1.45; border-radius: 3px; opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity .2s, transform .2s var(--ease);
}
.mode:hover .mode-why, #mode-dynamic:focus-visible + .mode-why { opacity: 1; transform: none; }
.mast-reveal { display: none; }

/* ---------------------------------------------------------------- bench grid */
.bench {
  position: relative; min-height: 100vh;
  padding: calc(var(--ruler) + 84px) 48px 40px calc(var(--ruler) + 50px);
  display: grid; column-gap: 40px;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 290px);
  grid-template-areas: "intent intent" "stage hall" "shelf hall";
  grid-template-rows: auto 1fr auto;
}
.is-empty .bench {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
  grid-template-areas: "intent stage";
  grid-template-rows: 1fr;
  align-items: center;
}
.intent { grid-area: intent; position: relative; z-index: 3; }
.stage { grid-area: stage; position: relative; min-height: 0; transition: transform .38s var(--ease); }
.hallmark { grid-area: hall; }
.shelf { grid-area: shelf; }
.is-empty .hallmark, .is-empty .shelf, .is-empty .callouts, .is-empty .leaders, .is-empty .anatomy-btn { display: none; }
.has-code .examples { display: none; }

/* ---------------------------------------------------------------- intent: the sentence */
.intent-title {
  margin: 0 0 34px; font: 820 clamp(56px, 7.6vw, 118px)/.9 var(--display); font-stretch: 118%;
  letter-spacing: -.045em; color: var(--ink);
}
.intent-title span { display: block; }
.intent-title span:last-child { color: var(--ink-3); }
.has-code .intent-title { display: none; }

.sentence {
  position: relative; font: 500 46px/1.18 var(--display); font-stretch: 112%; letter-spacing: -.025em;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .28em; max-width: 1180px;
}
.is-empty .sentence { font-size: clamp(30px, 3vw, 44px); }
.sentence.dense { font-size: 32px; line-height: 1.32; }
.w { color: var(--ink-3); font-weight: 400; white-space: nowrap; }
.f {
  border: 0; border-bottom: 1.5px solid var(--line-2); background: transparent; padding: 0 .04em .02em; margin: 0;
  font: inherit; letter-spacing: inherit; font-weight: 640; color: var(--ink); border-radius: 0; outline: none;
  min-width: 1.4em; max-width: 100%; transition: border-color .2s;
}
.f::placeholder { color: rgba(29, 29, 27, .26); font-weight: 400; }
.f:focus { border-bottom-color: var(--cobalt); }
.f-primary { flex: 0 1 auto; }
.is-empty .f-primary { width: 100%; }
.f-area { width: 100%; resize: none; overflow: hidden; line-height: 1.22; font-size: .82em; }
.f-select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: .7em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%231D1D1B' stroke-width='1.4'/%3E%3C/svg%3E") right .08em center / .32em no-repeat;
}
.f[type="datetime-local"] { font-size: .7em; font-family: var(--sans); font-weight: 600; letter-spacing: 0; padding-bottom: .1em; }
.f-check { display: inline-flex; align-items: center; gap: 8px; font: 500 15px var(--sans); letter-spacing: 0; color: var(--ink-2); align-self: center; cursor: pointer; }
.f-check input { width: 16px; height: 16px; accent-color: var(--ink); }
.measure { position: absolute; visibility: hidden; white-space: pre; left: 0; top: 0; pointer-events: none; width: auto !important; border: 0; padding: 0 .04em; }
.intent-error { min-height: 22px; margin: 10px 0 0; color: var(--rust); font: 500 14px var(--sans); }

.kinds { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; margin-top: 14px; }
.kinds-lead { font: 500 13px var(--sans); color: var(--ink-3); margin-right: 2px; }
.kind { font: 600 15px var(--sans); color: var(--ink-2); padding: 6px 0 5px; box-shadow: inset 0 -1.5px 0 transparent; transition: color .15s, box-shadow .2s var(--ease); }
.kind:hover { color: var(--ink); box-shadow: inset 0 -1.5px 0 var(--line-2); }
.kind.is-on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--cobalt); }
.kind-auto { font: 500 10.5px var(--mono); color: var(--cobalt); margin-left: 6px; vertical-align: 1px; }
.has-code .kinds { margin-top: 8px; }
.has-code .kind { font-size: 14px; }

.examples { margin-top: 40px; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; font-size: 15px; }
.examples-lead { color: var(--ink-3); font-size: 13px; }
.examples button { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 4px; }
.examples button:hover { text-decoration-color: var(--cobalt); }

/* ---------------------------------------------------------------- the plinth + artifact */
.plinth-wrap {
  position: relative; display: grid; justify-items: center; align-content: center; perspective: 2200px;
  padding: 18px 0 30px; margin-left: 340px;
}
.is-empty .plinth-wrap { margin-left: 0; padding-bottom: 40px; }
.pool {
  position: absolute; left: 50%; top: 46%; width: 180%; aspect-ratio: 1; transform: translate(-50%, -50%); z-index: -1;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .85), rgba(255, 255, 255, .35) 45%, rgba(255, 255, 255, 0) 72%);
  pointer-events: none;
}
.plinth {
  position: relative; width: 380px; height: 380px; transform-style: preserve-3d; cursor: pointer;
  transition: transform .75s var(--ease), width .45s var(--ease), height .45s var(--ease);
}
.plinth::before {
  content: ''; position: absolute; inset: 0; border-radius: var(--pr, 3px); pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 0 0 1px rgba(29, 29, 27, .07),
    0 2px 3px rgba(var(--shadow-warm), .08), 0 22px 34px -14px rgba(var(--shadow-warm), .24), 0 70px 100px -44px rgba(var(--shadow-warm), .36);
  transition: opacity .4s;
}
.plinth::after { /* front edge of the slab */
  content: ''; position: absolute; left: 1px; right: 1px; top: calc(100% - var(--pr, 0px)); height: calc(9px + var(--pr, 0px)); border-radius: 0 0 var(--pr, 3px) var(--pr, 3px); z-index: -1;
  background: linear-gradient(var(--stone), var(--stone-2)); pointer-events: none; transition: opacity .4s;
}
.contact-shadow {
  width: 70%; height: 22px; margin-top: 8px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(var(--shadow-warm), .2), transparent);
}
.is-empty .plinth { cursor: default; }
.is-empty .plinth::before { box-shadow: 0 0 0 1px var(--line), 0 30px 60px -36px rgba(var(--shadow-warm), .25); }
.is-empty .plinth { background: rgba(250, 249, 245, .55); }

.artifact { position: absolute; inset: 0; transform-style: preserve-3d; }
.artifact.fade { animation: fadeIn .28s ease-out; }
.layer { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .75s var(--ease); }
.layer svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.layer g { transition: fill .35s; }
.layer-tag {
  position: absolute; left: calc(100% + 18px); top: 50%; white-space: nowrap; font: 500 17px var(--mono); color: var(--ink);
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
.layer-tag::before { content: ''; display: inline-block; width: 22px; height: 1px; background: var(--ink-3); vertical-align: middle; margin-right: 8px; }
.l-func .layer-tag { top: 30%; } .l-data .layer-tag { top: 44%; } .l-eyes .layer-tag { top: 58%; } .l-mark .layer-tag { top: 72%; }

.l-data path, .l-func path, .l-eyes path, .l-mark > svg > * { transform-box: fill-box; transform-origin: center; }
.b { animation: press .44s cubic-bezier(.2, .9, .3, 1.25) var(--d, 0ms) both; }
.eye-b { animation: lock .4s cubic-bezier(.3, 1.6, .4, 1) var(--d, 0ms) both; }
.rip { animation: rip .34s var(--ease) var(--d, 0ms) both; }
.pop { animation: pop .24s var(--ease) both; }
@keyframes press { 0% { opacity: 0; transform: scale(2.3); } 55% { opacity: 1; } 100% { opacity: 1; transform: scale(1); } }
@keyframes lock { 0% { opacity: 0; transform: scale(1.4) rotate(-10deg); } 100% { opacity: 1; transform: none; } }
@keyframes rip { 0% { transform: scale(.55); opacity: .4; } 100% { transform: none; opacity: 1; } }
@keyframes pop { 0% { transform: scale(.2); } 100% { transform: none; } }
@keyframes fadeIn { from { opacity: 0; } }

.ghost { position: absolute; inset: 0; color: var(--ink-3); }
.ghost svg { width: 100%; height: 100%; display: block; fill: rgba(29, 29, 27, .3); stroke: rgba(29, 29, 27, .3); stroke-width: .08; }
.ghost-note { margin: 18px 0 0; font: 500 13px var(--sans); color: var(--ink-3); }

.sweep { position: absolute; left: -3%; right: -3%; top: 0; height: 1px; background: var(--cobalt); opacity: 0; pointer-events: none; box-shadow: 0 0 12px 1px rgba(36, 64, 255, .5); transform: translateZ(1px); }
.sweep::before { content: ''; position: absolute; left: 3%; right: 3%; bottom: 1px; height: 70px; background: linear-gradient(to top, rgba(36, 64, 255, .1), transparent); }
.sweep.run { animation: sweep .52s cubic-bezier(.45, 0, .25, 1) both; }
@keyframes sweep { 0% { top: 0; opacity: 0; } 8% { opacity: 1; } 92% { opacity: 1; } 100% { top: 100%; opacity: 0; } }

.hint { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.hint path { stroke: var(--cobalt); stroke-width: 1.5; stroke-dasharray: 5 4; }
.hover-chip {
  position: absolute; left: 0; top: 0; pointer-events: none; z-index: 6; opacity: 0; transition: opacity .15s;
  font: 600 12px var(--sans); color: var(--bone); background: var(--ink); padding: 5px 9px; border-radius: 2px; white-space: nowrap;
}
.hover-chip.is-on { opacity: 1; }
.hover-chip::after { content: ' · click to shape'; font-weight: 400; color: rgba(250, 249, 245, .65); }

.anatomy-btn { margin-top: 2px; font: 600 13px var(--sans); color: var(--ink-2); padding: 6px 2px; }
.anatomy-btn:hover, .anatomy-btn[aria-pressed="true"] { color: var(--ink); }

/* anatomy: the code separates into its layers */
/* Chrome sorts this stack correctly only with the plane tipped toward the viewer, so layers peel forward and down. */
.exploded .plinth { transform: translateY(-120px) rotateX(-58deg) rotateZ(36deg) scale(.64); cursor: default; }
.exploded .plinth::before, .exploded .plinth::after { opacity: 0; }
.exploded .l-func { transform: translateZ(70px); }
.exploded .l-data { transform: translateZ(140px); }
.exploded .l-eyes { transform: translateZ(210px); }
.exploded .l-mark { transform: translateZ(280px); }
.exploded .layer-tag { opacity: 1; }
.exploded .l-ground svg { filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0)); }
.exploded .l-ground::after { content: ''; position: absolute; inset: 0; box-shadow: 0 0 0 1px var(--line-2); }
.exploded .callouts, .exploded .leaders, .exploded .sweep { opacity: 0; pointer-events: none; }
.leaders, .callouts { transition: opacity .3s; }

/* ---------------------------------------------------------------- callouts (drafting annotations that open into instruments) */
.leaders { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 4; }
.leaders path { fill: none; stroke: rgba(29, 29, 27, .38); stroke-width: 1; transition: stroke .2s, opacity .25s; }
.leaders path.is-on { stroke: var(--cobalt); stroke-width: 1.3; }
.leaders .is-dim { opacity: .25; }
.leaders .ring { fill: var(--bone); stroke: var(--ink); stroke-width: 1; }
.leaders .ring.is-on { stroke: var(--cobalt); stroke-width: 1.5; }
.leaders .dot { fill: var(--ink); }
.leaders .dot.is-on { fill: var(--cobalt); }

.callouts { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.callout {
  position: absolute; width: 236px; text-align: right; padding: 4px 0; pointer-events: auto;
  display: grid; justify-items: end; gap: 1px; transition: opacity .25s;
}
.callout-name { font: 680 17px/1.1 var(--display); font-stretch: 116%; letter-spacing: -.01em; color: var(--ink); }
.callout-name kbd { opacity: 0; transition: opacity .2s; }
.callout:hover .callout-name kbd, .callout:focus-visible .callout-name kbd { opacity: 1; }
.callout-val { font: 400 13px/1.3 var(--sans); color: var(--ink-2); max-width: 230px; }
.callout:hover .callout-name { color: var(--cobalt); }
.callout[data-flag]:not([data-flag=""]) .callout-name::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; vertical-align: 2px; background: var(--amber);
}
.callout[data-flag="fail"] .callout-name::before { background: var(--rust); }
.tool-open .callout { opacity: .14; }
.tool-open .callout.is-on { opacity: 0; pointer-events: none; }
.tool-open .callout:hover { opacity: .6; }

/* the instrument */
.instrument {
  position: absolute; z-index: 8; width: 300px; max-height: calc(100vh - 140px); overflow: auto;
  background: var(--bone); border-radius: 2px;
  box-shadow: 0 0 0 1px var(--line), 0 1px 0 rgba(255, 255, 255, .9) inset, 0 30px 50px -28px rgba(var(--shadow-warm), .4);
}
.instrument::before { /* caliper scale along the top edge */
  content: ''; position: sticky; top: 0; display: block; height: 7px; z-index: 1;
  background: linear-gradient(90deg, var(--line-2) 1px, transparent 1px) 0 0 / 6px 4px repeat-x, linear-gradient(90deg, var(--ink) 1px, transparent 1px) 0 0 / 30px 7px repeat-x, var(--bone);
}
.inst-head { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 20px 6px; }
.inst-head h2 { margin: 0; font: 760 24px/1 var(--display); font-stretch: 120%; letter-spacing: -.02em; }
.inst-close { font: 600 13px var(--sans); color: var(--ink-2); padding: 4px 0; }
.inst-close:hover { color: var(--ink); }
.inst-body { padding: 4px 20px 22px; }
.sec { margin: 16px 0 8px; font: 600 12.5px var(--sans); color: var(--ink-2); }
.aside { margin: 14px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-3); }

.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.key {
  display: grid; justify-items: center; gap: 6px; padding: 10px 2px 8px; border-radius: 2px; color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .15s, background .15s, color .15s, transform .15s var(--ease);
}
.key svg { width: 26px; height: 26px; fill: currentColor; }
.key span { font: 500 11.5px var(--sans); color: var(--ink-2); }
.key:hover { box-shadow: inset 0 0 0 1px var(--line-2); }
.key[aria-pressed="true"] { background: var(--ink); color: var(--bone); box-shadow: none; }
.key[aria-pressed="true"] span { color: rgba(250, 249, 245, .78); }
.keys-text .key { padding: 9px 2px; }
.keys-text .key b { font: 760 17px/1 var(--display); font-stretch: 112%; }
.keys-text .key span { font-size: 10.5px; text-align: center; line-height: 1.2; }
.keys-text { grid-template-columns: 1.6fr repeat(4, 1fr); }

.inks { display: flex; flex-wrap: wrap; gap: 5px; align-items: flex-end; }
.ink {
  width: 27px; height: 40px; border-radius: 2px; background: var(--c); position: relative;
  box-shadow: inset 0 0 0 1px rgba(29, 29, 27, .14); transition: transform .2s var(--ease);
}
.ink[aria-pressed="true"] { transform: translateY(-5px); }
.ink[aria-pressed="true"]::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: -9px; height: 2px; background: var(--cobalt); }
.ink-same { background: linear-gradient(135deg, transparent 47%, var(--line-2) 47%, var(--line-2) 53%, transparent 53%); }
.ink-custom { display: grid; place-items: center; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line-2); background: transparent; font: 400 18px var(--sans); color: var(--ink-2); }
.ink-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.ink-custom:focus-within { outline: 2px solid var(--cobalt); outline-offset: 3px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; margin-top: 16px; box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 2px; }
.seg-b { padding: 8px; font: 600 13px var(--sans); color: var(--ink-2); border-radius: 2px; }
.seg-b[aria-pressed="true"] { background: var(--ink); color: var(--bone); }

.dial-row { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.dial {
  width: 56px; height: 56px; border-radius: 50%; position: relative; cursor: grab; touch-action: none;
  box-shadow: inset 0 0 0 1px var(--line-2), 0 1px 0 rgba(255, 255, 255, .9), 0 6px 12px -8px rgba(var(--shadow-warm), .5);
  background: repeating-conic-gradient(from 0deg, var(--line-2) 0 1deg, transparent 1deg 45deg), var(--bone);
}
.dial i { position: absolute; left: 50%; top: 50%; width: 24px; height: 2px; background: var(--ink); transform-origin: 0 50%; transform: translateY(-50%) rotate(var(--a, 0deg)); border-radius: 1px; }
.dial i::after { content: ''; position: absolute; right: -3px; top: -2px; width: 6px; height: 6px; border-radius: 50%; background: var(--cobalt); }
.dial-row output { font: 500 13px var(--mono); }

/* needle sliders with a detent at the safe limit */
.needle-wrap { position: relative; padding: 8px 54px 22px 0; }
.needle-wrap output { position: absolute; right: 0; top: 10px; font: 500 13px var(--mono); }
.needle-wrap.is-over output { color: var(--rust); }
.detent { position: absolute; top: 2px; left: calc(7px + (100% - 68px) * var(--dn, 0)); width: 0; height: 0; border: 4px solid transparent; border-top: 6px solid var(--cobalt); transform: translateX(-4px); }
.detent-label { display: block; margin-top: 4px; font: 500 11.5px var(--sans); color: var(--ink-3); }
.needle-wrap.is-over .detent-label { color: var(--rust); }
input[type="range"].needle { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; cursor: pointer; }
.needle::-webkit-slider-runnable-track {
  height: 28px;
  background:
    linear-gradient(90deg, var(--line-2) 1px, transparent 1px) 0 100% / 7px 6px repeat-x,
    linear-gradient(var(--ink), var(--ink)) 0 100% / var(--fill, 0%) 2px no-repeat,
    linear-gradient(var(--line-2), var(--line-2)) 0 100% / 100% 1px no-repeat;
}
.needle::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 28px; border: 0; border-radius: 0;
  background: linear-gradient(var(--cobalt), var(--cobalt)) 50% 0 / 8px 8px no-repeat, linear-gradient(var(--ink), var(--ink)) 50% 0 / 2px 100% no-repeat;
}
.needle::-moz-range-track { height: 28px; background: linear-gradient(90deg, var(--line-2) 1px, transparent 1px) 0 100% / 7px 6px repeat-x, linear-gradient(var(--line-2), var(--line-2)) 0 100% / 100% 1px no-repeat; }
.needle::-moz-range-thumb { width: 14px; height: 28px; border: 0; border-radius: 0; background: linear-gradient(var(--cobalt), var(--cobalt)) 50% 0 / 8px 8px no-repeat, linear-gradient(var(--ink), var(--ink)) 50% 0 / 2px 100% no-repeat; }
.needle:disabled { opacity: .35; cursor: default; }
.needle:focus-visible { outline-offset: 2px; }

.meter { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.meter-bar { position: relative; height: 8px; background: linear-gradient(90deg, rgba(180, 56, 30, .35) 0 36%, rgba(154, 106, 18, .3) 36% 49%, rgba(29, 29, 27, .18) 49% 64%, rgba(36, 64, 255, .35) 64%); border-radius: 1px; }
.meter-needle { position: absolute; top: -4px; width: 2px; height: 16px; background: var(--ink); transform: translateX(-1px); transition: left .3s var(--ease); }
.meter-read { display: flex; align-items: baseline; gap: 10px; margin: 8px 0 0; }
.meter-read output { font: 500 15px var(--mono); }
.meter-read span { font-size: 12.5px; color: var(--ink-2); }
.meter[data-level="fail"] .meter-read output { color: var(--rust); }

.line-field { display: grid; gap: 4px; margin-top: 14px; font: 600 12.5px var(--sans); color: var(--ink-2); }
.line-field input { border: 0; border-bottom: 1.5px solid var(--line-2); background: transparent; padding: 4px 0; font: 640 20px var(--display); font-stretch: 112%; color: var(--ink); outline: none; }
.line-field input:focus { border-bottom-color: var(--cobalt); }
.check { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); margin: 0; }
.quiet-btn { font: 600 13.5px var(--sans); padding: 9px 12px; border-radius: 2px; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink); transition: box-shadow .15s, background .15s; margin-top: 14px; }
.quiet-btn:hover { box-shadow: inset 0 0 0 1px var(--ink); }

/* ---------------------------------------------------------------- hallmark */
.hallmark { position: relative; z-index: 2; align-self: start; padding-top: 6px; display: flex; flex-direction: column; min-height: 100%; }
.stamp-wrap { width: 168px; height: 168px; margin: 0 0 12px -6px; color: var(--ink); transform: rotate(var(--rot, -2deg)); transition: opacity .3s, transform .3s var(--ease); }
.stamp-wrap.is-lifted { opacity: .28; transform: rotate(var(--rot, -2deg)) scale(1.05) translateY(-3px); }
.stamp-wrap.strike { animation: strike .5s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes strike { 0% { transform: rotate(calc(var(--rot) - 8deg)) scale(1.22); opacity: 0; } 55% { opacity: 1; transform: rotate(var(--rot)) scale(.97); } 100% { transform: rotate(var(--rot)) scale(1); } }
.stamp { width: 100%; height: 100%; display: block; overflow: visible; }
.stamp text { fill: currentColor; }
.stamp-ring { font: 600 10.5px var(--mono); letter-spacing: .08em; }
.stamp-center { font: 860 54px var(--display); font-stretch: 62%; letter-spacing: -.02em; }
.stamp-sub { font: 500 10px var(--mono); letter-spacing: .1em; }
.stamp-glyph { font: 700 18px var(--sans); }
.stamp.is-ok { color: var(--ink); }
.stamp.is-ok .stamp-glyph { fill: var(--cobalt); }
.stamp.is-fail { color: var(--rust); }
.stamp.is-partial { color: var(--amber); }
.stamp.is-idle, .stamp.is-proofing { color: var(--ink-3); }
.stamp.is-exported { color: var(--cobalt); }

.verdict { margin: 0; font: 800 38px/1 var(--display); font-stretch: 116%; letter-spacing: -.035em; }
.verdict.is-fail { color: var(--rust); }
.verdict.is-proofing, .verdict.is-idle { color: var(--ink-3); }
.verdict-sub { margin: 10px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--ink-2); max-width: 32ch; }
.readout { margin: 22px 0 0; display: grid; gap: 7px; border-top: 1px solid var(--line); padding-top: 14px; }
.readout div { display: grid; grid-template-columns: 74px 1fr; gap: 8px; }
.readout dt { font: 500 12px var(--sans); color: var(--ink-3); }
.readout dd { margin: 0; font: 450 11.5px/1.5 var(--mono); color: var(--ink); }
.notes { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.note { padding: 2px 0 2px 12px; box-shadow: inset 2px 0 0 var(--ink-3); }
.note.is-fail { box-shadow: inset 2px 0 0 var(--rust); }
.note.is-warn { box-shadow: inset 2px 0 0 var(--amber); }
.note p { margin: 0; font-size: 13px; line-height: 1.42; }
.fix { margin-top: 5px; font: 600 12.5px var(--sans); color: var(--cobalt); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(36, 64, 255, .35); }
.honesty { margin: 18px 0 0; font-size: 12px; line-height: 1.45; color: var(--ink-3); max-width: 34ch; }
.reveal-cta {
  margin-top: auto; position: sticky; bottom: 24px; display: flex; align-items: center; justify-content: space-between;
  height: 58px; padding: 0 18px 0 20px; background: var(--ink); color: var(--bone); border-radius: 2px;
  font: 680 17px var(--display); font-stretch: 114%; letter-spacing: -.01em; transition: background .2s;
}
.hallmark .honesty { margin-bottom: 24px; }
.reveal-cta kbd { color: rgba(250, 249, 245, .6); border-color: rgba(250, 249, 245, .3); }
.reveal-cta:hover:not(:disabled) { background: var(--cobalt); }
.reveal-cta:disabled { opacity: .3; }

/* ---------------------------------------------------------------- presets shelf */
.shelf { display: flex; align-items: flex-end; gap: 28px; margin-left: 340px; padding-top: 8px; }
.shelf-lead { margin: 0 0 34px; font: 600 12.5px var(--sans); color: var(--ink-3); }
.shelf-row { display: flex; gap: 6px; border-bottom: 1px solid var(--line-2); box-shadow: 0 5px 0 -4px var(--line); padding: 0 4px; overflow-x: auto; overflow-y: hidden; align-items: flex-end; }
.preset { display: grid; justify-items: center; gap: 8px; padding: 6px 8px 12px; position: relative; }
.preset-mini { width: 52px; height: 66px; display: flex; align-items: flex-end; transition: transform .25s var(--ease); filter: drop-shadow(0 4px 5px rgba(var(--shadow-warm), .18)); }
.preset-mini svg { width: 100%; height: auto; display: block; }
.preset:hover .preset-mini { transform: translateY(-4px); }
.preset-name { font: 620 13px var(--display); font-stretch: 112%; color: var(--ink-2); }
.preset[aria-checked="true"] .preset-name { color: var(--ink); }
.preset[aria-checked="true"]::after { content: ''; position: absolute; left: 50%; bottom: -1px; width: 22px; height: 2px; background: var(--cobalt); transform: translateX(-50%); }

/* ---------------------------------------------------------------- mobile-only parts hidden on desktop */
.mhall, .rail, .sheet { display: none; }

/* ---------------------------------------------------------------- reveal */
.reveal { position: fixed; inset: 0; z-index: 40; background: var(--porcelain); overflow: auto; }
.reveal::before { content: ''; position: fixed; inset: 0; background: inherit; z-index: -1; }
.in-reveal .masthead { z-index: 45; }
.in-reveal .ruler { z-index: 46; }
.reveal-top { display: flex; align-items: baseline; gap: 24px; padding: calc(var(--ruler) + 76px) 48px 0 calc(var(--ruler) + 50px); }
.back { font: 600 14px var(--sans); color: var(--ink); }
.back::before { content: ''; display: inline-block; width: 18px; height: 1px; background: var(--ink); vertical-align: middle; margin-right: 10px; }
.reveal-static { margin: 0 0 0 auto; font-size: 13px; color: var(--ink-3); }
.reveal-grid {
  display: grid; grid-template-columns: 260px minmax(0, 1fr) 280px; gap: 40px;
  padding: 22px 48px 36px calc(var(--ruler) + 50px); align-items: start;
}
.reveal-kind { margin: 0; font: 820 44px/1 var(--display); font-stretch: 120%; letter-spacing: -.04em; }
.reveal-payload { margin: 10px 0 0; font: 450 12px/1.5 var(--mono); color: var(--ink-2); word-break: break-all; max-height: 7.5em; overflow: hidden; white-space: pre-wrap; }
.reveal-hall { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; margin-top: 22px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.reveal-hall .stamp { width: 64px; height: 64px; }
.reveal-hall .stamp .stamp-ring { font-size: 11px; }
.reveal-hall p { margin: 0; display: grid; gap: 2px; }
.reveal-hall b { font: 760 17px var(--display); font-stretch: 114%; }
.reveal-hall span { font-size: 12px; line-height: 1.4; color: var(--ink-2); }
.reveal-hall.strike .stamp { animation: strike .5s cubic-bezier(.3, 1.4, .5, 1) both; --rot: -3deg; }
.ctl { margin-top: 24px; }
.ctl-label { display: flex; justify-content: space-between; font: 600 13px var(--sans); color: var(--ink-2); margin-bottom: 4px; }
.ctl-label output { font: 500 13px var(--mono); color: var(--ink); }
.pull-ctl { position: relative; }
.pull-track { height: 3px; background: repeating-linear-gradient(90deg, rgba(180, 56, 30, .45) 0 3px, transparent 3px 6px); margin: 8px 0 -2px; position: relative; }
.pull-ok { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--cobalt); transition: width .4s var(--ease); }
.range-read { margin: 10px 0 0; font-size: 13.5px; line-height: 1.45; }
.range-read b { font: 700 15px var(--display); font-stretch: 112%; }
.range-note { margin: 8px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--ink-3); }

.scene-col { min-width: 0; }
.scene {
  position: relative; height: calc(100vh - 250px); min-height: 440px; overflow: hidden; border-radius: 3px; cursor: ns-resize; touch-action: none;
  background: radial-gradient(ellipse 80% 70% at 42% 30%, #F2F0EA, #E2DED4 70%, #D8D3C7);
  box-shadow: inset 0 0 0 1px var(--line);
}
.scene[data-surface="poster"], .scene[data-surface="screen"] {
  background: linear-gradient(#E6E2DA 0 76%, #CFC8BA 76% 76.4%, #D9D3C6 76.4%);
}
.scene-world {
  position: absolute; left: 50%; top: 48%; transform: translate(-50%, -50%) scale(var(--pull, 1)); filter: blur(var(--blur, 0));
  transition: transform .5s var(--ease), filter .5s; perspective: 1600px;
}
.scene.is-pulling .scene-world { transition: none; }
.scene-hint { position: absolute; left: 18px; bottom: 14px; margin: 0; font: 500 12px var(--sans); color: var(--ink-3); pointer-events: none; }
.slot { position: absolute; }
.slot svg { width: 100%; height: 100%; display: block; }

.viewfinder { position: absolute; right: 16px; bottom: 16px; width: 196px; padding: 8px 8px 10px; background: rgba(29, 29, 27, .92); border-radius: 4px; color: var(--bone); cursor: default; }
.viewfinder canvas { width: 180px; height: 180px; display: block; image-rendering: pixelated; border-radius: 2px; }
.vf-c { position: absolute; width: 16px; height: 16px; border: 2px solid var(--bone); }
.viewfinder[data-ok="true"] .vf-c { border-color: #7F93FF; }
.viewfinder[data-ok="false"] .vf-c { border-color: #E07A5F; }
.vf-c.tl { left: 22px; top: 22px; border-right: 0; border-bottom: 0; } .vf-c.tr { right: 22px; top: 22px; border-left: 0; border-bottom: 0; }
.vf-c.bl { left: 22px; top: 158px; border-right: 0; border-top: 0; } .vf-c.br { right: 22px; top: 158px; border-left: 0; border-top: 0; }
.vf-cap { margin: 8px 2px 0; font: 500 11px/1.35 var(--sans); color: rgba(250, 249, 245, .82); }

.surfaces { display: flex; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.surface { display: flex; align-items: center; gap: 8px; padding: 9px 14px 9px 10px; border-radius: 2px; color: var(--ink-2); font: 620 14px var(--display); font-stretch: 110%; }
.surface svg { width: 22px; height: 22px; fill: currentColor; }
.surface:hover { color: var(--ink); background: rgba(29, 29, 27, .04); }
.surface[aria-checked="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--cobalt); }

.export-title { margin: 0; font: 600 13px var(--sans); color: var(--ink-3); }
.formats { display: flex; gap: 18px; margin-top: 6px; }
.format { font: 860 34px/1 var(--display); font-stretch: 125%; letter-spacing: -.04em; color: rgba(29, 29, 27, .22); padding: 4px 0 8px; transition: color .2s; }
.format:hover { color: var(--ink-2); }
.format[aria-checked="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--cobalt); }
.format-note { margin: 12px 0 0; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.format-warn { margin: 6px 0 0; font-size: 12.5px; color: var(--amber); }
.sizes { display: flex; gap: 6px; margin-top: 14px; }
.size { font: 500 12.5px var(--mono); padding: 7px 10px; border-radius: 2px; box-shadow: inset 0 0 0 1px var(--line-2); }
.size[aria-checked="true"] { background: var(--ink); color: var(--bone); box-shadow: none; }
.download {
  width: 100%; margin-top: 22px; height: 60px; background: var(--ink); color: var(--bone); border-radius: 2px;
  font: 700 18px var(--display); font-stretch: 116%; letter-spacing: -.01em; transition: background .2s;
}
.download:hover:not(:disabled) { background: var(--cobalt); }
.export-row { display: flex; gap: 8px; }
.export-row .quiet-btn { flex: 1; }

/* --- surfaces --- */
.sf { position: relative; }
.card { position: absolute; inset: 0; border-radius: 3px; }
.card-front {
  background: #FBFAF7; transform: rotate(-4deg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .38 0 0 0 0 .3 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  box-shadow: inset 0 1px 0 #fff, 0 0 0 .5px rgba(0, 0, 0, .08), 0 2px 3px rgba(var(--shadow-warm), .12), 0 18px 30px -12px rgba(var(--shadow-warm), .35);
}
.card-back { background: #23231F; transform: translate(9%, 16%) rotate(7deg); box-shadow: 0 16px 30px -14px rgba(var(--shadow-warm), .5); }
.cf-name { margin: 0; font-family: var(--display); font-weight: 760; font-stretch: 116%; letter-spacing: -.02em; color: #1D1D1B; }
.cf-role { margin: .5em 0 0; font-family: var(--sans); color: #5F5D57; }
.cf-lines { position: absolute; margin: 0; font-family: var(--sans); line-height: 1.5; color: #3A3935; }
.sf-menu {
  background: #F6F1E6; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .06), 0 2px 4px rgba(var(--shadow-warm), .1), 0 30px 50px -24px rgba(var(--shadow-warm), .4);
  transform: rotate(2deg); color: #2A2824;
}
.sf-menu::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0, 0, 0, .04), transparent 6%, transparent 94%, rgba(0, 0, 0, .05)); pointer-events: none; }
.mn-house { margin: 0; font-family: var(--display); font-weight: 300; font-stretch: 125%; letter-spacing: .02em; text-align: center; }
.mn-sub { margin: .4em 0 0; text-align: center; font-family: var(--sans); color: #6E6A60; }
.mn-h { margin-bottom: .5em; font-family: var(--display); font-weight: 700; font-stretch: 112%; }
.mn-i { margin: 0 0 .55em; display: flex; align-items: baseline; gap: .4em; font-family: var(--sans); }
.mn-i i { flex: 1; border-bottom: 1px dotted rgba(0, 0, 0, .3); }
.mn-foot { position: absolute; display: flex; align-items: center; }
.mn-foot p { margin: 0; font-family: var(--sans); line-height: 1.35; color: #4F4B43; }
.mn-foot .slot { position: relative; }
.sf-pack { transform-style: preserve-3d; }
.box { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(-12deg) rotateY(-34deg); }
.face { position: absolute; left: 0; top: 0; backface-visibility: hidden; }
.face.front { background: #F1EEE7; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .08); overflow: hidden; }
.face.front .band { position: absolute; left: 0; right: 0; top: 0; background: #2440FF; }
.pk-name { margin: 0; position: relative; font-family: var(--display); font-weight: 850; font-stretch: 120%; letter-spacing: -.03em; color: #1D1D1B; }
.pk-sub { margin: .4em 0 0; font-family: var(--sans); color: #5F5D57; line-height: 1.35; }
.face.side { background: #DCD7CC; }
.face.side p { margin: 0; font-family: var(--sans); color: #5F5D57; line-height: 1.4; }
.face.top { background: #F7F5F0; }
.sf-pack::after { content: ''; position: absolute; left: -20%; right: -40%; bottom: -12%; height: 22%; background: radial-gradient(closest-side, rgba(var(--shadow-warm), .3), transparent); transform: translateZ(-60px); z-index: -1; }
.sf-poster { background: #F7F5F0; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .06), 0 20px 40px -20px rgba(var(--shadow-warm), .45); overflow: hidden; color: #1D1D1B; }
.ps-block { position: absolute; left: 0; right: 0; top: 0; background: #2440FF; }
.ps-big { margin: 0; position: relative; font-family: var(--display); font-weight: 900; font-stretch: 125%; letter-spacing: -.05em; line-height: .86; }
.ps-date { margin: .8em 0 0; font-family: var(--sans); font-weight: 600; }
.ps-addr { position: absolute; margin: 0; font-family: var(--sans); line-height: 1.4; color: #5F5D57; }
.sf-screen { display: grid; justify-items: center; }
.bezel { width: 100%; padding: 10px; background: #26262A; border-radius: 6px; box-shadow: 0 24px 40px -20px rgba(var(--shadow-warm), .55); }
.display { position: relative; background: #FFFFFF; border-radius: 2px; overflow: hidden; }
.sc-big { margin: 0; font-family: var(--display); font-weight: 820; font-stretch: 120%; letter-spacing: -.04em; color: #1D1D1B; }
.sc-sub { margin: .8em 0 0; font-family: var(--sans); color: #5F5D57; line-height: 1.4; }
.stand { display: block; width: 18%; height: 34px; background: linear-gradient(#3A3A3E, #2A2A2E); clip-path: polygon(30% 0, 70% 0, 100% 100%, 0 100%); }
.sf-bare { display: flex; align-items: flex-end; gap: 40px; }
.sf-bare .slot { position: relative; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 0 0 1px rgba(29, 29, 27, .07), 0 22px 34px -14px rgba(var(--shadow-warm), .3), 0 60px 90px -40px rgba(var(--shadow-warm), .4); }
.sf-bare .slot::after { content: ''; position: absolute; left: 1px; right: 1px; top: 100%; height: 10px; background: linear-gradient(var(--stone), var(--stone-2)); }
.museum { width: 190px; padding: 12px 0 0; border-top: 1px solid var(--ink); font-size: 12px; line-height: 1.5; color: var(--ink-2); }
.museum p { margin: 0; }
.museum .mu-t { font: 700 14px var(--display); font-stretch: 112%; color: var(--ink); margin-bottom: 4px; }

.flight { position: fixed; z-index: 60; display: none; pointer-events: none; transform-origin: top left; }
.flight svg { width: 100%; height: 100%; display: block; }

/* ---------------------------------------------------------------- toast, micro-feedback */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 80; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bone); padding: 11px 16px; border-radius: 2px; font: 500 13.5px var(--sans); max-width: calc(100vw - 32px);
  transition: opacity .25s, transform .3s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.pulse { animation: pulseK .32s var(--ease); }
@keyframes pulseK { 0% { transform: scale(.94); } 100% { transform: none; } }

/* ---------------------------------------------------------------- mid widths */
@media (max-width: 1240px) and (min-width: 821px) {
  .bench { grid-template-columns: minmax(0, 1fr) 240px; column-gap: 28px; padding-right: 32px; }
  .plinth-wrap, .shelf { margin-left: 290px; }
  .callout { width: 200px; }
  .sentence { font-size: 38px; }
  .reveal-grid { grid-template-columns: 220px minmax(0, 1fr) 240px; gap: 28px; }
}

/* ---------------------------------------------------------------- mobile: a native-feeling instrument */
@media (max-width: 820px) {
  :root { --ruler: 0px; }
  .ruler { display: none; }
  .masthead { height: 56px; left: 0; padding: 0 16px; gap: 12px; background: color-mix(in srgb, var(--porcelain) 90%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
  .wordmark { font-size: 20px; }
  .wordmark-note { display: none; }
  .mode-opt { padding: 7px 8px; font-size: 12.5px; }
  .mode-why { display: none; }
  .mast-reveal { display: block; font: 700 14px var(--display); font-stretch: 112%; background: var(--ink); color: var(--bone); padding: 10px 14px; border-radius: 2px; min-height: 40px; }
  .mast-reveal:disabled { opacity: .3; }

  .bench, .is-empty .bench {
    display: flex; flex-direction: column; align-items: stretch; padding: 76px 16px calc(110px + env(safe-area-inset-bottom)); min-height: 100svh; gap: 0;
  }
  .is-empty .bench { justify-content: flex-start; }
  .intent-title { font-size: clamp(36px, 10.6vw, 60px); margin: 18px 0 20px; overflow-wrap: break-word; }
  .sentence { font-size: 28px; }
  .sentence.dense { font-size: 22px; }
  .is-empty .sentence { font-size: 24px; }
  .kinds { gap: 0 14px; flex-wrap: nowrap; overflow-x: auto; margin: 10px -16px 0; padding: 0 16px; scrollbar-width: none; }
  .kinds::-webkit-scrollbar { display: none; }
  .kind { white-space: nowrap; padding: 10px 0; font-size: 14px; }
  .kinds-lead { white-space: nowrap; }
  .examples { margin-top: 20px; }
  .intent { transition: opacity .3s; min-width: 0; }
  .stage, .mhall { min-width: 0; }
  .sheet-open .intent { opacity: 0; pointer-events: none; }

  .stage { order: 2; margin-top: 18px; }
  .plinth-wrap, .is-empty .plinth-wrap { margin-left: 0; padding: 12px 0 30px; }
  .is-empty .stage { margin-top: 28px; }
  .callouts, .leaders, .instrument, .hover-chip, .anatomy-btn, .hallmark, .shelf { display: none !important; }

  .mhall { display: block; order: 3; }
  .is-empty .mhall { display: none; }
  .mhall-btn { width: 100%; display: flex; align-items: center; gap: 14px; padding: 10px 0; text-align: left; border-top: 1px solid var(--line); }
  .mhall-stamp { width: 52px; height: 52px; flex: none; }
  .mhall-stamp .stamp { width: 52px; height: 52px; }
  .mhall-stamp .stamp-ring { font-size: 12px; }
  .mhall-text { display: grid; }
  .mhall-text b { font: 780 20px var(--display); font-stretch: 114%; letter-spacing: -.02em; }
  .mhall-text span { font-size: 13px; color: var(--ink-2); }

  /* the slide-rule rail */
  .rail {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: var(--bone);
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .is-empty .rail { transform: translateY(110%); }
  .rail { transition: transform .4s var(--ease); }
  .rail::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: linear-gradient(90deg, var(--line-2) 1px, transparent 1px) 0 0 / 8px 6px repeat-x; pointer-events: none; }
  .rail-track { display: flex; overflow-x: auto; scroll-snap-type: x proximity; padding: 0 8px; scrollbar-width: none; }
  .rail-track::-webkit-scrollbar { display: none; }
  .rail-key {
    flex: 0 0 auto; min-width: 88px; height: 70px; display: grid; place-items: center; scroll-snap-align: center; position: relative;
    font: 660 15px var(--display); font-stretch: 114%; color: var(--ink-2);
  }
  .rail-key i { position: absolute; left: 50%; bottom: 12px; width: 1px; height: 8px; background: var(--line-2); }
  .rail-key[aria-pressed="true"] { color: var(--ink); }
  .rail-key[aria-pressed="true"]::before { content: ''; position: absolute; inset: 12px 8px 10px; border: 1.5px solid var(--ink); border-radius: 2px; box-shadow: inset 0 -2px 0 var(--cobalt); }
  .rail-key[aria-pressed="true"] i { opacity: 0; }
  .rail-key[data-flag="warn"] span::after, .rail-key[data-flag="fail"] span::after { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); margin-left: 6px; vertical-align: 3px; }
  .rail-key[data-flag="fail"] span::after { background: var(--rust); }
  .rail-key:disabled { opacity: .35; }

  .sheet {
    display: block; position: fixed; left: 0; right: 0; bottom: calc(71px + env(safe-area-inset-bottom)); z-index: 34; height: 50vh; background: var(--bone);
    border-radius: 14px 14px 0 0; box-shadow: 0 -1px 0 var(--line), 0 -24px 50px -24px rgba(var(--shadow-warm), .4);
    transform: translateY(calc(100% + 80px)); transition: transform .38s var(--ease), height .38s var(--ease);
  }
  .sheet.is-open { transform: none; }
  .sheet.is-full { height: calc(88vh - 71px); }
  .sheet-handle { display: block; width: 100%; height: 26px; touch-action: none; }
  .sheet-handle i { display: block; width: 44px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 10px auto 0; }
  .sheet-body { height: calc(100% - 26px); overflow: auto; overscroll-behavior: contain; }
  .sheet-body .inst-head { padding-top: 4px; }
  .sheet-body .inst-body { padding-bottom: 28px; }
  .sheet-body .keys { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
  .sheet-body .key { min-height: 64px; }
  .sheet-body .ink { width: 38px; height: 48px; }
  .sheet-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 6px; padding: 8px 16px 24px; }
  .sheet-presets .preset-mini { width: 72px; }
  .stage { transform-origin: 50% 0; }

  .reveal-top { padding: 72px 16px 0; flex-wrap: wrap; gap: 6px; }
  .reveal-static { margin: 0; width: 100%; }
  .reveal-grid { display: flex; flex-direction: column; padding: 14px 16px calc(40px + env(safe-area-inset-bottom)); gap: 22px; }
  .scene-col { order: 1; width: 100%; }
  .reveal-meta { order: 2; width: 100%; }
  .export { order: 3; width: 100%; }
  .scene { height: 58svh; min-height: 360px; }
  .viewfinder { width: 128px; right: 10px; bottom: 10px; padding: 6px; }
  .viewfinder canvas { width: 116px; height: 116px; }
  .vf-c { width: 12px; height: 12px; }
  .vf-c.tl { left: 14px; top: 14px; } .vf-c.tr { right: 14px; top: 14px; } .vf-c.bl { left: 14px; top: 106px; } .vf-c.br { right: 14px; top: 106px; }
  .vf-cap { font-size: 10px; }
  .scene-hint { display: none; }
  .sf-bare { flex-direction: column; align-items: center; gap: 22px; }
  .museum { width: auto; max-width: 240px; text-align: center; }
  .surfaces { flex-wrap: nowrap; overflow-x: auto; margin: 10px -16px 0; padding: 0 16px; scrollbar-width: none; }
  .surface { flex: none; min-height: 44px; }
  .reveal-kind { font-size: 34px; }
  .download { height: 56px; }
  .quiet-btn { min-height: 44px; }
  .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
}

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
