:root {
  --bg: #010602;
  --bg-deep: #000301;
  --chitin-dark: #040d06;
  --chitin-panel: #07150a;
  --chitin-ridge: #112a15;
  --carapace-highlight: #194620;
  --metal-edge: #235d2c;
  --fg: #d2ffd8;
  --muted: #6eb774;
  --subtle: #78a77c;
  --border: #133918;
  --accent: #00ff41;
  --accent-glow: rgba(0, 255, 65, 0.45);
  --accent-fg: #011003;
  --sentinel-red: #ff002b;
  --sentinel-ruby: #ff2255;
  --sentinel-darkred: #660011;
  --sentinel-glow: rgba(255, 0, 43, 0.7);
  --font: "Share Tech Mono", "Courier New", monospace;
  --display: "Orbitron", "Share Tech Mono", sans-serif;
}

html {
  /* Prevent the fixed TINA pipe from shifting by the scrollbar width when the
     setup page hands off to the full-window slideshow. */
  scrollbar-gutter: stable;
}

* {
  box-sizing: border-box;
  border-color: var(--border);
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-deep);
  color: var(--fg);
  font-family: var(--font);
  overflow-x: hidden;
}

body {
  background-color: #010602;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(0, 255, 65, 0.1) 0%, transparent 65%),
    radial-gradient(circle at 10% 40%, rgba(255, 0, 43, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 90% 70%, rgba(255, 0, 43, 0.03) 0%, transparent 40%),
    linear-gradient(rgba(0, 255, 65, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 65, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 24px 24px, 24px 24px;
}

button:not(:disabled), [role="button"]:not(:disabled) {
  cursor: pointer;
}
button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  filter: grayscale(0.65);
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid #a9ffbc;
  outline-offset: 3px;
}

h1, h2, h3 {
  font-family: var(--display);
  text-wrap: balance;
  margin: 0;
  letter-spacing: 0.06em;
}

p {
  text-wrap: pretty;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* -------------------------------------------------------------
   AUTHENTIC MATRIX CODE RAIN CANVAS
   ------------------------------------------------------------- */
.matrix-rain-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
}

/* -------------------------------------------------------------
   SENTINEL ATMOSPHERIC OVERLAYS & SEARCH LASER
   ------------------------------------------------------------- */
.sentinel-overlay {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 15, 0, 0.32) 2px,
    rgba(0, 15, 0, 0.32) 4px
  );
  opacity: 0.7;
}

.sentinel-scanner-laser {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 0, 43, 0.2) 20%, #ff002b 50%, rgba(255, 0, 43, 0.2) 80%, transparent 100%);
  box-shadow: 0 0 15px #ff002b, 0 0 30px rgba(255, 0, 43, 0.5);
  animation: sentinel-laser-sweep 8s ease-in-out infinite alternate;
  opacity: 0.45;
}

@keyframes sentinel-laser-sweep {
  0% { transform: translateY(-5vh); opacity: 0; }
  10% { opacity: 0.5; }
  50% { opacity: 0.7; }
  90% { opacity: 0.5; }
  100% { transform: translateY(105vh); opacity: 0; }
}

.crt-distortion {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.9);
}

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 55%, rgba(0, 6, 2, 0.9) 100%);
}

/* -------------------------------------------------------------
   SENTINEL COMPOUND OCULAR SENSORY ARRAYS (3D OPTICAL LENSES)
   ------------------------------------------------------------- */
.sens-eye {
  display: inline-block;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #ff2255 35%, #990018 70%, #330006 100%);
  box-shadow: 0 0 6px var(--sentinel-red), inset 0 0 2px #fff;
  flex-shrink: 0;
}

.sens-eye.micro { width: 5px; height: 5px; }
.sens-eye.sm { width: 8px; height: 8px; }
.sens-eye.mini { width: 9px; height: 9px; }
.sens-eye.mid { width: 12px; height: 12px; }
.sens-eye.main { width: 15px; height: 15px; }
.sens-eye.primary { width: 18px; height: 18px; }
.sens-eye.primary-core {
  width: 20px;
  height: 20px;
  box-shadow: 0 0 16px var(--sentinel-red), 0 0 28px var(--sentinel-ruby), inset 0 0 5px #fff;
  animation: eye-throb-core 1.8s ease-in-out infinite alternate;
}

.sens-eye.red-active {
  animation: eye-throb-core 2s ease-in-out infinite alternate;
}
.sens-eye.pulse {
  animation: eye-throb-core 1.4s ease-in-out infinite alternate;
}

