:root {
  color-scheme: dark;
  --bg: #070a10;
  --bg-soft: #0e1320;
  --panel: rgba(14, 19, 32, 0.82);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: #e8edf7;
  --muted: #98a3b8;
  --accent: #76d7ff;
  --accent-strong: #40ffa5;
  --warning: #ffd36f;
  --danger: #ff8a8a;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI Variable", "Trebuchet MS", "Gill Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(64, 255, 165, 0.15), transparent 32%),
    radial-gradient(circle at top right, rgba(118, 215, 255, 0.12), transparent 28%),
    linear-gradient(180deg, #06080d 0%, #090d16 48%, #05070c 100%);
}

body.processing {
  overflow: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black, transparent 85%);
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 24px auto 40px;
  display: grid;
  gap: 18px;
}

.topbar,
.hero,
.workspace,
.lower-grid {
  display: grid;
  gap: 18px;
}

.topbar {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  font-weight: 700;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: -0.03em;
}

h2 {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: clamp(1.7rem, 3vw, 2.8rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

h3 {
  font-size: 1.18rem;
  line-height: 1.15;
}

h4 {
  font-size: 0.98rem;
}

.topbar-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge,
.subtle-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
}

.badge-live {
  color: #d9fff0;
  border-color: rgba(64, 255, 165, 0.22);
  background: rgba(64, 255, 165, 0.1);
}

.panel {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(18, 24, 39, 0.94), rgba(11, 16, 28, 0.88));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  grid-template-columns: 1.2fr 0.8fr;
  padding: 28px;
}

.hero-copy {
  display: grid;
  gap: 16px;
  align-content: start;
}

.hero-text {
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.7;
}

.hint {
  color: var(--warning);
  font-size: 0.95rem;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.artifact-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.artifact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.artifact-list {
  display: grid;
  gap: 8px;
}

.artifact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--text);
  text-decoration: none;
}

.artifact-item:hover {
  background: rgba(118, 215, 255, 0.08);
}

