/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:       #0A0A0A;
  --bg2:      #141414;
  --bg3:      #1E1E1E;
  --border:   #2A2A2A;
  --accent:   #00E5FF;
  --success:  #00FF88;
  --warn:     #FFA500;
  --danger:   #FF4444;
  --text:     #FFFFFF;
  --text2:    #888888;
  --text3:    #444444;
  --radius:   16px;
  --radius-sm:10px;
  --arrow-sz:  clamp(140px, 27dvh, 200px);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  height: 100%;
  /* Use dvh when available so the viewport is stable on mobile */
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  animation: pageIn 0.25s ease both;
  /* Respect iPhone notch and home indicator */
  padding-top:    env(safe-area-inset-top);
  padding-left:   env(safe-area-inset-left);
  padding-right:  env(safe-area-inset-right);
}

body.exit {
  animation: pageOut 0.22s ease forwards;
  pointer-events: none;
}

@keyframes pageIn  { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes pageOut { to   { opacity: 0; transform: translateX(-22px); } }

button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
svg    { display: block; flex-shrink: 0; }
input  { font: inherit; }
a      { color: inherit; text-decoration: none; }

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}
.topbar-title  { flex: 1; font-size: 17px; font-weight: 600; letter-spacing: 0.02em; }
.topbar-badge  { font-size: 13px; font-weight: 600; color: var(--accent); background: rgba(0,229,255,0.1); padding: 4px 10px; border-radius: 20px; }

.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--bg3);
  transition: background 0.15s;
  flex-shrink: 0;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { background: var(--border); }
.icon-btn.light  { background: rgba(255,255,255,0.1); }

/* ── Scrollable body ───────────────────────────────────────── */
.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
::-webkit-scrollbar { width: 0; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn-primary {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 16px;
  background: var(--accent); color: #000;
  font-size: 16px; font-weight: 700;
  border-radius: var(--radius); letter-spacing: 0.03em;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-primary:active    { opacity: 0.85; transform: scale(0.98); }
.btn-primary:disabled  { opacity: 0.35; pointer-events: none; }

.btn-secondary {
  display: flex; align-items: center; justify-content: center;
  flex: 1; padding: 15px;
  background: var(--bg3); color: var(--text);
  font-size: 15px; font-weight: 600;
  border-radius: var(--radius); border: 1px solid var(--border);
  transition: background 0.15s;
}
.btn-secondary:active { background: var(--border); }

/* ── Bottom Nav ────────────────────────────────────────────── */
.bottom-nav {
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--bg);
  /* Pad above iPhone home indicator */
  padding: 8px 0 calc(16px + env(safe-area-inset-bottom));
  flex-shrink: 0;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px; color: var(--text3); font-size: 11px; font-weight: 500;
  transition: color 0.15s;
}
.nav-btn svg   { width: 22px; height: 22px; }
.nav-btn.active { color: var(--accent); }

/* ── Section label ─────────────────────────────────────────── */
.section-label {
  font-size: 11px; font-weight: 700; color: var(--text3);
  letter-spacing: 0.12em; padding: 0 4px;
}

/* ═══════════════════════════════════════════════════════════
   PROFILE (profile.html)
═══════════════════════════════════════════════════════════ */
.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 0 20px;
}
.profile-big-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 800;
  color: #fff;
  background: #3A1C71;
  border: 3px solid rgba(255,255,255,0.08);
  transition: background 0.25s;
}
.profile-name-preview {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  min-height: 28px;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.12em;
}
.profile-input {
  width: 100%;
  padding: 15px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.profile-input::placeholder { color: var(--text3); font-weight: 400; }
.profile-input:focus { border-color: rgba(0,229,255,0.5); }

.color-swatches {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.color-swatch {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid transparent;
  outline: none;
  transition: transform 0.15s, border-color 0.15s;
  cursor: pointer;
  flex-shrink: 0;
}
.color-swatch.selected {
  border-color: #fff;
  transform: scale(1.18);
}
.color-swatch:active { transform: scale(0.95); }

/* History */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.history-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.history-info   { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.history-name   { font-size: 15px; font-weight: 600; }
.history-meta   { font-size: 12px; color: var(--text2); }
.empty-history  { text-align: center; color: var(--text3); font-size: 14px; padding: 32px 0; line-height: 1.6; }

/* Home topbar avatar */
.home-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #3A1C71;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  cursor: pointer;
  transition: opacity 0.15s;
  border: 2px solid rgba(255,255,255,0.08);
}
.home-avatar:active { opacity: 0.7; }

/* ── Offline banner ─────────────────────────────────────────── */
.offline-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 8000;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,165,0,0.12);
  border-top: 1px solid rgba(255,165,0,0.25);
  color: var(--warn); font-size: 13px; font-weight: 500;
  backdrop-filter: blur(10px);
}

