:root {
  color-scheme: dark;
  font-family:
    Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #071018;
  color: #f8fbff;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 0%, rgba(20, 118, 153, 0.24), transparent 32%),
    #071018;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

.lens-shell {
  width: 100%;
  height: 100dvh;
  min-height: 560px;
}

.topbar {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 14px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(to bottom, rgba(6, 16, 24, 0.9), rgba(6, 16, 24, 0.58));
  backdrop-filter: blur(18px);
}

.brand,
.top-actions,
.camera-picker,
.scan-hint,
.marker-row,
.footer-note,
.primary-button,
.secondary-button {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand-lens {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, rgba(141, 236, 255, 0.2) 0 34%, transparent 35%),
    linear-gradient(90deg, transparent 0 22%, #9cf1ff 23% 31%, transparent 32% 68%, #9cf1ff 69% 77%, transparent 78%);
  box-shadow: 0 0 28px rgba(95, 218, 255, 0.24);
}

.brand-lens::after {
  position: absolute;
  inset: 5px 13px;
  border: 1px solid rgba(194, 250, 255, 0.95);
  border-radius: 50%;
  background: rgba(89, 201, 255, 0.18);
  content: "";
}

.eyebrow,
.step-label {
  margin: 0 0 3px;
  color: #83a7b8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 680;
  letter-spacing: 0.04em;
}

.top-actions {
  gap: 8px;
  min-width: 0;
}

.pill-link,
.text-link,
.camera-picker select {
  color: #dff8ff;
  font-size: 13px;
  text-decoration: none;
}

.pill-link {
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: rgba(7, 20, 30, 0.32);
}

.camera-picker {
  gap: 8px;
  min-width: 0;
  color: #83a7b8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.camera-picker span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.camera-picker select {
  min-width: 0;
  max-width: min(230px, 28vw);
  height: 36px;
  padding: 0 34px 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  outline: none;
  background: rgba(7, 18, 28, 0.86);
  font: inherit;
  letter-spacing: 0;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  color: #dff8ff;
  background: rgba(7, 18, 28, 0.76);
  cursor: pointer;
}

.camera-stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(20, 62, 77, 0.9), rgba(7, 12, 20, 0.98) 63%),
    #060b12;
}

#ar-container {
  position: absolute !important;
  inset: 0;
  overflow: hidden;
}

#ar-container canvas,
#ar-container video {
  position: absolute !important;
  max-width: none !important;
  max-height: none !important;
}

#ar-container canvas {
  z-index: 2 !important;
  pointer-events: none;
}

#ar-container #arjs-video {
  z-index: 1 !important;
  background: #000;
}

.camera-active {
  background: #000;
}

.welcome-panel,
.error-panel {
  position: absolute;
  z-index: 10;
  top: 50%;
  left: 50%;
  width: min(520px, calc(100% - 38px));
  padding: 34px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  background: rgba(8, 19, 29, 0.78);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.36);
  text-align: center;
  backdrop-filter: blur(22px);
}

.welcome-panel h2,
.error-panel h2 {
  margin: 10px 0 12px;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.05em;
}

.welcome-panel > p:not(.step-label),
.error-panel > p:not(.step-label) {
  max-width: 390px;
  margin: 0 auto 24px;
  color: #b5c9d8;
  font-size: 14px;
  line-height: 1.76;
}

.primary-button,
.secondary-button {
  justify-content: center;
  gap: 10px;
  min-width: 220px;
  padding: 13px 22px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  color: #061018;
  background: linear-gradient(135deg, #f8ffff, #9bedff);
  box-shadow: 0 12px 34px rgba(99, 219, 255, 0.22);
}

.secondary-button {
  color: #edfbff;
  background: #234154;
}

.camera-icon {
  position: relative;
  width: 18px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.camera-icon::before {
  position: absolute;
  top: 2px;
  left: 4px;
  width: 5px;
  height: 5px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  content: "";
}

.camera-icon::after {
  position: absolute;
  top: -5px;
  left: 3px;
  width: 7px;
  height: 3px;
  border-radius: 2px 2px 0 0;
  background: currentColor;
  content: "";
}

.welcome-camera-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  width: min(100%, 520px);
  margin: 18px auto 0;
}

.welcome-camera-row .camera-picker {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: start;
  gap: 6px;
  width: 100%;
}

.welcome-camera-row .camera-picker select {
  width: 100%;
  max-width: none;
  height: 44px;
}

.compact-button {
  min-width: 118px;
  height: 44px;
  padding: 0 18px;
  font-size: 12px;
  white-space: nowrap;
}

.text-link {
  display: block;
  width: fit-content;
  margin: 16px auto 0;
  color: #a7d8e9;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.scan-hint {
  position: absolute;
  z-index: 8;
  top: 94px;
  left: 50%;
  gap: 9px;
  padding: 10px 16px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #e5fbff;
  background: rgba(7, 17, 27, 0.78);
  font-size: 12px;
  backdrop-filter: blur(14px);
}

.scan-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8ff2ff;
  box-shadow: 0 0 0 0 rgba(143, 242, 255, 0.6);
  animation: pulse 1.8s infinite;
}

