/* =========================================================
   WebLUT — Pro Camera
   iOS 26 Liquid Glass inspired UI
   CACHE_VERSION: v6.8.0
   ========================================================= */

:root {
  --bg: #000000;
  --text: #f0f0f5;
  --text-dim: rgba(240, 240, 245, 0.55);
  --text-muted: rgba(240, 240, 245, 0.3);
  --accent: #5b8aff;
  --accent-glow: rgba(91, 138, 255, 0.25);
  --accent-warm: #f5c842;

  /* Liquid Glass tokens */
  --glass-bg: rgba(120, 120, 140, 0.18);
  --glass-bg-heavy: rgba(80, 80, 100, 0.35);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-light: rgba(255, 255, 255, 0.06);
  --glass-blur: blur(40px);
  --glass-blur-light: blur(20px);
  --glass-shadow: 0 2px 20px rgba(0, 0, 0, 0.25), 0 0 0 0.5px rgba(255, 255, 255, 0.08) inset;
  --glass-shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4), 0 0 0 0.5px rgba(255, 255, 255, 0.1) inset;

  --panel-w: 280px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* === Reset === */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════
   VIEWFINDER
   ═══════════════════════════════════════════════════ */

#viewfinder-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 1;
}

#viewfinder {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s var(--ease-spring);
}

#viewfinder.mirrored {
  transform: scaleX(-1);
}

/* Grid */
#grid-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.grid-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.18);
}

.grid-v1 {
  left: 33.33%;
  top: 0;
  bottom: 0;
  width: 1px;
}

.grid-v2 {
  left: 66.66%;
  top: 0;
  bottom: 0;
  width: 1px;
}

.grid-h1 {
  top: 33.33%;
  left: 0;
  right: 0;
  height: 1px;
}

.grid-h2 {
  top: 66.66%;
  left: 0;
  right: 0;
  height: 1px;
}

/* No camera */
#no-camera-msg {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 24px;
}

.no-camera-icon {
  font-size: 56px;
  margin-bottom: 8px;
  opacity: 0.6;
}

#no-camera-msg p {
  font-size: 16px;
  font-weight: 500;
}

#no-camera-msg .sub {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 260px;
}

/* Loading */
#viewfinder-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ═══════════════════════════════════════════════════
   TOP BAR — ultra-minimal
   ═══════════════════════════════════════════════════ */

#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(8px + var(--safe-top)) 16px 6px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, transparent 100%);
  pointer-events: none;
}

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

.app-brand {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #5b8aff 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.top-info-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

#lut-name-display {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s ease;
}

.info-btn:active {
  transform: scale(0.85);
  background: rgba(255, 255, 255, 0.2);
}

/* ── Device Info Modal ── */
.info-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(50px + var(--safe-top)) 20px 20px;
  background: rgba(0, 0, 0, 0.4);
  opacity: 1;
  transition: opacity 0.25s ease;
}

.info-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.info-modal-content {
  width: 100%;
  max-width: 340px;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  background: rgba(20, 20, 28, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  backdrop-filter: blur(30px) saturate(1.3);
  -webkit-backdrop-filter: blur(30px) saturate(1.3);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transform: translateY(0);
  transition: transform 0.25s ease;
}

.info-modal.hidden .info-modal-content {
  transform: translateY(-12px);
}

.info-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.info-modal-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}

.info-modal-close:active {
  transform: scale(0.85);
}

.info-modal-body {
  padding: 10px 14px 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 11px;
  font-family: var(--font-mono);
  line-height: 1.6;
  color: var(--text-dim);
}

.info-section {
  margin-bottom: 10px;
}

.info-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 4px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

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

.info-value {
  color: var(--text);
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════
   BOTTOM AREA — All controls here
   ═══════════════════════════════════════════════════ */

#bottom-area {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 12px calc(6px + var(--safe-bottom));
  pointer-events: none;
}

#bottom-area>* {
  pointer-events: auto;
}

/* === Liquid Glass Pill === */
.glass-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 6px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}

.glass-pill-lg {
  padding: 8px 16px;
  gap: 16px;
  background: rgba(20, 20, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(30px) saturate(1.3);
  -webkit-backdrop-filter: blur(30px) saturate(1.3);
}


/* === Camera HUD strip === */
#cam-hud-strip-wrap {
  width: 100%;
}

#cam-hud-strip {
  display: flex;
  gap: 6px;
  padding: 0 4px;
  overflow-x: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  justify-content: center;
}

#cam-hud-strip::-webkit-scrollbar {
  display: none;
}

.hud-chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-light);
  border-radius: var(--radius-pill);
  backdrop-filter: var(--glass-blur-light);
  -webkit-backdrop-filter: var(--glass-blur-light);
  transition: all var(--transition);
  white-space: nowrap;
}

.hud-chip:active {
  transform: scale(0.95);
}

.hud-chip-active {
  color: var(--accent);
  background: var(--accent-glow);
  border-color: rgba(91, 138, 255, 0.3);
}

