/* ==========================================
   SNAP 360 PWA - Styles
   Optimizado para iPhone 17 Pro Max
   ========================================== */

:root {
  --bg: #0a0a0f;
  --bg2: #12121c;
  --bg3: #1a1a2e;
  --accent1: #9B30FF;
  --accent2: #E91E8C;
  --accent-grad: linear-gradient(135deg, #9B30FF, #E91E8C);
  --accent-grad-r: linear-gradient(135deg, #E91E8C, #9B30FF);
  --text: #ffffff;
  --text2: rgba(255,255,255,0.6);
  --text3: rgba(255,255,255,0.35);
  --glass: rgba(255,255,255,0.06);
  --glass-border: rgba(255,255,255,0.12);
  --danger: #FF3B5C;
  --success: #30D158;
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 28px;
  --safe-top: env(safe-area-inset-top, 44px);
  --safe-bottom: env(safe-area-inset-bottom, 34px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================
   SCREENS
   ========================================== */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.35s ease, transform 0.35s ease;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  z-index: 10;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
  z-index: 20;
}

.screen.slide-out {
  opacity: 0;
  transform: translateY(-20px);
}

/* ==========================================
   HOME SCREEN
   ========================================== */
#screen-home {
  background: var(--bg);
  align-items: center;
  justify-content: center;
  gap: 0;
}

.home-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.home-bg::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(155,48,255,0.25) 0%, transparent 70%);
  top: -100px; left: 50%;
  transform: translateX(-50%);
  animation: pulse-glow 4s ease-in-out infinite;
}

.home-bg::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(233,30,140,0.2) 0%, transparent 70%);
  bottom: -50px; right: -100px;
  animation: pulse-glow 4s ease-in-out infinite 2s;
}

@keyframes pulse-glow {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.7; }
  50% { transform: translateX(-50%) scale(1.15); opacity: 1; }
}

.home-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-bottom: 60px;
}

.home-logo-ring {
  position: relative;
  width: 140px; height: 140px;
  margin-bottom: 8px;
}

.ring-outer {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  background: var(--accent-grad) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
  animation: spin 8s linear infinite;
}

.ring-inner {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.1);
  animation: spin 5s linear infinite reverse;
}

.ring-center {
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  background: var(--accent-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  box-shadow: 0 0 40px rgba(155,48,255,0.6);
}

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

.home-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-subtitle {
  font-size: 15px;
  color: var(--text2);
  letter-spacing: 0.5px;
  text-align: center;
  max-width: 240px;
}

.home-features {
  display: flex;
  gap: 16px;
  margin: 16px 0 24px;
}

.feature-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 11px;
  color: var(--text2);
  backdrop-filter: blur(10px);
}

.feature-chip span:first-child {
  font-size: 22px;
}

.btn-start {
  position: relative;
  width: 240px;
  padding: 18px;
  border: none;
  border-radius: 50px;
  background: var(--accent-grad);
  color: white;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(155,48,255,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  margin-bottom: 16px;
}

.btn-start::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.15), transparent);
}

.btn-start:active {
  transform: scale(0.96);
  box-shadow: 0 4px 16px rgba(155,48,255,0.3);
}

.btn-gallery-home {
  background: none;
  border: 1.5px solid var(--glass-border);
  border-radius: 50px;
  width: 240px;
  padding: 16px;
  color: var(--text2);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-gallery-home:active {
  color: white;
  border-color: rgba(255,255,255,0.3);
}

/* ==========================================
   CAMERA SCREEN
   ========================================== */
#screen-camera {
  background: #000;
}

.camera-top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 8px) 20px 16px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
}

.camera-video-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #000;
  /* Force 9:16 display — center the video, black bars if needed */
  display: flex;
  align-items: center;
  justify-content: center;
}

#camera-video {
  /* Fill the wrapper maintaining 9:16 — crops sides if camera is wider */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;          /* no distortion, crops to fill */
  object-position: center;
  transition: filter 0.3s ease;
}

#camera-canvas {
  display: none;
}

.camera-effect-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: all 0.3s;
}

.template-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.template-overlay .tmpl-top,
.template-overlay .tmpl-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.camera-timer-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 140px;
  font-weight: 900;
  color: white;
  text-shadow: 0 0 40px rgba(155,48,255,0.8);
  opacity: 0;
  pointer-events: none;
  transition: all 0.1s;
  z-index: 50;
}

