:root {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.75);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(6, 182, 212, 0.4);
  
  --accent-cyan: #06b6d4;
  --accent-violet: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #06b6d4, #8b5cf6);
  --accent-glow: 0 0 24px rgba(6, 182, 212, 0.35);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  position: relative;
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(6, 182, 212, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(139, 92, 246, 0.12) 0%, transparent 45%);
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 24px;
  gap: 18px;
  box-sizing: border-box;
}

/* Header */
.app-header {
  position: relative;
  z-index: 100;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 16px;
  padding: 12px 20px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  color: #fff;
  box-shadow: var(--accent-glow);
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.header-actions {
  position: relative;
  z-index: 60;
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  flex-shrink: 0;
}

.btn-github {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.btn-github:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

/* Made by Yogesh / Contact Me Button */
.btn-author {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12) 0%, rgba(139, 92, 246, 0.08) 100%);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: var(--radius-full);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  white-space: nowrap;
}

.btn-author:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.22) 0%, rgba(139, 92, 246, 0.18) 100%);
  border-color: var(--accent-cyan);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.25);
}

.btn-author svg {
  color: #38bdf8;
  flex-shrink: 0;
}

.author-mobile {
  display: none;
}

.author-desktop {
  display: inline;
}

/* 100% Local Privacy Badge */
.privacy-badge {
  position: relative;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(139, 92, 246, 0.06) 100%);
  border: 1px solid rgba(6, 182, 212, 0.28);
  border-radius: var(--radius-full);
  color: #f1f5f9;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  user-select: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  white-space: nowrap;
}

.privacy-badge:hover,
.privacy-badge.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.18) 0%, rgba(139, 92, 246, 0.12) 100%);
  border-color: rgba(6, 182, 212, 0.55);
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.privacy-eye-icon {
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.privacy-text {
  color: #f8fafc;
  white-space: nowrap;
}

/* Tooltip Popover (Desktop Hover + Mobile Tap) */
.privacy-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 260px;
  max-width: calc(100vw - 32px);
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(6, 182, 212, 0.4);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.75), 0 0 20px rgba(6, 182, 212, 0.2);
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--text-main);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
  white-space: normal;
  text-align: left;
}

.privacy-popover::before {
  content: '';
  position: absolute;
  top: -5px;
  right: 28px;
  width: 10px;
  height: 10px;
  background: rgba(15, 23, 42, 0.98);
  border-left: 1px solid rgba(6, 182, 212, 0.4);
  border-top: 1px solid rgba(6, 182, 212, 0.4);
  transform: rotate(45deg);
}

/* Shown on Desktop Hover, Mobile Active Tap, or Focus */
.privacy-badge:hover .privacy-popover,
.privacy-badge:focus-within .privacy-popover,
.privacy-badge.active .privacy-popover {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Main Workspace */
.app-main {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 20px;
  flex: 1;
  min-width: 0;
  width: 100%;
}

@media (max-width: 1080px) {
  .app-main {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Viewport & Canvas */
.viewport-section {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

#spiral-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Canvas HUD */
.canvas-hud {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  z-index: 10;
  pointer-events: none;
}

.top-hud {
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
}

.bottom-hud {
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
}

.top-hud > *, .bottom-hud > * {
  pointer-events: auto;
}

.hud-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-sep {
  opacity: 0.4;
}

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

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-cyan);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.live-badge {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent-cyan);
  border-radius: 50%;
  animation: pulse 1.6s infinite ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; filter: drop-shadow(0 0 4px var(--accent-cyan)); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* Recording Overlay */
.recording-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 20;
}

.rec-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ef4444;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.05em;
}

.rec-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  animation: recBlink 0.8s infinite alternate ease-in-out;
}

@keyframes recBlink {
  from { opacity: 0.3; }
  to { opacity: 1; transform: scale(1.1); box-shadow: 0 0 10px #ef4444; }
}

.rec-progress-bar {
  width: 280px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.rec-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  transition: width 0.1s linear;
}

.rec-time-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Control Aside Cards */
.controls-aside {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 4px;
  min-width: 0;
  width: 100%;
}

.controls-aside::-webkit-scrollbar {
  width: 6px;
}
.controls-aside::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* Callout Banner to Scroll Down to Export */
.export-callout-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.18), rgba(139, 92, 246, 0.18));
  border: 1px solid rgba(6, 182, 212, 0.4);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.15);
  animation: calloutGlow 3s infinite alternate ease-in-out;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

@keyframes calloutGlow {
  0% { border-color: rgba(6, 182, 212, 0.4); box-shadow: 0 4px 16px rgba(6, 182, 212, 0.15); }
  100% { border-color: rgba(139, 92, 246, 0.6); box-shadow: 0 4px 22px rgba(139, 92, 246, 0.25); }
}

