@font-face {
  font-family: 'Jost';
  src: url('../assets/fonts/Jost-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Plex Mono';
  src: url('../assets/fonts/IBMPlexMono-Light.woff2') format('woff2');
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: 'Plex Mono';
  src: url('../assets/fonts/IBMPlexMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  --ink: #16171a;
  --ink-2: #5d6066;
  --ink-3: #9a9da3;
  --paper: #f4f4f2;
  --line: rgba(22, 23, 26, 0.14);
  --glass: rgba(255, 255, 255, 0.46);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --sans: 'Jost', 'Futura', 'Century Gothic', system-ui, sans-serif;
  --mono: 'Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --print: #0b0c0f;          /* ink of the pages on the glass */
  --print-2: #3c3f47;
  --sig: #ffd400;            /* signal yellow and black: the arrows and crosses */
  --sig-ink: #0b0c0f;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { overflow: hidden; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
.top, .rail, .hud { z-index: 2; }
.hint, .smears { z-index: 4; }
.safe-probe { position: fixed; left: 0; top: 0; visibility: hidden; pointer-events: none; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.hidden { opacity: 0 !important; pointer-events: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the site as plain text (#text in index.html): unseen, but read by screen readers and search
   engines – and shown as a simple page when there is no WebGL (or, see index.html, no JavaScript) */
.seo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.seo-note.gl { display: none; }
html.nogl, html.nogl body { overflow: auto; height: auto; touch-action: auto; user-select: text; -webkit-user-select: text; }
html.nogl #gl, html.nogl #ui { display: none; }
html.nogl .seo { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; max-width: 44rem; margin: 0 auto; padding: 32px 16px 64px; }
html.nogl .seo-note.gl { display: block; }
.seo { font-size: 18px; line-height: 1.55; font-weight: 400; color: var(--print); }
.seo :is(h1, h2) { font-weight: 300; line-height: 1.1; }
.seo h1 { font-size: 40px; margin: 0.6em 0 0.4em; }
.seo h2 { font-size: 26px; margin: 1.6em 0 0.4em; }
.seo blockquote { margin: 1.2em 0; padding-left: 18px; border-left: 3px solid var(--print); font-size: 24px; line-height: 1.3; }
.seo .seo-note { font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em; padding: 12px 16px; background: var(--sig); color: var(--sig-ink); border-radius: 8px; }
.seo a { color: inherit; }
body.armed #gl { cursor: crosshair; }
body.pointing #gl { cursor: pointer; }

/* ---------- gate ---------- */
.gate {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: clamp(48px, 11vh, 120px); gap: 34px; transition: opacity 1.2s ease;
}
.gate.gone { opacity: 0; pointer-events: none; }
.gate-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.gate-name { font-size: clamp(22px, 2.3vw, 34px); font-weight: 300; letter-spacing: 0.62em; text-transform: uppercase; margin-right: -0.62em; }
.gate-sub { font-family: var(--mono); font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-2); }
.gate-enter {
  pointer-events: auto; font-family: var(--mono); font-size: 11px; letter-spacing: 0.36em; text-transform: uppercase;
  padding: 15px 34px 15px 38px; border: 1px solid var(--line); border-radius: 40px; background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 14px 40px -18px rgba(20, 22, 30, 0.35);
  transition: background 0.3s, transform 0.3s, letter-spacing 0.4s, color 0.3s;
}
.gate-enter:disabled { color: var(--ink-3); cursor: default; }
.gate-enter:not(:disabled):hover { background: var(--ink); color: #fff; letter-spacing: 0.46em; }

/* ---------- top ---------- */
.top { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: center; padding: max(22px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) 22px max(28px, env(safe-area-inset-left)); transition: opacity 1.4s ease; }
.brand { pointer-events: auto; display: flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; font-size: 13px; letter-spacing: 0.42em; text-transform: uppercase; }
.brand img { border-radius: 3px; display: block; }
.nav { display: flex; gap: 6px; }
.nav button { pointer-events: auto; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.26em; text-transform: uppercase; padding: 10px 14px; border-radius: 20px; color: var(--ink-2); transition: color 0.25s, background 0.25s; }
.nav button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.6); }

/* ---------- instrument rail ---------- */
.rail {
  position: absolute; left: calc(22px + env(safe-area-inset-left)); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 6px; padding: 8px;
  border-radius: 28px; background: var(--glass); border: 1px solid var(--glass-edge);
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95) inset, 0 24px 60px -24px rgba(20, 22, 30, 0.35), 0 2px 6px -2px rgba(20, 22, 30, 0.12);
  transition: opacity 1.4s ease 0.3s;
}
.rail hr { width: 20px; height: 1px; border: 0; background: var(--line); margin: 4px auto; }
.tool { --e: 1; pointer-events: auto; position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; transition: background 0.25s, color 0.25s, transform 0.2s; }
.tool svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover { background: rgba(255, 255, 255, 0.85); }
.tool.on { background: var(--ink); color: #fff; }
.tool.out { color: var(--ink-3); pointer-events: none; transform: rotate(-14deg) translateX(-3px); }
.tool.out::after { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #2a2a30, #050506 70%); opacity: 0.9; }
.tool .charge { position: absolute; inset: 1px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(currentColor calc(var(--e) * 360deg), transparent 0); opacity: 0.55;
  -webkit-mask: radial-gradient(circle, transparent 20px, #000 20.5px); mask: radial-gradient(circle, transparent 20px, #000 20.5px); }
.tool .tip {
  position: absolute; left: 58px; top: 50%; transform: translate(-6px, -50%); white-space: nowrap; pointer-events: none; opacity: 0;
  display: flex; align-items: baseline; gap: 12px; padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.82); color: var(--ink);
  border: 1px solid var(--glass-edge); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 16px 40px -20px rgba(20, 22, 30, 0.4);
  transition: opacity 0.2s, transform 0.2s;
}
.tool:hover .tip { opacity: 1; transform: translate(0, -50%); }
.tip b { font-weight: 400; font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; }
.tip em { font-style: normal; font-size: 13px; color: var(--ink-2); }
.tip kbd { font-family: var(--mono); font-size: 10px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }

/* ---------- specimen monitor ---------- */
.hud { position: absolute; right: calc(28px + env(safe-area-inset-right)); bottom: calc(26px + env(safe-area-inset-bottom)); width: 178px; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-2); transition: opacity 1.4s ease 0.6s; }
.hud-id { color: var(--ink-3); margin-bottom: 6px; }
.hud-mood { font-family: var(--sans); font-size: 21px; font-weight: 300; letter-spacing: 0.16em; color: var(--ink); margin-bottom: 12px; }
.hud-row { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 8px; height: 15px; }
.hud-row i { position: relative; height: 1px; background: var(--line); }
.hud-row b { position: absolute; left: 0; top: -1px; height: 3px; background: var(--ink); transition: width 0.5s ease, left 0.5s ease; }
.hud-row i.mid::before { content: ''; position: absolute; left: 50%; top: -3px; width: 1px; height: 7px; background: var(--ink-3); }

.hint { position: absolute; left: 50%; bottom: calc(30px + env(safe-area-inset-bottom)); transform: translate(-50%, 8px); font-size: 14px; letter-spacing: 0.05em; color: var(--ink); padding: 10px 20px; border-radius: 30px;
  background: rgba(255, 255, 255, 0.66); border: 1px solid var(--glass-edge); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); opacity: 0; transition: opacity 0.6s, transform 0.6s; max-width: min(78vw, 560px); text-align: center; }
.hint.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- overlays ---------- */
.overlay { position: absolute; inset: 0; z-index: 5; pointer-events: auto; display: grid; place-items: center; background: rgba(244, 244, 242, 0.72); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); transition: opacity 0.4s; user-select: text; -webkit-user-select: text; }
.ov-box { position: relative; }
.ov-close { position: absolute; right: 0; top: -38px; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--sig-ink); color: var(--sig); box-shadow: 0 14px 30px -14px rgba(10, 10, 14, 0.6); transition: transform 0.2s, background 0.18s, color 0.18s; }
.ov-close svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }
@media (hover: hover) { .ov-close:hover { background: var(--sig); color: var(--sig-ink); transform: scale(1.07); } }
.ov-video { width: min(88vw, 150vh); }
.ov-frame { aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; box-shadow: 0 40px 100px -40px rgba(10, 12, 20, 0.6); }
.ov-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.ov-text { width: min(86vw, 720px); max-height: 76vh; overflow: auto; padding: 4px 6px 30px; font-size: 15px; line-height: 1.6; }
.ov-text .ov-close { position: sticky; float: right; top: 0; margin: 0 0 12px 12px; }
.ov-text h2 { font-weight: 300; font-size: 40px; letter-spacing: 0.08em; margin: 0 0 24px; }
.ov-text h3 { font-family: var(--mono); font-weight: 400; font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-2); margin: 28px 0 8px; }
.ov-text p { margin: 0 0 10px; font-weight: 400; }

