/* ==========================================================================
   K.LAB — SWISS-BRUTALIST INDUSTRIAL INSTRUMENT STYLESHEET
   Aesthetic Anchors: Swiss-Brutalist Grid · Ryoji Ikeda · Teenage Engineering
   Hard Rules: 0px Radius · 0px Blur · 0px Soft Shadow · 1px Exposed Grid
   ========================================================================== */

:root,
[data-theme="obsidian"] {
  --bg: #070709;
  --bg-surface: #0C0C10;
  --bg-invert: #F3F2EE;
  --fg: #F3F2EE;
  --fg-invert: #070709;
  --fg-muted: rgba(243, 242, 238, 0.56);
  --fg-dim: rgba(243, 242, 238, 0.30);
  --line: rgba(243, 242, 238, 0.14);
  --line-strong: rgba(243, 242, 238, 0.34);
  --accent: #FF3B1D;
  --accent-fg: #070709;
  --chroma-r: rgba(255, 59, 29, 0.85);
  --chroma-c: rgba(0, 229, 255, 0.72);
  --hud-h: 44px;
  --status-h: 38px;
}

[data-theme="silica"] {
  --bg: #EFECE6;
  --bg-surface: #E5E1D9;
  --bg-invert: #111113;
  --fg: #111113;
  --fg-invert: #EFECE6;
  --fg-muted: rgba(17, 17, 19, 0.58);
  --fg-dim: rgba(17, 17, 19, 0.32);
  --line: rgba(17, 17, 19, 0.15);
  --line-strong: rgba(17, 17, 19, 0.38);
  --accent: #D92B04;
  --accent-fg: #EFECE6;
  --chroma-r: rgba(217, 43, 4, 0.78);
  --chroma-c: rgba(0, 118, 168, 0.65);
}

/* Base Reset — Strictly Sharp Corners */
*,
*::before,
*::after {
  box-sizing: border-box;
  border-radius: 0 !important;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--fg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  selection-background-color: var(--accent);
  transition: background-color 180ms steps(4, end), color 180ms steps(4, end);
}

::selection {
  background: var(--accent);
  color: var(--accent-fg);
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  outline: none;
}

button:focus-visible,
a:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==========================================================================
   FULLSCREEN GENERATIVE CANVAS & ARCHITECTURAL GRID OVERLAY
   ========================================================================== */
#bg-canvas-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.swiss-bg-grid {
  position: fixed;
  inset: var(--hud-h) 0 var(--status-h) 0;
  z-index: 1;
  pointer-events: none;
}

.swiss-bg-grid .grid-v {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
  opacity: 0.45;
}

.swiss-bg-grid .grid-v-1 { left: 8.333%; }
.swiss-bg-grid .grid-v-2 { left: 66.666%; }
.swiss-bg-grid .grid-v-3 { left: 91.666%; }

/* ==========================================================================
   OVERCLOCK / WARP STATE — GLOBAL CHROMATIC ABERRATION & TENSION JITTER
   ========================================================================== */
@keyframes warp-text-jitter {
  0% {
    text-shadow: -1.5px 0 0 var(--chroma-r), 1.5px 0 0 var(--chroma-c);
    transform: translate3d(0, 0, 0);
  }
  25% {
    text-shadow: 2px -0.5px 0 var(--chroma-r), -1.5px 0.5px 0 var(--chroma-c);
    transform: translate3d(0.6px, -0.3px, 0);
  }
  50% {
    text-shadow: -2px 0.5px 0 var(--chroma-r), 2px -0.5px 0 var(--chroma-c);
    transform: translate3d(-0.5px, 0.4px, 0);
  }
  75% {
    text-shadow: 1.5px 0 0 var(--chroma-r), -2px 0 0 var(--chroma-c);
    transform: translate3d(0.4px, 0.2px, 0);
  }
  100% {
    text-shadow: -1.5px 0 0 var(--chroma-r), 1.5px 0 0 var(--chroma-c);
    transform: translate3d(0, 0, 0);
  }
}

body.is-warping .stage-viewport {
  animation: warp-text-jitter 110ms steps(2, end) infinite;
}

body.is-warping .hud-top,
body.is-warping .hud-bottom {
  border-color: var(--accent);
}

body.is-warping .display-title {
  text-shadow: -3px 0 0 var(--chroma-r), 3px 0 0 var(--chroma-c);
}

body.is-warping .hud-speed-btn {
  background-color: var(--accent);
  color: var(--accent-fg);
}

body.is-warping .hud-speed-btn .speed-prefix,
body.is-warping .hud-speed-btn .speed-val {
  color: var(--accent-fg);
}

body.is-warping .status-clock-mode {
  background-color: var(--accent);
  color: var(--accent-fg);
}

/* ==========================================================================
   TOP FIXED HUD (44px)
   ========================================================================== */
.hud-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--hud-h);
  z-index: 50;
  display: flex;
  align-items: stretch;
  background-color: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.hud-cell {
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-right: 1px solid var(--line);
  white-space: nowrap;
  position: relative;
}

.hud-cell:last-child {
  border-right: 0;
}

/* Brand Cell */
.hud-brand {
  gap: 8px;
  padding: 0 16px;
  cursor: pointer;
}

.status-led {
  width: 6px;
  height: 6px;
  background-color: var(--accent);
  display: inline-block;
  flex-shrink: 0;
}

.brand-code {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
}

.brand-sub {
  color: var(--fg-muted);
  font-size: 10px;
}

/* Primary Nav */
.hud-nav {
  padding: 0;
  display: flex;
  align-items: stretch;
}

.hud-nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 100%;
  border-right: 1px solid var(--line);
  color: var(--fg-muted);
  position: relative;
  transition: color 120ms linear, background-color 120ms linear;
}

.hud-nav-btn:last-child {
  border-right: 0;
}

.hud-nav-btn .nav-idx {
  color: var(--fg-dim);
  font-size: 9px;
}

.hud-nav-btn:hover {
  color: var(--fg);
  background-color: var(--bg-surface);
}

.hud-nav-btn.is-active {
  color: var(--fg);
  background-color: var(--bg-surface);
}

.hud-nav-btn.is-active .nav-idx {
  color: var(--accent);
}

.hud-nav-btn.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background-color: var(--accent);
}

/* Real-Time UTC+8 Calibrated Ruler */
.hud-ruler-cell {
  flex: 1 1 auto;
  min-width: 210px;
  gap: 14px;
  padding: 0 16px;
  overflow: hidden;
}

.ruler-meta {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-shrink: 0;
}

