/* ============================================================
   GPS MAP CAMERA - MODERN RESPONSIVE STYLESHEET (V2)
   Includes Draggable Stamp, Vector Flag, Anti-Burik, & Bulk Modal
   ============================================================ */

:root {
  --bg-dark: #0a0e17;
  --panel-bg: rgba(15, 23, 42, 0.88);
  --panel-border: rgba(255, 255, 255, 0.12);
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

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

body, html {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  user-select: none;
}

/* App Wrapper */
.camera-app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #000;
  overflow: hidden;
}

/* Camera Viewport */
.viewport-container {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

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

/* Grid Overlay - Hidden to prevent visual barriers or clipping confusion */
.grid-overlay {
  display: none !important;
}

/* Top Floating Bar */
.top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 12px) 14px 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.75) 0%, rgba(0,0,0,0) 100%);
  gap: 8px;
}

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

/* Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 5px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 6px currentColor;
  animation: pulse 1.8s infinite;
}
.status-dot.active { background: var(--success); }
.status-dot.manual { background: #38bdf8; }
.status-dot.error { background: var(--danger); }

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Position Quick-Preset Pills */
.pos-btn-group {
  display: inline-flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
  padding: 2px 4px;
}
.pos-pill-btn {
  background: none;
  border: none;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 7px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pos-pill-btn:hover { color: #fff; }
.pos-pill-btn.active {
  background: var(--accent);
  color: #fff;
}

/* Round Action Buttons */
.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.btn-icon:hover {
  background: rgba(30, 41, 59, 0.95);
  transform: translateY(-1px);
}
.btn-icon:active { transform: scale(0.92); }
.btn-icon.active {
  background: var(--accent);
  border-color: #60a5fa;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ============================================================
   LIVE DRAGGABLE HUD OVERLAY (ON TOP OF CAMERA)
   ============================================================ */
.live-hud-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 25;
  overflow: hidden;
}

/* The Draggable Wrapper */
.hud-draggable-box {
  position: absolute;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  transition: transform 0.05s ease-out;
  /* Default position bottom right with padding */
  bottom: 115px;
  right: 14px;
  max-width: 90vw;
}
.hud-draggable-box.dragging {
  cursor: grabbing;
  opacity: 0.92;
  transition: none;
}

/* Top Tabs Attached to the Card (Rotate & GPS Map Camera Badge) */
.hud-top-tabs {
  position: absolute;
  top: -21px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 5;
}

.hud-rotate-tab {
  height: 21px;
  background: rgba(16, 20, 28, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 0 8px;
  color: #38bdf8;
  font-size: 9.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.4);
  transition: all 0.15s ease;
  pointer-events: auto;
}
.hud-rotate-tab:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #fff;
}
.hud-rotate-tab:active {
  transform: scale(0.92);
}

.hud-app-badge {
  position: relative;
  top: 0;
  right: 0;
  height: 21px;
  background: rgba(16, 20, 28, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.hud-badge-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.hud-badge-text {
  font-size: 9.5px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* Mini Google Satellite Map Box */
.hud-map-wrap {
  position: relative;
  width: clamp(96px, 28vw, 125px);
  height: clamp(102px, 30vw, 132px);
  min-width: clamp(96px, 28vw, 125px);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: #1e293b;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}
/* Shown until the real GPS map snapshot is ready */
.hud-map-wrap::before {
  content: 'GPS';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #243447 0%, #141d28 100%);
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
}
.hud-map-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hud-map-img:not([src]) {
  visibility: hidden;
}

/* Blue Direction / Heading Beam */
.hud-heading-beam {
  position: absolute;
  z-index: 2;
  top: 52%;
  left: 50%;
  width: 65px;
  height: 65px;
  background: radial-gradient(circle at 0 0, rgba(66, 133, 244, 0.48) 0%, rgba(66, 133, 244, 0.15) 55%, rgba(66, 133, 244, 0) 75%);
  clip-path: polygon(0 0, 100% 28%, 28% 100%);
  transform: translate(0, 0);
  pointer-events: none;
}

/* Google Red Teardrop Pin */
.hud-map-pin {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -75%);
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.65));
}

/* Google Logo on Bottom of Map */
.hud-google-logo {
  position: absolute;
  z-index: 4;
  bottom: 4px;
  left: 0;
  right: 0;
  text-align: center;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.3px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9), 0 0 6px rgba(0,0,0,0.8);
  pointer-events: none;
}

/* Text Content - ALL CRISP WHITE */
.hud-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  line-height: 1.35;
}

