:root {
  --bg: #060f09;
  --bg-gradient: radial-gradient(circle at 50% 0%, #0e2417 0%, #030805 100%);
  --panel: rgba(15, 32, 22, 0.78);
  --panel-solid: #0d2115;
  --card-border: rgba(16, 185, 129, 0.18);
  --text: #f4faf5;
  --muted: #92a89a;
  --accent: #10b981;              /* Rich jewel emerald */
  --accent-light: #34d399;
  --accent-glow: rgba(16, 185, 129, 0.3);
  --accent-dark: #047857;
  --amber: #f59e0b;               /* Golden sunlit amber */
  --amber-light: #fbbf24;
  --amber-glow: rgba(245, 158, 11, 0.35);
  --gold: #f59e0b;
  --danger: #f87171;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* Ambient Bioluminescent Forest Spores */
.ambient-spores {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.spore {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  animation: sporeDrift 18s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.spore.s1 { left: 10%; bottom: -10px; width: 4px; height: 4px; background: #34d399; box-shadow: 0 0 8px #34d399; animation-duration: 18s; animation-delay: 0s; }
.spore.s2 { left: 25%; bottom: -10px; width: 3px; height: 3px; background: #fbbf24; box-shadow: 0 0 6px #fbbf24; animation-duration: 22s; animation-delay: 3s; }
.spore.s3 { left: 45%; bottom: -10px; width: 5px; height: 5px; background: #10b981; box-shadow: 0 0 10px #10b981; animation-duration: 16s; animation-delay: 7s; }
.spore.s4 { left: 65%; bottom: -10px; width: 3px; height: 3px; background: #f59e0b; box-shadow: 0 0 7px #f59e0b; animation-duration: 20s; animation-delay: 2s; }
.spore.s5 { left: 80%; bottom: -10px; width: 4px; height: 4px; background: #6ee7b7; box-shadow: 0 0 9px #6ee7b7; animation-duration: 19s; animation-delay: 5s; }
.spore.s6 { left: 90%; bottom: -10px; width: 3px; height: 3px; background: #fde68a; box-shadow: 0 0 6px #fde68a; animation-duration: 24s; animation-delay: 9s; }
.spore.s7 { left: 35%; bottom: -10px; width: 4px; height: 4px; background: #a7f3d0; box-shadow: 0 0 8px #a7f3d0; animation-duration: 17s; animation-delay: 11s; }
.spore.s8 { left: 55%; bottom: -10px; width: 3px; height: 3px; background: #fbbf24; box-shadow: 0 0 6px #fbbf24; animation-duration: 21s; animation-delay: 13s; }

@keyframes sporeDrift {
  0% { transform: translate3d(0, 0, 0); opacity: 0; }
  15% { opacity: 0.65; }
  50% { transform: translate3d(25px, -50vh, 0); opacity: 0.85; }
  85% { opacity: 0.5; }
  100% { transform: translate3d(-15px, -105vh, 0); opacity: 0; }
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: rgba(10, 22, 15, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border);
}

.header-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  display: flex;
  align-items: center;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #a7f3d0 0%, #10b981 60%, var(--amber-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.trainer-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.28);
  font-size: 13px;
  font-weight: 600;
  color: #fef3c7;
}

/* Main Container */
main {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 100px;
  transition: max-width 0.25s ease;
}

.view {
  display: none;
  animation: fadeIn 0.2s ease-out;
}

.view.active {
  display: block;
}

.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Welcome Screen */
.welcome-hero {
  text-align: center;
  padding: 28px 10px 20px;
}

.welcome-icon-wrap {
  display: inline-flex;
  padding: 16px;
  border-radius: 28px;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.2);
  box-shadow: 0 0 24px var(--accent-glow);
  margin-bottom: 16px;
}

.welcome-hero h2 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 10px;
  letter-spacing: -0.5px;
}

.welcome-lead {
  color: var(--muted);
  font-size: 15px;
  margin: 0 auto 20px;
  max-width: 340px;
}

.feature-pills {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.pill {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cce3d4;
}

.welcome-card {
  margin-top: 10px;
}

/* Card Surfaces */
.card {
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

/* Inputs & Form Elements */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

input, select {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: rgba(6, 15, 10, 0.85);
  border: 1px solid rgba(74, 222, 128, 0.22);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-top: 6px;
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Buttons */
button {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:active {
  transform: scale(0.97);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

button.primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #f4faf5;
  font-weight: 700;
  box-shadow: 0 4px 18px var(--accent-glow);
}

button.primary:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: 0 6px 22px var(--accent-glow);
}

button.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.12);
}

button.glass-btn {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--card-border);
}

button.danger-btn {
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.full-width {
  width: 100%;
}

.row {
  display: flex;
  gap: 10px;
  margin: 12px 0;
}

.row > button {
  flex: 1;
}

/* Camera Viewfinder */
.camera {
  position: relative;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 5;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--card-border);
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#cam-msg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-weight: 500;
  background: radial-gradient(circle at center, #112017 0%, #08110b 100%);
  z-index: 1;
}

/* Viewfinder Overlay */
.viewfinder-overlay {
  position: absolute;
  inset: 16px;
  pointer-events: none;
  z-index: 2;
}

.corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: rgba(245, 158, 11, 0.85);
  border-style: solid;
  border-width: 0;
  filter: drop-shadow(0 0 5px var(--amber-glow));
  animation: cornerBreathe 3.5s ease-in-out infinite alternate;
}

@keyframes cornerBreathe {
  0% { opacity: 0.75; transform: scale(0.97); }
  100% { opacity: 1; transform: scale(1.03); filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.6)); }
}

.corner.tl { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 6px; }
.corner.tr { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 6px; }
.corner.bl { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 6px; }
.corner.br { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 6px; }

.lens-status {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.55);
  padding: 4px 10px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}

.lens-status.active {
  color: var(--amber-light);
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
  animation: lensGlow 2.5s ease-in-out infinite alternate;
}

@keyframes lensGlow {
  0% { opacity: 0.75; }
  100% { opacity: 1; }
}

/* Controls Bar */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 12px;
  gap: 14px;
}

.controls-bar > button.glass-btn {
  flex: 1;
  height: 52px;
}

/* Shutter Button */
.shutter-btn {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: transparent;
  border: 4px solid var(--amber-light);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--amber-glow);
  cursor: pointer;
  flex-shrink: 0;
}

.shutter-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  transition: transform 0.1s ease;
}

.shutter-btn:not(:disabled):hover .shutter-inner {
  transform: scale(0.92);
}

.shutter-btn:disabled {
  opacity: 0.35;
  box-shadow: none;
}

/* Status Card */
.status-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(18, 36, 25, 0.5);
  border: 1px solid var(--card-border);
  margin-bottom: 12px;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  flex-shrink: 0;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  line-height: 1.4;
}

/* Result Card */
.result-card {
  margin-top: 14px;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.result-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.badge-open-model {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.15);
  color: var(--accent);
  border: 1px solid rgba(74, 222, 128, 0.25);
}

.result-media {
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 14px;
  max-height: 240px;
}

.result-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: block;
}

#guesses {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.guess-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.guess-pill .score-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(74, 222, 128, 0.16);
  padding: 2px 6px;
  border-radius: 999px;
}

