:root {
  --bg: #f6f7f6;
  --surface: #ffffff;
  --surface-2: #f1f3f2;
  --border: #e2e5e3;
  --border-strong: #c9cfcc;
  --text: #16201c;
  --text-2: #55615c;
  --text-3: #808a86;
  --accent: #0f766e;
  --accent-hover: #0b5f58;
  --accent-soft: #e3f2ef;
  --accent-text: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --success: #067647;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 20, 0.04), 0 4px 16px rgba(16, 24, 20, 0.05);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1211;
    --surface: #161b1a;
    --surface-2: #1d2322;
    --border: #2a3230;
    --border-strong: #3a4441;
    --text: #e8eeeb;
    --text-2: #a5b0ac;
    --text-3: #7b8682;
    --accent: #2bb3a3;
    --accent-hover: #3fc6b6;
    --accent-soft: #15302c;
    --accent-text: #06201c;
    --danger: #f97066;
    --danger-soft: #3a1714;
    --success: #47cd89;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

[hidden] { display: none !important; }

.shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 28px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; letter-spacing: -0.01em; }
.brand img { width: 28px; height: 28px; display: block; }
.link-button {
  background: none; border: 0; padding: 6px 8px; margin: -6px -8px;
  color: var(--text-2); font: inherit; font-size: 14px; cursor: pointer; border-radius: 6px;
}
.link-button:hover { color: var(--text); background: var(--surface-2); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  min-height: 300px;
  padding: 40px 24px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); outline: none; }
.dropzone.is-dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  margin-bottom: 18px;
}
.dropzone h1 { font-size: 21px; font-weight: 650; letter-spacing: -0.015em; margin: 0 0 6px; }
.dropzone p { margin: 0; color: var(--text-2); }
.dropzone .formats { margin-top: 18px; font-size: 13px; color: var(--text-3); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 15px; font-weight: 550;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s, transform 0.06s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-inline { margin-top: 18px; }
.btn[disabled] { opacity: 0.55; cursor: default; }

/* Progress */
.progress-card { padding: 22px; }
.file-row { display: flex; align-items: center; gap: 14px; }
.file-icon {
  width: 42px; height: 42px; border-radius: 11px; flex: none;
  display: grid; place-items: center; background: var(--surface-2); color: var(--text-2);
}
.file-meta { min-width: 0; flex: 1; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--text-3); font-size: 14px; }
.steps { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 12px; }
.step { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 15px; }
.step .dot {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  border: 2px solid var(--border-strong);
  display: grid; place-items: center;
}
.step.is-active { color: var(--text); }
.step.is-active .dot { border-color: var(--accent); border-top-color: transparent; animation: spin 0.8s linear infinite; }
.step.is-done { color: var(--text-2); }
.step.is-done .dot { border-color: var(--accent); background: var(--accent); }
.step.is-done .dot::after { content: ""; width: 8px; height: 5px; border: 2px solid var(--accent-text); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.step .detail { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-3); font-size: 14px; }
.bar { height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.hint { margin: 18px 0 0; font-size: 14px; color: var(--text-3); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .step.is-active .dot { animation: none; border-top-color: var(--accent); } }

/* Alerts */
.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--danger);
  font-size: 15px; margin-bottom: 16px;
}
.alert svg { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.alert .alert-body { flex: 1; }
.alert strong { display: block; }

/* Result */
.result-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.result-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.result-title h2 { margin: 0; font-size: 17px; font-weight: 650; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 600;
}
.muted { color: var(--text-3); font-size: 14px; }
.transcript {
  display: block; width: 100%;
  min-height: 260px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 16.5px; line-height: 1.65;
  resize: vertical;
  box-shadow: var(--shadow);
}
.transcript:focus { outline: none; border-color: var(--accent); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.actions .spacer { flex: 1; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 550;
  opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Login */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; padding: 32px 28px; }
.login-card .brand { margin-bottom: 22px; }
.login-card h1 { margin: 0 0 4px; font-size: 21px; letter-spacing: -0.015em; }
.login-card p { margin: 0 0 22px; color: var(--text-2); font-size: 15px; }
.field label { display: block; font-size: 14px; font-weight: 550; margin-bottom: 6px; }
.input {
  width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-card .btn { width: 100%; margin-top: 16px; height: 44px; }
.login-card .alert { margin: 16px 0 0; }

@media (max-width: 560px) {
  .header { padding-bottom: 20px; }
  .dropzone { min-height: 240px; padding: 32px 18px; }
  .actions .btn { flex: 1 1 auto; }
  .actions .spacer { display: none; }
  .transcript { padding: 14px 16px; font-size: 16px; }
}
