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

:root {
  --blue: #4fa8f7;
  --blue-dim: #1a6fd6;
  --blue-vivid: #2196F3;
  --blue-glow: rgba(79,168,247,0.18);
  --blue-glow-strong: rgba(79,168,247,0.35);
  --bg: #071e3d;
  --bg2: #0c2a52;
  --bg3: #112f5c;
  --surface: rgba(255,255,255,0.06);
  --surface2: rgba(255,255,255,0.11);
  --border: rgba(79,168,247,0.18);
  --text: #ddeeff;
  --text-dim: #7aa0cc;
  --red: #ff4466;
  --yellow: #ffd700;
  --green: #00e676;
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Inter', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: calc(56px + var(--safe-top));
  --banner-h: 0px;
  --nav-h: calc(62px + var(--safe-bottom));
}

html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.hidden { display: none !important; }

/* ── Splash ─────────────────────────────────────────────────────────────────── */
.splash {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 48px;
}
.splash-logo { text-align: center; }
.splash-icon { font-size: 72px; animation: float 2s ease-in-out infinite; }
.splash-title {
  font-size: 2.5rem; font-weight: 900; letter-spacing: -1px;
  background: linear-gradient(135deg, var(--blue), #60c8ff);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-top: 8px;
}
.splash-sub { color: var(--text-dim); font-size: 1rem; margin-top: 4px; }
.splash-loader { width: 200px; height: 3px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.loader-bar {
  height: 100%; width: 40%; border-radius: 99px;
  background: linear-gradient(90deg, var(--blue), #60c8ff);
  animation: slide 1.2s ease-in-out infinite;
}
@keyframes slide { 0%{transform:translateX(-100%)} 100%{transform:translateX(350%)} }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }

/* ── App Shell ──────────────────────────────────────────────────────────────── */
.app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* ── Header ─────────────────────────────────────────────────────────────────── */
.header {
  height: var(--header-h);
  padding-top: var(--safe-top);
  padding-left: 16px; padding-right: 16px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(7,30,61,0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; z-index: 100;
}
.header-left, .header-right { display: flex; align-items: center; gap: 10px; }
.header-logo { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.3px; }
.btn-icon {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.btn-icon:hover { background: var(--surface2); }

/* ── Offline Banner (persistent) ───────────────────────────────────────────── */
.offline-banner-bar {
  background: rgba(255,68,102,0.15);
  border-bottom: 1px solid rgba(255,68,102,0.35);
  color: var(--red);
  padding: 8px 16px;
  display: flex; align-items: center; gap: 8px;
  font-size: .85rem; font-weight: 600;
  flex-shrink: 0; z-index: 99;
  animation: slideDown .3s ease;
}
@keyframes slideDown { from{transform:translateY(-100%)} to{transform:translateY(0)} }
.offline-banner-icon { font-size: 1rem; }
.offline-badge {
  margin-left: auto;
  background: var(--red); color: white;
  font-size: .75rem; font-weight: 700;
  padding: 2px 8px; border-radius: 99px;
}

/* Badge online/offline */
.badge { display: flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 99px; font-size: .75rem; font-weight: 600; }
.badge-online { background: rgba(0,230,118,.12); color: var(--green); border: 1px solid rgba(0,230,118,.25); }
.badge-offline { background: rgba(255,68,102,.12); color: var(--red); border: 1px solid rgba(255,68,102,.25); }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── Side Nav ───────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}
.sidenav {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 201;
  width: min(280px, 85vw);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding-top: var(--safe-top);
  animation: slideRight .25s cubic-bezier(.25,.46,.45,.94);
}
@keyframes slideRight { from{transform:translateX(-100%)} to{transform:translateX(0)} }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.sidenav-header { padding: 24px 20px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--border); }
.sidenav-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #60c8ff);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.3rem; color: var(--bg); flex-shrink: 0;
}
.sidenav-username { font-weight: 700; font-size: 1rem; }
.sidenav-role { color: var(--blue); font-size: .8rem; font-weight: 600; margin-top: 2px; }
.sidenav-links { flex: 1; padding: 12px 12px; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  width: 100%; text-align: left; padding: 12px 16px; border-radius: var(--radius-sm);
  background: transparent; border: none; color: var(--text); font-size: .95rem;
  cursor: pointer; transition: background .15s, color .15s;
}
.nav-link:hover, .nav-link.active { background: var(--blue-glow); color: var(--blue); }
.sidenav-footer { padding: 16px 20px; border-top: 1px solid var(--border); }
.points-display { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; font-weight: 700; color: var(--yellow); }

/* ── Main ───────────────────────────────────────────────────────────────────── */
.main {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--nav-h);
}
.view { min-height: 100%; }