.guess-pill.on {
  background: var(--accent);
  color: #06170c;
  border-color: var(--accent);
  box-shadow: 0 2px 10px var(--accent-glow);
}

.guess-pill.on .score-badge {
  background: rgba(0, 0, 0, 0.2);
  color: #06170c;
}

/* Collection View */
.collection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.collection-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.collection-count-badge {
  font-size: 12px;
  font-weight: 700;
  color: #a7f3d0;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.24);
  padding: 4px 10px;
  border-radius: 999px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs button {
  padding: 7px 14px;
  font-size: 13px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  color: var(--muted);
}

.tabs button.on {
  background: var(--accent);
  color: #06170c;
  border-color: var(--accent);
  font-weight: 700;
  box-shadow: 0 2px 14px var(--accent-glow);
}

/* Journal Sorting Bar */
.journal-sort-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0 16px;
  padding: 6px 12px;
  background: rgba(15, 32, 22, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  gap: 10px;
  flex-wrap: wrap;
}

.sort-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sort-pills {
  display: flex;
  gap: 6px;
}

.sort-btn {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sort-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.sort-btn:active {
  transform: scale(0.92);
}

.sort-btn.on {
  background: rgba(245, 158, 11, 0.15);
  color: #fef3c7;
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

/* Collection Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.tile {
  position: relative;
  background: var(--panel-solid);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  transform-style: preserve-3d;
  perspective: 600px;
  transition: transform 0.22s cubic-bezier(0.2, 0, 0.2, 1), box-shadow 0.22s ease, border-color 0.22s ease;
  will-change: transform;
  animation: tileEntrance 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.tile:hover {
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55), 0 0 16px rgba(16, 185, 129, 0.25);
  border-color: rgba(52, 211, 153, 0.45);
}

.tile:active {
  transform: scale(0.96) !important;
}

.tile-sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at var(--sheen-x, 50%) var(--sheen-y, 50%), rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 65%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 4;
}

.tile:hover .tile-sheen {
  opacity: 1;
}

@keyframes tileEntrance {
  from { opacity: 0; transform: translateY(16px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile .tile-chip {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  color: #fff;
  z-index: 2;
}

.tile .tile-scrim {
  position: absolute;
  inset: auto 0 0 0;
  padding: 24px 10px 8px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
  z-index: 2;
}

.tile b {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

/* Map & Territory */
.edge-banner {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 12px;
  animation: slideDown 0.25s ease-out;
}

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

.edge-banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.edge-banner-icon {
  font-size: 16px;
}

.edge-banner-text {
  font-size: 13px;
  font-weight: 600;
  color: #fef08a;
  line-height: 1.35;
}

.edge-banner-actions {
  display: flex;
  gap: 8px;
}

.edge-btn {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.primary-edge {
  background: var(--amber);
  color: #06110a;
  border: none;
}

.secondary-edge {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.map-wrapper {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--card-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  margin-bottom: 14px;
  aspect-ratio: 1;
}

.map-wrapper:fullscreen,
.map-wrapper.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border: none !important;
  z-index: 99999 !important;
  margin: 0 !important;
  box-shadow: none !important;
}

.maplibre-base {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #06110a;
}

canvas#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 2;
  touch-action: none;
}

.map-attribution {
  position: absolute;
  bottom: 6px;
  left: 10px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(0, 0, 0, 0.65);
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 10;
  pointer-events: none;
}

.map-overlay-controls {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.fab-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(14, 28, 20, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.gps-chip {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.gps-chip::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  transition: all 0.25s ease;
}

.gps-chip.active {
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
}

.gps-chip.active::before {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: gpsPulse 1.8s ease-in-out infinite;
}

@keyframes gpsPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.7); opacity: 0.4; }
}

/* Modals & Offline Maps UI */
.privacy-notice {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 12px 0 16px;
  font-size: 13px;
  line-height: 1.45;
}

.privacy-notice b {
  color: #a7f3d0;
  display: block;
  margin-bottom: 4px;
}

.privacy-notice p {
  margin: 0;
  color: var(--muted);
}

.consent-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.consent-icon {
  font-size: 24px;
}

.consent-desc {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 12px;
}

.dl-estimate {
  font-size: 12px;
  font-weight: 600;
  color: var(--amber-light);
  margin-top: 4px;
}

.dl-upgrade-hint {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #34d399;
  line-height: 1.4;
}

.dl-upgrade-hint.hidden {
  display: none;
}

.dl-progress-box {
  margin: 14px 0;
}

.dl-progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.dl-progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #f59e0b);
  border-radius: 999px;
  transition: width 0.15s ease;
}

.dl-progress-status {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.storage-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
}

.storage-quota-hint {
  font-size: 11px;
  color: var(--muted);
}

.regions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  max-height: 240px;
  overflow-y: auto;
}

