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

:root {
  --bg-base: #060612;
  --bg-card: rgba(255, 255, 255, 0.045);
  --bg-card-hover: rgba(255, 255, 255, 0.075);
  --border: rgba(255, 255, 255, 0.09);
  --border-hover: rgba(255, 255, 255, 0.18);
  --purple-400: #a78bfa;
  --purple-500: #8b5cf6;
  --purple-600: #7c3aed;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --green-400: #34d399;
  --amber-400: #fbbf24;
  --red-400: #f87171;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 8px 40px rgba(0, 0, 0, 0.4);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--font);
  color: var(--text-primary);
  line-height: 1.6;
  background:
    radial-gradient(1200px 640px at 0% -10%, rgba(124, 58, 237, 0.34), transparent 62%),
    radial-gradient(980px 580px at 100% 35%, rgba(59, 130, 246, 0.24), transparent 60%),
    radial-gradient(760px 420px at 45% 105%, rgba(8, 145, 178, 0.18), transparent 65%),
    var(--bg-base);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(6, 6, 18, 0.76);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(180%);
}

.header-inner {
  width: min(900px, calc(100% - 48px));
  height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.logo,
.header-badge,
.upload-heading,
.selected-file,
.file-info,
.primary-action,
.secondary-action,
.results-title,
.card-header,
.empty-state,
.error-card,
.dropzone {
  display: flex;
  align-items: center;
}

.logo {
  gap: 10px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--purple-600), var(--blue-500));
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.38);
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 800;
}

.logo-text span,
.hero h1 span {
  color: transparent;
  background: linear-gradient(90deg, var(--purple-400), var(--blue-400));
  -webkit-background-clip: text;
  background-clip: text;
}

.header-badge {
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--text-muted);
}

.header-badge[data-status="online"] .badge-dot {
  background: var(--green-400);
  box-shadow: 0 0 8px var(--green-400);
}

.header-badge[data-status="offline"] .badge-dot {
  background: var(--red-400);
}

.main {
  position: relative;
  z-index: 1;
  width: min(900px, calc(100% - 48px));
  margin: 0 auto;
  padding: 0 0 72px;
}

.hero {
  padding: 72px 0 52px;
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--purple-400);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 760px;
  margin: 0 auto 18px;
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 900;
  line-height: 1.12;
}

.hero p {
  max-width: 610px;
  margin: 0 auto;
  color: var(--text-secondary);
  font-size: 1.04rem;
}

.upload-section,
.results {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
}

.upload-card {
  padding: 6px;
}

.upload-heading {
  justify-content: space-between;
  gap: 18px;
  padding: 18px 18px 12px;
}

.upload-heading p {
  margin-bottom: 4px;
  color: var(--purple-400);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.upload-heading h2,
.results-title h2,
.empty-state h2,
.error-card h2 {
  font-size: 1.08rem;
  line-height: 1.2;
}

.icon-button {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.icon-button:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.icon-button.danger {
  color: var(--red-400);
}

.dropzone {
  min-height: 300px;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 52px 32px;
  border: 2px dashed rgba(139, 92, 246, 0.34);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  outline: none;
  transition: all var(--transition);
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--purple-500);
  background: rgba(139, 92, 246, 0.06);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1), inset 0 0 40px rgba(139, 92, 246, 0.05);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 50%;
  color: var(--purple-400);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.15));
  transition: transform var(--transition);
}

.dropzone:hover .drop-icon {
  transform: translateY(-4px);
}

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

.drop-main {
  color: var(--text-primary);
  font-size: 1.08rem;
  font-weight: 800;
}

.drop-sub {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.format-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.format-row span,
.card-badge {
  padding: 3px 10px;
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--purple-400);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.selected-file {
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
}

.file-info {
  min-width: 0;
  flex: 1;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  background: rgba(59, 130, 246, 0.07);
}

.file-icon,
.card-icon,
.results-title span,
.empty-state>span,
.error-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.file-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  color: var(--blue-400);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
}

.file-meta {
  min-width: 0;
}

