:root {
  --bg: #0f1218; --panel: #171b24; --panel-2: #1e2430; --line: #2a3140; --text: #e8ecf3; --muted: #9aa4b5;
  --accent: #5fd8ff; --accent-2: #7ee07e; --warn: #ffb45f; --bad: #ff5f5f; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif; }
a { color: var(--accent); }
header { display: flex; align-items: center; gap: 16px; padding: 14px 22px; border-bottom: 1px solid var(--line); background: #0c0f14; position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
header h1 { font-size: 18px; margin: 0; letter-spacing: .5px; }
header .sub { color: var(--muted); font-size: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.chip b { color: var(--text); font-weight: 600; }
.chip.ok::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); }
.chip.busy::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.tabs { display: flex; gap: 6px; padding: 14px 22px 0; }
.tab { padding: 10px 18px; border-radius: 10px 10px 0 0; background: var(--panel); border: 1px solid var(--line); border-bottom: none; cursor: pointer; color: var(--muted); font-weight: 600; }
.tab.active { color: var(--text); background: var(--panel-2); border-color: var(--accent); }
.tab small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.page { display: none; padding: 16px 22px 40px; }
.page.active { display: block; }
.subtabs { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.subtabs button { background: transparent; border: none; color: var(--muted); padding: 7px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.subtabs button.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.grid { display: grid; grid-template-columns: minmax(340px, 440px) 1fr; gap: 16px; }
@media (max-width: 1000px) { .grid { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.card h3 { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
label.f { display: block; margin: 10px 0 4px; color: var(--muted); font-size: 12px; }
select, input[type=text], input[type=number], textarea { width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 8px 10px; border-radius: 8px; font: inherit; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
button.primary { width: 100%; margin-top: 12px; padding: 11px; border: none; border-radius: 10px; background: linear-gradient(135deg, #5fd8ff, #7f8cff); color: #0b0e14; font-weight: 700; font-size: 15px; cursor: pointer; }
button.primary:disabled { opacity: .5; cursor: not-allowed; }
button.ghost { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 6px 10px; border-radius: 8px; cursor: pointer; font: inherit; }
button.ghost.on { border-color: var(--accent); color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { background: var(--panel-2); border: none; color: var(--muted); padding: 6px 12px; cursor: pointer; font: inherit; }
.seg button.on { background: #263040; color: var(--text); }
.samples { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.sample { position: relative; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: #000; aspect-ratio: 4/3; }
.sample img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .9; }
.sample.on { border-color: var(--accent); }
.sample span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; padding: 2px 4px; background: rgba(0,0,0,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drop { margin-top: 10px; border: 1px dashed var(--line); border-radius: 10px; padding: 12px; text-align: center; color: var(--muted); cursor: pointer; }
.drop.hover { border-color: var(--accent); color: var(--text); }
.canvas-wrap { position: relative; width: 100%; background: #000; border-radius: 8px; overflow: hidden; }
.canvas-wrap canvas { width: 100%; display: block; cursor: crosshair; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.prompts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.prompts .p { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); }
.prompts .p.neg { border-color: var(--bad); color: var(--bad); }
.prompts .p.pos { border-color: var(--accent-2); color: var(--accent-2); }
.result img, .result video { width: 100%; border-radius: 8px; background: #000; display: block; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.stat .v { font-size: 20px; font-weight: 700; }
.stat .k { font-size: 11px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
.tbl-wrap { max-height: 320px; overflow: auto; }
.progress { height: 10px; background: var(--panel-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.progress > div { height: 100%; background: linear-gradient(90deg, #5fd8ff, #7ee07e); width: 0; transition: width .3s; }
.msg { color: var(--muted); font-size: 12px; margin-top: 6px; }
.err { color: var(--bad); white-space: pre-wrap; }
.info { font-size: 12px; color: var(--muted); }
.info b { color: var(--text); }
.model-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.model-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 12px; }
.model-card h4 { margin: 0 0 6px; font-size: 14px; }
.model-card .tag { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 4px; background: #263040; color: var(--accent); margin-left: 6px; vertical-align: middle; }
.model-card dl { margin: 0; display: grid; grid-template-columns: 70px 1fr; gap: 2px 8px; color: var(--muted); }
.model-card dt { color: var(--muted); }
.model-card dd { margin: 0; color: var(--text); }
.placeholder { color: var(--muted); text-align: center; padding: 60px 10px; border: 1px dashed var(--line); border-radius: 10px; }
.badge { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 4px; background: #263040; color: var(--muted); margin-left: 6px; }
.badge.loaded { color: var(--accent-2); }

.nav a { color: var(--muted); text-decoration: none; margin-right: 14px; font-size: 13px; }
.nav a.on, .nav a:hover { color: var(--accent); }