/* ── GPS denied banner (tracking page) ─────────────────────── */
.gps-denied-banner {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0 16px 6px;
  padding: 12px 14px;
  background: rgba(255,165,0,0.07);
  border: 1px solid rgba(255,165,0,0.22);
  border-radius: 10px;
  color: var(--warn);
}
.gps-denied-banner strong { font-size: 13px; font-weight: 600; display: block; margin-bottom: 2px; }
.gps-denied-banner span   { font-size: 12px; color: var(--text2); }
.gps-denied-banner > div  { flex: 1; }
.gps-denied-banner .close-btn {
  background: none; border: none; color: var(--text3);
  font-size: 14px; cursor: pointer; padding: 0 2px; line-height: 1;
  flex-shrink: 0; margin-top: 2px;
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 100px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; font-weight: 500;
  padding: 12px 20px; border-radius: 30px;
  opacity: 0; transition: opacity 0.25s, transform 0.25s;
  z-index: 9999; white-space: nowrap; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ═══════════════════════════════════════════════════════════
   SPLASH (index.html)
═══════════════════════════════════════════════════════════ */
.splash-bg {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.splash-ring {
  position: absolute; border-radius: 50%;
  border: 1px solid rgba(0,229,255,0.08);
  animation: pulse-ring 3s ease-in-out infinite;
}
.ring-1 { width: 200px; height: 200px; animation-delay: 0s; }
.ring-2 { width: 360px; height: 360px; animation-delay: 0.6s; }
.ring-3 { width: 520px; height: 520px; animation-delay: 1.2s; }
@keyframes pulse-ring {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.03); }
}