.axis-hint {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  display: grid;
  grid-template-columns: auto minmax(36px, 1fr) auto minmax(36px, 1fr) auto;
  align-items: center;
  width: min(620px, calc(100% - 44px));
  transform: translate(-50%, -50%);
  color: rgba(220, 249, 255, 0.48);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}

.is-scanning .axis-hint {
  opacity: 1;
}

.axis-hint i {
  height: 1px;
  margin: 0 12px;
  background: linear-gradient(90deg, transparent, rgba(180, 246, 255, 0.8), transparent);
}

.experiment-panel {
  position: absolute;
  z-index: 9;
  right: clamp(12px, 3vw, 28px);
  bottom: 58px;
  width: min(560px, calc(100% - 24px));
  max-height: calc(100dvh - 130px);
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background: rgba(5, 13, 22, 0.78);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.marker-row {
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.tracking-chip {
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #7f96a6;
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  font-weight: 800;
}

.tracking-chip.is-found {
  border-color: rgba(129, 242, 206, 0.5);
  color: #b7ffec;
  background: rgba(77, 219, 174, 0.12);
}

.readouts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 12px;
}

.readouts div {
  min-width: 0;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.readouts dt {
  margin: 0 0 5px;
  color: #83a7b8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.readouts dd {
  margin: 0;
  color: #f4feff;
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.result-card {
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(41, 92, 112, 0.55), rgba(19, 35, 50, 0.64));
}

.result-card span {
  display: block;
  margin-bottom: 5px;
  color: #9befff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.result-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 15px;
}

.result-card p {
  margin: 0;
  color: #c8dce6;
  font-size: 12px;
  line-height: 1.55;
}

.inquiry-tools {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.inquiry-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.inquiry-heading span {
  display: block;
  margin-bottom: 3px;
  color: #83a7b8;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.inquiry-heading strong {
  display: block;
  color: #f3fcff;
  font-size: 13px;
}

.record-button,
.clear-button {
  border: 0;
  border-radius: 999px;
  color: #061018;
  background: #9bedff;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.record-button {
  flex: 0 0 auto;
  padding: 9px 12px;
}

.clear-button {
  margin-top: 8px;
  padding: 7px 11px;
  color: #cbe7ef;
  background: rgba(255, 255, 255, 0.1);
}

.record-button:disabled,
.clear-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

th,
td {
  padding: 8px 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  font-size: 11px;
  white-space: nowrap;
}

th {
  color: #9befff;
  background: rgba(155, 239, 255, 0.08);
  font-weight: 900;
}

td {
  color: #d9edf4;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty-row td {
  color: #85a0ad;
  text-align: center;
  white-space: normal;
}

.footer-note {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  justify-content: space-between;
  min-height: 42px;
  padding: 8px clamp(18px, 4vw, 48px);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: #6e8b9a;
  background: linear-gradient(to top, rgba(5, 13, 22, 0.88), rgba(5, 13, 22, 0.22));
  font-size: 10px;
  letter-spacing: 0.04em;
}

[hidden] {
  display: none !important;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 8px rgba(143, 242, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(143, 242, 255, 0);
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 68px;
  }

  .eyebrow,
  .desktop-note,
  .top-camera-picker,
  .icon-button {
    display: none;
  }

  h1 {
    font-size: 16px;
  }

  .top-actions {
    gap: 6px;
  }

  .pill-link {
    padding: 8px 10px;
    font-size: 12px;
  }

  .welcome-panel {
    padding: 28px 22px;
  }

  .welcome-panel h2 {
    font-size: 32px;
  }

  .welcome-camera-row,
  .readouts {
    grid-template-columns: 1fr;
  }

  .compact-button {
    width: 100%;
  }

  .scan-hint {
    top: 82px;
  }

  .experiment-panel {
    right: 12px;
    bottom: 50px;
  }

  .inquiry-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .record-button {
    width: 100%;
  }

  .footer-note {
    justify-content: center;
    text-align: center;
  }
}
