:root { color-scheme: dark; font-family: system-ui, "Segoe UI", "Noto Sans CJK SC", sans-serif; background: #080b12; color: #eef2ff; }
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at top, #17213b, #080b12 45%); min-height: 100vh; }
button, textarea, input, select { font: inherit; }
button { min-height: 38px; border: 1px solid transparent; border-radius: 8px; padding: 0 14px; color: white; cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary, button.active { background: #3d70ff; }
.secondary { background: #20283a; border-color: #35415b; }
.danger { background: #b63a4c; }
header { min-height: 66px; padding: 10px 18px; border-bottom: 1px solid #283149; background: #0c1019e8; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 4; }
header > div { display: grid; gap: 3px; }
header strong { font-size: 18px; }
header span, nav span { color: #95a2ba; font-size: 12px; }
nav { display: flex; align-items: center; gap: 8px; }
main { width: min(1800px, 100%); margin: auto; padding: 14px; }
.layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, .72fr); gap: 14px; }
.screen-card { background: #000; border: 1px solid #303b55; border-radius: 12px; overflow: hidden; min-height: 420px; display: grid; place-items: center; }
.video-stage { position: relative; width: 100%; aspect-ratio: 16/9; line-height: 0; background: #000; }
#screen { display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: contain; }
.video-stage:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto !important; display: grid; place-items: center; background: #000; }
.video-stage:fullscreen #screen { width: 100%; height: 100%; aspect-ratio: auto !important; object-fit: contain; }
body.manual-mode #screen { cursor: crosshair; }
body.manual-mode #screen.relative { cursor: none; }
body.manual-controlling header { box-shadow: inset 0 -2px #3d70ff; }
#screenOverlay { position: absolute; z-index: 3; inset: 0; display: grid; place-items: center; color: #b7c2d8; background: #0009; pointer-events: none; line-height: normal; }
.person-box { position: absolute; z-index: 2; border: 3px solid #39ff74; border-radius: 5px; box-shadow: 0 0 0 1px #061b0d, 0 0 14px #39ff7477; pointer-events: none; transition: left .12s linear, top .12s linear, width .12s linear, height .12s linear; }
.person-box span { position: absolute; left: -3px; top: -27px; min-height: 24px; padding: 2px 7px; border-radius: 4px 4px 4px 0; background: #39ff74; color: #041108; font: 700 12px/20px ui-monospace, Consolas, monospace; white-space: nowrap; }
aside, .events-card { border: 1px solid #2b354d; border-radius: 12px; padding: 14px; background: #111722dd; }
.settings-card { margin-top: 12px; border: 1px solid #2b354d; border-radius: 12px; padding: 16px; background: #111722ee; }
.settings-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.settings-heading small { color: #8f9bb1; }
.settings-grid { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; margin-bottom: 14px; }
fieldset { min-width: 0; margin: 0; padding: 12px; border: 1px solid #35425e; border-radius: 9px; }
legend { padding: 0 6px; color: #a9c2ff; }
fieldset label { display: grid; gap: 4px; margin: 8px 0; color: #9eabc1; font-size: 12px; }
h2 { margin: 0 0 10px; font-size: 16px; }
h3 { margin: 0 0 8px; font-size: 14px; }
textarea, input { width: 100%; border: 1px solid #35425e; border-radius: 8px; padding: 10px; color: white; background: #0b101a; }
select { width: 100%; min-height: 38px; border: 1px solid #35425e; border-radius: 8px; padding: 6px 9px; color: white; background: #0b101a; }
textarea { min-height: 145px; resize: vertical; line-height: 1.5; }
textarea.small { min-height: 82px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.toggle { display: flex; align-items: center; gap: 8px; padding: 10px 0 14px; color: #b0bbcf; }
.toggle input { width: auto; accent-color: #3d70ff; }
.toggle.compact { padding-top: 0; padding-bottom: 4px; }
.follow-status { display: block; min-height: 18px; margin-top: -9px; color: #65e792; }
.follow-help { margin: 5px 0 12px; color: #8f9bb1; font-size: 12px; line-height: 1.55; }
.ai-mouse-note { margin: -6px 0 12px; color: #7fa8ff; font-size: 12px; line-height: 1.5; }
.manual-status { display: block; margin: 4px 0 10px; color: #7fa8ff; line-height: 1.5; }
.field-label { display: grid; gap: 6px; color: #aeb8ca; font-size: 13px; }
.macro-actions button { flex: 1 1 120px; }
.common-controls { margin-top: 14px; padding-top: 10px; border-top: 1px solid #2b354d; }
.admin-menu { margin-top: 12px; padding: 10px; border: 1px solid #35425e; border-radius: 9px; color: #9eabc1; }
.admin-menu > summary, .power-menu > summary { cursor: pointer; color: #d5dded; font-weight: 650; }
.admin-menu p { margin: 8px 0; font-size: 12px; line-height: 1.5; }
.power-menu { margin-top: 10px; padding: 8px; border: 1px solid #5a3440; border-radius: 8px; }
#kvmAdminStatus { display: block; margin-top: 6px; color: #7fa8ff; }
.notice { margin: 4px 0 12px; padding: 10px 12px; border: 1px solid #a7505c; border-radius: 8px; background: #341820; color: #ffd9df; font-size: 13px; line-height: 1.5; }
.notice.success { border-color: #347652; background: #10271b; color: #b8f5ce; }
.confirmation { margin: 8px 0 14px; padding: 12px; border: 1px solid #b65261; border-radius: 9px; background: #391923; }
.confirmation pre { max-height: 150px; overflow: auto; white-space: pre-wrap; font-size: 12px; }
.confirmation input { margin-bottom: 8px; }
.hidden { display: none !important; }
/* 自适应可视化：用户看到画面自己变卡却不知道原因，比画质下降本身更糟，
   所以「变化」要有瞬时高亮 + 常驻箭头 + 归因文案三层可见性。 */
.adaptive-hint { display: block; margin: 6px 0 0; color: #7fa8ff; font-size: 12px; }
.adaptive-hint.paused { color: #ffc46b; }
.adaptive-status { display: block; margin: 6px 0 2px; padding: 7px 9px; border: 1px solid #2b354d; border-radius: 8px; background: #0d131f; color: #b0bbcf; font-size: 12px; line-height: 1.5; cursor: help; }
.adaptive-status.trend-down { border-color: #ff9a5c; color: #ffd7bd; }
.adaptive-status.trend-up { border-color: #4fd08a; color: #c7f4dc; }
.adaptive-status.flash-down { animation: adaptive-flash-down 1.5s ease-out; }
.adaptive-status.flash-up { animation: adaptive-flash-up 1.5s ease-out; }
@keyframes adaptive-flash-down { 0%, 55% { background: #3a2118; } 100% { background: #0d131f; } }
@keyframes adaptive-flash-up { 0%, 55% { background: #12301f; } 100% { background: #0d131f; } }
.adaptive-toast { position: absolute; z-index: 4; top: 10px; right: 10px; max-width: min(92%, 460px); padding: 7px 12px; border: 1px solid #4a5573; border-radius: 8px; background: #0c1019e8; color: #eef2ff; font-size: 13px; font-weight: 700; line-height: 1.4; pointer-events: none; animation: adaptive-toast-in .18s ease-out; }
.adaptive-toast.trend-down { border-color: #ff9a5c; color: #ffd7bd; }
.adaptive-toast.trend-up { border-color: #4fd08a; color: #c7f4dc; }
@keyframes adaptive-toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.freeze-badge { position: absolute; z-index: 4; left: 10px; bottom: 10px; padding: 5px 10px; border: 1px solid #6f79a8; border-radius: 7px; background: #10152099; color: #c8d2ee; font-size: 12px; line-height: normal; pointer-events: none; }
.status-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.status-grid article { min-height: 86px; padding: 12px; border: 1px solid #2b354d; border-radius: 10px; background: #111722cc; display: grid; gap: 4px; }
.status-grid span, .status-grid small { color: #8f9bb1; }
.status-grid small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#events { max-height: 300px; overflow: auto; display: grid; gap: 6px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.event { display: grid; grid-template-columns: 90px 150px 1fr; gap: 8px; padding: 7px; border-bottom: 1px solid #273147; }
.event time { color: #8794aa; }
.event strong { color: #8fb2ff; }
@media (max-width: 1050px) { .layout { grid-template-columns: 1fr; } .status-grid { grid-template-columns: repeat(2, 1fr); } nav span { display: none; } }
@media (max-width: 1200px) { .settings-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); } }
@media (max-width: 600px) { header { align-items: flex-start; gap: 8px; } nav { flex-wrap: wrap; justify-content: flex-end; } .status-grid { grid-template-columns: 1fr; } .screen-card { min-height: 220px; } }
@media (max-width: 650px) { .settings-grid { grid-template-columns: 1fr; } }
