:root {
  color-scheme: dark;
  --bg: #05090c;
  --panel: rgba(13, 25, 31, 0.92);
  --panel-strong: rgba(16, 33, 41, 0.97);
  --line: rgba(125, 222, 230, 0.28);
  --text: #eef8fb;
  --muted: #9bb3bd;
  --teal: #12b8a4;
  --cyan: #3ad7ff;
  --green: #68f27a;
  --orange: #f0ad32;
  --red: #ff4d58;
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #000;
  color: var(--text);
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

.observer-shell {
  position: relative;
  width: min(100vw, 430px);
  height: 100dvh;
  min-height: 640px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 28px 90px rgba(0, 0, 0, 0.7);
}

.camera-pane {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #020608;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-pane::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.62), transparent 22%, transparent 52%, rgba(0, 0, 0, 0.72)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.36), transparent 20%, transparent 80%, rgba(0, 0, 0, 0.36));
}

.reticle,
.ar-baseline-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.reticle-dot,
.reticle-line,
.reticle-ring,
.ball-marker {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
}

.reticle-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 7px rgba(255, 77, 88, 0.16), 0 0 20px rgba(255, 77, 88, 0.9);
}

.reticle-line {
  width: min(78vw, 330px);
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  box-shadow: 0 0 20px rgba(58, 215, 255, 0.56);
}

.reticle-ring {
  width: 78px;
  height: 78px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
}

.ar-baseline-overlay {
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease;
}

.ar-baseline-overlay.is-visible {
  opacity: 1;
  transform: scale(1);
}

.ar-base-disc {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 184px;
  height: 88px;
  transform: translate(-50%, -50%) rotateX(62deg);
  transform-origin: center center;
}

.ar-base-ring,
.ar-base-cross {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: block;
}

.ar-base-ring {
  border: 3px solid rgba(104, 242, 122, 0.92);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(104, 242, 122, 0.45), inset 0 0 16px rgba(104, 242, 122, 0.12);
}

.ar-base-ring-outer {
  width: 184px;
  height: 88px;
}

.ar-base-ring-mid {
  width: 128px;
  height: 58px;
  border-width: 2px;
  opacity: 0.72;
}

.ar-base-ring-inner {
  width: 46px;
  height: 22px;
  background: rgba(104, 242, 122, 0.16);
  border-width: 2px;
}

.ar-base-cross {
  background: rgba(104, 242, 122, 0.82);
  box-shadow: 0 0 12px rgba(104, 242, 122, 0.55);
}

.ar-base-cross-x {
  width: 178px;
  height: 2px;
}

.ar-base-cross-z {
  width: 2px;
  height: 84px;
}

.ar-vertical-axis {
  position: absolute;
  left: 50%;
  top: 9%;
  width: 2px;
  height: 34%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.95));
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.5);
}

.ar-vertical-axis span {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-width: 54px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  font-weight: 900;
}

.ar-lock-badge {
  position: absolute;
  left: 50%;
  top: calc(42% + 64px);
  transform: translateX(-50%);
  padding: 7px 12px;
  border: 1px solid rgba(104, 242, 122, 0.58);
  border-radius: 8px;
  background: rgba(7, 19, 13, 0.78);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  backdrop-filter: blur(12px);
}

.ball-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  background: rgba(24, 185, 167, 0.28);
  box-shadow: 0 0 0 4px rgba(24, 185, 167, 0.22);
  pointer-events: none;
  z-index: 5;
}

.camera-status {
  position: absolute;
  z-index: 6;
  left: 12px;
  right: 12px;
  top: max(12px, env(safe-area-inset-top));
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 13, 18, 0.76);
  backdrop-filter: blur(14px);
  font-size: 13px;
  font-weight: 900;
}

.camera-status span {
  color: var(--cyan);
}

.control-pane {
  position: absolute;
  z-index: 7;
  left: 10px;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  max-height: 54dvh;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-strong), rgba(6, 14, 18, 0.95));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

header,
.card {
  border: 1px solid rgba(125, 222, 230, 0.16);
  border-radius: 8px;
  background: rgba(4, 12, 16, 0.42);
}

header {
  padding: 13px;
  margin-bottom: 10px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
}

h1,
h2,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.18;
}

h2 {
  font-size: 15px;
}

header p,
.note,
footer,
ol {
  color: var(--muted);
  line-height: 1.58;
}

header p {
  margin-top: 8px;
  font-size: 12px;
}

.field-grid,
.pid-grid,
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.field-grid {
  margin-bottom: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: #c2d8df;
  font-size: 12px;
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(125, 222, 230, 0.22);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(2, 8, 12, 0.75);
  color: var(--text);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--cyan);
}

.actions {
  position: sticky;
  top: -12px;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 0 10px;
  background: linear-gradient(180deg, rgba(16, 33, 41, 0.98), rgba(16, 33, 41, 0.84));
}

button {
  min-height: 44px;
  border: 1px solid rgba(125, 222, 230, 0.26);
  border-radius: 8px;
  color: var(--text);
  background: rgba(28, 49, 58, 0.98);
  font-size: 14px;
  font-weight: 900;
}

button:active {
  transform: translateY(1px);
}

button.is-primary {
  background: var(--teal);
  border-color: var(--teal);
}

button.is-ar-ready {
  border-color: rgba(104, 242, 122, 0.7);
  box-shadow: 0 0 18px rgba(104, 242, 122, 0.16);
}

.card {
  padding: 13px;
  margin-bottom: 10px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.card-head span,
.stats span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

ol {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
}

.note {
  margin-top: 8px;
  color: #abc3cb;
  font-size: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.stats div {
  min-height: 54px;
  padding: 10px;
  border: 1px solid rgba(125, 222, 230, 0.15);
  border-radius: 8px;
  background: rgba(2, 8, 12, 0.48);
}

.stats strong {
  display: block;
  margin-top: 5px;
  color: var(--cyan);
  font-size: 15px;
}

footer {
  padding: 2px 2px 10px;
  font-size: 12px;
}

@media (max-width: 390px) {
  .field-grid,
  .pid-grid,
  .stats {
    grid-template-columns: 1fr;
  }

  .control-pane {
    max-height: 58dvh;
  }

  button {
    font-size: 13px;
    padding-inline: 4px;
  }
}

@media (min-width: 720px) {
  body {
    display: grid;
    place-items: center;
  }

  .observer-shell {
    height: min(100dvh, 920px);
    min-height: min(100dvh, 760px);
  }
}