.callout-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.callout-icon {
  font-size: 1.2rem;
}

.callout-text {
  display: flex;
  flex-direction: column;
}

.callout-text strong {
  font-size: 0.85rem;
  color: #fff;
  font-weight: 600;
}

.callout-text span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-jump-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.4);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn-jump-export:hover {
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.15);
}

.pulse-highlight {
  animation: cardPulse 1.2s ease-out;
}

@keyframes cardPulse {
  0% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.7); border-color: var(--accent-cyan); }
  50% { box-shadow: 0 0 30px 4px rgba(6, 182, 212, 0.5); border-color: #fff; }
  100% { box-shadow: none; border-color: rgba(6, 182, 212, 0.3); }
}

.control-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.2s ease;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.control-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.export-card {
  border: 1px solid rgba(6, 182, 212, 0.3);
  box-shadow: inset 0 0 20px rgba(6, 182, 212, 0.05);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.card-title svg {
  color: var(--accent-cyan);
}

/* Dropzone */
.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.02);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.05);
}

.drop-icon {
  color: var(--accent-cyan);
  margin-bottom: 6px;
}

.drop-main {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
}

.drop-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Thumbnails Strip — Clean Horizontal Scrolling */
.thumbnails-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  height: 56px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(6, 182, 212, 0.3) transparent;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.thumbnails-container::-webkit-scrollbar {
  height: 4px;
}

.thumbnails-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-full);
}

.thumbnails-container::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-full);
}

.thumbnails-container::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

.thumb-item {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-glass);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.thumb-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
}

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

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
}

.btn-subtle {
  background: none;
  border: none;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease;
}

.btn-subtle:hover {
  color: var(--text-main);
  text-decoration: underline;
}

.text-danger {
  color: #f87171 !important;
}

