/* PixelCut — Design glassmorphism iDklic */
:root {
  --bg-0: #0a0e1a;
  --bg-1: #131825;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --text-mute: #64748b;
  --border: rgba(255, 255, 255, 0.08);
  --glass: rgba(255, 255, 255, 0.04);
  --glass-strong: rgba(255, 255, 255, 0.07);
  --success: #10b981;
  --error: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
}

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

html, body {
  background: var(--bg-0);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(800px 600px at 15% 10%, rgba(99, 102, 241, 0.15), transparent 50%),
    radial-gradient(700px 500px at 85% 70%, rgba(236, 72, 153, 0.12), transparent 50%),
    radial-gradient(900px 700px at 50% 100%, rgba(139, 92, 246, 0.10), transparent 50%);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  max-width: 1100px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-icon { font-size: 26px; }
.logo-text {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}
.brand-link:hover { color: var(--text); }

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

.hero {
  text-align: center;
  margin: 32px 0 48px;
}

.hero h1 {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.grad {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .sub {
  font-size: 17px;
  color: var(--text-dim);
  max-width: 560px;
  margin: 0 auto;
}

.card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color 0.2s, background 0.2s;
}

.card:hover { border-color: rgba(255, 255, 255, 0.12); }

.card label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 14px;
}

.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: white;
  font-size: 13px;
  font-weight: 700;
}

.help {
  margin-left: auto;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.help:hover { text-decoration: underline; }

.key-row {
  display: flex;
  gap: 8px;
}

#apiKey {
  flex: 1;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  outline: none;
  transition: border-color 0.2s;
}
#apiKey:focus { border-color: var(--accent); }

#toggleKey {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}
#toggleKey:hover { color: var(--text); border-color: var(--accent); }

.hint {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 10px;
}

.quota {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-dim);
}
.quota .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
.quota.low .dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15); }
.quota.empty .dot { background: var(--error); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.drop-zone:hover, .drop-zone.dragging {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
}

.drop-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.7; }
.drop-zone p { margin: 4px 0; }
.muted { color: var(--text-dim); }
.muted.small { font-size: 12px; margin-top: 8px; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.file-list {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
}

.file-chip {
  background: var(--glass-strong);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}
.file-chip.done { color: var(--success); border-color: rgba(16, 185, 129, 0.3); }
.file-chip.error { color: var(--error); border-color: rgba(239, 68, 68, 0.3); }

.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 24px 0;
}

.btn-primary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent-grad);
  color: white;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(99, 102, 241, 0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); }

.btn-icon { font-size: 18px; }

.progress-bar {
  height: 8px;
  background: var(--bg-1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: var(--accent-grad);
  width: 0%;
  transition: width 0.3s;
  border-radius: 4px;
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.progress-log {
  max-height: 200px;
  overflow-y: auto;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.log-line {
  padding: 2px 0;
  color: var(--text-dim);
}
.log-line.ok { color: var(--success); }
.log-line.err { color: var(--error); }

.download-card {
  text-align: center;
  padding: 40px 24px;
}

.success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--accent-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: white;
  font-weight: bold;
}

.download-card h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.download-card p {
  color: var(--text-dim);
  margin-bottom: 24px;
}

.download-card .btn-primary { margin-right: 8px; }

.how {
  margin-top: 64px;
  padding: 32px 0;
  border-top: 1px solid var(--border);
}

.how h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
  text-align: center;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.how-item {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
}

.how-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--glass-strong);
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 10px;
}

.how-item p {
  color: var(--text-dim);
  font-size: 14px;
}

footer {
  text-align: center;
  padding: 32px 24px;
  color: var(--text-mute);
  font-size: 13px;
  border-top: 1px solid var(--border);
}

footer a {
  color: var(--text-dim);
  text-decoration: none;
}
footer a:hover { color: var(--text); }

@media (max-width: 600px) {
  header { padding: 16px 20px; }
  main { padding: 16px 16px 60px; }
  .hero { margin: 16px 0 32px; }
  .card { padding: 20px; }
  .actions { flex-direction: column; }
  .actions button { width: 100%; justify-content: center; }
}
