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

:root {
  /* ── Color palette ── */
  --bg:        #0c0c10;
  --bg-gradient: linear-gradient(135deg, #0c0c10 0%, #14141e 100%);
  --surface:   #13131a;
  --surface-hover: #1a1a24;
  --border:    #22222e;
  --border-hover: #2e2e3c;
  --border2:   #2e2e42;
  
  /* ── Accent colors ── */
  --accent:    #c8f04a;
  --accent-gradient: linear-gradient(135deg, #c8f04a 0%, #a8d938 100%);
  --accent-dark: #a8d938;
  --accent-light: #e0ff80;
  
  /* ── Neutral tones ── */
  --dim:       #3a3a52;
  --text:      #e4e4f0;
  --text-secondary: #b0b0c0;
  --muted:     #66667a;
  --muted-light: #8888a0;
  
  /* ── Status colors ── */
  --ok:        #4ade80;
  --error:     #f87171;
  --warning:   #fbbf24;
  --info:      #60a5fa;
  
  /* ── Spacing scale ── */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  12px;
  --space-lg:  16px;
  --space-xl:  24px;
  --space-2xl: 32px;
  --space-3xl: 48px;
  
  /* ── Border radius ── */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 999px;
  
  /* ── Shadows ── */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,.2);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.25);
  --shadow-xl: 0 12px 48px rgba(0,0,0,.3);
  
  /* ── Glassmorphism ── */
  --glass-bg: rgba(19,19,26,.85);
  --glass-border: rgba(255,255,255,.05);
  --glass-shadow: 0 8px 32px rgba(0,0,0,.2);
  
  /* ── Typography ── */
  --font-size-xs: .65rem;
  --font-size-sm: .7rem;
  --font-size-md: .75rem;
  --font-size-lg: .85rem;
  --font-size-xl: 1rem;
  --font-size-2xl: 1.15rem;
  
  /* ── Transitions ── */
  --transition-fast: .15s ease;
  --transition-normal: .2s ease;
  --transition-slow: .3s ease;
  --transition-bounce: .3s cubic-bezier(.34,1.56,.64,1);
}

html, body { 
  background: var(--bg-gradient); 
  color: var(--text); 
  font-family: 'Space Mono', monospace; 
  min-height: 100%;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 9999; opacity: .5;
}

/* ── Sticky controls bar (Glassmorphism Premium) ── */
.controls-bar {
  position: sticky; 
  top: 0; 
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  padding: var(--space-lg) var(--space-2xl);
  display: flex;
  align-items: center;
  gap: var(--space-2xl);
  flex-wrap: wrap;
  box-shadow: var(--glass-shadow);
  transition: background var(--transition-slow), 
              box-shadow var(--transition-slow);
}

.controls-bar.scrolled {
  background: rgba(19,19,26,.95);
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
}

.bar-title {
  font-family: 'Syne', sans-serif;
  font-size: var(--font-size-2xl);
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: -.5px;
  position: relative;
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
}

.bar-title span:first-child {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.bar-title .subtitle {
  color: var(--text);
  font-size: var(--font-size-sm);
  opacity: .6;
}

.bar-title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-slow);
}

.controls-bar:hover .bar-title::after {
  transform: scaleX(1);
}

.bar-sliders {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
  flex-wrap: wrap;
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  flex: 1;
}

.download-options {
  display: flex;
  align-items: center;
  gap: 10px;
}

.download-options select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: 'Space Mono', monospace;
  cursor: pointer;
  transition: border var(--transition-normal);
}

.download-options select:hover {
  border-color: var(--border-hover);
}

.slider-group label {
  font-size: .65rem;
  color: var(--muted);
  white-space: nowrap;
  min-width: 70px;
}

.slider-group .val {
  font-size: .7rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 34px;
  text-align: right;
}

/* ── Custom Sliders (Premium Design) ── */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 8px;
  background: var(--border2);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
  border: none;
  position: relative;
  transition: background var(--transition-normal);
}