/* Line 1: Headline + Vector Flag */
.hud-headline-row {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
}
.hud-headline-line {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.1px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Vector Indonesian Flag */
.vector-flag-id {
  display: inline-flex;
  flex-direction: column;
  width: 18px;
  height: 12px;
  border-radius: 2px;
  overflow: hidden;
  border: 0.75px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  flex-shrink: 0;
}
.flag-red {
  height: 50%;
  background: #e11d48;
}
.flag-white {
  height: 50%;
  background: #ffffff;
}

/* Line 2: Detailed Address */
.hud-addr-line {
  color: #ffffff;
  font-size: 10.5px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Line 3: Lat & Long */
.hud-coord-line {
  font-weight: 500;
  color: #ffffff;
  font-size: 11px;
}

/* Line 4: Date & Time */
.hud-time-line {
  font-weight: 500;
  color: #ffffff;
  font-size: 11px;
}

/* Line 5: Note */
.hud-note-line {
  color: #ffffff;
  font-size: 10.5px;
}

/* ============================================================
   BOTTOM CONTROLS BAR
   ============================================================ */
.bottom-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  padding: 12px 16px env(safe-area-inset-bottom, 16px);
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.88) 0%, rgba(0,0,0,0) 100%);
  display: flex;
  align-items: center;
  justify-content: space-around;
}

/* Big Shutter Button */
.shutter-btn-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}
.shutter-outer {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  transition: transform 0.15s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.shutter-inner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ffffff;
  transition: all 0.15s ease;
}
.shutter-outer:active { transform: scale(0.92); }
.shutter-outer:active .shutter-inner {
  transform: scale(0.85);
  background: #ef4444;
}

.btn-bottom-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 500;
  opacity: 0.88;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-bottom-action:hover { opacity: 1; }
.btn-bottom-action:active { transform: scale(0.92); }
.btn-bottom-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ============================================================
   MODALS (PREVIEW, BULK, SETTINGS)
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Drawer Dialog */
.drawer-content {
  width: 100%;
  max-width: 620px;
  max-height: 85vh;
  background: #0f172a;
  border-radius: 18px 18px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.8);
}
.modal-overlay.open .drawer-content {
  transform: translateY(0);
}

.drawer-header {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-close-drawer {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
}

.drawer-body {
  padding: 16px 18px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Preview Modal Box */
.preview-modal-box {
  width: 95%;
  max-width: 680px;
  max-height: 92vh;
  background: #0f172a;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 15px 50px rgba(0,0,0,0.9);
}
.preview-img-container {
  flex: 1;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  max-height: 65vh;
}
#previewCanvasOutput {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
  display: block;
}
.preview-actions {
  padding: 12px 16px;
  background: #1e293b;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Bulk Upload Modal Box */
.bulk-modal-box {
  width: 95%;
  max-width: 720px;
  max-height: 90vh;
  background: #0f172a;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.bulk-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}
.bulk-progress-bar {
  width: 100%;
  height: 8px;
  background: #334155;
  border-radius: 4px;
  overflow: hidden;
  margin: 10px 0 14px;
}
.bulk-progress-fill {
  height: 100%;
  background: var(--success);
  width: 0%;
  transition: width 0.25s ease;
}
.bulk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  max-height: 48vh;
  overflow-y: auto;
  padding: 4px;
}
.bulk-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #1e293b;
  aspect-ratio: 4/3;
  cursor: pointer;
  transition: transform 0.15s;
}
.bulk-item:hover { transform: scale(1.02); }
.bulk-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.bulk-item-status {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.75);
  font-size: 10px;
  color: #fff;
  padding: 2px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.bulk-actions {
  padding: 12px 16px;
  background: #1e293b;
  display: flex;
  gap: 10px;
}

/* General Buttons & Forms */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  flex: 1;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  flex: 1;
}

