@font-face {
  font-family: "DM Sans";
  src: url("fonts/dm-sans.woff2") format("woff2");
  font-weight: 400 600;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif.woff2") format("woff2");
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #090a0d;
  --ink: #ede8dc;
  --dim: #b4afa4;
  --line: #373228;
  --signal: #e2bd80;
  --mono: "IBM Plex Mono", "Courier New", monospace;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
body { margin: 0; overflow: hidden; background: var(--bg); color: var(--ink); font-family: "DM Sans", Arial, sans-serif }
a { color: inherit; text-decoration: none }
button, summary { font: inherit; color: inherit; cursor: pointer }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px }

.portfolio {
  --gutter: clamp(10px, 4vw, 64px);
  height: 100svh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: radial-gradient(ellipse at 50% 49%, #1c1914 0%, var(--bg) 66%);
}
.masthead {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: clamp(5px, 1.3svh, 14px) var(--gutter);
  border-bottom: 1px solid #e2bd8020;
}
.brand { white-space: nowrap; font: bold .95rem var(--mono) }
.brand span { color: var(--signal) }
nav { display: flex; align-items: center; gap: clamp(12px, 2.5vw, 38px); font-size: .9rem }
nav a:hover, summary:hover { color: var(--signal) }
.project-nav { white-space: nowrap }
.ddg-link { display: grid; place-items: center; justify-content: center; min-width: 32px; min-height: 32px }
.ddg-link img { display: block }
.ddg-link:hover img, .ddg-link:focus-visible img { filter: drop-shadow(0 0 5px #e2bd8070) }
.contact { position: relative }
.contact summary { list-style: none; padding: 9px 0 9px 10px; white-space: nowrap }
.contact summary::-webkit-details-marker { display: none }
.contact-menu {
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 172px;
  display: grid;
  background: #151419;
  border: 1px solid #63553d;
}
.contact-menu a { padding: 12px }

.transformer { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0 }
.intro { text-align: center; padding: clamp(5px, 1.7svh, 20px) 12px 0 }
.intro h1 { font: 400 clamp(1.7rem, min(5.4vw, 8.5svh), 5rem)/.95 "Instrument Serif", Georgia, serif; letter-spacing: -.025em; margin: 0 0 clamp(3px, 1svh, 8px) }
.intro p { color: var(--dim); max-width: 72ch; margin: 0 auto; line-height: 1.4; text-wrap: pretty }
.intro-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px clamp(12px, 2vw, 24px);
  margin-top: clamp(2px, 1svh, 8px);
  font: .73rem/1.25 var(--mono);
}
.intro-links a { color: var(--signal); padding-block: 3px }
.intro-links a:hover { text-decoration: underline; text-underline-offset: 3px }
.intro-links [aria-disabled=true] { color: var(--dim) }
.intro-links small { font: inherit }
.viewport { position: relative; isolation: isolate; min-width: 0; container-type: size }
.scene, .hotspots { position: absolute; inset: 0 }
.scene canvas { display: block; width: 100%; height: 100%; touch-action: pan-y }
.scene canvas:focus-visible { outline: 1px solid var(--signal); outline-offset: -2px }
.hotspots { pointer-events: none }
.hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  color: var(--signal);
  background: #141318;
  border: 1px solid #786548;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  padding: 0;
  font: .78rem var(--mono);
}
.hotspot:hover, .hotspot[aria-pressed=true] { background: var(--signal); color: #161411 }
.label { color: var(--dim); font: .73rem var(--mono); letter-spacing: .07em; text-transform: uppercase; margin: 0 }
.terminal {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  align-content: center;
  gap: 9px;
  min-height: 78px;
  padding: 12px;
  background: #101014f5;
  border: 1px solid #5b4c36;
  text-align: center;
  pointer-events: none;
}
.terminal code, .terminal output { font: .87rem/1.3 var(--mono) }
.terminal output { color: #ecd09c }
.terminal output[data-pending] { color: var(--dim) }
.token-strip { display: flex; gap: 6px; justify-content: center }
.token-strip i { width: 5px; height: 5px; background: #879fff }
.fallback { position: absolute; bottom: 14px; left: 5%; right: 5%; text-align: center; color: var(--dim) }

.detail {
  position: absolute;
  z-index: 2;
  bottom: 8px;
  left: clamp(12px, 4vw, 64px);
  width: min(355px, calc(100% - 24px));
  padding: 14px 35px 14px 14px;
  background: #151419f5;
  border: 1px solid #63553d;
}
.detail h2 { margin: 6px 0; font-size: 1.12rem }
.detail p:last-child { color: var(--dim); line-height: 1.42; margin: 0 }
.detail button { position: absolute; right: 5px; top: 5px; border: 0; background: none; font-size: 1.2rem }
.console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 16px;
  padding: clamp(4px, 1.3svh, 11px) var(--gutter);
  border-top: 1px solid #e2bd8020;
}
.stages, .view-controls { display: flex; gap: 4px; flex-wrap: wrap }
.view-controls { align-items: center }
.view-controls a { padding: 7px 9px; color: var(--signal); font: .78rem var(--mono) }
.view-controls a:hover { text-decoration: underline }
.zoom-hint { display: none }
@media (min-width: 900px) and (hover: hover) {
  .console:has(.zoom-hint:not([hidden])) { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) }
  .console > .inspect { justify-self: end }
  .zoom-hint { display: block }
}
.console button { background: #151419; border: 1px solid var(--line); padding: 7px 9px; font: .78rem var(--mono) }
.console button:hover, .console button[aria-pressed=true] { border-color: var(--signal); color: var(--signal) }

.loader { display: none }
.js .loader {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #090a0d;
  color: var(--dim);
  font: .78rem var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.js .loader.leaving { opacity: 0; visibility: hidden; transition: opacity 230ms, visibility 230ms; pointer-events: none }
.loader-network {
  display: block;
  width: min(650px, 98vw, 142svh);
  height: auto;
}
.loader p { margin: 0; padding-inline: 12px; text-align: center }
@media(prefers-reduced-motion: reduce) {
  .js .loader.leaving { transition: none }
}
.terminal-input { width: clamp(95px, 13vw, 165px); grid-template-columns: minmax(0, 1fr); pointer-events: auto }
#glyph { display: block; width: 100%; max-width: 132px; margin: auto; image-rendering: pixelated; background: #09090c; border: 1px solid var(--line) }
#next-symbol { padding: 5px 2px; border: 1px solid var(--line); background: #151419; color: var(--ink); font: .7rem var(--mono) }
.terminal-output { width: clamp(142px, 16vw, 205px); container-type: inline-size; text-align: left; gap: 8px }
@media (min-width: 651px) {
  .viewport {
    --panel-inset: clamp(10px, 2.1vw, 52px);
    --scene-gap: clamp(6px, .9vw, 18px);
    --input-width: clamp(108px, 15vw, 244px);
    --output-width: clamp(153px, 17.5vw, 285px);
  }
  .scene, .hotspots {
    left: calc(var(--panel-inset) + var(--input-width) + var(--scene-gap));
    right: calc(var(--panel-inset) + var(--output-width) + var(--scene-gap));
  }
  .terminal-input { left: var(--panel-inset); width: var(--input-width) }
  .terminal-output { right: var(--panel-inset); width: var(--output-width) }
}
.terminal-output .label { font-size: clamp(.65rem, 7.5cqi, .73rem); line-height: 1.15; overflow-wrap: anywhere }
#scores-label { display: block }
.scores ol { padding: 0; margin: 5px 0 0; list-style: none; font: clamp(.65rem, 8cqi, .75rem)/1.15 var(--mono) }
.scores li { display: grid; grid-template-columns: 1ch minmax(0, 1fr) 4ch; gap: clamp(3px, 3cqi, 6px); align-items: center; color: var(--dim) }
.scores li span:last-child { text-align: right }
.scores li i { height: 3px; background: linear-gradient(90deg, #a68550 var(--score), #30291e var(--score)) }
.scores li.winner { color: #f5d49a; font-weight: bold }
.scores li.winner i { background: linear-gradient(90deg, #e2bd80 var(--score), #30291e var(--score)) }
.prediction { border-top: 1px solid var(--line); padding-top: 5px; display: grid; grid-template-columns: minmax(0, 1fr) fit-content(45%); gap: 4px; align-items: center }
.prediction output { font: bold clamp(.8rem, 11cqi, 1.25rem)/1.2 var(--mono); text-align: right; overflow-wrap: anywhere }
.pass-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px }

.console [data-pass=forward] { border-color: #466897; color: #a8cdff }
.console [data-pass=backward] { border-color: #864963; color: #ff99b6 }
.viewport[data-phase=backward] .terminal-output { border-color: #a34e70 }
.viewport[data-phase=backward] .terminal-input { border-color: #85405d }

.contact summary span, .inspect summary span { color: var(--signal); margin-left: .35em }
.contact[open] summary, .inspect[open] summary { color: var(--signal) }
.contact-menu a + a { border-top: 1px solid var(--line) }
.contact-signal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}
.inspect { position: relative; z-index: 3 }
.inspect summary { list-style: none; white-space: nowrap; font-size: .86rem }
.inspect summary::-webkit-details-marker { display: none }
.inspect-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: min(340px, calc(100vw - 28px));
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #151419;
  border: 1px solid #63553d;
}
.console button { background: transparent; border-color: transparent }
.console button:hover, .console button[aria-pressed=true] { background: #e2bd8010 }
#next-symbol { background: transparent }
@media(max-width: 350px) { .brand { font-size: .78rem } }
.portfolio:has(.contact[open]) .terminal-output {
  border-color: var(--signal);
  box-shadow: 0 0 20px #e2bd8025;
}
.signal-trace {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}
.viewport[data-phase=rebound] .terminal-input { border-color: #ff527d }

.detail {
  width: min(400px, calc(100% - 24px));
  max-height: calc(100% - 16px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  padding: 16px 18px 12px;
}
.detail-reading { position: relative; min-height: 0; display: grid }
#detail-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #947947 #252019;
}
#detail-scroll:focus-visible { outline: 1px solid var(--signal); outline-offset: -1px }
.detail-scroll-cue {
  position: absolute;
  right: 10px;
  bottom: 0;
  padding: 5px 8px;
  border: 1px solid #685335;
  background: #151419;
  box-shadow: 0 0 13px 5px #151419;
  color: var(--signal);
  font: .66rem/1 var(--mono);
  pointer-events: none;
  visibility: hidden;
}
#detail-content { padding-right: 8px }
.detail[data-scroll-more] .detail-scroll-cue { visibility: visible }
.detail h2 { font: 400 clamp(1.6rem, 3vw, 2.05rem)/1 "Instrument Serif", Georgia, serif; margin: 8px 22px 10px 0 }
.detail #detail-copy { color: var(--ink); margin: 0; line-height: 1.45 }
.detail .detail-flow { color: var(--signal); font: .77rem/1.4 var(--mono); margin: 0 0 9px }
.detail-note { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 10px }
.detail #detail-note-copy { font-size: .87rem; margin-top: 4px }
.detail-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px }
.detail-nav button { position: static; padding: 6px 8px; border: 1px solid var(--line); font: inherit; font-size: .85rem }
.detail-nav button:disabled { opacity: .38; cursor: default }
.detail-nav a { color: var(--signal); font-size: .85rem }
.node-key { margin: 0; font-size: .82rem; color: var(--dim) }
.node-key span:nth-child(1) { color: var(--ink) }
.node-key span:nth-child(2) { color: #90c7ff }
.node-key span:nth-child(3) { color: #ff849f }
@media(min-width: 651px) and (max-height: 650px) {
  .detail { width: min(455px, calc(100% - 24px)); padding-block: 12px 9px }
  .detail h2 { margin-block: 5px 7px }
  .detail-note { padding-top: 6px; margin-top: 7px }
}

.model-switch { position: relative; display: flex; align-items: center; flex: 0 1 238px; min-width: 0; gap: 8px; font-size: .84rem }
.model-switch label { color: var(--dim) }
.model-switch select { appearance: none; padding: 5px 24px 5px 9px; border: 1px solid var(--line); background: #141318; color: var(--ink); font: inherit; min-width: 0; flex: 1 }
.model-switch:has(.model-picker[hidden])::after { content: ''; width: 5px; height: 5px; border-right: 1px solid var(--signal); border-bottom: 1px solid var(--signal); transform: rotate(45deg); position: absolute; right: 10px; top: calc(50% - 4px); pointer-events: none }
#prompt { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 10px 4px; background: #090b0f; border: 1px solid var(--line) }
#prompt span { max-width: 100%; padding: 3px 4px; border: 1px solid #48615c; color: #c9e6dd; font: .76rem var(--mono); white-space: pre-wrap; overflow-wrap: anywhere }
.viewport[data-model=clip] #glyph { width: min(55px, 23cqh) }
.viewport[data-model=clip] #prompt { padding-block: 4px; gap: 2px }
.viewport[data-model=clip] #prompt span { padding: 1px 3px; font-size: .68rem }
.viewport[data-model]:not([data-model=vision]) .scores li { grid-template-columns: minmax(0, 46%) minmax(0, 1fr) 4ch }
.viewport[data-model]:not([data-model=vision]) .scores li span:first-child { overflow-wrap: anywhere }
.viewport[data-model]:not([data-model=vision]) .prediction output { font-size: clamp(.75rem, 9cqi, 1.03rem) }

.transformer:has(.decoder-key:not([hidden])) { grid-template-rows: auto minmax(0, 1fr) auto auto }
.decoder-key { display: flex; justify-content: center; gap: 8px 18px; flex-wrap: wrap; padding: 0 12px 10px; margin: 0; color: var(--dim); font: .7rem var(--mono) }
.decoder-key span:first-child { color: #79cabf }
.decoder-key span:nth-child(2) { color: #ecc17f }

.decoder-key { align-items: center }
.decoder-key p { margin: 0 }
.decoder-key #decoder-explanation { color: var(--signal) }
.lens-switch { display: flex; gap: 3px; }
.lens-switch button { border: 1px solid var(--line); background: #141318; padding: 5px 8px; color: var(--dim); font: inherit }
.lens-switch button[aria-pressed=true] { color: var(--ink); border-color: var(--signal); background: #e2bd8020 }
@media(max-width: 720px) {
  .masthead { flex-wrap: wrap }
  .model-switch { order: 1; flex-basis: 100% }
  .portfolio .masthead > nav { margin-inline-start: auto }
}

/* Keep auxiliary content reachable inside short viewports. */
.terminal { max-height: calc(100% - 8px) }
.terminal-output { max-height: none; pointer-events: auto }
.inspect-menu { max-height: min(65svh, 340px); overflow: auto }
@media (max-height: 525px) {
  .terminal { gap: 4px; padding: 6px 8px; min-height: 0 }
  #glyph { max-width: 85px }
  .decoder-key { gap: 3px 12px; padding-bottom: 5px }
}

.model-picker { position: relative; width: 100%; max-width: 22rem }
.portfolio .masthead > nav { position: relative; z-index: 1 }
.model-picker:not([open]) > .model-options, .contact:not([open]) > .contact-menu { display: none }
.model-picker summary {
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  padding: 6px 10px;
  border: 1px solid #756246;
  background: #141318;
}
.model-picker summary::-webkit-details-marker { display: none }
.model-picker summary:hover, .model-picker[open] summary { border-color: var(--signal); color: var(--ink) }
.model-picker summary i {
  width: 6px;
  height: 6px;
  border-bottom: 1px solid var(--signal);
  border-right: 1px solid var(--signal);
  transform: rotate(45deg);
  margin: -3px 2px 0 auto;
}
.model-picker[open] summary i { transform: rotate(225deg); margin-top: 3px }
.model-picker-label, .model-group-label {
  font: .62rem var(--mono);
  color: var(--signal);
  letter-spacing: .10em;
  text-transform: uppercase;
}
.model-options {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  width: 100%;
  max-width: 22rem;
  overflow: auto;
  overscroll-behavior: contain;
  max-height: min(65svh, 370px);
  padding: 5px;
  border: 1px solid #756246;
  background: #131216;
  box-shadow: 0 14px 32px #0009;
}
.model-options button {
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 6px 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-size: .84rem;
}
.model-options button:hover, .model-options button:focus-visible { border-color: #756246; background: #e2bd8014 }
.model-options button:focus-visible { outline-offset: -2px }
.model-options button[aria-pressed=true] { color: var(--signal); background: #e2bd8018 }
.model-options button[aria-pressed=true]::after { content: ''; width: 4px; height: 8px; border: solid currentColor; border-width: 0 1px 1px 0; transform: rotate(45deg); margin: 0 3px 3px 8px }
.model-option-group { border-block-start: 1px solid var(--line); margin-top: 3px; padding-top: 3px }
.model-group-label { display: block; padding: 3px 9px; color: var(--dim) }
@media(max-width: 720px) {
  .model-switch select { max-width: 22rem }
  .model-options { max-height: min(58svh, 370px) }
}

.contact-menu { min-width: 205px; max-height: 75svh; overflow: auto }

.model-options {
  scrollbar-color: #947947 #151419;
  scrollbar-width: thin;
}
.model-options::-webkit-scrollbar { width: 8px }
.model-options::-webkit-scrollbar-track { background: #151419 }
.model-options::-webkit-scrollbar-thumb {
  background: #947947;
  border: 2px solid #151419;
  border-radius: 8px;
}
.model-options::-webkit-scrollbar-thumb:hover { background: var(--signal) }
.model-options::-webkit-scrollbar-button { display: none; width: 0; height: 0 }
.model-picker summary i { flex: 0 0 7px; height: 7px; border-color: var(--signal) }
#config-source { color: var(--signal); text-decoration: underline; text-underline-offset: 2px }

.layer-audit { position: relative; z-index: 3 }
.layer-audit summary { color: var(--signal); padding: 4px 6px; border: 1px solid var(--line); cursor: pointer }
.layer-audit-panel {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  width: min(315px, calc(100vw - 20px)); padding: 9px; background: #151419;
  border: 1px solid #756246; box-shadow: 0 8px 22px #0008; line-height: 1.4;
}
.layer-audit-header { display: flex; align-items: center; gap: 7px }
.layer-audit-header input { width: 5ch; font: inherit; background: #101014; border: 1px solid var(--line); color: var(--ink) }
.layer-audit-header button { border: 1px solid var(--line); background: #101014; color: var(--signal) }
.layer-audit-header button:disabled { opacity: .4 }
.layer-audit-panel p { margin-top: 6px }
#layer-description { color: var(--ink) }
#layer-dependencies:empty { display: none }
.layer-audit-scope { color: var(--dim) }
@media(max-width: 650px) {
  .layer-audit { position: static }
  .decoder-key { position: relative }
  .layer-audit-panel { bottom: calc(100% + 4px) }
}

#selected-model { overflow-wrap: anywhere }
.model-options button { gap: 4px; overflow-wrap: anywhere }
.model-options button[aria-pressed=true]::after { flex: 0 0 4px }
#checkpoint-source { color: var(--signal); overflow-wrap: anywhere; text-decoration: underline; text-underline-offset: 2px }

.message-options > summary { display: flex; justify-content: space-between; align-items: center; padding: 12px }
.message-options > summary i { width: 5px; height: 5px; border: solid var(--signal); border-width: 0 1px 1px 0; transform: rotate(45deg) }
.message-options[open] > summary i { transform: rotate(225deg) }
.message-options ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); list-style: none; padding: 0 8px 7px; gap: 4px; margin: 0 }
.message-options ul :is(a, span, button) { display: block; padding: 5px 7px; font-size: .78rem; border: 1px solid var(--line) }
.message-options ul button { width: 100%; text-align: left; background: transparent }
.contact-feedback { margin: 0; padding: 0 8px 7px; font-size: .72rem; color: var(--signal); overflow-wrap: anywhere }
.contact-feedback:empty { padding: 0 }
.message-options [aria-disabled=true] { color: var(--dim); opacity: .62 }
#booking-link { border-top: 1px solid var(--line) }
#booking-link[aria-disabled=true] { color: var(--dim); opacity: .62 }
.contact-menu [data-relay-active] { background: #e2bd8013; box-shadow: inset 2px 0 var(--signal) }
.contact-menu [data-relay-active] > :is(a, span, button) { border-color: #756246 }

@media (max-width: 650px) {
  body { overflow: auto }
  .portfolio { height: auto; min-height: 100svh }
  .transformer { grid-template-rows: auto minmax(316px, 1fr) auto }
  .transformer:has(.decoder-key:not([hidden])) { grid-template-rows: auto minmax(316px, 1fr) auto auto }
  .masthead { row-gap: 4px }
  nav { gap: 10px }
  nav > a, .contact > summary, .model-picker summary, .model-switch select { min-height: 40px }
  nav > a, .contact > summary, .inspect > summary { display: flex; align-items: center }
  .intro { padding-top: 10px }
  .intro p { font-size: .86rem }
  .viewport { --terminal-space: 206px }
  .scene, .hotspots { bottom: var(--terminal-space) }
  .fallback { bottom: var(--terminal-space) }
  .hotspot { width: 38px; height: 38px }
  .terminal {
    top: auto;
    bottom: 8px;
    transform: none;
    min-height: 0;
    max-height: calc(var(--terminal-space) - 16px);
    padding: 6px 8px;
    gap: 4px;
  }
  .terminal-input { left: var(--gutter); width: clamp(114px, 41%, 185px) }
  .terminal-output { left: auto; right: var(--gutter); width: clamp(137px, 47%, 215px); max-height: none }
  .terminal-input .label { font-size: .65rem }
  .terminal-output .scores ol { margin-top: 3px }
  .prediction { padding-top: 3px }
  #glyph { width: 72px }
  #next-symbol, .inspect > summary { min-height: 32px }
  .decoder-key { gap: 5px 10px; padding: 0 10px 6px; text-align: center }
  .lens-switch button, .layer-audit summary, .console button { min-height: 30px }
  .layer-audit-panel { max-height: min(52svh, 300px); overflow: auto; text-align: left }
  .console { gap: 3px 8px }
  .console #phase { min-height: 2.6em; font-size: .65rem; line-height: 1.3 }
  .model-options button { min-height: 38px }
}

@media (max-width: 400px) {
  .portfolio .masthead { column-gap: 6px; padding-inline: 10px }
  .portfolio .masthead .brand { font-size: .72rem }
  .portfolio .masthead nav { gap: 6px; font-size: .78rem }
  .portfolio .masthead .ddg-link { min-width: 26px }
  .portfolio .masthead .ddg-link img { width: 24px; height: 24px }
}
@media (max-width: 350px) {
  .portfolio .masthead .brand { letter-spacing: -.03em }
  .portfolio .masthead nav { gap: 4px }
  .portfolio .masthead .ddg-link { min-width: 24px }
  .portfolio .masthead .contact > summary { padding-left: 2px }
}

@media (max-width: 650px) and (pointer: coarse) {
  .portfolio .masthead nav > a, .portfolio .contact > summary { min-height: 44px }
  .portfolio .masthead .ddg-link { min-width: 36px }
  .portfolio .masthead nav > a:active, .portfolio .contact > summary:active { color: var(--signal) }
  .portfolio .contact-menu > a, .portfolio .message-options > summary { min-height: 44px }
  .portfolio .message-options ul :is(a, span, button) { min-height: 36px; padding-block: 8px }
}

@media (min-width: 651px) and (max-height: 500px) {
  .intro p { font-size: .82rem }
  .viewport { --input-width: clamp(88px, 13vw, 120px); --output-width: clamp(194px, 21vw, 218px) }
  .terminal-output { padding: 5px 7px; gap: 4px }
  .terminal-output .label { font-size: .65rem }
  .scores ol {
    display: grid;
    grid-auto-flow: column;
    grid-template: repeat(5, auto) / repeat(2, minmax(0, 1fr));
    column-gap: 10px;
    margin-top: 4px;
    font-size: .65rem;
  }
  .terminal-output .prediction { padding-top: 3px }
  .viewport[data-model]:not([data-model=vision]) .scores li {
    grid-template-columns: minmax(0, 1fr) 4ch;
    gap: 1px 2px;
  }
  .viewport[data-model]:not([data-model=vision]) .scores li i {
    grid-area: 2 / 1 / 3 / -1;
    height: 1px;
  }
  .terminal-input .label { font-size: .62rem }
  #glyph { width: min(65px, 28cqh) }
  .decoder-key { font-size: .65rem }
  .layer-audit-panel { max-height: 51svh; overflow: auto }
}

@media (min-width: 651px) and (max-height: 360px) {
  .terminal-input { padding: 4px 6px; gap: 3px }
  .terminal-output { padding-block: 3px; gap: 2px }
  .scores ol { margin-top: 2px; line-height: 1.06 }
  #prompt { padding-block: 3px; gap: 2px }
  #prompt span { padding-block: 1px }
  #next-symbol { padding-block: 3px }
}

@media (min-aspect-ratio: 21/9) and (min-width: 1400px) {
  .portfolio { --wide-inset: max(0px, (100% - min(240svh, 2400px)) / 2) }
  .masthead, .console { padding-inline: calc(var(--wide-inset) + var(--gutter)) }
}