input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--border2) 100%);
  background-size: var(--range-fill, 50%) 100%;
  background-repeat: no-repeat;
  border-radius: var(--radius-full);
  border: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  border: 4px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent-dark), 
              0 4px 12px rgba(200,240,74,.4);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  z-index: 2;
  margin-top: -7px; /* Center vertically with track */
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 3px var(--accent-dark), 
              0 6px 16px rgba(200,240,74,.5);
}

input[type=range]::-webkit-slider-thumb:active {
  transform: scale(1.1);
  box-shadow: 0 0 0 4px var(--accent-dark), 
              0 4px 10px rgba(200,240,74,.6);
}

input[type=range]::-moz-range-track {
  width: 100%;
  height: 8px;
  background: var(--border2);
  border-radius: var(--radius-full);
  border: none;
}

input[type=range]::-moz-range-progress {
  height: 8px;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
}

input[type=range]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  border: 4px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent-dark), 
              0 4px 12px rgba(200,240,74,.4);
  cursor: pointer;
  transition: all var(--transition-normal);
}

input[type=range]::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 3px var(--accent-dark), 
              0 6px 16px rgba(200,240,74,.5);
}

input[type=range]:focus {
  outline: none;
}

input[type=range]:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(200,240,74,.4), 
              0 0 0 5px var(--bg),
              0 4px 12px rgba(200,240,74,.4);
}

input[type=range]:focus::-moz-range-thumb {
  box-shadow: 0 0 0 3px rgba(200,240,74,.4), 
              0 0 0 5px var(--bg),
              0 4px 12px rgba(200,240,74,.4);
}

.bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Premium Button Styles ── */
#btnConvert {
  padding: var(--space-md) var(--space-xl);
  background: var(--accent-gradient);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Syne', sans-serif;
  font-size: var(--font-size-lg);
  font-weight: 800;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(200,240,74,.2);
}

#btnConvert::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.1), transparent);
  transition: left var(--transition-slow);
}

#btnConvert:hover:not(:disabled) { 
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(200,240,74,.3);
}

#btnConvert:hover:not(:disabled)::before {
  left: 100%;
}

#btnConvert:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(200,240,74,.2);
}

#btnConvert:disabled {
  opacity: .5;
  cursor: not-allowed;
  filter: grayscale(0.5);
  transform: none !important;
  box-shadow: none !important;
}

/* Secondary Button */
#btnClear {
  padding: var(--space-sm) var(--space-lg);
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border2);
  border-radius: var(--radius-md);
  font-family: 'Space Mono', monospace;
  font-size: var(--font-size-sm);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

#btnClear::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(248,113,113,.05) 100%);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

#btnClear:hover {
  color: var(--error);
  border-color: var(--error);
  transform: translateY(-1px);
}

#btnClear:hover::before {
  opacity: 1;
}

#btnClear:active {
  transform: translateY(0);
}

/* Accent Button */
#btnDlAll {
  padding: var(--space-md) var(--space-lg);
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(200,240,74,.35);
  border-radius: var(--radius-md);
  font-family: 'Space Mono', monospace;
  font-size: var(--font-size-md);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

#btnDlAll::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(200,240,74,.05) 100%);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

#btnDlAll:hover {
  background: rgba(200,240,74,.07);
  border-color: rgba(200,240,74,.5);
  transform: translateY(-1px);
}

#btnDlAll:hover::before {
  opacity: 1;
}

#btnDlAll:active {
  transform: translateY(0);
}

/* ── Wrap ── */
.wrap { max-width: 1300px; margin: 0 auto; padding: 32px 24px 80px; }

