:root {
  color-scheme: dark;
  --bg: #071012;
  --surface: rgba(14, 28, 30, 0.86);
  --surface-strong: #102225;
  --line: rgba(192, 235, 218, 0.14);
  --line-strong: rgba(192, 235, 218, 0.28);
  --text: #f1f8f5;
  --muted: #9cb2aa;
  --green: #80f0bd;
  --green-strong: #33d696;
  --amber: #f6c96f;
  --red: #ff877d;
  --blue: #89b9ff;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(255,255,255,.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.016) 1px, transparent 1px),
    var(--bg);
  background-size: 48px 48px;
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

[hidden] { display: none !important; }

.ambient {
  position: fixed;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: .13;
  pointer-events: none;
  z-index: -1;
}
.ambient-one { top: -220px; right: -120px; background: var(--green); }
.ambient-two { bottom: -300px; left: -180px; background: #2e78ff; opacity: .08; }

.topbar {
  width: min(1120px, calc(100% - 40px));
  height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 680;
  text-decoration: none;
  letter-spacing: .01em;
}
.brand em { color: var(--green); font-style: normal; margin: 0 3px; }
.brand-mark { display: flex; align-items: end; gap: 3px; width: 22px; height: 20px; }
.brand-mark i { width: 4px; border-radius: 4px; background: var(--green); box-shadow: 0 0 16px rgba(128,240,189,.28); }
.brand-mark i:nth-child(1) { height: 9px; }
.brand-mark i:nth-child(2) { height: 18px; }
.brand-mark i:nth-child(3) { height: 13px; }

.mode-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .08em;
}
.mode-badge span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(128,240,189,.09); }
.mode-badge.local { color: var(--green); }

main { width: min(960px, calc(100% - 40px)); margin: 0 auto; }

