:root {
  --bg: #0e0e12;
  --surface: #1a1a24;
  --border: #2a2a3a;
  --text: #e4e4ef;
  --text-muted: #8888a0;
  --accent: #6c5ce7;
  --accent-hover: #7e6ff0;
  --success: #00b894;
  --error: #e74c3c;
  --warning: #f39c12;
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-user-select: none;
  user-select: none;
}

h1, h2 { font-family: 'Poppins', sans-serif; }

/* Draggable titlebar area for frameless window */
.titlebar-drag {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 38px;
  -webkit-app-region: drag;
  z-index: 100;
}

.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
}

header {
  text-align: center;
  margin-bottom: 1.5rem;
}

header h1 {
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--accent), #a29bfe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-size: 0.85rem;
}

/* Folder Selection */
.folder-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.folder-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.folder-pick label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-folder {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-app-region: no-drag;
}

.btn-folder:hover { background: var(--accent-hover); }

.folder-path {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.folder-path.active { color: var(--success); }

.file-count-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.file-count {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  -webkit-app-region: no-drag;
}

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

/* Presets */
.presets { margin-bottom: 1.25rem; }
.presets h2 { font-size: 1rem; margin-bottom: 0.75rem; }

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.preset-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-app-region: no-drag;
}

.preset-card:hover { border-color: var(--accent); }
.preset-card:has(input:checked) { border-color: var(--accent); background: rgba(108, 92, 231, 0.08); }

.preset-card input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
.card-body { display: flex; flex-direction: column; }
.card-body strong { font-size: 0.82rem; }
.card-body small { color: var(--text-muted); font-size: 0.72rem; }

/* Settings row */
.settings-row {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 1.25rem;
}

.quality-section {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.quality-section label { font-size: 0.85rem; white-space: nowrap; }

.quality-section input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 5px;
}

.drive-section { flex-shrink: 0; }

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  -webkit-app-region: no-drag;
}

.toggle-label input { accent-color: var(--accent); }

/* GAS Section */
.gas-section {
  margin-bottom: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.gas-section label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gas-section input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-size: 0.82rem;
  font-family: monospace;
  -webkit-app-region: no-drag;
}

.gas-section input:focus { border-color: var(--accent); outline: none; }

/* Process button */
.btn-process {
  display: block;
  width: 100%;
  padding: 0.85rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-app-region: no-drag;
}

.btn-process:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); }
.btn-process:disabled { opacity: 0.35; cursor: not-allowed; }

/* Progress */
.progress-section { margin-top: 1.25rem; }

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

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

.progress-text {
  text-align: center;
  margin-top: 0.6rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* Results */
.results { margin-top: 1.5rem; }

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.results-header h2 { font-size: 1rem; }

.results-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.result-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.result-card .info { padding: 0.6rem; }
.result-card .info strong { display: block; font-size: 0.78rem; margin-bottom: 0.15rem; }
.result-card .info small { color: var(--text-muted); font-size: 0.7rem; }
.result-card .info .dims { color: var(--text-muted); font-size: 0.68rem; display: block; margin-top: 0.15rem; }

.status { margin-top: 0.3rem; font-size: 0.72rem; }
.status.success { color: var(--success); }
.status.error { color: var(--error); }
.status.uploading { color: var(--warning); }

/* Footer */
footer {
  margin-top: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
}

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

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