.ruler-zone {
  font-size: 9px;
  color: var(--accent);
  font-weight: 600;
}

.ruler-time {
  font-size: 11px;
  color: var(--fg);
  letter-spacing: 0.08em;
}

.ruler-track {
  position: relative;
  flex: 1 1 auto;
  height: 18px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-left: 1px solid var(--line-strong);
  border-right: 1px solid var(--line-strong);
}

.ruler-ticks {
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      to right,
      var(--line-strong) 0px,
      var(--line-strong) 1px,
      transparent 1px,
      transparent 24px
    ),
    repeating-linear-gradient(
      to right,
      var(--line) 0px,
      var(--line) 1px,
      transparent 1px,
      transparent 6px
    );
  background-size: 100% 10px, 100% 5px;
  background-position: left bottom, left bottom;
  background-repeat: no-repeat;
}

.ruler-needle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0%;
  width: 1px;
  background-color: var(--accent);
  will-change: transform;
  pointer-events: none;
}

.needle-diamond {
  position: absolute;
  top: 2px;
  left: 50%;
  width: 6px;
  height: 6px;
  background-color: var(--accent);
  transform: translateX(-50%) rotate(45deg);
}

/* FPS Cell */
.hud-fps-cell {
  gap: 6px;
  min-width: 74px;
  justify-content: space-between;
}

.hud-micro-label {
  color: var(--fg-dim);
  font-size: 9px;
}

.hud-fps-val {
  color: var(--fg);
  font-weight: 500;
}

/* Instrument Control Buttons */
.hud-ctrl-btn {
  gap: 8px;
  color: var(--fg);
  transition: background-color 100ms linear, color 100ms linear;
}

.hud-ctrl-btn:hover {
  background-color: var(--bg-invert);
  color: var(--fg-invert);
}

.hud-ctrl-btn:hover .ctrl-state,
.hud-ctrl-btn:hover .speed-prefix {
  color: var(--fg-invert);
}

.theme-swatch {
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
  background: linear-gradient(135deg, currentColor 50%, transparent 50%);
  display: inline-block;
}

.hud-speed-btn {
  min-width: 144px;
  justify-content: space-between;
}

.speed-prefix {
  color: var(--fg-muted);
  font-size: 9px;
}

.speed-val {
  font-weight: 600;
  color: var(--accent);
}

.ctrl-state {
  color: var(--fg-dim);
  font-weight: 600;
}

.hud-ctrl-btn[aria-pressed="true"] .ctrl-state {
  color: var(--accent);
}

.hud-cmd-btn {
  padding: 0 16px;
  font-weight: 600;
}

/* ==========================================================================
   MIDDLE MAIN VIEWPORT
   ========================================================================== */
.stage-viewport {
  position: fixed;
  top: var(--hud-h);
  bottom: var(--status-h);
  left: 0;
  right: 0;
  z-index: 10;
  overflow: hidden;
}

.lab-page {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.lab-page[hidden] {
  display: none;
}

/* ==========================================================================
   PAGE (01): LINKS — SWISS-BRUTALIST TYPOGRAPHY & TABLE SPECIMEN
   ========================================================================== */
.links-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* Asymmetric Header Grid */
.links-header {
  display: grid;
  grid-template-columns: 2fr 1fr;
  border-bottom: 1px solid var(--line);
}

.links-title-block {
  padding: 28px 32px 24px 32px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.section-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.kicker-seq {
  color: var(--accent);
  font-weight: 600;
}

.kicker-sep {
  color: var(--fg-dim);
}

.display-row {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}

.display-title {
  margin: 0;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(3.4rem, 8.6vw, 8.2rem);
  line-height: 0.84;
  letter-spacing: -0.045em;
  text-transform: uppercase;
  color: var(--fg);
}

.display-meta-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 6px;
}

.phonetic-sub {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
}

.count-bracket {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.08em;
}

/* Right Control Box */
.links-control-block {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: var(--bg-surface);
}

.control-block-head,
.control-block-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.control-block-head {
  border-bottom: 1px solid var(--line);
}

.control-block-foot {
  border-top: 1px solid var(--line);
  color: var(--fg-dim);
}

.mode-switch-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1 1 auto;
}

.mode-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 12px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border-right: 1px solid var(--line);
  transition: background-color 120ms linear, color 120ms linear;
}

.mode-btn:last-child {
  border-right: 0;
}

.mode-dot {
  width: 6px;
  height: 6px;
  border: 1px solid currentColor;
  display: inline-block;
}

.mode-btn:hover {
  color: var(--fg);
  background-color: var(--bg);
}

.mode-btn.is-active {
  background-color: var(--bg-invert);
  color: var(--fg-invert);
  font-weight: 600;
}

.mode-btn.is-active .mode-dot {
  background-color: var(--accent);
  border-color: var(--accent);
}

/* Swiss Table Column Header */
.swiss-table-head {
  display: grid;
  grid-template-columns: 84px minmax(220px, 1.5fr) minmax(180px, 1.1fr) minmax(150px, 0.9fr) 190px 56px;
  border-bottom: 1px solid var(--line-strong);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-dim);
  background-color: var(--bg);
}

.swiss-table-head > span {
  padding: 9px 16px;
  border-right: 1px solid var(--line);
}

.swiss-table-head > span:last-child {
  border-right: 0;
  text-align: center;
}

/* Swiss Table Rows */
.swiss-table-body {
  display: flex;
  flex-direction: column;
}

.swiss-row {
  display: grid;
  grid-template-columns: 84px minmax(220px, 1.5fr) minmax(180px, 1.1fr) minmax(150px, 0.9fr) 190px 56px;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  position: relative;
  transition: background-color 120ms linear, color 120ms linear;
}

.swiss-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0px;
  background-color: var(--accent);
  transition: width 140ms cubic-bezier(0.16, 1, 0.3, 1);
}

.swiss-row > span {
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
}

.swiss-row > span:last-child {
  border-right: 0;
  justify-content: center;
}

.swiss-row:hover {
  background-color: var(--bg-invert);
  color: var(--fg-invert);
}

.swiss-row:hover::before {
  width: 4px;
}

.swiss-row:hover .row-idx,
.swiss-row:hover .row-phonetic,
.swiss-row:hover .row-stack,
.swiss-row:hover .row-geo {
  color: var(--fg-invert);
  opacity: 0.82;
}

.swiss-row:hover .tag-chip {
  border-color: var(--fg-invert);
  color: var(--fg-invert);
}

.swiss-row:hover .row-arrow {
  color: var(--accent);
  transform: translate(3px, -3px);
}