@keyframes eye-throb-core {
  0% {
    transform: scale(0.92);
    box-shadow: 0 0 8px var(--sentinel-red), 0 0 14px var(--sentinel-darkred);
    filter: brightness(0.9);
  }
  100% {
    transform: scale(1.1);
    box-shadow: 0 0 18px var(--sentinel-red), 0 0 32px var(--sentinel-ruby), inset 0 0 4px #ffffff;
    filter: brightness(1.25);
  }
}

/* -------------------------------------------------------------
   SENTINEL CEPHALOTHORAX CARAPACE & HEAD POD
   ------------------------------------------------------------- */
.sentinel-cephalothorax-pod {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  margin-bottom: 1.5rem;
}

.sentinel-compound-eyes {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: radial-gradient(ellipse at center, #0d2611 0%, #030a04 70%, #000 100%);
  border: 1px solid var(--metal-edge);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(0, 255, 65, 0.3), 0 0 20px rgba(0, 0, 0, 0.9);
}

.sentinel-main-header {
  position: relative;
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.title-brand {
  position: relative;
  display: inline-block;
  font-family: "Matrix", "Orbitron", "Teko", "Share Tech Mono", monospace, sans-serif;
  font-size: clamp(2.2rem, 6.8vw, 4rem);
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1.05;
  color: #00ff41;
  -webkit-text-stroke: 1.8px #00ff41;
  background: linear-gradient(180deg, #ffffff 0%, #a3ffa3 25%, #00ff41 60%, #006615 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 #001f05)
          drop-shadow(0 0 10px rgba(0, 255, 65, 0.75))
          drop-shadow(0 0 25px rgba(0, 255, 65, 0.4));
  margin: 0;
  user-select: none;
  transform: translateZ(0) scaleY(1.08);
  transform-origin: left center;
}

.title-brand::before,
.title-brand::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  -webkit-text-stroke: inherit;
  opacity: 0;
  pointer-events: none;
}

.title-brand.glitching {
  animation: angular-glitch-shake 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.title-brand.glitching::before {
  opacity: 1;
  left: -4px;
  text-shadow: -3px 0 #00f0ff;
  background: linear-gradient(180deg, #ffffff 0%, #00f0ff 70%, #005577 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  clip-path: polygon(0 15%, 100% 15%, 100% 45%, 0 45%);
  animation: angular-glitch-slice-1 0.22s steps(2, start) forwards;
}

.title-brand.glitching::after {
  opacity: 1;
  left: 4px;
  text-shadow: 3px 0 #00ff41;
  background: linear-gradient(180deg, #ffffff 0%, #00ff41 70%, #00881b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  clip-path: polygon(0 55%, 100% 55%, 100% 85%, 0 85%);
  animation: angular-glitch-slice-2 0.22s steps(2, start) forwards;
}

@keyframes angular-glitch-shake {
  0% { transform: translate(0, 0) skew(0deg); }
  20% { transform: translate(-5px, 2px) skew(-3deg); }
  40% { transform: translate(5px, -2px) skew(3deg); filter: brightness(1.6) drop-shadow(0 0 25px #00ff41); }
  60% { transform: translate(-3px, -1px) skew(-1.5deg); }
  80% { transform: translate(3px, 2px) skew(1.5deg); }
  100% { transform: translate(0, 0) skew(0deg); }
}

@keyframes angular-glitch-slice-1 {
  0% { clip-path: polygon(0 10%, 100% 10%, 100% 35%, 0 35%); transform: translate(-5px, 1px); }
  50% { clip-path: polygon(0 40%, 100% 40%, 100% 70%, 0 70%); transform: translate(4px, -2px); }
  100% { clip-path: polygon(0 5%, 100% 5%, 100% 30%, 0 30%); transform: translate(0, 0); }
}

@keyframes angular-glitch-slice-2 {
  0% { clip-path: polygon(0 60%, 100% 60%, 100% 90%, 0 90%); transform: translate(5px, -1px); }
  50% { clip-path: polygon(0 20%, 100% 20%, 100% 50%, 0 50%); transform: translate(-4px, 2px); }
  100% { clip-path: polygon(0 70%, 100% 70%, 100% 95%, 0 95%); transform: translate(0, 0); }
}

.sentinel-main-header .kicker {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.sentinel-main-header .lede {
  max-width: 38rem;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.95rem;
  margin: 0;
}

.cephalothorax-carapace {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #0f2b14 0%, #061509 50%, #020703 100%);
  border: 1px solid var(--metal-edge);
  border-radius: 4px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow:
    inset 0 1px 0 rgba(0, 255, 65, 0.4),
    inset 0 0 25px rgba(0, 0, 0, 0.9),
    0 8px 24px rgba(0, 0, 0, 0.8),
    0 0 15px rgba(0, 255, 65, 0.08);
}

.carapace-top-spine {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.spine-segment {
  width: 14px;
  height: 6px;
  background: #194620;
  border: 1px solid var(--metal-edge);
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(0, 255, 65, 0.2);
}

.sentinel-ocular-array {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.eye-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tentacle-bundle-flanks {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tentacle-bundle-flanks.left { left: 12px; }
.tentacle-bundle-flanks.right { right: 12px; }

.tentacle-strand {
  width: 24px;
  height: 3px;
  background: repeating-linear-gradient(90deg, #133918 0, #133918 3px, #000 3px, #000 6px);
  border-radius: 2px;
}

/* -------------------------------------------------------------
   AUTHENTIC DIGITAL SIGNAL GLITCH-IN INTRO
   ------------------------------------------------------------- */
.intro-glitch {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.28s cubic-bezier(0.8, 0, 0.2, 1), visibility 0.28s;
  overflow: hidden;
}

.intro-glitch.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.glitch-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 255, 65, 0.08) 50%, rgba(0, 0, 0, 0.7) 50%),
    radial-gradient(circle at center, rgba(0, 255, 65, 0.25) 0%, rgba(0, 10, 2, 0.8) 60%, #000 90%);
  background-size: 100% 4px, 100% 100%;
  animation: crt-roll 6s linear infinite, backdrop-strobe 1.1s ease-out forwards;
}

@keyframes backdrop-strobe {
  0% { opacity: 0; }
  10% { opacity: 1; filter: brightness(2.5) contrast(1.8); }
  25% { opacity: 0.3; }
  40% { opacity: 0.9; }
  60% { opacity: 0.5; }
  75% { opacity: 1; filter: brightness(1.5); }
  100% { opacity: 1; filter: brightness(1); }
}

@keyframes crt-roll {
  0% { background-position: 0 0, center; }
  100% { background-position: 0 100vh, center; }
}

.glitch-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem;
  max-width: 95vw;
}

.glitch-title {
  font-family: "Matrix", "Orbitron", "Teko", "Share Tech Mono", monospace, sans-serif;
  font-size: clamp(2.2rem, 7vw, 4.4rem);
  font-weight: 900;
  color: #00ff41;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  -webkit-text-stroke: 1.2px #00cc33;
  text-shadow:
    0 0 10px rgba(0, 255, 65, 0.6),
    0 0 20px rgba(0, 255, 65, 0.3);
  animation: glitch-materialize 0.75s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
  transform-origin: center center;
}

.glitch-text-wrap {
  position: relative;
  display: inline-block;
}

.glitch-text-wrap::before,
.glitch-text-wrap::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  -webkit-text-stroke: inherit;
  pointer-events: none;
}

/* Red / Magenta Chromatic Channel Glitch-In (Fast & continuous) */
.glitch-text-wrap::before {
  color: rgba(255, 0, 80, 0.85);
  text-shadow: -2px 0 rgba(255, 0, 80, 0.6);
  animation: digital-rgb-r-in 0.75s steps(1) forwards;
  mix-blend-mode: screen;
}

/* Cyan / Blue Chromatic Channel Glitch-In (Fast & continuous) */
.glitch-text-wrap::after {
  color: rgba(0, 230, 255, 0.85);
  text-shadow: 2px 0 rgba(0, 230, 255, 0.6);
  animation: digital-rgb-b-in 0.75s steps(1) forwards;
  mix-blend-mode: screen;
}

@keyframes glitch-materialize {
  0% {
    opacity: 0;
    transform: scale(1.04) scaleY(1.08) translate(-4px, 1px) skewX(-2deg);
  }
  15% {
    opacity: 0.9;
    transform: scale(1.02) scaleY(1.04) translate(3px, -1px) skewX(1.5deg);
  }
  30% {
    opacity: 0.6;
    transform: scale(0.99) scaleY(1.06) translate(-2px, 0);
  }
  45% {
    opacity: 1;
    transform: scale(1.01) scaleY(1.02) translate(2px, -1px);
  }
  60% {
    opacity: 0.85;
    transform: scale(1) scaleY(1.03) translate(-1px, 0);
  }
  75% {
    opacity: 1;
    transform: scale(1.01) scaleY(1.01) translate(1px, 0);
  }
  90% {
    opacity: 0.95;
    transform: scale(1) scaleY(1.01);
  }
  100% {
    opacity: 1;
    transform: scale(1) scaleY(1) translate(0, 0);
  }
}

@keyframes digital-rgb-r-in {
  0% { opacity: 0; }
  12% { opacity: 0.8; clip-path: inset(12% 0 68% 0); transform: translate(-4px, 1px); }
  25% { opacity: 0.4; clip-path: inset(48% 0 32% 0); transform: translate(3px, -1px); }
  40% { opacity: 0.85; clip-path: inset(72% 0 12% 0); transform: translate(-4px, 0); }
  55% { opacity: 0.5; clip-path: inset(22% 0 58% 0); transform: translate(-3px, 1px); }
  70% { opacity: 0.7; clip-path: inset(58% 0 28% 0); transform: translate(2px, 0); }
  85% { opacity: 0.3; clip-path: inset(80% 0 8% 0); transform: translate(-1px, 0); }
  100% { opacity: 0; transform: translate(0, 0); }
}

@keyframes digital-rgb-b-in {
  0% { opacity: 0; }
  15% { opacity: 0.8; clip-path: inset(58% 0 22% 0); transform: translate(4px, -1px); }
  28% { opacity: 0.4; clip-path: inset(18% 0 62% 0); transform: translate(-3px, 1px); }
  42% { opacity: 0.85; clip-path: inset(32% 0 48% 0); transform: translate(4px, 0); }
  58% { opacity: 0.5; clip-path: inset(68% 0 16% 0); transform: translate(3px, -1px); }
  72% { opacity: 0.7; clip-path: inset(12% 0 72% 0); transform: translate(-2px, 0); }
  88% { opacity: 0.3; clip-path: inset(88% 0 4% 0); transform: translate(1px, 0); }
  100% { opacity: 0; transform: translate(0, 0); }
}

/* -------------------------------------------------------------
   TOPBAR & STATUS
   ------------------------------------------------------------- */
#setup {
  position: relative;
  z-index: 10;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem 0;
  position: relative;
  z-index: 10;
  max-width: 50rem;
  margin: 0 auto;
}

.sentinel-link-node {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.15em;
}

.sensor-pod-micro {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar button.link {
  background: rgba(4, 16, 7, 0.7);
  border: 1px solid var(--border);
  color: var(--accent);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: all 0.2s;
}

.topbar button.link:hover {
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: 0 0 14px var(--accent);
}

.wrap {
  max-width: 48rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 9rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.kicker {
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.neon {
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.55), 0 0 24px rgba(56, 255, 20, 0.25);
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.1;
  text-transform: uppercase;
}

.lede {
  max-width: 34rem;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.95rem;
  margin: 0.6rem 0 0;
}

/* -------------------------------------------------------------
   BIO-MECHANICAL SENTINEL WINDOWS (CHITIN PLATING & SPINES)
   ------------------------------------------------------------- */
.panel.sentinel-window {
  position: relative;
  background:
    linear-gradient(135deg, rgba(14, 34, 18, 0.92) 0%, rgba(5, 16, 8, 0.96) 50%, rgba(7, 22, 11, 0.94) 100%);
  border: 1px solid #16401c;
  padding: 1.4rem 1.6rem;
  border-radius: 3px;
  box-shadow:
    inset 0 1px 0 rgba(0, 255, 65, 0.3),
    inset 0 0 35px rgba(0, 0, 0, 0.9),
    0 8px 32px rgba(0, 0, 0, 0.8),
    0 0 16px rgba(0, 255, 65, 0.04);
  backdrop-filter: blur(8px);
}

/* Articulated claw brackets at window corners */
.sentinel-chitin-bracket {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  pointer-events: none;
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.5);
}

.sentinel-chitin-bracket.tl {
  top: -2px;
  left: -2px;
  border-right: 0;
  border-bottom: 0;
}
.sentinel-chitin-bracket.tr {
  top: -2px;
  right: -2px;
  border-left: 0;
  border-bottom: 0;
}
.sentinel-chitin-bracket.bl {
  bottom: -2px;
  left: -2px;
  border-right: 0;
  border-top: 0;
}
.sentinel-chitin-bracket.br {
  bottom: -2px;
  right: -2px;
  border-left: 0;
  border-top: 0;
}

/* Segmented spinal vertebrae along the flanks of each window */
.sentinel-rib-spine {
  position: absolute;
  top: 14px;
  bottom: 14px;
  width: 4px;
  background: repeating-linear-gradient(
    to bottom,
    #1d5424 0,
    #1d5424 5px,
    #000000 5px,
    #000000 10px
  );
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(0, 255, 65, 0.15);
}
.sentinel-rib-spine.left { left: 4px; }
.sentinel-rib-spine.right { right: 4px; }

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  border-bottom: 1px solid rgba(0, 255, 65, 0.15);
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
}

.panel-sensor-tag {
  display: flex;
  align-items: center;
  gap: 8px;
}

.idx {
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #7cff7c;
  margin: 0;
}

.panel h2 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.3rem;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.35);
}

.hint {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.count {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: bold;
  padding: 0.2rem 0.55rem;
  background: rgba(0, 255, 65, 0.08);
  border: 1px solid var(--border);
  letter-spacing: 0.08em;
}

/* -------------------------------------------------------------
   FORM FIELDS & BUTTONS
   ------------------------------------------------------------- */
.field.bio-field {
  margin-top: 0.5rem;
  height: 2.85rem;
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(2, 10, 4, 0.88);
  padding: 0 0.85rem;
  font: inherit;
  font-size: 0.88rem;
  color: var(--fg);
  outline: none;
  border-radius: 2px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7);
  transition: all 0.2s ease;
}

.field.bio-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.3), inset 0 2px 6px rgba(0, 0, 0, 0.7);
}

label.block {
  display: block;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
  font: inherit;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: bold;
  border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 0 16px rgba(0, 255, 65, 0.35);
  transition: all 0.15s ease;
}

.btn.outline {
  background: rgba(1, 16, 5, 0.55);
  color: var(--fg);
  box-shadow: 0 0 10px rgba(0, 255, 65, 0.15);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--accent);
  box-shadow: none;
}

.btn.sm {
  min-height: 2.25rem;
  padding: 0 0.85rem;
  font-size: 0.75rem;
}

.btn.icon {
  width: 2.75rem;
  padding: 0;
  font-size: 1.1rem;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.15);
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.5);
}

