:root {
  --page-bg: #050816;
  --surface: rgba(9, 13, 32, 0.78);
  --surface-strong: rgba(13, 18, 40, 0.92);
  --surface-soft: rgba(13, 19, 45, 0.66);
  --border: rgba(110, 142, 255, 0.18);
  --border-strong: rgba(71, 201, 255, 0.32);
  --text: #f8fbff;
  --muted: rgba(218, 228, 255, 0.72);
  --muted-soft: rgba(218, 228, 255, 0.46);
  --cyan: #47d8ff;
  --cyan-strong: #10b8ff;
  --pink: #ff5ea9;
  --violet: #7567ff;
  --success: #59f0ba;
  --checker-a: #edf2ff;
  --checker-b: #d5def6;
  --shadow: 0 26px 80px rgba(6, 10, 28, 0.44);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(71, 216, 255, 0.14), transparent 34%),
    radial-gradient(circle at right 15%, rgba(255, 94, 169, 0.14), transparent 28%),
    linear-gradient(180deg, #060917 0%, #040610 100%);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

.page-noise,
.page-grid,
.page-orb {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.page-noise {
  opacity: 0.18;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.08) 0.7px, transparent 0.7px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent);
}

.page-grid {
  background-image:
    linear-gradient(rgba(72, 117, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 117, 255, 0.08) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.25;
}

.page-orb {
  filter: blur(110px);
  opacity: 0.55;
}

.page-orb--cyan {
  inset: auto auto -120px -120px;
  width: 360px;
  height: 360px;
  background: rgba(16, 184, 255, 0.26);
}

.page-orb--pink {
  inset: -100px -80px auto auto;
  width: 340px;
  height: 340px;
  background: rgba(255, 94, 169, 0.2);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 28px 0 72px;
}

.app-header,
.hero-panel,
.panel,
.footer-panel {
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background:
    linear-gradient(160deg, rgba(117, 103, 255, 0.42), rgba(71, 216, 255, 0.2));
  border: 1px solid rgba(120, 128, 255, 0.26);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(71, 216, 255, 0.08),
    0 18px 36px rgba(6, 10, 28, 0.32);
  color: var(--cyan);
}

.brand-icon svg {
  width: 28px;
  height: 28px;
}

.brand-kicker,
.panel-eyebrow,
.hero-eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  font-family: "Orbitron", sans-serif;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand-name {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  background: rgba(7, 10, 22, 0.45);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.back-link:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  color: var(--cyan);
}

.back-link svg {
  width: 16px;
  height: 16px;
}

.hero-panel,
.panel,
.footer-panel {
  border-radius: 28px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(15, 21, 44, 0.92), rgba(8, 12, 27, 0.84));
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 34px 34px 30px;
  margin-bottom: 24px;
}

.hero-title {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: clamp(2rem, 4.8vw, 3.5rem);
  line-height: 0.95;
}

