/* nam@sydney: a tmux session.
   Palette: Rosé Pine (https://rosepinetheme.com). Rose marks focus, iris the session,
   gold for keys and highlights, foam for links, love for warnings. */
:root {
  /* Rosé Pine (main) */
  --base: #191724;
  --surface: #1f1d2e;
  --overlay: #26233a;
  --hl-low: #21202e;
  --hl-med: #403d52;
  --hl-high: #524f67;
  --text: #e0def4;
  --subtle: #908caa;
  --muted: #6e6a86;
  --love: #eb6f92;
  --gold: #f6c177;
  --rose: #ebbcba;
  --pine: #31748f;
  --foam: #9ccfd8;
  --iris: #c4a7e7;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --display: "Martian Mono", "JetBrains Mono", ui-monospace, monospace;
  --glass: color-mix(in srgb, var(--base) 80%, transparent);
  --glass-blur: blur(14px) saturate(1.1);
  --status-h: 26px;
  --bar-h: 22px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--base);
  color: var(--text);
  font: 400 14px/1.6 var(--mono);
  font-variant-ligatures: none;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--gold); color: var(--base); }
a { color: var(--foam); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
a:hover { color: var(--text); text-decoration-style: solid; text-decoration-color: var(--rose); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
kbd { font: inherit; color: var(--gold); }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul { list-style: none; padding: 0; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -9999px; top: 0; z-index: 99; background: var(--gold); color: var(--base); padding: 6px 10px; }
.skip:focus { left: 8px; top: 8px; }
.noscript { position: fixed; inset: 40% 10% auto; text-align: center; }
.ghost { color: var(--subtle); padding: 0 .5ch; }
.ghost:hover { color: var(--text); }

/* ---------- the photo behind everything ---------- */
#bg { position: fixed; inset: 0; z-index: 0; background: var(--base); overflow: hidden; }
#bg img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; /* fill the screen: no black bars, portraits crop top and bottom */
  opacity: 0; transition: opacity 1.2s ease, filter .6s ease, transform .6s ease;
}
#bg img.on { opacity: 1; }
#bg::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--base) 30%, transparent); transition: background .4s ease; }
body[data-win="2"] #bg img { filter: blur(28px) brightness(.5) saturate(1.1); transform: scale(1.08); }
body.peek #bg::after { background: transparent; }

/* ---------- session + windows ---------- */
#session { position: fixed; inset: 0 0 var(--status-h) 0; z-index: 1; }
.window {
  position: absolute; inset: 0;
  display: grid; gap: 10px; padding: 10px;
}
/* 0:home is one floating shell, centred over the photo */
#w0 {
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  /* anchored near the top so the shell grows downward as commands run, like a real terminal */
  place-items: start center; padding: clamp(20px, 9vh, 110px) 24px clamp(20px, 5vh, 56px);
}
#w0 .backdrop { position: absolute; inset: 0; cursor: pointer; }
#w0 .shell {
  z-index: 2; width: min(84ch, 100%); max-height: 100%;
  box-shadow: 0 0 0 1px var(--hl-med), 0 30px 80px -20px rgba(0, 0, 0, .7), 0 0 120px -30px color-mix(in srgb, var(--iris) 30%, transparent);
}
#w0 .shell { background: color-mix(in srgb, var(--base) 70%, transparent); }
#w0 .shell .pane-body { padding: 14px 3.5ch 26px; }
.photo-caption {
  position: absolute; left: 0; bottom: 0; z-index: 1; max-width: 100%;
  display: flex; align-items: center; gap: .5ch;
  background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  padding: 3px 1ch; font-size: 12px; color: var(--subtle);
}
.photo-caption [data-caption] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
#w1 { grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); grid-template-areas: "picker readme"; }
#w2 { grid-template-areas: "gallery"; }
#w3 { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); grid-template-areas: "gitlog posts"; }
#w4 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); grid-template-areas: "cv contact"; }

