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

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 0%, rgba(46, 70, 145, 0.2), transparent 34%),
    #050713;
}

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

.app-shell {
  width: 100%;
  height: 100dvh;
  min-height: 540px;
}

.topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  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(5, 7, 19, 0.88), rgba(5, 7, 19, 0.55));
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 200, 89, 0.7);
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff4ba 0 12%, #ffb733 13% 31%, transparent 32%),
    radial-gradient(circle, transparent 0 55%, rgba(255, 183, 51, 0.35) 56% 58%, transparent 59%);
  box-shadow: 0 0 24px rgba(255, 177, 40, 0.25);
}

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

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

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

.marker-link {
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  transition: 160ms ease;
}

.marker-link:hover {
  border-color: rgba(132, 157, 255, 0.7);
  background: rgba(104, 130, 230, 0.12);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.camera-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #8e9ac5;
  font-size: 11px;
  font-weight: 700;
  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(10, 14, 35, 0.82);
  font: inherit;
  letter-spacing: 0;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  color: #dbe1ff;
  background: rgba(10, 14, 35, 0.72);
  cursor: pointer;
}

.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;
  color: #edf0ff;
  background: #2c365f;
  font-size: 12px;
  white-space: nowrap;
}

.secondary-button.compact-button {
  min-width: 118px;
}

.camera-note {
  max-width: 340px !important;
  margin: 12px auto 0 !important;
  color: #7f8cb8 !important;
  font-size: 11px !important;
  line-height: 1.55 !important;
}

.camera-stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(28, 39, 79, 0.9), rgba(7, 10, 26, 0.96) 60%),
    #080b18;
}

#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(470px, calc(100% - 38px));
  padding: 34px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 24px;
  background: rgba(11, 15, 36, 0.76);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
  text-align: center;
  backdrop-filter: blur(22px);
}

.welcome-panel h2,
.error-panel h2 {
  margin: 10px 0 12px;
  font-size: clamp(28px, 5vw, 43px);
  line-height: 1.12;
  letter-spacing: -0.04em;
}

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

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 210px;
  padding: 13px 22px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  color: #10152a;
  background: linear-gradient(135deg, #f8faff, #bfcaff);
  box-shadow: 0 12px 32px rgba(132, 157, 255, 0.26);
}

.secondary-button {
  color: #edf0ff;
  background: #2c365f;
}

.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: "";
}

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

.reticle {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  width: min(54vw, 330px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 300ms ease;
  pointer-events: none;
}

.is-scanning .reticle {
  opacity: 0.75;
}

.reticle span {
  position: absolute;
  width: 38px;
  height: 38px;
  border-color: rgba(220, 227, 255, 0.9);
}

.reticle span:nth-child(1) {
  top: 0;
  left: 0;
  border-top: 2px solid;
  border-left: 2px solid;
  border-radius: 10px 0 0;
}

.reticle span:nth-child(2) {
  top: 0;
  right: 0;
  border-top: 2px solid;
  border-right: 2px solid;
  border-radius: 0 10px 0 0;
}

.reticle span:nth-child(3) {
  right: 0;
  bottom: 0;
  border-right: 2px solid;
  border-bottom: 2px solid;
  border-radius: 0 0 10px;
}

.reticle span:nth-child(4) {
  bottom: 0;
  left: 0;
  border-bottom: 2px solid;
  border-left: 2px solid;
  border-radius: 0 0 0 10px;
}

.scan-hint,
.planet-legend {
  position: absolute;
  z-index: 8;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 11, 28, 0.78);
  backdrop-filter: blur(14px);
}

.scan-hint {
  top: 94px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border-radius: 999px;
  color: #e3e7fa;
  font-size: 12px;
}

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

.planet-legend {
  bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(430px, calc(100% - 32px));
  padding: 14px 16px;
  border-radius: 16px;
}

.planet-legend span {
  display: block;
  margin-bottom: 3px;
  color: #8995c1;
  font-size: 10px;
  letter-spacing: 0.08em;
}

.planet-legend strong {
  font-size: 13px;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #9ff0ce;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.live-badge span {
  width: 7px;
  height: 7px;
  margin: 0;
  border-radius: 50%;
  background: #58e9b6;
  box-shadow: 0 0 10px #58e9b6;
}

.footer-note {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 8px clamp(18px, 4vw, 48px);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: #66719a;
  background: linear-gradient(to top, rgba(5, 7, 19, 0.82), rgba(5, 7, 19, 0.18));
  font-size: 10px;
  letter-spacing: 0.04em;
}

[hidden] {
  display: none !important;
}

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

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

  .scan-hint {
    top: 82px;
  }

  .eyebrow,
  .desktop-note {
    display: none;
  }

  .top-camera-picker span {
    display: none;
  }

  .top-actions {
    gap: 6px;
  }

  .top-camera-picker {
    display: none;
  }

  .top-actions .marker-link {
    padding: 8px 10px;
    font-size: 12px;
  }

  .top-camera-picker select {
    width: 118px;
    max-width: 31vw;
  }

  .icon-button {
    display: none;
  }

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

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

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

  .compact-button {
    width: 100%;
  }

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