:root {
  --bg: #090f15;
  --panel: rgba(7, 11, 17, 0.66);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #f6f4ef;
  --muted: rgba(246, 244, 239, 0.72);
  --accent: #88d7ff;
  --accent-2: #ffd68a;
  --accent-3: #d9b9ff;
  --success: #9af4c5;
  --danger: #ffb0a7;
  --shadow: rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  height: 100%;
  background: radial-gradient(circle at top, #1a2330 0%, #090f15 60%, #05070b 100%);
  color: var(--text);
  font-family: "SF Pro Text", "Avenir Next", "Helvetica Neue", sans-serif;
  overflow: hidden;
}

body {
  overscroll-behavior: none;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #000;
  isolation: isolate;
}

#camera,
#fx,
.ambient-glow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#camera {
  object-fit: cover;
  background:
    radial-gradient(circle at 35% 18%, rgba(132, 194, 255, 0.12), transparent 32%),
    linear-gradient(180deg, #18212b 0%, #0d141b 42%, #090f15 100%);
}

#fx {
  pointer-events: none;
}

.ambient-glow {
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 221, 149, 0.1), transparent 30%),
    radial-gradient(circle at 80% 25%, rgba(125, 182, 255, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(5, 10, 18, 0.1), rgba(5, 10, 18, 0.35));
  z-index: 1;
}

.topbar,
.flight-card,
.bottom-panel,
.toast,
.result-card,
#captureCluster {
  z-index: 12;
}

.topbar {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.status-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.brand-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand,
.status,
.flight-card,
.bottom-panel,
.result-card,
.toast {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.brand-subtitle {
  padding-left: 4px;
  font-size: 12px;
  color: var(--muted);
}

.status {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--muted);
  text-align: right;
}

.build-stamp {
  padding-right: 4px;
  font-size: 11px;
  line-height: 1.2;
  color: rgba(246, 244, 239, 0.48);
  text-align: right;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.observe-debug {
  position: absolute;
  top: max(204px, calc(env(safe-area-inset-top) + 188px));
  right: 14px;
  width: min(320px, calc(100vw - 28px));
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid rgba(136, 215, 255, 0.18);
  background: rgba(7, 11, 17, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.26);
  pointer-events: none;
  z-index: 13;
}

.observe-debug.is-alert {
  border-color: rgba(255, 149, 126, 0.4);
  box-shadow: 0 14px 34px rgba(255, 122, 92, 0.12);
}

.observe-debug-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(246, 244, 239, 0.6);
}

.observe-debug-content {
  margin: 8px 0 0;
  white-space: pre-wrap;
  font-family: "SF Mono", "Menlo", "Monaco", monospace;
  font-size: 11px;
  line-height: 1.45;
  color: rgba(246, 244, 239, 0.9);
}

.observe-debug-hint {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(154, 244, 197, 0.94);
}

.flight-card {
  position: absolute;
  top: max(94px, calc(env(safe-area-inset-top) + 78px));
  left: 14px;
  width: min(280px, calc(100vw - 28px));
  border-radius: 22px;
  padding: 16px 18px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(246, 244, 239, 0.52);
}

.specimen-name {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}

.specimen-meta {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}

#butterfly {
  --size: 112px;
  --dir-x: 1;
  --flight-tilt: 0deg;
  --bank-angle: 0deg;
  --figure-lift: 0px;
  --wing-a: #fff4b3;
  --wing-b: #f3a55d;
  --wing-c: #7ac7ff;
  --wing-d: #695ee6;
  --body-color: #37293d;
  --body-tilt: 0deg;
  --body-yaw: 0deg;
  --body-bob: 0px;
  --body-jitter-x: 0px;
  --body-jitter-y: 0px;
  --body-scale-base: 1;
  --front-origin-left-x: 84%;
  --front-origin-right-x: 16%;
  --front-origin-y: 48%;
  --back-origin-left-x: 82%;
  --back-origin-right-x: 18%;
  --back-origin-y: 44%;
  --wing-front-left-angle: 20deg;
  --wing-front-right-angle: -20deg;
  --wing-back-left-angle: 16deg;
  --wing-back-right-angle: -16deg;
  --wing-front-left-scale: 1;
  --wing-front-right-scale: 1;
  --wing-back-left-scale: 1;
  --wing-back-right-scale: 1;
  --shadow-scale: 1;
  --shadow-opacity: 0.36;
  position: absolute;
  left: 50%;
  top: 34%;
  width: var(--size);
  height: var(--size);
  transform: translate(-50%, -50%) rotate(var(--flight-tilt));
  pointer-events: none;
  z-index: 10;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.38));
  will-change: transform, opacity;
}

