*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --spr-primary: #90527b;
  --spr-dark: #6b3a5e;
  --spr-deeper: #4e2545;
  --spr-accent: #842b45;
  --spr-light: #fff1fa;
  --spr-pale: #f8edf4;
  --spr-border: #dec7d8;
  --spr-text: #2e2030;
  --spr-muted: #7a6874;
  --spr-white: #ffffff;
  --spr-bg: #faf5f8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 12px rgba(144, 82, 123, 0.08);
  --shadow-md: 0 8px 32px rgba(144, 82, 123, 0.14);
  --shadow-lg: 0 20px 60px rgba(144, 82, 123, 0.18);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "DM Sans", sans-serif;
  background: var(--spr-bg);
  color: var(--spr-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
}

/* ── Background decoration ── */
body::before {
  content: "";
  position: fixed;
  top: -120px;
  right: -120px;
  width: 480px;
  height: 480px;
  background: radial-gradient(
    circle,
    rgba(144, 82, 123, 0.12) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: "";
  position: fixed;
  bottom: -80px;
  left: -80px;
  width: 360px;
  height: 360px;
  background: radial-gradient(
    circle,
    rgba(132, 43, 69, 0.08) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

/* ── Header ── */
header {
  width: 100%;
  padding: 28px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 10;
  animation: fadeDown 0.6s ease both;
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-emblem {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--spr-primary), var(--spr-accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(144, 82, 123, 0.3);
}

.logo-emblem svg {
  width: 24px;
  height: 24px;
  fill: white;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.logo-company {
  font-family: "Cormorant Garamond", serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--spr-primary);
  letter-spacing: 0.04em;
}

.logo-sub {
  font-size: 10px;
  font-weight: 500;
  color: var(--spr-muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 2px;
}

.header-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--spr-primary);
  background: var(--spr-light);
  border: 1px solid var(--spr-border);
  padding: 6px 14px;
  border-radius: 20px;
  letter-spacing: 0.06em;
}

/* ── Divider line ── */
.header-rule {
  width: calc(100% - 96px);
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--spr-border),
    transparent
  );
  position: relative;
  z-index: 10;
  animation: fadeIn 0.8s 0.2s ease both;
}

/* ── Main ── */
main {
  width: 100%;
  max-width: 820px;
  padding: 52px 24px 80px;
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Hero title ── */
.hero {
  text-align: center;
  margin-bottom: 52px;
  animation: fadeUp 0.7s 0.1s ease both;
}

.hero-eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--spr-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.hero-eyebrow::before,
.hero-eyebrow::after {
  content: "";
  display: inline-block;
  width: 32px;
  height: 1px;
  background: var(--spr-border);
}

.hero h1 {
  font-family: "Cormorant Garamond", serif;
  font-size: 48px;
  font-weight: 600;
  color: var(--spr-deeper);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}

.hero h1 span {
  color: var(--spr-primary);
}

.hero-desc {
  font-size: 14px;
  color: var(--spr-muted);
  font-weight: 400;
  line-height: 1.6;
  max-width: 440px;
  margin: 0 auto;
}

/* ── Upload cards ── */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
  animation: fadeUp 0.7s 0.25s ease both;
}

.upload-card {
  background: var(--spr-white);
  border: 1.5px solid var(--spr-border);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
  position: relative;
  overflow: hidden;
}

.upload-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(to right, var(--spr-primary), var(--spr-accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.upload-card:hover::before,
.upload-card.active::before {
  transform: scaleX(1);
}

.upload-card:hover {
  border-color: var(--spr-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.upload-card.active {
  border-color: var(--spr-primary);
  box-shadow: var(--shadow-md);
}

.upload-card.has-file {
  border-color: #4caf50;
}

.upload-card.has-file::before {
  background: linear-gradient(to right, #4caf50, #66bb6a);
  transform: scaleX(1);
}

.card-number {
  width: 28px;
  height: 28px;
  background: var(--spr-pale);
  border: 1px solid var(--spr-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--spr-primary);
  flex-shrink: 0;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--spr-text);
  letter-spacing: 0.01em;
}

.card-drop-zone {
  border: 1.5px dashed var(--spr-border);
  border-radius: var(--radius-sm);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition);
  position: relative;
}

.card-drop-zone:hover,
.card-drop-zone.drag-over {
  background: var(--spr-light);
  border-color: var(--spr-primary);
}

.card-drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  background: var(--spr-pale);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--spr-primary);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drop-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--spr-text);
  margin-bottom: 4px;
}

.drop-sub {
  font-size: 11.5px;
  color: var(--spr-muted);
}

.drop-sub strong {
  color: var(--spr-primary);
}

.file-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: var(--spr-pale);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--spr-primary);
}