.region-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
}

.region-info b {
  display: block;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}

.region-info small {
  font-size: 11px;
  color: var(--muted);
}

.maps-manager-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.file-import-btn {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.uncharted-toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(245, 158, 11, 0.95);
  color: #061009;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 999px;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
  z-index: 1000;
  animation: toastFade 2.5s ease-out forwards;
  pointer-events: none;
}

@keyframes toastFade {
  0% { opacity: 0; transform: translate(-50%, -10px); }
  15% { opacity: 1; transform: translate(-50%, 0); }
  80% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -10px); }
}

/* Stats Grid */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transform-style: preserve-3d;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  will-change: transform;
}

.stat:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 12px rgba(16, 185, 129, 0.2);
  border-color: rgba(52, 211, 153, 0.4);
}

.stat b {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.stat span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.hint-card {
  background: rgba(18, 36, 25, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 12px 0;
}

.data-actions {
  margin-top: 18px;
}

/* Detail Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-sheet {
  position: relative;
  background: #0d1e15;
  border: 1px solid var(--card-border);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px 20px 34px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.7);
  animation: modalUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  font-size: 22px;
  color: var(--muted);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
}

.modal-image-wrap {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  margin-bottom: 14px;
  background: #000;
}

.modal-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.75);
  color: var(--accent);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.modal-content h3 {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 14px;
}

.modal-meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 18px;
}

.meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.meta-label {
  color: var(--muted);
}

.meta-value {
  font-weight: 600;
  color: var(--text);
}

/* Bottom Navigation Dock */
nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(12px, env(safe-area-inset-bottom, 12px));
  width: calc(100% - 24px);
  max-width: 440px;
  display: flex;
  gap: 8px;
  padding: 8px;
  background: rgba(13, 27, 19, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
  z-index: 40;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  cursor: pointer;
}

.nav-item:active {
  transform: scale(0.92);
}

.nav-icon {
  font-size: 18px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item.on .nav-icon {
  transform: scale(1.15);
}

.nav-item.on {
  background: rgba(16, 185, 129, 0.18);
  color: #a7f3d0;
  border: 1px solid rgba(52, 211, 153, 0.35);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.3), inset 0 0 8px rgba(16, 185, 129, 0.2);
}

/* ==========================================================================
   Cinematic Splash Intro Screen (Sarvam-Style Fluid Portal)
   ========================================================================== */
.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #0f2619 0%, #050d08 100%);
  cursor: pointer;
  overflow: hidden;
  transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1), transform 0.45s cubic-bezier(0.4, 0, 0.2, 1), filter 0.45s ease, visibility 0.45s ease;
}

