/* ── Reset & base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #0d1117;
  --surface:      #161b22;
  --surface2:     #1c2230;
  --border:       #30363d;
  --accent:       #7c3aed;
  --accent-h:     #6d28d9;
  --accent-dim:   rgba(124, 58, 237, 0.12);
  --text:         #e6edf3;
  --muted:        #8b949e;
  --success:      #2ea043;
  --success-dim:  rgba(46, 160, 67, 0.12);
  --error:        #da3633;
  --error-dim:    rgba(218, 54, 51, 0.12);
  --radius:       10px;
  --radius-sm:    7px;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 2.5rem 1rem 3rem;
  line-height: 1.5;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.app {
  max-width: 580px;
  margin: 0 auto;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.4rem;
}

header p {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px;
  margin-bottom: 1.25rem;
}

.tab {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab.active {
  background: var(--accent);
  color: #fff;
}

.tab:not(.active):hover {
  background: var(--surface2);
  color: var(--text);
}

/* ── Panel ───────────────────────────────────────────────────────────────── */
.panel { display: none; }
.panel.active { display: block; }

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

/* ── Drop zone ───────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: default;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 1.25rem;
}

.drop-zone.over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.drop-icon {
  font-size: 2.25rem;
  margin-bottom: 0.6rem;
}

.drop-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.drop-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.drop-btns {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.primary-btn {
  display: block;
  width: 100%;
  padding: 0.72rem;
  margin-top: 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.primary-btn:hover:not(:disabled) {
  background: var(--accent-h);
  transform: translateY(-1px);
}

.primary-btn:active:not(:disabled) {
  transform: translateY(0);
}

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

.icon-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  transition: color 0.15s;
}

.icon-btn:hover { color: var(--text); }

/* ── File list ───────────────────────────────────────────────────────────── */
.file-list {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  max-height: 140px;
  overflow-y: auto;
  margin-bottom: 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

.file-item:last-child { border-bottom: none; }

.file-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.file-size {
  color: var(--muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ── Form fields ─────────────────────────────────────────────────────────── */
.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.field-row {
  display: flex;
  gap: 6px;
}

.field-row input {
  flex: 1;
  min-width: 0;
}

input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
  height: 38px;
}

input[type="password"]:focus,
input[type="text"]:focus {
  border-color: var(--accent);
}

/* ── Range slider ────────────────────────────────────────────────────────── */
.range-val {
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.range-hint {
  color: var(--muted);
  font-size: 0.78rem;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  cursor: pointer;
  margin: 0.4rem 0 0.2rem;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: background 0.15s;
}

input[type="range"]::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.73rem;
  color: var(--muted);
}

/* ── Progress ────────────────────────────────────────────────────────────── */
.progress {
  margin-top: 1rem;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.progress-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.progress-track {
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, #a78bfa 100%);
  border-radius: 3px;
  transition: width 0.25s ease;
}

/* ── Result box ──────────────────────────────────────────────────────────── */
.result {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  border-left: 3px solid transparent;
}

.result.success {
  background: var(--success-dim);
  border-color: var(--success);
}

.result.error {
  background: var(--error-dim);
  border-color: var(--error);
  color: #fca5a5;
}

.result-stats {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.stat {
  flex: 1;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem;
  text-align: center;
}

.stat-label {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}

.stat-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.result-msg {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.6;
}

.result-msg strong { color: var(--text); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.8;
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