.hud-chip-label {
  font-weight: 600;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  opacity: 0.6;
}

.hud-chip-value {
  font-weight: 500;
  color: var(--text);
}

.hud-chip-active .hud-chip-value {
  color: var(--accent);
}

.hud-chip-icon {
  padding: 0 6px;
  min-width: 28px;
  justify-content: center;
}

.hud-chip-icon svg {
  opacity: 0.5;
  transition: opacity var(--transition);
}

.hud-chip-icon.hud-chip-active svg {
  opacity: 1;
  stroke: var(--accent);
}

/* HUD Slider */
.hud-slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 4px 16px 2px;
  animation: fadeSlideUp 0.15s ease;
}

.hud-slider-wrap.hidden {
  display: none !important;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hud-slider-label {
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  color: var(--accent);
  min-width: 32px;
  letter-spacing: 0.3px;
}

.hud-slider {
  flex: 1;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  outline: none;
}

.hud-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  cursor: pointer;
}

.hud-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  cursor: pointer;
}

.hud-slider-val {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text);
  min-width: 40px;
  text-align: right;
}


/* === Unified bar buttons — iOS 26 Liquid Glass === */
.bar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  /* Glass circle per button */
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.2);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bar-btn::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.bar-btn:active {
  transform: scale(0.82);
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.25);
}

.bar-btn:active::after {
  opacity: 1;
}

.bar-btn.active {
  color: var(--accent);
  background: rgba(91, 138, 255, 0.18);
  border-color: rgba(91, 138, 255, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(91, 138, 255, 0.15),
    0 0 12px rgba(91, 138, 255, 0.2),
    0 1px 3px rgba(0, 0, 0, 0.2);
}

/* LUT loaded indicator — persists when panel closed */
.bar-btn.lut-active {
  color: var(--accent);
  border-color: rgba(91, 138, 255, 0.4);
  box-shadow:
    0 0 8px rgba(91, 138, 255, 0.25),
    0 1px 3px rgba(0, 0, 0, 0.2);
}

.bar-btn svg {
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* === Floating Intensity Slider === */
.intensity-pill {
  gap: 6px;
  padding: 4px 12px;
  width: auto;
  min-width: 180px;
  max-width: 280px;
}

.intensity-icon {
  font-size: 12px;
  color: var(--accent);
  flex-shrink: 0;
  line-height: 1;
}

.intensity-range {
  flex: 1;
  height: 2px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  outline: none;
}

.intensity-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
  cursor: pointer;
}

.intensity-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
  cursor: pointer;
}

.intensity-val {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-dim);
  min-width: 32px;
  text-align: right;
}

/* === Denoise Controls === */
.denoise-icon-pill {
  color: var(--accent-warm);
  font-size: 14px;
}

.denoise-range::-webkit-slider-thumb {
  border-color: var(--accent-warm) !important;
  box-shadow: 0 0 6px rgba(245, 200, 66, 0.3) !important;
}

.denoise-range::-moz-range-thumb {
  border-color: var(--accent-warm) !important;
  box-shadow: 0 0 6px rgba(245, 200, 66, 0.3) !important;
}

/* Denoise button active state — warm amber */
.bar-btn.denoise-active {
  color: var(--accent-warm);
  background: rgba(245, 200, 66, 0.15);
  border-color: rgba(245, 200, 66, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(245, 200, 66, 0.15),
    0 0 12px rgba(245, 200, 66, 0.15),
    0 1px 3px rgba(0, 0, 0, 0.2);
}

/* === Main bar layout === */
#main-bar {
  width: 100%;
  justify-content: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

/* Capture button */
.capture-btn {
  position: relative;
  width: 54px;
  height: 54px;
  min-width: 54px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.capture-ring {
  position: absolute;
  inset: 0;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  transition: all var(--transition);
}

.capture-inner {
  position: absolute;
  width: 44px;
  height: 44px;
  background: #ffffff;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.capture-btn:active .capture-inner {
  transform: scale(0.8);
  opacity: 0.75;
}

/* Recording state */
.capture-btn.recording .capture-ring {
  border-color: #ff3b30;
  animation: record-pulse 1s ease-in-out infinite;
}

.capture-btn.recording .capture-inner {
  background: #ff3b30;
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

@keyframes record-pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.08);
    opacity: 0.7;
  }
}