.drop {
  margin-top: 1rem;
  min-height: 5.5rem;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px dashed #1b4b20;
  background: rgba(3, 14, 5, 0.7);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.25rem;
  border-radius: 2px;
  transition: all 0.2s;
}

.drop:hover {
  border-color: var(--accent);
  background: rgba(0, 255, 65, 0.06);
  color: #fff;
}

.preview {
  margin-top: 1rem;
  border: 1px solid var(--border);
  background: #000;
  padding: 0.5rem;
}
.preview video {
  width: 100%;
  max-height: 10rem;
  object-fit: contain;
  display: block;
}

.fname {
  margin: 0.4rem 0 0;
  font-size: 0.72rem;
  color: var(--subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slider {
  margin-top: 1.1rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: block;
}
.slider span {
  display: flex;
  justify-content: space-between;
}
.slider span b {
  color: var(--accent);
}
.slider input,
.slider input[type="range"] {
  width: 100%;
  margin-top: 0.55rem;
  height: 22px;
  appearance: none;
  -webkit-appearance: none;
  color-scheme: light;
  background: #d7ffe3;
  border: 2px solid #39ff6a;
  border-radius: 999px;
  cursor: pointer;
  accent-color: #00c853;
}
.slider input::-webkit-slider-runnable-track {
  height: 18px;
  border-radius: 999px;
  background: #d7ffe3;
  border: 0;
}
.slider input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -4px;
  border-radius: 50%;
  background: #06210c;
  border: 3px solid #00ff41;
  box-shadow: 0 0 0 2px #fff, 0 0 12px #39ff6a;
}
.slider input::-moz-range-track {
  height: 18px;
  border-radius: 999px;
  background: #d7ffe3;
  border: 0;
}
.slider input::-moz-range-progress {
  height: 18px;
  border-radius: 999px;
  background: #39ff6a;
}
.slider input::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: #06210c;
  border: 3px solid #00ff41;
}