.intro-screen.fade-out {
  opacity: 0;
  transform: scale(1.05);
  filter: blur(8px);
  visibility: hidden;
  pointer-events: none;
}

.intro-orb {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 45%, rgba(245, 158, 11, 0.22) 0%, rgba(16, 185, 129, 0.28) 50%, transparent 72%);
  filter: blur(40px);
  animation: orbBreathe 2s ease-in-out infinite alternate;
  pointer-events: none;
}

.intro-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
}

.intro-title {
  margin: 0;
  font-size: 46px;
  font-weight: 800;
  letter-spacing: -0.6px;
  background: linear-gradient(110deg, #ffffff 10%, #fef08a 35%, #10b981 65%, #f59e0b 90%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titleSheen 1.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.intro-tagline {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
  opacity: 0.95;
  animation: taglineSlide 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

@keyframes orbBreathe {
  0% { transform: scale(0.9); opacity: 0.7; }
  100% { transform: scale(1.15); opacity: 1; }
}

@keyframes titleSheen {
  0% {
    opacity: 0;
    transform: scale(0.94) translateY(12px);
    background-position: 100% 0;
    filter: blur(6px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    background-position: 0% 0;
    filter: blur(0);
  }
}

@keyframes taglineSlide {
  0% { opacity: 0; transform: translateY(8px); letter-spacing: 4.5px; }
  100% { opacity: 0.92; transform: translateY(0); letter-spacing: 3px; }
}

/* ==========================================================================
   Responsive Tablet & Laptop / Desktop Dashboard (min-width: 768px)
   ========================================================================== */
@media (min-width: 768px) {
  /* Main Container expansion */
  main {
    max-width: 1040px;
    padding: 28px 24px 130px;
  }

  /* Welcome Screen layout on Desktop */
  .welcome-hero {
    padding: 48px 24px 32px;
  }
  .welcome-hero h2 {
    font-size: 34px;
  }
  .welcome-lead {
    font-size: 16px;
    max-width: 480px;
  }
  .welcome-card {
    max-width: 460px;
    margin: 0 auto;
  }

  /* Scanner / Capture Split View */
  .capture-layout-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 28px;
    align-items: start;
  }
  .camera {
    margin-bottom: 0;
    max-height: 480px;
  }
  .scanner-side-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  /* Field Guide Collection Responsive Gallery */
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
  }
  .tabs {
    justify-content: flex-start;
    gap: 10px;
  }
  .tabs button {
    padding: 8px 16px;
    font-size: 13px;
  }

  /* Territory Map: Split Cockpit Dashboard */
  .map-layout-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 28px;
    align-items: start;
  }
  .map-wrapper {
    margin-bottom: 0;
    min-height: 480px;
    height: 100%;
    aspect-ratio: auto;
  }
  .map-sidebar {
    display: flex;
    flex-direction: column;
  }
  .stats {
    margin: 14px 0;
  }

  /* Desktop Navigation Dock: Sleek Horizontal Pills */
  nav {
    bottom: 24px;
    max-width: 500px;
    padding: 8px 14px;
    gap: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
  }
  .nav-item {
    flex-direction: row;
    gap: 8px;
    padding: 10px 18px;
    font-size: 13px;
  }
  .nav-icon {
    font-size: 18px;
  }

  /* Modals: Centered Dialog Cards instead of Bottom Sheets */
  .modal-backdrop {
    align-items: center;
    padding: 24px;
  }
  .modal-sheet {
    max-width: 520px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--card-border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
    padding: 24px;
    animation: modalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .modal-image-wrap {
    max-height: 280px;
  }
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