.splash-content {
  display: flex; flex-direction: column; align-items: center;
  gap: 24px; padding: 40px 32px; width: 100%; max-width: 380px;
  position: relative; z-index: 1;
  /* center vertically */
  margin: auto;
}
.logo { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.logo-icon {
  width: 80px; height: 80px;
  background: rgba(0,229,255,0.07); border-radius: 24px;
  border: 1px solid rgba(0,229,255,0.2);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.logo-icon svg { width: 48px; height: 48px; }
.logo-text { font-size: 36px; font-weight: 800; letter-spacing: 0.15em; color: var(--accent); }
.tagline { text-align: center; font-size: 18px; line-height: 1.5; color: var(--text2); }
.tagline strong { color: var(--text); }
.splash-sub { font-size: 13px; color: var(--text3); letter-spacing: 0.05em; }

/* ═══════════════════════════════════════════════════════════
   HOME (home.html)
═══════════════════════════════════════════════════════════ */
.new-meetup-btn {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, rgba(0,229,255,0.08), rgba(0,229,255,0.03));
  border: 1px solid rgba(0,229,255,0.25); border-radius: var(--radius);
  text-align: left; transition: background 0.15s;
}
.new-meetup-btn:active { background: rgba(0,229,255,0.12); }
.nm-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(0,229,255,0.1);
  display: flex; align-items: center; justify-content: center;
}
.nm-icon svg { width: 22px; height: 22px; stroke: var(--accent); }
.nm-text { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.nm-title { font-size: 16px; font-weight: 700; color: var(--accent); }
.nm-sub   { font-size: 13px; color: var(--text2); }

.contact-list { display: flex; flex-direction: column; gap: 8px; }
.contact-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  transition: background 0.15s; cursor: pointer;
}
.contact-card:active  { background: var(--bg3); }
.contact-card.online  { border-color: rgba(0,229,255,0.15); }
.contact-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; flex-shrink: 0; color: #fff;
}
.contact-avatar.add {
  background: var(--bg3); border: 2px dashed var(--border);
  font-size: 22px; color: var(--text3);
}
.contact-info    { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.contact-name    { font-size: 16px; font-weight: 600; }
.contact-status  { font-size: 13px; color: var(--text2); }
.contact-signal  { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.signal-dot      { width: 8px; height: 8px; border-radius: 50%; }
.signal-dot.gps  { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.signal-dot.offline { background: var(--text3); }
.signal-label    { font-size: 10px; color: var(--text2); font-weight: 600; letter-spacing: 0.05em; }
.signal-dot.ble  { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.signal-dot.uwb  { background: var(--success); box-shadow: 0 0 8px var(--success); }

.empty-contacts {
  padding: 28px 16px; text-align: center;
  border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--bg2);
}
.empty-contacts-icon {
  width: 40px; height: 40px; margin: 0 auto 12px;
  border-radius: 50%; background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
}
.empty-contacts-icon svg { width: 20px; height: 20px; stroke: var(--text3); }
.empty-contacts-title { font-size: 15px; font-weight: 600; color: var(--text2); margin-bottom: 4px; }
.empty-contacts-sub   { font-size: 13px; color: var(--text3); }

.parking-banner {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  background: rgba(0,229,255,0.05); border: 1px solid rgba(0,229,255,0.2);
  border-radius: var(--radius); cursor: pointer; transition: background 0.15s;
}
.parking-banner:active { background: rgba(0,229,255,0.1); }
.parking-banner > svg  { width: 24px; height: 24px; stroke: var(--accent); }
.parking-banner > div  { display: flex; flex-direction: column; gap: 3px; }
.banner-title { font-size: 15px; font-weight: 600; color: var(--accent); }
.banner-sub   { font-size: 13px; color: var(--text2); }

/* ═══════════════════════════════════════════════════════════
   SESSION (session.html)
═══════════════════════════════════════════════════════════ */
.session-body {
  flex: 1; display: flex; flex-direction: column;
  padding: 24px 20px; gap: 20px; overflow-y: auto;
}
.s-tabs {
  display: flex; background: var(--bg2); border-radius: var(--radius-sm);
  padding: 4px; gap: 4px; border: 1px solid var(--border);
}
.s-tab {
  flex: 1; padding: 10px; border-radius: 8px;
  font-size: 15px; font-weight: 600; color: var(--text2); transition: all 0.2s;
}
.s-tab.active {
  background: var(--bg3); color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.s-panel        { display: flex; flex-direction: column; gap: 16px; }
.s-panel.hidden { display: none; }
.s-hint         { font-size: 14px; color: var(--text2); line-height: 1.5; text-align: center; }

.pin-row {
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.pd {
  width: 48px; height: 60px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 28px; font-weight: 800; color: var(--accent);
  transition: all 0.2s;
}
.pd.filled   { border-color: rgba(0,229,255,0.4); background: rgba(0,229,255,0.05); }
.pin-dash    { font-size: 18px; color: var(--text3); margin: 0 2px; }

.pin-gen-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px; border-radius: var(--radius);
  border: 1px dashed var(--border); color: var(--text2);
  font-size: 14px; font-weight: 600; transition: all 0.15s;
}
.pin-gen-btn:hover, .pin-gen-btn:active { border-color: var(--accent); color: var(--accent); background: rgba(0,229,255,0.04); }

.pin-input-wrap { display: flex; justify-content: center; }
.pin-input {
  width: 100%; max-width: 260px; padding: 18px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 32px; font-weight: 800;
  text-align: center; letter-spacing: 0.2em;
  outline: none; transition: border-color 0.2s; caret-color: var(--accent);
}
.pin-input::placeholder { color: var(--text3); letter-spacing: 0.1em; font-size: 24px; }
.pin-input:focus { border-color: rgba(0,229,255,0.5); }
.pin-input.valid { border-color: rgba(0,255,136,0.5); color: var(--success); }

.s-status     { min-height: 20px; font-size: 13px; color: var(--text2); text-align: center; line-height: 1.4; }
.s-status.ok  { color: var(--success); }
.s-status.err { color: var(--danger); }

.share-row {
  gap: 10px;
}
.share-row .btn-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.s-note {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 12px 14px; background: var(--bg2);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  font-size: 12px; color: var(--text3); line-height: 1.5; margin-top: auto;
}

/* ═══════════════════════════════════════════════════════════
   OVERVIEW (overview.html)
═══════════════════════════════════════════════════════════ */
.map-container { flex: 1; position: relative; overflow: hidden; }
.map-bg        { position: absolute; inset: 0; background: #0E0E0E; }
.map-grid, .map-line { position: absolute; inset: 0; width: 100%; height: 100%; }

.map-you { position: absolute; bottom: 25%; left: 50%; transform: translate(-50%, -50%); }
.map-you-pulse {
  position: absolute; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(0,229,255,0.2);
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  animation: you-pulse 2s ease-in-out infinite;
}
@keyframes you-pulse {
  0%, 100% { transform: translate(-50%,-50%) scale(1); opacity: 0.6; }
  50%       { transform: translate(-50%,-50%) scale(1.8); opacity: 0; }
}
.map-you-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 12px var(--accent);
}
.map-friend {
  position: absolute; top: 25%; right: 28%;
  transform: translate(50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.friend-label {
  font-size: 11px; font-weight: 600; background: rgba(0,0,0,0.7);
  padding: 3px 8px; border-radius: 10px; border: 1px solid var(--border); white-space: nowrap;
}
.map-friend-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: #FF6B35; border: 2px solid #fff; box-shadow: 0 0 12px #FF6B35;
}

.overview-panel {
  background: var(--bg2); border-top: 1px solid var(--border);
  padding: 20px; display: flex; flex-direction: column; gap: 16px; flex-shrink: 0;
}
.overview-stats { display: flex; align-items: center; justify-content: space-around; }
.stat           { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat-value     { font-size: 26px; font-weight: 700; color: var(--accent); }
.stat-unit      { font-size: 12px; color: var(--text2); }
.stat-divider   { width: 1px; height: 36px; background: var(--border); }

.signal-stack   { display: flex; gap: 8px; }
.signal-tier {
  flex: 1; text-align: center; padding: 7px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  background: var(--bg3); color: var(--text3); border: 1px solid var(--border);
}
.signal-tier.active {
  background: rgba(0,229,255,0.1); color: var(--accent); border-color: rgba(0,229,255,0.3);
}

/* ═══════════════════════════════════════════════════════════
   TRACKING (tracking.html)
═══════════════════════════════════════════════════════════ */
#page-tracking { background: #070707; }

.tracking-topbar {
  display: flex; align-items: center; padding: 16px 20px 12px; gap: 14px; flex-shrink: 0;
}
.tracking-who   { display: flex; align-items: center; gap: 10px; flex: 1; }
.tracking-who span { font-size: 16px; font-weight: 600; }
.tracking-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}

.tracking-mode-badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  padding: 5px 10px; border-radius: 20px; min-width: 52px; text-align: center;
  background: rgba(0,229,255,0.1); color: var(--accent); border: 1px solid rgba(0,229,255,0.25);
  transition: all 0.4s ease;
}
.tracking-mode-badge.ble { background: rgba(255,165,0,0.1); color: var(--warn); border-color: rgba(255,165,0,0.25); }
.tracking-mode-badge.uwb { background: rgba(0,255,136,0.1); color: var(--success); border-color: rgba(0,255,136,0.3); }

.gps-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 20px;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text2); flex-shrink: 0; min-height: 36px;
}
.gps-dot  { width: 8px; height: 8px; border-radius: 50%; background: var(--text3); flex-shrink: 0; transition: background 0.3s; }
.gps-dot.searching { background: var(--warn); animation: blink 1s infinite; }
.gps-dot.locked    { background: var(--success); box-shadow: 0 0 6px var(--success); animation: none; }
.gps-dot.sim       { background: var(--accent); }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }
.gps-bar > span { flex: 1; }
.compass-btn {
  padding: 5px 10px; border-radius: 20px;
  background: rgba(255,165,0,0.1); border: 1px solid rgba(255,165,0,0.3);
  color: var(--warn); font-size: 11px; font-weight: 600; white-space: nowrap;
}

.tracking-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: space-around; padding: 10px 24px 20px;
}
.distance-display { display: flex; align-items: flex-start; gap: 6px; line-height: 1; }
.distance-number  { font-size: clamp(52px, 10dvh, 80px); font-weight: 800; color: var(--text); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; transition: color 0.5s ease; }
.distance-number.close     { color: var(--accent); }
.distance-number.uwb-range { color: var(--success); }
.distance-unit { font-size: 24px; font-weight: 600; color: var(--text2); padding-top: 16px; }