/* ── Premium Drop Zone ── */
#dropzone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius-lg);
  padding: var(--space-3xl) var(--space-2xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  margin-bottom: var(--space-2xl);
  animation: fadeUp .4s var(--transition-bounce) both;
  position: relative;
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

#dropzone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(200,240,74,.03) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

#dropzone::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: var(--radius-lg);
  background: linear-gradient(45deg, var(--accent), transparent, var(--accent));
  opacity: 0;
  transition: opacity var(--transition-normal);
  z-index: -1;
}

#dropzone:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

#dropzone:hover::before {
  opacity: 1;
}

#dropzone.over {
  border-color: var(--accent);
  background: rgba(200,240,74,.05);
  animation: pulse-glow 1s ease infinite;
}

#dropzone.over::after {
  opacity: 1;
  animation: gradient-rotate 3s linear infinite;
}

#dropzone .drop-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  display: block;
  transition: all var(--transition-bounce);
  color: var(--accent);
  filter: drop-shadow(0 4px 8px rgba(200,240,74,.2));
}

#dropzone:hover .drop-icon {
  transform: translateY(-6px) scale(1.1);
}

#dropzone.over .drop-icon {
  animation: bounce 1s ease infinite;
}

#dropzone h2 {
  font-family: 'Syne', sans-serif;
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-bottom: var(--space-xs);
  color: var(--text);
}

#dropzone p {
  font-size: var(--font-size-sm);
  color: var(--muted);
  max-width: 300px;
  margin: 0 auto;
  line-height: 1.5;
}

#fileInput { display: none; }

/* Dropzone animations */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(200,240,74,.1), var(--shadow-lg); }
  50% { box-shadow: 0 0 30px rgba(200,240,74,.2), var(--shadow-lg); }
}

@keyframes gradient-rotate {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(-6px) scale(1.1); }
  50% { transform: translateY(-10px) scale(1.15); }
}

/* ── Premium Progress Bar ── */
.progress-wrap {
  margin-bottom: var(--space-xl);
  display: none;
  animation: fadeUp .3s var(--transition-bounce) both;
}

.progress-bar-bg {
  height: 6px;
  background: var(--border2);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-sm);
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.2);
}

.progress-bar-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent);
  animation: shimmer 2s infinite linear;
}

#progressBar {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow) cubic-bezier(.34,1.56,.64,1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(200,240,74,.3);
}

#progressBar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
  animation: progress-shimmer 1.5s infinite ease-in-out;
}

#statusText {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  transition: color var(--transition-normal);
}

#statusText.processing {
  color: var(--accent);
}

#statusText.complete {
  color: var(--ok);
}

#statusText.error {
  color: var(--error);
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes progress-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

/* ── Premium Gallery ── */
#gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
  animation: fadeUp .4s .1s var(--transition-bounce) both;
}

.gallery-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: slideIn .3s var(--transition-bounce) both;
  transition: all var(--transition-normal);
  position: relative;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: translateY(10px);
}

.gallery-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.gallery-item:hover { 
  border-color: var(--border-hover); 
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-lg);
}

.gallery-item.done  { 
  border-color: rgba(74,222,128,.3);
  box-shadow: 0 4px 20px rgba(74,222,128,.1);
}

.gallery-item.error { 
  border-color: rgba(248,113,113,.3);
  box-shadow: 0 4px 20px rgba(248,113,113,.1);
}

.gallery-item.loading {
  border-color: rgba(200,240,74,.3);
  box-shadow: 0 4px 20px rgba(200,240,74,.1);
}

/* canvas */
.gallery-item canvas {
  display: block;
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--bg);
}

.gallery-item .item-footer {
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  border-top: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.item-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--dim);
  flex-shrink: 0;
  transition: all var(--transition-normal);
  position: relative;
  box-shadow: 0 0 4px currentColor;
}

.gallery-item.done .item-dot {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: pulse-gentle 2s ease infinite;
}

.gallery-item.error .item-dot {
  background: var(--error);
  box-shadow: 0 0 8px var(--error);
  animation: pulse-gentle 2s ease infinite;
}

