* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
#cesiumContainer { width: 100%; height: 100%; }

/* Hide default Cesium branding */
.cesium-viewer-bottom { display: none !important; }

/* ========================================
   Design Tokens
   ======================================== */
:root {
  /* Colors */
  --panel-bg: rgba(15, 23, 42, 0.92);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text-color: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #f97316;
  --accent-light: #fb923c;
  --accent-dark: #ea580c;
  --accent-glow: rgba(249, 115, 22, 0.4);
  --btn-bg: rgba(255, 255, 255, 0.08);
  --btn-border: rgba(255, 255, 255, 0.12);
  --btn-hover: rgba(255, 255, 255, 0.15);
  --btn-active-bg: var(--accent);
  --btn-active-text: #ffffff;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.35);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;
}

/* Body scroll lock when popup/menu is open */
body.scroll-locked {
  overflow: hidden;
}

/* ========================================
   Animations
   ======================================== */
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes popupOpen {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 20px 4px var(--accent-glow); }
}

/* ========================================
   Loading Overlay
   ======================================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s;
}
.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.loading-globe {
  position: relative;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulseGlow 2s ease-in-out infinite;
  border-radius: 50%;
}
.loading-spinner {
  width: 56px;
  height: 56px;
  border: 3px solid rgba(249, 115, 22, 0.2);
  border-top-color: var(--accent);
  border-right-color: var(--accent-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading-text {
  color: var(--accent);
  margin-top: 24px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  animation: pulse 2s ease-in-out infinite;
}


/* ========================================
   Hamburger Button (mobile only)
   ======================================== */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 15px;
  right: 15px;
  z-index: 200;
  width: 44px;
  height: 44px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(16px);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition-fast);
}
.hamburger-btn:active {
  background: var(--btn-hover);
}
.hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-color);
  border-radius: 1px;
  transition: all var(--transition-normal);
}
.hamburger-btn.active .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger-btn.active .hamburger-line:nth-child(2) {
  opacity: 0;
}
.hamburger-btn.active .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile overlay */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 149;
  opacity: 0;
  transition: opacity var(--transition-normal);
}
.mobile-overlay.visible {
  opacity: 1;
}

/* ========================================
   Control Panel — Desktop
   ======================================== */
.control-panel {
  position: fixed;
  top: 15px;
  right: 15px;
  background: var(--panel-bg);
  color: var(--text-color);
  padding: 10px;
  border-radius: var(--radius-md);
  z-index: 150;
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-md);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  max-width: 640px;
  animation: slideInDown 0.4s ease;
}
.control-panel-header {
  display: none;
}
.control-panel-buttons {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}
.control-group-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  padding-left: 2px;
}
.control-group-btns {
  display: flex;
  gap: 4px;
}
.control-divider {
  width: 1px;
  height: 20px;
  background: var(--btn-border);
}
.control-panel .btn {
  padding: 8px 14px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--text-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition-fast);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.control-panel .btn svg {
  flex-shrink: 0;
  opacity: 0.7;
}
.control-panel .btn:hover {
  background: var(--btn-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.control-panel .btn:hover svg {
  opacity: 1;
}
.control-panel .btn:active {
  transform: scale(0.95);
}
.control-panel .btn.active {
  background: var(--btn-active-bg);
  color: var(--btn-active-text);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.control-panel .btn.active svg {
  opacity: 1;
}

/* Filter select dropdown */
.filter-select {
  padding: 8px 14px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--text-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition-fast);
  outline: none;
}
.filter-select:hover {
  background: var(--btn-hover);
}
.filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.15);
}
.filter-select option {
  background: #1e293b;
  color: var(--text-color);
}


/* ========================================
   Video Popup
   ======================================== */
.video-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}
.video-popup.visible {
  display: flex;
}
.video-popup.visible .popup-content {
  animation: popupOpen 0.3s ease forwards;
}

.popup-content {
  background: var(--panel-bg);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 800px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-lg);
  position: relative;
}

.popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  color: var(--text-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  z-index: 10;
}
.popup-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}
.popup-close:active {
  transform: scale(0.95);
}

.popup-header {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  padding: 20px 24px;
  padding-right: 56px;
}
.popup-header h2 {
  color: white;
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}
.popup-header p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  margin: 4px 0 0 0;
}

.video-container {
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
}
.video-container iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
}

.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: white;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  z-index: 10;
}
.nav-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-50%) scale(1.1);
}
.nav-btn:active {
  transform: translateY(-50%) scale(0.95);
}
.nav-btn.prev { left: 12px; }
.nav-btn.next { right: 12px; }

.video-counter {
  text-align: center;
  padding: 12px;
  color: var(--text-muted);
  font-size: 13px;
  background: rgba(0, 0, 0, 0.3);
}

/* Video settings in popup */
.video-settings {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--panel-border);
}
.setting-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  user-select: none;
}
.setting-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 36px;
  height: 20px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.setting-toggle input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition-fast);
}
.setting-toggle input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.setting-toggle input[type="checkbox"]:checked::before {
  left: 18px;
  background: white;
}
.setting-toggle:hover span {
  color: var(--text-color);
}