.floor-indicator {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text2);
  background: var(--bg2); padding: 7px 14px;
  border-radius: 20px; border: 1px solid var(--border);
}

.arrow-container {
  position: relative; width: var(--arrow-sz); height: var(--arrow-sz);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.arrow-ring         { position: absolute; border-radius: 50%; border: 1px solid rgba(0,229,255,0.08); }
.arrow-ring.outer   { width: var(--arrow-sz); height: var(--arrow-sz); }
.arrow-ring.inner   { width: calc(var(--arrow-sz) * 0.8); height: calc(var(--arrow-sz) * 0.8); border-color: rgba(0,229,255,0.12); }
.arrow-icon {
  width: calc(var(--arrow-sz) * 0.6); height: calc(var(--arrow-sz) * 0.6);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 0 20px rgba(0,229,255,0.4));
}
.arrow-icon.uwb-mode { filter: drop-shadow(0 0 24px rgba(0,255,136,0.5)); }
.arrow-icon.uwb-mode svg path   { fill: var(--success); }
.arrow-icon.uwb-mode svg circle { stroke: var(--success); }

.precision-bar    { width: 100%; display: flex; align-items: center; gap: 10px; }
.precision-label  { font-size: 12px; color: var(--text3); min-width: 60px; }
.precision-track  { flex: 1; height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; }
.precision-fill   { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.6s ease, background 0.5s ease; }
.precision-fill.high { background: var(--success); }
.precision-value  { font-size: 12px; color: var(--accent); min-width: 42px; text-align: right; font-weight: 600; }

