/* ============================================================
   CloudSource — Design System
   Aesthetic: Dark atmospheric, weather-station industrial
   ============================================================ */

:root {
  /* Core palette — deep navy to electric cyan */
  --bg-base: #0b1120;
  --bg-surface: #111827;
  --bg-elevated: #1a2435;
  --bg-glass: rgba(17, 24, 39, 0.88);
  --border: rgba(148, 210, 242, 0.1);
  --border-focus: rgba(56, 189, 248, 0.4);

  /* Text */
  --text-primary: #e8edf5;
  --text-secondary: #8899b0;
  --text-muted: #546380;

  /* Accents */
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.25);
  --accent-warm: #f59e0b;
  --accent-danger: #ef4444;
  --accent-success: #34d399;

  /* Condition colors */
  --c-clear: #fbbf24;
  --c-cloudy: #94a3b8;
  --c-partly: #a3c4e0;
  --c-light-rain: #60a5fa;
  --c-heavy-rain: #3b82f6;
  --c-storm: #8b5cf6;
  --c-snow: #e0e7ff;
  --c-fog: #6b7280;
  --c-wind: #14b8a6;
  --c-other: #f472b6;

  /* Typography */
  --font-display: 'Anybody', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  /* Spacing */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;

  /* Z layers */
  --z-map: 1;
  --z-ui: 100;
  --z-modal: 500;
  --z-toast: 900;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea {
  font-family: var(--font-body);
  color: var(--text-primary);
}

/* ── Map ── */
#map {
  position: absolute;
  inset: 0;
  z-index: var(--z-map);
}

/* Override Leaflet tiles for dark theme */
.leaflet-tile-pane { filter: brightness(0.7) contrast(1.1) saturate(0.3) hue-rotate(180deg) invert(1); }
.leaflet-control-attribution { display: none; }
.leaflet-control-zoom {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden;
}
.leaflet-control-zoom a {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border-bottom-color: var(--border) !important;
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 18px !important;
}

/* ── Top Bar ── */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-ui);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top, 12px));
  background: linear-gradient(to bottom, var(--bg-base), transparent);
  pointer-events: none;
}

#top-bar > * { pointer-events: auto; }

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  font-size: 24px;
  color: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

#conditions-temp {
  font-weight: 600;
  color: var(--text-primary);
}

/* ── FAB ── */
#fab-report {
  position: fixed;
  bottom: 100px;
  right: 16px;
  z-index: var(--z-ui);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px var(--accent-glow), 0 0 40px rgba(56, 189, 248, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#fab-report:active {
  transform: scale(0.92);
}

/* ── Profile Button ── */
#btn-profile {
  position: fixed;
  bottom: 100px;
  left: 16px;
  z-index: var(--z-ui);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

#btn-profile:active {
  background: var(--bg-elevated);
  color: var(--accent);
}

/* ── Help Button ── */
#btn-help {
  position: fixed;
  bottom: 152px;
  left: 16px;
  z-index: var(--z-ui);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

#btn-help:active {
  background: var(--bg-elevated);
  color: var(--accent);
}

/* ── Timeline Panel ── */
#timeline-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-ui);
  padding: 12px 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  background: linear-gradient(to top, var(--bg-base) 60%, transparent);
}

#timeline-summary {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-align: center;
  min-height: 16px;
}

#timeline-track {
  position: relative;
}

#timeline-scrub {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-elevated);
  outline: none;
  direction: rtl; /* 0 = now (right), 120 = 2h ago (left) */
}

#timeline-scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  cursor: grab;
}

#timeline-scrub::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  cursor: grab;
  border: none;
}

#timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Modals ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: opacity 0.25s ease;
}

.hidden {
  display: none !important;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  padding: 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
  border: 1px solid var(--border);
  border-bottom: none;
  animation: slideUp 0.3s ease;
}

.modal-sheet-sm {
  max-height: 70vh;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--text-muted);
  margin: 0 auto 16px;
}

.modal-sheet h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  margin-bottom: 16px;
}

/* ── Report Form ── */
#photo-section {
  margin-bottom: 16px;
}

#btn-camera {
  width: 100%;
  padding: 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 14px;
  transition: all 0.2s ease;
}

#btn-camera:active {
  border-color: var(--accent);
  color: var(--accent);
}

#photo-preview {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-top: 8px;
}

.field-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  margin-top: 12px;
}

.char-count {
  font-weight: 400;
  color: var(--text-muted);
}

#condition-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.condition-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.condition-btn .cond-icon {
  font-size: 20px;
}

.condition-btn.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--text-primary);
}

#intensity-bar {
  margin-bottom: 4px;
}