/* ========================================
   Search Panel
   ======================================== */
.search-panel {
  position: fixed;
  top: 15px;
  left: 15px;
  width: 400px;
  max-height: calc(100vh - 30px);
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
  color: var(--text-color);
  border-radius: var(--radius-lg);
  z-index: 100;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideInLeft 0.5s ease 0.1s both;
}

.search-header {
  padding: 14px 16px 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.search-title {
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
.search-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.search-stats .stat-value {
  color: var(--accent);
  font-weight: 700;
}
.stat-dot {
  width: 3px;
  height: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  opacity: 0.5;
}

/* Drag handle (mobile only) */
.search-drag-handle {
  display: none;
}

.search-input-container {
  display: flex;
  gap: 10px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#searchInput {
  flex: 1;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  outline: none;
  transition: all 0.3s ease;
}
#searchInput::placeholder {
  color: rgba(148, 163, 184, 0.7);
}
#searchInput:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.search-btn {
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border: none;
  color: white;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}
.search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}
.search-btn:active {
  transform: translateY(0) scale(0.95);
}
.search-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
}
.search-results::-webkit-scrollbar {
  width: 6px;
}
.search-results::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}
.search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}
.search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.search-placeholder {
  color: var(--text-muted);
  text-align: center;
  padding: 30px 20px;
  font-size: 13px;
  line-height: 1.6;
}
.suggestion-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}
.suggestion-pill {
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.25);
  color: var(--accent-light);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  white-space: nowrap;
}
.suggestion-pill:hover {
  background: rgba(249, 115, 22, 0.2);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.15);
}
.suggestion-pill:active {
  transform: scale(0.95);
}

.search-loading,
.search-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--accent-light);
  font-size: 12px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.15), rgba(234, 88, 12, 0.1));
  font-weight: 500;
  position: sticky;
  top: -16px;
  z-index: 10;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(249, 115, 22, 0.2);
  margin: -16px -16px 16px -16px;
}
.search-loading {
  justify-content: center;
  padding: 30px;
  border-bottom: none;
  background: transparent;
  position: static;
  margin: 0;
}
.search-loading .spinner,
.search-status .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(249, 115, 22, 0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.search-error {
  color: #fca5a5;
  padding: 16px;
  background: rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-md);
  font-size: 13px;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.search-answer,
.search-answer-stable,
.search-answer-live {
  color: var(--text-color);
}
.search-answer {
  animation: fadeIn 0.3s ease;
}
.search-answer p,
.search-answer-stable p,
.search-answer-live p {
  margin-bottom: 12px;
  line-height: 1.7;
}
.search-answer p:last-child,
.search-answer-stable p:last-child,
.search-answer-live p:last-child {
  margin-bottom: 0;
}

/* Section headers */
.search-answer .section-header,
.search-answer-stable .section-header,
.search-answer-live .section-header {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-light);
  margin: 20px 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(249, 115, 22, 0.2);
}
.search-answer .section-header:first-child,
.search-answer-stable .section-header:first-child,
.search-answer-live .section-header:first-child {
  margin-top: 0;
}

/* Content lists */
.search-answer .content-list,
.search-answer-stable .content-list,
.search-answer-live .content-list {
  margin: 0 0 16px 0;
  padding-left: 0;
  list-style: none;
}
.search-answer .content-list li,
.search-answer-stable .content-list li,
.search-answer-live .content-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  line-height: 1.6;
}
.search-answer .content-list li::before,
.search-answer-stable .content-list li::before,
.search-answer-live .content-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

/* ========================================
   Inline Video Cards
   ======================================== */
.inline-video-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.12), rgba(234, 88, 12, 0.06));
  border: 1px solid rgba(249, 115, 22, 0.25);
  border-radius: 8px;
  padding: 8px;
  margin: 10px 0;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.inline-video-card:hover {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(234, 88, 12, 0.12));
  border-color: var(--accent);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.15);
}

.inline-video-thumb {
  position: relative;
  width: 72px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.4);
}
.inline-video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.inline-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  background: rgba(249, 115, 22, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.inline-video-card:hover .inline-video-play {
  transform: translate(-50%, -50%) scale(1.15);
}
.inline-video-play svg {
  width: 9px;
  height: 9px;
  margin-left: 1px;
  fill: white;
}

.inline-video-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.inline-video-location {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-light);
}

.inline-video-time {
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
}

/* Bottom resize handle (desktop) */
.search-resize-handle {
  display: flex;
  justify-content: center;
  padding: 4px 0;
  cursor: ns-resize;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}
.search-resize-handle:hover {
  background: rgba(255, 255, 255, 0.05);
}
.search-resize-handle span {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  display: block;
  transition: background var(--transition-fast);
}
.search-resize-handle:hover span {
  background: rgba(255, 255, 255, 0.3);
}
.search-panel.resizing {
  transition: none !important;
  user-select: none;
}