.tracking-actions { display: flex; gap: 12px; width: 100%; }
.action-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px; border-radius: var(--radius);
  background: var(--bg2); border: 1px solid var(--border);
  font-size: 13px; color: var(--text2); transition: background 0.15s;
}
.action-btn svg     { width: 22px; height: 22px; }
.action-btn:active  { background: var(--bg3); }
.action-btn.arrived { border-color: rgba(0,255,136,0.3); background: rgba(0,255,136,0.05); color: var(--success); }
.action-btn.arrived:active { background: rgba(0,255,136,0.1); }

/* ═══════════════════════════════════════════════════════════
   PARKING (parking.html)
═══════════════════════════════════════════════════════════ */
.parking-map {
  flex: 1; background: #0C0C0C;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; padding: 30px; gap: 0;
}
.parking-grid { display: flex; flex-direction: column; gap: 30px; }
.parking-row  { display: flex; gap: 10px; }
.parking-aisle { height: 2px; background: var(--border); width: 100%; max-width: 300px; }
.parking-spot {
  width: 54px; height: 72px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg2);
}
.parking-spot.taken    { background: #1A1A1A; border-color: #222; opacity: 0.5; }
.parking-spot.your-car {
  background: rgba(0,229,255,0.08); border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); box-shadow: 0 0 20px rgba(0,229,255,0.15);
}

.floor-tabs { position: absolute; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 6px; }
.floor-tab {
  padding: 6px 10px; font-size: 12px; font-weight: 700;
  border-radius: var(--radius-sm); background: var(--bg3); color: var(--text3);
  border: 1px solid var(--border); transition: all 0.15s;
}
.floor-tab.active { background: rgba(0,229,255,0.1); color: var(--accent); border-color: rgba(0,229,255,0.3); }

