:root {
  --bg-0: #f3efff;
  --bg-1: #e7dcfb;
  --bg-2: #faf7ff;
  --panel: #ffffff;
  --text: #130f1f;
  --muted: #5f567a;
  --border: #dbcff7;
  --brand: #8d5bc1;
  --brand-strong: #7a44b1;
  --brand-deep: #341a52;
  --ink-btn: #1d1336;
  --danger: #ab2940;
  --shadow: #26124733;
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 600px at 0% -10%, #cbb3ff9a 0%, #cbb3ff00 60%),
    radial-gradient(1000px 500px at 90% 0%, #b69bff54 0%, #b69bff00 50%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 45%, var(--bg-2));
}

.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(#ffffff26 0.8px, transparent 0.8px);
  background-size: 2px 2px;
  opacity: 0.45;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 940px;
  margin: 0 auto;
  padding: 2.4rem 1rem 3rem;
}

.hero {
  margin-bottom: 1rem;
}

.eyebrow {
  width: fit-content;
  margin: 0 0 0.65rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid #00000014;
  border-radius: 999px;
  color: var(--brand-deep);
  background: #ffffff96;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: clamp(2rem, 4.2vw, 3.2rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
}

.hero p {
  max-width: 700px;
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.card {
  margin-top: 1rem;
  border-radius: 22px;
  border: 1px solid #ffffff70;
  background:
    linear-gradient(140deg, #ffffffeb 0%, #fcf9ffeb 50%, #f7f1ffeb 100%);
  box-shadow:
    0 24px 60px -34px var(--shadow),
    inset 0 1px 0 #ffffffdd;
  backdrop-filter: blur(8px);
}

.workspace {
  padding: 1.2rem;
}

.dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 18px;
  padding: 2.4rem 1rem;
  text-align: center;
  background: linear-gradient(180deg, #fffffffa 0%, #fbf8ff 100%);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}

.dropzone::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(
      120deg,
      #8d5bc100 20%,
      #8d5bc122 50%,
      #8d5bc100 85%
    );
  opacity: 0;
  transition: opacity 0.2s ease;
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone.drag-over {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px #8d5bc132;
  transform: translateY(-1px);
}

.dropzone.drag-over::before {
  opacity: 1;
}

.dropzone-title {
  position: relative;
  margin: 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.dropzone-hint {
  position: relative;
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.controls {
  margin-top: 1rem;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.control {
  display: grid;
  gap: 0.45rem;
}

.control-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  color: #4f4384;
}

select {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  font-size: 0.96rem;
  font-family: inherit;
  padding: 0 0.8rem;
}

.range-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
}

.range-value {
  min-width: 2ch;
  font-weight: 700;
  color: var(--brand-deep);
}

.actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 12px;
  min-height: 44px;
  padding: 0.75rem 1.15rem;
  font-family: inherit;
  font-size: 0.93rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background-color 0.2s ease;
}

button:focus-visible,
select:focus-visible {
  outline: 3px solid #8d5bc166;
  outline-offset: 2px;
}

#optimizeBtn {
  color: #fff;
  background: linear-gradient(120deg, var(--brand-deep), var(--brand-strong) 52%, var(--brand));
  box-shadow: 0 10px 22px -14px #2d1649c7;
}

#optimizeBtn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -16px #2d1649d9;
}

#optimizeBtn:disabled {
  cursor: not-allowed;
  background: linear-gradient(120deg, #6f4b9f, #8d5bc1);
  opacity: 0.7;
  box-shadow: none;
}

#clearBtn {
  color: #2d2450;
  background: #eee7ff;
}

#clearBtn:hover {
  background: #e3d8ff;
}

.status {
  margin: 0.95rem 0 0;
  color: var(--muted);
  font-weight: 500;
}

.status.error {
  color: var(--danger);
}

.file-list-wrap {
  padding: 1rem;
}

.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.8rem;
  margin-bottom: 0.75rem;
}

.queue-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-family: "Space Grotesk", "Manrope", sans-serif;
}

.queue-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 300px;
  overflow: auto;
  display: grid;
  gap: 0.5rem;
}

.file-list:empty::before {
  content: "No files in queue yet.";
  display: block;
  padding: 0.8rem;
  border-radius: 12px;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.file-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.62rem 0.75rem;
  background: #fcfaff;
  font-size: 0.93rem;
}

@media (max-width: 720px) {
  .app {
    padding-top: 1.5rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .workspace {
    padding: 0.9rem;
  }

  .queue-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