/* -------------------------------------------------------------
   PACES & SPEED SELECTION
   ------------------------------------------------------------- */
.paces {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
  margin-top: 1rem;
}
@media (min-width: 640px) {
  .paces {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 780px) {
  .paces {
    grid-template-columns: repeat(6, 1fr);
  }
}

.pace {
  border: 1px solid var(--border);
  background: rgba(2, 10, 4, 0.85);
  color: var(--fg);
  text-align: left;
  padding: 0.85rem 0.75rem;
  font: inherit;
  border-radius: 2px;
  transition: all 0.15s;
}

.pace strong {
  display: block;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.pace em {
  font-style: normal;
  font-size: 0.7rem;
  color: var(--subtle);
  display: block;
  margin-top: 0.2rem;
}

.pace.on {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: 0 0 16px rgba(0, 255, 65, 0.4);
}

.pace.on em {
  color: rgba(2, 16, 3, 0.8);
}

.pace-controls-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  margin-top: 1rem;
}

.check input {
  accent-color: var(--accent);
  width: 1rem;
  height: 1rem;
}

/* -------------------------------------------------------------
   ALBUMS & THUMBS
   ------------------------------------------------------------- */
.albums {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.albums li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border);
  background: rgba(2, 10, 4, 0.8);
  padding: 0.6rem 0.85rem;
  border-radius: 2px;
}

