:root {
  color-scheme: dark;
  --ink: #f5f0e7;
  --muted: rgba(245, 240, 231, .72);
  --glass: rgba(10, 19, 30, .62);
  --line: rgba(255, 255, 255, .16);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #101a27;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

body { position: fixed; inset: 0; }

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 44%, rgba(61, 104, 130, .34), transparent 58%),
    linear-gradient(180deg, #17283a 0%, #101a27 100%);
  isolation: isolate;
}

#camera {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: transparent;
  opacity: 0;
  transition: opacity .25s ease;
}

#camera.active { opacity: .86; }

#scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.topbar {
  position: absolute;
  z-index: 2;
  top: max(12px, env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.brand {
  padding: 10px 12px 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.eyebrow {
  margin-bottom: 4px;
  color: #c4d8d9;
  font-size: 10px;
  letter-spacing: .12em;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 650;
  line-height: 1.25;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.privacy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  color: #e3f1e8;
  font-size: 10px;
  white-space: nowrap;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.privacy-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #91e2b0;
  box-shadow: 0 0 10px rgba(145, 226, 176, .8);
}

.status-panel {
  position: absolute;
  z-index: 2;
  top: 105px;
  left: 50%;
  width: min(88vw, 340px);
  padding: 10px 14px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 14px;
  background: rgba(8, 16, 26, .5);
  text-align: center;
  pointer-events: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.status-title {
  color: #fff6e6;
  font-size: 14px;
  font-weight: 650;
}

.status-detail {
  margin-top: 3px;
  color: rgba(245, 240, 231, .74);
  font-size: 11px;
  line-height: 1.4;
}

.diagnostics {
  position: absolute;
  z-index: 3;
  top: 175px;
  right: 10px;
  width: 142px;
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  background: rgba(0,0,0,.68);
  color: #fff;
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  pointer-events: none;
}

.diagnostics div {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.diagnostics span { color: rgba(255,255,255,.68); }
.diagnostics b { font-weight: 600; }

.bottombar {
  position: absolute;
  z-index: 2;
  left: 16px;
  right: 16px;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  pointer-events: none;
}

.hint {
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  color: rgba(255,255,255,.9);
  font-size: 11px;
  text-align: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.button-row { display: flex; justify-content: center; gap: 10px; width: 100%; }

button {
  min-width: 174px;
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #f1dba6, #d5b477);
  color: #1b2631;
  font: inherit;
  font-size: 15px;
  font-weight: 750;
  box-shadow: 0 7px 24px rgba(0,0,0,.24);
  pointer-events: auto;
  touch-action: manipulation;
}

button:disabled { opacity: .62; }
button:active { transform: scale(.98); }

.subhint {
  color: rgba(245,240,231,.64);
  font-size: 10px;
  text-shadow: 0 1px 5px rgba(0,0,0,.7);
}

.error-box {
  position: absolute;
  z-index: 5;
  left: 16px;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  padding: 14px 16px;
  border: 1px solid rgba(255,190,150,.35);
  border-radius: 14px;
  background: rgba(55, 22, 19, .92);
  color: #ffe5d9;
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

@media (max-height: 680px) {
  .status-panel { top: 88px; }
  .brand { padding: 8px 10px; }
  h1 { font-size: 18px; }
  .bottombar { gap: 6px; }
  button { min-height: 44px; }
}