@media (max-width: 760px), (max-height: 520px) {
  .rail { left: 50%; top: auto; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); flex-direction: row; padding: 6px; }
  .rail hr { width: 1px; height: 20px; margin: auto 3px; }
  .tool { width: 40px; height: 40px; }
  .tool .tip { display: none; }
  .hud { right: 16px; bottom: auto; top: 62px; width: auto; text-align: right; }
  .hud-row, .hud-id { display: none; }
  .hud-mood { font-size: 15px; margin: 0; }
  .hint { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .top { padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left)); }
  .hud { right: max(16px, env(safe-area-inset-right)); top: calc(62px + env(safe-area-inset-top)); }
  .brand span { display: none; }
}
/* touch screens: no hover tips (a tap would leave them stuck open), no page zoom by double tap or pinch */
@media (hover: none) { .tool .tip { display: none; } }
html, body { touch-action: none; }
button, a { touch-action: manipulation; }
.ov-text { touch-action: pan-y; }
@media (prefers-reduced-motion: reduce) { .gate, .top, .rail, .hud { transition: none; } }

body.armed.pointing #gl { cursor: pointer; }
/* sound switch: three little bars */
.nav .snd { display: inline-flex; align-items: flex-end; gap: 2px; padding-left: 12px; }
.nav .snd span { margin-left: 8px; }
.nav .snd i { width: 2px; background: currentColor; border-radius: 1px; animation: snd 1.1s ease-in-out infinite; height: 9px; }
.nav .snd i:nth-child(2) { animation-delay: -0.4s; height: 12px; }
.nav .snd i:nth-child(3) { animation-delay: -0.75s; height: 7px; }
.nav .snd.off { color: var(--ink-3); }
.nav .snd.off i { animation: none; height: 2px; }
@keyframes snd { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }
.nav .snd i { transform-origin: bottom; }
@media (max-width: 760px) { .nav button { padding: 9px 7px; letter-spacing: 0.16em; font-size: 9.5px; } .nav .snd span, .nav .mic span { display: none; } }
/* microphone switch: off it is a quiet outline; on, a signal-yellow disc whose halo grows with
   what it hears (--lv, 0…1) – nobody should be in doubt whether it is listening */