.albums p {
  margin: 0;
}

.albums small {
  color: var(--subtle);
  font-size: 0.7rem;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}
@media (min-width: 640px) {
  .thumbs {
    grid-template-columns: repeat(5, 1fr);
  }
}

.thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--chitin-panel);
}

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

.thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--border);
  color: var(--fg);
  width: 1.4rem;
  height: 1.4rem;
  display: grid;
  place-items: center;
}

.status {
  color: #b8ff00;
  font-size: 0.85rem;
  margin: 0;
}

/* -------------------------------------------------------------
   SENTINEL DOCK
   ------------------------------------------------------------- */
.dock.sentinel-dock {
  position: fixed;
  inset: auto 0 0;
  z-index: 50;
  border-top: 1px solid #1a4921;
  background: rgba(2, 10, 4, 0.92);
  backdrop-filter: blur(12px);
  padding: 1rem 1.5rem;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(0, 255, 65, 0.25);
}

.dock-inner {
  max-width: 48rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.dock-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dock p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.dock-play {
  min-height: 2.9rem;
  padding: 0 1.6rem;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  font-weight: 800;
}

/* -------------------------------------------------------------
   FULLSCREEN PLAYER
   ------------------------------------------------------------- */
#player {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  overflow: hidden;
  z-index: 200;
  --fade-ms: 200ms;
  isolation: isolate;
  contain: layout paint style;
}

