html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font-family: "JetBrains Mono", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", monospace; }
button, input { font: inherit; }
.field-photo { display: block; background: none !important; object-fit: cover; object-position: center; }
.field-photo::after { display: none !important; }
.creature-distortion { position: absolute; inset: 0; z-index: 22; width: 100%; height: 100%; pointer-events: none; }
.creature-intro-more { max-width: 500px; margin-top: 22px; }
.creature-intro-more p { margin: 0 0 15px; font-size: clamp(13px,1.05vw,16px); line-height: 1.55; }
.menu-tools summary { display: none; }
.device-test-link { color: var(--pink); text-decoration: none; }
.device-test-link:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.menu-meta-line { display: flex; align-items: baseline; gap: 5px; flex-wrap: nowrap; white-space: nowrap; overflow-x: auto; scrollbar-width: none; font-size: 7px !important; letter-spacing: .025em !important; }
.menu-meta-line::-webkit-scrollbar { display: none; }
.menu-meta-line a { flex: 0 0 auto; }
.context-page { --context-gutter: clamp(22px,5vw,76px); overflow-x: hidden; }
.context-intro { box-sizing: border-box; width: 100%; grid-template-columns: minmax(0,1fr); padding-inline: var(--context-gutter); align-content: start; }
.context-intro > * { min-width: 0; max-width: 100%; }
.context-intro h1 { width: min(100%,950px); font-size: clamp(36px,6.2vw,78px); line-height: .98; letter-spacing: -.035em; overflow-wrap: anywhere; }
.context-intro-copy { width: min(100%,780px); }
.context-intro-copy p { overflow-wrap: break-word; }
.context-copy { box-sizing: border-box; padding-inline: var(--context-gutter); grid-template-columns: minmax(0,1fr) minmax(330px,1fr); gap: clamp(22px,4vw,64px); align-items: start; }
.context-copy article { min-width: 0; }
.context-main-column { min-width: 0; }
.context-main-column article { padding: 0 0 clamp(32px,5vw,66px); border: 0; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.context-main-column article + article { padding-top: clamp(20px,3vw,38px); border-top: 1px solid #fe74a075; }
.context-side-column { display: grid; gap: 12px; min-width: 0; align-content: start; }
.context-side-column > article,
.context-media-gallery { min-width: 0; padding: clamp(18px,2.2vw,30px); background: #00180eea; border: 1px solid #ffffff28; border-radius: 2px 22px 2px 22px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.diagram-labels strong { font-weight: 600; }
.context-copy .warning-label p { overflow-wrap: anywhere; }
.palette-switch { display: none !important; }
.pole-colors { border: 1px solid #ffffff45; margin: 15px 0 5px; padding: 10px; min-width: 0; }
.pole-colors legend { color: var(--pink); font-size: 11px; letter-spacing: .07em; padding: 0 4px; }
.pole-color-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.pole-color-options button { color: #fff; background: #0006; border: 1px solid #ffffff58; padding: 9px 5px; min-height: 40px; cursor: pointer; font-size: 11px; letter-spacing: .02em; }
.pole-color-options button[aria-pressed="true"] { color: #101010; background: var(--pink); border-color: var(--pink); }
.pole-color-options button:focus-visible, .language-button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.pole-note { font-size: 9px; line-height: 1.3; color: #e6e6e6; margin: 9px 0 0; }
.pole-tracking-tools { border: 1px solid #ffffff45; margin: 10px 0 5px; padding: 10px; min-width: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.pole-tracking-tools legend { color: var(--pink); font-size: 11px; letter-spacing: .07em; padding: 0 4px; }
.pole-tracking-tools button { border: 1px solid #ffffff75; color: #fff; background: #0006; min-height: 39px; font-size: 9px; cursor: pointer; }
.pole-tracking-tools #pole-preview { grid-column: 1 / -1; color: var(--pink); }
.pole-tracking-tools #pole-preview[aria-pressed="true"] { color: #101010; background: var(--pink); }
.pole-tracking-tools button:focus-visible { outline: 2px solid var(--pink); }
.pole-tracking-tools p { grid-column: 1 / -1; font-size: 9px; color: var(--pink); line-height: 1.3; margin: 2px 0 0; }
.pole-tracking-tools p:empty { display: none; }

.protocol-irl-gallery,
.protocol-video-gallery { z-index: 8; width: min(58vw,840px); margin: 28px 3vw 28px auto; position: relative; color: #0f6; }
.protocol-video-gallery { margin-bottom: 70px; }
.protocol-page { overflow-y: auto; overflow-x: hidden; }
.protocol-irl-gallery label,
.protocol-video-gallery label { display: block; color: var(--pink); margin: 0 0 8px; font-size: 11px; letter-spacing: .08em; }
.protocol-irl-gallery select,
.protocol-video-gallery select { width: 100%; min-height: 52px; appearance: auto; color: #0f6; background: #000c06e8; border: 1px solid #0f6; border-radius: 0; padding: 8px 12px; font-size: clamp(16px,2vw,28px); font-weight: 400; cursor: pointer; }
.protocol-irl-gallery figure,
.protocol-video-gallery figure { margin: 10px 0 0; padding: 10px; background: #000c06cc; border: 1px solid #0f6; }
.protocol-irl-gallery picture { display: block; overflow: hidden; background: #001008; }
.protocol-irl-gallery img { display: block; width: 100%; height: min(48vw,560px); object-fit: contain; object-position: center; }
.protocol-video-gallery video { display: block; width: 100%; max-height: min(48vw,560px); background: #001008; }
.protocol-irl-gallery figcaption,
.protocol-video-gallery figcaption { color: #0f6; margin-top: 8px; font-size: 10px; letter-spacing: .055em; }
.context-media-gallery label { display: block; color: var(--pink); margin-bottom: 8px; font-size: 10px; letter-spacing: .06em; }
.context-media-gallery select { width: 100%; min-height: 48px; color: #fff; background: #0009; border: 1px solid var(--pink); border-radius: 0; padding: 7px 9px; font-size: clamp(12px,1.1vw,16px); }
.context-media-gallery figure { margin: 10px 0 0; }
.context-media-gallery picture { display: block; }
.context-media-gallery img,
.context-media-gallery video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #001008; }
.context-media-gallery [hidden] { display: none; }
.context-media-gallery figcaption { margin-top: 8px; color: var(--pink); font-size: 9px; letter-spacing: .045em; }
.pole-calibration { position: absolute; inset: 0; z-index: 75; pointer-events: none; display: none; }
.pole-calibration.active { display: block; pointer-events: auto; touch-action: manipulation; cursor: crosshair; }
.pole-calibration > p { position: absolute; left: 50%; bottom: max(102px,calc(env(safe-area-inset-bottom) + 95px)); transform: translateX(-50%); width: min(90vw,590px); text-align: center; color: #fff; background: #001a14bf; border: 1px solid var(--pink); padding: 12px; font-size: clamp(11px,2.5vw,15px); }
.pole-calibration-markers, #pole-calibration-markers { position: absolute; inset: 0; pointer-events: none; }
.pole-calibration-marker { position: absolute; width: 24px; height: 24px; border: 2px solid var(--pink); border-radius: 50%; transform: translate(-50%,-50%); box-shadow: 0 0 0 5px #fe74a049; }
.pole-calibration-marker:after { content: attr(data-number); color: #fff; font-size: 10px; position: absolute; left: 28px; top: 0; }
.pole-debug-overlay { position: absolute; inset: 0; z-index: 62; display: none; pointer-events: none; }
.pole-debug-overlay.active { display: block; }
.pole-debug-overlay:before { content: "TRACKING VIEW"; position: absolute; top: 72px; right: 18px; color: var(--pink); background: #00180fc9; border: 1px solid var(--pink); padding: 6px 8px; font-size: 9px; letter-spacing: .06em; }
html[lang="zh-CN"] .pole-debug-overlay:before { content: "追踪视图"; }
.pole-debug-line { position: absolute; left: 0; top: 0; height: 1px; transform-origin: 0 50%; background: linear-gradient(90deg,#fe74a0,#fe74a018); filter: drop-shadow(0 0 3px #fe74a0); }
.pole-debug-marker { position: absolute; width: 24px; height: 24px; border: 2px solid var(--pink); border-radius: 50%; transform: translate(-50%,-50%); box-shadow: 0 0 0 5px #fe74a030,0 0 15px #fe74a0; }
.pole-debug-marker:before, .pole-debug-marker:after { content: ""; position: absolute; background: var(--pink); }
.pole-debug-marker:before { left: 10px; top: -8px; width: 1px; height: 36px; }
.pole-debug-marker:after { left: -8px; top: 10px; width: 36px; height: 1px; }
.pole-debug-marker b { position: absolute; left: 27px; top: -3px; color: #fff; background: #00180fcf; padding: 2px 4px; font-size: 9px; font-weight: 400; white-space: nowrap; }
.field-actions { position: fixed; top: max(13px,env(safe-area-inset-top)); right: max(17px,env(safe-area-inset-right)); z-index: 110; display: flex; align-items: center; justify-content: flex-end; gap: clamp(4px,1vw,13px); }
.field-actions .run-button, .field-actions .animal-mode-button, .field-actions .language-button { position: static; inset: auto; min-height: 44px; margin: 0; padding: 6px 7px; display: inline-flex; align-items: center; justify-content: center; line-height: 1.1; background: #06080845; backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); border: 1px solid #fe74a080; color: var(--pink); font-size: clamp(10px,1vw,12px); letter-spacing: .03em; white-space: nowrap; cursor: pointer; }
.field-actions .run-button:after { display: none; }
.field-actions .language-button { border-color: #ffffffa0; color: #fff; min-width: 48px; }
.site-menu.is-open { z-index: 200; }
.context-palette { position: relative; z-index: 20; pointer-events: auto; touch-action: manipulation; min-height: 48px; font-size: 12px; }
body:not(.route-field) .field-actions #run, body:not(.route-field) .field-actions #animal-time { display: none; }
.artist-page { min-height: 100svh; overflow: auto; color: #fff; background: linear-gradient(110deg,#001d15e9,#001507f2),url("./visuals/subpage-pattern.webp") center/430px repeat; padding: clamp(105px,13vh,145px) clamp(18px,5vw,90px) 50px; }
.artist-page.active { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(220px,.85fr); gap: clamp(24px,6vw,100px); align-items: start; }
.artist-copy { max-width: 820px; }
.artist-copy h1 { color: var(--pink); font-size: clamp(36px,7vw,100px); line-height: .9; font-weight: 400; margin: 14px 0 33px; overflow-wrap: anywhere; }
.artist-copy > h2, .credit-grid h2 { color: var(--pink); font-size: clamp(15px,1.35vw,20px); line-height: 1.2; font-weight: 400; letter-spacing: .06em; margin: 34px 0 15px; }
.artist-copy > h3 { color: #fff; font-size: clamp(25px,3vw,46px); line-height: 1; font-weight: 400; margin: 0 0 22px; }
.artist-copy p { font-size: clamp(15px,1.2vw,20px); line-height: 1.52; margin: 0 0 19px; }
.artist-copy .commission { border: 0; padding: 0; margin-top: calc(2 * 1.52em + 38px); margin-bottom: 46px; color: #fff; }
.credit-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; margin-top: 0; }
.credit-grid > section { min-width: 0; border-top: 1px solid #fe74a099; }
.credit-grid .credit-commission { grid-column: 1 / -1; }
.credit-grid .credit-wide { grid-column: 1 / -1; }
.credit-grid dl { margin: 0; }
.credit-grid dl > div { display: grid; grid-template-columns: minmax(120px,.72fr) minmax(0,1.28fr); gap: 16px; padding: 11px 0; border-top: 1px solid #ffffff28; }
.credit-grid dt, .credit-grid dd { margin: 0; overflow-wrap: anywhere; }
.credit-grid dt { color: var(--pink); font-size: 10px; line-height: 1.45; letter-spacing: .055em; }
.credit-grid dd { color: #fff; font-size: 12px; line-height: 1.5; }
.artist-copy .page-number { color: var(--pink); font-size: 12px; }
.artist-copy a { color: var(--pink); text-underline-offset: 4px; }
.artist-image { margin: 0; position: sticky; top: 95px; }
.artist-image img { display: block; width: 100%; max-height: 70svh; object-fit: contain; filter: grayscale(.08) contrast(1.07); }
.artist-image figcaption { margin-top: 8px; font-size: 10px; color: var(--pink); }
.creature-list article p { line-height: 1.48; }
.context-copy article p, .context-intro-copy p { line-height: 1.58; }
html[lang="zh-CN"] .creature-list article p, html[lang="zh-CN"] .context-copy p, html[lang="zh-CN"] .context-intro-copy p { letter-spacing: .02em; }

@media (max-width: 760px), (max-width: 900px) and (orientation: landscape) {
  .site-menu { width: fit-content; max-width: calc(100vw - 190px); }
  .site-menu.is-open { width: min(360px,calc(100vw - 20px)); max-width: none; }
  .site-menu:not(.is-open) .menu-panel { display: none; }
  .menu-trigger { min-height: 44px; border: 1px solid #ffffff8c; border-radius: 3px 12px 3px 12px; background: #00180fb8; font-size: 11px; padding: 8px 10px; }
  .menu-panel { max-height: calc(100vh - 65px); max-height: calc(100svh - 65px); overflow-y: auto; overscroll-behavior: contain; border-radius: 0 0 14px 4px; }
  .menu-panel nav { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; }
  .menu-panel nav a { box-sizing: border-box; min-width: 0; min-height: 46px; align-items: center; grid-template-columns: 25px minmax(0,1fr); padding: 8px 6px; font-size: 11px; line-height: 1.2; border: 1px solid #ffffff34; background: #001c1170; overflow-wrap: anywhere; }
  .menu-panel nav a:last-child { grid-column: 1 / -1; }
  .menu-panel > p { margin: 10px 0 2px; font-size: 10px; }
  .menu-tools { margin-top: 8px; border-top: 1px solid #ffffff6a; }
  .menu-tools summary { display: flex; align-items: center; justify-content: space-between; min-height: 42px; list-style: none; color: var(--pink); font-size: 11px; letter-spacing: .04em; cursor: pointer; }
  .menu-tools summary::-webkit-details-marker { display: none; }
  .menu-tools summary::after { content: "+"; font-size: 20px; font-weight: 400; }
  .menu-tools[open] summary::after { content: "−"; }
  .menu-tools .pole-colors { margin-top: 2px; }
  .context-page { --context-gutter: clamp(18px,4.5vw,29px); }
  .context-intro { min-height: 0; padding: 92px var(--context-gutter) 28px; }
  .context-intro h1 { font-size: clamp(33px,8vw,54px); line-height: 1; }
  .context-intro-copy p { font-size: 16px; line-height: 1.56; }
  .context-copy { grid-template-columns: minmax(0,1fr); gap: 18px; padding: 0 var(--context-gutter) 54px; }
  .context-main-column article { padding: 0 0 32px; }
  .context-side-column > article, .context-media-gallery { padding: 20px; }
  .creature-intro-more { margin-top: 20px; }
  .creature-intro-more p { font-size: 15px; }
  .field-actions { right: max(10px,env(safe-area-inset-right)); top: max(9px,env(safe-area-inset-top)); gap: 3px; }
  .field-actions .run-button, .field-actions .animal-mode-button, .field-actions .language-button { min-height: 44px; font-size: 10px; padding-inline: 6px; }
  .site-menu { width: fit-content; max-width: calc(100vw - 190px); }
  .menu-trigger { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .site-menu.is-open { width: min(360px,calc(100vw - 20px)); }
  .artist-page.active { grid-template-columns: 1fr; padding-top: 90px; }
  .artist-image { position: static; }
  .artist-copy p { font-size: 16px; }
  .credit-grid { grid-template-columns: 1fr; gap: 10px; }
  .credit-grid .credit-wide { grid-column: auto; }
  .credit-grid dl > div { grid-template-columns: minmax(105px,.7fr) minmax(0,1.3fr); gap: 12px; }
  .credit-grid dt { font-size: 11px; }
  .credit-grid dd { font-size: 14px; }
  .creature-list article p, .context-copy article p, .context-intro-copy p { font-size: 16px; line-height: 1.55; }
  .field-controls label { min-width: 0; }
}

/* V12: larger protocol micro-type while preserving its hierarchy. */
.protocol-mast > p { font-size: 11px; }
.protocol-mast button { font-size: 12px; }
.protocol-manifesto p { font-size: 14px; }
.protocol-equation { font-size: 11px !important; }
.protocol-constellation button { font-size: 12px; line-height: 1.15; }
.protocol-constellation button span,
.protocol-constellation button small { font-size: 9px; }
.protocol-specimen { bottom: max(86px,12vh); }
.protocol-specimen > span { font-size: 10px; }
.protocol-specimen p { font-size: 12px; }
.protocol-specimen a { font-size: 9px; }

/* Stable viewport sizing for older WeChat, UC, QQ and manufacturer WebViews. */
.home-screen { height: 100vh; height: calc(var(--pure-vh, 1vh) * 100); }
.protocol-page,
.pattern-page,
.artist-page { min-height: 100vh; min-height: calc(var(--pure-vh, 1vh) * 100); }

@media (max-width: 760px), (hover: none) and (pointer: coarse) {
  .protocol-specimen { bottom: auto; }
  .protocol-mast button { font-size: 13px; }
  .protocol-manifesto p { font-size: 15px; }
  .protocol-equation { font-size: 12px !important; }
  .protocol-constellation button { font-size: 13px; }
  .protocol-constellation button span,
  .protocol-constellation button small { font-size: 10px; }
  .protocol-specimen > span { font-size: 11px; }
  .protocol-specimen p { font-size: 14px; }
  .protocol-specimen a { font-size: 11px; }
  .protocol-irl-gallery, .protocol-video-gallery { width: auto; margin: 24px 12px; }
  .protocol-irl-gallery label, .protocol-video-gallery label { font-size: 12px; }
  .protocol-irl-gallery select, .protocol-video-gallery select { font-size: 16px; }
  .protocol-irl-gallery img { height: min(115vw,620px); }
  .protocol-video-gallery video { max-height: min(115vw,620px); }
}

@media (max-width: 900px) and (orientation: landscape) {
  .site-menu.is-open .menu-panel { box-sizing: border-box; max-height: calc(100vh - 48px); max-height: calc(100svh - 48px); display: grid; grid-template-columns: minmax(205px,.78fr) minmax(270px,1.22fr); grid-template-rows: auto auto; gap: 7px 10px; overflow: auto; padding: 8px; }
  .site-menu.is-open .menu-panel nav { grid-column: 1; grid-row: 1; display: grid; grid-template-columns: 1fr; align-content: start; gap: 3px; }
  .site-menu.is-open .menu-panel nav a,
  .site-menu.is-open .menu-panel nav a:last-child { grid-column: auto; min-height: 34px; padding: 5px 7px; font-size: 9px; }
  .site-menu.is-open .menu-tools { grid-column: 2; grid-row: 1; margin: 0; border: 0; }
  .site-menu.is-open .menu-tools summary { display: none; }
  .site-menu.is-open .pole-colors,
  .site-menu.is-open .pole-tracking-tools { margin: 0 0 6px; padding: 6px; }
  .site-menu.is-open .pole-colors legend,
  .site-menu.is-open .pole-tracking-tools legend { font-size: 8px; letter-spacing: .045em; }
  .site-menu.is-open .pole-color-options { gap: 3px; }
  .site-menu.is-open .pole-color-options button,
  .site-menu.is-open .pole-tracking-tools button { min-height: 28px; padding: 3px; font-size: 8px; }
  .site-menu.is-open .pole-tracking-tools p { font-size: 7px; }
  .site-menu.is-open .menu-meta-line { grid-column: 1 / -1; grid-row: 2; margin: 0; }
  .field-actions { top: max(5px,env(safe-area-inset-top)); right: max(8px,env(safe-area-inset-right)); }
  .field-actions .run-button, .field-actions .animal-mode-button, .field-actions .language-button { min-height: 36px; font-size: 10px; }
  .site-menu { top: max(5px,env(safe-area-inset-top)); left: max(8px,env(safe-area-inset-left)); width: fit-content; }
  .site-menu.is-open { width: min(650px,calc(100vw - 24px)); }
  .field-controls .camera-button { bottom: max(8px,env(safe-area-inset-bottom)); left: max(8px,env(safe-area-inset-left)); }
  .sound-toggle { bottom: max(8px,env(safe-area-inset-bottom)); left: calc(max(8px,env(safe-area-inset-left)) + 115px); }
  .field-controls label { right: max(12px,env(safe-area-inset-right)); bottom: max(8px,env(safe-area-inset-bottom)); width: min(42vw,360px); grid-template-columns: auto minmax(45px,1fr) auto; gap: 6px; font-size: 10px; padding: 5px 2px; }
  .field-controls label span { white-space: nowrap; }
  .artist-page.active { grid-template-columns: 1fr 260px; }
}

@media (max-width: 650px) and (orientation: landscape) {
  .field-controls label { width: 35vw; }
  .field-controls label span { font-size: 0; }
  .field-controls label span:before { content: "ROOT"; font-size: 10px; }
}

@media (max-width: 480px) and (orientation: portrait) {
  .field-actions .run-button { padding-inline: 5px; }
  .field-actions .animal-mode-button { font-size: 9px; }
  .site-menu { width: fit-content; max-width: calc(100vw - 205px); }
  .site-menu.is-open { width: min(340px,calc(100vw - 20px)); }
}
