:root {
  color-scheme: dark;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #f7f9ff;
  background: #02040b;
}

* {
  box-sizing: border-box;
}

html,
body,
.stage {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.stage {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, #172347 0, #070b18 48%, #02040b 100%);
  touch-action: none;
}

#camera-feed,
#three-layer,
#three-layer canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#camera-feed {
  z-index: 1;
  object-fit: cover;
  background: #02040b;
}

#three-layer {
  z-index: 2;
  pointer-events: none;
}

#three-layer canvas {
  display: block;
}

.hud {
  position: fixed;
  right: 0;
  left: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.top-hud {
  top: 0;
  min-height: 78px;
  padding: 13px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(to bottom, rgba(2, 4, 11, 0.88), rgba(2, 4, 11, 0.28));
  backdrop-filter: blur(14px);
}

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

.brand-orbit {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(123, 156, 255, 0.72);
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff5c7 0 9%, #ffae35 10% 24%, transparent 25%),
    radial-gradient(ellipse, transparent 0 52%, rgba(123, 156, 255, 0.7) 53% 56%, transparent 57%);
  box-shadow: 0 0 25px rgba(83, 121, 255, 0.3);
}

.brand p,
.kicker {
  margin: 0 0 3px;
  color: #94a4dc;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.05em;
}

.top-hud a {
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #ecf0ff;
  font-size: 13px;
  text-decoration: none;
  pointer-events: auto;
}

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

.camera-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #94a4dc;
  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.16);
  border-radius: 999px;
  color: #ecf0ff;
  outline: none;
  background: rgba(8, 12, 31, 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: #ecf0ff;
  background: rgba(8, 12, 31, 0.72);
  cursor: pointer;
}

.welcome,
.error-panel {
  position: fixed;
  z-index: 8;
  top: 50%;
  left: 50%;
  width: min(500px, calc(100% - 38px));
  padding: 36px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  background: rgba(7, 11, 28, 0.8);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.42);
  text-align: center;
  backdrop-filter: blur(22px);
}

.welcome h2,
.error-panel h2 {
  margin: 10px 0 14px;
  font-size: clamp(32px, 6vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

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

.welcome button,
.error-panel button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 220px;
  padding: 14px 22px;
  border: 0;
  border-radius: 999px;
  color: #0d142b;
  background: linear-gradient(135deg, #ffffff, #bdcaff);
  box-shadow: 0 14px 38px rgba(91, 124, 255, 0.28);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.welcome button span {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(13, 20, 43, 0.13);
}

.welcome small {
  display: block;
  margin-top: 16px;
  color: #7783ad;
  font-size: 11px;
}

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

.welcome .welcome-camera-row button {
  min-width: 118px;
  height: 44px;
  padding: 0 18px;
  color: #edf0ff;
  background: #28335e;
  box-shadow: none;
  font-size: 12px;
  white-space: nowrap;
}

.fact-card {
  position: fixed;
  z-index: 7;
  top: 104px;
  left: clamp(18px, 4vw, 48px);
  min-width: 190px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 15px;
  background: rgba(5, 9, 24, 0.68);
  backdrop-filter: blur(13px);
}

.fact-card span {
  color: #72e2bb;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.fact-card strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.fact-card p {
  margin: 3px 0 0;
  color: #939fc8;
  font-size: 11px;
}

.controls {
  position: fixed;
  z-index: 12;
  bottom: 62px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
}

.controls button {
  min-width: 46px;
  height: 46px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: #f5f7ff;
  background: rgba(7, 11, 28, 0.78);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  font: inherit;
  font-size: 20px;
  cursor: pointer;
  backdrop-filter: blur(14px);
}

.controls .wide {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 96px;
  font-size: 12px;
  font-weight: 800;
}

.controls .reset {
  font-size: 12px;
}

.pause-icon {
  width: 10px;
  height: 12px;
  border-right: 3px solid currentColor;
  border-left: 3px solid currentColor;
}

.pause-icon.playing {
  width: 0;
  height: 0;
  border: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid currentColor;
}

.bottom-hud {
  bottom: 0;
  min-height: 42px;
  padding: 8px clamp(18px, 4vw, 48px);
  color: #9ba7cd;
  background: linear-gradient(to top, rgba(2, 4, 11, 0.86), rgba(2, 4, 11, 0.12));
  font-size: 10px;
  letter-spacing: 0.04em;
}

[hidden] {
  display: none !important;
}

@media (max-width: 620px) {
  .top-hud {
    min-height: 68px;
  }

  .brand p,
  .desktop-only {
    display: none;
  }

  .top-actions {
    gap: 6px;
  }

  .camera-picker span,
  .icon-button {
    display: none;
  }

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

  .welcome {
    padding: 30px 22px;
  }

  .welcome h2 {
    font-size: 36px;
  }

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

  .welcome .welcome-camera-row button {
    width: 100%;
  }

  .fact-card {
    top: 82px;
  }

  .controls {
    bottom: 54px;
  }

  .controls .reset {
    display: none;
  }

  .bottom-hud {
    justify-content: center;
  }
}
