:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e4e7ec;
  --soft: #f1f4f7;
  --accent: #0f9d76;
  --accent-ink: #ffffff;
  --accent-soft: #e7f6f1;
  --danger: #c2410c;
  --danger-soft: #fff1ea;
  --warn: #9a6700;
  --warn-soft: #fff8e1;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f14;
    --card: #121820;
    --ink: #e6e9ee;
    --muted: #93a0b2;
    --line: #222b36;
    --soft: #18202a;
    --accent: #22b88b;
    --accent-ink: #04130e;
    --accent-soft: #10261f;
    --danger: #fb923c;
    --danger-soft: #2a1710;
    --warn: #f5c451;
    --warn-soft: #2a2410;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2 { margin: 0; line-height: 1.3; }
h2 { font-size: 19px; font-weight: 600; margin-bottom: 14px; }
p { margin: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }
.muted { color: var(--muted); }

/* header */
.top {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 560px; margin: 0 auto; padding: 18px 16px 0;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
.top-actions { display: flex; gap: 6px; }
.ghost {
  background: none; border: 1px solid var(--line); color: var(--ink);
  font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  text-decoration: none;
}
.ghost:hover { background: var(--card); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.langpick {
  position: relative; display: inline-flex; align-items: center; gap: 6px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px; padding: 0 10px; cursor: pointer;
}
.langpick:hover { background: var(--card); }
.langpick select {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit;
  font: inherit; font-size: 13px; padding: 6px 2px; cursor: pointer; outline: none;
}
.langpick select option { color: #0f172a; background: #fff; }

/* layout */
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 40px; }
.hero { text-align: center; padding: 34px 4px 22px; }
.hero h1 { font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.hero p { color: var(--muted); }

.tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 14px;
}
.tab {
  font: inherit; font-weight: 500; border: 0; background: none; color: var(--muted);
  padding: 9px 8px; border-radius: 9px; cursor: pointer;
}
.tab.is-on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}

/* steps */
.steps { display: flex; list-style: none; margin: 0 0 22px; padding: 0; gap: 8px; }
.steps li { flex: 1; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.steps li::after { content: ""; flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
.steps li:last-child::after { display: none; }
.steps i {
  font-style: normal; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--soft); border: 1px solid var(--line); font-size: 12px; font-weight: 600; flex: none;
}
.steps li.is-on { color: var(--ink); font-weight: 600; }
.steps li.is-on i { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps li.is-done i { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.steps li.is-done::after { background: var(--accent); }

/* form */
.lbl { display: block; font-weight: 500; margin-bottom: 6px; }
.input {
  width: 100%; font-size: 15px; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 110px; font-size: 12.5px; line-height: 1.5; }
#session::placeholder { font: 14px/1.6 "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, sans-serif; letter-spacing: 0; }
html[dir="rtl"] #session:placeholder-shown { direction: rtl; }
html[lang="zh"] body, html[lang="zh"] #session::placeholder {
  font-family: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", system-ui, sans-serif;
}
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 16px; }
.hint.lock::before { content: "🔒 "; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 15px; text-decoration: none;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 11px 18px; border-radius: 12px; cursor: pointer; transition: filter .15s, opacity .15s;
}
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
.btn.block { width: 100%; margin-top: 10px; }
.btn.small { padding: 7px 14px; font-size: 13.5px; border-radius: 10px; margin-top: 10px; margin-inline-end: 6px; }
.btn.is-busy { pointer-events: none; opacity: .7; }
.btn.is-busy::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite;
}
.row { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 6px; }
.inline { display: flex; gap: 8px; }
.inline .input { flex: 1; min-width: 0; }

.alert {
  border-radius: 12px; padding: 11px 14px; margin: 0 0 14px; font-size: 14px;
  background: var(--danger-soft); color: var(--danger); border: 1px solid transparent;
}
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.warn p { margin: 6px 0 10px; color: var(--ink); }
.alert small { display: block; color: var(--muted); margin-top: 4px; }

.pill {
  display: inline-flex; gap: 8px; align-items: center; background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 4px 12px; font-size: 13px; margin-bottom: 14px;
}
.pill b { font-weight: 600; }

.how { margin: 0 0 18px; padding: 0; list-style: none; counter-reset: how; }
.how li {
  counter-increment: how; position: relative; padding-inline-start: 34px; margin-bottom: 12px;
}
.how li::before {
  content: counter(how); position: absolute; inset-inline-start: 0; top: 1px;
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--soft); border: 1px solid var(--line); font-size: 12px; font-weight: 600;
}
.linkbox {
  display: flex; justify-content: space-between; align-items: center; margin-top: 8px;
  background: var(--soft); border: 1px dashed var(--line); border-radius: 10px; padding: 9px 12px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; text-decoration: none; color: var(--ink);
}
.linkbox span { color: var(--accent); font-weight: 700; }

.facts { margin: 0 0 16px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.facts > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; }
.facts > div + div { border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; text-align: end; word-break: break-all; }
.facts dd.accent { color: var(--accent); font-weight: 600; }

.check { display: flex; gap: 10px; align-items: center; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* progress */
.center { text-align: center; }
.center h2 { margin: 14px 0 10px; }
.center p { margin-bottom: 8px; }
.spinner {
  width: 44px; height: 44px; margin: 6px auto 0; border-radius: 50%;
  border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.phases { list-style: none; padding: 0; margin: 18px auto; max-width: 300px; text-align: start; }
.phases li { display: flex; align-items: center; gap: 10px; padding: 7px 0; color: var(--muted); }
.phases i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.phases li.is-on { color: var(--ink); font-weight: 600; }
.phases li.is-on i { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.phases li.is-done { color: var(--ink); }
.phases li.is-done i { background: var(--accent); }
.badge {
  width: 58px; height: 58px; border-radius: 50%; margin: 4px auto 0; display: grid; place-items: center;
  font-size: 28px; font-weight: 700;
}
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.wait { background: var(--warn-soft); color: var(--warn); }

.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; background: var(--soft); }
.tag.ok { background: var(--accent-soft); color: var(--accent); }
.tag.wait { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--danger-soft); color: var(--danger); }

.qbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 0 14px; }
.qbar .over { color: var(--danger); font-weight: 600; }
.results { display: grid; gap: 10px; }
.qitem { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.qhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.qcode { font-weight: 600; font-size: 14px; word-break: break-all; }
.qfacts { margin: 10px 0 0; display: grid; gap: 4px; }
.qfacts > div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.qfacts dt { color: var(--muted); }
.qfacts dd { margin: 0; font-weight: 500; text-align: end; word-break: break-all; }
.qitem .hint { margin: 8px 0 0; }

.foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 22px; }
.foot a { display: inline-block; margin-top: 6px; }

@media (max-width: 420px) {
  .card { padding: 18px; }
  .hero h1 { font-size: 22px; }
  .steps span { display: none; }
  .row { grid-template-columns: 1fr 1.6fr; }
}