.row-idx {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.row-name {
  flex-direction: column;
  align-items: flex-start !important;
  justify-content: center;
  gap: 3px;
}

.row-name-text {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: clamp(1.15rem, 1.8vw, 1.55rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-transform: uppercase;
}

.row-phonetic {
  font-size: 10px;
  color: var(--fg-dim);
  letter-spacing: 0.04em;
}

.row-tags {
  gap: 6px;
  flex-wrap: wrap;
}

.tag-chip {
  font-size: 9px;
  letter-spacing: 0.1em;
  padding: 3px 6px;
  border: 1px solid var(--line-strong);
  color: var(--fg-muted);
  text-transform: uppercase;
}

.row-stack {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  text-transform: uppercase;
}

.row-geo {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

.row-arrow {
  font-size: 16px;
  color: var(--fg-muted);
  transition: transform 140ms cubic-bezier(0.16, 1, 0.3, 1), color 120ms linear;
}

/* Physics Field Standby */
.physics-field-mount {
  flex: 1 1 auto;
  min-height: 300px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}

.physics-field-mount[hidden] {
  display: none;
}

/* Lower Whitespace & Optical Seal */
.links-footer-band {
  flex: 1 1 auto;
  min-height: 180px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 28px 32px;
  gap: 24px;
}

.footer-band-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.optical-seal {
  position: relative;
  width: 148px;
  height: 112px;
  border: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background-color: var(--bg);
  transition: background-color 140ms linear, color 140ms linear, border-color 140ms linear;
}

.optical-seal:hover {
  border-color: var(--accent);
  background-color: var(--accent);
  color: var(--accent-fg);
}

.optical-seal:hover .seal-code,
.optical-seal:hover .seal-sub {
  color: var(--accent-fg);
}

.optical-seal:hover .seal-crosshair {
  background-color: var(--accent-fg);
  opacity: 0.25;
}

.seal-crosshair {
  position: absolute;
  background-color: var(--line);
  pointer-events: none;
}

.seal-crosshair-h {
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
}

.seal-crosshair-v {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
}

.seal-corner {
  position: absolute;
  width: 7px;
  height: 7px;
  border-color: var(--accent);
  border-style: solid;
  pointer-events: none;
}

.seal-corner.tl { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.seal-corner.tr { top: -1px; right: -1px; border-width: 2px 2px 0 0; }
.seal-corner.bl { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; }
.seal-corner.br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

.seal-code {
  position: relative;
  z-index: 1;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.seal-label {
  position: relative;
  z-index: 1;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.12em;
}

.seal-sub {
  position: relative;
  z-index: 1;
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--fg-dim);
}

/* ==========================================================================
   PAGE (02): WORKS & PAGE (03): GALLERY — ARCHITECTURAL SCAFFOLDS
   ========================================================================== */
.works-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.works-console-bar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  background-color: var(--bg-surface);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.console-group {
  display: flex;
  align-items: stretch;
  border-right: 1px solid var(--line);
}

.console-group:last-child {
  border-right: 0;
}

.console-label {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  color: var(--fg-dim);
  font-size: 9px;
  border-right: 1px solid var(--line);
}

.console-btn {
  padding: 10px 14px;
  color: var(--fg-muted);
  border-right: 1px solid var(--line);
  transition: background-color 100ms linear, color 100ms linear;
}

.console-btn:last-of-type {
  border-right: 0;
}

.console-btn:hover {
  color: var(--fg);
  background-color: var(--bg);
}

.console-btn.is-active {
  background-color: var(--bg-invert);
  color: var(--fg-invert);
  font-weight: 600;
}

.console-slider-readout {
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-left: 1px solid var(--line);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.works-matrix-mount {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

/* Gallery 3D Viewport Scaffold */
.gallery-shell {
  position: relative;
  width: 100%;
  height: 100%;
}

.gallery-3d-mount {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-corner-tl,
.gallery-corner-tr,
.gallery-corner-br {
  position: absolute;
  z-index: 5;
  border: 1px solid var(--line);
  background-color: var(--bg);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gallery-corner-tl {
  top: 20px;
  left: 20px;
  display: flex;
  align-items: stretch;
}

.gallery-corner-tr {
  top: 20px;
  right: 20px;
}

.gallery-corner-br {
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
}

.corner-label {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  font-size: 9px;
  color: var(--fg-dim);
  border-right: 1px solid var(--line);
}

.gallery-corner-br .corner-label {
  padding: 0;
  border-right: 0;
}

.corner-btn-row {
  display: flex;
}

.corner-btn {
  padding: 8px 12px;
  color: var(--fg-muted);
  border-right: 1px solid var(--line);
}

.corner-btn:last-child {
  border-right: 0;
}

.corner-btn.is-active,
.corner-btn:hover {
  background-color: var(--bg-invert);
  color: var(--fg-invert);
}

.corner-val {
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Standby Plate (Clean Swiss Instrument Telemetry) */
.module-standby {
  border: 1px solid var(--line);
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: var(--bg-surface);
  max-width: 460px;
}

.standby-code {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-weight: 600;
}

.standby-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.standby-sub {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
}

/* ==========================================================================
   BOTTOM FIXED STATUS BAR (38px)
   ========================================================================== */
.hud-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--status-h);
  z-index: 50;
  display: flex;
  align-items: stretch;
  background-color: var(--bg);
  border-top: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.status-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-right: 1px solid var(--line);
  white-space: nowrap;
}

.status-cell:last-child {
  border-right: 0;
}

.status-page {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-prefix {
  color: var(--accent);
  font-weight: 600;
  font-size: 9px;
}

.status-clock-mode {
  color: var(--fg-muted);
  transition: background-color 100ms linear, color 100ms linear;
}

.status-cursor {
  min-width: 148px;
}

.status-coords {
  min-width: 168px;
  justify-content: flex-end;
  color: var(--fg-muted);
}

/* ==========================================================================
   RESPONSIVE ADAPTATION (Preserve Swiss 1px Discipline)
   ========================================================================== */
@media (max-width: 1080px) {
  .hud-ruler-cell {
    display: none;
  }

  .links-header {
    grid-template-columns: 1fr;
  }

  .links-title-block {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .swiss-table-head,
  .swiss-row {
    grid-template-columns: 68px 1.4fr 1fr 48px;
  }

  .col-stack,
  .col-geo,
  .row-stack,
  .row-geo {
    display: none !important;
  }
}

@media (max-width: 680px) {
  .hud-fps-cell,
  .hud-speed-btn .speed-prefix,
  .status-cursor {
    display: none;
  }

  .hud-speed-btn {
    min-width: auto;
  }

  .links-title-block {
    padding: 20px 16px;
  }

  .links-footer-band {
    padding: 20px 16px;
  }
}

/* ==========================================================================
   STAGE 3.1: MAGNETIC PREVIEW CARD, 2D PHYSICS FIELD & SVG OPTICAL SEAL
   ========================================================================== */
.swiss-table-head[hidden] {
  display: none;
}

/* Magnetic Floating Preview Card */
.links-mag-preview {
  position: fixed;
  top: 0;
  left: 0;
  width: 216px;
  z-index: 42;
  pointer-events: none;
  opacity: 0;
  background-color: var(--bg);
  border: 1px solid var(--line-strong);
  will-change: transform, opacity;
}

.mag-head,
.mag-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 9px;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.mag-head {
  border-bottom: 1px solid var(--line);
}

.mag-id {
  color: var(--accent);
  font-weight: 600;
}

.mag-coords {
  color: var(--fg-muted);
}

.mag-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background-color: var(--bg-surface);
}

.mag-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mag-crosshair {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to right, transparent calc(50% - 0.5px), rgba(255, 59, 29, 0.35) 50%, transparent calc(50% + 0.5px)),
    linear-gradient(to bottom, transparent calc(50% - 0.5px), rgba(255, 59, 29, 0.35) 50%, transparent calc(50% + 0.5px));
}

.mag-foot {
  border-top: 1px solid var(--line);
}

.mag-title {
  color: var(--fg);
  font-weight: 600;
}

.mag-algo {
  color: var(--fg-dim);
}

/* 2D Physics Collision Field */
.physics-field-mount {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-height: 490px;
}

.physics-toolbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  background-color: var(--bg-surface);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.physics-toolbar-left,
.physics-toolbar-right {
  display: flex;
  align-items: stretch;
}

.phys-badge {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  color: var(--accent);
  font-weight: 600;
  border-right: 1px solid var(--line);
}

.phys-hint {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  color: var(--fg-muted);
  letter-spacing: 0.06em;
}

.phys-ctrl-btn {
  padding: 10px 16px;
  border-left: 1px solid var(--line);
  color: var(--fg-muted);
  transition: background-color 100ms linear, color 100ms linear;
}

.phys-ctrl-btn:hover {
  background-color: var(--bg);
  color: var(--fg);
}

.phys-ctrl-btn.is-active {
  background-color: var(--bg-invert);
  color: var(--fg-invert);
  font-weight: 600;
}

.phys-impulse-btn {
  color: var(--accent);
  font-weight: 600;
}

.phys-impulse-btn:hover {
  background-color: var(--accent);
  color: var(--accent-fg);
}

.physics-arena {
  position: relative;
  width: 100%;
  height: 450px;
  overflow: hidden;
  user-select: none;
  touch-action: none;
}

.arena-crosshair-h,
.arena-crosshair-v {
  position: absolute;
  pointer-events: none;
  background-color: var(--line);
  opacity: 0.55;
}

.arena-crosshair-h {
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
}

.arena-crosshair-v {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
}

.arena-telemetry {
  position: absolute;
  left: 14px;
  bottom: 12px;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--fg-dim);
  pointer-events: none;
}

/* Rigid-Body Physics Module Cartridge */
.phys-node {
  position: absolute;
  top: 0;
  left: 0;
  width: 248px;
  height: 112px;
  background-color: var(--bg);
  border: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  will-change: transform;
  cursor: grab;
  transition: border-color 100ms linear;
}

.phys-node:hover {
  border-color: var(--fg);
}

.phys-node.is-grabbed {
  cursor: grabbing;
  border-color: var(--accent);
  background-color: var(--bg-surface);
}

.phys-node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.phys-node-id {
  color: var(--accent);
  font-weight: 600;
}

.phys-node-city {
  color: var(--fg-muted);
}

.phys-node-ext {
  padding: 0 4px;
  color: var(--fg-muted);
}

.phys-node-ext:hover {
  color: var(--accent);
}

.phys-node-body {
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.phys-thumb {
  width: 64px;
  border-right: 1px solid var(--line);
  flex-shrink: 0;
  background-color: var(--bg-surface);
}

.phys-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.phys-info {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.phys-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phys-tags {
  font-size: 9px;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phys-stack {
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
}

/* Multi-Ring Counter-Rotating SVG Optical Seal */
.optical-seal-svg-btn {
  position: relative;
  width: 176px;
  height: 176px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.optical-seal-svg-btn:hover {
  transform: scale(1.04);
}

.seal-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.seal-ring-outer,
.seal-ring-mid,
.seal-ring-inner {
  transform-origin: 88px 88px;
}

.ring-hairline {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1;
}

.ring-hairline-dim {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}

.ring-ticks line {
  stroke: var(--fg-muted);
  stroke-width: 1;
}

.ring-dashed {
  fill: none;
  stroke: var(--fg);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}

.ring-accent {
  stroke: var(--accent);
  stroke-width: 1.5;
}

.ring-square {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1;
}

.optical-seal-svg-btn.is-resonating .ring-hairline,
.optical-seal-svg-btn.is-resonating .ring-square {
  stroke: var(--accent);
}

.optical-seal-svg-btn.is-resonating .ring-ticks line {
  stroke: var(--fg);
}

.seal-core {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}

/* Fullscreen GSAP Optical Shutter Overlay */
.optical-shutter-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
  display: none;
  align-items: center;
  justify-content: center;
}

.optical-shutter-overlay.is-active {
  display: flex;
  pointer-events: all;
}

.shutter-curtain {
  position: absolute;
  inset: 0;
  background-color: var(--bg-invert);
}

.shutter-scanlines {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(255, 59, 29, 0.22) 3px,
    rgba(255, 59, 29, 0.22) 4px
  );
}

.shutter-reticle {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.shutter-reticle-box {
  width: 140px;
  height: 140px;
  border: 2px solid var(--accent);
}

.shutter-label {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--accent);
  font-weight: 600;
  background-color: var(--bg);
  padding: 6px 12px;
  border: 1px solid var(--accent);
}

/* ==========================================================================
   STAGE 3.2: PAGE (02) WORKS MATRIX & REAL-TIME FILTER BENCH
   ========================================================================== */
.console-fader-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-left: 1px solid var(--line);
}

.console-fader {
  -webkit-appearance: none;
  appearance: none;
  width: 96px;
  height: 2px;
  background: var(--line-strong);
  outline: none;
  cursor: ew-resize;
}

.console-fader::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 16px;
  background: var(--accent);
  border: 1px solid var(--fg);
  cursor: ew-resize;
}

.console-fader::-moz-range-thumb {
  width: 10px;
  height: 16px;
  background: var(--accent);
  border: 1px solid var(--fg);
  border-radius: 0;
  cursor: ew-resize;
}

.console-slider-readout {
  border-left: 0;
  padding: 0;
  min-width: 38px;
  text-align: right;
  color: var(--fg-dim);
}

.console-slider-readout.is-engaged {
  color: var(--accent);
  font-weight: 600;
}

.works-matrix-mount.is-grid-view,
.works-matrix-mount.is-matrix-view {
  display: block;
  padding: 0;
}

/* GRID + VIEW (3-Column Exposed 1px Swiss Architecture) */
.works-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.work-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background-color: transparent;
  position: relative;
  transition: background-color 120ms linear, color 120ms linear;
}

.work-card:nth-child(3n) {
  border-right: 0;
}

.work-card:hover {
  background-color: var(--bg-surface);
}

.work-card.is-portal {
  background-color: var(--bg-surface);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.work-card.is-portal:hover {
  background-color: var(--bg-invert);
  color: var(--fg-invert);
}

.work-card.is-portal:hover .work-code-sub,
.work-card.is-portal:hover .work-params,
.work-card.is-portal:hover .work-year {
  color: var(--fg-invert);
  opacity: 0.78;
}

.work-card.is-portal:hover .tag-chip {
  border-color: var(--fg-invert);
  color: var(--fg-invert);
}

.work-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.work-idx {
  color: var(--accent);
  font-weight: 600;
}

.work-year {
  color: var(--fg-muted);
}

.work-disc {
  color: var(--fg-dim);
}

.work-card.is-portal .work-disc {
  color: var(--accent);
  font-weight: 600;
}

.work-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background-color: var(--bg);
}

.work-thumb-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.work-card:hover .work-thumb-canvas {
  transform: scale(1.03);
}

.portal-badge {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: var(--accent);
  color: var(--accent-fg);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.work-card-body {
  padding: 16px 14px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
}

.work-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.work-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.work-arrow {
  font-size: 15px;
  color: var(--accent);
}

.work-code-sub {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
  text-transform: uppercase;
}

.work-meta-foot {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.work-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.work-params {
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

/* MATRIX + VIEW (High-Density Swiss Ledger) */
.works-ledger {
  display: flex;
  flex-direction: column;
}

.works-ledger-head,
.work-ledger-row {
  display: grid;
  grid-template-columns: 76px 88px minmax(200px, 1.5fr) 76px minmax(160px, 1fr) 168px 88px;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}

.works-ledger-head {
  border-bottom: 1px solid var(--line-strong);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-dim);
  background-color: var(--bg);
}

.works-ledger-head > span,
.work-ledger-row > span {
  padding: 10px 14px;
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
}

.works-ledger-head > span:last-child,
.work-ledger-row > span:last-child {
  border-right: 0;
  justify-content: center;
}

.work-ledger-row {
  text-align: left;
  transition: background-color 110ms linear, color 110ms linear;
}

.work-ledger-row:hover {
  background-color: var(--bg-invert);
  color: var(--fg-invert);
}

.work-ledger-row.is-portal {
  border-left: 3px solid var(--accent);
}

.work-ledger-row:hover .wl-sub,
.work-ledger-row:hover .wl-year,
.work-ledger-row:hover .wl-params {
  color: var(--fg-invert);
  opacity: 0.8;
}

.work-ledger-row:hover .tag-chip {
  border-color: var(--fg-invert);
  color: var(--fg-invert);
}

.wl-idx {
  color: var(--accent);
  font-weight: 600;
  font-size: 11px;
}

.wl-thumb {
  padding: 6px !important;
}

.wl-thumb .work-thumb-canvas {
  width: 74px;
  height: 54px;
}

.wl-name {
  flex-direction: column;
  align-items: flex-start !important;
  justify-content: center;
  gap: 2px;
}

.wl-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 16px;
}

.wl-sub {
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
}

.wl-year {
  font-size: 11px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

.wl-tags {
  gap: 6px;
  flex-wrap: wrap;
}

.wl-params {
  font-size: 10px;
  color: var(--fg-muted);
  letter-spacing: 0.08em;
}

.wl-act {
  color: var(--accent);
  font-weight: 600;
  font-size: 11px;
}

@media (max-width: 1080px) {
  .works-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .work-card:nth-child(3n) {
    border-right: 1px solid var(--line);
  }
  .work-card:nth-child(2n) {
    border-right: 0;
  }
  .works-ledger-head,
  .work-ledger-row {
    grid-template-columns: 64px 72px 1.4fr 68px 72px;
  }
  .works-ledger-head > span:nth-child(5),
  .works-ledger-head > span:nth-child(6),
  .wl-tags,
  .wl-params {
    display: none !important;
  }
}

@media (max-width: 680px) {
  .works-grid {
    grid-template-columns: 1fr;
  }
  .work-card {
    border-right: 0 !important;
  }
}

/* ==========================================================================
   STAGE 3.3: PAGE (03) GALLERY — 3D CONTROLS, 2D GRID & DARKROOM LIGHTBOX
   ========================================================================== */
.gallery-corner-bl {
  position: absolute;
  left: 20px;
  bottom: 20px;
  z-index: 5;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  background-color: var(--bg);
  font-size: 10px;
  letter-spacing: 0.1em;
  max-width: calc(100% - 340px);
}

.corner-hover-info {
  padding: 8px 14px;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-z-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 112px;
  height: 2px;
  background: var(--line-strong);
  outline: none;
  cursor: ew-resize;
}

.gallery-z-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 16px;
  background: var(--accent);
  border: 1px solid var(--fg);
  cursor: ew-resize;
}

.gallery-z-slider::-moz-range-thumb {
  width: 10px;
  height: 16px;
  background: var(--accent);
  border: 1px solid var(--fg);
  border-radius: 0;
  cursor: ew-resize;
}

/* 2D Grid Overlay inside (03) GALLERY */
.gallery-2d-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  background-color: var(--bg);
  overflow-y: auto;
  padding: 72px 20px 72px 20px;
}

.gallery-2d-overlay[hidden] {
  display: none;
}

.g2d-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.g2d-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background-color: var(--bg);
  transition: background-color 110ms linear, color 110ms linear;
}

.g2d-card:hover {
  background-color: var(--bg-invert);
  color: var(--fg-invert);
}

.g2d-card:hover .g2d-algo,
.g2d-card:hover .g2d-seed {
  color: var(--fg-invert);
  opacity: 0.78;
}

.g2d-head,
.g2d-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.g2d-head {
  border-bottom: 1px solid var(--line);
}

.g2d-foot {
  border-top: 1px solid var(--line);
}

.g2d-id {
  color: var(--accent);
  font-weight: 600;
}

.g2d-algo,
.g2d-seed {
  color: var(--fg-dim);
}

.g2d-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
}

.g2d-img-wrap {
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background-color: var(--bg-surface);
}

.g2d-img-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Minimalist Darkroom Lightbox */
.darkroom-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.darkroom-lightbox[hidden] {
  display: none;
}

.lb-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(7, 7, 9, 0.92);
}

[data-theme="silica"] .lb-backdrop {
  background-color: rgba(239, 236, 230, 0.94);
}

.lb-shell {
  position: relative;
  z-index: 2;
  width: min(860px, 100%);
  max-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  border: 1px solid var(--line-strong);
}

.lb-head,
.lb-foot {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  flex-wrap: wrap;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lb-head {
  border-bottom: 1px solid var(--line);
}

.lb-foot {
  border-top: 1px solid var(--line);
  padding: 10px 16px;
  gap: 12px;
}

.lb-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}

.lb-id {
  color: var(--accent);
  font-weight: 600;
}

.lb-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
}

.lb-en {
  color: var(--fg-dim);
  font-size: 9px;
}

.lb-head-right {
  display: flex;
  align-items: stretch;
}

.lb-btn {
  padding: 10px 14px;
  border-left: 1px solid var(--line);
  color: var(--fg-muted);
  transition: background-color 100ms linear, color 100ms linear;
}

.lb-btn:hover,
.lb-btn.is-active {
  background-color: var(--bg-invert);
  color: var(--fg-invert);
}

.lb-close {
  color: var(--accent);
  font-weight: 600;
}

.lb-close:hover {
  background-color: var(--accent);
  color: var(--accent-fg);
}

.lb-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: var(--bg-surface);
  overflow: hidden;
}