.nav .mic { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-3); }
.nav .mic svg { width: 22px; height: 22px; padding: 3px; box-sizing: border-box; border-radius: 50%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; transition: background-color 0.2s, box-shadow 0.08s linear; }
.nav .mic:hover { color: inherit; }
.nav .mic.on { color: inherit; }
.nav .mic.on svg { background: var(--sig); stroke: var(--sig-ink); box-shadow: 0 0 0 calc(2px + var(--lv, 0) * 9px) rgba(255, 212, 0, 0.32); }
.nav .mic.asking svg { animation: micask 1s ease-in-out infinite; }
.nav .mic.no { text-decoration: line-through; }
/* (refused: the icon itself is struck through – on a phone the label is not shown) */
.nav .mic.no svg { background: linear-gradient(135deg, transparent 45%, currentColor 45%, currentColor 55%, transparent 55%); opacity: 0.7; }
@keyframes micask { 50% { background: rgba(255, 212, 0, 0.45); } }
@media (prefers-reduced-motion: reduce) { .nav .mic.asking svg { animation: none; background: rgba(255, 212, 0, 0.45); } }
/* (a narrow phone: the bar moves closer together, so that the microphone still fits on it) */
@media (max-width: 420px) {
  .nav { gap: 2px; }
  .nav button { padding: 9px 5px; letter-spacing: 0.1em; }
  .nav .snd { padding-left: 6px; padding-right: 3px; }
  .nav .mic { padding-left: 3px; padding-right: 1px; }
  .nav .mic svg { width: 21px; height: 21px; }
}
@media (max-width: 345px) { .nav button { padding: 9px 3px; letter-spacing: 0.04em; } }