.camera-timer-display.show {
  opacity: 1;
}

.recording-indicator {
  position: absolute;
  top: calc(var(--safe-top) + 56px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: white;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 40;
}

.recording-indicator.show {
  opacity: 1;
}

.rec-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.camera-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  padding: 0 24px calc(var(--safe-bottom) + 16px);
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
}

.effects-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.effects-strip::-webkit-scrollbar { display: none; }

.effect-btn {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.15s;
}

.effect-btn:active { transform: scale(0.9); }

.effect-thumb {
  width: 56px; height: 56px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid transparent;
  position: relative;
  transition: border-color 0.2s;
}

.effect-btn.active .effect-thumb {
  border-color: var(--accent1);
  box-shadow: 0 0 12px rgba(155,48,255,0.6);
}

.effect-thumb-inner {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.effect-thumb-label {
  font-size: 10px;
  color: var(--text2);
  white-space: nowrap;
}

.effect-btn.active .effect-thumb-label { color: white; }

.camera-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 0;
}

.ctrl-btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--glass);
  border: 1.5px solid var(--glass-border);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  transition: all 0.15s;
  color: white;
}

.ctrl-btn:active {
  transform: scale(0.88);
  background: rgba(255,255,255,0.15);
}

.record-btn-wrap {
  position: relative;
  width: 84px; height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.record-btn-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid white;
}

.record-btn-ring-progress {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--danger);
  transform: rotate(-90deg);
  transition: border-color 0.2s;
}

.record-btn {
  width: 68px; height: 68px;
  border-radius: 50%;
  background: var(--danger);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  box-shadow: 0 0 24px rgba(255,59,92,0.5);
}

.record-btn.recording {
  border-radius: 16px;
  background: var(--danger);
  width: 34px; height: 34px;
  box-shadow: 0 0 24px rgba(255,59,92,0.8);
}

.record-btn:active { transform: scale(0.9); }

.timer-ring-svg {
  position: absolute;
  inset: -3px;
  width: calc(100% + 6px);
  height: calc(100% + 6px);
  transform: rotate(-90deg);
  pointer-events: none;
}

.timer-ring-circle {
  fill: none;
  stroke: var(--danger);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  transition: stroke-dashoffset 1s linear;
}

/* ==========================================
   TEMPLATES STRIP
   ========================================== */
.templates-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 0 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.templates-strip::-webkit-scrollbar { display: none; }

.tmpl-btn {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.tmpl-thumb {
  width: 48px; height: 48px;
  border-radius: 12px;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.2s;
  background: var(--glass);
}

.tmpl-btn.active .tmpl-thumb {
  border-color: var(--accent2);
  box-shadow: 0 0 12px rgba(233,30,140,0.5);
  background: rgba(233,30,140,0.15);
}

.tmpl-label {
  font-size: 10px;
  color: var(--text2);
}

.tmpl-btn.active .tmpl-label { color: white; }

/* ==========================================
   PANEL ICONS (TOP BAR)
   ========================================== */
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  color: white;
  transition: all 0.15s;
}

.icon-btn:active { transform: scale(0.88); }

.icon-btn.accent {
  background: var(--accent-grad);
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(155,48,255,0.4);
}

/* ==========================================
   PREVIEW SCREEN
   ========================================== */
#screen-preview {
  background: #000;
}

#preview-video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

/* preview-top-bar kept for legacy but no longer used in HTML */
.preview-top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 8px) 20px 20px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%);
}

.preview-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  padding: 20px 24px calc(var(--safe-bottom) + 16px);
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ==========================================
   PREVIEW ACTIONS (post-render)
   ========================================== */
