:root {
  --bg: #0b0d12;
  --panel: rgba(20, 22, 30, 0.72);
  --panel-2: rgba(28, 30, 40, 0.65);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef1f7;
  --muted: #8b93a7;
  --accent: #ff5a8a;
  --accent-2: #7c5cff;
  --accent-3: #34d0ff;
  --success: #34d399;
  --danger: #ff6b6b;
  --radius: 18px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  min-height: 100%;
  background: radial-gradient(1200px 800px at 10% -10%, #1a1030 0%, transparent 60%),
              radial-gradient(1000px 700px at 110% 10%, #10202e 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

code { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; font-size: 0.9em; color: #c8b5ff; }

.bg-orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; }
.orb-a { width: 480px; height: 480px; background: #ff4d8a; top: -120px; left: -120px; }
.orb-b { width: 520px; height: 520px; background: #7c5cff; bottom: -160px; right: -80px; }
.orb-c { width: 380px; height: 380px; background: #34d0ff; top: 30%; left: 45%; opacity: .25; }

.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: conic-gradient(from 210deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent));
  box-shadow: 0 0 20px rgba(255, 90, 138, 0.55);
}
.brand-name { font-weight: 800; letter-spacing: -0.01em; }
.brand-sub { color: var(--muted); font-size: 13px; margin-left: 4px; }
.status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--panel); color: var(--muted); font-size: 12.5px;
  backdrop-filter: blur(12px);
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: #f5a524; box-shadow: 0 0 10px #f5a52488; }
.status.ok .dot { background: var(--success); box-shadow: 0 0 10px #34d39988; }
.status.err .dot { background: var(--danger); box-shadow: 0 0 10px #ff6b6b88; }

.wrap {
  position: relative; z-index: 1;
  max-width: 1180px; margin: 0 auto; padding: 24px 32px 80px;
}

.hero { margin: 24px 0 32px; }
.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 12px;
  font-weight: 800;
}
.hero .grad {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 55%, var(--accent-3) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); max-width: 640px; font-size: 16px; margin: 0; }

.mode-toggle {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  margin: 0 0 20px;
  backdrop-filter: blur(10px);
}
.mode-btn {
  padding: 8px 18px; border-radius: 999px;
  background: transparent; color: var(--muted);
  border: none; font: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all .2s ease;
}
.mode-btn:hover { color: var(--text); }
.mode-btn.active {
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  color: white;
  box-shadow: 0 4px 14px -6px rgba(124, 92, 255, 0.7);
}

.grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 960px) { .grid { grid-template-columns: 1fr; } }

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  min-height: 320px;
  display: flex; flex-direction: column;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.chip {
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: #d9ccff; background: rgba(124, 92, 255, 0.15);
  border: 1px solid rgba(124, 92, 255, 0.35);
  border-radius: 999px; padding: 4px 10px;
}
.card h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.dropzone {
  position: relative; flex: 1;
  border: 1.5px dashed var(--border-strong);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.005));
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .2s ease;
  overflow: hidden; min-height: 220px;
}
.dropzone:hover { border-color: rgba(255, 255, 255, 0.3); background: rgba(255,255,255,0.03); }
.dropzone.drag { border-color: var(--accent-2); background: rgba(124, 92, 255, 0.1); }
.dropzone.has-file { border-style: solid; border-color: rgba(52, 208, 255, 0.4); }