#player.on {
  display: block;
}

#setup.hid {
  display: none;
}

#still {
  pointer-events: none;
  width: 100%;
  height: 100dvh;
  object-fit: contain;
  display: block;
  user-select: none;
}

#overlay-vid {
  pointer-events: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100dvh;
  object-fit: cover;
  z-index: 20;
  will-change: opacity;
}

#record-canvas {
  position: fixed;
  width: 2px;
  height: 2px;
  right: 0;
  bottom: 0;
  opacity: 0.01;
  pointer-events: none;
}

.shade {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(1, 8, 3, 0.75) 0%,
    transparent 28%,
    transparent 72%,
    rgba(1, 8, 3, 0.82) 100%
  );
  z-index: 220;
}

.phud {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.25rem 1.25rem 0;
  padding-top: max(1.25rem, env(safe-area-inset-top));
  z-index: 230;
}

.phud-meta-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sentinel-compound-mini {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 0.25rem;
}

.phud p {
  margin: 0;
}

.pctl {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  justify-content: center;
  gap: 0.85rem;
  padding: 0 1rem max(1.5rem, env(safe-area-inset-bottom));
  z-index: 230;
}

#sc-frame {
  position: absolute;
  right: 1rem;
  bottom: 6.5rem;
  width: min(calc(100% - 2rem), 22rem);
  height: 5.5rem;
  border: 1px solid var(--border);
  background: rgba(1, 10, 3, 0.88);
  z-index: 230;
}

.fade {
  transition: opacity 0.2s ease;
}
.fade.off {
  opacity: 0;
  pointer-events: none;
}

/* -------------------------------------------------------------
   INSTALL PWA SHEET
   ------------------------------------------------------------- */
.sheet-bg {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.8);
  display: grid;
  place-items: end;
  padding: 1rem;
  backdrop-filter: blur(8px);
}
@media (min-width: 640px) {
  .sheet-bg {
    place-items: center;
  }
}

.sheet {
  width: 100%;
  max-width: 28rem;
}

.sheet ol {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  line-height: 1.45;
}

