:root {
  --bg: #080808;
  --bg-2: #0f0f0f;
  --panel: #141414;
  --panel-2: #1b1b1b;
  --border: #2a2a2a;
  --text: #f5f5f5;
  --muted: #9a9a9a;
  --yellow: #ffd400;
  --yellow-soft: #ffe566;
  --yellow-dim: #b89b00;
  --danger: #ff5a4d;
  --warn: #ffb020;
  --radius: 12px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0; color: var(--text); min-height: 100vh; display: flex; flex-direction: column;
  background: radial-gradient(1200px 500px at 50% -200px, #1a1600 0%, var(--bg) 60%) no-repeat, var(--bg);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", sans-serif;
}
a { color: var(--yellow); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.65rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: 1.05rem; margin: 0 0 .6rem; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { background: var(--panel-2); padding: .1rem .35rem; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.big { font-size: 1.8rem; font-weight: 700; margin: .25rem 0 .5rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--yellow); color: #000; padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }

/* ---- header ---- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .65rem 1.25rem; background: rgba(0, 0, 0, .86); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); box-shadow: 0 1px 0 var(--yellow-dim);
}
.brand { display: flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 700; font-size: 1.1rem; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.brand img { display: block; height: 40px; width: auto; max-width: 62vw; }
.brand-ng { color: var(--yellow); }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .35rem; }
.nav > a:not(.btn) { color: var(--muted); padding: .35rem .7rem; border-radius: 8px; }
.nav > a:not(.btn):hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.nav > a.active { color: #000; background: var(--yellow); font-weight: 600; }
.menu { position: relative; margin-left: .35rem; }
.menu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .45rem; padding: .25rem .6rem .25rem .3rem; border: 1px solid var(--border); border-radius: 999px; color: var(--text); }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary, .menu summary:hover { border-color: var(--yellow); }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--yellow); color: #000; font-weight: 700; font-size: .85rem; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: .4rem; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.menu-pop a, .menu-pop button.link { display: block; width: 100%; text-align: left; padding: .5rem .7rem; border-radius: 7px; color: var(--text); }
.menu-pop a:hover, .menu-pop button.link:hover { background: var(--panel-2); color: var(--yellow); text-decoration: none; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; flex: 1; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 1.25rem; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem .6rem; }
.footer a { color: var(--yellow); }
.footer-sep { opacity: .5; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1.1rem; }
.page-head h1 { margin: 0; }
.head-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

/* ---- cards ---- */
.card {
  background: linear-gradient(180deg, var(--panel) 0%, #111 100%); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow);
}
.card.narrow, .narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.card-alert { border-color: var(--yellow-dim); background: linear-gradient(180deg, #1c1800 0%, #131100 100%); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; gap: .5rem; }
.card-head h2 { margin: 0; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; align-items: stretch; }
.two-col > .card { margin-bottom: 1.25rem; }
.two-col.wide-left { grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr); }
.gauge-card { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge { width: 180px; max-width: 100%; }
.state-card { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.state-card > div { flex: 1 1 280px; }
.state-bad { border-color: #4a2320; }
.illus { max-width: 100%; height: auto; }
.empty { text-align: center; padding: .5rem 0; }

/* ---- forms ---- */
label { display: block; margin: .9rem 0 .3rem; color: var(--muted); font-size: .85rem; }
input[type=text], input[type=password], select {
  width: 100%; padding: .65rem .75rem; background: #0e0e0e; color: var(--text);
  border: 1px solid var(--border); border-radius: 9px; font: inherit;
}
input.short { width: 5.2rem; display: inline-block; padding: .4rem .5rem; }
.hint { margin: .3rem 0 0; color: var(--muted); font-size: .8rem; }
input:focus, select:focus, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--yellow); outline-offset: 2px; border-color: var(--yellow);
}
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }
.btn, button.btn {
  display: inline-block; padding: .55rem 1.05rem; border-radius: 9px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s, transform .05s;
}
.btn:hover { border-color: var(--yellow); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--yellow); color: #000; border-color: var(--yellow); }
.btn-primary:hover { background: var(--yellow-soft); }
.btn-danger { color: var(--danger); border-color: #4a2320; }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { padding: .3rem .7rem; font-size: .85rem; }
.btn-block { display: block; width: 100%; margin-top: 1.2rem; }
button.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }
button.link:hover { color: var(--yellow); }
form.inline { display: inline; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }

.row { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; margin-top: 1rem; }
.grow { flex: 1 1 220px; }
.row label { margin-top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem 1rem; align-items: start; }
.grid label { margin-top: 0; }
.align-end { align-self: end; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; margin: 1rem 0; }
.actions-row { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }
.actions { white-space: nowrap; }

.notice { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid var(--border); background: var(--panel-2); }
.notice-ok { border-color: var(--yellow-dim); }
.notice-warn { border-color: var(--yellow); background: #1d1a05; color: var(--yellow-soft); }
.notice-err { border-color: var(--danger); background: #230d0b; color: #ff9d94; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: rgba(255, 255, 255, .02); }
th { color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
td.right, th.right { text-align: right; }
.usage-cell { min-width: 190px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .45rem 0; border-bottom: 1px solid var(--border); }
ul.plain li:last-child { border-bottom: 0; }

.tag { display: inline-block; white-space: nowrap; padding: .05rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; vertical-align: middle; border: 1px solid var(--border); color: var(--muted); }
.tag-ok { color: var(--yellow); border-color: var(--yellow-dim); }
.tag-off { color: var(--danger); border-color: #4a2320; }
.tag-warn { color: var(--warn); border-color: #5a4210; background: #1b1405; }
.presence { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #444; margin-right: .25rem; vertical-align: middle; }
.presence.on { background: #3ddc84; box-shadow: 0 0 0 3px rgba(61, 220, 132, .18); }

progress { display: block; width: 100%; height: 8px; margin-top: .35rem; border: 0; border-radius: 99px; background: #262626; overflow: hidden; appearance: none; -webkit-appearance: none; }
progress::-webkit-progress-bar { background: #262626; border-radius: 99px; }
progress::-webkit-progress-value { background: var(--yellow); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--yellow); border-radius: 99px; }
progress.over::-webkit-progress-value { background: var(--danger); }
progress.over::-moz-progress-bar { background: var(--danger); }
progress.warn::-webkit-progress-value { background: var(--warn); }
progress.warn::-moz-progress-bar { background: var(--warn); }

/* ---- stats ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--yellow); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.stat-label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 1.4rem; font-weight: 700; }

/* ---- charts ---- */
.chart { width: 100%; height: auto; display: block; }
.ch-grid { stroke: #262626; stroke-width: 1; }
.ch-axis { fill: var(--muted); font-size: 12.5px; }
.ch-label { fill: var(--text); font-size: 14px; }
.ch-down { fill: var(--yellow); }
.ch-up { fill: #e9e9e9; fill-opacity: .6; }
.ch-hit { fill: transparent; }
g:hover > .ch-hit { fill: rgba(255, 212, 0, .07); }
.ch-track { fill: #222; }
.ch-track-ring { stroke: #262626; }
.ch-ring { stroke: var(--yellow); }
.ch-ring.ch-warn { stroke: var(--warn); }
.ch-ring.ch-over { stroke: var(--danger); }
.ch-gauge-num { fill: var(--text); font-size: 26px; font-weight: 700; }
.ch-spark { fill: none; stroke: var(--yellow); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark { width: 84px; height: 24px; display: block; }
.legend { color: var(--muted); font-size: .8rem; margin: 0 0 .4rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 .25rem 0 .6rem; vertical-align: middle; }
.dot:first-child { margin-left: 0; }
.dot-down { background: var(--yellow); }
.dot-up { background: #e9e9e9; opacity: .6; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.seg a { padding: .3rem .8rem; color: var(--muted); font-size: .85rem; }
.seg a:hover { color: var(--text); text-decoration: none; background: var(--panel-2); }
.seg a.on { background: var(--yellow); color: #000; font-weight: 700; }

/* ---- QR, config, codes ---- */
.qr { background: #fff; padding: .5rem; border-radius: 8px; width: max-content; max-width: 100%; margin: .5rem auto; }
.qr svg { display: block; max-width: 100%; height: auto; }
.config { background: #0e0e0e; border: 1px solid var(--border); border-radius: 8px; padding: .75rem; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.secret { font-size: 1rem; letter-spacing: .08em; color: var(--yellow); word-break: break-all; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.codes code { display: block; text-align: center; padding: .4rem; font-size: 1rem; }
details summary { cursor: pointer; color: var(--yellow); }

/* ---- sign in / register ---- */
.auth { max-width: 440px; margin: 1.5rem auto 0; }
.auth-hero { text-align: center; margin-bottom: 1.25rem; }
.auth-hero img { border-radius: 16px; margin-bottom: .5rem; }
.auth-hero h1 { margin-bottom: .35rem; }
.auth-alt { margin: 1.1rem 0 0; }

/* ---- help ---- */
.help { display: grid; grid-template-columns: 230px 1fr; gap: 1.5rem; align-items: start; }
.toc { position: sticky; top: 76px; font-size: .9rem; }
.toc ol { margin: .4rem 0 1rem; padding-left: 1.2rem; }
.toc li { margin: .3rem 0; }
.help-part { font-size: 1.25rem; margin: 1.5rem 0 .75rem; color: var(--yellow); }
.help-part:first-child { margin-top: 0; }
.help-body .card { scroll-margin-top: 80px; }
.help-body ol, .help-body ul { padding-left: 1.3rem; }
.help-body li { margin: .35rem 0; }
.faq dt { font-weight: 600; margin-top: .9rem; }
.faq dd { margin: .2rem 0 0; color: #cfcfcf; }

@media (max-width: 820px) {
  .help { grid-template-columns: 1fr; }
  .toc { position: static; }
}
@media (max-width: 600px) {
  .container { padding: 1rem .8rem 2rem; }
  .nav { font-size: .9rem; }
  .two-col, .two-col.wide-left { grid-template-columns: 1fr; }
  .menu-pop { right: auto; left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---- language switch ---- */
.lang { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-left: .35rem; }
.lang a { padding: .2rem .65rem; font-size: .8rem; color: var(--muted); }
.lang a:hover { color: var(--text); text-decoration: none; background: var(--panel-2); }
.lang a.on { background: var(--yellow); color: #000; font-weight: 700; }

/* ---- auth logo ---- */
.auth-logo { display: block; margin: 0 auto .9rem; max-width: 100%; height: auto; }

/* ---- tutorial screenshots ---- */
figure.shot { margin: 1rem 0 1.25rem; }
figure.shot img { display: block; width: 100%; max-width: 760px; height: auto; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
figure.shot figcaption { color: var(--muted); font-size: .82rem; margin-top: .4rem; }
body.lang-zh .help-body li, body.lang-zh .help-body dd { line-height: 1.75; }
