/* Şeref Çimen portfolio: the whole page is Level 0.
   Yellow wallpaper, a drop ceiling with fluorescent panels, carpet at the bottom.
   Content hangs on the walls as papers and plates, written in Clark's hand (two
   self-hosted fonts, fonts/); everything else uses system fonts;
   all textures are small repeating CSS/SVG patterns, nothing is fixed-attached. */

:root {
  --wall: #d4bf74;
  --ink: #2a2210;            /* body text on wall, paper, plates (≥6.2:1 on the darkest wall stain) */
  --ink-soft: #5e5136;       /* secondary text on paper (6.7:1) */
  --paper: #f4efdd;
  --paper-old: #eee4c6;      /* a paper that has hung in the building for a long time */
  --pinned-old: #f0e7cf;
  --manila: #dcc38a;
  --manila-soft: #57461f;    /* secondary text on manila (5.3:1) */
  --plate: #e6dfc6;
  --plate-soft: #5a5039;     /* secondary text on plates (6.0:1) */
  --plaque: #2c2a24;
  --plaque-fg: #eee6cc;
  --plaque-soft: #b9b096;
  --frame: #8f8670;
  --exit: #0e6b36;
  --exit-fg: #f4fff4;
  --red: #8c2a1c;
  --link: #6b3209;
  --ceiling: #dcd6c1;
  --carpet: #5a4a28;
  --carpet-fg: #f3ead0;
  --carpet-soft: #d6c9a2;
  --focus: #0b3d91;
  --marker: #2b2112;         /* Clark's marker on the wallpaper (≥5.2:1 on the darkest lit wallpaper behind it) */
  --marker-red: #5f180f;     /* red marker text (≥4.6:1 there) */
  --pencil: #3b3529;         /* pencil on the wallpaper (≥4.6:1 there) */
  --pencil-paper: #5a5240;   /* pencil on a paper note (6.7:1) */
  --hand: "Clark Hand", "Segoe Print", "Bradley Hand", "Chalkboard SE", "Marker Felt", cursive;
  --hand-calm: "Clark Hand Calm", "Clark Hand", "Segoe Print", "Bradley Hand", "Chalkboard SE", "Marker Felt", cursive;
  --focus-dark: #ffd84a;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --cond: "Bahnschrift SemiCondensed", "Roboto Condensed", "Arial Narrow", "Liberation Sans Narrow", "DejaVu Sans Condensed", "Helvetica Neue", var(--sans);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --paper-shadow: 0 2px 3px rgba(70, 52, 12, 0.32);
  color-scheme: light;
}

/* Clark's lettering as two fonts (fonts/, ~12 KB each): Latin and Turkish letters, digits
   and the punctuation the site uses. Hand is the jittery marker for headings and labels;
   Calm is the same hand with less jitter and a lighter line, for paragraphs.
   swap: text paints at once in the fallback. */
