:root {
  --bg: #0f1117;
  --surface: #181b24;
  --surface-2: #1f2430;
  --border: #2a3040;
  --text: #e7eaf0;
  --text-dim: #9aa3b2;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --success: #22c55e;
  --danger: #ef4444;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% -10%, #1d2233 0%, var(--bg) 55%);
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 32px 16px;
}

.app {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.header {
  display: flex;
  align-items: center;
  gap: 18px;
}

.logo {
  flex: none;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow);
}

.logo span {
  opacity: 0.8;
}

.header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 14px;
}

.header__guide {
  margin-left: auto;
  flex: none;
  align-self: flex-start;
  color: var(--accent-hover);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  transition:
    border-color 0.2s,
    background 0.2s;
}

.header__guide:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.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.1s;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.dropzone.is-dragover {
  border-color: var(--accent-hover);
  background: var(--surface-2);
  transform: scale(1.01);
}

.dropzone__icon {
  font-size: 40px;
  line-height: 1;
  color: var(--accent-hover);
}

.dropzone__title {
  margin: 14px 0 4px;
  font-size: 17px;
  font-weight: 600;
}

.dropzone__hint {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
}

.dropzone__formats {
  margin: 12px 0 0;
  color: var(--text-dim);
  font-size: 12px;
  opacity: 0.7;
}

.link {
  background: none;
  border: none;
  color: var(--accent-hover);
  font: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-list:empty {
  display: none;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
}

.file-item__name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item__size {
  color: var(--text-dim);
  font-size: 12px;
  flex: none;
}

.file-item__remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
}

.file-item__remove:hover {
  color: var(--danger);
}

.actions {
  display: flex;
  gap: 12px;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s,
    opacity 0.2s;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:not(:disabled):hover {
  background: var(--accent-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.status {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 20px;
}

.status__row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-hover);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status--success {
  border-color: rgba(34, 197, 94, 0.4);
}

.status--error {
  border-color: rgba(239, 68, 68, 0.4);
}

.status__title {
  font-weight: 600;
}

.status__download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  background: var(--success);
  color: #06210f;
  text-decoration: none;
  font-weight: 700;
  padding: 11px 20px;
  border-radius: 10px;
}

.status__download:hover {
  filter: brightness(1.08);
}

.status__log {
  margin-top: 14px;
  max-height: 220px;
  overflow: auto;
  background: var(--bg);
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  color: var(--text-dim);
  white-space: pre-wrap;
}

.footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}

.footer code {
  color: var(--accent-hover);
}

/* --- Guide page ---------------------------------------------------------- */

.app--guide {
  max-width: 920px;
}

.back-link {
  flex: none;
  align-self: flex-start;
  margin-left: auto;
  color: var(--accent-hover);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
}

.back-link:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
}

.toc h2 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.toc ol {
  margin: 0;
  padding-left: 20px;
  columns: 2;
  column-gap: 28px;
}

.toc a {
  color: var(--accent-hover);
  text-decoration: none;
}

.toc a:hover {
  text-decoration: underline;
}

.guide-section {
  scroll-margin-top: 16px;
}

.guide-section h2 {
  font-size: 20px;
  margin: 8px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.guide-section h3 {
  font-size: 16px;
  margin: 22px 0 10px;
  color: var(--accent-hover);
}

.guide-section p {
  line-height: 1.6;
  color: var(--text);
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin: 6px 0 4px;
}

.md-table th,
.md-table td {
  border: 1px solid var(--border);
  padding: 8px 11px;
  text-align: left;
  vertical-align: top;
}

.md-table th {
  background: var(--surface-2);
  font-weight: 600;
}

.md-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

.md-table code,
.guide-section p code,
.guide-section li code {
  background: var(--bg);
  border-radius: 5px;
  padding: 1px 6px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.9em;
  color: var(--accent-hover);
}

.example {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 10px 0;
  overflow: auto;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.callout {
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 10px;
  background: var(--surface);
  padding: 14px 16px;
  margin: 12px 0;
  line-height: 1.55;
}

.callout--warn {
  border-left-color: var(--danger);
}

.callout--info {
  border-left-color: var(--accent);
}

.callout--ok {
  border-left-color: var(--success);
}

.callout strong {
  display: block;
  margin-bottom: 4px;
}
