:root {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --text: #1f2023;
  --muted: #62646b;
  --line: #dcdde1;
  --accent: #ea580c;
  --accent-ink: #ffffff;
  --accent-soft: #fff1e6;
  --warn-bg: #fff4e0;
  --warn-line: #f0c36d;
  --err-bg: #fdecec;
  --err-line: #e7a0a0;
  --ok: #15803d;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18181b;
    --surface: #232327;
    --text: #ececee;
    --muted: #a1a1aa;
    --line: #3a3a40;
    --accent: #fb923c;
    --accent-ink: #1c0d03;
    --accent-soft: #3a2314;
    --warn-bg: #2f2612;
    --warn-line: #6d5420;
    --err-bg: #331a1a;
    --err-line: #7a3535;
    --ok: #4ade80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.8 Vazirmatn, Tahoma, "Segoe UI", system-ui, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }

.top { padding: 32px 0 8px; }
.top h1 { margin: 0 0 4px; font-size: 1.9rem; }
.lead { margin: 0 0 6px; }
.privacy { margin: 0; color: var(--muted); font-size: .92rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  margin: 16px 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card h2 { margin: 0; font-size: 1.15rem; display: flex; align-items: center; gap: 10px; }
.step {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: .95rem;
}

.muted { color: var(--muted); }
.small { font-size: .88rem; }
.status { min-height: 1.6em; margin: 6px 0 0; color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }
.status.error { color: #c2410c; }
.eta { margin: 8px 0 0; font-weight: 500; }
.eta .pct { color: var(--accent); font-size: 1.1rem; }
#gpu-info { margin: 4px 0 0; }
#gpu-info b { color: var(--text); font-weight: 500; }

.chip {
  font-size: .85rem; padding: 2px 12px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line); color: var(--muted);
}
.chip.ok { color: var(--ok); border-color: currentColor; }

.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn {
  font: inherit; font-size: .95rem;
  padding: 8px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 500; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 12px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.banner {
  border: 1px solid var(--warn-line); background: var(--warn-bg);
  border-radius: 12px; padding: 12px 16px; margin-top: 16px;
}
.banner.error { border-color: var(--err-line); background: var(--err-bg); }
.banner h3 { margin: 0 0 4px; font-size: 1rem; }
.banner p { margin: 4px 0; }

.progress { height: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress .bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress.indeterminate .bar { width: 30%; animation: slide 1.2s infinite linear; }
@keyframes slide { from { margin-right: -30%; } to { margin-right: 100%; } }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  border: 2px dashed var(--line); border-radius: 12px; padding: 24px 12px; margin-top: 12px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { font-size: 1.6rem; color: var(--accent); }

.file-list { list-style: none; padding: 0; margin: 12px 0 0; }
.file-list li {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; margin-bottom: 6px;
}
.file-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: right; }
.file-list .meta { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.file-list .remove { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; padding: 0 4px; }
.file-list .remove:disabled { visibility: hidden; }

.options { margin-top: 12px; }
.options summary { cursor: pointer; color: var(--muted); }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 10px; }
.opt-grid label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
select, input[type=text] {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; min-width: 0;
}

.doc { margin-top: 18px; }
.doc h3 { margin: 0 0 6px; font-size: 1rem; direction: ltr; text-align: right; overflow-wrap: anywhere; }
.page { margin-bottom: 12px; }
.page-label { font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.page textarea {
  width: 100%; min-height: 160px; resize: vertical;
  font: 1rem/1.9 Vazirmatn, Tahoma, sans-serif; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.page.working textarea { border-color: var(--accent); }

a.btn { display: inline-block; text-decoration: none; }
.desktop-card { border-color: var(--accent); }
.desktop-card p { margin: 8px 0 0; }

.foot { padding-bottom: 40px; font-size: .92rem; }
.foot p { margin: 8px 0; }
.version { font-size: .8rem; color: var(--muted); direction: ltr; text-align: right; }
.top .version { margin: 0 0 2px; }

@media (max-width: 520px) {
  .top h1 { font-size: 1.5rem; }
  .card { padding: 14px; }
  .btn { flex: 1 1 auto; }
}