/* ---------- the microphone among the instruments, and what it tells you while it listens ---------- */
.mic-tool { color: var(--ink-2); }
.mic-tool svg { stroke-width: 1.6; }
.mic-tool::before { content: ''; position: absolute; inset: 0; border-radius: 50%; pointer-events: none; }
.mic-tool.on, .mic-tool.on:hover { background: var(--sig); color: var(--sig-ink); box-shadow: 0 0 0 calc(1px + var(--lv, 0) * 10px) rgba(255, 212, 0, 0.34); transition: background 0.25s, color 0.25s, box-shadow 0.08s linear; }
.mic-tool.on .tip { display: none; }                 /* (the card says it all) */
.mic-tool.asking { animation: micask 1s ease-in-out infinite; }
.mic-tool.no { color: var(--ink-3); }
.mic-tool.no svg { background: linear-gradient(135deg, transparent 45%, currentColor 45%, currentColor 55%, transparent 55%); border-radius: 50%; }
/* not tried yet: a yellow pulse calls for it, and the one with the instruments says what it is for */
.mic-tool.beckon { background: var(--sig); color: var(--sig-ink); }
.mic-tool.beckon::before, .nav .mic.beckon svg { animation: beckon 1.3s ease-out 5; }
.mic-tool.beckon .tip { opacity: 1; transform: translate(0, -50%); }
.nav .mic.beckon { color: inherit; }
.nav .mic.beckon svg { background: var(--sig); stroke: var(--sig-ink); }
@keyframes beckon { 0% { box-shadow: 0 0 0 0 rgba(255, 212, 0, 0.9); } 75% { box-shadow: 0 0 0 15px rgba(255, 212, 0, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 212, 0, 0); } }
.earcard { position: absolute; z-index: 2; left: 98px; bottom: 229px; width: 252px; padding: 12px 14px 11px; border-radius: 18px; pointer-events: none;
  background: rgba(255, 255, 255, 0.9); border: 1px solid var(--glass-edge); box-shadow: 0 18px 44px -22px rgba(20, 22, 30, 0.45), 0 2px 6px -2px rgba(20, 22, 30, 0.12);
  transition: opacity 0.35s, transform 0.35s; }
