:root {
  --bg-color: #070709;
  --text-primary: #f0f0f5;
  --text-secondary: #c5c5d0;
  --text-muted: #9e9ea9;
  --accent-glow: linear-gradient(135deg, #ff007a, #7928ca, #4200ff);
  --card-bg: rgba(255, 255, 255, 0.035);
  --card-border: rgba(255, 255, 255, 0.09);
  --code-bg: rgba(255, 0, 122, 0.08);
  --code-border: rgba(255, 0, 122, 0.25);
  --pink-accent: #ff007a;
  --pink-light: #ff3399;
  --danger-accent: #ff3366;
  --success-glow: linear-gradient(135deg, #00e676, #00b0ff);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: '-apple-system', BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
  padding: 2.5rem 1rem;
}

/* Ambient Background Orbs */
.glow-orb {
  position: fixed;
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(121, 40, 202, 0.18) 0%, rgba(0,0,0,0) 70%);
  top: -300px;
  left: -250px;
  z-index: 0;
  animation: float 12s ease-in-out infinite alternate;
  pointer-events: none;
}

.glow-orb-2 {
  position: fixed;
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(255, 0, 122, 0.15) 0%, rgba(0,0,0,0) 70%);
  bottom: -300px;
  right: -250px;
  z-index: 0;
  animation: float 16s ease-in-out infinite alternate-reverse;
  pointer-events: none;
}

#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Navigation Bar */
nav {
  position: relative;
  z-index: 2;
  width: 95%;
  max-width: 950px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0 2rem 0;
}

.nav-logo {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
  text-decoration: none;
}

.nav-logo span {
  background: var(--accent-glow);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Main Container */
.container {
  position: relative;
  z-index: 2;
  width: 95%;
  max-width: 950px;
  background: var(--card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 3.5rem 3rem;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), 
              inset 0 1px 0 rgba(255, 255, 255, 0.12);
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  margin-bottom: 2rem;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 2rem;
}

.app-name {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #ffffff 30%, #a5a5a5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-name .accent {
  background: var(--accent-glow);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  font-weight: 300;
  max-width: 650px;
  margin: 0 auto;
}

.help-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  font-weight: 300;
}

/* Drag & Drop Label */
.file-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 1.5rem 0 0.5rem 0;
  padding: 3.5rem 2rem;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
}

.upload-icon {
  font-size: 2rem;
  color: var(--pink-light);
  margin-bottom: 0.75rem;
  transition: transform 0.3s;
}

.file-label-text {
  font-size: 1.05rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.file-label:hover {
  border-color: var(--pink-accent);
  background: rgba(255, 0, 122, 0.05);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(255, 0, 122, 0.15);
}

.file-label:hover .upload-icon {
  transform: scale(1.15) rotate(5deg);
}

/* Fullscreen Drag Overlay */
.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 7, 9, 0.85);
  z-index: 50;
  display: grid;
  place-items: center;
  backdrop-filter: blur(16px);
}

.drop-message {
  font-size: 2.2rem;
  font-weight: 600;
  color: #fff;
  padding: 40px 80px;
  border-radius: 24px;
  border: 1px solid var(--pink-accent);
  background: rgba(255, 0, 122, 0.1);
  box-shadow: 0 0 50px rgba(255, 0, 122, 0.3);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Workspace Panels */
.workspace {
  margin-top: 2rem;
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

h2.section-heading {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #ffffff;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.glass-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 2rem;
  margin: 1.5rem 0;
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 1.5rem 0;
  align-items: center;
}

/* Form Groups & Inputs */
.radio-group, .password-group, .batch-group, .quality-group {
  display: flex;
  gap: 15px;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-secondary);
  align-items: center;
  flex-wrap: wrap;
}

.custom-radio, .custom-checkbox {
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  gap: 8px;
  color: var(--text-primary);
}

.custom-radio input, .custom-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.radio-btn, .checkmark {
  height: 20px;
  width: 20px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 50%;
  display: inline-block;
  position: relative;
  transition: all 0.2s;
}

.custom-checkbox .checkmark {
  border-radius: 6px;
}

.custom-radio:hover input ~ .radio-btn,
.custom-checkbox:hover input ~ .checkmark {
  background-color: rgba(255, 255, 255, 0.1);
}

.custom-radio input:checked ~ .radio-btn,
.custom-checkbox input:checked ~ .checkmark {
  background-color: var(--pink-accent);
  border-color: var(--pink-accent);
  box-shadow: 0 0 10px rgba(255, 0, 122, 0.4);
}

.radio-btn::after {
  content: "";
  position: absolute;
  display: none;
  top: 6px; left: 6px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: white;
}

.custom-radio input:checked ~ .radio-btn::after {
  display: block;
}

.checkmark::after {
  content: "";
  position: absolute;
  display: none;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.custom-checkbox input:checked ~ .checkmark::after {
  display: block;
}

input[type="password"], select {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.3s;
}

input[type="password"]:focus, select:focus {
  outline: none;
  border-color: var(--pink-accent);
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 0 12px rgba(255, 0, 122, 0.25);
}

input[type="password"]:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#qualitySlider {
  -webkit-appearance: none;
  width: 130px;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  outline: none;
}

#qualitySlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--pink-light);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 0, 122, 0.5);
  transition: transform 0.2s;
}

#qualitySlider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

/* Image Thumbnails & Storyboard Grid */
.preview-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 16px;
  margin: 1.25rem 0 2rem;
}

.preview-item {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--card-border);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  opacity: 0;
  animation: fadeInPop 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.preview-item:active {
  cursor: grabbing;
}

@keyframes fadeInPop {
  0% { opacity: 0; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  transition: transform 0.3s ease;
}

.preview-item:hover img {
  transform: scale(1.08);
}

.preview-item .delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  flex: none;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
}

.preview-item .delete-btn:hover {
  background: var(--danger-accent);
  transform: scale(1.15);
}

.status-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--pink-light);
  backdrop-filter: blur(4px);
  border: 1px solid var(--card-border);
}

.preview-item .spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--pink-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.fade-out {
  opacity: 0 !important;
  transform: scale(0.8) !important;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 16px;
  margin-top: 2rem;
  justify-content: center;
}

.action-buttons button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 28px;
  border: none;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.glow-btn {
  background: linear-gradient(135deg, #ff007a, #7928ca);
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(255, 0, 122, 0.35);
}

.glow-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(255, 0, 122, 0.55);
  background: linear-gradient(135deg, #ff1a8c, #8a3bd8);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  border: 1px solid var(--card-border) !important;
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25) !important;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

button.download-ready {
  background: var(--success-glow);
  box-shadow: 0 10px 30px rgba(0, 230, 118, 0.35);
}

button.download-ready:hover {
  box-shadow: 0 15px 40px rgba(0, 230, 118, 0.55);
}

/* Dots Loader Animation */
.processing-dots {
  color: var(--pink-light);
  font-weight: 500;
  text-align: center;
  margin: 1rem 0;
}

.processing-dots::after {
  content: '';
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
  100% { content: ''; }
}

/* Screen Readers & Utilities */
.hidden { display: none !important; }

.sr-only {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden; clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
  border: 0; padding: 0; margin: -1px;
}

/* Animations */
@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 40px) scale(1.1); }
}

@media (max-width: 768px) {
  .app-name { font-size: 2.5rem; }
  .container { padding: 2.5rem 1.5rem; }
  .action-buttons { flex-direction: column-reverse; }
  .preview-item { width: calc(33.33% - 11px); height: 100px; }
}