.settings-section {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
}
.section-head {
  font-size: 12.5px;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 10px;
}
.form-group { margin-bottom: 10px; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-weight: 500;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 7px;
  color: #fff;
  padding: 8px 10px;
  font-size: 12.5px;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.toggle-label { font-size: 12.5px; color: #fff; font-weight: 500; }
.toggle-sub { font-size: 10.5px; color: var(--text-muted); }
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 34px;
}
.slider:before {
  position: absolute; content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(20px); }

#mapPickerContainer {
  width: 100%;
  height: 280px;
  border-radius: 8px;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-notice {
  position: fixed;
  top: 65px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.toast-notice.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   CAMERA FALLBACK OVERLAY (MOBILE PERMISSION & ERROR)
   ============================================================ */
.camera-fallback-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 14, 23, 0.94);
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.camera-fallback-card {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 22px 18px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}
.fallback-icon {
  font-size: 38px;
  margin-bottom: 8px;
}
.fallback-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}
.fallback-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
  margin-bottom: 12px;
}
.fallback-guide {
  margin-top: 16px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px;
  text-align: left;
  font-size: 11px;
  color: #cbd5e1;
}
.fallback-guide strong {
  display: block;
  color: #38bdf8;
  margin-bottom: 6px;
}
.fallback-guide ol {
  padding-left: 18px;
  line-height: 1.5;
}
.fallback-guide code {
  background: rgba(0, 0, 0, 0.4);
  color: #fbbf24;
  padding: 1px 5px;
  border-radius: 4px;
}

/* ============================================================
   MOBILE RESPONSIVENESS & PERFORMANCE ENHANCEMENTS
   ============================================================ */