/* ── Bottom Nav ─────────────────────────────────────────────────────────────── */
.bottom-nav {
  height: var(--nav-h);
  padding-bottom: var(--safe-bottom);
  background: rgba(7,30,61,.95); backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-around;
  padding-top: 8px; flex-shrink: 0;
}
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; color: var(--text-dim);
  font-size: .75rem; cursor: pointer; padding: 4px 16px; border-radius: 10px;
  transition: color .15s;
}
.bottom-nav-item span { font-size: 1.4rem; }
.bottom-nav-item.active { color: var(--blue); }

/* ── Glass Card ─────────────────────────────────────────────────────────────── */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}

/* ── Auth ───────────────────────────────────────────────────────────────────── */
.auth-container {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px 16px; padding-top: calc(var(--safe-top) + 24px);
  background: radial-gradient(ellipse at 50% 0%, rgba(79,168,247,.1) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 80%, rgba(32,112,255,.07) 0%, transparent 50%),
              var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px;
  padding: 36px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
}
.auth-logo { font-size: 3rem; text-align: center; margin-bottom: 12px; }
.auth-title { font-size: 1.8rem; font-weight: 900; text-align: center; letter-spacing: -0.5px; }
.auth-sub { color: var(--text-dim); text-align: center; margin-top: 4px; margin-bottom: 28px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-switch { text-align: center; color: var(--text-dim); font-size: .9rem; margin-top: 20px; }

/* Role picker */
.role-picker { margin-top: 4px; }
.role-label { font-size: .85rem; font-weight: 600; color: var(--text-dim); margin-bottom: 10px; }
.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-card { cursor: pointer; }
.role-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.role-card-inner {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 10px; border-radius: var(--radius-sm);
  border: 2px solid var(--border); background: var(--surface);
  transition: border-color .2s, background .2s; text-align: center;
}
.role-card input:checked + .role-card-inner {
  border-color: var(--blue); background: var(--blue-glow);
}
.role-icon { font-size: 1.8rem; }
.role-card strong { font-size: .9rem; }
.role-card small { color: var(--text-dim); font-size: .75rem; line-height: 1.3; }

/* ── Form elements ─────────────────────────────────────────────────────────── */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: .85rem; font-weight: 600; color: var(--text-dim); }
.input-group input, .input-group textarea, .input-group select {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  color: var(--text); font-family: var(--font); font-size: 1rem;
  outline: none; transition: border-color .2s;
  -webkit-appearance: none;
}
.input-group input:focus, .input-group textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-glow);
}
.input-group textarea { resize: vertical; min-height: 70px; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px; border-radius: var(--radius-sm);
  font-family: var(--font); font-weight: 600; font-size: 1rem;
  border: none; cursor: pointer; transition: all .2s;
  -webkit-appearance: none;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--blue-dim));
  color: white; box-shadow: 0 4px 20px rgba(79,168,247,.3);
}
.btn-primary:not(:disabled):hover {
  transform: translateY(-1px); box-shadow: 0 6px 28px rgba(79,168,247,.45);
}
.btn-primary:not(:disabled):active { transform: translateY(0); }
.btn-secondary {
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg3); }
.btn-sm { padding: 8px 16px; font-size: .85rem; }
.link-btn { background: none; border: none; color: var(--blue); font-weight: 600; cursor: pointer; font-size: inherit; }