/* ---------- panes ---------- */
.pane {
  position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: 0 0 0 1px var(--hl-med), 0 20px 50px -24px rgba(0, 0, 0, .7);
  transition: opacity .35s ease;
}
/* p: peek. The panes step aside so the photo can be seen */
body.peek .pane, body.peek .photo-caption { opacity: 0; pointer-events: none; }
.pane-bar {
  flex: none; height: var(--bar-h);
  display: flex; align-items: center; gap: 1ch;
  padding: 0 0 0 2ch;
  font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden;
  cursor: default; user-select: none;
}
.pane-bar::before { content: ""; position: absolute; left: 0; width: 1.4ch; top: calc(var(--bar-h) / 2); border-top: 1px solid var(--hl-med); }
.pane-bar .fill { flex: 1; min-width: 2ch; border-top: 1px solid var(--hl-med); }
.pane-bar .pane-id { font-weight: 500; color: var(--muted); }
.pane-bar .pane-name { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pane-bar .pane-meta { padding-right: 1ch; overflow: hidden; text-overflow: ellipsis; }
.pane::after {
  content: ""; position: absolute; inset: calc(var(--bar-h) / 2) 0 0 0;
  border: 1px solid transparent; border-top: 0; pointer-events: none; z-index: 3;
  transition: border-color .15s;
}
.pane.active::after { border-color: var(--rose); }
.pane.active .pane-bar::before, .pane.active .pane-bar .fill { border-top-color: var(--rose); }
.pane.active .pane-bar { color: var(--subtle); }
.pane.active .pane-bar .pane-id { color: var(--base); background: var(--rose); padding: 0 .6ch; }
.pane.active .pane-bar .pane-name { color: var(--text); }

.pane-body {
  flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain;
  padding: 10px 2.5ch 28px;
  scrollbar-width: thin; scrollbar-color: var(--hl-med) transparent;
}
.pane-body:focus { outline: none; }
.pane-body:focus-visible { outline: none; }
.pane-body::-webkit-scrollbar { width: 8px; height: 8px; }
.pane-body::-webkit-scrollbar-thumb { background: var(--hl-med); }

.prompt-line { color: var(--muted); margin-top: 1.1em; }
.prompt-line .ps1 { color: var(--foam); font-weight: 500; opacity: .85; }
.prompt-line .ps1 b { color: var(--iris); font-weight: 500; }
.prompt-line .cmd { color: var(--text); }
.out { color: var(--text); }
.muted { color: var(--subtle); }
.faint { color: var(--muted); }
.brass { color: var(--gold); }
.lac { color: var(--rose); }

/* ---------- intro ---------- */
.figlet {
  font-family: var(--mono); line-height: 1.02; letter-spacing: 0;
  font-size: clamp(7px, 1.05vw, 15px);
  color: var(--text); white-space: pre; margin: 6px 0 2px;
  user-select: none;
}
.figlet { color: var(--rose); }
.figlet .sh { color: var(--hl-high); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.typed { font-family: var(--display); font-weight: 700; font-size: clamp(16px, 1.55vw, 23px); line-height: 1.45; color: var(--text); max-width: 40ch; margin-top: 4px; letter-spacing: -.01em; }
.caret { display: inline-block; width: .6em; height: 1.1em; vertical-align: -0.18em; background: var(--rose); margin-left: 2px; animation: blink 1.05s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.now { margin-top: 4px; }
.now li { display: grid; grid-template-columns: 2ch minmax(0, 1fr) auto; gap: 0 1ch; padding: 1px 0; }
.now li::before { content: "→"; color: var(--rose); }
.now .when { color: var(--iris); font-size: 12px; padding-top: 2px; }
.status-line { color: var(--text); max-width: 60ch; }
.ls { display: flex; flex-wrap: wrap; gap: 2px 2.4ch; max-width: 70ch; }
.ls a { color: var(--foam); text-decoration: none; }
.ls a::after { content: "/"; color: var(--muted); }
.ls a:hover { color: var(--text); text-decoration: underline; text-decoration-color: var(--rose); }
.ls .more { color: var(--iris); }
.links { display: flex; flex-wrap: wrap; gap: 6px 2.2ch; margin-top: 6px; }
.btn-cv {
  display: inline-flex; align-items: center; gap: 1ch;
  background: var(--gold); color: var(--base); text-decoration: none; font-weight: 700;
  padding: 1px 1.2ch; border-radius: 2px;
}
.btn-cv:hover { background: var(--rose); color: var(--base); }
/* home: a command waits at the prompt until Enter */
[data-step].pending > :not(.prompt-line) { display: none; }
[data-step].pending .prompt-line { cursor: pointer; }
[data-step].fresh > :not(.prompt-line) { animation: print .45s ease-out both; }
@keyframes print { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.run-hint { display: inline-flex; align-items: center; gap: 1.2ch; }
.run-hint .caret { margin-left: 1px; }
.run-btn {
  font-size: 12px; color: var(--muted); margin-left: 1ch;
  border: 1px solid var(--hl-med); border-radius: 3px; padding: 0 .8ch; line-height: 1.5;
  animation: nudge 2.6s ease-in-out 1.2s infinite;
}
.run-btn kbd { color: var(--gold); }
.run-btn:hover { color: var(--text); border-color: var(--gold); }
.skip-all { font-size: 12px; color: var(--muted); }
.skip-all:hover { color: var(--text); }
@keyframes nudge { 0%, 80%, 100% { box-shadow: none; } 88% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 25%, transparent); } }
.hint { margin-top: 1.4em; color: var(--muted); font-size: 12.5px; }
.hint button { color: var(--subtle); text-decoration: underline dotted; text-underline-offset: 3px; }
.hint button:hover { color: var(--text); }

/* ---------- lists (tree, picker, log, posts) ---------- */
.list-head { color: var(--muted); margin: 2px 0 4px; }
.list-head:not(:first-child) { margin-top: 14px; }
.item {
  display: grid; align-items: baseline; gap: 0 1ch;
  width: 100%; text-align: left; text-decoration: none; color: var(--text);
  padding: 1px 1ch 1px .5ch; margin-left: -.5ch; border-left: 2px solid transparent;
  cursor: pointer; line-height: 1.55;
}
.item:hover { background: var(--surface); color: var(--text); }
.item:focus { outline: none; }
.item.sel, .item:focus-visible { background: var(--overlay); border-left-color: var(--rose); }
.pane.active .item:focus { background: var(--overlay); border-left-color: var(--rose); }
.item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .tr { color: var(--hl-med); white-space: pre; }
.item .kd { color: var(--muted); font-size: 12px; white-space: nowrap; }
.tree .item { grid-template-columns: auto minmax(0, 25ch) 2ch minmax(0, 1fr) auto; }
.tree .item .badge-dot { color: var(--gold); }
.tree .lab .item { grid-template-columns: auto minmax(0, max-content) minmax(0, 1fr); }
.tree .lab .item .ln { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.honest { white-space: nowrap; font-size: 12px; text-align: right; }
.tag { padding: 0 .5ch; border-radius: 2px; }
.b-hand { color: var(--gold); }
.b-mixed { color: var(--foam); }
.b-agents { color: var(--iris); }
.r-yes { color: var(--foam); }
.r-partly { color: var(--gold); }
.r-not-yet { color: var(--love); }
.tree-foot { margin-top: 14px; color: var(--muted); font-size: 12px; }

.prompt { display: flex; align-items: center; gap: 1ch; border: 1px solid var(--hl-med); padding: 3px 1ch; margin-bottom: 10px; color: var(--rose); }
.prompt:focus-within { border-color: var(--gold); }
.prompt input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font: inherit; padding: 2px 0; }
.prompt input::placeholder { color: var(--muted); }
.picker .item { grid-template-columns: minmax(0, 1fr) auto; }
.picker .lab .item { grid-template-columns: minmax(0, 1fr); }
.empty { color: var(--muted); padding: 8px 0; }

/* ---------- README / :help page ---------- */
.help-head { display: flex; justify-content: space-between; gap: 2ch; color: var(--muted); border-bottom: 1px solid var(--hl-med); padding-bottom: 4px; margin-bottom: 14px; font-size: 12.5px; }
.help-head .t { color: var(--gold); }
.rd-title { font-family: var(--display); font-weight: 800; font-size: clamp(22px, 2.6vw, 36px); line-height: 1.1; letter-spacing: -.02em; color: var(--text); }
.rd-kind { color: var(--subtle); margin-top: 6px; }
.rd-tagline { font-size: 15.5px; color: var(--text); margin-top: 14px; max-width: 62ch; }
.rd-sec { margin-top: 18px; max-width: 66ch; }
.rd-sec h3 { font: inherit; color: var(--gold); font-weight: 700; margin-bottom: 2px; }
.rd-sec h3::before { content: "## "; color: var(--muted); font-weight: 400; }
.stack { display: flex; flex-wrap: wrap; gap: 4px 1.6ch; }
.stack span::before { content: "·"; color: var(--muted); margin-right: .8ch; }
.honesty-box { border: 1px solid var(--hl-med); padding: 8px 1.5ch; display: grid; gap: 4px; }
.honesty-box .lbl { font-weight: 700; }
.legend { font-size: 12.5px; color: var(--muted); }
.badge { display: inline-block; color: var(--base); background: var(--gold); padding: 0 1ch; margin-top: 14px; font-weight: 500; }
.rd-links { display: flex; flex-wrap: wrap; gap: 6px 3ch; }
.rd-links a::before { content: attr(data-k) " → "; color: var(--muted); }
.rd-lab-note { color: var(--muted); margin-top: 14px; }

/* project previews: a screenshot, or a top-to-bottom data-flow diagram */
.shot { margin-top: 4px; max-width: 72ch; }
.shot a { display: block; border: 1px solid var(--hl-med); background: var(--surface); line-height: 0; text-decoration: none; }
.shot a:hover { border-color: var(--rose); }
.shot img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; display: block; }
.shot figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.shot figcaption::before { content: "↳ "; }
.flow { margin-top: 6px; max-width: 72ch; display: grid; gap: 0; }
.fl-stage { display: flex; flex-wrap: wrap; gap: 6px 1ch; }
.fl-node {
  flex: 1 1 18ch; min-width: 0; max-width: 34ch;
  border: 1px solid var(--hl-high); border-left: 2px solid var(--iris);
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  padding: 3px 1.2ch 4px; display: grid; line-height: 1.35;
}
.fl-node b { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-node small { font-size: 11.5px; color: var(--subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-edge { display: flex; align-items: center; gap: 1.2ch; padding: 1px 0 1px 2ch; font-size: 12px; color: var(--muted); }
.fl-arrow { color: var(--rose); line-height: .95; font-size: 11px; text-align: center; }
.fl-note { margin-top: 8px; color: var(--text); max-width: 66ch; }
.fl-src { margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.fl-src code { font: inherit; color: var(--subtle); }

/* ---------- 2:photos: the whole photo, uncropped, over a blurred copy of itself ---------- */
#w2 { padding: 0; }
#w2 .pane { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }
#w2 .pane::after { display: none; }
#w2 .pane-bar { background: var(--glass); }
.stage { position: relative; padding: 0; overflow: hidden; cursor: zoom-in; }
.stage-img {
  position: absolute; inset: 14px; width: calc(100% - 28px); height: calc(100% - 28px);
  object-fit: contain; filter: drop-shadow(0 24px 40px rgba(0, 0, 0, .55));
}
body.peek .stage-img { inset: 0; width: 100%; height: 100%; }
/* peek in 2:photos means "full screen": the photo's own pane must stay, only its chrome goes.
   Without this, the generic peek rule hid the pane, the photo vanished and clicks went nowhere. */
body.peek #w2 .pane { opacity: 1; pointer-events: auto; }
body.peek #w2 .pane-bar { opacity: 0; pointer-events: none; }
body.peek .stage { cursor: zoom-out; }
.photo-card {
  position: absolute; left: 2ch; bottom: 16px; z-index: 4; width: min(44ch, calc(100% - 4ch));
  background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--hl-med); border-top: 2px solid var(--rose);
  padding: 8px 1.5ch 10px; cursor: default; transition: opacity .35s ease;
}
.pc-top { display: flex; justify-content: space-between; gap: 2ch; font-size: 12px; color: var(--muted); }
.pc-count { color: var(--rose); }
.pc-cap { font-family: var(--display); font-weight: 700; font-size: 17px; line-height: 1.3; margin: 4px 0 8px; }
.pc-ctl { display: flex; flex-wrap: wrap; gap: 4px 2ch; font-size: 12.5px; }
.pc-ctl button { color: var(--subtle); }
.pc-ctl button:hover { color: var(--text); }
.pc-ticks { display: flex; gap: 2px; margin-top: 10px; height: 12px; }
.pc-ticks button { flex: 1; min-width: 0; background: var(--hl-med); height: 100%; }
.pc-ticks button:hover { background: var(--subtle); }
.pc-ticks button.on { background: var(--rose); }
body.peek .photo-card { opacity: 0; pointer-events: none; }

/* ---------- log ---------- */
.gl .item { grid-template-columns: 7ch 10ch minmax(0, 1fr); cursor: default; }
.gl .hash { color: var(--gold); }
.gl .date { color: var(--iris); }
.gl .msg .deco { color: var(--rose); }
.gl .msg .res { color: var(--subtle); }
.gl .msg .res.win { color: var(--gold); }
.posts .item { grid-template-columns: 8ch minmax(0, 1fr); }
.posts .item .nm { white-space: normal; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 2ch; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- cv ---------- */
.cv-hero { font-family: var(--display); font-weight: 800; font-size: clamp(20px, 2.3vw, 32px); line-height: 1.15; letter-spacing: -.02em; max-width: 24ch; }
.cv-big {
  display: flex; align-items: center; justify-content: space-between; gap: 2ch;
  margin: 18px 0 6px; max-width: 46ch;
  background: var(--rose); color: var(--base); text-decoration: none;
  font-family: var(--display); font-weight: 800; font-size: clamp(18px, 2vw, 26px);
  padding: 14px 2ch; border-radius: 2px;
}
.cv-big:hover { background: var(--text); color: var(--base); }
.cv-big small { font: 500 12.5px var(--mono); }
.cv-sec { margin-top: 18px; max-width: 68ch; }
.cv-sec h3 { font: inherit; font-weight: 700; color: var(--gold); }
.cv-sec h3::before { content: "## "; color: var(--muted); font-weight: 400; }
.cv-sec ul li { padding-left: 2ch; text-indent: -2ch; }
.cv-sec ul li::before { content: "- "; color: var(--rose); }
.contact .item { grid-template-columns: 10ch minmax(0, 1fr); }
.contact .item .nm { color: var(--foam); }

/* ---------- status bar (tmux) ---------- */
#status {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--status-h); z-index: 20;
  display: flex; align-items: stretch; gap: 1ch;
  background: var(--surface); border-top: 1px solid var(--hl-med);
  font-size: 12.5px; line-height: var(--status-h); white-space: nowrap;
}
.st-left { display: flex; align-items: stretch; min-width: 0; }
.st-session { background: var(--iris); color: var(--base); font-weight: 700; padding: 0 1ch; }
.st-windows { display: flex; }
.st-windows button { padding: 0 1ch; color: var(--subtle); }
.st-windows button:hover { color: var(--text); background: var(--overlay); }
.st-windows button[aria-current="page"] { background: var(--rose); color: var(--base); font-weight: 700; }
.st-windows .flag { opacity: .85; }
.st-mid { flex: 1; min-width: 0; display: flex; align-items: center; overflow: hidden; }
.st-hint { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.st-hint:hover { color: var(--text); }
.st-msg { overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.st-msg.err { color: var(--base); background: var(--love); padding: 0 1ch; }
.st-right { display: flex; align-items: stretch; min-width: 0; }
.st-building { color: var(--subtle); padding: 0 1.5ch; overflow: hidden; text-overflow: ellipsis; max-width: 46ch; border-left: 1px solid var(--hl-med); }
.st-building b { color: var(--gold); font-weight: 500; }
.st-clock { color: var(--text); padding: 0 1.5ch; border-left: 1px solid var(--hl-med); }
.st-cv { background: var(--gold); color: var(--base); font-weight: 700; padding: 0 1.6ch; text-decoration: none; }
.st-cv:hover { background: var(--rose); color: var(--base); }
.cmdline { position: absolute; inset: 0; display: flex; align-items: center; background: var(--base); padding: 0 1ch; z-index: 2; }
.cmdline label { color: var(--gold); font-weight: 700; padding-right: .3ch; }
.cmdline input { flex: 1; background: none; border: 0; outline: none; color: var(--text); font: inherit; caret-color: var(--rose); }

/* ---------- popups (tmux display-popup) ---------- */
.popup-scrim { position: fixed; inset: 0; z-index: 30; background: rgba(16, 14, 24, .7); }
.popup {
  position: fixed; z-index: 31; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(880px, calc(100vw - 32px)); max-height: calc(100dvh - var(--status-h) - 32px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--iris);
  box-shadow: 0 0 0 1px var(--base), 0 24px 60px rgba(0, 0, 0, .55);
}
.popup-bar { display: flex; align-items: center; gap: 1ch; padding: 0 0 0 1.5ch; height: 26px; font-size: 12.5px; color: var(--text); border-bottom: 1px solid var(--hl-med); }
.popup-bar .fill { flex: 1; }
.popup-body { overflow: auto; padding: 14px 2.5ch 18px; }
.keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 0 4ch; }
.keys dl { display: grid; grid-template-columns: 14ch minmax(0, 1fr); gap: 2px 1.5ch; margin: 0 0 12px; }
.keys dt { color: var(--gold); }
.keys dd { margin: 0; color: var(--text); }
.keys dd small { color: var(--muted); font-size: 12px; }
.keys h3 { font: inherit; color: var(--muted); margin: 0 0 4px; grid-column: 1 / -1; }
.cmds { display: flex; flex-wrap: wrap; gap: 6px 1ch; margin-top: 6px; }
.cmds button { border: 1px solid var(--hl-med); padding: 1px 1ch; color: var(--foam); }
.cmds button:hover { border-color: var(--foam); color: var(--text); }
.help-foot { color: var(--muted); margin-top: 12px; font-size: 12.5px; }

/* chess */
.chess { display: flex; flex-wrap: wrap; gap: 18px 3ch; align-items: flex-start; }
.board-wrap { --sq: min(46px, calc((100vw - 72px) / 8)); }
.board { display: grid; grid-template-columns: repeat(8, var(--sq)); grid-template-rows: repeat(8, var(--sq)); border: 1px solid var(--hl-med); }
.sq {
  position: relative; width: var(--sq); height: var(--sq);
  display: grid; place-items: center;
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Apple Symbols", "DejaVu Sans", serif;
  font-size: calc(var(--sq) * .74); line-height: 1;
}
.sq.l { background: #d9cfe3; }
.sq.d { background: #7d7799; }
.sq .pc.w { color: #faf4ed; text-shadow: 0 0 1px #000, 0 0 1px #000, 0 1px 0 #000, 0 -1px 0 #000, 1px 0 0 #000, -1px 0 0 #000; }
.sq .pc.b { color: #191724; }
.sq .co { position: absolute; font: 500 9.5px var(--mono); opacity: .8; pointer-events: none; }
.sq .co.f { right: 2px; bottom: 1px; }
.sq .co.r { left: 2px; top: 1px; }
.sq.l .co { color: #7d7799; }
.sq.d .co { color: #d9cfe3; }
.sq.pick { box-shadow: inset 0 0 0 3px var(--gold); }
.sq.dot::after { content: ""; width: 26%; height: 26%; border-radius: 50%; background: rgba(25, 23, 36, .35); }
.sq.dot.cap::after { width: 86%; height: 86%; background: none; box-shadow: inset 0 0 0 3px rgba(25, 23, 36, .35); }
.sq.last { box-shadow: inset 0 0 0 999px rgba(246, 193, 119, .42); }
.sq.mated { box-shadow: inset 0 0 0 999px rgba(235, 111, 146, .7); }
.sq:focus-visible { outline: 2px solid var(--foam); outline-offset: -2px; z-index: 1; }
.chess-side { flex: 1; min-width: 240px; max-width: 42ch; }
.chess-count { color: var(--muted); font-size: 12.5px; }
.chess-side h2 { font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1.2; margin: 2px 0 6px; }
.chess-task { color: var(--gold); }
.chess-note { color: var(--subtle); margin-top: 6px; }
#chess-form { margin-top: 14px; }
#chess-form label { font-size: 12.5px; color: var(--muted); }
.chess-row { display: flex; gap: 1ch; border: 1px solid var(--hl-med); padding: 3px 1ch; color: var(--rose); margin-top: 2px; }
.chess-row:focus-within { border-color: var(--gold); }
.chess-row input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font: inherit; }
.chess-msg { min-height: 3.2em; margin-top: 8px; }
.chess-msg.ok { color: var(--foam); }
.chess-msg.bad { color: var(--love); }
.chess-ctl { display: flex; flex-wrap: wrap; gap: 6px 1ch; }
.chess-ctl button { border: 1px solid var(--hl-med); padding: 1px 1ch; color: var(--subtle); }
.chess-ctl button:hover { color: var(--text); border-color: var(--subtle); }
.chess-ctl button.go { color: var(--base); background: var(--foam); border-color: var(--foam); }

/* sl */
.train {
  position: fixed; left: 0; bottom: calc(var(--status-h) + 10px); z-index: 40; margin: 0;
  font: 500 13px/1.15 var(--mono); color: var(--text); white-space: pre; pointer-events: none;
  animation: choo 7s linear forwards; will-change: transform;
}
.train .smoke { color: var(--muted); }
.train .loco { color: var(--rose); }
.train .car { color: var(--gold); }
@keyframes choo { from { transform: translateX(100vw); } to { transform: translateX(-110%); } }

/* ---------- zen: no photos, no telemetry. Just the terminal. ---------- */
.st-zen { color: var(--subtle); padding: 0 1.4ch; border-left: 1px solid var(--hl-med); }
.st-zen:hover { color: var(--text); background: var(--overlay); }
body.zen .st-zen { color: var(--base); background: var(--iris); font-weight: 700; }
body.zen #bg, body.zen .photo-caption, body.zen .st-building, body.zen .st-clock { display: none; }
body.zen .pane, body.zen .photo-card { background: var(--base); -webkit-backdrop-filter: none; backdrop-filter: none; }
body.zen #w0 .backdrop { cursor: default; }
body.zen #w0 .shell { box-shadow: 0 0 0 1px var(--hl-med); }

/* ---------- cats: background layer, above the photo but behind the panes (#session is z 1) ---------- */
#cats { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; opacity: .6; }
#cats canvas { position: absolute; left: 0; top: 0; }
#cats .cat { will-change: transform; }
#cats .cats-fx { z-index: 40; }
html.cat-pat, html.cat-pat * { cursor: grab !important; }
body.zen #cats { display: none; }

/* pointer type helpers */
.touch-only { display: none; }
@media (hover: none) { .hover-only { display: none; } .touch-only { display: inline; } }

/* ---------- mid screens ---------- */
@media (max-width: 1100px) {
  .st-building { max-width: 26ch; }
}

/* ---------- phones: one column, status bar becomes the window switcher ---------- */
@media (max-width: 760px) {
  :root { --status-h: 76px; }
  body { overflow: auto; overflow-x: hidden; font-size: 13.5px; }
  /* relative + z-index keeps the panes above the cats layer (#cats is fixed, z 0) */
  #session { position: relative; z-index: 1; padding-bottom: var(--status-h); }
  .window { position: static; display: flex; flex-direction: column; min-height: calc(100dvh - var(--status-h)); gap: 10px; padding: 10px; }
  .pane-body { overflow: visible; padding: 8px 16px 22px; }
  .pane-bar { padding-left: 16px; }
  .figlet { font-size: min(2.05vw, 9px); }
  #w0 { display: flex; padding: 10px; place-items: stretch; }
  #w0 .shell { width: 100%; max-height: none; }
  #w0 .shell .pane-body { padding: 8px 16px 22px; }
  #w0 .backdrop { position: relative; inset: auto; order: 2; flex: 1 0 64vw; min-height: 200px; }
  body.zen #w0 .backdrop { display: none; }
  #w2 { padding: 0; }
  #w2 .pane-photo { height: calc(100dvh - var(--status-h)); flex: none; }
  #w2 .stage { overflow: hidden; }
  .photo-card { left: 10px; right: 10px; width: auto; bottom: 10px; }
  .tree .item { grid-template-columns: auto minmax(0, 1fr) auto; }
  .tree .item .kd, .tree .item .badge-dot { display: none; }
  .tree .lab .item { grid-template-columns: auto minmax(0, 1fr); }
  .tree .lab .item .ln { display: none; }
  .gl .item { grid-template-columns: 10ch minmax(0, 1fr); }
  .gl .hash { display: none; }
  .contact .item { grid-template-columns: 9ch minmax(0, 1fr); }
  .contact .item .nm { overflow-wrap: anywhere; white-space: normal; }

  #status { height: var(--status-h); flex-wrap: wrap; line-height: 1.2; gap: 0; padding-bottom: env(safe-area-inset-bottom); }
  .st-left { order: 1; flex: 1 0 100%; height: 44px; }
  .st-session { display: none; }
  .st-windows { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); }
  .st-windows button { padding: 0 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; border-right: 1px solid var(--hl-med); }
  .st-windows button .n { font-size: 10.5px; opacity: .75; }
  .st-windows .flag { display: none; }
  .st-mid { order: 2; flex: 1; height: 31px; padding-left: 10px; border-top: 1px solid var(--hl-med); }
  .st-hint { font-size: 12px; }
  .st-right { order: 3; height: 31px; border-top: 1px solid var(--hl-med); }
  .st-building { display: none; }
  .st-zen { display: flex; align-items: center; }
  .st-clock { display: flex; align-items: center; }
  .st-cv { display: flex; align-items: center; padding: 0 2.2ch; }
  .cmdline { inset: 0 0 auto 0; height: 44px; }
  .popup { top: 12px; transform: translateX(-50%); max-height: calc(100dvh - var(--status-h) - 24px); }
  .popup-body { padding: 12px 14px 16px; }
  .keys dl { grid-template-columns: 12ch minmax(0, 1fr); }
  .chess-side { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .train { display: none; }
}
