:root {
  --bg: #020208;
  --bg-card: rgba(8, 10, 18, 0.9);
  --bg-panel: rgba(8, 10, 18, 0.95);
  --bg-input: rgba(14, 16, 28, 0.9);
  --border: rgba(0, 170, 255, 0.12);
  --border-hover: rgba(0, 170, 255, 0.3);
  --text: #e8eaf0;
  --text-dim: #4a5070;
  --accent: #00aaff;
  --accent-dim: #005588;
  --success: #00ff88;
  --danger: #ff453a;
  --warning: #ff9f0a;
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

/* ── Pages ────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ── Login ────────────────────────────── */
.login-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 85dvh; text-align: center;
  padding: 32px; position: relative;
}
.login-screen::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 40%, rgba(0,170,255,0.06) 0%, transparent 60%);
  pointer-events: none;
}
.login-icon { font-size: 72px; margin-bottom: 28px; filter: drop-shadow(0 0 20px rgba(0,170,255,0.3)); }
.login-screen h1 {
  font-size: 32px; font-weight: 700; margin-bottom: 8px;
  background: linear-gradient(135deg, #e8e8e8 0%, #8ab4ff 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-screen p { color: var(--text-dim); margin-bottom: 36px; font-size: 15px; }

/* ── Header ───────────────────────────── */
.header {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  padding-top: calc(env(safe-area-inset-top, 0) / 2 + 18px);
  background: linear-gradient(180deg, rgba(4,4,12,0.9) 0%, rgba(4,4,12,0.4) 60%, transparent 100%);
  z-index: 50; pointer-events: none;
}
.header * { pointer-events: auto; }
.header h1 {
  font-size: 16px; font-weight: 600; letter-spacing: 0.5px;
  color: rgba(232,232,232,0.7);
}
.header-btn {
  background: rgba(74,158,255,0.08);
  border: 1px solid rgba(74,158,255,0.15);
  color: var(--accent); font-size: 13px; font-weight: 500;
  cursor: pointer; padding: 8px 16px; border-radius: 8px;
  transition: all 0.2s;
}
.header-btn:hover {
  background: rgba(74,158,255,0.15);
  border-color: rgba(74,158,255,0.3);
}

/* ── 3D Container ─────────────────────── */
#three-container { position: fixed; inset: 0; z-index: 1; }
#three-container canvas { display: block; width: 100% !important; height: 100% !important; }

/* ── Action Bar (detail state) ─────────── */
.detail-bar {
  position: fixed; bottom: 30px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 10px; z-index: 100;
  padding: 10px 16px;
  background: var(--bg-panel);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 40px rgba(74,158,255,0.05);
  opacity: 1; transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}
.detail-bar.hidden {
  opacity: 0; pointer-events: none;
  transform: translateX(-50%) translateY(20px);
}

.bar-btn {
  padding: 12px 24px; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.2s; white-space: nowrap;
}
.bar-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: white; box-shadow: 0 4px 16px rgba(74,158,255,0.25);
}
.bar-btn.primary:hover { box-shadow: 0 6px 24px rgba(74,158,255,0.35); transform: translateY(-1px); }
.bar-btn.secondary {
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border);
}
.bar-btn.secondary:hover { border-color: var(--border-hover); }

/* ── Status Dots ──────────────────────── */
.status-dot {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  position: relative;
}
.status-dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 1.5px solid currentColor; opacity: 0.3;
}
.status-dot.green { background: var(--success); color: var(--success); box-shadow: 0 0 10px rgba(52,199,89,0.4); }
.status-dot.orange { background: var(--warning); color: var(--warning); box-shadow: 0 0 10px rgba(255,159,10,0.4); }
.status-dot.blue { background: var(--accent); color: var(--accent); box-shadow: 0 0 10px rgba(74,158,255,0.4); }

/* ── Buttons ──────────────────────────── */
.btn {
  display: block; width: 100%; padding: 16px; border: none;
  border-radius: var(--radius); font-size: 17px; font-weight: 600;
  cursor: pointer; text-align: center; transition: all 0.2s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: white;
  box-shadow: 0 4px 24px rgba(74,158,255,0.3);
}
.btn-primary:hover { box-shadow: 0 6px 32px rgba(74,158,255,0.4); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

/* ── Toast ────────────────────────────── */
.toast {
  position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%);
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  color: var(--text); padding: 12px 24px;
  border-radius: var(--radius); font-size: 14px; font-weight: 500;
  z-index: 2000; opacity: 0; transition: opacity 0.3s; pointer-events: none;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.toast.show { opacity: 1; }

/* ── Hint ─────────────────────────────── */
.hint-text {
  position: fixed; bottom: 22px; left: 0; right: 0;
  text-align: center; color: var(--text-dim); font-size: 12px;
  z-index: 40; pointer-events: none; opacity: 0.5;
  letter-spacing: 0.3px;
}
