* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b0e15;
  color: #e8eefc;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
}

.hud {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 0 max(14px, env(safe-area-inset-bottom));
  pointer-events: none;
}

/* ---------- 顶部 ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  pointer-events: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .3px;
  color: #dce6ff;
  background: rgba(18, 24, 38, .52);
  border: 1px solid rgba(140, 175, 255, .16);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .28);
}

.brand .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #62d0ff;
  box-shadow: 0 0 0 3px rgba(98, 208, 255, .16), 0 0 12px #62d0ff;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 12.5px;
  color: #b9c8e6;
  background: rgba(18, 24, 38, .48);
  border: 1px solid rgba(140, 175, 255, .13);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.status .pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7ce3a7;
  box-shadow: 0 0 9px #7ce3a7;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.82); }
}

/* ---------- 气泡 ---------- */
.bubble {
  position: absolute;
  left: 0;
  top: 0;
  max-width: 210px;
  padding: 9px 13px;
  border-radius: 14px 14px 14px 4px;
  font-size: 13px;
  line-height: 1.5;
  color: #eaf2ff;
  background: rgba(24, 32, 50, .82);
  border: 1px solid rgba(140, 175, 255, .22);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transform: translate(-50%, -100%);
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble.out {
  opacity: 0;
  transform: translate(-50%, -92%);
}

/* ---------- 底部 ---------- */
.dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  pointer-events: none;
}

.chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 560px;
  pointer-events: auto;
}

.chips button {
  height: 30px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 12.5px;
  color: #c9d7f2;
  background: rgba(20, 27, 42, .55);
  border: 1px solid rgba(140, 175, 255, .16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  transition: .18s ease;
}

.chips button:hover {
  color: #fff;
  background: rgba(70, 110, 200, .35);
  border-color: rgba(120, 170, 255, .45);
  transform: translateY(-1px);
}

.chips button:active { transform: translateY(0) scale(.97); }

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(560px, 100%);
  padding: 6px 6px 6px 16px;
  border-radius: 999px;
  background: rgba(16, 22, 36, .72);
  border: 1px solid rgba(140, 175, 255, .18);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .42);
  pointer-events: auto;
}

.bar input {
  flex: 1;
  min-width: 0;
  height: 34px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #eaf2ff;
  font-size: 14px;
  font-family: inherit;
}

.bar input::placeholder { color: #6d7d9c; }

.bar button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: #06121f;
  background: linear-gradient(150deg, #8fd8ff, #57a6ff);
  cursor: pointer;
  transition: .18s ease;
  box-shadow: 0 6px 18px rgba(80, 160, 255, .35);
}

.bar button:hover { filter: brightness(1.08); transform: scale(1.04); }
.bar button:active { transform: scale(.95); }

/* ---------- 加载 ---------- */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  background: radial-gradient(120% 90% at 50% 30%, #1a2438 0%, #0b0e15 70%);
  color: #93a4c4;
  font-size: 13px;
  z-index: 20;
  transition: opacity .5s ease;
}

.boot.hide { opacity: 0; pointer-events: none; }

.boot .spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(120, 170, 255, .18);
  border-top-color: #6cb8ff;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .top { padding: 0 12px; }
  .brand { height: 30px; font-size: 13px; }
  .status { height: 28px; font-size: 11.5px; }
  .chips { gap: 6px; max-width: 100%; }
  .chips button { height: 28px; padding: 0 11px; font-size: 12px; }
  .dock { padding: 0 10px; }
  .bubble { max-width: 170px; font-size: 12.5px; }
}
