:root {
  color-scheme: dark;
  --bg: #090b12;
  --panel: rgba(16, 22, 34, 0.84);
  --panel-strong: rgba(22, 31, 47, 0.94);
  --line: rgba(139, 160, 202, 0.2);
  --line-strong: rgba(120, 222, 255, 0.38);
  --text: #f4f7fb;
  --muted: #9fabbd;
  --cyan: #39d9ff;
  --mint: #28f2a6;
  --pink: #ff4fd8;
  --amber: #ffc857;
  --danger: #ff5b79;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(57, 217, 255, 0.18), transparent 24rem),
    radial-gradient(circle at 85% 10%, rgba(255, 79, 216, 0.15), transparent 22rem),
    linear-gradient(135deg, #070810 0%, #0c1320 48%, #120f1f 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.ambient-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0.72;
  pointer-events: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1380px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.topbar {
  margin-bottom: 24px;
}

.header-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.hero-art {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  height: auto;
  margin: 0 auto;
  border: 1px solid rgba(57, 217, 255, 0.28);
  border-radius: var(--radius);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(57, 217, 255, 0.12), transparent 58%),
    rgba(8, 14, 25, 0.68);
  box-shadow:
    0 18px 56px rgba(0, 0, 0, 0.36),
    0 0 38px rgba(57, 217, 255, 0.12);
}

.hero-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

.hero-title-card {
  position: absolute;
  left: clamp(18px, 3vw, 38px);
  bottom: clamp(18px, 3vw, 36px);
  z-index: 1;
  max-width: min(64%, 610px);
  margin: 0;
  border: 1px solid rgba(57, 217, 255, 0.32);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(6, 12, 23, 0.88), rgba(12, 23, 38, 0.64)),
    rgba(7, 12, 21, 0.78);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.36),
    0 0 28px rgba(40, 242, 166, 0.12);
  padding: clamp(12px, 1.6vw, 18px) clamp(16px, 2.4vw, 28px);
  backdrop-filter: blur(14px);
}

.section-kicker {
  margin: 0 0 6px;
  color: var(--mint);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 620px;
  font-size: clamp(1.7rem, 3.25vw, 3.25rem);
  line-height: 1;
  font-weight: 850;
  white-space: nowrap;
  color: #eefcff;
  letter-spacing: 0;
  text-shadow:
    0 6px 18px rgba(0, 0, 0, 0.52),
    0 0 18px rgba(40, 242, 166, 0.2);
}

h2 {
  font-size: 1.08rem;
}

.privacy-pill,
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid rgba(40, 242, 166, 0.28);
  border-radius: 999px;
  background: rgba(40, 242, 166, 0.1);
  color: #c9ffe9;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.privacy-pill {
  flex: 0 0 auto;
  width: fit-content;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(18px);
}

.privacy-pill svg,
button svg,
.download-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.status-chip {
  border-color: rgba(57, 217, 255, 0.28);
  background: rgba(57, 217, 255, 0.09);
  color: #c6f4ff;
}

.status-chip.muted {
  border-color: rgba(159, 171, 189, 0.18);
  background: rgba(159, 171, 189, 0.08);
  color: var(--muted);
}

.status-chip.warning {
  border-color: rgba(255, 200, 87, 0.38);
  background: rgba(255, 200, 87, 0.12);
  color: #ffe1a1;
}

.status-chip.error {
  border-color: rgba(255, 91, 121, 0.42);
  background: rgba(255, 91, 121, 0.12);
  color: #ffc7d1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(139, 160, 202, 0.14);
}

.upload-panel,
.preview-panel {
  grid-column: span 1;
}

.config-panel,
.progress-panel {
  grid-column: span 1;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 278px;
  margin: 20px;
  padding: 28px;
  border: 1px dashed rgba(57, 217, 255, 0.42);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(57, 217, 255, 0.12), rgba(255, 79, 216, 0.08)),
    rgba(5, 11, 20, 0.68);
  text-align: center;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: rgba(40, 242, 166, 0.72);
  transform: translateY(-1px);
  background:
    linear-gradient(135deg, rgba(40, 242, 166, 0.13), rgba(255, 79, 216, 0.1)),
    rgba(6, 14, 24, 0.78);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin-bottom: 18px;
  border: 1px solid rgba(57, 217, 255, 0.32);
  border-radius: 50%;
  background: rgba(57, 217, 255, 0.12);
  color: var(--cyan);
}