.butterfly-shadow {
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 50%;
  height: 14px;
  transform: translateX(-50%) scale(var(--shadow-scale));
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  filter: blur(10px);
  opacity: var(--shadow-opacity);
  will-change: transform, opacity;
}

.butterfly-figure {
  position: absolute;
  inset: 0;
  transform: translateY(var(--figure-lift)) scaleX(var(--dir-x)) rotate(var(--bank-angle));
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}

.butterfly-sprite {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.butterfly-rig {
  position: absolute;
  inset: 0;
}

.butterfly-part {
  position: absolute;
  overflow: hidden;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  will-change: transform, opacity;
}

.butterfly-part-image {
  position: absolute;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.part-body {
  z-index: 5;
  transform-origin: 50% 32%;
  transform:
    translate3d(var(--body-jitter-x), calc(var(--body-bob) + var(--body-jitter-y)), 0)
    rotate(var(--body-tilt))
    skewX(var(--body-yaw))
    scale(var(--body-scale-base));
}

.part-wing-front-left {
  z-index: 4;
  transform-origin: var(--front-origin-left-x) var(--front-origin-y);
  transform: rotate(var(--wing-front-left-angle)) scaleY(var(--wing-front-left-scale));
}

.part-wing-front-right {
  z-index: 4;
  transform-origin: var(--front-origin-right-x) var(--front-origin-y);
  transform: rotate(var(--wing-front-right-angle)) scaleY(var(--wing-front-right-scale));
}

.part-wing-back-left {
  z-index: 3;
  opacity: 0.82;
  transform-origin: var(--back-origin-left-x) var(--back-origin-y);
  transform: rotate(var(--wing-back-left-angle)) scaleY(var(--wing-back-left-scale));
}

.part-wing-back-right {
  z-index: 3;
  opacity: 0.82;
  transform-origin: var(--back-origin-right-x) var(--back-origin-y);
  transform: rotate(var(--wing-back-right-angle)) scaleY(var(--wing-back-right-scale));
}

.butterfly-art {
  position: absolute;
  inset: 0;
  transform: translateY(2px) rotate(-4deg);
}

.wing {
  position: absolute;
  background:
    radial-gradient(circle at 34% 32%, rgba(255, 255, 255, 0.88), transparent 18%),
    radial-gradient(circle at 55% 52%, var(--wing-a) 0%, var(--wing-b) 30%, var(--wing-c) 62%, var(--wing-d) 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.08);
}

.wing.left {
  transform-origin: 100% 50%;
}

.wing.right {
  transform-origin: 0% 50%;
}

.wing-back {
  top: 16px;
  width: 34%;
  height: 46%;
  opacity: 0.72;
  border-radius: 78% 28% 82% 34% / 68% 34% 78% 42%;
}

.wing-front {
  top: 2px;
  width: 43%;
  height: 58%;
  border-radius: 84% 24% 80% 28% / 76% 34% 82% 36%;
}

.wing-front.left {
  left: 8px;
  animation: flapLeft 0.24s infinite alternate ease-in-out;
}

.wing-back.left {
  left: 18px;
  animation: flapLeftBack 0.26s infinite alternate ease-in-out;
}

.wing-front.right {
  right: 8px;
  animation: flapRight 0.24s infinite alternate ease-in-out;
}

.wing-back.right {
  right: 18px;
  animation: flapRightBack 0.26s infinite alternate ease-in-out;
}

.body {
  position: absolute;
  left: 50%;
  top: 9px;
  width: 12%;
  height: 72%;
  transform: translateX(-50%);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 18%),
    linear-gradient(180deg, #15131b 0%, var(--body-color) 55%, #161417 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 -8px 12px rgba(0, 0, 0, 0.2);
}

.body::before,
.body::after {
  content: "";
  position: absolute;
  top: -8px;
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.46);
  transform-origin: bottom center;
}

.body::before {
  left: 2px;
  transform: rotate(-22deg);
}

.body::after {
  right: 2px;
  transform: rotate(22deg);
}

.capture-cluster {
  --frame-size: 156px;
  --frame-size-compact: 142px;
  position: absolute;
  left: 50%;
  top: 33.5%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.capture-frame {
  position: relative;
  width: var(--frame-size);
  height: var(--frame-size);
  border-radius: 30px;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    0 0 0 8px rgba(255, 255, 255, 0.04),
    0 0 30px rgba(136, 215, 255, 0.14);
  overflow: hidden;
}

.capture-frame::before,
.capture-frame::after,
.capture-frame-core::before,
.capture-frame-core::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  border-color: rgba(136, 215, 255, 0.88);
}

.capture-frame::before {
  left: 10px;
  top: 10px;
  border-left: 4px solid;
  border-top: 4px solid;
  border-top-left-radius: 16px;
}

.capture-frame::after {
  right: 10px;
  top: 10px;
  border-right: 4px solid;
  border-top: 4px solid;
  border-top-right-radius: 16px;
}

.capture-frame-core::before {
  left: 10px;
  bottom: 10px;
  border-left: 4px solid;
  border-bottom: 4px solid;
  border-bottom-left-radius: 16px;
}

.capture-frame-core::after {
  right: 10px;
  bottom: 10px;
  border-right: 4px solid;
  border-bottom: 4px solid;
  border-bottom-right-radius: 16px;
}

.capture-frame-core {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(136, 215, 255, 0.05), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.012));
}

