:root {
  color-scheme: dark;
  --bg-deep: #061925;
  --bg-blue: #0e5f95;
  --panel: rgba(4, 20, 31, 0.74);
  --line: rgba(218, 246, 255, 0.82);
  --ink: #f2fbff;
  --muted: #9dc6d3;
  --accent: #f25555;
  --cyan: #4bd4ff;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 18%, rgba(75, 212, 255, 0.24), transparent 30%),
    linear-gradient(135deg, var(--bg-deep), var(--bg-blue));
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  touch-action: none;
}

button {
  font: inherit;
}

.app-shell,
#scene {
  position: fixed;
  inset: 0;
}

#scene canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: fixed;
  z-index: 10;
  pointer-events: none;
}

.hud-top {
  top: calc(22px + var(--safe-top));
  left: clamp(18px, 4vw, 56px);
  right: clamp(18px, 4vw, 56px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  width: fit-content;
  margin: 0 0 8px;
  padding: 5px 10px;
  border: 1px solid rgba(242, 251, 255, 0.55);
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(25px, 3vw, 42px);
  line-height: 1.04;
  letter-spacing: 0;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}

.spec-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(142px, 1fr));
  gap: 8px;
  max-width: 470px;
  margin-top: 5px;
}

.spec-strip span {
  min-height: 34px;
  padding: 8px 11px;
  border: 1px solid rgba(218, 246, 255, 0.45);
  background: rgba(7, 35, 50, 0.5);
  border-radius: 6px;
  color: #dff8ff;
  font-size: 13px;
  line-height: 1.25;
  backdrop-filter: blur(12px);
}

.hud-panel {
  right: clamp(16px, 4vw, 46px);
  bottom: calc(clamp(18px, 4vw, 40px) + var(--safe-bottom));
  display: flex;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(218, 246, 255, 0.28);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
}

.control-btn {
  height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(218, 246, 255, 0.35);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.control-btn:hover,
.control-btn.is-active {
  border-color: rgba(75, 212, 255, 0.82);
  background: rgba(75, 212, 255, 0.16);
  color: #ffffff;
}

.control-btn:disabled {
  border-color: rgba(218, 246, 255, 0.22);
  background: rgba(255, 255, 255, 0.035);
  color: rgba(242, 251, 255, 0.62);
  cursor: not-allowed;
}

.model-label {
  min-width: 122px;
  padding: 7px 10px;
  border-left: 2px solid var(--cyan);
  background: rgba(2, 16, 24, 0.72);
  color: #f4fcff;
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  transform: translateY(-6px);
  user-select: none;
  white-space: nowrap;
}

.model-label::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
}

@media (max-width: 760px) {
  .hud-top {
    top: calc(14px + var(--safe-top));
    left: 14px;
    right: 14px;
    flex-direction: column;
    gap: 10px;
  }

  h1 {
    max-width: 100%;
    font-size: clamp(22px, 5.8vw, 26px);
    line-height: 1.12;
  }

  .spec-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100%, 420px);
    max-width: none;
    gap: 7px;
  }

  .spec-strip span {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .hud-panel {
    left: 12px;
    right: 12px;
    bottom: calc(12px + var(--safe-bottom));
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: center;
    gap: 7px;
    padding: 7px;
  }

  .control-btn {
    height: 44px;
    min-width: 0;
    padding: 0 6px;
    font-size: 12px;
    line-height: 1.15;
  }

  .model-label {
    display: none;
    min-width: 0;
    max-width: 132px;
    white-space: normal;
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  .spec-strip span {
    padding-inline: 8px;
    font-size: 11px;
  }

  .control-btn {
    font-size: 11px;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .hud-top {
    top: calc(10px + var(--safe-top));
    right: auto;
    max-width: 46vw;
  }

  h1 {
    font-size: 24px;
  }

  .spec-strip {
    display: none;
  }

  .hud-panel {
    left: auto;
    width: min(390px, calc(100vw - 24px));
  }

  .model-label {
    display: none;
  }
}