.gallery-item.loading .item-dot {
  background: var(--accent-gradient);
  box-shadow: 0 0 8px var(--accent);
  animation: spin-slow 1.5s linear infinite;
}

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

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

.item-name {
  flex: 1;
  font-size: var(--font-size-sm);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  transition: color var(--transition-normal);
  min-width: 0;
}

.gallery-item.done .item-name {
  color: var(--text-secondary);
}

.gallery-item:hover .item-name {
  color: var(--text);
}

.item-controls {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.item-zoom-container {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.item-dl {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: rgba(200,240,74,.1);
  color: var(--accent);
  border: 1px solid rgba(200,240,74,.3);
  border-radius: var(--radius-sm);
  font-family: 'Space Mono', monospace;
  font-size: var(--font-size-sm);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-normal);
  flex-shrink: 0;
  display: none;
  position: relative;
  overflow: hidden;
}

.item-dl::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(200,240,74,.1) 100%);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.item-dl:hover {
  background: rgba(200,240,74,.25);
  border-color: rgba(200,240,74,.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(200,240,74,.2);
}

.item-dl:hover::before {
  opacity: 1;
}

.item-dl:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(200,240,74,.1);
}

.gallery-item.done .item-dl {
  display: inline-flex;
  animation: slide-in-right .3s var(--transition-bounce) both;
}

/* Rotate Button */
.item-rotate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  font-family: 'Space Mono', monospace;
  font-size: var(--font-size-md);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-normal);
  flex-shrink: 0;
}

.item-rotate:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(200,240,74,.1);
  transform: rotate(-15deg);
}

.item-rotate:active {
  transform: rotate(0deg) scale(0.95);
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* spinner */
.item-spinner {
  position: absolute; top: 8px; right: 8px;
  width: 18px; height: 18px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}
.gallery-item.loading .item-spinner { display: block; }

/* dl all */
#dlAllWrap {
  margin-top: 24px;
  display: none;
  animation: fadeUp .3s ease both;
}
#btnDlAll {
  padding: 12px 28px;
  background: none;
  color: var(--accent);
  border: 1px solid rgba(200,240,74,.35);
  border-radius: var(--r);
  font-family: 'Space Mono', monospace;
  font-size: .75rem; font-weight: 700;
  cursor: pointer;
  transition: background .2s;
}
#btnDlAll:hover { background: rgba(200,240,74,.07); }

/* ── Premium Animations ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

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

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 0.5;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

@keyframes slide-up-fade {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--dim); border-radius: 3px; }

/* ── Controls Accessibility ── */
/* Select focus */
#aspectRatioSelect:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
#aspectRatioSelect:hover {
  border-color: var(--accent2);
}

/* Sliders accessibility */
input[type=range]::-webkit-slider-thumb:focus {
  box-shadow: 0 0 0 3px rgba(200, 240, 74, 0.4);
}
input[type=range]::-moz-range-thumb:focus {
  box-shadow: 0 0 0 3px rgba(200, 240, 74, 0.4);
}

/* Buttons accessibility */
button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:hover:not(:disabled) {
  transform: translateY(-1px);
}
button:active:not(:disabled) {
  transform: translateY(0);
}

/* ── Premium Controls Container ── */
.controls-container {
  margin: var(--space-2xl) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  animation: fadeUp .3s var(--transition-bounce) both;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  transition: all var(--transition-normal);
}

.controls-container:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.control-section {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
  outline: none;
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
}

/* Custom Select Styles */
.control-section select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-lg);
  font-family: 'Space Mono', monospace;
  font-size: var(--font-size-md);
  font-weight: 700;
  cursor: pointer;
  min-width: 160px;
  transition: all var(--transition-normal);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23c8f04a' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-sm) center;
  background-size: 12px;
  padding-right: var(--space-2xl);
}