.drop-icon svg {
  width: 38px;
  height: 38px;
}

.drop-title {
  display: block;
  font-size: 1.35rem;
  font-weight: 850;
}

.drop-subtitle {
  display: block;
  max-width: 560px;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.55;
}

.file-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 20px 20px;
}

.file-summary > div,
.stat {
  border: 1px solid rgba(139, 160, 202, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  padding: 14px;
}

.summary-label,
.stat span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.file-summary strong,
.stat strong {
  display: block;
  overflow-wrap: anywhere;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 20px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.control-label {
  color: #d8e3f0;
  font-size: 0.86rem;
  font-weight: 750;
}

select,
input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(139, 160, 202, 0.22);
  border-radius: var(--radius);
  background: rgba(5, 10, 18, 0.82);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

select:focus,
input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(57, 217, 255, 0.12);
}

select:disabled,
input:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 20px 20px;
}

.control-label {
  margin-right: 6px;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid rgba(139, 160, 202, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  padding: 0 14px;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.segmented input:checked + span {
  border-color: rgba(255, 79, 216, 0.42);
  background: rgba(255, 79, 216, 0.16);
  color: #ffd7f6;
}

.action-row {
  display: flex;
  gap: 10px;
  padding: 0 20px 20px;
}

button,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 16px;
  color: var(--text);
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease,
    border-color 160ms ease;
}

button:not(:disabled):hover,
.download-button:not(.disabled):hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(135deg, var(--cyan), var(--pink));
  color: #07101b;
  flex: 1;
}

.primary-button:not(:disabled):hover {
  box-shadow:
    0 12px 34px rgba(255, 79, 216, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  filter: saturate(1.08) brightness(1.04);
}

.secondary-button {
  border: 1px solid rgba(139, 160, 202, 0.22);
  background: rgba(255, 255, 255, 0.06);
}

.secondary-button:not(:disabled):hover {
  border-color: rgba(57, 217, 255, 0.42);
  box-shadow: 0 10px 28px rgba(57, 217, 255, 0.12);
}

.progress-wrap {
  padding: 20px;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(139, 160, 202, 0.16);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--cyan), var(--pink));
  transition: width 180ms ease;
}

#progressText {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 20px 20px;
}

.stat strong {
  color: var(--cyan);
  font-size: 1.25rem;
}

.download-button {
  width: calc(100% - 40px);
  margin: 0 20px 20px;
  background: linear-gradient(135deg, var(--mint), var(--amber));
  color: #07101b;
}

.download-button.disabled {
  pointer-events: none;
  opacity: 0.45;
  filter: saturate(0.5);
  cursor: not-allowed;
}

.preview-panel {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow: auto;
  max-height: 420px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid rgba(139, 160, 202, 0.14);
  padding: 14px 18px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-strong);
  color: #dbe7f7;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  color: #eaf1f9;
}

.variant-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.variant-list span {
  border: 1px solid rgba(139, 160, 202, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: #cbd6e4;
  padding: 4px 8px;
  font-size: 0.78rem;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1020px) {
  .workspace,
  .form-grid,
  .file-summary {
    grid-template-columns: 1fr;
  }

  .hero-art {
    max-width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 780px) {
  .header-tools {
    justify-content: flex-start;
  }

  .hero-title-card {
    max-width: calc(100% - 32px);
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1380px);
    padding-top: 18px;
  }

  h1 {
    font-size: clamp(1.34rem, 7.1vw, 2.05rem);
    white-space: nowrap;
  }

  .panel-header,
  .action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .privacy-pill,
  .status-chip {
    width: fit-content;
    max-width: 100%;
    white-space: normal;
  }

  .hero-title-card {
    left: 12px;
    bottom: 12px;
    padding: 10px 12px;
  }

  .drop-zone {
    margin: 14px;
    min-height: 236px;
    padding: 20px;
  }

  .form-grid,
  .progress-wrap,
  .stats-grid,
  .control-row,
  .action-row {
    padding-left: 14px;
    padding-right: 14px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .download-button {
    width: calc(100% - 28px);
    margin-left: 14px;
    margin-right: 14px;
  }
}
