*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2d3142;
  --accent: #6c63ff;
  --accent-light: #8b85ff;
  --text: #e2e8f0;
  --text-muted: #718096;
  --success: #48bb78;
  --error: #fc8181;
  --radius: 8px;
  --font: 'Inter', system-ui, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 1rem;
}

.app { max-width: 640px; margin: 0 auto; }

header { text-align: center; padding: 2rem 0 1.5rem; }
header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.5px; }
header p  { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.25rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

label { display: block; font-size: 0.8rem; font-weight: 600;
        color: var(--text-muted); margin-bottom: 0.375rem; letter-spacing: 0.05em; text-transform: uppercase; }

input[type="text"], input[type="url"], input[type="password"], select {
  width: 100%; padding: 0.625rem 0.875rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 0.9375rem;
  outline: none; transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--accent); }

.modes-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.5rem;
}
.mode-chip {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem; border-radius: var(--radius);
  border: 1px solid var(--border); cursor: pointer;
  font-size: 0.8125rem; transition: border-color .15s, background .15s;
  user-select: none;
}
.mode-chip:hover  { border-color: var(--accent-light); }
.mode-chip.active { border-color: var(--accent); background: rgba(108,99,255,.12); }
.mode-chip input  { display: none; }

.advanced-toggle {
  color: var(--accent-light); font-size: 0.8125rem; cursor: pointer;
  background: none; border: none; padding: 0; margin-top: 0.75rem;
}
.advanced-section { margin-top: 0.75rem; display: none; }
.advanced-section.open { display: block; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.btn {
  display: block; width: 100%; padding: 0.875rem;
  background: var(--accent); color: #fff; font-size: 1rem; font-weight: 600;
  border: none; border-radius: var(--radius); cursor: pointer;
  transition: opacity .15s; margin-top: 1rem;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:not(:disabled):hover { opacity: .9; }

.status-bar {
  display: none; padding: 0.75rem 1rem;
  border-radius: var(--radius); font-size: 0.875rem; margin-bottom: 1rem;
}
.status-bar.running { display: flex; align-items: center; gap: 0.5rem;
  background: rgba(108,99,255,.15); border: 1px solid var(--accent); }
.status-bar.done    { display: block;
  background: rgba(72,187,120,.1); border: 1px solid var(--success); }
.status-bar.error   { display: block;
  background: rgba(252,129,129,.1); border: 1px solid var(--error); }

.spinner {
  width: 16px; height: 16px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result-text {
  white-space: pre-wrap; font-family: monospace; font-size: 0.8125rem;
  line-height: 1.6; max-height: 400px; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; margin-top: 0.75rem;
}
.result-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; flex-wrap: wrap; }
.btn-sm {
  padding: 0.4rem 0.875rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 0.8125rem; cursor: pointer;
}
.btn-sm:hover { border-color: var(--accent-light); }

.file-list { list-style: none; margin-top: 0.5rem; }
.file-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.375rem 0; border-bottom: 1px solid var(--border); font-size: 0.8125rem;
}
.file-list li:last-child { border: none; }
.file-size { color: var(--text-muted); }

@media (max-width: 400px) {
  .modes-grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
}