.artifact-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.artifact-empty {
  color: var(--muted);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  transition:
    transform 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.primary,
.secondary,
.ghost {
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
}

.primary {
  color: #061017;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
}

.secondary,
.ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ghost {
  background: rgba(118, 215, 255, 0.08);
}

.hero-stats {
  display: grid;
  gap: 12px;
}

.stat-card {
  border-radius: var(--radius-lg);
  padding: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-card {
  border-radius: var(--radius-lg);
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 12px;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.preview-pane {
  min-width: 0;
  margin: 0;
  display: grid;
  gap: 7px;
}

.preview-pane figcaption {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

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

.preview-frame {
  position: relative;
  min-height: 220px;
  border-radius: 18px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(118, 215, 255, 0.12), rgba(64, 255, 165, 0.08)),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 35%),
    #090d16;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-frame-small {
  min-height: 118px;
}

.preview-mask-frame {
  background: #ffffff;
}

.preview-frame img {
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: contain;
  display: block;
}

.preview-frame-small img {
  min-height: 118px;
}

.preview-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  line-height: 1.6;
}

.stat-label,
.label,
.subtle-text {
  color: var(--muted);
}

.stat-label {
  display: block;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
}

.workspace {
  grid-template-columns: 1.45fr 0.95fr;
  align-items: start;
}

.upload-panel,
.formats-panel,
.lower-grid .panel {
  padding: 24px;
}

.panel-head,
.control-head,
.group-head,
.file-row,
.guidance-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-head {
  margin-bottom: 18px;
}

.dropzone {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(118, 215, 255, 0.3);
  background:
    linear-gradient(180deg, rgba(118, 215, 255, 0.08), rgba(64, 255, 165, 0.05));
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.dropzone strong {
  display: block;
  margin-bottom: 6px;
}

.dropzone p,
.format-desc,
.hero-text,
.guidance-value,
.output-note p {
  color: var(--muted);
}

.dropzone:hover,
.dropzone.dragging {
  border-color: rgba(118, 215, 255, 0.7);
  transform: translateY(-1px);
}

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  color: #061017;
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
}

.file-row {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  flex-wrap: wrap;
}

.value {
  margin-top: 4px;
  font-weight: 700;
}

.settings-group {
  margin-top: 22px;
  display: grid;
  gap: 14px;
}

.option-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.option-card input {
  margin-top: 4px;
  accent-color: var(--accent);
}

.option-card strong {
  display: block;
  margin-bottom: 4px;
}

.option-card small {
  color: var(--muted);
  line-height: 1.5;
}

.option-card-accent {
  border-color: rgba(118, 215, 255, 0.2);
  background: linear-gradient(135deg, rgba(118, 215, 255, 0.07), rgba(64, 255, 165, 0.04));
}

.option-card-accent:has(input:checked) {
  border-color: rgba(64, 255, 165, 0.48);
  box-shadow: inset 0 0 0 1px rgba(64, 255, 165, 0.08);
}

.segment {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.segment.active {
  color: #061017;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
}

.segmented {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.control-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

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

.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 62px;
  height: 34px;
  margin-top: 14px;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  pointer-events: auto;
}

.toggle-track {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: background 140ms ease;
  position: relative;
  pointer-events: none;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%);
  transition: transform 140ms ease;
}

.toggle input:checked + .toggle-track {
  background: rgba(64, 255, 165, 0.24);
}

.toggle input:checked + .toggle-track::after {
  transform: translate(28px, -50%);
}

.format-list {
  display: grid;
  gap: 10px;
}

.format-card {
  display: grid;
  gap: 4px;
  padding: 14px 14px 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.format-card.selected {
  border-color: rgba(118, 215, 255, 0.32);
  background: rgba(118, 215, 255, 0.06);
}

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

.format-name {
  font-weight: 800;
}

.png-size-control {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(64, 255, 165, 0.22);
  background: linear-gradient(135deg, rgba(64, 255, 165, 0.07), rgba(118, 215, 255, 0.05));
  transition: opacity 140ms ease, border-color 140ms ease;
}

.png-size-control label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.png-size-control strong,
.png-size-control small {
  display: block;
}

.png-size-control small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.png-size-control select {
  min-width: 124px;
  padding: 10px 34px 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(118, 215, 255, 0.32);
  color: var(--text);
  background: #101725;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.png-size-control select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.png-size-control.disabled {
  opacity: 0.48;
  border-color: rgba(255, 255, 255, 0.08);
}

.png-size-control select:disabled {
  cursor: not-allowed;
}

.output-note {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.lower-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.timeline {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 14px;
  color: var(--muted);
}

.timeline li.current {
  color: var(--text);
  font-weight: 700;
}

.timeline li.completed {
  color: var(--accent-strong);
}

.processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 6, 11, 0.82);
  backdrop-filter: blur(14px);
}

.processing-card {
  width: min(620px, 100%);
  padding: clamp(22px, 4vw, 34px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(118, 215, 255, 0.24);
  background:
    radial-gradient(circle at top right, rgba(118, 215, 255, 0.12), transparent 38%),
    linear-gradient(160deg, rgba(18, 26, 43, 0.98), rgba(8, 12, 21, 0.99));
  box-shadow: 0 34px 110px rgba(0, 0, 0, 0.62);
}

.processing-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
}

.processing-head h2 {
  font-size: clamp(1.35rem, 4vw, 2rem);
}

.processing-head > strong {
  color: var(--accent-strong);
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.processing-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-right-color: var(--accent-strong);
  animation: processing-spin 900ms linear infinite;
}

.processing-detail {
  margin-top: 20px;
  min-height: 1.5em;
  color: var(--muted);
}

.processing-card progress {
  display: block;
  width: 100%;
  height: 12px;
  margin-top: 14px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  accent-color: var(--accent-strong);
}

.processing-card progress::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.processing-card progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 180ms ease;
}

.processing-steps {
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  list-style: none;
  counter-reset: processing-step;
}

.processing-steps li {
  position: relative;
  padding-top: 26px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
  text-align: center;
  counter-increment: processing-step;
}

.processing-steps li::before {
  content: counter(processing-step);
  position: absolute;
  top: 0;
  left: 50%;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #061017;
  background: rgba(255, 255, 255, 0.28);
  transform: translateX(-50%);
}

.processing-steps li.current,
.processing-steps li.completed {
  color: var(--text);
}

.processing-steps li.current::before {
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(118, 215, 255, 0.1);
}

.processing-steps li.completed::before {
  content: "✓";
  background: var(--accent-strong);
}

.processing-note {
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

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

.guidance-list {
  display: grid;
  gap: 12px;
}

.guidance-item {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.guidance-item:last-child {
  border-bottom: 0;
}

.guidance-key {
  font-weight: 700;
}

@media (max-width: 980px) {
  .topbar,
  .hero,
  .workspace,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .topbar-badges {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1240px);
    margin-top: 12px;
  }

  .hero,
  .upload-panel,
  .formats-panel,
  .lower-grid .panel {
    padding: 18px;
  }

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

  .png-size-control label {
    align-items: stretch;
    flex-direction: column;
  }

  .png-size-control select {
    width: 100%;
  }

  .processing-head {
    grid-template-columns: auto 1fr;
  }

  .processing-head > strong {
    grid-column: 2;
  }

  .processing-steps {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .processing-steps li {
    min-height: 24px;
    padding: 3px 0 3px 34px;
    text-align: left;
  }

  .processing-steps li::before {
    top: 0;
    left: 0;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .processing-spinner {
    animation: none;
  }
}
