:root {
    --bg: #f4f6f9;
    --card: #ffffff;
    --ink: #16202c;
    --ink-2: #4b5b6e;
    --ink-3: #8496a8;
    --line: #e2e8f0;
    --line-2: #cfd8e3;
    --red: #d92b4b;
    --red-soft: #fdeef1;
    --blue: #2b6cd9;
    --blue-soft: #eaf1fd;
    --green: #12885a;
    --green-soft: #e8f6f0;
    --amber: #a86400;
    --amber-soft: #fdf4e3;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(22, 32, 44, .05), 0 6px 20px rgba(22, 32, 44, .06);
    --shadow-lg: 0 12px 40px rgba(22, 32, 44, .16);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px 64px; }
.wrap-narrow { max-width: 520px; }

header.top {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: saturate(1.4) blur(8px);
}
header.top .inner {
    max-width: 1080px; margin: 0 auto; padding: 12px 16px;
    display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; }
/* 站点头部是整块可点区域，鼠标移上去不要出现下划线 */
.brand:hover, .brand:focus, .brand h1, .brand small { text-decoration: none; }
/* 站标：sxktr.png 是带透明通道的圆形徽标，自带底色，所以不再需要背景与圆角 */
.brand .logo {
    width: 34px; height: 34px; flex: none; display: block;
    filter: drop-shadow(0 2px 5px rgba(179, 23, 58, .22));
}
.brand .logo.logo-lg { width: 64px; height: 64px; }
.brand h1 { font-size: 16px; margin: 0; font-weight: 650; letter-spacing: .2px; white-space: nowrap; }
.brand small { display: block; color: var(--ink-3); font-size: 11.5px; font-weight: 400; line-height: 1.3; }
header.top nav { margin-left: auto; display: flex; gap: 4px; align-items: center; }
header.top nav a {
    padding: 7px 12px; border-radius: 8px; color: var(--ink-2);
    font-size: 14px; font-weight: 500; white-space: nowrap;
}
header.top nav a:hover { background: var(--bg); text-decoration: none; }
header.top nav a.active { background: var(--ink); color: #fff; }

h2.page { font-size: 20px; margin: 26px 0 4px; font-weight: 650; }
p.page-sub { color: var(--ink-3); margin: 0 0 18px; font-size: 13.5px; }

/* ---------- 卡片 ---------- */
.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 20px; margin-bottom: 18px;
}
.card.tight { padding: 14px 16px; }
.card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card h3 .badge { font-size: 11px; }

/* ---------- 表单 ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > .lab {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px;
}
label.field > .lab .val { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }
input[type=text], input[type=password], input[type=search], select {
    width: 100%; padding: 11px 13px; font-size: 15px; font-family: inherit;
    border: 1px solid var(--line-2); border-radius: var(--radius-sm);
    background: #fff; color: var(--ink); outline: none;
}
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }

input[type=range] {
    -webkit-appearance: none; width: 100%; height: 26px; background: transparent; margin: 0;
}
input[type=range]::-webkit-slider-runnable-track {
    height: 5px; border-radius: 3px; background: var(--line-2);
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%;
    background: #fff; border: 2px solid var(--blue); margin-top: -9px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .2); cursor: pointer;
}
input[type=range]::-moz-range-track { height: 5px; border-radius: 3px; background: var(--line-2); }
input[type=range]::-moz-range-thumb {
    width: 20px; height: 20px; border-radius: 50%; background: #fff;
    border: 2px solid var(--blue); cursor: pointer;
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 11px 18px; font-size: 15px; font-weight: 600; font-family: inherit;
    border: 1px solid var(--line-2); background: #fff; color: var(--ink);
    border-radius: var(--radius-sm); cursor: pointer; text-align: center;
    transition: .15s ease; line-height: 1.2;
}
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.danger { color: var(--red); border-color: #f2ccd4; background: var(--red-soft); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 上传区 ---------- */
.dropzone {
    border: 2px dashed var(--line-2); border-radius: var(--radius);
    background: var(--card); padding: 34px 20px; text-align: center;
    transition: .18s ease; cursor: pointer;
}
.dropzone:hover, .dropzone.hot { border-color: var(--blue); background: var(--blue-soft); }
.dropzone .big { font-size: 34px; line-height: 1; margin-bottom: 10px; }
.dropzone .t1 { font-size: 16px; font-weight: 650; margin-bottom: 4px; }
.dropzone .t2 { font-size: 13px; color: var(--ink-3); }
.dropzone input[type=file] { display: none; }

.paste-hint {
    margin-top: 12px; font-size: 12.5px; color: var(--ink-3);
    display: flex; align-items: center; justify-content: center; gap: 6px;
}