.earcard.off, body.reading .earcard { opacity: 0; transform: translateX(-8px); visibility: hidden; transition: opacity 0.25s, transform 0.25s, visibility 0s 0.25s; }
.ec-head { display: flex; align-items: center; gap: 9px; }
.ec-head b { font-family: var(--mono); font-weight: 400; font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; white-space: nowrap; }
.ec-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--sig); box-shadow: 0 0 0 1.5px var(--sig-ink), 0 0 0 calc(1.5px + var(--lv, 0) * 6px) rgba(255, 212, 0, 0.5); }
.earcard.hearing .ec-dot { animation: ecpulse 0.6s ease-in-out infinite alternate; }
.ec-meter { display: flex; align-items: center; gap: 2px; height: 16px; margin-left: auto; }
.ec-meter i { width: 3px; height: 16px; border-radius: 2px; background: var(--ink); transform: scaleY(calc(0.12 + var(--h, 0) * 0.88)); transition: transform 0.06s linear; }
.ec-try { display: grid; gap: 4px; margin-top: 10px; }
.ec-chip { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 400; color: var(--ink-2); padding: 6px 10px 6px 8px; border-radius: 12px; transition: background 0.3s, color 0.3s; }
.ec-chip svg { flex: none; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ec-chip .d1, .ec-chip .d2, .ec-chip .d3 { fill: currentColor; stroke: none; }
.ec-chip.now { background: var(--sig); color: var(--sig-ink); }
.ec-chip.done::after { content: ''; margin-left: auto; width: 9px; height: 5px; border: solid currentColor; border-width: 0 0 2px 2px; transform: translateY(-2px) rotate(-45deg); }
.ec-chip.now[data-k=tune] svg { animation: ecbob 0.5s ease-in-out infinite alternate; }
.ec-chip.now[data-k=rhythm] svg { animation: ecclap 0.55s ease-in-out infinite; }
.ec-chip.now[data-k=rhythm] .spark { animation: ecspark 0.55s ease-out infinite; }
.ec-chip.now[data-k=talk] .d1 { animation: ecdot 0.9s infinite; }
.ec-chip.now[data-k=talk] .d2 { animation: ecdot 0.9s 0.15s infinite; }
.ec-chip.now[data-k=talk] .d3 { animation: ecdot 0.9s 0.3s infinite; }
.ec-said { display: none; margin-top: 9px; font-size: 14.5px; font-weight: 400; color: var(--ink); }
.earcard.said .ec-said { display: block; animation: ecsaid 0.35s ease-out; }
.earcard.game .ec-said { padding: 7px 10px; border-radius: 10px; background: var(--sig); color: var(--sig-ink); }   /* (the copy-me game) */
.ec-foot { margin-top: 9px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.earcard:not(.full) .ec-try, .earcard:not(.full) .ec-foot { display: none; }
@keyframes ecpulse { to { transform: scale(1.3); } }
@keyframes ecbob { from { transform: translateY(1.5px) rotate(-7deg); } to { transform: translateY(-2px) rotate(7deg); } }
@keyframes ecclap { 0%, 100% { transform: scale(1); } 35% { transform: scale(0.8, 1); } 50% { transform: scale(1.12); } }
@keyframes ecspark { 0%, 40% { opacity: 0; } 55% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ecdot { 0%, 100% { opacity: 0.25; } 30% { opacity: 1; } }
@keyframes ecsaid { from { opacity: 0; transform: translateY(4px); } }
/* a phone: the row of instruments is full – the microphone is only at the top, and the card right
   below it (under the mood at the top, clear of the hints and the arrows at the bottom) */
@media (max-width: 760px), (max-height: 520px) {
  .mic-tool, .mic-hr { display: none; }
  .earcard { left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: auto; top: calc(92px + env(safe-area-inset-top)); width: auto; max-width: 420px; margin-left: auto; padding: 10px 12px; }
  .earcard.off, body.reading .earcard { transform: translateY(-8px); }
  .ec-try { grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 8px; }
  .ec-chip { flex-direction: column; gap: 4px; font-size: 12px; padding: 7px 4px 6px; text-align: center; }
  .ec-chip { position: relative; }
  .ec-chip.done::after { position: absolute; right: 7px; top: 9px; margin: 0; }
  .ec-foot { text-align: center; margin-top: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .ec-chip svg, .ec-chip .d1, .ec-chip .d2, .ec-chip .d3, .ec-chip .spark, .earcard.hearing .ec-dot, .mic-tool::before, .nav .mic.beckon svg, .mic-tool.asking { animation: none !important; }
}

/* ---------- checking the microphone on a real device: ?mic=debug (micdebug.js) ---------- */
.micdbg { position: absolute; z-index: 6; right: max(16px, env(safe-area-inset-right)); top: calc(70px + env(safe-area-inset-top)); width: 404px; max-height: calc(100vh - 140px); overflow: auto;
  pointer-events: auto; padding: 10px 12px 12px; border-radius: 14px; background: rgba(11, 12, 15, 0.9); color: #e9e9e6; font-family: var(--mono); font-size: 11px; line-height: 1.45;
  user-select: text; -webkit-user-select: text; touch-action: pan-y; }
.md-head { display: flex; align-items: center; gap: 8px; }
.md-head b { color: var(--sig); font-weight: 400; letter-spacing: 0.18em; }
.md-btns { margin-left: auto; display: flex; gap: 4px; }
.md-btns button { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; padding: 5px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.12); color: #fff; }
@media (hover: hover) { .md-btns button:hover { background: var(--sig); color: var(--sig-ink); } }
.md-text { margin: 8px 0 6px; white-space: pre; font: inherit; overflow-x: auto; }
.md-graph { display: block; width: 100%; height: 56px; }
.md-help { margin: 8px 0 0; font-family: var(--sans); font-size: 12px; font-weight: 400; line-height: 1.4; color: #b9bbc0; }
.md-copy { display: block; width: 100%; height: 96px; margin-top: 8px; font: 10px/1.4 var(--mono); }
.micdbg.folded { width: auto; }
.selftest .md-text { white-space: pre-wrap; }               /* (the self test, ?selftest: its lines may be long) */
.micdbg.folded .md-text, .micdbg.folded .md-graph, .micdbg.folded .md-help, .micdbg.folded .md-copy { display: none; }
@media (max-width: 760px), (max-height: 520px) {
  .micdbg { left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); top: auto; bottom: calc(72px + env(safe-area-inset-bottom)); width: auto; max-height: 46vh; font-size: 9.5px; }
}

/* ---------- the creature has licked the screen ---------- */
.smears { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.smears i { position: absolute; margin: -60px 0 0 -60px; border-radius: 48% 52% 45% 55% / 55% 46% 54% 45%; transform: rotate(var(--r));
  background: radial-gradient(ellipse at 34% 28%, rgba(120, 124, 140, 0.55) 0%, rgba(14, 14, 20, 0.93) 22%, rgba(6, 6, 10, 0.95) 58%, rgba(6, 6, 10, 0.6) 68%, rgba(6, 6, 10, 0) 72%);
  filter: blur(1.2px); animation: smear 7s cubic-bezier(0.5, 0, 0.9, 0.6) forwards; }
@keyframes smear {
  0% { opacity: 0; transform: rotate(var(--r)) scale(0.5); }
  4% { opacity: 0.92; transform: rotate(var(--r)) scale(1.08); }
  30% { opacity: 0.85; transform: translateY(calc(var(--d) * 0.12)) rotate(var(--r)) scale(1, 1.1); }
  100% { opacity: 0; transform: translateY(var(--d)) rotate(var(--r)) scale(0.8, 1.7); }
}

/* ---------- the page of an open plate, laid onto the glass (see sheet.js) ---------- */
/* (no stacking context of its own – position absolute, no z-index – so that each page can be
   multiplied onto the canvas underneath; the UI layer lies above it) */
.sheets { position: absolute; inset: 0; pointer-events: none; }
.sheet { --k: 1; --r: 14px; position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform, opacity; pointer-events: none; mix-blend-mode: multiply;
  border-radius: var(--r); overflow: hidden; color: var(--print); font-family: var(--sans); font-weight: 400;
  -webkit-mask-composite: source-in; mask-composite: intersect; user-select: text; -webkit-user-select: text; -webkit-tap-highlight-color: transparent; }
.sheet.live { pointer-events: auto; }
body.armed .sheet.live { pointer-events: none; }                       /* an instrument in hand: through the page onto the creature … */
body.armed .sheet.live :is([data-act], a, iframe) { pointer-events: auto; }   /* … except for its buttons */
.sh-scroll { position: absolute; inset: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: thin; scrollbar-color: rgba(11, 12, 15, 0.22) transparent; }
.sh-scroll.more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 44px), rgba(0, 0, 0, 0.15)); mask-image: linear-gradient(to bottom, #000 calc(100% - 44px), rgba(0, 0, 0, 0.15)); }
.sh-scroll::-webkit-scrollbar { width: 6px; }
.sh-scroll::-webkit-scrollbar-thumb { background: rgba(11, 12, 15, 0.22); border-radius: 3px; }
.sh-page { padding: calc(30px * var(--k)) calc(44px * var(--k)) calc(40px * var(--k)); }
.sh-kicker { display: flex; justify-content: space-between; gap: 12px; font-family: var(--mono); font-size: max(11px, calc(13px * var(--k))); letter-spacing: 0.16em; text-transform: uppercase; color: var(--print-2); margin-bottom: calc(18px * var(--k)); }
.sh-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); column-gap: calc(48px * var(--k)); align-items: start; }
.sh-media { position: sticky; top: 0; }
.sh-hero { position: relative; margin: 0; aspect-ratio: 16 / 9; border-radius: calc(12px * var(--k)); overflow: hidden; background: #d9dbde; }
.sh-hero[data-act] { cursor: pointer; }
.sh-hero img, .sh-hero video, .sh-frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; border: 0; border-radius: inherit; }
.sh-hero video.sh-frame { object-fit: contain; background: #000; }          /* (the showreel, a file of the site's own: never cropped) */
.sh-hero.playing { cursor: default; background: #000; }
.sh-hero.playing .sh-play, .sh-hero.playing .sh-loop { display: none; }
.sh-play { position: absolute; right: 4%; bottom: 7%; width: max(48px, calc(64px * var(--k))); height: max(48px, calc(64px * var(--k))); border-radius: 50%; background: rgba(21, 22, 26, 0.62); border: 2px solid rgba(255, 255, 255, 0.92); color: #fff; transition: background 0.2s, transform 0.2s; }
.sh-play::before { content: ''; position: absolute; left: 37%; top: 29%; width: 38%; height: 42%; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.sh-play.big { right: auto; bottom: auto; left: 50%; top: 50%; width: calc(120px * var(--k)); height: calc(120px * var(--k)); transform: translate(-50%, -50%); }
@media (hover: hover) { .sh-play:hover { background: var(--sig-ink); } .sh-hero[data-act]:hover img { filter: brightness(1.04); } }
.sh-thumbs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: calc(8px * var(--k)); margin-top: calc(12px * var(--k)); }
.sh-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 7px; overflow: hidden; border: 2px solid transparent; opacity: 0.6; transition: opacity 0.2s, border-color 0.2s; }
.sh-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 4px; }
.sh-thumb.on { opacity: 1; border-color: var(--print); }
@media (hover: hover) { .sh-thumb:hover { opacity: 1; } }
.sh-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: calc(18px * var(--k)); }
.sh-actions:empty { display: none; }
.sh-btn { display: inline-flex; align-items: center; height: max(40px, calc(46px * var(--k))); padding: 0 calc(22px * var(--k)); border-radius: 999px; border: 1.5px solid rgba(11, 12, 15, 0.7); font-family: var(--mono); font-size: max(11.5px, calc(13px * var(--k))); letter-spacing: 0.14em; text-transform: uppercase; color: var(--print); text-decoration: none; white-space: nowrap; transition: background 0.18s, color 0.18s, border-color 0.18s; }
.sh-btn.primary { background: var(--print); border-color: var(--print); color: #f4f4f2; }
@media (hover: hover) { .sh-btn:hover { background: var(--sig); border-color: var(--sig-ink); color: var(--sig-ink); } }
.sh-title { font-weight: 400; font-size: max(28px, calc(56px * var(--k))); line-height: 1.04; letter-spacing: -0.01em; margin: 0; }
.sh-rule { border: 0; height: 1.5px; background: rgba(11, 12, 15, 0.3); margin: calc(20px * var(--k)) 0 calc(22px * var(--k)); }
.sh-meta { margin: 0 0 calc(16px * var(--k)); }
.sh-meta div { display: grid; grid-template-columns: calc(140px * var(--k)) minmax(0, 1fr); column-gap: 12px; margin-bottom: 6px; }
.sh-meta dt { font-family: var(--mono); font-size: max(11px, calc(12.5px * var(--k))); letter-spacing: 0.14em; text-transform: uppercase; color: var(--print-2); padding-top: 0.5em; }
.sh-meta dd { margin: 0; font-size: max(15px, calc(21px * var(--k))); font-weight: 500; line-height: 1.4; }
.sh-text p, .sh-list li, .sh-intro p { font-size: max(15px, calc(21px * var(--k))); line-height: 1.55; }
.sh-text p { margin: 0 0 0.75em; }
.sh-list h3, .sh-cols h3 { font-family: var(--mono); font-weight: 400; font-size: max(11px, calc(12.5px * var(--k))); letter-spacing: 0.16em; text-transform: uppercase; color: var(--print-2); margin: 1.5em 0 0.6em; }
.sh-list ul { list-style: none; margin: 0; padding: 0; }
.sh-list li { position: relative; padding-left: 1.3em; margin-bottom: 0.3em; line-height: 1.5; }
.sh-list li i { position: absolute; left: 0; font-style: normal; color: var(--print-2); }
.sheet-about .sh-grid { grid-template-columns: minmax(0, 0.38fr) minmax(0, 1fr); }
.sh-portrait { margin: 0; aspect-ratio: 991 / 1200; border-radius: calc(12px * var(--k)); overflow: hidden; background: #d9dbde; }
.sh-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.sh-intro p { margin: 0.5em 0 0; }
.sh-quote { margin: calc(26px * var(--k)) 0 0; padding: 0.05em 0 0.05em calc(20px * var(--k)); border-left: 3px solid var(--print); }
.sh-quote p { margin: 0; font-size: max(19px, calc(30px * var(--k))); line-height: 1.28; letter-spacing: -0.01em; }
.sh-focus { list-style: none; margin: calc(24px * var(--k)) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35em 1.5em; font-family: var(--mono); font-size: max(11px, calc(12.5px * var(--k))); letter-spacing: 0.14em; text-transform: uppercase; color: var(--print-2); }
.sh-focus li { white-space: nowrap; }
.sh-focus li::before { content: ''; display: inline-block; width: 0.5em; height: 0.5em; margin-right: 0.6em; background: currentColor; vertical-align: 0.1em; }
.sh-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); column-gap: calc(40px * var(--k)); }
.sh-cols h3:first-child { margin-top: 0; }
.sh-entry { margin-bottom: 0.9em; font-size: max(14px, calc(17px * var(--k))); line-height: 1.4; }
.sh-entry b { display: block; font-weight: 600; }
.sh-entry span { display: block; color: var(--print-2); }
.sh-title.xl { font-size: max(36px, calc(80px * var(--k))); }
.sh-sub { margin: 0.4em 0 1.4em; font-size: max(15px, calc(22px * var(--k))); color: var(--print-2); }
.sh-contacts { list-style: none; margin: 0; padding: 0; }
.sh-contacts li { display: grid; grid-template-columns: calc(150px * var(--k)) minmax(0, 1fr); align-items: baseline; padding: 0.35em 0; }
.sh-contacts span { font-family: var(--mono); font-size: max(11px, calc(12.5px * var(--k))); letter-spacing: 0.16em; text-transform: uppercase; color: var(--print-2); }
.sh-contacts a { font-size: max(19px, calc(40px * var(--k))); color: var(--print); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; text-decoration-color: rgba(11, 12, 15, 0.35); overflow-wrap: anywhere; }
.sh-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: calc(32px * var(--k)); }
.sh-foot small { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: #5d6066; }

/* a phone held upright: one column, set in fixed sizes */
.sheet.compact .sh-page { padding: 16px 18px 30px; }
.sheet.compact .sh-kicker { font-size: 11.5px; margin-bottom: 12px; }
.sheet.compact .sh-grid { display: block; }
.sheet.compact .sh-media { position: static; }
.sheet.compact .sh-hero, .sheet.compact .sh-portrait { border-radius: 10px; }
.sheet.compact .sh-play { width: 54px; height: 54px; }
.sheet.compact .sh-play.big { width: 84px; height: 84px; }
.sheet.compact .sh-thumbs { display: flex; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; touch-action: pan-x pan-y; scrollbar-width: none; margin: 8px -18px 0; padding: 0 18px; gap: 6px; }
.sheet.compact .sh-thumbs::-webkit-scrollbar { display: none; }
.sheet.compact .sh-thumb { flex: 0 0 auto; width: 72px; }
.sheet.compact .sh-actions { margin-top: 14px; }
.sheet.compact .sh-btn { height: 44px; padding: 0 18px; font-size: 12px; }
.sheet.compact .sh-body { margin-top: 24px; }
.sheet.compact .sh-title { font-size: 31px; }
.sheet.compact .sh-title.xl { font-size: 42px; }
.sheet.compact .sh-rule { margin: 16px 0; }
.sheet.compact .sh-meta div { display: block; margin-bottom: 10px; }
.sheet.compact .sh-meta dt { font-size: 11px; padding: 0 0 2px; }
.sheet.compact :is(.sh-meta dd, .sh-text p, .sh-list li, .sh-intro p) { font-size: 17px; }
.sheet.compact .sh-portrait { width: 64%; }
.sheet.compact .sh-quote { margin-top: 20px; padding-left: 14px; }
.sheet.compact .sh-quote p { font-size: 21px; }
.sheet.compact .sh-focus { margin-top: 18px; font-size: 11px; gap: 0.3em 1.2em; }
.sheet.compact .sh-cols { display: block; margin-top: 4px; }
.sheet.compact .sh-cols section + section h3 { margin-top: 1.5em; }
.sheet.compact .sh-entry { font-size: 15px; }
.sheet.compact .sh-sub { font-size: 16px; }
.sheet.compact .sh-contacts li { grid-template-columns: 74px minmax(0, 1fr); padding: 0.55em 0; }
.sheet.compact .sh-contacts a { font-size: 19px; }

/* ---------- arrows and cross of an open plate: signal yellow and black ---------- */
.cnav { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.cn { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; display: grid; place-items: center; pointer-events: auto;
  background: var(--sig); color: var(--sig-ink); box-shadow: 0 0 0 1.5px var(--sig-ink), 0 16px 34px -14px rgba(10, 10, 14, 0.6);
  transition: transform 0.24s cubic-bezier(0.3, 1.5, 0.5, 1) 0.12s, opacity 0.24s ease 0.12s, background 0.18s, color 0.18s; }
.cn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.cn-close { background: var(--sig-ink); color: var(--sig); }
@media (hover: hover) { .cn:hover { background: var(--sig-ink); color: var(--sig); transform: scale(1.07); transition-delay: 0s; } .cn-close:hover { background: var(--sig); color: var(--sig-ink); } }
.cn:active { transform: scale(0.92); transition-delay: 0s; }
.cn:focus-visible { outline: 3px solid var(--sig-ink); outline-offset: 4px; }
.cnav.off .cn { opacity: 0; transform: scale(0.5); pointer-events: none; transition-delay: 0s; }
.cnav.solo .cn-prev, .cnav.solo .cn-next { display: none; }
.cnav.row .cn { left: 50%; top: auto; bottom: calc(18px + env(safe-area-inset-bottom)); width: 56px; height: 56px; margin: 0 0 0 -28px; }
.cnav.row .cn-prev { margin-left: -104px; }
.cnav.row .cn-next { margin-left: 48px; }
.cnav.row .cn svg { width: 25px; height: 25px; }
/* while reading the monitor makes room (its corner overlaps the plate) – on a small screen the instruments too */
body.reading .hud { opacity: 0; transition: opacity 0.3s; }
@media (max-width: 760px), (max-height: 520px) {
  body.reading .rail { opacity: 0; pointer-events: none; transform: translate(-50%, 28px); transition: opacity 0.25s, transform 0.25s; }
  body.reading .hint { bottom: auto; top: calc(8px + env(safe-area-inset-top)); max-width: calc(100vw - 24px); }   /* (over the bar at the top, not over the text) */
}
