:root {
  --bg: #E5E9F0;
  --surface: #ECEFF4;
  --surface-alt: #E5E9F0;
  --text: #2E3440;
  --text-muted: #4C566A;
  --border: #D8DEE9;
  --accent: #88C0D0;
  --accent-strong: #81A1C1;
  --accent-contrast: #2E3440;
  --success: #27C93F;
  --warning: #FF9500;
  --danger: #BF616A;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #111111;
    --surface-alt: #1a1a1a;
    --text: #E0DEF4;
    --text-muted: #6E6A86;
    --border: #393552;
    --accent: #C4A7E7;
    --accent-strong: #9b7fc7;
    --accent-contrast: #0b0b0b;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "MiSans", "Avenir Next", "Inter", "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

button {
  font: inherit;
}

.topbar {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  font-size: 22px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--accent-contrast);
  box-shadow: 0 6px 18px rgba(196, 167, 231, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.brand p {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.container {
  width: min(980px, calc(100% - 32px));
  margin: 28px auto 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  outline: none;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--surface) 85%, var(--accent));
  transform: translateY(-1px);
}

.drop-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.drop-title {
  font-size: 18px;
  font-weight: 600;
}

.drop-sub {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-muted);
}

.drop-hint {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-muted);
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.controls button {
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.controls button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.controls button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.controls button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-color: transparent;
  color: var(--accent-contrast);
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(196, 167, 231, 0.25);
}

.format-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.format-control select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.stats {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 14px;
}

.list-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  font-weight: 600;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

.file-list {
  max-height: 480px;
  overflow-y: auto;
}

.empty-state {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
}

.file-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

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

.file-number {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--surface-alt);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
}

.file-main {
  min-width: 0;
}

.file-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.size {
  color: var(--text-muted);
}

.status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--surface-alt);
  color: var(--text-muted);
  white-space: nowrap;
}

.status.done {
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
}

.status.error {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
}

.status.busy {
  background: rgba(79, 110, 247, 0.12);
  color: var(--accent);
}

.file-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.file-actions button {
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.file-actions button:hover:not(:disabled) {
  background: var(--surface-alt);
}

.file-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.footer {
  margin-top: 40px;
  padding: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: rgba(28, 35, 51, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .file-item {
    grid-template-columns: auto 1fr;
  }

  .file-actions {
    grid-column: 2;
    justify-content: flex-start;
  }
}