.sheet ol li strong {
  display: block;
  color: var(--text, #e8ffe9);
  font-size: 0.92rem;
  margin-bottom: 0.2rem;
}

.hid {
  display: none !important;
}
.privacy-line {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  max-width: 38rem;
  line-height: 1.45;
}

.brand-sub {
  margin: 0.45rem 0 0;
  font-size: clamp(0.85rem, 2.4vw, 1.15rem);
  letter-spacing: 0.22em;
  text-transform: lowercase;
  color: #7cff9a;
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.topbar a.link {
  text-decoration: none;
}

.mark-legend {
  font-size: 0.7rem;
  color: var(--subtle);
  align-self: center;
  letter-spacing: 0.06em;
}

.icon-mark {
  font-size: 1rem;
  min-width: 2.5rem;
}

.track-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 10rem;
  overflow: auto;
}

.track-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  background: rgba(2, 10, 4, 0.8);
  padding: 0.4rem 0.65rem;
  font-size: 0.78rem;
}

.track-list li.on {
  border-color: var(--accent);
  color: var(--accent);
}

.track-list .t-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tts-text {
  height: auto;
  min-height: 6rem;
  padding: 0.7rem 0.85rem;
  resize: vertical;
  line-height: 1.4;
}

.dock-actions {
  display: flex;
  gap: 0.55rem;
  align-items: center;
}

.rec-btn {
  color: #ff5a6a !important;
  border-color: #ff5a6a !important;
}

.rec-btn.live {
  background: #ff002b !important;
  color: #fff !important;
  animation: rec-pulse 1.1s ease-in-out infinite;
}

@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 0, 43, 0.55); }
  50% { box-shadow: 0 0 0 8px rgba(255, 0, 43, 0); }
}

.rec-dot {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  right: 4.5rem;
  z-index: 240;
  color: #ff2040;
  font-size: 1.1rem;
  text-shadow: 0 0 12px #ff002b;
  pointer-events: none;
}

.pace-controls-row .check {
  margin-top: 0;
}

.slide-still,
.slide-vid {
  pointer-events: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100dvh;
  object-fit: contain;
  display: block;
  user-select: none;
  opacity: 0;
  will-change: opacity, transform;
  z-index: 10;
  transition: opacity var(--fade-ms, 0ms) ease;
  backface-visibility: hidden;
}

#skip-video-btn {
  min-width: auto;
  padding: 0.45rem 0.7rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.slide-still.on,
.slide-vid.on {
  opacity: 1;
}

.ghost-still {
  width: 1px;
  height: 1px;
  opacity: 0 !important;
  pointer-events: none;
}

.thumb.vid {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 1.4rem;
  letter-spacing: 0;
}

.thumb.vid .vid-badge {
  font-size: 0.65rem;
  position: absolute;
  left: 4px;
  bottom: 4px;
  background: rgba(0,0,0,0.75);
  padding: 0.1rem 0.3rem;
}

.pctl {
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: stretch;
  padding-inline: clamp(0.75rem, 2vw, 1.25rem);
}

.pctl-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.35rem;
  border: 1px solid rgba(57, 255, 106, 0.22);
  border-radius: 0.55rem;
  background: rgba(0, 10, 3, 0.72);
  backdrop-filter: blur(8px);
}

.pctl .btn.sm {
  min-height: 2.3rem;
  padding: 0.42rem 0.68rem;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.pctl-transport {
  margin-right: auto;
}

.pctl-options {
  justify-content: flex-end;
}

.video-audio-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.55rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid rgba(57, 255, 106, 0.34);
  background: rgba(1, 12, 4, 0.88);
  box-shadow: inset 0 0 18px rgba(0, 255, 65, 0.06);
}