.capture-frame.is-active {
  box-shadow:
    0 0 0 8px rgba(255, 255, 255, 0.04),
    0 0 34px rgba(136, 215, 255, 0.18);
}

.capture-frame.is-ready {
  box-shadow:
    0 0 0 9px rgba(154, 244, 197, 0.08),
    0 0 42px rgba(154, 244, 197, 0.24);
}

.capture-frame.is-ready::before,
.capture-frame.is-ready::after,
.capture-frame.is-ready .capture-frame-core::before,
.capture-frame.is-ready .capture-frame-core::after {
  border-color: rgba(154, 244, 197, 0.96);
}

.capture-cluster.is-passive {
  opacity: 0.6;
}

.timing-hud {
  position: relative;
  width: 132px;
  border-radius: 15px;
  padding: 5px 6px 8px;
  background: rgba(7, 11, 17, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}

.timing-hud.is-shake-active {
  border-color: rgba(136, 215, 255, 0.26);
}

.timing-meta {
  min-height: 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(246, 244, 239, 0.92);
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.timing-bar {
  position: relative;
  margin-top: 4px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
  overflow: visible;
}

.timing-window {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 125, 93, 0.82);
  background: rgba(255, 125, 93, 0.34);
  box-shadow: 0 0 14px rgba(255, 125, 93, 0.14);
}

.timing-cursor {
  position: absolute;
  top: calc(100% + 4px);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 12px solid rgba(79, 178, 255, 0.94);
  transform: translateX(-50%);
  filter: drop-shadow(0 3px 8px rgba(79, 178, 255, 0.24));
}

.timing-hud.is-ready {
  border-color: rgba(154, 244, 197, 0.58);
  background: rgba(19, 41, 33, 0.18);
  box-shadow: 0 8px 18px rgba(154, 244, 197, 0.14);
}

.timing-hud.is-ready .timing-meta {
  color: rgba(154, 244, 197, 0.96);
}

.timing-hud.is-miss {
  border-color: rgba(255, 110, 76, 0.68);
  background: rgba(56, 22, 18, 0.2);
  box-shadow: 0 8px 18px rgba(255, 110, 76, 0.12);
}

.bottom-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  border-radius: 20px;
  padding: 8px;
}