.preview-actions {
  display: flex;
  gap: 12px;
}
.btn-retake {
  flex: 1;
  padding: 16px;
  border-radius: var(--radius);
  border: 1.5px solid var(--glass-border);
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn-retake:active { background: rgba(255,255,255,0.15); transform: scale(0.97); }

.btn-save {
  flex: 2;
  padding: 16px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent-grad);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.btn-save:active { opacity: 0.85; transform: scale(0.97); }

.btn-share-small {
  width: 100%;
  padding: 13px;
  border-radius: var(--radius);
  border: 1.5px solid var(--glass-border);
  background: rgba(255,255,255,0.05);
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.btn-share-small:active { background: rgba(255,255,255,0.1); }
.btn-publish { border-color: #7c5cfc; color: #a78bfa; margin-top: 6px; }

/* ==========================================
   QR MODAL
   ========================================== */
.qr-modal {
  position: fixed;
  left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.92);
  width: min(340px, calc(100vw - 40px));
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 28px 24px 24px;
  z-index: 500;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.qr-modal.show { opacity: 1; pointer-events: all; transform: translate(-50%, -50%) scale(1); }
.modal-close-btn {
  position: absolute; top: 12px; right: 14px;
  background: var(--glass); border: none; color: var(--text);
  width: 30px; height: 30px; border-radius: 50%; font-size: 14px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.qr-title { font-size: 18px; font-weight: 700; text-align: center; }
.qr-sub   { font-size: 13px; color: var(--text2); text-align: center; margin-bottom: 4px; }
#qr-canvas { border-radius: 12px; overflow: hidden; width: 240px; height: 240px; flex-shrink: 0; }
#qr-canvas img, #qr-canvas canvas { display: block; border-radius: 12px; }
.qr-link {
  font-size: 11px; color: var(--text2);
  word-break: break-all; text-align: center; text-decoration: none;
  padding: 4px 8px; background: var(--glass); border-radius: 6px;
  display: block; width: 100%;
}

.preview-play-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 25;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: 2.5px solid rgba(255,255,255,0.7);
  color: #fff;
  font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  padding-left: 6px;
  transition: opacity 0.2s;
}
.preview-play-btn.hide { display: none; }

.btn-primary {
  width: 100%;
  padding: 17px;
  border: none;
  border-radius: 50px;
  background: var(--accent-grad);
  color: white;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 6px 24px rgba(155,48,255,0.4);
}

.btn-primary:active { transform: scale(0.97); }

.preview-row {
  display: flex;
  gap: 12px;
}

.btn-secondary {
  flex: 1;
  padding: 15px;
  border: 1.5px solid var(--glass-border);
  border-radius: 50px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-secondary:active { transform: scale(0.97); background: rgba(255,255,255,0.1); }

.preview-duration {
  font-size: 13px;
  color: var(--text2);
  text-align: center;
}

/* ==========================================
   GALLERY SCREEN
   ========================================== */
#screen-gallery {
  background: var(--bg);
}

.gallery-header {
  padding: calc(var(--safe-top) + 8px) 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--glass-border);
}

.gallery-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.gallery-count {
  font-size: 13px;
  color: var(--text2);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 4px 10px;
}

.gallery-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: start;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--safe-bottom) + 16px);
}

.gallery-item {
  position: relative;
  aspect-ratio: 9/16;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg3);
  cursor: pointer;
  transition: transform 0.2s;
}

.gallery-item:active { transform: scale(0.96); }

.gallery-item video {
  width: 100%; height: 100%;
  object-fit: cover;
}

.gallery-item-info {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  font-size: 11px;
  color: var(--text2);
}

.gallery-item-duration {
  font-weight: 600;
  color: white;
}

.gallery-item-delete {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--danger);
  cursor: pointer;
}

.gallery-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 40px;
  text-align: center;
  grid-column: span 2;
}

.gallery-empty-icon { font-size: 52px; opacity: 0.4; }
.gallery-empty-title { font-size: 18px; font-weight: 700; color: var(--text2); }
.gallery-empty-sub { font-size: 14px; color: var(--text3); }

/* ==========================================
   MODAL / SHEET
   ========================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: all;
}

.bottom-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--bg2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-top: 1px solid var(--glass-border);
  padding: 12px 24px calc(var(--safe-bottom) + 20px);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-sheet.show {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.2);
  margin: 0 auto 20px;
}

.sheet-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: center;
}

.share-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: white;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
}

.share-btn:active { background: rgba(255,255,255,0.1); }

.share-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

/* ==========================================
   TOAST
   ========================================== */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 100px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30,30,50,0.95);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  border-radius: 50px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: white;
  z-index: 200;
  opacity: 0;
  transition: all 0.3s;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================
   UTILITIES
   ========================================== */
.gradient-text {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hide { display: none !important; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  background: var(--danger);
  font-size: 11px;
  font-weight: 700;
  color: white;
  padding: 0 4px;
  position: absolute;
  top: -4px; right: -4px;
}

/* ==========================================
   STRIP LABEL
   ========================================== */
.strip-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 6px 0 2px;
}