.video-volume {
  display: grid;
  grid-template-columns: auto minmax(5.5rem, 9rem) 3.2rem;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.video-volume input[type="range"] {
  width: 100%;
  min-height: 1.4rem;
  accent-color: var(--accent);
}

.video-volume output {
  color: var(--text, #e8ffe9);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

#tts-engine-status {
  font-size: 0.78rem;
  opacity: 0.75;
  margin: 0.35rem 0 0.6rem;
}

@media (max-width: 640px) {
  .mark-legend { display: none; }
  .pctl {
    gap: 0.35rem;
    padding-inline: 0.5rem;
  }
  .pctl-group {
    width: 100%;
    justify-content: center;
  }
  .pctl-transport {
    margin-right: 0;
  }
  .pctl-options {
    order: 3;
  }
  .video-audio-controls {
    order: 10;
    width: min(100%, 22rem);
  }
  .video-volume {
    flex: 1;
    grid-template-columns: auto minmax(4rem, 1fr) 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sentinel-scanner-laser,
  .slide-still.pan-1,
  .slide-still.pan-2,
  .slide-still.pan-3,
  .slide-still.pan-4 {
    animation: none !important;
  }
}

#icon-review {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.icon-review-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 520px;
  width: 100%;
}
.icon-review-card img {
  width: min(72vw, 420px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 22%;
  display: block;
}
.icon-review-kicker {
  margin: 0;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  color: #9dffb8;
}
#update-dl {
  position: sticky;
  top: 0;
  z-index: 10000;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1rem;
  background: #050505;
  border-bottom: 1px solid #39ff6a;
}
#update-dl p {
  width: 100%;
  margin: 0;
  text-align: center;
  color: #c8ffd4;
}
#update-dl .btn {
  text-decoration: none;
}

/* --- iOS app-like layout --- */
body.layout-ios .hide-ios {
  display: none !important;
}
body.layout-ios {
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body.layout-ios #setup {
  padding: 0.85rem 0.85rem calc(6.5rem + env(safe-area-inset-bottom, 0px));
  max-width: 560px;
  margin: 0 auto;
}
body.layout-ios .panel {
  border-radius: 1.1rem;
  margin-bottom: 0.85rem;
  padding: 1rem 1rem 1.1rem;
}
body.layout-ios .panel-head h2 {
  font-size: 1.05rem;
}
body.layout-ios .btn {
  min-height: 44px;
  border-radius: 0.75rem;
  font-size: 0.92rem;
}
body.layout-ios .row {
  gap: 0.55rem;
}
body.layout-ios .row .btn {
  flex: 1 1 auto;
}
body.layout-ios .drop {
  min-height: 5.5rem;
  border-radius: 0.9rem;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1rem;
}
body.layout-ios .drop.drag {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
body.layout-ios .dock {
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
}
body.layout-ios .dock-inner {
  border-radius: 1.25rem;
  max-width: 560px;
  margin: 0 auto;
}
body.layout-ios .dock-play {
  min-height: 48px;
  border-radius: 999px;
  flex: 1;
}
body.layout-ios .paces {
  grid-template-columns: 1fr 1fr;
}
body.layout-ios .slider input[type="range"] {
  min-height: 28px;
}
body.layout-ios .title-brand,
body.layout-ios .glitch-title {
  font-size: clamp(1.6rem, 8vw, 2.4rem);
}
body.layout-ios #brand-title,
body.layout-ios .brand-lockup {
  padding-inline: 0.5rem;
}
.drop.drag {
  border-color: var(--accent, #00ff41);
  background: rgba(0, 255, 65, 0.06);
}

#player {
  overflow: hidden;
}
.slide-still.pan-1,
.slide-still.pan-2,
.slide-still.pan-3,
.slide-still.pan-4 {
  animation-timing-function: ease-in-out;
  animation-fill-mode: both;
  animation-duration: 14s;
}
.slide-still.pan-1 { animation-name: pan-zoom-1; }
.slide-still.pan-2 { animation-name: pan-zoom-2; }
.slide-still.pan-3 { animation-name: pan-zoom-3; }
.slide-still.pan-4 { animation-name: pan-zoom-4; }
@keyframes pan-zoom-1 {
  from { transform: scale(1.05) translate(0, 0); }
  to { transform: scale(1.18) translate(-3%, -2%); }
}
@keyframes pan-zoom-2 {
  from { transform: scale(1.16) translate(2%, -2%); }
  to { transform: scale(1.05) translate(-2%, 2%); }
}
@keyframes pan-zoom-3 {
  from { transform: scale(1.06) translate(-2%, 2%); }
  to { transform: scale(1.2) translate(3%, -1%); }
}
@keyframes pan-zoom-4 {
  from { transform: scale(1.14) translate(0, 2%); }
  to { transform: scale(1.05) translate(0, -2%); }
}

/* ================================================== LIVE UPDATE TOAST ==
   Shown when an already-open instance swaps itself to a new build. */

#live-update-toast {
  position: fixed;
  left: 50%;
  bottom: calc(7.5rem + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 12px);
  z-index: 10000;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(2, 12, 5, 0.94);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8);
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#live-update-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  #live-update-toast {
    transition: none;
  }
}