.file-note svg {
  width: 14px;
  height: 14px;
  stroke: var(--spr-primary);
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
  margin-top: 1px;
}

.file-note-text {
  font-size: 11.5px;
  color: var(--spr-muted);
  line-height: 1.5;
}

.file-note-text strong {
  color: var(--spr-text);
  font-family: "Courier New", monospace;
  font-size: 11px;
  background: var(--spr-white);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--spr-border);
}

/* ── File selected state ── */
.file-selected {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f0faf1;
  border: 1px solid #a8d5ab;
  border-radius: var(--radius-sm);
  margin-top: -4px;
}

.file-selected.visible {
  display: flex;
}

.file-selected svg {
  width: 16px;
  height: 16px;
  stroke: #4caf50;
  fill: none;
  stroke-width: 2.2;
  flex-shrink: 0;
}

.file-selected-name {
  font-size: 12px;
  font-weight: 500;
  color: #2d6b30;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.file-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: #7a9e7b;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}

.file-clear:hover {
  color: #c62828;
}
.file-clear svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* ── Action bar ── */
.action-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  animation: fadeUp 0.7s 0.4s ease both;
}

.btn-run {
  flex: 1;
  height: 56px;
  background: linear-gradient(
    135deg,
    var(--spr-primary) 0%,
    var(--spr-accent) 100%
  );
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(144, 82, 123, 0.35);
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    opacity var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-run::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.15) 0%,
    transparent 60%
  );
  pointer-events: none;
}

.btn-run:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(144, 82, 123, 0.45);
}

.btn-run:active:not(:disabled) {
  transform: translateY(0);
}

.btn-run:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-run svg {
  width: 18px;
  height: 18px;
  stroke: white;
  fill: none;
  stroke-width: 2;
}

/* ── Spinner ── */
.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-run.loading .btn-run-icon,
.btn-run.loading .btn-run-text {
  display: none;
}

.btn-run.loading .spinner {
  display: block;
}

/* ── Download section ── */
.download-section {
  display: none;
  margin-top: 24px;
  animation: fadeUp 0.5s ease both;
}

.download-section.visible {
  display: block;
}

.download-card {
  background: var(--spr-white);
  border: 1.5px solid #a8d5ab;
  border-radius: var(--radius);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 4px 20px rgba(76, 175, 80, 0.1);
}

.download-icon-wrap {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.download-icon-wrap svg {
  width: 24px;
  height: 24px;
  stroke: #388e3c;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.download-info {
  flex: 1;
}

.download-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #4caf50;
  margin-bottom: 4px;
}

.download-filename {
  font-family: "Courier New", monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--spr-text);
  letter-spacing: 0.02em;
}

.download-meta {
  font-size: 12px;
  color: var(--spr-muted);
  margin-top: 3px;
}

.btn-download {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #43a047, #2e7d32);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 14px rgba(56, 142, 60, 0.3);
  transition:
    transform var(--transition),
    box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(56, 142, 60, 0.4);
}

.btn-download svg {
  width: 15px;
  height: 15px;
  stroke: white;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Status / error ── */
.status-message {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-top: 16px;
}

.status-message.visible {
  display: flex;
}

.status-message.error {
  background: #fff3f3;
  border: 1px solid #ffcdd2;
  color: #c62828;
}

.status-message.info {
  background: var(--spr-light);
  border: 1px solid var(--spr-border);
  color: var(--spr-primary);
}

.status-message svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

/* ── Progress bar ── */
.progress-wrap {
  display: none;
  margin-top: 16px;
  animation: fadeIn 0.3s ease both;
}

.progress-wrap.visible {
  display: block;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--spr-muted);
  margin-bottom: 8px;
}

.progress-bar-track {
  height: 6px;
  background: var(--spr-pale);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--spr-primary), var(--spr-accent));
  border-radius: 99px;
  width: 0%;
  transition: width 0.4s ease;
}

/* ── Footer ── */
footer {
  width: 100%;
  text-align: center;
  padding: 24px 48px;
  font-size: 12px;
  color: var(--spr-muted);
  position: relative;
  z-index: 10;
  animation: fadeIn 1s 0.6s ease both;
  border-top: 1px solid var(--spr-border);
  margin-top: auto;
}

footer span {
  color: var(--spr-primary);
  font-weight: 500;
}

/* ── Animations ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pulse-border {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(144, 82, 123, 0);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(144, 82, 123, 0.15);
  }
}

/* ── Responsive ── */
@media (max-width: 600px) {
  header {
    padding: 20px 24px;
  }
  .header-rule {
    width: calc(100% - 48px);
  }
  main {
    padding: 36px 16px 60px;
  }
  .hero h1 {
    font-size: 34px;
  }
  .upload-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .download-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .btn-download {
    width: 100%;
    justify-content: center;
  }
}