/* ==========================================
   MUSIC PANEL
   ========================================== */
.music-panel {
  margin-bottom: 4px;
}

.music-panel-inner {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(12px);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.music-track-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.music-pick-btn {
  background: var(--accent-grad);
  border: none;
  border-radius: 20px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.music-clear-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,59,92,0.2);
  border: 1px solid rgba(255,59,92,0.4);
  color: var(--danger);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.vol-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

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

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent1);
  box-shadow: 0 0 6px rgba(155,48,255,0.6);
}

/* ==========================================
   PREVIEW EFFECTS STRIP (speed/rewind)
   ========================================== */
.preview-effects-wrap {
  position: absolute;
  left: 0; right: 0;
  bottom: 160px;
  z-index: 30;
  padding: 0 20px;
}

.peff-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.preview-effects-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}

.preview-effects-strip::-webkit-scrollbar { display: none; }

.peff-btn {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 20px;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.peff-btn.active {
  background: var(--accent-grad);
  border-color: transparent;
  color: white;
  box-shadow: 0 2px 12px rgba(155,48,255,0.4);
}

.peff-btn:active { transform: scale(0.94); }

/* ==========================================
   RENDER BUTTON
   ========================================== */
.btn-render {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--accent1);
  border-radius: 50px;
  background: rgba(155,48,255,0.15);
  color: var(--accent1);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 8px;
}
.btn-render:active { background: rgba(155,48,255,0.3); transform: scale(0.97); }
.btn-render.hidden { display: none; }

/* ==========================================
   PROCESSING OVERLAY
   ========================================== */
.processing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(16px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.processing-overlay.show {
  opacity: 1;
  pointer-events: all;
}
.proc-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
}
.proc-spinner {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 4px solid rgba(155,48,255,0.2);
  border-top-color: var(--accent1);
  border-right-color: var(--accent2);
  animation: spin 0.8s linear infinite;
}
.proc-msg {
  font-size: 18px;
  font-weight: 700;
  color: white;
  text-align: center;
}
.proc-sub {
  font-size: 13px;
  color: var(--text2);
  text-align: center;
}
.proc-cancel-btn {
  margin-top: 16px;
  padding: 10px 28px;
  border-radius: 20px;
  border: 1.5px solid rgba(255,255,255,0.2);
  background: transparent;
  color: var(--text2);
  font-size: 14px;
  cursor: pointer;
}
.proc-cancel-btn:active { background: rgba(255,255,255,0.1); }

/* ==========================================
   CAMERA SPEED BADGE
   ========================================== */
.cam-speed-badge {
  background: var(--glass);
  border: 1.5px solid var(--glass-border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  backdrop-filter: blur(8px);
  white-space: nowrap;
}

/* ==========================================
   PREVIEW EFFECT INFO
   ========================================== */
.preview-effect-info {
  position: absolute;
  top: calc(var(--safe-top) + 60px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(155,48,255,0.3);
  border: 1px solid rgba(155,48,255,0.5);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  color: white;
  z-index: 30;
  white-space: nowrap;
}

/* ==========================================
   SETTINGS SHEET
   ========================================== */
.settings-sheet {
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sheet-sub {
  font-size: 13px;
  color: var(--text2);
  text-align: center;
  margin: -12px 0 20px;
  padding: 0 16px;
  line-height: 1.5;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 16px;
}

.setting-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setting-row:last-child { border-bottom: none; }

.setting-toggle-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.setting-label {
  font-size: 15px;
  font-weight: 500;
  color: white;
}

.setting-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-select {
  width: 100%;
  padding: 13px 16px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: white;
  font-size: 15px;
  font-weight: 400;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.setting-select option {
  background: #1a1a2e;
  color: white;
}

.setting-toggle {
  width: 51px; height: 31px;
  border-radius: 16px;
  background: rgba(255,255,255,0.15);
  position: relative;
  cursor: pointer;
  transition: background 0.25s;
  flex-shrink: 0;
}

.setting-toggle.active {
  background: #E83535;
}

.setting-toggle::after {
  content: '';
  position: absolute;
  width: 27px; height: 27px;
  border-radius: 50%;
  background: white;
  top: 2px; left: 2px;
  transition: transform 0.25s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.setting-toggle.active::after {
  transform: translateX(20px);
}

.help-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #E83535;
  border: none;
  color: white;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