.file-meta strong,
.file-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta strong {
  color: var(--text-primary);
  font-size: 0.92rem;
}

.file-meta span,
.empty-state p,
.error-card p {
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.primary-action,
.secondary-action {
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 800;
  transition: all var(--transition);
}

.primary-action {
  width: calc(100% - 32px);
  min-height: 50px;
  margin: 0 16px 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--purple-600), var(--blue-500));
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35);
}

.primary-action:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.5);
}

.primary-action:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.secondary-action {
  margin-left: auto;
  padding: 7px 12px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: transparent;
  font-size: 0.8rem;
}

.secondary-action:hover,
.secondary-action.is-copied {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.loading-card {
  padding: 34px 28px;
  display: grid;
  justify-items: center;
  gap: 18px;
}

.loading-animation {
  position: relative;
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  color: var(--purple-400);
}

.loading-animation span {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-top-color: var(--purple-500);
  border-radius: 50%;
  animation: spin 1.1s linear infinite;
}

.loading-animation span:nth-child(2) {
  inset: 9px;
  border-top-color: var(--blue-400);
  animation-duration: 0.85s;
  animation-direction: reverse;
}

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

.progress-bar {
  width: min(420px, 100%);
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple-500), var(--blue-400));
  transition: width 0.3s ease;
}

#progressText {
  color: var(--text-secondary);
  font-weight: 700;
}

.workspace {
  margin-top: 34px;
}

.empty-state,
.error-card {
  min-height: 280px;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 42px 28px;
  text-align: center;
}

.empty-state>span,
.error-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  color: var(--purple-400);
}

.error-icon {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.22);
  color: var(--red-400);
}

.results-header {
  margin-bottom: 8px;
}

.results-title {
  gap: 12px;
}

.results-title span {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: 10px;
  color: var(--green-400);
  background: rgba(52, 211, 153, 0.15);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.stat-card span {
  display: block;
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--green-400);
  font-size: clamp(1.15rem, 3.5vw, 1.5rem);
  font-weight: 900;
  line-height: 1.1;
}

.stat-card small {
  display: block;
  margin-top: 5px;
  color: var(--text-secondary);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.result-card {
  padding: 22px 24px;
}

.card-header {
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.card-header h3 {
  flex: 1;
  color: var(--text-primary);
  font-size: 0.94rem;
}

.card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.card-icon.blue {
  color: var(--blue-400);
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.card-icon.green {
  color: var(--green-400);
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.card-icon.purple {
  color: var(--purple-400);
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.card-icon.gray {
  color: var(--text-secondary);
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--border);
}

.details {
  margin: 0;
}

.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

.detail-row:last-child {
  border-bottom: 0;
}

dt {
  min-width: 132px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
}

dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 800;
}

.muted-line {
  color: var(--text-muted);
  font-size: 0.86rem;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  font-size: 0.84rem;
}

th {
  padding: 10px 14px;
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  color: var(--text-secondary);
  vertical-align: top;
  overflow-wrap: anywhere;
}

tr:last-child td {
  border-bottom: 0;
}

pre {
  max-height: 380px;
  overflow: auto;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.72);
  color: #dbeafe;
  font-size: 0.8rem;
  line-height: 1.55;
}

.footer {
  position: relative;
  z-index: 1;
  padding: 28px 24px 34px;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.82rem;
}

@media (max-width: 760px) {

  .header-inner,
  .main {
    width: min(100% - 28px, 900px);
  }

  .hero {
    padding: 48px 0 34px;
  }

  .dropzone {
    min-height: 240px;
    padding: 38px 20px;
  }

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

  .detail-row {
    flex-direction: column;
    gap: 4px;
  }

  dt {
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .logo-text {
    font-size: 1rem;
  }

  .header-badge {
    padding: 6px 10px;
    font-size: 0.72rem;
  }

  .upload-heading {
    align-items: flex-start;
  }

  .selected-file {
    align-items: stretch;
  }

  .file-info {
    min-width: 0;
  }
}