/* ---------- 上传队列 ---------- */
.queue { margin-top: 16px; }
.qitem {
    display: flex; align-items: center; gap: 12px; padding: 11px 13px;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: #fff; margin-bottom: 8px;
}
.qitem .thumb {
    width: 46px; height: 46px; border-radius: 8px; flex: none; object-fit: cover;
    background: var(--bg); border: 1px solid var(--line);
}
.qitem .meta { flex: 1; min-width: 0; }
.qitem .name {
    font-size: 13.5px; font-weight: 600; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.qitem .sub { font-size: 12px; color: var(--ink-3); }
.qitem .state { flex: none; font-size: 12.5px; font-weight: 600; text-align: right; }
.state.wait { color: var(--ink-3); }
.state.run { color: var(--blue); }
.state.done { color: var(--green); }
.state.err { color: var(--red); }
.bar { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--blue); transition: width .25s; }

/* ---------- 三列参数网格 ---------- */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid3 > * { min-width: 0; }

/* ---------- 指标面板 ---------- */
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.metric {
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: 15px 14px; background: #fff;
}
.metric .k { font-size: 12.5px; color: var(--ink-3); font-weight: 600; margin-bottom: 6px; }
.metric .v { font-size: 27px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric .u { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.metric .r { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.metric.red { background: var(--red-soft); border-color: #f6d5dc; }
.metric.red .v { color: var(--red); }
.metric.blue { background: var(--blue-soft); border-color: #d5e4fa; }
.metric.blue .v { color: var(--blue); }
.metric.ink .v { color: var(--ink); }

.hbar { height: 14px; border-radius: 7px; overflow: hidden; display: flex; background: var(--line); margin: 6px 0 4px; }
.hbar > i { display: block; height: 100%; }
.hbar > i.red { background: var(--red); }
.hbar > i.blue { background: #6f9bea; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend a, .legend a:hover { text-decoration: none; }
.legend i.sw { width: 11px; height: 11px; border-radius: 3px; display: block; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th, table.tbl td {
    padding: 10px 10px; text-align: left; border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
table.tbl th {
    font-size: 12px; color: var(--ink-3); font-weight: 650;
    text-transform: none; background: #fafbfd; position: sticky; top: 0;
}
table.tbl td.num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 13px; }
table.tbl tr:hover td { background: #fafbfd; }
.thumb-sm {
    width: 48px; height: 48px; border-radius: 7px; object-fit: cover;
    border: 1px solid var(--line); background: var(--bg); display: block;
}

/* ---------- 标记 ---------- */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 20px;
    font-size: 11.5px; font-weight: 650; line-height: 1.7; white-space: nowrap;
}
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.err { background: var(--red-soft); color: var(--red); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.mute { background: #eef1f5; color: var(--ink-2); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }

.note {
    border-left: 3px solid var(--amber); background: var(--amber-soft);
    padding: 11px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13px; color: #7a4c00; margin-bottom: 12px;
}
.note.red { border-color: var(--red); background: var(--red-soft); color: #98203a; }
.note.info { border-color: var(--blue); background: var(--blue-soft); color: #1d4f9e; }
.note ul { margin: 6px 0 0; padding-left: 18px; }
.note li { margin: 2px 0; }

/* ---------- 图片查看 ---------- */
.viewer {
    position: relative; background: #10151b; border-radius: var(--radius-sm);
    overflow: hidden; display: grid; place-items: center; min-height: 200px;
}
.viewer img { display: block; max-width: 100%; max-height: 72vh; cursor: zoom-in; }
.viewer .tools {
    position: absolute; right: 8px; top: 8px; display: flex; gap: 6px;
}
.viewer .tools button {
    background: rgba(255, 255, 255, .92); border: none; border-radius: 8px;
    padding: 6px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--ink);
}
.lightbox {
    position: fixed; inset: 0; background: rgba(8, 11, 15, .94); z-index: 200;
    display: none; place-items: center; padding: 20px; overflow: auto;
}
.lightbox.on { display: grid; }
.lightbox img { max-width: 100%; max-height: 100%; }
.lightbox .close {
    position: fixed; right: 18px; top: 18px; background: #fff; border: none;
    width: 40px; height: 40px; border-radius: 50%; font-size: 20px; cursor: pointer;
    line-height: 1; color: var(--ink);
}

/* ---------- 实时调参面板 ----------
 * 全屏黑底：上面一行实时数字，中间放大图，下面一排滑块。
 * 手机上天然就是「竖排 + 底部操作条」，不用另外写一套布局。
 */
.tuner {
    position: fixed; inset: 0; z-index: 300; background: #0b0e12;
    display: none; flex-direction: column; color: #e9edf2;
}
.tuner.on { display: flex; }
.tuner .tn-head {
    display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap;
    padding: 10px 12px; background: rgba(255, 255, 255, .05);
    border-bottom: 1px solid rgba(255, 255, 255, .09);
}
.tuner .tn-close {
    width: 34px; height: 34px; flex: none; border: none; border-radius: 50%;
    background: rgba(255, 255, 255, .15); color: #fff; font-size: 18px;
    line-height: 1; cursor: pointer;
}
.tuner .tn-close:hover { background: rgba(255, 255, 255, .26); }
.tuner .tn-stats {
    display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px;
    font-size: 13px; color: #a9b4c0;
}
.tuner .tn-stats b { color: #fff; font-size: 17px; font-variant-numeric: tabular-nums; }
.tuner .tn-stats i { font-size: 11.5px; font-style: normal; }
.tuner .tn-stats .s-red b { color: #ff8098; }
.tuner .tn-stats .s-pale b { color: #7db0ff; }
.tuner .tn-state { margin-left: auto; font-size: 12.5px; color: #ffc46b; }
.tuner .tn-stage {
    flex: 1; min-height: 0; padding: 6px;
    display: grid; place-items: center; overflow: hidden;
}
.tuner .tn-stage img { display: block; max-width: 100%; max-height: 100%; }
.tuner .tn-panel {
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .05);
    border-top: 1px solid rgba(255, 255, 255, .09);
}
.tuner .tn-note { display: none; }
.tuner .tn-note.on {
    display: block; font-size: 12px; color: #ffc46b;
    padding-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tuner .tn-row {
    display: grid; grid-template-columns: 92px 1fr 52px;
    align-items: center; gap: 10px; margin-bottom: 4px;
}
.tuner .tn-row > span { font-size: 13px; color: #a9b4c0; }
.tuner .tn-row > b {
    font-size: 13.5px; text-align: right; color: #fff;
    font-variant-numeric: tabular-nums;
}
.tuner input[type=range]::-webkit-slider-runnable-track { background: rgba(255, 255, 255, .24); }
.tuner .tn-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.tuner .tn-actions .btn {
    flex: 1 1 auto; background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .2); color: #fff;
}
.tuner .tn-actions .btn:hover { background: rgba(255, 255, 255, .2); border-color: rgba(255, 255, 255, .34); }
.tuner .tn-actions .btn.primary { background: #fff; border-color: #fff; color: #10151b; }
.tuner .tn-actions .btn.primary:hover { background: #dfe6ee; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 48px 16px; color: var(--ink-3); }
.empty .big { font-size: 38px; margin-bottom: 10px; }

.kv { display: grid; grid-template-columns: 128px 1fr; gap: 7px 12px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.kv dd.mono { font-family: var(--mono); font-size: 12.5px; }

.foot { text-align: center; color: var(--ink-3); font-size: 12px; padding: 20px 0 8px; }

.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }
.spacer { height: 10px; }

/* ---------- 手机适配 ---------- */
@media (max-width: 720px) {
    body { font-size: 15px; }
    .wrap { padding: 0 12px 56px; }
    header.top .inner {
        padding: 10px 12px 0; flex-wrap: wrap; row-gap: 8px;
    }
    header.top .brand h1 { font-size: 15px; }
    header.top .brand small { display: none; }
    header.top nav {
        margin-left: 0; width: 100%; gap: 2px; overflow-x: auto;
        padding: 7px 0 9px; -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    header.top nav::-webkit-scrollbar { display: none; }
    header.top nav a { padding: 6px 11px; font-size: 13.5px; flex: none; }
    .card { padding: 16px; border-radius: 12px; }
    .grid3 { grid-template-columns: 1fr; gap: 12px; }
    .metrics { grid-template-columns: 1fr; gap: 10px; }
    .metric { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; }
    .metric .k { margin-bottom: 0; }
    .metric .wrapv { text-align: right; }
    .metric .v { font-size: 24px; }
    .kv { grid-template-columns: 108px 1fr; }
    .dropzone { padding: 26px 14px; }
    .btn-row .btn { flex: 1 1 auto; }
    h2.page { font-size: 18px; margin-top: 18px; }
    .viewer img { max-height: 60vh; }
    /* 手机端表格改为卡片式 */
    table.tbl.responsive thead { display: none; }
    table.tbl.responsive tr {
        display: block; border: 1px solid var(--line); border-radius: 10px;
        margin-bottom: 10px; padding: 6px 2px; background: #fff;
    }
    table.tbl.responsive td {
        display: flex; justify-content: space-between; gap: 10px;
        border: none; padding: 6px 12px; white-space: normal;
    }
    table.tbl.responsive td::before {
        content: attr(data-l); color: var(--ink-3); font-size: 12px; font-weight: 600;
    }
    table.tbl.responsive td.c-img { padding-top: 2px; }
    /* 实时调参：手机上把数字条压缩成两行，给图留出更多高度 */
    .tuner .tn-head { padding: 8px 10px; gap: 6px 12px; }
    .tuner .tn-stats { font-size: 12px; gap: 4px 12px; }
    .tuner .tn-stats b { font-size: 15px; }
    .tuner .tn-row { grid-template-columns: 78px 1fr 44px; gap: 8px; }
    .tuner .tn-row > span { font-size: 12.5px; }
    .tuner .tn-actions .btn { padding: 10px 12px; font-size: 14px; }
}