/* ── Feedback ──────────────────────────────────────────────────────────────── */
.form-error {
  background: rgba(255,68,102,.1); border: 1px solid rgba(255,68,102,.3);
  color: var(--red); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .9rem;
}
.form-success {
  background: rgba(0,230,118,.1); border: 1px solid rgba(0,230,118,.3);
  color: var(--green); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .9rem;
}

/* ── Home ──────────────────────────────────────────────────────────────────── */
.home-hero {
  min-height: 38vh; display: flex; flex-direction: column; justify-content: center;
  align-items: center; text-align: center; padding: 40px 24px 24px;
  background: radial-gradient(ellipse at 50% 0%, rgba(79,168,247,.14) 0%, transparent 65%);
}
.home-greeting h2 { font-size: 2rem; font-weight: 900; letter-spacing: -0.5px; }
.home-greeting p { color: var(--text-dim); margin-top: 6px; font-size: 1rem; }
.home-stats { margin-top: 28px; padding: 20px 40px; display: flex; gap: 40px; }
.stat-item { text-align: center; }
.stat-value { display: block; font-size: 2.2rem; font-weight: 900; color: var(--blue); }
.stat-label { font-size: .8rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }
.home-actions { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.home-action-card {
  padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  cursor: pointer; transition: border-color .2s, background .2s;
}
.home-action-card:hover { border-color: var(--blue); background: var(--surface2); }
.action-icon { font-size: 2.2rem; }
.action-title { font-weight: 700; font-size: 1.05rem; }
.action-sub { color: var(--text-dim); font-size: .85rem; margin-top: 2px; }

/* ── Page header ───────────────────────────────────────────────────────────── */
.page-header { padding: 28px 20px 16px; }
.page-title { font-size: 1.6rem; font-weight: 900; letter-spacing: -0.3px; }
.page-sub { color: var(--text-dim); margin-top: 4px; font-size: .9rem; }

/* ── Create Cache ──────────────────────────────────────────────────────────── */
.create-steps { margin: 0 16px 24px; padding: 20px; display: flex; flex-direction: column; gap: 24px; }
.step { display: flex; flex-direction: column; gap: 12px; }
.step-header { display: flex; align-items: center; gap: 10px; }
.step-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--blue-glow); border: 2px solid var(--blue);
  color: var(--blue); font-weight: 700; font-size: .85rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.step-title { font-weight: 700; flex: 1; }
.step-status { font-size: .8rem; color: var(--text-dim); }
.location-result { display: flex; align-items: center; gap: 8px; color: var(--blue); font-size: .9rem; }

.camera-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 24px; border: 2px dashed var(--border); border-radius: var(--radius);
  cursor: pointer; transition: border-color .2s, background .2s;
  color: var(--text-dim); text-align: center;
}
.camera-btn:hover { border-color: var(--blue); background: var(--blue-glow); color: var(--blue); }
.camera-icon { font-size: 2rem; }
.photo-preview { position: relative; border-radius: var(--radius); overflow: hidden; }
.photo-preview img { width: 100%; max-height: 240px; object-fit: cover; display: block; }
.btn-retake {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,.7); border: none; color: white;
  padding: 6px 12px; border-radius: 99px; cursor: pointer; font-size: .85rem;
}

/* ── Card list ─────────────────────────────────────────────────────────────── */
.card-list { padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.cache-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; gap: 0; align-items: stretch;
  cursor: pointer; transition: border-color .2s, transform .15s;
}
.cache-card:hover { border-color: var(--blue); transform: translateY(-1px); }
.cache-card-thumb {
  width: 80px; flex-shrink: 0; background: var(--bg3);
  display: flex; align-items: center; justify-content: center; font-size: 2rem;
}
.cache-card-thumb img { width: 80px; height: 100%; object-fit: cover; display: block; }
.cache-card-body { flex: 1; padding: 14px; }
.cache-card-title { font-weight: 700; font-size: .95rem; }
.cache-card-meta { color: var(--text-dim); font-size: .8rem; margin-top: 4px; }
.cache-card-dist { font-size: .85rem; font-weight: 600; color: var(--blue); margin-top: 6px; }
.cache-card-arrow { display: flex; align-items: center; padding-right: 14px; color: var(--text-dim); }
.empty-state { text-align: center; padding: 60px 24px; color: var(--text-dim); }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }

