@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #06060b;
  --surface: rgba(255,255,255,.03);
  --surface2: rgba(255,255,255,.05);
  --border: rgba(255,255,255,.08);
  --border-h: rgba(255,255,255,.15);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #dc2626;
  --accent-h: #b91c1c;
  --ok: #4ade80;
  --err: #f87171;
  --radius: 14px;
  --radius-sm: 8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}
.header .banner {
  max-width: 100%;
  height: auto;
  max-height: 140px;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.header-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
}
.header .logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}
.header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.header p {
  color: var(--text-muted);
  margin-top: .25rem;
}

.tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: .75rem .85rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: .85rem;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}
.card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: .25rem;
}
.muted { color: var(--text-muted); font-size: .9rem; margin-bottom: 1.25rem; }

.form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .4rem; }
.field span { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.field input, .field select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem .85rem;
  color: var(--text);
  font-family: inherit;
  font-size: .95rem;
  transition: border-color .15s, background .15s;
  color-scheme: dark;
}
.field select option {
  background: #12121a;
  color: var(--text);
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255,255,255,.06);
}
.field input[type="file"] { padding: .5rem; cursor: pointer; }

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: .8rem 1.25rem;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  margin-top: .25rem;
}
.btn:hover { background: var(--accent-h); }

.hint {
  margin-top: 1rem;
  font-size: .8rem;
  color: var(--text-dim);
}

.progress-wrap {
  margin-top: 1.25rem;
}
.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #f87171);
  border-radius: 999px;
  transition: width .3s ease, background .2s;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: .5rem;
  font-size: .8rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.pw-output {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
}
.pw-output input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem .85rem;
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .95rem;
}
.btn-ghost {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface3, rgba(255,255,255,.08)); }
.pw-opts { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; }
.chk {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .9rem;
  color: var(--text-muted);
  cursor: pointer;
}
.chk input { accent-color: var(--accent); }
.short-result { margin-top: 1.25rem; }
input[type="range"] { accent-color: var(--accent); }

.dl-error {
  margin-top: .75rem;
  padding: .75rem;
  background: rgba(248,113,113,.1);
  border: 1px solid rgba(248,113,113,.3);
  border-radius: var(--radius-sm);
  color: #fca5a5;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .75rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.alert {
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  font-size: .9rem;
  border: 1px solid transparent;
}
.alert pre { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .8rem; white-space: pre-wrap; word-break: break-word; margin: 0; }
.alert-error { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.3); color: #fca5a5; }
.alert-info { background: rgba(148,163,184,.1); border-color: var(--border); color: var(--text-muted); }
.alert-success { background: rgba(74,222,128,.1); border-color: rgba(74,222,128,.3); color: #86efac; }

/* ── Tabs responsive ────────────────────────────────── */
@media (max-width: 600px) {
  .tabs { flex-wrap: wrap; }
  .tabs a { padding: .5rem .75rem; font-size: .85rem; }
}

/* ── Background Remover ─────────────────────────────── */
.card.drag-over {
  border-color: var(--accent);
  background: rgba(220,38,38,.05);
}
.bg-preview {
  margin-top: 1.25rem;
}
.bg-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 500px) {
  .bg-compare { grid-template-columns: 1fr; }
}
.bg-col {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.bg-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
}
.bg-col img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
}
.bg-checker {
  background-image:
    linear-gradient(45deg, #1a1a2e 25%, transparent 25%),
    linear-gradient(-45deg, #1a1a2e 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1a2e 75%),
    linear-gradient(-45deg, transparent 75%, #1a1a2e 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.bg-checker img {
  border: none;
  border-radius: 0;
}

.footer {
  margin-top: 2rem;
  text-align: center;
  color: var(--text-dim);
  font-size: .8rem;
}