.bottom-panel.is-collapsed {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.bottom-panel-expanded {
  display: grid;
  gap: 8px;
}

.panel-mini {
  display: block;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-caption {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(246, 244, 239, 0.58);
}

.panel-toggle,
.panel-collapse {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.panel-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
}

.panel-mini-label {
  font-size: 13px;
  font-weight: 700;
}

.panel-toggle-hint,
.panel-collapse {
  font-size: 11px;
  color: var(--muted);
}

.panel-collapse {
  padding: 6px 8px;
}

.primary-btn,
.secondary-btn,
.mode-btn {
  appearance: none;
  border: none;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 700;
}

.primary-btn {
  width: 100%;
  background: linear-gradient(120deg, #86dbff 0%, #eac991 100%);
  color: #0d1622;
  box-shadow: 0 10px 28px rgba(134, 219, 255, 0.22);
}

.secondary-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.mode-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.mode-btn.active {
  background: rgba(136, 215, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(136, 215, 255, 0.36);
}

.hint {
  margin-top: 10px;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.38;
}

.toast {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  max-width: calc(100vw - 34px);
  border-radius: 999px;
  padding: 10px 14px;
  text-align: center;
  font-size: 14px;
}

.result-card {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 26px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.result-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(136, 215, 255, 0.14);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.result-title {
  margin-top: 14px;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.05;
}

.result-meta {
  margin-top: 8px;
  color: rgba(246, 244, 239, 0.82);
  font-size: 15px;
}

.result-flavor {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.result-actions {
  margin-top: 18px;
}

.hidden {
  display: none !important;
}

.capture-hit {
  animation: capturePulse 0.2s ease-out forwards;
}

.miss {
  animation: miss 0.3s ease-out;
}

@keyframes flapLeft {
  from {
    transform: rotate(calc(10deg + var(--flap-depth) * 5deg)) scaleY(1);
  }
  to {
    transform: rotate(calc(-28deg - var(--flap-depth) * 11deg)) scaleY(0.9);
  }
}

@keyframes flapRight {
  from {
    transform: rotate(calc(-10deg - var(--flap-depth) * 5deg)) scaleY(1);
  }
  to {
    transform: rotate(calc(28deg + var(--flap-depth) * 11deg)) scaleY(0.9);
  }
}

@keyframes flapLeftBack {
  from {
    transform: rotate(calc(6deg + var(--flap-depth) * 3deg)) scaleY(0.96);
  }
  to {
    transform: rotate(calc(-18deg - var(--flap-depth) * 8deg)) scaleY(0.88);
  }
}

@keyframes flapRightBack {
  from {
    transform: rotate(calc(-6deg - var(--flap-depth) * 3deg)) scaleY(0.96);
  }
  to {
    transform: rotate(calc(18deg + var(--flap-depth) * 8deg)) scaleY(0.88);
  }
}

@keyframes spriteFloat {
  from {
    transform: translateY(-1px) scale(1);
  }
  to {
    transform: translateY(2px) scale(0.98);
  }
}

@keyframes capturePulse {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--flight-tilt)) scale(1);
  }
  55% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--flight-tilt)) scale(1.14);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--flight-tilt)) scale(0.42);
  }
}

@keyframes miss {
  0%,
  100% {
    transform: translate(-50%, -50%) rotate(var(--flight-tilt));
  }
  25% {
    transform: translate(calc(-50% - 8px), -50%) rotate(calc(var(--flight-tilt) - 3deg));
  }
  75% {
    transform: translate(calc(-50% + 8px), -50%) rotate(calc(var(--flight-tilt) + 3deg));
  }
}

@media (max-width: 380px) {
  .brand-subtitle,
  .hint {
    font-size: 11px;
  }

  .specimen-name {
    font-size: 20px;
  }

  .result-title {
    font-size: 26px;
  }

  .panel-mini-label {
    font-size: 12px;
  }

  .observe-debug {
    right: 12px;
    width: min(300px, calc(100vw - 24px));
  }
}

@media (max-height: 820px) {
  .flight-card {
    top: max(88px, calc(env(safe-area-inset-top) + 72px));
    width: min(256px, calc(100vw - 28px));
    padding: 14px 16px;
  }

  .specimen-name {
    font-size: 20px;
  }

  .capture-cluster {
    top: 32.5%;
  }

  .capture-frame {
    width: var(--frame-size-compact);
    height: var(--frame-size-compact);
  }

  .timing-hud {
    width: 124px;
    padding: 5px 6px 8px;
  }

  .observe-debug {
    top: max(192px, calc(env(safe-area-inset-top) + 176px));
  }

  .bottom-panel {
    padding: 7px;
  }

  .primary-btn,
  .secondary-btn,
  .mode-btn {
    padding: 11px 12px;
  }
}

body.observe-lab-page {
  background: #000;
}

#observeLabApp {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #000;
  isolation: isolate;
}

#labCamera,
.lab-targets-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#labCamera {
  object-fit: cover;
  background:
    radial-gradient(circle at 35% 18%, rgba(132, 194, 255, 0.12), transparent 32%),
    linear-gradient(180deg, #18212b 0%, #0d141b 42%, #090f15 100%);
}