.loading-spinner { display: flex; justify-content: center; padding: 40px; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--surface2); border-top-color: var(--blue);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Explore ───────────────────────────────────────────────────────────────── */
.explore-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 20px 8px; }
.location-bar { margin: 8px 16px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.location-status-text { font-size: .85rem; color: var(--text-dim); }

/* ── Map ───────────────────────────────────────────────────────────────────── */
.map-container { position: relative; margin: 0 16px; border-radius: var(--radius); overflow: hidden; }
#map { height: 320px; width: 100%; background: var(--bg3); }
.map-hint {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  padding: 6px 14px; font-size: .8rem; white-space: nowrap; pointer-events: none;
  color: var(--text-dim);
}

/* ── Detail ────────────────────────────────────────────────────────────────── */
.detail-header { display: flex; align-items: center; gap: 12px; padding: 20px 16px 12px; }
.detail-photo-wrapper {
  margin: 0 16px 12px;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
}
.detail-photo-label {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  background: rgba(0,0,0,.65); backdrop-filter: blur(6px);
  color: white; font-size: .8rem; font-weight: 600;
  padding: 4px 10px; border-radius: 99px;
}
.detail-cache-photo { width: 100%; max-height: 280px; object-fit: cover; display: block; }
.detail-info { margin: 12px 16px; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.detail-row { display: flex; justify-content: space-between; align-items: center; }
.detail-row span { color: var(--text-dim); font-size: .9rem; }
.validation-zone { margin: 12px 16px 24px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.validation-title { font-size: 1.1rem; font-weight: 700; }
.validation-sub { color: var(--text-dim); font-size: .9rem; }

/* ── Leaderboard offline animation ─────────────────────────────────────────── */
.lb-offline {
  display: flex; flex-direction: column; align-items: center;
  padding: 52px 24px 40px; text-align: center; gap: 12px;
}
.lb-offline-icon {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.lb-trophy-anim {
  font-size: 4.5rem; display: block;
  animation: trophyFloat 2.4s ease-in-out infinite, trophyGlow 2.4s ease-in-out infinite;
}
@keyframes trophyFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}
@keyframes trophyGlow {
  0%, 100% { filter: drop-shadow(0 0 14px rgba(255,215,0,.65)); opacity: 1; }
  50%       { filter: drop-shadow(0 0 0px transparent); opacity: 0.55; }
}

/* Signal bars cascade (3 bars blinking red) */
.lb-signal-bars {
  display: flex; align-items: flex-end; gap: 5px; height: 22px;
}
.bar {
  width: 6px; border-radius: 3px;
  background: var(--text-dim);
  animation: barFlicker 1.6s ease-in-out infinite;
}
.b1 { height: 8px;  animation-delay: 0s; }
.b2 { height: 14px; animation-delay: 0.22s; }
.b3 { height: 22px; animation-delay: 0.44s; }
@keyframes barFlicker {
  0%, 100% { background: var(--text-dim); opacity: 0.25; }
  50%       { background: var(--red);      opacity: 1; }
}

.lb-offline-title { font-size: 1.25rem; font-weight: 700; }
.lb-offline-sub { font-size: .9rem; color: var(--text-dim); line-height: 1.6; }
.lb-retry-btn { margin-top: 10px; }

/* ── Leaderboard ───────────────────────────────────────────────────────────── */
.leaderboard-container { padding: 8px 16px 24px; display: flex; flex-direction: column; gap: 8px; }
.lb-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  transition: border-color .15s;
}
.lb-item.top-1 { border-color: var(--yellow); background: rgba(255,215,0,.07); }
.lb-item.top-2 { border-color: #b0b8c4; background: rgba(176,184,196,.06); }
.lb-item.top-3 { border-color: #cd7f32; background: rgba(205,127,50,.07); }
.lb-item.me { border-color: var(--blue); background: var(--blue-glow); }
.lb-rank { font-size: 1.3rem; width: 32px; text-align: center; flex-shrink: 0; }
.lb-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #60c8ff);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; color: var(--bg); flex-shrink: 0;
}
.lb-info { flex: 1; }
.lb-name { font-weight: 700; }
.lb-count { font-size: .8rem; color: var(--text-dim); margin-top: 2px; }
.lb-points { font-weight: 900; font-size: 1.1rem; color: var(--yellow); }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: calc(var(--nav-h) + 12px); left: 50%; transform: translateX(-50%);
  z-index: 9000; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; width: calc(100% - 32px); max-width: 400px;
}
.toast {
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 500; text-align: center;
  animation: toastIn .3s cubic-bezier(.25,.46,.45,.94);
  pointer-events: all;
}
.toast-success { background: var(--green); color: #071e3d; }
.toast-error { background: var(--red); color: white; }
.toast-info { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
@keyframes toastIn { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }

/* ── Leaflet overrides (dark blue map) ────────────────────────────────────── */
.leaflet-container { background: var(--bg3); }
.leaflet-tile { filter: brightness(.7) saturate(.6) hue-rotate(195deg); }
.leaflet-popup-content-wrapper { background: var(--bg2); color: var(--text); border: 1px solid var(--border); }
.leaflet-popup-tip { background: var(--bg2); }

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 99px; }

/* ── Profile ──────────────────────────────────────────────────────────────── */
.profile-hero {
  text-align: center;
  padding: 32px 20px 20px;
  background: radial-gradient(ellipse at 50% 0%, rgba(79,168,247,.12) 0%, transparent 60%);
}
.profile-avatar-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 16px;
}
.profile-avatar {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #60c8ff);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--bg);
  box-shadow: 0 12px 32px rgba(79,168,247,.4);
  overflow: hidden;
  border: 3px solid rgba(255,255,255,.1);
}
.profile-avatar-initial { font-size: 3.2rem; }
.profile-avatar-img {
  width: 100%; height: 100%; object-fit: cover;
}
.profile-avatar-edit {
  position: absolute; bottom: 4px; right: 4px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--blue); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  border: 3px solid var(--bg);
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
  transition: transform .15s;
}
.profile-avatar-edit:hover { transform: scale(1.08); }
.profile-avatar-edit:active { transform: scale(.95); }
.profile-username {
  font-size: 1.5rem; font-weight: 800; margin: 0 0 4px;
}
.profile-role {
  color: var(--blue); font-size: .9rem; font-weight: 600; margin: 0;
}
.profile-stats {
  display: flex; justify-content: space-around;
  margin: 0 16px 16px; padding: 18px 14px;
}
.profile-stat {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex: 1;
}
.profile-stat-value {
  font-size: 1.6rem; font-weight: 800; color: var(--blue);
}
.profile-stat-label {
  font-size: .75rem; color: var(--text-dim);
}
.profile-section {
  margin: 0 16px 16px; padding: 18px;
}
.profile-section-title {
  font-size: .95rem; font-weight: 700; margin: 0 0 14px;
  color: var(--text);
}
.profile-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; font-size: .9rem;
}
.profile-row + .profile-row { border-top: 1px solid var(--border); }
.profile-row-label { color: var(--text-dim); }
.profile-row-value { font-weight: 600; }
.profile-form .input-group { margin-bottom: 12px; }