.parking-info {
  background: var(--bg2); border-top: 1px solid var(--border);
  padding: 20px; display: flex; flex-direction: column; gap: 16px; flex-shrink: 0;
}
.parking-detail { display: flex; flex-direction: column; gap: 12px; }
.detail-row     { display: flex; align-items: center; gap: 12px; }
.detail-row > div { display: flex; flex-direction: column; gap: 2px; }
.detail-title   { font-size: 15px; font-weight: 600; }
.detail-sub     { font-size: 13px; color: var(--text2); }
.parking-actions { display: flex; gap: 10px; }

/* ═══════════════════════════════════════════════════════════
   WAITING OVERLAY (tracking.html — before friend joins)
═══════════════════════════════════════════════════════════ */
.waiting-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 7, 7, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 100;
  padding: 32px;
  text-align: center;
  /* backdrop-filter: blur(4px); -- uncomment if you want blur */
}
.waiting-overlay.hidden { display: none; }

.waiting-spinner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--bg3);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.waiting-label {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.waiting-pin {
  font-size: 36px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.18em;
  background: rgba(0, 229, 255, 0.06);
  padding: 14px 28px;
  border-radius: var(--radius);
  border: 1px solid rgba(0, 229, 255, 0.2);
}

.waiting-hint {
  font-size: 13px;
  color: var(--text2);
  max-width: 260px;
  line-height: 1.5;
}

.waiting-mode {
  font-size: 12px;
  color: var(--text3);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg2);
}

/* Firebase status badge (top of session/tracking) */
.fb-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text3);
}
.fb-badge.live { color: var(--success); border-color: rgba(0,255,136,0.3); background: rgba(0,255,136,0.06); }
.fb-badge.local { color: var(--accent); border-color: rgba(0,229,255,0.3); background: rgba(0,229,255,0.06); }
.fb-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ═══════════════════════════════════════════════════════════
   ARRIVED (arrived.html)