/* Slider Controls */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.slider-val {
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.6);
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.group-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Segmented Buttons */
.segmented-control {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.seg-btn {
  flex: 1;
  padding: 7px 10px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.seg-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Color Options */
.color-options {
  display: flex;
  gap: 10px;
}

.color-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.color-btn.active {
  border-color: var(--accent-cyan);
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

/* Duration Pills */
.duration-pills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.pill-btn {
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.pill-btn.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #090d16;
}

/* Buttons */
.w-100 { width: 100%; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--accent-glow);
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 0 28px rgba(6, 182, 212, 0.5);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-cyan);
}

.audio-playback-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.btn-audio-preview {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: var(--accent-cyan);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-audio-preview:hover {
  background: rgba(6, 182, 212, 0.25);
  transform: translateY(-1px);
}

.btn-audio-preview.playing {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.hint-text {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.audio-sub-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.btn-text-action {
  background: none;
  border: none;
  color: #f87171;
  font-size: 0.75rem;
  cursor: pointer;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  max-width: 640px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
}
.btn-close-modal:hover { color: #fff; }

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.video-preview-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.video-preview-wrapper video {
  width: 100%;
  height: 100%;
  display: block;
}

.export-details {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-cyan);
  text-align: center;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-glass);
}

/* ========================================================
   Mobile & Tablet Responsiveness (< 768px and < 480px)
   ======================================================== */

@media (max-width: 768px) {
  .app-container {
    padding: 8px 12px 24px;
    gap: 12px;
  }

  /* Compact & Fully Responsive Header */
  .app-header {
    padding: 8px 12px;
    border-radius: var(--radius-md);
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
  }

  .brand {
    gap: 8px;
    min-width: 0;
    flex-shrink: 1;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
  }

  .brand-icon svg {
    width: 18px;
    height: 18px;
  }

  .brand-title {
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-subtitle {
    display: none; /* Hide subtitle on phones/tablets to prevent horizontal squeezing */
  }

  .header-actions {
    gap: 6px;
    flex-shrink: 0;
  }

  .privacy-badge {
    padding: 6px 10px;
    font-size: 0.72rem;
    gap: 5px;
  }

  .privacy-text {
    display: none; /* Icon-only eye button on mobile so header never overflows */
  }

  .privacy-popover {
    width: 250px;
    right: -10px;
    max-width: calc(100vw - 28px);
  }

  .privacy-popover::before {
    right: 22px;
  }

  .btn-github {
    padding: 6px 10px;
    font-size: 0.75rem;
    gap: 6px;
  }

  .btn-github span {
    display: none; /* Icon-only GitHub on mobile */
  }

  .btn-github svg {
    width: 16px;
    height: 16px;
  }

  .author-desktop {
    display: none;
  }

  .author-mobile {
    display: inline;
  }

  .btn-author {
    padding: 6px 10px;
    font-size: 0.72rem;
    gap: 5px;
  }

  /* Layout */
  .app-main {
    gap: 14px;
  }

  .canvas-wrapper {
    border-radius: var(--radius-md);
  }

  .canvas-hud {
    padding: 8px 10px;
  }

  .live-badge {
    font-size: 0.65rem;
    padding: 3px 8px;
  }

  .hud-stats {
    font-size: 0.7rem;
    padding: 3px 8px;
  }

  .hud-btn {
    padding: 6px 10px;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    gap: 4px;
  }

  #lbl-reverse-mode {
    display: none; /* Hide reverse text on mobile so HUD controls never overflow */
  }

  .hud-btn svg {
    width: 15px;
    height: 15px;
  }

  /* Natural page scrolling for controls on mobile */
  .controls-aside {
    max-height: none;
    overflow: visible;
    padding-right: 0;
    gap: 12px;
    width: 100%;
    min-width: 0;
  }

  .control-card {
    padding: 12px;
    border-radius: var(--radius-md);
    gap: 10px;
    width: 100%;
    min-width: 0;
  }

  .card-title {
    font-size: 0.85rem;
    gap: 6px;
  }

  .card-title svg {
    width: 16px;
    height: 16px;
  }

  .badge {
    font-size: 0.68rem;
    padding: 3px 8px;
  }

  /* Callout Banner */
  .export-callout-banner {
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 8px;
    width: 100%;
    min-width: 0;
  }

  .callout-content {
    min-width: 0;
    flex: 1 1 100%;
  }

  .callout-icon {
    font-size: 1.05rem;
  }

  .callout-text strong {
    font-size: 0.78rem;
  }

  .callout-text span {
    font-size: 0.66rem;
  }

  .btn-jump-export {
    width: 100%;
    justify-content: center;
    padding: 7px 10px;
    font-size: 0.74rem;
  }

  /* Dropzone */
  .dropzone {
    padding: 14px 10px;
    width: 100%;
    box-sizing: border-box;
  }

  .drop-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
  }

  .drop-main {
    font-size: 0.82rem;
  }

  .drop-sub {
    font-size: 0.68rem;
  }

  .thumbnails-container {
    height: 48px;
    gap: 6px;
    width: 100%;
    min-width: 0;
  }

  .thumb-item {
    width: 38px;
    height: 38px;
  }

  .btn-subtle {
    font-size: 0.7rem;
  }

  /* Controls & Sliders */
  .slider-header, .group-label {
    font-size: 0.78rem;
  }

  .slider-val {
    font-size: 0.78rem;
  }

  .segmented-control {
    flex-wrap: wrap;
    gap: 4px;
  }

  .seg-btn {
    flex: 1 1 30%;
    min-width: 0;
    padding: 6px 4px;
    font-size: 0.7rem;
    white-space: normal;
    text-align: center;
  }

  .duration-pills {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .pill-btn {
    padding: 6px;
    font-size: 0.72rem;
  }

  .audio-playback-bar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .color-btn {
    width: 28px;
    height: 28px;
  }

  .btn-primary, .btn-secondary {
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .btn-audio-preview {
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  .hint-text {
    font-size: 0.68rem;
  }

  /* Modal */
  .modal-backdrop {
    padding: 12px;
  }

  .modal-card {
    border-radius: var(--radius-md);
  }

  .modal-header {
    padding: 12px 14px;
  }

  .modal-title {
    font-size: 0.95rem;
  }

  .modal-body {
    padding: 14px;
    gap: 8px;
  }

  .modal-footer {
    padding: 10px 14px;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .app-container {
    padding: 6px 8px 20px;
    width: 100%;
    max-width: 100%;
  }

  .app-header {
    padding: 6px 8px;
    gap: 6px;
    width: 100%;
    max-width: 100%;
  }

  .brand-icon {
    width: 28px;
    height: 28px;
  }

  .brand-icon svg {
    width: 16px;
    height: 16px;
  }

  .brand-title {
    font-size: 0.88rem;
    max-width: 130px;
  }

  .btn-github {
    padding: 6px 8px;
  }

  .btn-author {
    padding: 6px 8px;
    font-size: 0.7rem;
    gap: 4px;
  }

  .privacy-badge {
    padding: 6px 8px;
  }

  .hud-stats {
    font-size: 0.65rem;
  }

  .privacy-popover {
    width: min(240px, calc(100vw - 20px));
    right: -8px;
    max-width: calc(100vw - 20px);
  }

  .privacy-popover::before {
    right: 20px;
  }
}