#intensity-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent), var(--accent-warm), var(--accent-danger));
  outline: none;
}

#intensity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  cursor: grab;
}

#intensity-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  cursor: grab;
  border: none;
}

#intensity-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

#report-note {
  width: 100%;
  height: 60px;
  resize: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

#report-note:focus {
  border-color: var(--border-focus);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn-primary {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #818cf8);
  color: white;
  font-weight: 600;
  font-size: 14px;
  transition: opacity 0.2s ease;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary:active:not(:disabled) {
  opacity: 0.8;
}

.btn-secondary {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
}

.btn-danger {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--accent-danger);
  color: var(--accent-danger);
  font-weight: 600;
  font-size: 14px;
}

.btn-danger:active {
  background: rgba(239, 68, 68, 0.25);
}

/* ── Report Detail ── */
#detail-photo {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 12px;
}

#detail-condition {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 4px;
}

#detail-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

#detail-note {
  font-size: 14px;
  margin-bottom: 8px;
  line-height: 1.4;
}

#detail-note:empty { display: none; }

.user-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}

.badge-trusted { background: rgba(52, 211, 153, 0.15); color: var(--accent-success); }
.badge-expert { background: rgba(245, 158, 11, 0.15); color: var(--accent-warm); }

#detail-votes {
  display: flex;
  gap: 8px;
}

.vote-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.vote-btn:active {
  background: var(--bg-elevated);
}

.vote-btn.voted-confirm {
  border-color: var(--accent-success);
  color: var(--accent-success);
  background: rgba(52, 211, 153, 0.08);
}

.vote-btn.voted-deny {
  border-color: var(--accent-danger);
  color: var(--accent-danger);
  background: rgba(239, 68, 68, 0.08);
}

.vote-count {
  opacity: 0.6;
  font-size: 12px;
}

.vote-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.vote-btn:disabled:active {
  background: none;
}

.vote-message {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
  min-height: 16px;
}

/* ── Auth / Profile ── */
.auth-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.4;
}

#auth-email {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 14px;
  outline: none;
  margin-bottom: 12px;
}

#auth-email:focus { border-color: var(--border-focus); }

.auth-status {
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  min-height: 20px;
}

.auth-status.success { color: var(--accent-success); }
.auth-status.error { color: var(--accent-danger); }

#profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

#profile-level-badge {
  flex-shrink: 0;
}

#profile-info h2 {
  font-size: 18px;
  margin-bottom: 2px;
}

#profile-rep {
  font-size: 13px;
  color: var(--text-secondary);
}

#profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.stat-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  color: var(--accent);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

#profile-achievements h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.achievement {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.achievement:last-child { border-bottom: none; }

.achievement-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.achievement-name {
  font-weight: 600;
  color: var(--text-primary);
}

.achievement-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.achievement.locked {
  opacity: 0.35;
}

/* ── Toast ── */
#toast-container {
  position: fixed;
  top: max(70px, calc(env(safe-area-inset-top, 12px) + 60px));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.toast.success { border-color: var(--accent-success); }
.toast.error { border-color: var(--accent-danger); }

@keyframes toastIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-10px); }
}

/* ── Map markers (custom) ── */
.report-marker {
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.report-marker:hover {
  transform: scale(1.2);
}

/* ── Loading state ── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

/* ── Geolocation Overlay ── */
.geo-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}

.geo-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.geo-content {
  text-align: center;
  padding: 32px;
  max-width: 340px;
}

.geo-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 16px;
}

.geo-content h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  margin-bottom: 8px;
}