@media (max-width: 600px) {
  /* Disable heavy GPU blur on mobile for smooth 60fps */
  .hud-stamp-card, .status-pill, .btn-icon, .pos-btn-group, .btn-bottom-icon {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .hud-stamp-card {
    background: rgba(15, 20, 28, 0.94);
    padding: 8px 10px;
    gap: 10px;
    width: auto;
    max-width: calc(100vw - 16px);
  }
  .hud-draggable-box {
    bottom: 95px;
    right: 8px;
  }
  /* PROMINENT MOBILE SATELLITE MAP */
  .hud-map-wrap {
    width: 124px;
    height: 128px;
    min-width: 124px;
    border-radius: 10px;
  }
  .hud-headline-line {
    font-size: 12px;
  }
  .hud-addr-line {
    font-size: 9.5px;
    -webkit-line-clamp: 2;
  }
  .hud-coord-line, .hud-time-line {
    font-size: 10px;
  }
  .hud-note-line {
    font-size: 9px;
  }
  .top-bar {
    padding: 8px 10px;
    gap: 5px;
  }
  .status-pill {
    padding: 4px 8px;
    font-size: 10px;
  }
  .btn-icon {
    width: 34px;
    height: 34px;
  }
  .pos-pill-btn {
    padding: 3px 6px;
    font-size: 10px;
  }
  .bottom-bar {
    padding: 10px 12px 14px;
  }
  .shutter-outer {
    width: 62px;
    height: 62px;
  }
  .shutter-inner {
    width: 48px;
    height: 48px;
  }
  .btn-bottom-icon {
    width: 36px;
    height: 36px;
  }
  .btn-bottom-action span {
    font-size: 9.5px;
  }
}

@media (max-width: 480px) {
  .hud-draggable-box {
    bottom: 95px;
    right: 10px;
    max-width: calc(100vw - 16px);
  }
  .hud-stamp-card {
    padding: 7px 9px;
    gap: 8px;
  }
  .hud-map-wrap {
    width: 105px;
    height: 112px;
    min-width: 105px;
  }
  .hud-headline-line {
    font-size: 12.5px;
  }
  .hud-addr-line {
    font-size: 9.5px;
    line-height: 1.25;
  }
  .hud-coord-line, .hud-time-line {
    font-size: 10px;
  }
  .hud-note-line {
    font-size: 9.5px;
  }
  .hud-app-badge {
    top: -19px;
    height: 19px;
    padding: 0 6px;
  }
  .hud-badge-text {
    font-size: 9px;
  }
}

@media (max-width: 370px) {
  .hud-map-wrap {
    width: 90px;
    height: 98px;
    min-width: 90px;
  }
  .hud-stamp-card {
    padding: 6px 7px;
    gap: 7px;
  }
  .hud-headline-line {
    font-size: 11px;
  }
  .hud-addr-line {
    font-size: 8.5px;
  }
  .hud-coord-line, .hud-time-line {
    font-size: 9px;
  }
  .hud-note-line {
    font-size: 8.5px;
  }
}

/* Horizontal / Landscape Mode on Mobile */
@media (orientation: landscape) and (max-height: 540px), (max-height: 500px) {
  .top-bar {
    padding: 6px 14px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(0,0,0,0) 100%);
  }
  .btn-icon {
    width: 32px;
    height: 32px;
  }
  .status-pill {
    padding: 3px 8px;
    font-size: 10px;
  }
  .pos-pill-btn {
    padding: 2px 5px;
    font-size: 9.5px;
  }
  .bottom-bar {
    padding: 6px 16px 10px;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, rgba(0,0,0,0) 100%);
  }
  .shutter-outer {
    width: 54px;
    height: 54px;
  }
  .shutter-inner {
    width: 42px;
    height: 42px;
  }
  .btn-bottom-icon {
    width: 34px;
    height: 34px;
  }
  .btn-bottom-action span {
    font-size: 8.5px;
  }
  .hud-draggable-box {
    bottom: 72px;
    right: 12px;
    max-width: calc(100vw - 24px);
  }
  .hud-stamp-card {
    padding: 6px 8px;
    gap: 7px;
    border-radius: 10px;
  }
  .hud-map-wrap {
    width: 88px;
    height: 94px;
    min-width: 88px;
  }
  .hud-headline-line {
    font-size: 11px;
  }
  .hud-addr-line {
    font-size: 8.5px;
    line-height: 1.2;
  }
  .hud-coord-line, .hud-time-line {
    font-size: 8.5px;
  }
  .hud-note-line {
    font-size: 8px;
  }
  .hud-app-badge {
    top: -18px;
    height: 18px;
    padding: 0 5px;
  }
  .hud-badge-text {
    font-size: 8.5px;
  }
  .hud-drag-handle {
    font-size: 9px;
    margin-bottom: 2px;
  }
}

/* ============================================================
   ROTATION & TILT CONTROLS IN SETTINGS
   ============================================================ */
.btn-group-rotation {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 6px;
}
.btn-rot-pill {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}
.btn-rot-pill:hover {
  background: rgba(51, 65, 85, 0.85);
  color: #fff;
}
.btn-rot-pill.active {
  background: var(--accent);
  border-color: #60a5fa;
  color: #fff;
  box-shadow: 0 0 10px var(--accent-glow);
}
.form-range {
  width: 100%;
  accent-color: #38bdf8;
  cursor: pointer;
}

/* ============================================================
   GLOBAL MODERN GLASSMORPHIC LOADING OVERLAY & SPINNER
   ============================================================ */
.global-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: none !important;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
}
.global-loading-overlay.active {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
}
.global-loading-card {
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  max-width: 290px;
  text-align: center;
  transform: scale(0.92);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.global-loading-overlay.active .global-loading-card {
  transform: scale(1);
}
.loading-spinner-ring {
  width: 44px;
  height: 44px;
  border: 3.5px solid rgba(255, 255, 255, 0.15);
  border-top-color: #3b82f6;
  border-right-color: #60a5fa;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
}
.loading-subtitle {
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.35;
}