═══════════════════════════════════════════════════════════ */
.arrived-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 28px; padding: 40px 32px;
}
.arrived-animation {
  position: relative; width: 140px; height: 140px;
  display: flex; align-items: center; justify-content: center;
}
.arrived-ring {
  position: absolute; border-radius: 50%;
  animation: arrived-expand 1.5s ease-out forwards; opacity: 0;
}
.arrived-ring.r1 { width: 70px;  height: 70px;  border: 2px solid rgba(0,255,136,0.6); animation-delay: 0.1s; }
.arrived-ring.r2 { width: 100px; height: 100px; border: 2px solid rgba(0,255,136,0.35); animation-delay: 0.3s; }
.arrived-ring.r3 { width: 136px; height: 136px; border: 1px solid rgba(0,255,136,0.15); animation-delay: 0.5s; }
@keyframes arrived-expand {
  0%   { transform: scale(0.4); opacity: 0.8; }
  100% { transform: scale(1);   opacity: 0; }
}
.arrived-check {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(0,255,136,0.1); border: 2px solid rgba(0,255,136,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 1;
}
.arrived-check svg { width: 28px; height: 28px; }
.arrived-title { font-size: 26px; font-weight: 800; text-align: center; }
.arrived-sub   { font-size: 14px; color: var(--text2); text-align: center; }

.arrived-stats {
  display: flex; width: 100%;
  background: var(--bg2); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden;
}
.arrived-stat {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 8px; border-right: 1px solid var(--border);
}
.arrived-stat:last-child { border-right: none; }
.a-val   { font-size: 20px; font-weight: 700; color: var(--success); }
.a-label { font-size: 11px; color: var(--text2); text-align: center; }

/* ═══════════════════════════════════════════════════════════
   MISSING / UTILITY CLASSES
═══════════════════════════════════════════════════════════ */
.profile-hero-hint { font-size: 13px; color: var(--text3); text-align: center; }
.profile-label     { font-size: 11px; font-weight: 700; color: var(--text3); letter-spacing: 0.12em; }

/* Active swatch ring (JS sets .active, not .selected) */
.color-swatch.active  { border-color: #fff; transform: scale(1.18); }

/* History stats column in profile.html */
.history-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.history-dist  { font-size: 14px; font-weight: 600; }
.history-mode  { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; padding: 2px 8px; border-radius: 10px; }
.history-mode.gps { background: rgba(0,229,255,0.1);  color: var(--accent); }
.history-mode.ble { background: rgba(255,165,0,0.1);  color: var(--warn); }
.history-mode.uwb { background: rgba(0,255,136,0.1);  color: var(--success); }

/* Home topbar profile button wrapper */
.home-avatar-btn { background: none; padding: 0; }

/* Safe-area bottom for pages without a bottom nav */
.session-body,
.arrived-body,
.tracking-body,
.parking-info,
.overview-panel { padding-bottom: max(20px, calc(16px + env(safe-area-inset-bottom))); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */

/* ── Tablet / desktop: center like a phone ─────────────────── */
@media (min-width: 600px) {
  html {
    background: #050505;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
  }
  body {
    max-width: 430px;
    max-height: 932px;
    border-radius: 24px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 24px 80px rgba(0,0,0,0.8);
  }
  /* Splash rings look odd clipped — extend them */
  .ring-3 { width: 480px; height: 480px; }
}

/* ── Narrow phones (≤ 400px wide — covers SE, 13, 14 standard) */
@media (max-width: 400px) {
  /* PIN digit boxes:  6×44 + dash16 + 5×gap6 = 310px ≤ 320px available ✓ */
  .pd       { width: 44px; height: 56px; font-size: 26px; }
  .pin-row  { gap: 6px; }
  .pin-dash { font-size: 15px; margin: 0 1px; }
}

/* ── Very narrow phones (< 360px wide) ─────────────────────── */
@media (max-width: 359px) {
  .topbar      { padding: 14px 14px 10px; }
  .page-body   { padding: 16px 14px; }
  .session-body { padding: 16px 14px; }

  /* 6×38 + dash14 + 5×4 = 262px ≤ 280px available ✓ */
  .pd       { width: 38px; height: 50px; font-size: 22px; }
  .pin-row  { gap: 4px; }
  .pin-dash { font-size: 13px; margin: 0; }

  .color-swatch   { width: 36px; height: 36px; }
  .color-swatches { gap: 10px; }
}

/* ── Short screens (< 680px tall) ──────────────────────────── */
@media (max-height: 680px) {
  .tracking-body { padding-top: 6px; }
  .arrived-body  { gap: 20px; padding: 24px 28px; }
}

/* ── Very short screens (< 580px tall, e.g. iPhone SE portrait) */
@media (max-height: 580px) {
  .tracking-body   { padding: 4px 20px 8px; }
  .floor-indicator { display: none; }

  .arrived-body      { gap: 10px; padding: 14px 20px; }
  .arrived-animation { width: 90px; height: 90px; }
  .arrived-ring.r1   { width: 44px;  height: 44px; }
  .arrived-ring.r2   { width: 66px;  height: 66px; }
  .arrived-ring.r3   { width: 88px;  height: 88px; }
  .arrived-check     { width: 44px;  height: 44px; }
  .arrived-check svg { width: 20px;  height: 20px; }
  .arrived-title     { font-size: 21px; }
  .a-val             { font-size: 17px; }

  .profile-hero { padding: 14px 0 8px; }
}

/* ── Landscape phone (height < 500px) ─────────────────────── */
@media (orientation: landscape) and (max-height: 500px) {
  .floor-indicator { display: none; }
  .tracking-body   { padding: 2px 20px 6px; }
  .overview-panel  { padding: 10px 16px; gap: 8px; }
  .arrived-body    { gap: 8px; padding: 10px 20px; }
  .arrived-animation { width: 72px; height: 72px; }
  .arrived-ring.r1   { width: 36px; height: 36px; }
  .arrived-ring.r2   { width: 54px; height: 54px; }
  .arrived-ring.r3   { width: 70px; height: 70px; }
  .arrived-check     { width: 38px; height: 38px; }
}