.hero { padding: 92px 0 78px; text-align: center; }
.eyebrow {
  margin-bottom: 18px;
  color: var(--green);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: .2em;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 23px;
  font-size: clamp(42px, 7vw, 72px);
  line-height: 1.06;
  letter-spacing: -.055em;
  font-weight: 730;
}
h1 span { color: #9ab0aa; }
.hero-copy { max-width: 630px; margin: 0 auto 42px; color: var(--muted); font-size: 16px; line-height: 1.75; }

.probe-card, .local-panel, .progress-panel, .error-panel, .result-card, .recommendation-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.probe-card {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px;
  border-radius: 22px;
  text-align: left;
}
.probe-card label { display: block; margin: 0 0 9px 2px; color: #c9d7d1; font-size: 12px; font-weight: 650; }
.label-row { margin-top: 20px; display: flex; align-items: center; justify-content: space-between; }
.label-row label { margin-bottom: 9px; }
.label-row span { margin-bottom: 9px; color: var(--green); font-size: 11px; }
.input-shell {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 17px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: rgba(3, 12, 13, .72);
  transition: border-color .2s, box-shadow .2s;
}
.input-shell:focus-within { border-color: rgba(128,240,189,.62); box-shadow: 0 0 0 4px rgba(128,240,189,.07); }
.input-shell input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 15px; }
.input-shell input::placeholder { color: #60746d; }
.protocol-dot { width: 9px; height: 9px; flex: 0 0 auto; border: 2px solid var(--green); border-radius: 50%; }
.key-icon { position: relative; width: 12px; height: 12px; flex: 0 0 auto; border: 1.5px solid var(--green); border-radius: 50%; }
.key-icon::after { content: ""; position: absolute; top: 8px; left: 8px; width: 9px; height: 1.5px; background: var(--green); transform: rotate(45deg); transform-origin: left center; }
.reveal-button { padding: 6px; border: 0; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.form-footer { margin-top: 24px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.form-footer p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.form-footer p span { color: var(--green); }
.primary-button, .secondary-button, .ghost-button, .text-button {
  border: 0;
  cursor: pointer;
  transition: transform .16s, background .16s, border-color .16s, color .16s;
}
.primary-button {
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 0 21px;
  border-radius: 11px;
  background: var(--green);
  color: #052016;
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
}
.primary-button:hover { transform: translateY(-1px); background: #a1f6d0; }
.primary-button b { font-size: 18px; line-height: 1; }
.primary-button:disabled { opacity: .5; cursor: wait; transform: none; }
.primary-button.compact, .secondary-button.compact { height: 42px; }
.secondary-button { height: 42px; padding: 0 17px; border: 1px solid var(--line-strong); border-radius: 10px; background: transparent; color: var(--text); font-size: 12px; font-weight: 650; }
.secondary-button:hover, .ghost-button:hover { border-color: var(--green); color: var(--green); }
.ghost-button { padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); color: var(--muted); font-size: 11px; }
.ghost-button.full { width: 100%; margin-top: 16px; }
.text-button { padding: 6px 0; background: transparent; color: var(--muted); font-size: 12px; }
.text-button:hover { color: var(--green); }
.transport-warning { margin-top: 18px; padding: 11px 13px; border: 1px solid rgba(246,201,111,.22); border-radius: 10px; color: var(--amber); background: rgba(246,201,111,.06); font-size: 11px; line-height: 1.55; }
.trust-row { margin-top: 22px; display: flex; justify-content: center; gap: 24px; color: #6f8780; font-size: 11px; }
.trust-row i { color: var(--green); font-style: normal; margin-right: 4px; }

.local-panel, .error-panel { max-width: 760px; margin: 60px auto 90px; padding: 38px; border-radius: 22px; }
.local-panel h2, .error-panel h2, .progress-panel h2, .result-header h2 { margin-bottom: 12px; font-size: 28px; letter-spacing: -.035em; }
.local-panel p, .error-panel p, .progress-panel p { color: var(--muted); line-height: 1.7; }
.local-panel code { color: var(--green); }
.command-box { display: flex; align-items: center; gap: 12px; margin: 25px 0 21px; padding: 14px 14px 14px 17px; border: 1px solid var(--line-strong); border-radius: 12px; background: #041012; }
.command-box code { min-width: 0; flex: 1; overflow-x: auto; white-space: nowrap; font-size: 11px; scrollbar-width: thin; }
.command-box button { flex: 0 0 auto; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-strong); color: var(--text); font-size: 11px; cursor: pointer; }
.mini-steps { display: flex; gap: 20px; padding: 0; margin: 0 0 26px; list-style: none; color: var(--muted); font-size: 11px; }
.mini-steps li { display: flex; align-items: center; gap: 7px; }
.mini-steps span { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--green); }

.progress-panel { max-width: 760px; margin: 60px auto 100px; padding: 46px; display: grid; grid-template-columns: 160px 1fr; gap: 45px; align-items: center; border-radius: 24px; }
.radar { position: relative; width: 148px; height: 148px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: radial-gradient(circle, rgba(128,240,189,.11), transparent 65%); }
.radar::before, .radar::after { content: ""; position: absolute; border: 1px solid var(--line); border-radius: 50%; }
.radar::before { inset: 26px; }
.radar::after { inset: 52px; }
.radar i:first-child { position: absolute; width: 50%; height: 1px; left: 50%; top: 50%; transform-origin: left; background: linear-gradient(90deg, var(--green), transparent); animation: scan 1.7s linear infinite; }
.radar i:nth-child(2), .radar i:nth-child(3) { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }
.radar i:nth-child(2) { top: 35px; left: 91px; }
.radar i:nth-child(3) { bottom: 37px; left: 45px; animation: blink 1.4s infinite; }
@keyframes scan { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: .25; } }
.progress-track { height: 4px; margin-top: 25px; overflow: hidden; border-radius: 4px; background: rgba(255,255,255,.07); }
.progress-track span { display: block; width: 12%; height: 100%; border-radius: inherit; background: var(--green); transition: width .6s ease; box-shadow: 0 0 14px rgba(128,240,189,.45); }
.progress-labels { margin-top: 10px; display: flex; justify-content: space-between; color: #526860; font-size: 10px; }
.progress-labels .active { color: var(--green); }

.error-panel { display: flex; align-items: flex-start; gap: 24px; }
.error-mark { width: 45px; height: 45px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(255,135,125,.35); border-radius: 50%; color: var(--red); background: rgba(255,135,125,.08); font-weight: 800; }
.error-panel .secondary-button { margin-top: 8px; }

.results { padding: 58px 0 90px; }
.result-header { margin-bottom: 24px; display: flex; align-items: flex-end; justify-content: space-between; }
.result-header h2 { margin-bottom: 7px; font-size: 36px; }
.result-header p { margin-bottom: 0; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
.success-seal { width: 68px; height: 68px; display: grid; place-content: center; justify-items: center; border: 1px solid rgba(128,240,189,.28); border-radius: 50%; color: var(--green); background: rgba(128,240,189,.06); }
.success-seal span { font-size: 21px; }
.success-seal small { color: var(--muted); font-size: 9px; }

.recommendation-card { margin-bottom: 16px; padding: 28px 30px; display: flex; align-items: center; justify-content: space-between; border-color: rgba(128,240,189,.3); border-radius: 18px; background: linear-gradient(110deg, rgba(31,79,63,.45), rgba(11,25,27,.88)); }
.card-kicker { display: block; margin-bottom: 9px; color: var(--green); font-size: 9px; font-weight: 750; letter-spacing: .17em; text-transform: uppercase; }
.recommendation-card h3 { margin-bottom: 7px; font-size: 27px; letter-spacing: -.03em; }
.recommendation-card p { margin: 0; color: var(--muted); font-size: 12px; }
.format-symbol { width: 55px; height: 55px; display: grid; place-items: center; border: 1px solid rgba(128,240,189,.25); border-radius: 15px; color: var(--green); background: rgba(128,240,189,.07); font: 700 21px ui-monospace, monospace; }
.local-fallback { margin: 0 0 16px; padding: 24px 26px; border: 1px solid rgba(246,201,111,.28); border-radius: 17px; background: rgba(246,201,111,.055); }
.local-fallback h3 { margin-bottom: 8px; font-size: 19px; }
.local-fallback p { margin-bottom: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.local-fallback .card-kicker { color: var(--amber); }
.local-fallback .command-box { margin-bottom: 0; }

.result-grid { display: grid; grid-template-columns: 1.35fr .8fr; gap: 16px; }
.result-card { margin-bottom: 16px; padding: 26px; border-radius: 17px; box-shadow: 0 18px 55px rgba(0,0,0,.2); }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 21px; }
.card-heading h3 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.muted { color: var(--muted); font-size: 10px; }
.config-editor { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.editor-field, .mapping-field { min-width: 0; display: block; }
.editor-field.wide { grid-column: 1 / -1; }
.editor-field > span:first-child, .mapping-field > span { display: block; margin: 0 0 6px 2px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.editor-field > input, .editor-field > select, .mapping-field input, .editor-secret {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: rgba(3,12,13,.48);
  color: #d9e7e2;
  font: 10px ui-monospace, SFMono-Regular, Menlo, monospace;
  transition: border-color .16s, box-shadow .16s;
}
.editor-field > input, .editor-field > select, .mapping-field input { padding: 0 11px; }
.editor-field > select { appearance: auto; cursor: pointer; }
.editor-field > input:focus, .editor-field > select:focus, .mapping-field input:focus, .editor-secret:focus-within { border-color: rgba(128,240,189,.58); box-shadow: 0 0 0 3px rgba(128,240,189,.06); }
.editor-secret { display: flex; align-items: center; }
.editor-secret input { min-width: 0; flex: 1; height: 100%; padding: 0 11px; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; }
.editor-secret button { height: 100%; padding: 0 11px; border: 0; background: transparent; color: var(--muted); font-size: 9px; cursor: pointer; }
.mapping-editor { margin-top: 13px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.mapping-field input { color: var(--green); }
.action-row { margin-top: 20px; display: flex; gap: 9px; flex-wrap: wrap; }
.small-note { margin: 12px 0 0; color: #70877e; font-size: 10px; line-height: 1.5; }
.status-pill { padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; }
.status-pill.ok { border-color: rgba(128,240,189,.25); color: var(--green); background: rgba(128,240,189,.06); }
.balance-number { margin: 7px 0 3px; font-size: 38px; font-weight: 680; letter-spacing: -.04em; }
.balance-number small { margin-left: 5px; color: var(--muted); font-size: 12px; font-weight: 500; }
.balance-plan { color: var(--muted); font-size: 11px; }
.balance-meta { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.balance-meta div { padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.balance-meta span { display: block; color: var(--muted); font-size: 9px; }
.balance-meta b { display: block; margin-top: 4px; color: #d9e7e2; font-size: 12px; }
.balance-failed { min-height: 115px; display: grid; align-content: center; color: var(--muted); font-size: 12px; line-height: 1.6; }

.format-results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.format-result { padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: rgba(3,12,13,.35); }
.format-result-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.format-result strong { font-size: 11px; }
.format-result .dot { width: 8px; height: 8px; border-radius: 50%; background: #52645e; }
.format-result.supported .dot { background: var(--green); box-shadow: 0 0 9px rgba(128,240,189,.5); }
.format-result.unsupported .dot { background: var(--red); }
.format-result p { min-height: 30px; margin: 10px 0 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.format-meta { margin-top: 11px; display: flex; gap: 10px; color: #657a73; font: 9px ui-monospace, monospace; }

.model-list { display: flex; flex-wrap: wrap; gap: 7px; }
.model-chip { max-width: 100%; display: inline-flex; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: rgba(3,12,13,.42); color: #b8c9c3; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.model-name { min-width: 0; overflow: hidden; padding: 7px 8px 7px 9px; text-overflow: ellipsis; white-space: nowrap; }
.model-copy { align-self: stretch; padding: 0 7px; border: 0; border-left: 1px solid var(--line); background: rgba(128,240,189,.035); color: #71877f; font-size: 8px; cursor: pointer; transition: color .16s, background .16s; }
.model-copy:hover { background: rgba(128,240,189,.1); color: var(--green); }
#showAllModels { margin-top: 15px; }
.warnings { margin: 1px 0 20px; padding: 16px 18px; border: 1px solid rgba(246,201,111,.18); border-radius: 12px; background: rgba(246,201,111,.045); color: var(--amber); font-size: 11px; line-height: 1.8; }
.warnings ul { margin: 0; padding-left: 18px; }
.start-over { display: block; margin: 6px auto 0; }

footer { width: min(1120px, calc(100% - 40px)); min-height: 86px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: #50665e; font-size: 10px; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 20; padding: 11px 15px; transform: translate(-50%, 20px); border: 1px solid rgba(128,240,189,.22); border-radius: 10px; background: #112823; color: var(--green); box-shadow: var(--shadow); font-size: 11px; opacity: 0; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .topbar { height: 72px; }
  .brand { font-size: 13px; }
  .hero { padding: 68px 0 60px; }
  h1 { font-size: clamp(39px, 12vw, 56px); }
  .hero-copy { font-size: 14px; }
  .probe-card { padding: 20px; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .form-footer .primary-button { width: 100%; }
  .trust-row { gap: 11px; flex-wrap: wrap; }
  .progress-panel { grid-template-columns: 1fr; padding: 30px; }
  .radar { margin: 0 auto; }
  .result-header { align-items: center; }
  .result-header h2 { font-size: 29px; }
  .success-seal { width: 58px; height: 58px; }
  .result-grid { grid-template-columns: 1fr; }
  .format-results { grid-template-columns: 1fr; }
  .mini-steps { align-items: flex-start; flex-direction: column; }
  .command-box { align-items: stretch; flex-direction: column; }
  .command-box button { align-self: flex-end; }
  .recommendation-card { padding: 23px; }
  .format-symbol { display: none; }
  .result-card { padding: 21px; }
  .config-editor, .mapping-editor { grid-template-columns: 1fr; }
  .editor-field.wide { grid-column: auto; }
  footer { flex-direction: column; justify-content: center; gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