.control-section select:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.control-section select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.control-section label {
  font-family: 'Space Mono', monospace;
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.control-section .slider-group {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 220px;
  flex: 1;
}

.control-section .slider-group label {
  font-size: var(--font-size-sm);
  color: var(--muted);
  white-space: nowrap;
  min-width: 60px;
}

.control-section .slider-group .val {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--accent);
  min-width: 40px;
  text-align: right;
  background: rgba(200,240,74,.1);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(200,240,74,.2);
}

/* Button styles in control section */
.control-section button {
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-family: 'Space Mono', monospace;
  font-size: var(--font-size-sm);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  display: none; /* Hidden by default, shown via JS */
}

.control-section #btnClear {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border2);
  display: none; /* JS controls visibility */
}

.control-section #btnConvert {
  background: var(--accent-gradient);
  color: var(--bg);
  border: none;
  font-family: 'Syne', sans-serif;
  font-size: var(--font-size-md);
  font-weight: 800;
  padding: var(--space-sm) var(--space-xl);
  display: inline-flex; /* Always visible but disabled */
  opacity: .5;
}

.control-section #btnConvert:not(:disabled) {
  opacity: 1;
}

.control-section #btnDlAll {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(200,240,74,.35);
  display: none; /* JS controls visibility */
}

/* Delete Button */
.item-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  font-family: 'Space Mono', monospace;
  font-size: var(--font-size-md);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-normal);
  flex-shrink: 0;
}

.item-delete:hover {
  color: var(--error);
  border-color: var(--error);
  background: rgba(248,113,113,.1);
  transform: scale(1.1);
}

.item-delete:active {
  transform: scale(0.95);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  #aspectRatioSelect:focus,
  input[type=range]:focus,
  button:focus {
    outline-width: 3px;
  }
}

/* ── Responsive Design ── */
@media (max-width: 768px) {
  .controls-bar {
    padding: var(--space-md) var(--space-lg);
    gap: var(--space-lg);
  }
  
  .bar-title {
    font-size: var(--font-size-lg);
  }
  
  .controls-container {
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
  }
  
  .control-section {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }
  
  .control-section .slider-group {
    min-width: 100%;
    width: 100%;
  }
  
  .control-section button {
    width: 100%;
    justify-content: center;
  }
  
  .control-section select {
    width: 100%;
  }
  
  #dropzone {
    padding: var(--space-2xl) var(--space-lg);
  }
  
  #gallery {
    grid-template-columns: 1fr;
  }
  
  .gallery-item {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .wrap {
    padding: var(--space-lg) var(--space-md) var(--space-3xl);
  }
  
  .controls-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }
  
  .controls-container {
    padding: var(--space-md);
  }
  
  #dropzone h2 {
    font-size: var(--font-size-md);
  }
  
  #dropzone p {
    font-size: var(--font-size-xs);
  }
}

/* Dark mode preference */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0f;
    --surface: #111118;
    --border: #1a1a24;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --accent: #d4ff00;
    --text: #ffffff;
    --bg: #000000;
  }
  
  .controls-bar {
    border-bottom: 2px solid var(--accent);
  }
  
  #dropzone {
    border: 2px dashed var(--accent);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .gallery-item:hover {
    transform: none !important;
  }
  
  button:hover, button:focus {
    transform: none !important;
  }
}

/* Print styles */
@media print {
  .controls-bar,
  #dropzone,
  .controls-container,
  .progress-wrap,
  #btnClear,
  #btnConvert,
  #btnDlAll {
    display: none !important;
  }
  
  .gallery-item {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #ccc;
    box-shadow: none;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .gallery-item:hover {
    transform: none !important;
  }
  
  button:hover, button:focus {
    transform: none !important;
  }
}

/* Print styles */
@media print {
  .controls-bar,
  #dropzone,
  .controls-container,
  .progress-wrap,
  #btnClear,
  #btnConvert,
  #btnDlAll {
    display: none !important;
  }
  
  .gallery-item {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #ccc;
    box-shadow: none;
  }
}