/* Header avatar */
.header-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.15);
  cursor: pointer;
}

/* Sidenav avatar image */
.sidenav-avatar img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
}

/* ── Offline mini badge ────────────────────────────────────────────────────── */
.badge-offline-mini {
  display: inline-block; font-size: .7rem;
  background: rgba(79,168,247,.18); color: var(--blue);
  padding: 1px 6px; border-radius: 8px; margin-left: 4px;
  vertical-align: middle;
}

/* ── World Map View ────────────────────────────────────────────────────────── */
.world-map-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
}
.map-status-text {
  font-size: .85rem; color: var(--text-dim);
  background: var(--surface); padding: 4px 10px; border-radius: 12px;
  border: 1px solid var(--border);
}
.world-map-wrapper {
  position: relative;
  height: calc(100vh - 220px); min-height: 400px;
  margin: 0 16px 16px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.world-map { width: 100%; height: 100%; }
.world-map-toolbar {
  position: absolute; top: 10px; right: 10px; z-index: 401;
  display: flex; flex-direction: column; gap: 6px;
}
.map-tool-btn {
  background: rgba(7,30,61,.92); color: var(--text);
  border: 1px solid var(--border);
  width: 42px; height: 42px;
  border-radius: 10px; font-size: 1rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  backdrop-filter: blur(10px);
  transition: background .15s, transform .1s;
}
.map-tool-btn:hover { background: var(--blue-glow); color: var(--blue); }
.map-tool-btn:active { transform: scale(.95); }
.map-tool-btn.map-tool-primary {
  width: auto; padding: 0 14px; font-weight: 600; font-size: .85rem;
  background: var(--blue); color: var(--bg); border-color: var(--blue);
}
.map-tool-btn.map-tool-primary:hover { background: #60c8ff; color: var(--bg); }
.map-select-hint {
  position: absolute; top: 10px; left: 10px; right: 70px; z-index: 401;
  background: rgba(79,168,247,.95); color: var(--bg);
  padding: 8px 12px; border-radius: 10px;
  font-size: .85rem; font-weight: 600; text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.world-map-legend {
  position: absolute; bottom: 10px; left: 10px; z-index: 401;
  padding: 8px 12px;
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: .75rem;
}
.world-map-legend i {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; vertical-align: middle; margin-right: 4px;
  border: 2px solid white;
}
body.map-select-mode .world-map { cursor: crosshair !important; }
body.map-select-mode .leaflet-container { cursor: crosshair !important; }

/* Popup style Leaflet pour la carte mondiale */
.world-map .leaflet-popup-content-wrapper {
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
}
.world-map .leaflet-popup-tip { background: var(--bg2); }

/* ── iOS Install Modal ─────────────────────────────────────────────────────── */
.ios-install-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px;
  padding-bottom: calc(var(--safe-bottom) + 16px);
  animation: fadeIn .25s ease;
}
.ios-install-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.65); backdrop-filter: blur(6px);
}
.ios-install-card {
  position: relative;
  width: 100%; max-width: 420px;
  padding: 24px 22px 20px;
  border-radius: 22px;
  animation: slideUp .35s cubic-bezier(.25,.46,.45,.94);
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.ios-install-header { text-align: center; margin-bottom: 18px; }
.ios-install-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--blue), #60c8ff);
  border-radius: 16px; font-size: 1.8rem; margin-bottom: 10px;
  box-shadow: 0 8px 24px rgba(79,168,247,.35);
}
.ios-install-header h2 { font-size: 1.25rem; font-weight: 800; margin: 0 0 6px; }
.ios-install-sub { color: var(--text-dim); font-size: .9rem; line-height: 1.45; margin: 0; }
.ios-install-steps {
  list-style: none; padding: 0; margin: 0 0 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.ios-install-steps li {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  background: var(--surface2, rgba(255,255,255,.04));
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: .92rem; line-height: 1.4;
}
.ios-step-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  background: var(--blue); color: var(--bg);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
}
.ios-share-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  background: rgba(79,168,247,.18);
  color: var(--blue);
  border-radius: 6px;
  vertical-align: middle; margin: 0 2px;
}
.ios-install-actions {
  display: flex; gap: 10px;
}
.ios-install-actions .btn { flex: 1; }