/* Clear search button */
.search-clear-btn {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  align-self: center;
}
.search-clear-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* Response toggle (collapsible) */
.search-response-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  cursor: pointer;
  user-select: none;
  background: rgba(249, 115, 22, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background var(--transition-fast);
}
.search-response-toggle:hover {
  background: rgba(249, 115, 22, 0.14);
}
.search-response-toggle .toggle-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-light);
}
.search-response-toggle .toggle-chevron {
  transition: transform var(--transition-normal);
  color: var(--accent-light);
}
.search-response-toggle.collapsed .toggle-chevron {
  transform: rotate(-90deg);
}

/* Collapsed state hides results */
.search-results.collapsed {
  display: none !important;
}

/* Streaming cursor animation */
.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 16px;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.6s infinite;
}


/* ========================================
   Responsive — Tablet / Large Phone
   ======================================== */
@media (max-width: 768px) {
  /* Show hamburger */
  .hamburger-btn {
    display: flex;
  }

  /* Search header: compact on mobile */
  .search-header {
    padding: 10px 14px 0;
  }
  .search-title {
    font-size: 13px;
  }
  .search-stats {
    font-size: 10px;
  }

  /* Control panel becomes bottom sheet */
  .control-panel {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 0;
    flex-direction: column;
    gap: 0;
    transform: translateY(100%);
    transition: transform var(--transition-normal);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.4);
  }
  .control-panel.open {
    transform: translateY(0);
  }

  .control-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--panel-border);
    font-weight: 600;
    font-size: 15px;
    color: var(--text-color);
  }
  .control-panel-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background var(--transition-fast);
  }
  .control-panel-close:active {
    background: var(--btn-bg);
  }

  .control-panel-buttons {
    display: flex;
    flex-direction: column;
    padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
    gap: 16px;
  }

  .control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .control-group-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
  }
  .control-group-btns {
    display: flex;
    gap: 8px;
  }

  .control-divider {
    width: 100%;
    height: 1px;
    background: var(--panel-border);
  }

  .control-panel .btn {
    flex: 1;
    justify-content: center;
    padding: 12px 14px;
    min-height: 44px;
    font-size: 13px;
  }

  .filter-select {
    width: 100%;
    padding: 12px 14px;
    min-height: 44px;
    font-size: 13px;
  }

  /* Search panel: collapsed bottom bar by default, expands on focus */
  .search-panel {
    width: 100%;
    left: 0;
    top: auto;
    bottom: 0;
    max-height: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: slideInUp 0.4s ease;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
  }
  .search-panel .search-results {
    display: none;
  }
  .search-panel.expanded {
    max-height: 55vh;
    overflow: hidden;
  }
  .search-panel.expanded .search-results {
    display: block;
  }
  .search-resize-handle {
    display: none;
  }
  .search-drag-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 6px;
    cursor: grab;
  }
  .search-drag-handle span {
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    display: block;
  }

  .search-panel.expanded {
    transition: max-height 0.15s ease-out;
  }
  .search-panel.dragging {
    transition: none !important;
  }

  .search-input-container {
    padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
  }
  .search-panel.expanded .search-input-container {
    padding-bottom: 10px;
  }
  #searchInput {
    min-height: 44px;
    font-size: 16px; /* Prevent iOS zoom */
  }
  .search-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .inline-video-thumb {
    width: 60px;
    height: 34px;
  }
  .inline-video-location {
    font-size: 11px;
  }

  /* Video popup: full-screen on mobile */
  .video-popup {
    align-items: flex-start;
    justify-content: flex-start;
  }
  .popup-content {
    width: 100%;
    max-width: 100%;
    height: 100%;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }
  .popup-close {
    width: 44px;
    height: 44px;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.5);
  }
  .popup-header {
    padding: 16px 20px;
    padding-right: 56px;
  }
  .popup-header h2 {
    font-size: 18px;
  }
  .video-container {
    flex: 1;
    min-height: 0;
  }
  .video-container iframe {
    height: 100%;
    aspect-ratio: auto;
  }
  .nav-btn {
    width: 44px;
    height: 44px;
    opacity: 0.7;
  }
  .nav-btn.prev { left: 8px; }
  .nav-btn.next { right: 8px; }

  .video-settings {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }
  .setting-toggle {
    min-height: 44px;
  }
}


/* ========================================
   Responsive — Small Phone
   ======================================== */
@media (max-width: 480px) {
  .info-panel {
    top: 8px;
    left: 8px;
    padding: 8px 12px;
  }
  .info-panel h1 {
    font-size: 13px;
  }
  .stats-inline {
    font-size: 10px;
  }

  .hamburger-btn {
    top: 8px;
    right: 8px;
  }

  .search-panel {
    max-height: 60vh;
  }
  .search-input-container {
    padding: 8px 10px 12px;
  }
  .search-results {
    padding: 12px;
  }

  .popup-header {
    padding: 12px 16px;
    padding-right: 56px;
  }
  .popup-header h2 {
    font-size: 16px;
  }
  .popup-header p {
    font-size: 12px;
  }

  .video-settings {
    gap: 8px;
    padding: 10px 12px;
  }
  .setting-toggle {
    font-size: 11px;
  }

  .control-panel .btn {
    font-size: 12px;
    padding: 10px 12px;
  }
}