.lab-capture-cluster {
  top: 31.8%;
  gap: 0;
}

.lab-compact-status {
  position: absolute;
  top: max(88px, calc(env(safe-area-inset-top) + 72px));
  left: 18px;
  right: 18px;
  z-index: 12;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  color: rgba(246, 244, 239, 0.8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.34);
  pointer-events: none;
}

.lab-center-zone {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 18px;
  border: 2px dashed rgba(255, 216, 138, 0.92);
  background: rgba(255, 214, 138, 0.08);
  box-shadow: 0 0 18px rgba(255, 214, 138, 0.14);
}

.lab-targets-layer {
  pointer-events: none;
  z-index: 11;
}

.lab-target {
  position: absolute;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  color: #0d1622;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
  transition:
    transform 120ms ease-out,
    box-shadow 120ms ease-out,
    border-color 120ms ease-out;
}

.lab-target-label {
  transform: translateY(-0.5px);
}

.lab-target.is-blue {
  background: linear-gradient(145deg, #8bddff 0%, #4b88ff 100%);
}

.lab-target.is-red {
  background: linear-gradient(145deg, #ffb1a3 0%, #ff6e6e 100%);
}

.lab-target.is-sample {
  background: linear-gradient(145deg, rgba(246, 244, 239, 0.94) 0%, rgba(199, 209, 221, 0.9) 100%);
}

.lab-target.is-selected {
  border-color: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.26),
    0 0 0 5px rgba(136, 215, 255, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.lab-target.is-closest {
  transform: translate(-50%, -50%) scale(1.04);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.28),
    0 0 0 6px rgba(154, 244, 197, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.lab-target.is-entered {
  border-color: rgba(255, 214, 138, 0.98);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.28),
    0 0 0 7px rgba(255, 214, 138, 0.14),
    0 0 26px rgba(255, 214, 138, 0.22);
}

.lab-panel {
  z-index: 14;
  left: 10px;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  border-radius: 18px;
  padding: 6px;
}

.lab-panel .bottom-panel-expanded {
  gap: 6px;
}

.lab-panel .panel-header {
  min-height: 18px;
}

.lab-panel .panel-caption {
  font-size: 10px;
}

.lab-panel .modes {
  margin-top: 4px;
}

.lab-control-group {
  display: grid;
  gap: 6px;
}

.lab-control-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(246, 244, 239, 0.58);
}

.lab-chip-row,
.lab-target-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lab-chip {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 999px;
  min-height: 32px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
}

.lab-chip.active {
  background: rgba(136, 215, 255, 0.16);
  border-color: rgba(136, 215, 255, 0.44);
  box-shadow: inset 0 0 0 1px rgba(136, 215, 255, 0.28);
}

.lab-actions {
  display: grid;
  gap: 6px;
}

.lab-panel .primary-btn,
.lab-panel .secondary-btn,
.lab-panel .mode-btn {
  padding: 11px 14px;
  font-size: 14px;
}

.lab-summary-bar {
  display: grid;
  gap: 2px;
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.lab-summary-primary {
  font-size: 13px;
  font-weight: 700;
  color: rgba(246, 244, 239, 0.9);
}

.lab-summary-secondary {
  font-size: 11px;
  line-height: 1.35;
  color: rgba(246, 244, 239, 0.62);
}

.lab-summary-sensor {
  font-size: 10px;
  line-height: 1.35;
  color: rgba(166, 220, 255, 0.72);
  font-variant-numeric: tabular-nums;
}

.lab-debug-toggle {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 12px;
  min-height: 38px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.lab-debug-details {
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(136, 215, 255, 0.16);
  background: rgba(7, 11, 17, 0.56);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.lab-panel .observe-debug-title {
  font-size: 10px;
}

.lab-panel .observe-debug-content {
  margin-top: 6px;
  font-size: 11px;
}

@media (max-height: 820px) {
  .lab-capture-cluster {
    top: 30.2%;
  }

  .lab-target {
    width: 48px;
    height: 48px;
    font-size: 17px;
  }

  .lab-compact-status {
    top: max(84px, calc(env(safe-area-inset-top) + 68px));
    font-size: 11px;
  }

  .lab-panel .hint {
    font-size: 10px;
  }
}
