:root {
  --bg: #0b0d10;
  --card: #13161b;
  --card-2: #1a1e25;
  --line: #232832;
  --text: #eef1f5;
  --muted: #8a93a1;
  --go: #22c55e;
  --go-ink: #04210f;
  --stop: #ef4444;
  --warn: #f59e0b;
  --blue: #60a5fa;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f5f8; --card: #ffffff; --card-2: #f1f3f7; --line: #e2e6ec;
    --text: #12161c; --muted: #677284; --go: #16a34a; --go-ink: #ffffff;
    --stop: #dc2626; --warn: #b45309; --blue: #2563eb;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
a { color: var(--blue); }
code { font-family: var(--mono); font-size: .88em; background: var(--card-2); padding: 1px 5px; border-radius: 5px; }
h2 { margin: 0; font-size: 15px; font-weight: 650; }
.err { color: var(--stop); font-size: 14px; margin: 10px 0 0; min-height: 1px; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.hint.warnc { color: var(--warn); }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.card-top > div h2 { line-height: 1.3; }
.banner-warn { margin: 0; padding: 12px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
.hint:empty { display: none; }
.grow { flex: 1; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--card-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; width: 100%; outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--go); }
button { font: inherit; cursor: pointer; }

.btn-go, .btn-stop, .btn-soft {
  border: 0; border-radius: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; transition: transform .06s, filter .15s;
}
.btn-go:active, .btn-stop:active, .btn-soft:active { transform: scale(.98); }
.btn-go { background: var(--go); color: var(--go-ink); padding: 0 28px; }
.btn-go:hover { filter: brightness(1.08); }
.btn-go:disabled { opacity: .5; cursor: default; }
.btn-go.small { padding: 9px 18px; border-radius: 10px; }
.btn-stop { background: var(--stop); color: #fff; padding: 0 28px; }
.btn-soft { background: var(--card-2); color: var(--text); border: 1px solid var(--line); padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.btn-soft:hover { border-color: var(--muted); }
.btn-soft.small { padding: 5px 10px; font-size: 13px; }
.icon-btn { background: none; border: 0; color: var(--muted); padding: 8px; border-radius: 10px; display: grid; }
.icon-btn:hover { color: var(--text); background: var(--card-2); }

/* logo mark */
.mark { width: 44px; height: 44px; background: var(--go); -webkit-mask: url(/icon.svg) center/contain no-repeat; mask: url(/icon.svg) center/contain no-repeat; }
.mark.small { width: 22px; height: 22px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: 100%; max-width: 320px; display: grid; gap: 12px; justify-items: center; }
.login-box h1 { margin: 0 0 8px; font-size: 22px; }
.login-box input, .login-box button { width: 100%; height: 48px; }

/* layout */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; max-width: 980px; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 17px; }
main { max-width: 980px; margin: 0 auto; padding: 4px 20px 40px; display: grid; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; min-width: 0; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .two { grid-template-columns: 1fr; } }

/* hero */
.hero { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 26px; position: relative; overflow: hidden; }
.hero.running { border-color: color-mix(in srgb, var(--go) 45%, var(--line)); }
.hero.won { border-color: var(--go); background: color-mix(in srgb, var(--go) 10%, var(--card)); }
.hero.lost { border-color: color-mix(in srgb, var(--stop) 50%, var(--line)); }
.state { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; color: var(--muted); margin-bottom: 16px; }
.hero.running .state { color: var(--go); }
.hero.won .state { color: var(--go); font-size: 20px; }
.hero.lost .state { color: var(--stop); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.hero.running .dot { background: var(--go); animation: beat 1.4s ease-in-out infinite; }
.hero.won .dot { background: var(--go); }
.hero.lost .dot { background: var(--stop); }
@keyframes beat { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--go) 55%, transparent); } 60% { box-shadow: 0 0 0 9px transparent; } }

.go-row { display: flex; gap: 12px; height: 64px; }
.go-row input { height: 100%; font-size: 26px; font-weight: 700; padding: 0 18px; border-radius: 14px; letter-spacing: .01em; }
.go-row .btn-go, .go-row .btn-stop { font-size: 20px; border-radius: 14px; min-width: 130px; }
.run-name { flex: 1; display: flex; align-items: center; font-size: 30px; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.nums > div { background: var(--card-2); border-radius: 14px; padding: 12px 14px; display: grid; min-width: 0; }
.nums b { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nums span { color: var(--muted); font-size: 12px; font-weight: 600; }
@media (max-width: 600px) { .nums { grid-template-columns: 1fr 1fr; } }
.note { margin: 14px 0 0; color: var(--muted); font-size: 14px; min-height: 1px; }
.note.warn { color: var(--warn); }
.note:empty { display: none; }

.opts { margin-top: 16px; }
.opts summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; width: max-content; list-style: none; }
.opts summary::before { content: "▸ "; }
.opts[open] summary::before { content: "▾ "; }
.opts summary::-webkit-details-marker { display: none; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 12px; align-items: end; }
.opt-grid label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 600; }
label.tick { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 500; font-size: 14px; }
label.tick input { width: auto; margin: 0; accent-color: var(--go); }
label.tick.small { font-size: 13px; color: var(--muted); }

/* accounts */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list li { display: flex; align-items: center; gap: 10px; background: var(--card-2); border-radius: 12px; padding: 10px 12px; }
.list .who { flex: 1; min-width: 0; }
.list .who b { display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .who small { color: var(--muted); font-size: 12px; }
.list .who small.bad { color: var(--stop); }
.list .empty { color: var(--muted); justify-content: center; }
.chip { font-size: 11px; font-weight: 750; padding: 3px 8px; border-radius: 99px; white-space: nowrap; text-transform: uppercase; letter-spacing: .03em; }
.chip.claim { background: color-mix(in srgb, var(--go) 18%, transparent); color: var(--go); }
.chip.check { background: color-mix(in srgb, var(--blue) 18%, transparent); color: var(--blue); }
.x { background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1; padding: 4px 6px; border-radius: 8px; }
.x:hover { color: var(--stop); background: color-mix(in srgb, var(--stop) 12%, transparent); }

/* proxies */
.proxy-sum { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.proxy-sum b { color: var(--text); }
.paths { display: grid; gap: 5px; }
.path { display: grid; grid-template-columns: minmax(0, 1fr) 90px 44px; gap: 10px; align-items: center; font-size: 12.5px; }
.path .p { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.path .bar { height: 6px; background: var(--card-2); border-radius: 3px; overflow: hidden; }
.path .bar i { display: block; height: 100%; background: var(--go); border-radius: 3px; }
.path .ms { text-align: right; font-variant-numeric: tabular-nums; }

/* log */
.log-tools { display: flex; align-items: center; gap: 12px; }
.log { margin: 0; height: 340px; overflow: auto; background: #07090b; color: #c3cad4; border-radius: 12px; padding: 12px 14px;
  font: 12.5px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.log .c { color: #6b7684; }
.log .w { color: #fbbf24; }
.log .e { color: #f87171; }
.log .g { color: #4ade80; font-weight: 700; }
.log.no-checks .c:not(.w) { display: none; }

/* modals */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 16px; }
.sheet { width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 22px; display: grid; gap: 12px; max-height: calc(100vh - 32px); overflow: auto; }
.sheet.wide { max-width: 640px; }
.sheet h2 { font-size: 18px; margin-bottom: 4px; }
.sheet-btns { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.step { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.step > span { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--card-2); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.code { display: block; margin-top: 8px; font: 800 30px/1 var(--mono); letter-spacing: .14em; padding: 12px 16px; border-radius: 12px; background: var(--card-2); color: var(--text); border: 1px dashed var(--line); }
.code:hover { border-color: var(--go); }
.m-status { margin: 0; font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.m-status.ok { color: var(--go); }
.m-status.bad { color: var(--stop); }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--go); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
textarea { min-height: 260px; font: 12.5px/1.5 var(--mono); white-space: pre; resize: vertical; }
.proxy-results { display: grid; gap: 3px; max-height: 200px; overflow: auto; font: 12.5px/1.5 var(--mono); }
.proxy-results div { display: flex; justify-content: space-between; gap: 10px; }
.proxy-results .bad { color: var(--stop); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 30; background: var(--card); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); font-size: 14px; max-width: calc(100vw - 32px); }
.toast.bad { color: var(--stop); border-color: var(--stop); }

@media (max-width: 560px) {
  .topbar { padding: 12px 16px; }
  main { padding: 4px 16px 32px; }
  .hero { padding: 20px 16px; }
  .go-row { height: 56px; }
  .go-row input { font-size: 22px; }
  .go-row .btn-go, .go-row .btn-stop { min-width: 96px; font-size: 18px; padding: 0 18px; }
  .run-name { font-size: 24px; }
  .log { height: 300px; }
}