.lb-plate-wrap {
  height: min(68vh, 620px);
  aspect-ratio: 4 / 5;
  border: 1px solid var(--line-strong);
  background-color: var(--bg);
}

.lb-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lb-img.is-inverted {
  filter: invert(1);
}

.lb-desc {
  color: var(--fg-muted);
}

.lb-meta {
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .g2d-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .gallery-corner-bl {
    display: none;
  }
}

@media (max-width: 600px) {
  .g2d-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   STAGE 3.2 AUDIT: ASYMMETRIC 12-COL STAGGERED WORKS GRID + CONTACT SHEET
   ========================================================================== */
.works-asym-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.works-asym-grid .work-card {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.wc-span-7 { grid-column: span 7; }
.wc-span-5 { grid-column: span 5; }
.wc-span-4 { grid-column: span 4; }
.wc-span-12 { grid-column: span 12; border-right: 0 !important; }

.wc-offset-down .work-card-inner {
  padding-top: 28px;
}

.wc-offset-mid .work-card-inner {
  padding-top: 16px;
}

.work-card-inner {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.work-card-inner.is-portal-inner {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
}

.work-card-inner.is-portal-inner .work-thumb-wrap {
  border-bottom: 0;
  border-right: 1px solid var(--line);
  aspect-ratio: 16 / 9;
}

.work-card-inner.is-portal-inner .work-card-body {
  padding: 28px 26px;
  justify-content: center;
}

.work-card-inner.is-portal-inner .work-title {
  font-size: clamp(1.6rem, 3vw, 2.5rem);
}

.g2d-sheet-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-bottom: 0;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--fg-muted);
  background-color: var(--bg-surface);
}

@media (max-width: 1080px) {
  .wc-span-7,
  .wc-span-5,
  .wc-span-4 {
    grid-column: span 6;
  }
  .wc-offset-down .work-card-inner,
  .wc-offset-mid .work-card-inner {
    padding-top: 0;
  }
  .work-card-inner.is-portal-inner {
    grid-template-columns: 1fr;
  }
  .work-card-inner.is-portal-inner .work-thumb-wrap {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 680px) {
  .wc-span-7,
  .wc-span-5,
  .wc-span-4,
  .wc-span-12 {
    grid-column: span 12;
  }
}

/* ==========================================================================
   STAGE 4: 7-STATE DYNAMIC CURSOR + 2.5x OPTICAL LOUPE + HIDDEN [CMD] TERMINAL
   ========================================================================== */
@media (pointer: fine) {
  body.has-custom-cursor,
  body.has-custom-cursor * {
    cursor: none !important;
  }
}

.cursor-fx-canvas {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
}

.lab-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 125;
  pointer-events: none;
  opacity: 0;
  will-change: transform;
}

/* State 1: Idle Gyro Crosshair */
.cur-gyro {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
}

.cur-line {
  position: absolute;
  background-color: var(--fg);
}

.cur-h {
  width: 20px;
  height: 1px;
  left: -10px;
  top: -0.5px;
}

.cur-v {
  width: 1px;
  height: 20px;
  top: -10px;
  left: -0.5px;
}

.cur-dot {
  position: absolute;
  width: 3px;
  height: 3px;
  left: -1.5px;
  top: -1.5px;
  background-color: var(--accent);
}

/* States 2/3/4/6: Square Bracket Lock / Physics Clamp / Project RGB Viewfinder */
.cur-brackets {
  position: absolute;
  top: -16px;
  left: -16px;
  width: 32px;
  height: 32px;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 120ms linear, transform 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.cur-brackets .cb {
  position: absolute;
  width: 7px;
  height: 7px;
  border-color: var(--accent);
  border-style: solid;
}

.cur-brackets .tl { top: 0; left: 0; border-width: 1.5px 0 0 1.5px; }
.cur-brackets .tr { top: 0; right: 0; border-width: 1.5px 1.5px 0 0; }
.cur-brackets .bl { bottom: 0; left: 0; border-width: 0 0 1.5px 1.5px; }
.cur-brackets .br { bottom: 0; right: 0; border-width: 0 1.5px 1.5px 0; }

.lab-cursor.mode-link .cur-brackets,
.lab-cursor.mode-physics .cur-brackets,
.lab-cursor.mode-project .cur-brackets,
.lab-cursor.mode-seal .cur-brackets {
  opacity: 1;
  transform: scale(1);
}

/* Physics dashed clamp */
.lab-cursor.mode-physics .cur-brackets {
  border: 1px dashed var(--accent);
  width: 38px;
  height: 38px;
  top: -19px;
  left: -19px;
}

/* Project RGB chromatic viewfinder */
.lab-cursor.mode-project .cur-brackets {
  width: 44px;
  height: 44px;
  top: -22px;
  left: -22px;
  box-shadow: -2px 0 0 rgba(255, 59, 29, 0.7), 2px 0 0 rgba(0, 229, 255, 0.7);
}

/* State 5: 2.5x Darkroom Optical Magnifying Glass (Circular Optical Lens) */
.cur-loupe-lens {
  position: absolute;
  top: -58px;
  left: -58px;
  width: 116px;
  height: 116px;
  border-radius: 50% !important;
  border: 1.5px solid var(--accent);
  background-color: var(--bg);
  background-repeat: no-repeat;
  opacity: 0;
  transform: scale(0.45);
  transition: opacity 130ms linear, transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.lab-cursor.mode-loupe .cur-loupe-lens {
  opacity: 1;
  transform: scale(1);
}

.lab-cursor.mode-loupe .cur-gyro {
  opacity: 0;
}

.loupe-cross-h,
.loupe-cross-v {
  position: absolute;
  background-color: rgba(255, 59, 29, 0.55);
}

.loupe-cross-h {
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
}

.loupe-cross-v {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
}

.loupe-tag {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 5px;
  font-size: 8px;
  letter-spacing: 0.12em;
  background-color: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}

/* State 7: Warp 45° Prism Diamond */
.cur-warp-prism {
  position: absolute;
  top: -9px;
  left: -9px;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--accent);
  transform: rotate(45deg) scale(0.5);
  opacity: 0;
  transition: opacity 90ms linear, transform 120ms linear;
}

.lab-cursor.mode-warp .cur-warp-prism {
  opacity: 1;
  transform: rotate(45deg) scale(1);
}

.lab-cursor.mode-warp .cur-gyro {
  opacity: 0.25;
}

/* Hidden Experimental Terminal [CMD] */
.cmd-terminal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cmd-terminal[hidden] {
  display: none;
}

.cmd-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(7, 7, 9, 0.84);
}

[data-theme="silica"] .cmd-backdrop {
  background-color: rgba(17, 17, 19, 0.56);
}

.cmd-panel {
  position: relative;
  z-index: 2;
  width: min(620px, 100%);
  background-color: #070709;
  color: #F3F2EE;
  border: 1px solid rgba(243, 242, 238, 0.36);
  display: flex;
  flex-direction: column;
  font-family: 'JetBrains Mono', monospace;
}

.cmd-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(243, 242, 238, 0.16);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.cmd-title {
  color: #FF3B1D;
  font-weight: 600;
}

.cmd-close {
  color: rgba(243, 242, 238, 0.65);
  padding: 4px 8px;
  border: 1px solid rgba(243, 242, 238, 0.2);
}

.cmd-close:hover {
  background-color: #FF3B1D;
  color: #070709;
  border-color: #FF3B1D;
}

.cmd-controls {
  padding: 14px;
  border-bottom: 1px solid rgba(243, 242, 238, 0.16);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cmd-ctrl-row {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 10px;
  letter-spacing: 0.12em;
}

.cmd-ctrl-label {
  color: rgba(243, 242, 238, 0.68);
}

.cmd-ctrl-val {
  color: #FF3B1D;
  font-weight: 600;
  min-width: 36px;
}

.cmd-quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.cmd-qbtn {
  padding: 8px 10px;
  font-size: 10px;
  letter-spacing: 0.08em;
  border: 1px solid rgba(243, 242, 238, 0.22);
  color: #F3F2EE;
  text-align: left;
  transition: background-color 100ms linear, color 100ms linear;
}

.cmd-qbtn:hover {
  background-color: #F3F2EE;
  color: #070709;
}

.cmd-log {
  height: 150px;
  overflow-y: auto;
  padding: 12px 14px;
  font-size: 11px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background-color: #0B0B0E;
}

.cmd-line.is-sys { color: rgba(243, 242, 238, 0.56); }
.cmd-line.is-echo { color: #F3F2EE; }
.cmd-line.is-ok { color: #FF3B1D; }
.cmd-line.is-err { color: #FF6B52; }

.cmd-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid rgba(243, 242, 238, 0.22);
}

.cmd-prompt {
  color: #FF3B1D;
  font-weight: 600;
}

.cmd-input {
  flex: 1 1 auto;
  background: transparent;
  border: 0;
  outline: none;
  color: #F3F2EE;
  font-family: inherit;
  font-size: 11px;
}

/* ==========================================================================
   AWWWARDS POLISH PASS (20 POINTS + OVERCLOCK POSTERIZATION & GLITCH ART)
   ========================================================================== */

/* #1 Unified CJK / Latin Display Typography */
:root {
  --font-display: 'Syne', 'Noto Sans SC', sans-serif;
  --font-mono: 'JetBrains Mono', 'Noto Sans SC', monospace;
  --surface-wash: rgba(7, 7, 9, 0.78);
}

[data-theme="silica"] {
  --surface-wash: rgba(239, 236, 230, 0.86);
}

body {
  font-family: var(--font-mono);
}

.display-title,
.row-name-text,
.work-title,
.wl-title,
.lb-title,
.g2d-title,
.cart-title {
  font-family: var(--font-display);
}

/* #2 Crisp Figure-Ground Separation (No Blur, Pure Architectural Ink Wash) */
.links-header,
.swiss-table-body,
.work-card,
.works-ledger {
  background-color: var(--surface-wash);
}

/* #3 Compact 1-Screen Rhythm for (01) LINKS so UNLOCK Seal sits cleanly in viewport */
.links-title-block {
  padding: 18px 28px 16px 28px;
  gap: 10px;
}

.display-title {
  font-size: clamp(2.8rem, 6.2vw, 5.8rem);
}

.swiss-row > span {
  padding: 12px 16px;
}

.row-name-text {
  font-size: clamp(1rem, 1.45vw, 1.28rem);
  font-weight: 700;
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1), color 140ms linear;
}

.links-footer-band {
  min-height: 152px;
  padding: 16px 32px;
}

.optical-seal-svg-btn {
  width: 148px;
  height: 148px;
}

.seal-ring-outer,
.seal-ring-mid,
.seal-ring-inner {
  transform-origin: 74px 74px;
}

/* #8 Refined Non-Flashing Hover (Signal-Red Laser Edge + Micro Shift instead of Blinding Invert) */
.swiss-row:hover {
  background-color: var(--bg-surface);
  color: var(--fg);
}

.swiss-row:hover .row-name-text {
  transform: translateX(6px);
  color: var(--accent);
}

.swiss-row:hover .row-idx,
.swiss-row:hover .row-phonetic,
.swiss-row:hover .row-stack,
.swiss-row:hover .row-geo {
  color: var(--fg);
  opacity: 0.9;
}

.swiss-row:hover .tag-chip {
  border-color: var(--accent);
  color: var(--fg);
}

.g2d-card:hover {
  background-color: var(--bg-surface);
  color: var(--fg);
  border-color: var(--accent);
}

.g2d-card:hover .g2d-title {
  color: var(--accent);
}

.g2d-card:hover .g2d-algo,
.g2d-card:hover .g2d-seed {
  color: var(--fg-muted);
  opacity: 1;
}

/* #7 Teenage Engineering Hardware Cartridge Physics Modules */
.phys-cartridge {
  position: absolute;
  top: 0;
  left: 0;
  width: 224px;
  height: 92px;
  background-color: var(--bg);
  border: 1px solid var(--line-strong);
  display: grid;
  grid-template-columns: 52px 1fr;
  will-change: transform;
  user-select: none;
  transition: border-color 100ms linear;
}

.phys-cartridge:hover {
  border-color: var(--fg);
}

.phys-cartridge.is-grabbed {
  border-color: var(--accent);
  background-color: var(--bg-surface);
}

.cart-spine {
  background-color: var(--bg-invert);
  color: var(--fg-invert);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
  border-right: 1px solid var(--line-strong);
}

.phys-cartridge.is-grabbed .cart-spine {
  background-color: var(--accent);
  color: var(--accent-fg);
}

.cart-big-num {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.cart-screw {
  font-size: 11px;
  opacity: 0.65;
  line-height: 1;
}

.cart-main {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.cart-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
  color: var(--fg-dim);
  letter-spacing: 0.1em;
}

.cart-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-spec {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
  color: var(--fg-muted);
  border-top: 1px solid var(--line);
  padding-top: 5px;
}

.cart-led {
  width: 6px;
  height: 6px;
  background-color: var(--accent);
}

/* #4 True Swiss Asymmetric Negative-Space Grid for (02) WORKS */
.works-swiss-neg-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0;
  padding: 20px 24px 36px 24px;
  row-gap: 28px;
  column-gap: 18px;
}

.works-swiss-neg-grid .work-card {
  border: 1px solid var(--line-strong);
}

.works-swiss-neg-grid.is-editorial-all .wc-pos-1 {
  grid-column: 1 / 8;
}

.works-swiss-neg-grid.is-editorial-all .wc-pos-1 .work-thumb-wrap {
  aspect-ratio: 16 / 9;
}

/* Column 8 intentionally left as Swiss architectural negative space */
.works-swiss-neg-grid.is-editorial-all .wc-pos-2 {
  grid-column: 9 / 13;
  align-self: end;
}

.works-swiss-neg-grid.is-editorial-all .wc-pos-2 .work-thumb-wrap {
  aspect-ratio: 4 / 5;
}

.works-swiss-neg-grid.is-editorial-all .wc-pos-3 {
  grid-column: 1 / 5;
}

.works-swiss-neg-grid.is-editorial-all .wc-pos-4 {
  grid-column: 6 / 10;
  margin-top: 32px;
}

.works-swiss-neg-grid.is-editorial-all .wc-pos-5 {
  grid-column: 10 / 13;
}

.works-swiss-neg-grid.is-editorial-all .wc-pos-5 .work-thumb-wrap {
  aspect-ratio: 1 / 1;
}

.works-swiss-neg-grid.is-editorial-all .wc-pos-6 {
  grid-column: 1 / 13;
}

.wc-filtered {
  grid-column: span 4;
}

@media (max-width: 1080px) {
  .works-swiss-neg-grid.is-editorial-all .wc-pos-1,
  .works-swiss-neg-grid.is-editorial-all .wc-pos-2,
  .works-swiss-neg-grid.is-editorial-all .wc-pos-3,
  .works-swiss-neg-grid.is-editorial-all .wc-pos-4,
  .works-swiss-neg-grid.is-editorial-all .wc-pos-5,
  .wc-filtered {
    grid-column: span 6;
    margin-top: 0;
  }
}

@media (max-width: 680px) {
  .works-swiss-neg-grid {
    padding: 12px;
  }
  .works-swiss-neg-grid .work-card {
    grid-column: 1 / 13 !important;
  }
}

/* #9 Sharp 0px Square Optical Loupe Viewfinder (100% Faithful to Brutalist Charter) */
.cur-loupe-lens {
  border-radius: 0 !important;
  width: 120px;
  height: 120px;
  top: -60px;
  left: -60px;
  border: 1px solid var(--accent);
}

.loupe-corner {
  position: absolute;
  width: 8px;
  height: 8px;
  border-color: var(--fg);
  border-style: solid;
}

.loupe-corner.tl { top: 4px; left: 4px; border-width: 1.5px 0 0 1.5px; }
.loupe-corner.tr { top: 4px; right: 4px; border-width: 1.5px 1.5px 0 0; }
.loupe-corner.bl { bottom: 4px; left: 4px; border-width: 0 0 1.5px 1.5px; }
.loupe-corner.br { bottom: 4px; right: 4px; border-width: 0 1.5px 1.5px 0; }

/* + OVERCLOCK POSTERIZATION (色调分离) & GLITCH ART OVERLAY */
.warp-glitch-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  opacity: 0;
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 2px,
      rgba(255, 59, 29, 0.08) 2px,
      rgba(255, 59, 29, 0.08) 3px
    );
  transition: opacity 100ms linear;
}

@keyframes warp-glitch-bands {
  0%   { clip-path: inset(0% 0% 0% 0%); transform: translateX(0); }
  20%  { clip-path: inset(12% 0% 68% 0%); transform: translateX(-6px); }
  40%  { clip-path: inset(54% 0% 24% 0%); transform: translateX(7px); }
  60%  { clip-path: inset(0% 0% 0% 0%); transform: translateX(0); }
  80%  { clip-path: inset(76% 0% 8% 0%); transform: translateX(-5px); }
  100% { clip-path: inset(0% 0% 0% 0%); transform: translateX(0); }
}

body.is-warping .warp-glitch-overlay {
  opacity: 1;
  animation: warp-glitch-bands 190ms steps(2, end) infinite;
}

/* Apply SVG 4-Level Posterization + High-Contrast Chromatic Tension on Stage during 4.00x Warp */
body.is-warping .stage-viewport {
  filter: url(#lab-warp-posterize) contrast(1.18) saturate(1.35);
}