/* Record timer */
.record-timer {
  position: fixed;
  top: calc(8px + var(--safe-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  padding: 4px 14px;
  background: rgba(255, 59, 48, 0.85);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  letter-spacing: 0.5px;
}

/* === Focus ring (touch to focus) === */
.focus-ring {
  position: fixed;
  width: 70px; height: 70px;
  border: 2px solid rgba(255, 214, 10, 0.9);
  border-radius: 8px;
  pointer-events: none;
  z-index: 150;
  transform: translate(-50%, -50%) scale(1.4);
  opacity: 0;
  transition: none;
}
.focus-ring.focusing {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.0);
  transition: transform 0.3s ease-out, opacity 0.15s ease;
}
.focus-ring.focused {
  opacity: 0.5;
  transform: translate(-50%, -50%) scale(0.9);
  transition: transform 0.2s ease, opacity 0.8s ease 0.5s;
}


@keyframes capture-flash {
  0% {
    opacity: 0;
  }

  15% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

.capture-flash {
  position: fixed;
  inset: 0;
  background: white;
  z-index: 300;
  pointer-events: none;
  animation: capture-flash 0.25s ease-out forwards;
}

/* ═══════════════════════════════════════════════════
   LUT PANEL — Right side slide (Liquid Glass)
   ═══════════════════════════════════════════════════ */

.lut-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 42vh;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: rgba(16, 16, 22, 0.82);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px 18px 0 0;
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateY(0);
  transition: transform 0.32s var(--ease-spring);
}

.lut-panel.hidden {
  transform: translateY(100%);
  display: flex !important;
  pointer-events: none;
}

.lut-panel:not(.hidden) {
  pointer-events: auto;
}

.lut-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px 6px;
  border-bottom: 1px solid var(--glass-border-light);
  position: relative;
}

/* iOS-style drag indicator */
.lut-panel-header::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
}

.lut-panel-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.lut-panel-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.lut-panel-close:active {
  transform: scale(0.85);
  background: rgba(255, 255, 255, 0.15);
}

/* Search */
.lut-search-wrap {
  padding: 8px 12px 4px;
}

.lut-search {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  font-family: var(--font);
  font-size: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  outline: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.lut-search::placeholder {
  color: var(--text-muted);
}

.lut-search:focus {
  border-color: rgba(91, 138, 255, 0.4);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(91, 138, 255, 0.1);
}


/* LUT list */
.lut-list-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.lut-list-wrap::-webkit-scrollbar {
  width: 4px;
}

.lut-list-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.lut-list-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

#lut-list {
  padding: 4px 0;
}

.lut-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  text-align: left;
  font-size: 12px;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: all var(--transition);
  position: relative;
}

.lut-list-item:active {
  background: rgba(255, 255, 255, 0.06);
}

.lut-list-item.active {
  color: var(--text);
  background: rgba(91, 138, 255, 0.12);
  border-left: 3px solid var(--accent);
  box-shadow: inset 0 0 0 1px rgba(91, 138, 255, 0.08);
}

.lut-list-item.active .lut-list-name {
  font-weight: 600;
}

.lut-list-item.loading {
  pointer-events: none;
  opacity: 0.5;
}

.lut-list-item.loading::after {
  content: '';
  position: absolute;
  right: 14px;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.lut-list-item.lut-none {
  font-style: italic;
  color: var(--text-muted);
}

.lut-list-item.lut-none.active {
  color: var(--text-dim);
}

.lut-list-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.12);
}

.lut-list-item.active .lut-list-dot {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

.lut-list-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lut-list-badge {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(91, 138, 255, 0.15);
  color: var(--accent);
  letter-spacing: 0.3px;
}

/* Panel footer */
.lut-panel-footer {
  padding: 8px 12px calc(10px + var(--safe-bottom));
  border-top: 1px solid var(--glass-border);
}

.lut-add-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(91, 138, 255, 0.06);
  border: 1px dashed rgba(91, 138, 255, 0.25);
  border-radius: 10px;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.lut-add-btn:active {
  transform: scale(0.97);
  background: rgba(91, 138, 255, 0.12);
}

/* Panel backdrop — transparent so camera stays visible */
.lut-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: transparent;
}

/* ═══════════════════════════════════════════════════
   PREVIEW OVERLAY
   ═══════════════════════════════════════════════════ */

#preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(8, 8, 12, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}

.preview-image-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}

#preview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.preview-actions {
  display: flex;
  gap: 16px;
  padding: 16px 24px calc(24px + var(--safe-bottom));
  justify-content: center;
}

.preview-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}

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

.preview-btn.cancel {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.preview-btn.cancel:active {
  background: rgba(255, 255, 255, 0.15);
}

.preview-btn.download {
  background: var(--accent);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 20px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ═══════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════ */

#toast {
  position: fixed;
  bottom: calc(200px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  padding: 8px 18px;
  background: rgba(20, 20, 28, 0.7);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(30px) saturate(1.3);
  -webkit-backdrop-filter: blur(30px) saturate(1.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: toastIn 0.25s ease;
  white-space: nowrap;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Utility */
.hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════
   DESKTOP (>= 768px)
   ═══════════════════════════════════════════════════ */

@media (min-width: 768px) {
  #bottom-area {
    max-width: 420px;
    left: 50%;
    transform: translateX(-50%);
  }

  .lut-panel {
    max-width: 480px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-radius: 18px 18px 0 0;
  }

  .lut-panel.hidden {
    transform: translateX(-50%) translateY(100%);
  }
}