@font-face {
  font-family: "Clark Hand";
  src: url("fonts/clark-hand.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Clark Hand Calm";
  src: url("fonts/clark-hand-calm.woff2") format("woff2");
  font-display: swap;
}

/* Clark's marks: hand-drawn boxes, underlines, rules and an arrow, as inline SVG with
   non-scaling strokes, so they stretch to any box without thickening. */
:root {
  --clark-underline-red: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 16' preserveAspectRatio='none'%3E%3Cpath d='M4 11L37 10L71 10L102 10L133 10L168 7L201 8L232 7L266 7L298 7L329 7L362 7L396 8' fill='none' stroke='%237d2216' stroke-width='3.4' stroke-opacity='0.95' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M10 13L41 11L72 12L104 12L136 11L169 10L201 9L230 8L263 9L295 10L327 9L357 8L389 7' fill='none' stroke='%237d2216' stroke-width='2.2' stroke-opacity='0.55' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-underline-ink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 9' preserveAspectRatio='none'%3E%3Cpath d='M1 4L31 5L61 6L91 4L120 4L149 4L179 5L209 5L238 3L269 4L297 5' fill='none' stroke='%232b2112' stroke-width='2' stroke-opacity='0.9' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-underline-red-thin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 9' preserveAspectRatio='none'%3E%3Cpath d='M2 5L32 5L61 5L92 4L120 5L150 4L179 5L210 5L239 3L269 3L299 5' fill='none' stroke='%237d2216' stroke-width='2.6' stroke-opacity='0.95' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-box: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 100' preserveAspectRatio='none'%3E%3Cpath d='M5 8L55 9L102 7L149 6L198 5L245 8L293 5L294 33L292 63L291 92L244 94L198 93L150 94L104 93L57 94L9 94L7 63L7 35L6 3L29 7' fill='none' stroke='%232b2112' stroke-width='7' stroke-opacity='0.95' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M9 7L56 7L103 8L153 10L198 7L246 8L295 8L293 36L291 65L290 91L241 91L194 93L149 92L100 93L56 90L7 90L8 63L10 34L10 5L30 5' fill='none' stroke='%232b2112' stroke-width='4' stroke-opacity='0.6' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-box-red: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 100' preserveAspectRatio='none'%3E%3Cpath d='M6 7L54 6L102 7L149 7L197 6L245 5L294 7L292 34L293 65L292 92L246 91L198 92L149 92L102 94L54 94L8 94L7 63L5 33L7 4L29 6' fill='none' stroke='%237d2216' stroke-width='7' stroke-opacity='0.95' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M8 9L55 9L103 8L153 8L199 9L246 9L293 10L291 36L289 64L289 93L242 91L195 93L147 92L101 92L54 92L8 91L9 62L8 32L10 4L29 7' fill='none' stroke='%237d2216' stroke-width='4' stroke-opacity='0.6' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 40' preserveAspectRatio='xMidYMid meet'%3E%3Cpath d='M4 31L21 26L38 23L57 20L75 22' fill='none' stroke='%237d2216' stroke-width='3.6' stroke-opacity='0.95' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M60 8L76 20L59 33' fill='none' stroke='%237d2216' stroke-width='3.6' stroke-opacity='0.95' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M6 32L22 28L39 22L58 21L73 22' fill='none' stroke='%237d2216' stroke-width='2.2' stroke-opacity='0.55' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-box-thin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 100' preserveAspectRatio='none'%3E%3Cpath d='M5 7L53 9L102 7L151 6L199 6L245 8L295 5L295 35L291 63L292 93L246 92L197 93L149 93L102 93L56 92L7 95L6 64L8 33L6 3L29 6' fill='none' stroke='%232b2112' stroke-width='2.4' stroke-opacity='0.9' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M9 7L55 8L104 7L152 8L200 8L245 10L295 10L294 37L290 63L287 92L242 92L196 92L148 91L101 90L53 92L7 91L7 63L10 31L8 4L31 5' fill='none' stroke='%232b2112' stroke-width='1.5' stroke-opacity='0.5' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-box-pale: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 100' preserveAspectRatio='none'%3E%3Cpath d='M8 9L54 8L104 8L151 7L199 6L246 5L295 4L294 35L292 64L292 92L246 92L197 91L150 92L103 94L56 93L9 95L7 65L7 35L4 5L29 6' fill='none' stroke='%23eee6cc' stroke-width='2.4' stroke-opacity='0.9' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M10 9L56 7L103 8L152 9L201 9L245 9L293 9L293 36L292 65L289 92L243 93L194 93L147 91L100 93L53 91L8 90L7 61L9 32L9 4L30 5' fill='none' stroke='%23eee6cc' stroke-width='1.5' stroke-opacity='0.5' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-box-small: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' preserveAspectRatio='none'%3E%3Cpath d='M3 4L17 2L17 17L3 17L4 3L8 4' fill='none' stroke='%232b2112' stroke-width='2' stroke-opacity='0.95' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M4 3L16 4L18 16L2 17L2 5' fill='none' stroke='%232b2112' stroke-width='1.2' stroke-opacity='0.5' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-ring-red: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 100' preserveAspectRatio='none'%3E%3Cpath d='M15 34L48 20L100 9L162 5L221 12L269 25L293 43L291 61L262 79L213 89L152 94L89 90L38 80L10 62L5 42L29 26' fill='none' stroke='%237d2216' stroke-width='2.8' stroke-opacity='0.95' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-rule: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 7' preserveAspectRatio='none'%3E%3Cpath d='M1 3L39 4L75 3L113 3L150 4L188 4L225 4L262 4L298 4' fill='none' stroke='%235a5240' stroke-width='1.2' stroke-opacity='0.7' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-edge-t: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 8' preserveAspectRatio='none'%3E%3Cpath d='M-0 3L34 4L67 4L102 5L133 4L167 4L200 5L232 5L265 5L301 3' fill='none' stroke='%235a5240' stroke-width='1.6' stroke-opacity='0.85' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M4 4L37 6L68 4L101 4L134 4L167 4L199 5L230 5L264 2L295 4' fill='none' stroke='%235a5240' stroke-width='1.1' stroke-opacity='0.5' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-edge-b: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 8' preserveAspectRatio='none'%3E%3Cpath d='M2 3L34 3L68 4L101 5L132 4L168 4L200 4L233 4L265 5L297 5' fill='none' stroke='%235a5240' stroke-width='1.6' stroke-opacity='0.85' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M6 6L36 4L69 3L102 4L133 3L166 4L198 4L231 5L263 3L296 3' fill='none' stroke='%235a5240' stroke-width='1.1' stroke-opacity='0.5' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-edge-l: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 300' preserveAspectRatio='none'%3E%3Cpath d='M5 2L5 33L6 67L4 101L3 134L4 167L4 199L3 233L5 266L4 297' fill='none' stroke='%235a5240' stroke-width='1.6' stroke-opacity='0.85' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M6 4L4 37L6 71L3 102L4 135L4 166L3 198L3 229L2 263L2 296' fill='none' stroke='%235a5240' stroke-width='1.1' stroke-opacity='0.5' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-edge-r: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 300' preserveAspectRatio='none'%3E%3Cpath d='M5 -0L5 34L4 67L5 101L4 132L3 166L3 198L5 233L4 266L6 298' fill='none' stroke='%235a5240' stroke-width='1.6' stroke-opacity='0.85' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M4 4L4 37L5 69L5 100L3 135L3 167L5 199L5 230L4 264L2 296' fill='none' stroke='%235a5240' stroke-width='1.1' stroke-opacity='0.5' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-medge-t: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 8' preserveAspectRatio='none'%3E%3Cpath d='M-0 3L35 2L67 6L99 6L134 4L168 2L201 4L233 3L264 5L300 5' fill='none' stroke='%232b2112' stroke-width='2.6' stroke-opacity='0.85' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M5 4L38 5L70 6L101 5L134 3L165 3L197 3L231 3L263 2L295 4' fill='none' stroke='%232b2112' stroke-width='1.6' stroke-opacity='0.5' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-medge-b: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 8' preserveAspectRatio='none'%3E%3Cpath d='M1 3L35 3L68 5L102 5L134 4L165 6L201 2L232 3L267 4L299 4' fill='none' stroke='%232b2112' stroke-width='2.6' stroke-opacity='0.85' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M5 5L36 4L69 4L101 6L133 3L166 4L200 5L230 2L264 4L296 3' fill='none' stroke='%232b2112' stroke-width='1.6' stroke-opacity='0.5' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-medge-l: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 300' preserveAspectRatio='none'%3E%3Cpath d='M4 1L6 34L4 68L3 102L5 134L4 167L3 198L4 233L3 265L3 300' fill='none' stroke='%232b2112' stroke-width='2.6' stroke-opacity='0.85' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M6 5L6 36L6 71L4 102L4 133L3 167L3 199L2 231L4 263L4 296' fill='none' stroke='%232b2112' stroke-width='1.6' stroke-opacity='0.5' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --clark-medge-r: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 300' preserveAspectRatio='none'%3E%3Cpath d='M5 -0L5 35L5 67L5 102L5 134L3 167L2 200L3 232L4 265L2 301' fill='none' stroke='%232b2112' stroke-width='2.6' stroke-opacity='0.85' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M6 5L5 37L5 71L6 103L4 134L4 166L2 198L5 230L2 262L2 294' fill='none' stroke='%232b2112' stroke-width='1.6' stroke-opacity='0.5' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  /* A paper's frame: four edge strokes 3 px in from the edge (pencil), or in marker. */
  --clark-frame: var(--clark-edge-t) left top 3px / 100% 8px no-repeat, var(--clark-edge-b) left bottom 3px / 100% 8px no-repeat,
    var(--clark-edge-l) left 3px top / 8px 100% no-repeat, var(--clark-edge-r) right 3px top / 8px 100% no-repeat;
  --clark-mframe: var(--clark-medge-t) left top 2px / 100% 8px no-repeat, var(--clark-medge-b) left bottom 2px / 100% 8px no-repeat,
    var(--clark-medge-l) left 2px top / 8px 100% no-repeat, var(--clark-medge-r) right 2px top / 8px 100% no-repeat;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Wallpaper: one 40×72 tile (double pinstripe, faint stacked chevrons) over the base
   colour, plus a single soft gradient where the ceiling light falls. */
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  overflow-x: hidden;
  overflow-wrap: break-word;
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
  background-color: var(--wall);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='72'%3E%3Cpath d='M.5 0v72M3.5 0v72' stroke='rgba(110,84,22,.11)'/%3E%3Cpath d='M15 26l5-5 5 5M15 31l5-5 5 5' fill='none' stroke='rgba(118,90,24,.12)' stroke-width='1.2'/%3E%3Ccircle cx='20' cy='60' r='1' fill='rgba(118,90,24,.14)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, rgba(255, 248, 214, 0.3), rgba(255, 248, 214, 0) 520px);
  background-repeat: repeat, no-repeat;
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
code, kbd, .mono { font-family: var(--mono); font-size: 0.86em; }
kbd { border: 1px solid #a99f80; border-bottom-width: 2px; padding: 0 4px; border-radius: 2px; background: #f4efdd; }
.muted { color: var(--ink-soft); }
h1, h2, h3 { margin: 0; font-family: var(--cond); font-stretch: condensed; line-height: 1.05; }

.skip {
  position: absolute; left: 8px; top: -80px; z-index: 50;
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px;
  background: var(--plate); color: var(--ink); font-weight: 700; border: 2px solid var(--ink);
}
.skip:focus { top: 8px; }

/* ---------- Mounted objects ---------- */
/* Dark engraved plaque with four screws. */
.door-sign, .level-sign {
  color: var(--plaque-fg);
  background-color: var(--plaque);
  border: 3px solid var(--frame);
  border-radius: 3px;
}

/* Plastic wall plate: buttons and secondary links. */
.plate {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 14px;
  font: 600 14px/1.2 var(--sans); color: var(--ink); text-decoration: none;
  background: var(--plate);
  border: 1px solid #a99f80; border-bottom: 3px solid #8d8466; border-radius: 3px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.plate:hover { background: #efe9d3; color: var(--ink); }
.plate:active { border-bottom-width: 1px; margin-top: 2px; }
.plate[disabled] { color: var(--plate-soft); background: #ddd6bc; cursor: not-allowed; border-bottom-width: 1px; }
.plate-small { min-height: 40px; padding: 6px 12px; font-size: 13px; }

/* Lit exit-style sign: the CV. */
.exit {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 8px 16px;
  font: 800 16px/1.1 var(--cond); font-stretch: condensed; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--exit-fg); text-decoration: none;
  background: var(--exit);
  border: 3px solid #e7e1cc; border-radius: 3px;
  box-shadow: 0 0 14px rgba(70, 210, 120, 0.35);
  -webkit-tap-highlight-color: transparent;
}
.exit:hover { color: #fff; background: #11793e; }
.exit-small { min-height: 40px; padding: 6px 12px; font-size: 14px; }
.exit-big { min-height: 56px; font-size: 21px; }
.exit-sub { font: 700 13px/1 var(--mono); letter-spacing: 0.02em; text-transform: none; }

/* Paper with a strip of torn tape and Clark's pencil frame just inside the edge.
   Tape and frame are decoration only. Papers are written in his calm hand.
   Papers on the walls have aged: a yellowed sheet and a faint tide mark in one corner. */
.memo, .card { position: relative; color: var(--ink); box-shadow: var(--paper-shadow); }
.memo, .card { background: var(--clark-frame), var(--stain, none), var(--paper-old); }
:root {
  --stain-tr: radial-gradient(circle at 100% 0, transparent 0 22px, rgba(146, 108, 38, 0.2) 23px 25px, rgba(146, 108, 38, 0.07) 26px 44px, transparent 46px);
  --stain-bl: radial-gradient(circle at 0 100%, transparent 0 30px, rgba(146, 108, 38, 0.18) 31px 33px, rgba(146, 108, 38, 0.06) 34px 56px, transparent 58px);
  --stain-br: radial-gradient(70px 40px at 100% 100%, rgba(146, 108, 38, 0.1), rgba(146, 108, 38, 0.04) 70%, transparent);
  /* A torn bottom edge; the polygon reaches above the paper so the tape survives. */
  --torn: polygon(0 -30px, 100% -30px, 100% calc(100% - 3px), 93% 100%, 86% calc(100% - 4px), 77% calc(100% - 1px), 64% calc(100% - 5px), 52% calc(100% - 2px), 41% 100%, 30% calc(100% - 4px), 18% calc(100% - 1px), 9% calc(100% - 5px), 0 calc(100% - 2px));
}
.memo, .card { font: 16px/1.5 var(--sans); }
.memo::before, .card::before, .shot::before {
  content: ""; position: absolute; top: -9px; left: 50%; width: 76px; height: 20px; margin-left: -38px;
  background: rgba(247, 243, 222, 0.75);
  clip-path: polygon(0 12%, 5% 0, 12% 10%, 20% 2%, 80% 6%, 88% 0, 95% 9%, 100% 3%, 97% 52%, 100% 96%, 90% 88%, 84% 100%, 16% 94%, 8% 100%, 2% 90%, 4% 50%);
  transform: rotate(-2deg);
  pointer-events: none;
}

/* ---------- Ceiling ---------- */
.ceiling {
  position: sticky; top: 0; z-index: 20;
  height: calc(64px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background-color: var(--ceiling);
  background-image:
    linear-gradient(90deg, rgba(128, 119, 94, 0.6) 2px, transparent 2px),
    linear-gradient(0deg, rgba(128, 119, 94, 0.6) 2px, transparent 2px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cg fill='rgba(110,100,76,.22)'%3E%3Ccircle cx='9' cy='14' r='.9'/%3E%3Ccircle cx='31' cy='7' r='.7'/%3E%3Ccircle cx='50' cy='22' r='.9'/%3E%3Ccircle cx='18' cy='41' r='.7'/%3E%3Ccircle cx='44' cy='49' r='.9'/%3E%3Ccircle cx='57' cy='38' r='.6'/%3E%3Ccircle cx='27' cy='57' r='.8'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 64px 64px;
  border-bottom: 4px solid #a49b80;
  box-shadow: 0 3px 0 rgba(90, 70, 20, 0.18);
}
.ceiling-tiles { position: absolute; inset: env(safe-area-inset-top, 0px) 0 0 0; overflow: hidden; pointer-events: none; }
.lamp {
  position: absolute; top: 2px; width: 126px; height: 60px;
  background-color: #fcfbf3;
  background-image: repeating-linear-gradient(90deg, rgba(196, 190, 160, 0.35) 0 1px, transparent 1px 5px);
  border: 4px solid #c8c1a8;
  box-shadow: 0 0 18px rgba(255, 252, 228, 0.95);
}
.lamp-a { left: 194px; }
.lamp-b { left: 578px; }
.lamp-c { left: 962px; }
.lamp-d { left: 1346px; }
.lamp-dead { background-color: #bdb9a7; background-image: repeating-linear-gradient(90deg, rgba(120, 115, 95, 0.3) 0 1px, transparent 1px 5px); box-shadow: none; }
.tile-off {
  position: absolute; top: 3px; left: 770px; width: 62px; height: 62px;
  background: #d8d2bb; border: 1px solid rgba(128, 119, 94, 0.6);
  transform: translate(2px, 3px) rotate(1.4deg);
  box-shadow: inset 0 -3px 0 rgba(60, 50, 30, 0.25);
}
/* One-shot dip of a single panel after load. Never repeats; never runs with reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  html:not(.calm) .lamp-b { animation: dip 1.4s 0.9s 1 both; }
}
@keyframes dip {
  0%, 18%, 30%, 62%, 100% { opacity: 1; }
  22% { opacity: 0.72; }
  66% { opacity: 0.84; }
}

.ceiling-row {
  position: relative; height: 64px;
  display: flex; align-items: center; gap: 8px;
  max-width: 1480px; margin: 0 auto; padding: 0 12px;
}
.level-sign {
  display: inline-flex; align-items: center; min-height: 44px; padding: 6px 12px;
  font: 800 15px/1 var(--cond); font-stretch: condensed; text-transform: uppercase; letter-spacing: 0.12em;
  text-decoration: none;
}
.level-sign:hover { color: #fff; }
.signs { display: flex; gap: 6px; margin-right: auto; }
.signs a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px;
  font: 700 12px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--plaque-fg); background: #3a3830; border: 2px solid var(--frame); border-radius: 2px; text-decoration: none;
}
.signs a::after { content: "→"; font-family: var(--sans); }
.signs a:hover { background: var(--plaque); color: #fff; }

/* ---------- Room 0: plaque, doorway, control plate ---------- */
main { max-width: 1480px; margin: 0 auto; padding: 22px 12px 0; }
.level0 { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); }
.ident { display: grid; gap: 16px; align-content: start; min-width: 0; }

.plaque-kicker { margin: 0 0 10px; font: 600 12px/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--plaque-soft); }
h1 {
  font-size: clamp(2.4rem, 11vw, 3.7rem); font-weight: 800; letter-spacing: 0.01em;
  text-transform: uppercase; color: #f4ecd2;
}
.role { margin: 10px 0 0; font: 700 1.05rem/1.25 var(--cond); font-stretch: condensed; text-transform: uppercase; letter-spacing: 0.04em; color: #e3c55a; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions > * { flex: 1 1 auto; }
.actions .exit-big { flex-basis: 100%; }

.memo { padding: 18px 16px 14px; }
.memo-head { margin: 0 0 8px; font: 400 17px/1.3 var(--hand); text-transform: uppercase; letter-spacing: 0.05em; color: var(--red); }
.pitch { margin: 0 0 12px; }
.facts { margin: 0; display: grid; gap: 0; background: var(--clark-rule) top / 100% 7px no-repeat; }
.facts div { display: grid; grid-template-columns: 6.6em 1fr; gap: 8px; padding: 8px 0; background: var(--clark-rule) bottom / 100% 7px no-repeat; }
.facts dt { font: 400 15px/1.5 var(--hand); text-transform: uppercase; letter-spacing: 0.05em; color: var(--pencil-paper); }
.facts dd { margin: 0; font-size: 16px; line-height: 1.4; }

.help {
  margin: 12px 0 0; padding: 10px 12px;
  font: 16px/1.45 var(--hand-calm); color: var(--ink);
  background: var(--clark-frame), #efe9d3;
}
.help kbd { font-size: 0.85em; }
.sliders-head { margin: 12px 0 0; font: 400 15px/1.4 var(--hand); text-transform: uppercase; letter-spacing: 0.05em; color: var(--plate-soft); }

/* ---- Room 0 in Clark's hand: name, role, CV and links written on the wallpaper ---- */
.clark { color: var(--marker); }
.clark .plaque-kicker {
  margin: 0 0 6px; font: 400 15px/1.35 var(--hand); letter-spacing: 0.05em; color: var(--pencil);
}
.clark h1 {
  display: inline-block; padding: 0 6px 14px 0;
  font: 400 clamp(2.7rem, 13vw, 4.3rem)/1.02 var(--hand); letter-spacing: 0.03em; color: var(--marker);
  /* A heavier double pass for the name only: the stroke thickens every line evenly. */
  -webkit-text-stroke: 0.022em var(--marker);
  text-shadow: 0.045em 0.03em 0 rgba(43, 33, 18, 0.34);
  background: var(--clark-underline-red) left bottom / 100% 14px no-repeat;
}
.clark .role {
  margin: 8px 0 0; font: 400 1.32rem/1.25 var(--hand); letter-spacing: 0.03em; color: var(--marker-red); text-wrap: balance;
  text-shadow: 0.03em 0.02em 0 rgba(95, 24, 15, 0.3);
}
.clark .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; margin-top: 18px; }
.clark .actions > * { flex: 0 1 auto; }
/* Red arrow at the CV, then a line break before the links. */
.clark .actions::before {
  content: ""; flex: 0 0 auto; width: 64px; height: 34px; margin-right: -8px;
  background: var(--clark-arrow) center / contain no-repeat;
}
.clark .actions::after { content: ""; flex: 0 0 100%; order: 1; height: 0; }
.clark .actions .plate { order: 2; }
.clark .actions .exit-big {
  flex: 0 0 auto; display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 64px; padding: 10px 22px 10px 20px;
  font: 400 2.4rem/1 var(--hand); letter-spacing: 0.04em; text-transform: none; color: var(--marker);
  -webkit-text-stroke: 0.015em currentColor;
  text-shadow: 0.025em 0.02em 0 rgba(43, 33, 18, 0.38);
  background: var(--clark-box) center / 100% 100% no-repeat; border: 0; border-radius: 0; box-shadow: none;
}
.clark .actions .exit-big:hover { color: var(--marker-red); background: var(--clark-box-red) center / 100% 100% no-repeat; }
.clark .exit-sub { font: 400 15px/1.1 var(--hand); letter-spacing: 0.04em; text-shadow: none; -webkit-text-stroke: 0; }
.clark a:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.clark .plate {
  min-height: 44px; padding: 8px 2px 10px;
  font: 400 17px/1.2 var(--hand); letter-spacing: 0.03em; color: var(--marker);
  background: var(--clark-underline-ink) left bottom 6px / 100% 8px no-repeat; border: 0; border-radius: 0;
}
.clark .plate:hover { color: var(--marker-red); background: var(--clark-underline-red-thin) left bottom 6px / 100% 8px no-repeat; }
.clark .plate:active { margin-top: 0; }
/* The hint is a pencil note on a scrap of paper taped to the wall: lower on the wall the
   lit wallpaper is too dark for small pencil text. */
.clark .walk-hint {
  position: relative; display: inline-block; margin: 16px 0 0; padding: 8px 12px 9px;
  font: 400 15px/1.35 var(--hand); letter-spacing: 0.03em; text-transform: none; color: var(--pencil-paper);
  background: var(--paper); border: 0; box-shadow: 0 1px 2px rgba(70, 52, 12, 0.3);
  transform: rotate(-1.2deg); transform-origin: 0 50%;
}
.clark .walk-hint::before {
  content: ""; position: absolute; left: calc(50% - 22px); top: -7px; width: 44px; height: 14px;
  background: rgba(236, 230, 206, 0.7); box-shadow: 0 0 0 1px rgba(150, 135, 95, 0.25); transform: rotate(4deg);
}

/* Wall-mounted control plate for the matrix. */
.control {
  min-width: 0; align-self: start;
  padding: 18px 16px 16px;
  background-color: var(--plate);
  background-image:
    radial-gradient(circle at 10px 10px, #8d8466 2.2px, transparent 2.8px),
    radial-gradient(circle at calc(100% - 10px) 10px, #8d8466 2.2px, transparent 2.8px),
    radial-gradient(circle at 10px calc(100% - 10px), #8d8466 2.2px, transparent 2.8px),
    radial-gradient(circle at calc(100% - 10px) calc(100% - 10px), #8d8466 2.2px, transparent 2.8px);
  border: 1px solid #a99f80; border-bottom: 3px solid #8d8466; border-radius: 6px;
  box-shadow: var(--paper-shadow);
}
.control-title {
  justify-self: start; display: inline-block; margin: 0 0 12px; padding: 0 4px 10px 0;
  font: 400 1.6rem/1.1 var(--hand); text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink);
  background: var(--clark-underline-red) left bottom / 100% 10px no-repeat;
}
.note { margin: 0 0 12px; font: 16px/1.45 var(--hand-calm); color: var(--plate-soft); }
.note code { font-size: 0.8em; }
.formula { margin: 0 0 2px; color: var(--ink); }
.formula { font-size: 15px; }
.formula sub { font-size: 0.82em; }
.formula-note { margin: 0 0 10px; font: 16px/1.4 var(--hand-calm); color: var(--plate-soft); }
.formula-note sub { font-size: 0.95em; vertical-align: -0.2em; }
.lcd {
  padding: 6px 6px 4px;
  background: #c3c9ad;
  border: 3px solid #6e6a58; border-top-color: #57544a; border-bottom-color: #8b8670; border-radius: 3px;
}
.mtx { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mtx td {
  padding: 7px 2px; text-align: center; font-size: 15px; font-variant-numeric: tabular-nums;
  color: #1d2318; border: 1px solid rgba(29, 35, 24, 0.18);
}
.det { margin: 4px 2px 0; font-size: 12px; color: #1d2318; text-align: right; }

.sliders { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; margin-top: 6px; }
.sliders label {
  display: flex; justify-content: space-between; align-items: baseline;
  font: 400 16px/1 var(--hand); text-transform: uppercase; letter-spacing: 0.05em; color: var(--plate-soft);
}
/* Numbers stay in mono, so they are never ambiguous. */
.sliders output { font: 700 13px/1 var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: 0; }
input[type="range"] {
  width: 100%; height: 40px; margin: 0 0 4px; background: transparent; cursor: pointer;
  -webkit-appearance: none; appearance: none; touch-action: pan-y;
}
input[type="range"]::-webkit-slider-runnable-track { height: 6px; background: #b3a986; border: 1px solid #6e6a58; border-radius: 3px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 26px; margin-top: -11px;
  background: #f6f1df; border: 1px solid #5a5039; border-bottom-width: 3px; border-radius: 3px;
}
input[type="range"]::-moz-range-track { height: 6px; background: #b3a986; border: 1px solid #6e6a58; border-radius: 3px; }
input[type="range"]::-moz-range-thumb { width: 20px; height: 24px; background: #f6f1df; border: 1px solid #5a5039; border-radius: 3px; }
input[type="range"]:focus-visible { outline-offset: 0; }
.row-btns { display: flex; gap: 8px; margin-top: 6px; }
.row-btns .plate {
  flex: 1 1 0; font: 400 18px/1.1 var(--hand); letter-spacing: 0.03em;
  background: var(--clark-box-thin) center / 100% 100% no-repeat, transparent; border: 0;
}
.row-btns .plate:hover { background: var(--clark-box-thin) center / 100% 100% no-repeat, #efe9d3; }
.row-btns .plate:active { margin-top: 0; }
#scene-auto[aria-pressed="true"] { background: var(--clark-box-thin) center / 100% 100% no-repeat, #f3d77a; }
.motion-note { margin: 8px 0 0; font: 16px/1.4 var(--hand-calm); color: var(--plate-soft); }

/* ---------- Rooms ---------- */
.room { position: relative; isolation: isolate; margin-top: 54px; }
/* Damp stains: soft, low-contrast blots on the wallpaper behind each room. */
.room::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  top: -30px; right: 0; width: 46%; height: 380px;
  background: radial-gradient(closest-side, rgba(120, 95, 30, 0.13), rgba(120, 95, 30, 0.05) 60%, transparent);
}
#profile::before { left: 0; right: auto; top: 40%; width: 40%; }
#contact::before { right: 10%; top: -60px; width: 30%; height: 260px; }

.room-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; margin-bottom: 22px; }
.room-plaque {
  display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; padding: 0 6px 14px 0;
  color: var(--marker); background: var(--clark-underline-red) left bottom / 100% 12px no-repeat;
}
.room-no { font: 400 17px/1 var(--hand); text-transform: uppercase; letter-spacing: 0.06em; color: var(--pencil); }
.room-plaque h2 {
  font: 400 clamp(2.1rem, 9vw, 2.9rem)/1.02 var(--hand); text-transform: uppercase; letter-spacing: 0.03em; color: var(--marker);
  -webkit-text-stroke: 0.018em var(--marker); text-shadow: 0.04em 0.03em 0 rgba(43, 33, 18, 0.32);
}

/* Project papers. */
.cards { display: grid; gap: 26px 18px; grid-template-columns: minmax(0, 1fr); }
.card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px 16px 14px;
  min-width: 0;
}
.card header { display: grid; gap: 4px; padding-bottom: 12px; background: var(--clark-underline-red-thin) left bottom / 100% 8px no-repeat; }
.card-meta { margin: 0; font: 400 15px/1.3 var(--hand); text-transform: uppercase; letter-spacing: 0.05em; color: var(--pencil-paper); }
.card h3 { font: 400 1.62rem/1.12 var(--hand); color: var(--ink); -webkit-text-stroke: 0.012em var(--ink); }
.card p { margin: 0; }
.card details { padding-top: 8px; background: var(--clark-rule) top / 100% 7px no-repeat; }
/* "+ how it works", scrawled, in a drawn box. */
.card summary {
  min-height: 44px; display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  font: 400 18px/1 var(--hand); text-transform: lowercase; letter-spacing: 0.03em; color: var(--red);
}
.card summary::-webkit-details-marker { display: none; }
.card summary::before {
  content: "+"; display: inline-grid; place-items: center; width: 24px; height: 24px; padding-top: 2px;
  font: 400 19px/1 var(--hand); color: var(--marker); background: var(--clark-box-small) center / 100% 100% no-repeat;
}
.card details[open] summary::before { content: "−"; }
.card ul { margin: 6px 0 0; padding-left: 20px; font-size: 16px; }
.card li { margin: 5px 0; }
.card li::marker { color: var(--red); }
/* The stack is a scribbled list in pencil. */
.stack { margin-top: auto !important; font: 13px/1.5 var(--mono); letter-spacing: 0; color: var(--pencil-paper); }
/* Links: underlined handwriting, 44 px tall to tap. */
.links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 18px; font: 400 18px/1.2 var(--hand); }
.links a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px;
  color: var(--ink); text-decoration: none;
  background: var(--clark-underline-ink) left bottom 6px / 100% 7px no-repeat;
}
.links a:hover { color: var(--marker-red); background-image: var(--clark-underline-red-thin); }
.links.muted { font: 15px/1.3 var(--sans); color: var(--ink-soft); min-height: 44px; }
.links-label { align-self: center; font: 400 15px/1.2 var(--hand); color: var(--pencil-paper); }
.card:nth-child(3n + 1) { --stain: var(--stain-tr); }
.card:nth-child(3n + 2) { --stain: var(--stain-bl); }
.card:nth-child(3n) { --stain: var(--stain-br); }
.card:nth-child(5n + 2), .card:nth-child(7n) { clip-path: var(--torn); }
/* Date and heading accents on some papers. */
.card-meta.ringed {
  justify-self: start; margin: -6px 0 -6px -20px; padding: 8px 22px; background: var(--clark-ring-red) center / 100% 100% no-repeat;
}
.card:nth-child(4n) header {
  background: var(--clark-underline-red-thin) left bottom / 100% 8px no-repeat, var(--clark-underline-red-thin) 6px bottom 4px / 70% 7px no-repeat;
}
.card:nth-child(3n) h3 { text-shadow: 0.03em 0.025em 0 rgba(42, 34, 16, 0.42), -0.02em 0.012em 0 rgba(42, 34, 16, 0.25); }
.card-small p { font-size: 16px; }

/* HORUS: a manila case file with a pinned photo. */
.card-wide { background: var(--clark-frame), var(--stain, none), var(--manila); }
.card-wide::before { display: none; }
.card-wide::after {
  content: ""; position: absolute; top: -14px; left: -1px; width: 150px; height: 14px;
  background: var(--manila); border: 1px solid #b89e60; border-bottom: 0; border-radius: 4px 4px 0 0;
}
.card-wide .card-meta, .card-wide .stack, .card-wide .links-label { color: var(--manila-soft); }
.card-wide summary, .card-wide .links a { color: #5a2906; }
/* The HORUS photo, taped to the case file. */
.shot { position: relative; margin: 0; padding: 6px 6px 0; background: #fbfaf4; box-shadow: var(--paper-shadow); transform: rotate(0.6deg); }
.shot::before { width: 64px; margin-left: -32px; transform: rotate(3deg); }
.shot img { display: block; width: 100%; height: auto; }
.shot figcaption { padding: 6px 2px 8px; font: 14px/1.4 var(--sans); color: var(--ink-soft); }

/* ---------- Profile pinboard ---------- */
.board {
  display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr);
  padding: 22px 14px;
  background-color: #9c7a4c;
  background-image: radial-gradient(rgba(60, 38, 12, 0.28) 1px, transparent 1.6px), radial-gradient(rgba(255, 230, 180, 0.14) 1px, transparent 1.6px);
  background-size: 7px 7px, 9px 9px;
  background-position: 0 0, 3px 4px;
  border: 10px solid #cfcabb; border-radius: 3px;
  box-shadow: var(--paper-shadow);
}
.pinned {
  position: relative; padding: 16px 16px 14px;
  font: 16px/1.5 var(--sans);
  background: var(--clark-frame), var(--stain, none), var(--pinned-old); color: var(--ink);
  box-shadow: 0 2px 3px rgba(40, 25, 5, 0.4);
}
.pinned::before {
  content: ""; position: absolute; top: -6px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e46a5c, #a3261b 60%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.pinned h3 {
  margin-bottom: 10px; padding: 0 4px 10px 0; display: inline-block;
  font: 400 1.5rem/1.1 var(--hand); text-transform: uppercase; letter-spacing: 0.03em; -webkit-text-stroke: 0.012em var(--ink);
  background: var(--clark-underline-red-thin) left bottom / 100% 8px no-repeat;
}
.pinned-meta { margin-left: 6px; font: 400 15px/1 var(--hand); letter-spacing: 0.02em; color: var(--pencil-paper); text-transform: none; -webkit-text-stroke: 0; }
.pinned p { margin: 0 0 10px; }
.pinned p:last-child { margin-bottom: 0; }
.skills { margin: 0; display: grid; gap: 10px; }
.pinned:nth-child(1) { --stain: var(--stain-bl); }
.pinned:nth-child(2) { --stain: var(--stain-tr); clip-path: var(--torn); }
.pinned:nth-child(4) { --stain: var(--stain-br); }
.memo { --stain: var(--stain-bl); }
/* The walk tilts papers on the wall itself (world.js); Still mode and the CSS room tilt
   them here, by under 1°. */
html:not(.world) .card:nth-child(odd), html:not(.world) .pinned:nth-child(even) { rotate: -0.5deg; }
html:not(.world) .card:nth-child(4n + 2), html:not(.world) .pinned:nth-child(3), html:not(.world) .memo { rotate: 0.6deg; }
.skills dt { font: 400 15px/1.4 var(--hand); text-transform: uppercase; letter-spacing: 0.05em; color: var(--red); }
.skills dd { margin: 2px 0 0; }

/* ---------- Contact: Clark's sign-off, written on the wallpaper like Room 0 ---------- */
.contact-note { display: grid; gap: 10px; margin-top: 26px; }
.contact-note p { margin: 0; }
.contact-name {
  justify-self: start;
  font: 400 2.2rem/1.02 var(--hand); text-transform: uppercase; letter-spacing: 0.03em; color: var(--marker);
  -webkit-text-stroke: 0.02em var(--marker);
  text-shadow: 0.045em 0.03em 0 rgba(43, 33, 18, 0.34);
}
.contact-line {
  max-width: 30em; font: 400 1.2rem/1.35 var(--hand-calm); letter-spacing: 0.02em; color: var(--marker);
  text-wrap: balance;
}
.contact-note .actions { margin-top: 8px; }

/* ---------- Carpet ---------- */
.foot {
  margin-top: 0;
  color: var(--carpet-fg);
  background-color: var(--carpet);
  background-image: radial-gradient(rgba(255, 240, 200, 0.08) 1px, transparent 1.6px), radial-gradient(rgba(20, 12, 0, 0.18) 1px, transparent 1.6px);
  background-size: 5px 5px, 7px 7px;
  background-position: 0 0, 2px 3px;
  border-top: 14px solid #4a3a1c;
  box-shadow: 0 -3px 0 #75603a;
  font-size: 13px;
}
.foot-in { max-width: 1480px; margin: 0 auto; padding: 22px 12px calc(84px + var(--safe-b)); font: 15px/1.5 var(--sans); }
.foot p { margin: 0 0 6px; }
.foot .mono { font-family: var(--mono); color: var(--carpet-soft); }
.again { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 14px !important; }
.again a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px;
  font: 400 19px/1 var(--hand); text-transform: uppercase; letter-spacing: 0.06em; text-decoration: none;
  color: var(--plaque-fg); background: var(--clark-box-pale) center / 100% 100% no-repeat;
}
.again span { font: 400 19px/1.2 var(--hand); letter-spacing: 0.03em; color: var(--carpet-soft); }
.foot :focus-visible { outline-color: var(--focus-dark); }

/* ---------- Phone dock: wayfinding strip ---------- */
.dock {
  position: fixed; z-index: 25; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: 1fr 1fr 1fr 1.2fr;
  padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
  background: #23211c; border-top: 3px solid var(--frame);
}
.dock a {
  display: grid; place-items: center; min-height: 54px;
  font: 700 13px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--plaque-fg); text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.dock a:active { background: #34312a; }
.dock .dock-cv { color: var(--exit-fg); background: var(--exit); font-family: var(--cond); font-stretch: condensed; font-weight: 800; font-size: 15px; }
.dock a:focus-visible { outline-color: var(--focus-dark); outline-offset: -4px; }

@media (max-width: 759px) {
  .signs, .ceiling-row > .exit-small { display: none; }
  .ceiling-row { justify-content: space-between; }
  .views span { font-size: 9.5px; }
  .plate-small, .links a, .card summary { min-height: 44px; }
  .links.muted { min-height: 0; }
  input[type="range"] { height: 44px; }
}

/* ---------- Tablet ---------- */
@media (min-width: 760px) {
  main { padding: 28px 18px 0; }
  .foot-in { padding: 24px 18px calc(28px + var(--safe-b)); }
  .dock { display: none; }
  .level0 { grid-template-columns: minmax(0, 1fr); }
  .ident { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 28px; align-items: start; }
  .actions .exit-big { flex-basis: auto; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-wide { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-content: start; column-gap: 22px; }
  .card-wide > * { grid-column: 1; }
  .card-wide > .shot { grid-column: 2; grid-row: 1 / span 6; align-self: start; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 26px 20px; }
  .sliders { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sliders label { grid-row: 1; }
  .sliders input { grid-row: 2; }
}

/* ---------- Desktop ---------- */
@media (min-width: 1180px) {
  .level0 { grid-template-columns: minmax(0, 1fr); max-width: 1100px; }
  .ident { grid-template-columns: minmax(0, 1.2fr) minmax(320px, 440px); }
  h1 { font-size: 3.5rem; }
  .actions .exit-big { flex-basis: 100%; }
  .sliders { grid-template-columns: minmax(0, 1fr); }
  .sliders label, .sliders input { grid-row: auto; }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-wide { grid-column: span 2; }
  .board { grid-template-columns: 1.2fr 1fr 1.2fr 1fr; }
}

/* ================================================================
   Walk mode (html.world): the page is the rendered building.
   The canvas fills the viewport; every [data-panel] is fixed at the
   origin and world.js places it on a wall with matrix3d.
   Still mode (html.still): normal flow over the canvas.
   ================================================================ */
.world-canvas { display: none; }
html.world, html.still { scroll-behavior: auto; scroll-padding-top: 70px; }
html.world body, html.still body { background: #2a2412; }
html.world .world-canvas, html.still .world-canvas {
  display: block; position: fixed; left: 0; top: 0; width: 100%; height: 100%; height: 100lvh; z-index: 0;
  cursor: grab; touch-action: pan-y;
}
html.world .world-canvas:active, html.still .world-canvas:active { cursor: grabbing; }
html:not(.scene-drawn) .world-canvas { opacity: 0; }
/* Moving frames: a small canvas stretched over the scene while the camera moves. */
.world-canvas-fast { display: none; }
html.world.moving .world-canvas-fast, html.still.moving .world-canvas-fast {
  display: block; position: fixed; left: 0; top: 0; width: 100%; height: 100%; height: 100lvh; z-index: 0;
  pointer-events: none;
}
.world-canvas:focus-visible { outline: 3px solid var(--focus-dark); outline-offset: -6px; }
html.roaming .world-canvas:focus-visible { outline: none; }

.scene-status {
  position: fixed; z-index: 40; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%);
  width: max-content; max-width: min(92vw, 520px); margin: 0; padding: 8px 14px;
  font: 13px/1.4 var(--mono); color: var(--plaque-fg); background: var(--plaque); border: 2px solid var(--frame); border-radius: 3px;
}

/* HUD: the header becomes a dark signage strip; the drawn ceiling is the real one. */
html.world .ceiling, html.still .ceiling {
  height: calc(56px + env(safe-area-inset-top, 0px));
  background: rgba(30, 28, 23, 0.9); background-image: none;
  border-bottom: 2px solid var(--frame); box-shadow: none;
}
html.world .ceiling-tiles, html.still .ceiling-tiles { display: none; }
html.world .ceiling-row, html.still .ceiling-row { height: 56px; }
.where {
  margin: 0 auto 0 4px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font: 700 12px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--plaque-fg);
}
html.world .signs, html.still .signs { margin-right: 0; }
html.world .signs a, html.still .signs a { background: transparent; }
html.world .level-sign, html.still .level-sign { background: transparent; }

/* Live R readout: only on the roam HUD (H). */
.rchip { display: none; position: fixed; z-index: 15; left: calc(12px + var(--safe-l)); bottom: calc(14px + var(--safe-b)); }
html.roaming.roam-hud .rchip { display: block; }
.rchip-body { padding: 4px 6px 3px; background: #c3c9ad; border: 3px solid #6e6a58; border-radius: 3px; }
.rchip .mtx { width: auto; }
.rchip .mtx td { padding: 2px 5px; font-size: 12px; }
.rchip-meta { margin: 2px 0 0; min-height: 1.3em; font-size: 12px; line-height: 1.3; color: #1d2318; white-space: nowrap; }
.dock-roam {
  min-height: 54px; padding: 0 4px; border: 0;
  font: 700 13px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--plaque-fg); background: #34312a; cursor: pointer;
}
.dock-roam[aria-pressed="true"] { color: #1e1e1c; background: #e8c547; font-size: 12px; letter-spacing: 0; white-space: normal; line-height: 1.1; }
.dock-roam:focus-visible { outline: 3px solid var(--focus-dark); outline-offset: -4px; }
.roam-btn[aria-pressed="true"] { background: #e8c547; }

/* ---- Walk mode panels ---- */
html.world main { max-width: none; margin: 0; padding: 0; position: relative; z-index: 1; pointer-events: none; }
html.world .dock, html.still .dock { grid-template-columns: 1fr 1fr 1fr 1fr 1.2fr; }
html.world .level0, html.world .ident, html.world .cards, html.world .board { display: block; }
html.world .room { margin: 0; position: static; isolation: auto; }
html.world .room::before { display: none; }
html.world .board { padding: 0; border: 0; background: none; box-shadow: none; }
html.world #walk-space { display: block; }
#walk-space { display: none; }
html.world .foot { margin: 0; padding: 0; border: 0; background: none; box-shadow: none; pointer-events: none; }

html.world [data-panel] {
  position: fixed; left: 0; top: 0; margin: 0;
  width: min(540px, 90vw);
  transform-origin: 0 0;
  transform: translate(-300vw, 0);
  opacity: 0;
  backface-visibility: hidden;
}
html.world [data-panel="plaque"] { width: min(600px, 92vw); }
html.world [data-panel="matrix"] { width: min(400px, 90vw); }
html.world [data-panel="workhead"],
html.world [data-panel="profilehead"] { width: min(560px, 90vw); }
html.world [data-panel="contact"] { width: min(560px, 92vw); }
html.world [data-panel="footer"] {
  width: min(460px, 90vw); padding: 18px;
  color: var(--carpet-fg); background: var(--plaque); border: 3px solid var(--frame); border-radius: 3px;
}
html.world [data-panel="plaque"] .actions, html.world [data-panel="contact"] .actions { margin-top: 12px; }
html.world .card-wide { display: flex; }
html.world .card-more { width: min(760px, 94vw); }
html.world .card-wide > .shot { order: 0; }
html.world .room-head { margin: 0; }
html.world .contact-note { margin-top: 30px; }
html.world .card, html.world .pinned, html.world .memo { box-shadow: 0 2px 3px rgba(40, 28, 6, 0.4); }
html.world .walk-hint { margin-top: 12px; }

/* ---- Still mode: the page over a rendered still of the section in view ---- */
html.still .walk-hint, html.still .rchip, html.still .decals { display: none; }
html.still main { position: relative; z-index: 1; }
/* Still mode lays the page over the render, where the name would cross the ceiling:
   Clark's lettering goes on an offcut of the same wallpaper, pinned up. */
html.still .panel-plaque, html.still .room-plaque, html.still .contact-note {
  padding: 14px 16px 16px; background-color: var(--wall); border-radius: 2px; box-shadow: var(--paper-shadow);
}
html.still .room-plaque { background: var(--clark-underline-red) 16px bottom 8px / calc(100% - 32px) 12px no-repeat, var(--wall); padding-bottom: 22px; }
html.still .room::before { display: none; }
html.still .foot { position: relative; z-index: 1; }

/* ---- Fallback: without the renderer, the CSS room hides the matrix plate ---- */
html:not(.world):not(.still) .matrix { display: none; }
html.world:not(.scene-ready) body::after {
  content: "Entering Level 0…"; position: fixed; inset: auto 0 50% 0; text-align: center;
  font: 400 22px/1 var(--hand); color: var(--marker); z-index: 40;
}
.more-list { margin: 0; padding-left: 1.1em; display: grid; gap: 8px; }

@media (max-width: 759px) {
  html.world .where, html.still .where { font-size: 12px; letter-spacing: 0.04em; }
  .rchip { bottom: calc(66px + var(--safe-b)); }
  .roam-btn { display: none; }
  html.world .ceiling-row > *, html.still .ceiling-row > * { white-space: nowrap; }
  html.world .ceiling-row, html.still .ceiling-row { gap: 6px; padding: 0 8px; }
  html.world .level-sign, html.still .level-sign { padding: 6px 8px; letter-spacing: 0.08em; }
  /* After the loop the sign reads "Level 0?": tighter, so the header still fits 320 px. */
  html.world .level-sign:has(.level-q:not([hidden])), html.still .level-sign:has(.level-q:not([hidden])) { letter-spacing: 0; }
  .scene-status { bottom: calc(70px + var(--safe-b)); }
  html.world [data-panel] { font-size: 16px; }
}

/* ---- Clark's drawings (tour only): decorative, below every panel, never interactive ---- */
.decals { display: none; }
html.world .decals { display: block; position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 0; pointer-events: none; }
html.world .decals img {
  position: fixed; left: 0; top: 0; max-width: none;
  transform-origin: 0 0; transform: translate(-300vw, 0); opacity: 0;
  backface-visibility: hidden; user-select: none; pointer-events: none;
}

/* ---- Free roam ---- */
.kb-only { display: none; }
@media (hover: hover) and (pointer: fine) { .kb-only { display: inline; } }
/* Touch roam (09-roam.js): the pad covers the room so no swipe scrolls the page. Left half:
   a floating stick under the thumb; right half: drag to look; Jump and Crouch by the right
   thumb. Below the R chip, dock, recorder and roam bar, so those still take taps. */
.touch-pad {
  --pad-b: calc(24px + var(--safe-b));
  position: fixed; inset: 0; z-index: 14; touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.touch-pad[hidden] { display: none; }
@media (max-width: 759px) { .touch-pad { --pad-b: calc(66px + var(--safe-b)); } }
.stick {
  position: absolute; left: calc(28px + var(--safe-l)); bottom: calc(var(--pad-b) + 18px);
  width: 104px; height: 104px; box-sizing: border-box; pointer-events: none;
  border: 2px solid rgba(235, 232, 210, 0.3); border-radius: 50%; background: rgba(24, 22, 17, 0.16);
  display: grid; place-items: center; opacity: 0.5; transition: opacity 0.15s ease;
}
.stick.active { bottom: auto; opacity: 1; transition: none; }
.stick-knob {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(235, 232, 210, 0.5); border: 1px solid rgba(235, 232, 210, 0.7);
}
.stick.run .stick-knob { background: rgba(232, 197, 71, 0.85); border-color: #e8c547; }
.touch-acts {
  position: absolute; right: calc(22px + var(--safe-r)); bottom: calc(var(--pad-b) + 18px);
  display: flex; align-items: flex-end; gap: 14px;
}
.touch-acts button {
  width: 74px; height: 74px; padding: 0; border-radius: 50%; touch-action: none; cursor: pointer;
  font: 700 12px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.04em;
  color: #ebe8d2; background: rgba(24, 22, 17, 0.5); border: 1px solid rgba(235, 232, 210, 0.4);
  -webkit-tap-highlight-color: transparent;
}
.touch-acts [data-touch="crouch"] { width: 60px; height: 60px; margin-bottom: 40px; font-size: 11px; }
.touch-acts button:active { background: rgba(74, 70, 60, 0.75); }
.touch-acts [aria-pressed="true"] { color: #1e1e1c; background: rgba(232, 197, 71, 0.92); border-color: #e8c547; }
html.roaming .walk-hint { visibility: hidden; }
/* Hidden, not removed: taking the sticky ceiling out of the flow would shift the scroll, and a scroll leaves free roam. */
html.roaming:not(.roam-hud) .ceiling { visibility: hidden; }
@media (max-width: 759px) {
  /* Leave the touch stick below the R sheet only during roam. */
  html.roaming .rchip { bottom: calc(200px + var(--safe-b)); }
  /* Between the touch controls and the roam bar (shifted down under the header while the HUD is open). */
  html.roaming .rchip-body { max-height: calc(100dvh - 320px - var(--safe-b) - env(safe-area-inset-top, 0px)); }
}
@media (max-height: 500px) and (min-width: 760px) {
  /* Phone on its side: the sheet scrolls between the header and the bottom edge. */
  html.roaming .rchip-body { max-height: calc(100dvh - 84px - var(--safe-b)); }
}

.cam-overlay[hidden], .roam-bar[hidden] { display: none; }
.cam-overlay { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
/* A failing fixture's dip (world.js FLICKER): WAAPI animates opacity to the dip depth (at most
   1), so the room darkens by --fk x depth, never more than 14 %. */
.cam-flicker { position: absolute; inset: 0; opacity: 0; background: rgb(10 8 3 / var(--fk, .12)); }
.cam-grain { display: none; position: absolute; inset: 0; overflow: hidden; }
/* The tile is full-range noise, so a very low opacity is a faint film grain, not snow. */
.cam-grain::before {
  content: ''; position: absolute; inset: -64px;
  background-image: var(--grain); mix-blend-mode: overlay; opacity: .04;
}
/* At rest the grain keeps moving, compositor-only. */
@media (prefers-reduced-motion: no-preference) {
  html.roam-idle:not(.calm) .cam-grain { display: block; }
  html.roam-idle:not(.calm) .cam-grain::before { animation: tape-grain .4s steps(1, end) infinite; }
}

/* VHS (on by default, V or the roam bar's VHS button): free roam as recovered camcorder footage.
   level0/feel/vhs.js treats the image inside a 4:3 pillarbox; the OSD reads PLAY and a counter. */
.cam-osd { display: none; }
html.vhs { --frame-x: max(0px, calc((100vw - 100vh * 4 / 3) / 2)); }
@supports (height: 100lvh) {
  html.vhs { --frame-x: max(0px, calc((100vw - 100lvh * 4 / 3) / 2)); }
}
html.roaming.vhs [data-panel] { filter: saturate(.8) contrast(.92); }
/* The filter reduces opacity without replacing the projection's inline fade. */
html.roaming.vhs .decals img { filter: opacity(.8) blur(.5px); }
/* A camcorder's top and bottom edge; it also hides the idle breathing's 3 px drift. */
html.vhs .cam-overlay { box-shadow: inset 0 4px #000, inset 0 -4px #000; }
html.vhs .cam-grain { left: var(--frame-x); right: var(--frame-x); }
/* The tape's grain is coarser than the clean picture's. */
html.vhs .cam-grain::before { opacity: .07; }
/* At rest the tape keeps playing: a slow breath, compositor-only (translate runs in screen
   space before each paper's inline matrix3d, so canvas and papers move together). */
@media (prefers-reduced-motion: no-preference) {
  html.vhs.roam-idle:not(.calm) .world-canvas, html.vhs.roam-idle:not(.calm) [data-panel]:not([data-off]),
  html.vhs.roam-idle:not(.calm) .decals img:not([data-off]) { animation: l0-breathe 4.8s ease-in-out infinite alternate; }
}
@keyframes l0-breathe { from { translate: 0 0; } to { translate: 0 3px; } }
@media (min-aspect-ratio: 4/3) {
  html.vhs .cam-overlay::before, html.vhs .cam-overlay::after {
    content: ''; position: absolute; top: 0; bottom: 0; width: var(--frame-x); background: #000;
  }
  html.vhs .cam-overlay::before { left: 0; }
  html.vhs .cam-overlay::after { right: 0; }
}
html.vhs .cam-osd {
  display: block; position: absolute; left: calc(var(--frame-x) + 26px);
  font: 700 15px/1.2 var(--mono); letter-spacing: .12em;
  color: rgba(240, 240, 230, .82); text-shadow: 1px 1px 0 rgba(0, 0, 0, .55);
}
html.vhs .cam-osd-top { top: calc(22px + env(safe-area-inset-top, 0px)); }
html.vhs .cam-osd-bottom { bottom: calc(24px + var(--safe-b)); display: flex; gap: 14px; }
html.vhs .cam-caption { left: calc(var(--frame-x) + 26px); bottom: calc(56px + var(--safe-b)); max-width: min(520px, calc(100vw - 2 * var(--frame-x) - 52px)); }
@media (pointer: coarse) {
  html.vhs .cam-osd-bottom { bottom: calc(170px + var(--safe-b)); }
  html.vhs .cam-caption { bottom: calc(202px + var(--safe-b)); }
}
@media (pointer: coarse) and (max-width: 759px) {
  html.vhs .cam-osd-bottom { bottom: calc(212px + var(--safe-b)); }
  html.vhs .cam-caption { bottom: calc(244px + var(--safe-b)); }
}
@keyframes tape-grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-23px, 41px); }
  40% { transform: translate(37px, -11px); }
  60% { transform: translate(-51px, -29px); }
  80% { transform: translate(13px, 53px); }
}
.cam-caption {
  position: absolute; left: 26px; bottom: calc(24px + var(--safe-b)); margin: 0;
  max-width: min(520px, calc(100vw - 52px));
  font: 600 13px/1.3 var(--mono); color: rgba(240, 240, 230, .85); text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
@media (pointer: coarse) {
  /* Above the touch stick and buttons (about 140px over the dock or the screen edge). */
  .cam-caption { bottom: calc(170px + var(--safe-b)); }
}
@media (pointer: coarse) and (max-width: 759px) {
  .cam-caption { bottom: calc(212px + var(--safe-b)); }
}

.roam-bar {
  position: fixed; z-index: 28;
  top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(12px + var(--safe-r));
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; align-items: center;
  max-width: calc(100vw - 24px - var(--safe-l) - var(--safe-r));
  opacity: 0.55; transition: opacity 0.15s ease;
}
html.roam-hud .roam-bar { top: calc(64px + env(safe-area-inset-top, 0px)); }
.roam-bar:hover, .roam-bar:focus-within { opacity: 1; }
.roam-bar button {
  min-height: 34px; padding: 4px 10px;
  font: 700 12px/1 var(--mono); white-space: nowrap; cursor: pointer;
  color: #ebe8d2; background: rgba(24, 22, 17, 0.78);
  border: 1px solid rgba(235, 232, 210, 0.35); border-radius: 3px;
}
.roam-bar button kbd {
  margin-left: 3px; font: inherit; font-weight: 400;
  color: inherit; border-color: currentColor; background: transparent;
}
#roam-hud-toggle[aria-pressed="true"],
#roam-mute[aria-pressed="true"],
#roam-full[aria-pressed="true"] {
  color: #1e1e1c; background: rgba(232, 197, 71, 0.92); border-color: #e8c547;
}
@media (pointer: coarse), (max-width: 759px) {
  .roam-bar button { min-height: 44px; padding: 6px 12px; }
}

/* While the camera moves, scale existing bitmaps rather than re-rasterising every frame.
   Only for what is on screen: a layer per hidden panel or drawing would cost more than it saves. */
html.world.moving [data-panel]:not([data-off]), html.world.moving .decals img:not([data-off]) { will-change: transform; }
/* Notices never take taps, and during free roam they move up, clear of the d-pad. */
.scene-status { pointer-events: none; }
html.roaming .scene-status { top: calc(66px + env(safe-area-inset-top, 0px)); bottom: auto; }
html.roaming.roam-hud .scene-status { top: calc(116px + env(safe-area-inset-top, 0px)); }
html.roaming .scene-status[data-kind="roam-hint"] {
  width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; white-space: nowrap;
  clip: rect(0, 0, 0, 0); clip-path: inset(50%);
}

/* Sketch map (P): Clark's pencil plan on graph paper, pinned bottom right; a tap unfolds it. */
.sketch-map {
  position: fixed; z-index: 27; right: calc(14px + var(--safe-r)); bottom: calc(16px + var(--safe-b));
  width: 220px; height: 220px; transform: rotate(-1.2deg);
  border-radius: 2px; box-shadow: 0 2px 0 rgba(0, 0, 0, .25), 0 8px 22px rgba(0, 0, 0, .45);
  cursor: zoom-in; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.sketch-map.big { width: min(440px, 46vw, 80vh); height: min(440px, 46vw, 80vh); transform: rotate(-0.6deg); cursor: zoom-out; }
.sketch-map[hidden], html:not(.roaming) .sketch-map { display: none; }
@media (max-width: 759px), (pointer: coarse) {
  /* Below the roam bar, which spans the top of a phone. */
  .sketch-map { right: auto; left: calc(10px + var(--safe-l)); top: calc(64px + env(safe-area-inset-top, 0px)); bottom: auto; width: 140px; height: 140px; }
  .sketch-map.big { width: min(88vw, 62vh); height: min(88vw, 62vh); }
  /* The HUD sheet needs the whole column on a phone. */
  html.roam-hud .sketch-map { display: none; }
}

/* Touch stick latched on auto-run: it stays where it was, knob forward, until the next touch. */
.stick.locked { opacity: 0.85; border-color: #e8c547; }
.stick.locked::after {
  content: 'AUTO-RUN'; position: absolute; top: 100%; margin-top: 6px;
  font: 700 11px/1 var(--mono); letter-spacing: 0.06em; color: #e8c547; text-shadow: 0 1px 2px #000;
}

/* Settings sheet inside the lab HUD (H). */
.rchip-body { max-height: calc(100dvh - 40px - var(--safe-b)); overflow: auto; overscroll-behavior: contain; }
.settings { display: grid; gap: 4px; padding: 2px 0 6px; font-size: 12px; color: #1d2318; }
.settings label { display: flex; align-items: center; gap: 7px; min-height: 32px; cursor: pointer; }
.settings label[hidden] { display: none; }
.settings input[type="range"] { flex: 1; min-width: 80px; margin: 0; accent-color: #4d5b2c; }
.settings output { min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; }
.settings select { margin-left: auto; min-height: 30px; font: inherit; color: inherit; background: #e3e8cf; border: 2px solid #6e6a58; border-radius: 3px; }
.settings input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: #4d5b2c; }
.settings kbd { margin-left: auto; font: inherit; color: #51564a; }
.settings button { min-height: 32px; margin-top: 2px; font: 700 12px/1 var(--mono); color: #1d2318; background: #e3e8cf; border: 2px solid #6e6a58; border-radius: 3px; cursor: pointer; }
@media (max-width: 759px), (pointer: coarse) { .settings label, .settings button { min-height: 44px; } }

/* Procedural level: seed readout and reroll (free roam only), arrival fade after a jump. */
.rchip-seed { display: flex; align-items: center; gap: 6px; }
.qsurvey { margin-top: 4px; border-top: 1px solid #6e6a58; padding-top: 3px; }
.qsurvey summary { cursor: pointer; font-size: 12px; line-height: 1.6; color: #1d2318;
  min-height: 44px; display: flex; align-items: center; }
.qsurvey summary::marker { color: #6e6a58; }
.qsurvey[open] { max-width: min(276px, calc(100vw - 40px)); }
.qsurvey .rchip-meta { white-space: normal; }
.qsurvey output { font-variant-numeric: tabular-nums; }
.seed-btn {
  display: inline-block; visibility: hidden; min-height: 32px; padding: 2px 8px;
  font: 700 12px/1 var(--mono); color: #1d2318; background: #e3e8cf; border: 2px solid #6e6a58; border-radius: 3px; cursor: pointer;
}
/* Hidden but still taking space outside free roam, so the R chip's height (which the walk
   layout accounts for) never changes. */
html.roaming .seed-btn { visibility: visible; }
@media (max-width: 759px) { .seed-btn { min-height: 44px; } }
@media (prefers-reduced-motion: no-preference) {
  html:not(.calm) .world-canvas.arrive, html:not(.calm) .world-canvas-fast.arrive { animation: arrive 0.3s ease-out 1 both; }
}
@keyframes arrive { from { opacity: 0; } to { opacity: 1; } }