.accent-word {
  background: linear-gradient(135deg, var(--cyan), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-description {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.75;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.hero-badge {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(71, 216, 255, 0.16);
  background: rgba(71, 216, 255, 0.08);
  color: #c7f6ff;
  font-size: 0.87rem;
  font-weight: 600;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(330px, 0.95fr) minmax(0, 1.25fr);
  gap: 24px;
}

.panel {
  padding: 28px;
}

.panel-header {
  margin-bottom: 22px;
}

.panel-header h2,
.footer-copy h2 {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.18;
}

.upload-zone {
  display: block;
  position: relative;
  overflow: hidden;
  padding: 32px 24px;
  border-radius: 24px;
  border: 1px dashed rgba(71, 216, 255, 0.28);
  background:
    linear-gradient(180deg, rgba(11, 18, 39, 0.84), rgba(9, 14, 31, 0.72));
  text-align: center;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.upload-zone:hover,
.upload-zone.is-dragging {
  transform: translateY(-1px);
  border-color: rgba(71, 216, 255, 0.46);
  background:
    linear-gradient(180deg, rgba(12, 23, 54, 0.9), rgba(10, 16, 35, 0.76));
}

.upload-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(117, 103, 255, 0.28), rgba(71, 216, 255, 0.18));
  color: var(--cyan);
}

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

.upload-title {
  margin: 0;
  font-size: 1.08rem;
}

.upload-description {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.95rem;
}

.upload-badge {
  display: inline-flex;
  margin-top: 16px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(117, 103, 255, 0.16);
  color: #d9d4ff;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-box,
.source-card,
.preview-card,
.meta-card,
.stat-card,
.footer-panel {
  background: var(--surface-soft);
}

.status-box {
  margin-top: 18px;
  padding: 18px 18px 16px;
  border-radius: 20px;
  border: 1px solid rgba(98, 115, 255, 0.16);
}

.status-box[data-tone="processing"] {
  border-color: rgba(71, 216, 255, 0.26);
}

.status-box[data-tone="success"] {
  border-color: rgba(89, 240, 186, 0.26);
}

.status-box[data-tone="error"] {
  border-color: rgba(255, 94, 169, 0.28);
}

.status-box__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.status-box__row strong {
  font-size: 0.98rem;
}

.status-box__row span {
  color: var(--cyan);
  font-weight: 700;
}

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

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

.status-help,
.field-hint,
.footer-copy p,
.notes-list li,
.stage-placeholder p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.setting-block,
.source-card,
.stats-grid,
.action-row,
.preview-meta,
.notes-list {
  margin-top: 20px;
}

.setting-label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.96rem;
  font-weight: 700;
}

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

.color-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(86, 102, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.color-option.is-active {
  border-color: rgba(71, 216, 255, 0.38);
  box-shadow: inset 0 0 0 1px rgba(71, 216, 255, 0.16);
}

.color-option:hover {
  transform: translateY(-1px);
}

.color-swatch {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--swatch);
}

.color-swatch--transparent {
  background:
    linear-gradient(45deg, var(--checker-a) 25%, transparent 25%, transparent 75%, var(--checker-a) 75%),
    linear-gradient(45deg, var(--checker-a) 25%, transparent 25%, transparent 75%, var(--checker-a) 75%);
  background-color: var(--checker-b);
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
}

.source-card,
.preview-card,
.meta-card,
.stat-card {
  border: 1px solid rgba(96, 114, 255, 0.14);
  border-radius: 22px;
}

.source-card {
  padding: 18px;
}

.source-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.source-card__eyebrow {
  margin: 0 0 6px;
  color: var(--muted-soft);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.source-card__name {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  word-break: break-word;
}

.source-card__chip {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(71, 216, 255, 0.12);
  color: var(--cyan);
  font-size: 0.82rem;
  font-weight: 800;
}

.source-card__stage {
  min-height: 240px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(6, 10, 24, 0.72);
}

.source-card__stage img,
.preview-card__body img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.stage-placeholder {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
  color: var(--muted-soft);
}

.stage-placeholder svg {
  width: 34px;
  height: 34px;
}

.stats-grid,
.preview-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat-card,
.meta-card {
  padding: 14px 16px;
}

.stat-card span,
.meta-card span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: var(--muted-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card strong,
.meta-card strong {
  display: block;
  font-size: 0.96rem;
  line-height: 1.45;
}

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

.preview-card {
  overflow: hidden;
}

.preview-card__head {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(96, 114, 255, 0.12);
  font-family: "Orbitron", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-soft);
}

.preview-card__body {
  min-height: 360px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 14px;
}

.preview-card__body--solid {
  background:
    radial-gradient(circle at top, rgba(117, 103, 255, 0.12), transparent 55%),
    rgba(7, 11, 25, 0.82);
}

.preview-card__body--checker {
  background:
    linear-gradient(45deg, var(--checker-a) 25%, transparent 25%, transparent 75%, var(--checker-a) 75%),
    linear-gradient(45deg, var(--checker-a) 25%, transparent 25%, transparent 75%, var(--checker-a) 75%);
  background-color: var(--checker-b);
  background-position: 0 0, 14px 14px;
  background-size: 28px 28px;
}

.preview-card__body--plain {
  background: var(--preview-bg, #f8fafc);
}

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

.action-btn {
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid rgba(99, 114, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    opacity 0.2s ease;
}

.action-btn--primary {
  background: linear-gradient(135deg, rgba(16, 184, 255, 0.2), rgba(255, 94, 169, 0.16));
  border-color: rgba(71, 216, 255, 0.28);
}

.action-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(71, 216, 255, 0.34);
}

.action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.notes-list {
  padding: 20px 22px;
  border-radius: 22px;
  border: 1px solid rgba(96, 114, 255, 0.14);
  background: rgba(8, 14, 31, 0.7);
}

.notes-list h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.notes-list ul {
  margin: 0;
  padding-left: 18px;
}

.notes-list li + li {
  margin-top: 8px;
}

.footer-panel {
  margin-top: 24px;
  padding: 24px 28px;
}

.footer-copy p {
  margin-top: 10px;
}

.image-concat-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  min-width: 260px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(71, 216, 255, 0.2);
  background: rgba(7, 12, 28, 0.94);
  box-shadow: 0 24px 60px rgba(5, 9, 22, 0.38);
  color: var(--text);
  transform: translateY(16px);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.image-concat-toast.is-error {
  border-color: rgba(255, 94, 169, 0.34);
}

.image-concat-toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

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

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 24px, 100%);
    padding-top: 18px;
    padding-bottom: 48px;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-panel,
  .panel,
  .footer-panel {
    border-radius: 22px;
  }

  .hero-panel,
  .panel {
    padding: 22px;
  }

  .preview-grid,
  .action-row,
  .stats-grid,
  .preview-meta,
  .color-grid {
    grid-template-columns: 1fr;
  }

  .preview-card__body,
  .source-card__stage {
    min-height: 260px;
  }
}
