:root {
  --bg: #070b10;
  --bg-elevated: #0e141c;
  --sidebar: #0b1018;
  --card: #121a24;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f0f4fa;
  --muted: #8b9cb3;
  --accent: #2ee59d;
  --accent-dim: rgba(46, 229, 157, 0.12);
  --accent-hover: #25c985;
  --error: #ff6b7a;
  --warn: #ffb347;
  --radius: 14px;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(46, 229, 157, 0.15), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(56, 120, 255, 0.08), transparent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #1a9f6a);
  color: #041208;
  font-weight: 700;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(46, 229, 157, 0.25);
}

.brand h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.brand p {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.panel h2 {
  margin: 0 0 0.65rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.panel input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  margin-bottom: 0.5rem;
}

.panel input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.folder-path {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  word-break: break-all;
}

.sidebar-footer {
  margin-top: auto;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge-ok {
  color: var(--accent);
  border-color: rgba(46, 229, 157, 0.35);
  background: var(--accent-dim);
}

.badge-warn {
  color: var(--warn);
}

.workspace {
  padding: 1.75rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.workspace-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.workspace-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.workspace-header p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn {
  padding: 0.65rem 1.1rem;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: background 0.15s, transform 0.1s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #041208;
  box-shadow: 0 4px 20px rgba(46, 229, 157, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
}

.btn-sm {
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
}

.input-zone label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.45rem;
  color: var(--muted);
}

.input-zone textarea {
  width: 100%;
  min-height: 140px;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
  box-shadow: var(--shadow);
}

.input-zone textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.input-meta {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.input-meta .dot {
  margin: 0 0.35rem;
}

.progress-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  margin-bottom: 0.65rem;
}

.progress-track {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #3eb8ff);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.queue-section h3 {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 340px;
  overflow-y: auto;
}

.queue-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.queue-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.2s;
}

.queue-item.queue-downloading {
  border-color: rgba(46, 229, 157, 0.45);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

.queue-item.queue-done {
  border-color: rgba(46, 229, 157, 0.25);
}

.queue-item.queue-error {
  border-color: rgba(255, 107, 122, 0.4);
}

.queue-index {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.queue-body {
  flex: 1;
  min-width: 0;
}

.queue-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-meta {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-error {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--error);
}

.queue-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--muted);
}

.queue-downloading .queue-badge {
  background: var(--accent-dim);
  color: var(--accent);
}

.queue-done .queue-badge {
  background: var(--accent-dim);
  color: var(--accent);
}

.queue-error .queue-badge {
  background: rgba(255, 107, 122, 0.15);
  color: var(--error);
}

.status-bar {
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.88rem;
  background: var(--card);
  border: 1px solid var(--border);
  min-height: 2.75rem;
  display: flex;
  align-items: center;
}

.status-success {
  border-color: rgba(46, 229, 157, 0.35);
  color: var(--accent);
}

.status-error {
  border-color: rgba(255, 107, 122, 0.35);
  color: var(--error);
}

.status-warn {
  border-color: rgba(255, 179, 71, 0.35);
  color: var(--warn);
}

.status-loading {
  color: var(--muted);
}

@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .workspace {
    padding: 1.25rem;
  }
}