.geo-content p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* TODO: REMOVE BEFORE PRODUCTION — zip code fallback */
.geo-zip {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.geo-zip-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.geo-zip-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.geo-zip-row input {
  width: 100px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 16px;
  text-align: center;
  outline: none;
  color: var(--text-primary);
}

.geo-zip-row input:focus {
  border-color: var(--border-focus);
}

/* ── Radar Toggle ── */
.radar-btn {
  position: fixed;
  top: max(60px, calc(env(safe-area-inset-top, 12px) + 52px));
  right: 16px;
  z-index: var(--z-ui);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.radar-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── GPS Retry Banner ── */
.gps-retry-banner {
  position: fixed;
  top: max(90px, calc(env(safe-area-inset-top, 12px) + 82px));
  right: 16px;
  z-index: var(--z-ui);
  padding: 8px 14px;
  background: rgba(245, 158, 11, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--accent-warm);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-warm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.gps-retry-banner:active {
  background: rgba(245, 158, 11, 0.3);
}

/* ── Profile Edit ── */
.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.edit-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.edit-btn:active {
  color: var(--accent);
  background: var(--accent-glow);
}

.name-edit-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.name-edit-row input {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 14px;
  outline: none;
}

.name-edit-row input:focus {
  border-color: var(--border-focus);
}

.btn-sm {
  padding: 8px 12px;
  font-size: 12px;
  flex-shrink: 0;
}

/* ── Stats XP sub-label ── */
.stat-xp {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

#profile-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

/* ── Photo Flag Button ── */
.detail-photo-wrap {
  position: relative;
}

.flag-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: var(--text-secondary);
  font-size: 11px;
  transition: all 0.15s ease;
}

.flag-btn:active {
  background: rgba(239, 68, 68, 0.3);
  color: var(--accent-danger);
}

/* ── Photo GPS Indicator ── */
.photo-gps {
  font-size: 11px;
  color: var(--accent-success);
  margin-top: 6px;
  padding: 4px 8px;
  background: rgba(52, 211, 153, 0.08);
  border-radius: var(--radius-sm);
}

/* ── Profile Tabs ── */
.profile-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 14px;
}

.tab-btn {
  flex: 1;
  padding: 8px 4px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  transition: all 0.15s ease;
}

.tab-btn.active {
  background: var(--accent);
  color: var(--bg-base);
}

.tab-content {
  min-height: 120px;
}

/* ── Level Hero (current level display) ── */
.level-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  margin-bottom: 14px;
  border: 1px solid var(--border);
}

.level-hero-badge {
  font-size: 36px;
  line-height: 1;
}

.level-hero-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
}

.level-hero-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── XP Progress Bar ── */
.xp-bar-wrap {
  margin-bottom: 16px;
}

.xp-bar-track {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  transition: width 0.5s ease;
}

.xp-bar-community {
  background: linear-gradient(90deg, var(--accent-success), #14b8a6);
}

.xp-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── XP Breakdown ── */
.xp-breakdown {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 12px;
  border: 1px solid var(--border);
}

.xp-breakdown h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.xp-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  color: var(--text-secondary);
}

.xp-row span:last-child {
  color: var(--accent);
  font-weight: 600;
}

.xp-row.total {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 8px;
  color: var(--text-primary);
}

.xp-row.total span:last-child {
  color: var(--accent-warm);
}

/* ── Level List ── */
.level-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.level-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  position: relative;
}

.level-row.locked {
  opacity: 0.35;
}

.level-row-badge {
  font-size: 20px;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.level-row-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.level-row-title {
  font-size: 13px;
  font-weight: 500;
}

.level-row-xp {
  font-size: 11px;
  color: var(--text-muted);
}

.level-you {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 2px 6px;
  border-radius: 8px;
  flex-shrink: 0;
}

/* ── XP Float Animation ── */
.xp-float {
  position: fixed;
  pointer-events: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  z-index: 9999;
  animation: xpRise 1.2s ease-out forwards;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transform: translateX(-50%);
}

.xp-float-report { color: var(--accent); }
.xp-float-community { color: var(--accent-success); }

@keyframes xpRise {
  0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) translateY(-40px) scale(1.2); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-70px) scale(0.8); }
}

/* ── Photo Flagged (mod mode) ── */
.photo-flagged {
  border: 3px solid var(--accent-danger) !important;
  opacity: 0.7;
}

.flag-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-danger);
  margin-left: 2px;
}

.flag-count:empty { display: none; }

/* ── Mod Mode Toggle ── */
.mod-section {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.mod-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.mod-toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-warm);
  cursor: pointer;
}

.mod-label {
  font-size: 14px;
  font-weight: 600;
}

.mod-warning {
  font-size: 11px;
  color: var(--accent-warm);
  margin-top: 6px;
  line-height: 1.4;
}

/* ── Attributions ── */
.attributions,
.help-attributions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.attribution-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.attribution-list {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Help Modal ── */
.help-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.help-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.help-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}

.help-item strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.help-item p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.help-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ── Avatar Badge ── */
.avatar-badge {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  color: white;
  position: relative;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.avatar-rank-icon {
  position: absolute;
  bottom: -2px;
  right: -2px;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

/* Small avatar in detail view */
#detail-user {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

#detail-user .avatar-badge {
  flex-shrink: 0;
}

/* ── Daily Challenges ── */
#daily-challenges {
  margin-bottom: 14px;
}

#daily-challenges h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.challenge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.challenge-row.challenge-done {
  opacity: 0.5;
  border-color: var(--accent-success);
}

.challenge-text {
  font-size: 13px;
  flex: 1;
}

.challenge-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  margin-left: 8px;
}

.challenge-done .challenge-status {
  color: var(--accent-success);
}

.challenge-hint {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
}