.placeholder { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); text-align: center; padding: 20px; }
.placeholder svg { color: #b5bccd; margin-bottom: 6px; opacity: .9; }
.ph-title { color: var(--text); font-weight: 600; font-size: 14.5px; }
.ph-sub { color: var(--muted); font-size: 12.5px; }

.preview { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.clear {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.65); color: white;
  border: 1px solid rgba(255,255,255,.2);
  font-size: 18px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
}
.clear:hover { background: rgba(0,0,0,.85); }

.action-card textarea {
  width: 100%; resize: none;
  background: rgba(0,0,0,.25); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; font-family: inherit; font-size: 14px;
  outline: none; transition: border-color .15s;
}
.action-card textarea:focus { border-color: var(--accent-2); }
.action-card .hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.ctrl-wide { grid-column: 1 / -1; }
.ctrl { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.ctrl select {
  background: rgba(0,0,0,.25); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-family: inherit; font-size: 13.5px;
  outline: none;
}
.ctrl select:focus { border-color: var(--accent-2); }

.cta {
  margin-top: 14px; width: 100%; cursor: pointer;
  padding: 14px 18px; border: none; border-radius: 12px;
  color: white; font-weight: 700; font-size: 15px; letter-spacing: -.01em;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 60%, var(--accent-3) 130%);
  box-shadow: 0 10px 30px -10px rgba(124, 92, 255, 0.7);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s;
}
.cta:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 14px 34px -10px rgba(124, 92, 255, 0.85); }
.cta:disabled { opacity: .5; cursor: not-allowed; filter: saturate(.6); }
.cta-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: white;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result {
  margin-top: 32px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
.result-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.detect-badge {
  order: 2; flex: 0 1 auto;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(52, 208, 255, 0.12);
  border: 1px solid rgba(52, 208, 255, 0.35);
  color: #b6ecff; font-size: 12.5px; font-weight: 500;
}
.result-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.result-actions { display: flex; gap: 10px; }
.ghost {
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(255,255,255,.03); color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center;
}
.ghost:hover { background: rgba(255,255,255,.08); }

.result-body {
  display: grid; gap: 16px;
  grid-template-columns: 1fr 1fr 2fr;
}
@media (max-width: 900px) { .result-body { grid-template-columns: 1fr; } }
.result-body figure {
  margin: 0; background: rgba(0,0,0,.25);
  border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column;
}
.result-body figcaption {
  padding: 10px 14px; font-size: 12px; color: var(--muted);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: .08em;
}
.result-body img { display: block; width: 100%; height: 100%; object-fit: contain; background: #05070c; }
.result-body .big img { min-height: 320px; }
.variations {
  display: flex; gap: 8px; padding: 10px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,.25);
  overflow-x: auto;
}
.variation {
  flex: 0 0 auto; width: 80px; height: 80px; padding: 0;
  border-radius: 10px; border: 2px solid transparent;
  background: #05070c; cursor: pointer; overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.variation:hover { transform: translateY(-1px); }
.variation.active { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.2); }
.variation img { width: 100%; height: 100%; object-fit: cover; }

.progress {
  margin-top: 32px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
.progress-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.progress-head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.progress-total {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 13px; color: var(--muted);
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
}
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
  transition: all .2s ease;
}
.steps li[data-status="running"] {
  border-color: rgba(124, 92, 255, 0.5);
  background: rgba(124, 92, 255, 0.08);
}
.steps li[data-status="done"] {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.06);
}
.step-icon {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--muted);
}
.steps li[data-status="running"] .step-icon {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: white; border-color: transparent;
  animation: pulse 1.2s ease-in-out infinite;
}
.steps li[data-status="done"] .step-icon {
  background: var(--success); color: #052e21; border-color: transparent;
}
.steps li[data-status="done"] .step-icon::after { content: "✓"; }
.steps li[data-status="done"] .step-icon .num { display: none; }
@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(124, 92, 255, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(124, 92, 255, 0); }
}
.step-label { color: var(--text); font-size: 14px; font-weight: 500; }
.step-label .step-detail {
  display: block; margin-top: 2px;
  color: var(--muted); font-size: 12px; font-weight: 400;
}
.step-time {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 12.5px; color: var(--muted);
  min-width: 60px; text-align: right;
}
.steps li[data-status="done"] .step-time { color: #7ee2ba; }

.error {
  margin-top: 24px;
  background: rgba(255, 107, 107, 0.08);
  border: 1px solid rgba(255, 107, 107, 0.35);
  color: #ffd7d7;
  padding: 16px 18px; border-radius: 14px;
}
.error p { margin: 6px 0 0; color: #ffb0b0; font-size: 14px; }

.foot {
  text-align: center; padding: 24px; color: var(--muted); font-size: 12.5px;
  display: flex; gap: 10px; justify-content: center;
}
