:root {
    color-scheme: light;
    --canvas: #f5f6f7;
    --surface: #ffffff;
    --subtle: #f0f2f3;
    --text: #202528;
    --soft: #495258;
    --muted: #667178;
    --border: #dfe4e6;
    --primary: #28689d;
    --primary-fill: #a8d8ff;
    --primary-hover: #c0e3ff;
    --primary-soft: #e8f4ff;
    --on-primary: #163b58;
    --error: #be3547;
    --error-soft: #fff0f2;
    --warning: #916019;
    --warning-soft: #fff5e3;
    --shadow: 0 16px 64px #18232820;
    --radius: 6px;
    --ease: cubic-bezier(.2,.7,.2,1);
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --canvas: #151718;
    --surface: #1c1f21;
    --subtle: #25292b;
    --text: #edf1f2;
    --soft: #bcc4c9;
    --muted: #9ba7ad;
    --border: #343a3e;
    --primary: #9bd2ff;
    --primary-fill: #9bd2ff;
    --primary-hover: #b9e0ff;
    --primary-soft: #233545;
    --on-primary: #163b58;
    --error: #ff91a1;
    --error-soft: #3d252a;
    --warning: #e6bc73;
    --warning-soft: #352e20;
    --shadow: 0 16px 64px #0006;
}
* { box-sizing: border-box; letter-spacing: 0; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
html { min-width: 320px; height: 100%; background: var(--canvas); }
body { margin: 0; height: 100%; color: var(--text); font: 14px/1.6 "Segoe UI", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button, select, summary { cursor: pointer; }
button { color: inherit; transition: background-color 160ms, border-color 160ms, color 160ms, box-shadow 160ms, transform 160ms var(--ease); }
button:disabled { opacity: .42; cursor: not-allowed; }
button, a, input, select, summary, [tabindex] { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--primary); }
button:not(:disabled):active { transform: translateY(1px); }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 28px; font-weight: 650; line-height: 1.35; margin-bottom: 8px; }
h2 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
h3 { font-size: 14px; margin-bottom: 6px; }
p { margin-bottom: 12px; }
svg.lucide { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.7; }
button > svg { width: 17px; height: 17px; flex-shrink: 0; }
.app-shell { height: 100dvh; display: flex; flex-direction: column; max-width: 1920px; margin: auto; }
.topbar { height: 68px; flex: 0 0 68px; padding: 0 28px; display: flex; align-items: center; gap: 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.topbar .terminal-icon { margin-left: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 22px; font-weight: 650; }
.brand img { width: 30px; height: 30px; }
.theme-switch { display: flex; gap: 2px; background: var(--subtle); padding: 3px; border-radius: 7px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; min-height: 34px; padding: 0; flex-shrink: 0; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--muted); }
.icon-button:hover:not(:disabled) { color: var(--text); background: var(--subtle); }
.theme-switch .icon-button { width: 30px; height: 28px; min-height: 28px; }
.theme-switch [aria-pressed="true"] { color: var(--primary); background: var(--surface); box-shadow: 0 1px 4px #0001; }
.mobile-connect { display: none; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.workspace > .sidebar { display: flex; flex-direction: column; min-height: 0; overflow: auto; padding: 28px 18px 16px; border-right: 1px solid var(--border); background: var(--canvas); }
.section-eyebrow { color: var(--muted); font-size: 11px; font-weight: 600; margin-bottom: 14px; }
.workspace > .sidebar > .section-eyebrow { padding-left: 12px; }
.mode-nav { position: relative; isolation: isolate; display: grid; gap: 7px; margin-bottom: 30px; }
.nav-indicator { position: absolute; top: 0; left: 0; z-index: -1; pointer-events: none; background: var(--primary-soft); border-radius: 6px; }
.mode-tab { display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 10px; align-items: center; position: relative; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 12px; color: var(--soft); }
.mode-tab > svg { grid-row: span 2; width: 19px; height: 19px; }
.mode-tab > span { font-size: 13px; font-weight: 600; }
.mode-tab small { font-size: 10px; color: var(--muted); margin-top: 2px; }
.mode-tab::before { content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 3px; border-radius: 2px; background: var(--primary); transform: scaleY(0); transition: transform 220ms var(--ease); }
.mode-tab:hover { background: var(--subtle); }
.mode-tab.active { color: var(--primary); background: var(--primary-soft); }
.mode-nav:has(.nav-indicator) .mode-tab.active { background: transparent; }
.mode-tab.active::before { transform: scaleY(1); }
.connection-panel { border-top: 1px solid var(--border); padding: 23px 8px 0; }
.connection-heading { display: flex; justify-content: space-between; align-items: center; }
.connection-status { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.connection-status strong { font-size: 12px; font-weight: 600; }
.status-dot { width: 7px; height: 7px; display: inline-block; flex-shrink: 0; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px var(--subtle); }
.status-dot.connected { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.muted, .field-hint { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.field-hint { line-height: 1.8; margin: 0; }
#deviceName { min-height: 36px; margin-bottom: 18px; }
.btn-primary, .btn-secondary, .btn-danger { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 14px; border: 1px solid transparent; border-radius: var(--radius); font-size: 12px; font-weight: 600; line-height: 1.5; }
.btn-primary { background: var(--primary-fill); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); box-shadow: 0 3px 12px #73b9ef25; }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--soft); }
.btn-secondary:hover:not(:disabled) { border-color: var(--muted); background: var(--subtle); }
.btn-danger { border-color: var(--error); color: var(--error); background: var(--error-soft); }
.btn-danger:hover:not(:disabled) { box-shadow: 0 0 0 3px var(--error-soft); }
.full { width: 100%; }
.connection-panel > .full + .full { margin-top: 8px; }
.connection-actions { display: flex; justify-content: space-between; gap: 8px; margin: 8px 0 14px; }
.text-button { background: none; border: 0; padding: 6px 0; color: var(--muted); font-size: 11px; }
.text-button:hover:not(:disabled) { color: var(--primary); }
.device-list { display: grid; gap: 7px; margin-bottom: 10px; }
.device-list button { padding: 10px; text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); font-size: 12px; overflow-wrap: anywhere; }
.device-list small { display: block; color: var(--muted); }
#diagnoseBtn { font-size: 11px; margin-bottom: 12px; }
.content { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) 190px 0; background: var(--surface); }
.content { transition: grid-template-rows 320ms var(--ease); }
.content.log-standard { grid-template-rows: minmax(0, 1fr) 190px 0; }
.content.log-expanded { grid-template-rows: minmax(0, 1fr) min(45vh, 420px) 0; }
.content.log-minimized { grid-template-rows: minmax(0, 1fr) 44px 0; }
.page-stack { position: relative; min-height: 0; min-width: 0; }
.tool-pane { height: 100%; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 32px 36px; }
.pane-status { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.pane-status .protocol-tag { margin-top: 0; }
.protocol-tag { display: inline-flex; align-items: center; flex-shrink: 0; font: 10px/1.5 Consolas, "Microsoft YaHei", monospace; padding: 5px 8px; border: 1px solid var(--border); border-radius: 4px; color: var(--soft); background: var(--canvas); margin-top: 5px; }
.operation-panel { margin-bottom: 30px; }
.section-description { font-size: 12px; color: var(--muted); margin-bottom: 20px; }
.info-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; margin: 0 0 14px; }
.info-list > div { display: flex; gap: 16px; align-items: baseline; min-width: 0; padding: 17px 0; border-bottom: 1px solid var(--border); }
.info-list dt { flex: 0 0 100px; color: var(--muted); font-size: 12px; }
.info-list dd { margin: 0; min-width: 0; color: var(--text); font: 13px/1.6 Consolas, "Microsoft YaHei", monospace; overflow-wrap: anywhere; }
.quick-reboot-panel { margin-top: 30px; }
.action-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0 14px; }
.action-grid button { justify-content: flex-start; padding: 16px; }
.action-grid svg { color: var(--primary); }
.operation-form { display: grid; gap: 10px; max-width: 560px; }
.operation-form label, dialog label { display: block; font-size: 12px; color: var(--soft); margin-top: 6px; }
.operation-form button { justify-self: start; margin-top: 8px; }
input, select { width: 100%; min-width: 0; min-height: 40px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: 12px; transition: border-color 160ms, box-shadow 160ms; }
input:hover:not(:disabled), select:hover:not(:disabled) { border-color: var(--muted); }
input:focus, select:focus { border-color: var(--primary); }
input::placeholder { color: var(--muted); }
input:disabled, select:disabled { opacity: .6; }
input[type="file"] { font-size: 11px; padding: 6px; color: var(--muted); }
input[type="file"]::file-selector-button { padding: 6px 10px; margin-right: 10px; border: 0; border-radius: 4px; color: var(--soft); background: var(--subtle); cursor: pointer; }
input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--primary); flex-shrink: 0; }
.notice { padding: 12px 16px; font-size: 12px; line-height: 1.7; border: 1px solid; }
.error { color: var(--error); background: var(--error-soft); border-color: var(--error); }
.warning { color: var(--warning); background: var(--warning-soft); border-color: var(--warning); }
#environment { margin: 0; flex-shrink: 0; font-size: 11px; padding: 7px 28px; border-width: 0 0 1px; }
.diagnostic { margin: 12px 0; padding: 12px; border: 1px solid var(--warning); border-radius: var(--radius); background: var(--warning-soft); font-size: 11px; overflow-wrap: anywhere; }
.diagnostic strong { display: block; margin-bottom: 6px; color: var(--warning); }
.diagnostic ol { margin: 0; padding-left: 18px; color: var(--soft); }
.diagnostic li { margin: 5px 0; }
.file-manager { min-width: 0; outline: 2px solid transparent; outline-offset: 8px; transition: outline-color 180ms, background-color 180ms; }
.file-manager.is-dragging { outline-color: var(--primary); background: var(--primary-soft); }
.files-toolbar, .files-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.files-toolbar { padding: 0 0 14px; border-bottom: 1px solid var(--border); }
.files-toolbar input { flex: 1; width: auto; min-width: 100px; font-family: Consolas, "Microsoft YaHei", monospace; background: var(--canvas); }
.files-toolbar .icon-button { min-height: 40px; width: 40px; height: 40px; }
.files-actions { padding: 16px 0; }
.files-actions > span { margin-left: auto; color: var(--muted); font-size: 11px; }
#filesStatus { margin: 0 0 16px; }
.files-columns, .file-row { display: grid; grid-template-columns: minmax(0, 1fr) 125px 50px; gap: 16px; align-items: center; padding: 13px 12px; border-bottom: 1px solid var(--border); }
.files-columns { background: var(--canvas); border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); }
.files-list { min-height: 210px; max-height: 48vh; overflow: auto; }
.file-row { transition: background-color 150ms; }
.file-row:hover { background: var(--canvas); }
.file-row .file-name { min-width: 0; overflow-wrap: anywhere; text-align: left; font-size: 12px; }
.file-row button.file-name { padding: 4px 0; border: 0; background: none; color: var(--primary); }
.file-row small { font-size: 11px; color: var(--muted); }
.files-drop-hint { padding: 15px 0; border-top: 1px dashed var(--border); color: var(--muted); font-size: 11px; text-align: center; margin: 0; }
.browser-empty { padding: 70px 16px; margin: 0; text-align: center; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.mirror-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.mirror-toolbar > span { font-size: 11px; color: var(--muted); margin-left: auto; }
.mirror-empty { min-height: 260px; display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 8px; background: var(--canvas); }
.mirror-empty > svg { width: 52px; height: 52px; stroke-width: 1; color: var(--primary); margin-bottom: 18px; }
.mirror-empty strong { font-size: 13px; font-weight: 500; color: var(--soft); }
.mirror-empty p { font-size: 11px; margin: 8px 0 0; }
.adb-section:has(.mirror-stage:not([hidden])) .mirror-empty, .adb-section.has-floating-mirror .mirror-empty { display: none; }
#mirrorPane .adb-section { container-type: inline-size; }
.mirror-stage { display: flex; flex-direction: column; width: fit-content; max-width: 100%; margin-inline: auto; gap: 8px; background: #111415; border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.mirror-stage-body { display: flex; align-items: center; justify-content: center; gap: 12px; min-width: 0; }
.mirror-canvas { display: block; flex: 0 0 auto; min-width: 0; width: min(calc(min(56dvh, 650px) * var(--mirror-ratio, .5625)), calc(100cqw - 78px)); height: auto; object-fit: contain; background: #111415; border-radius: 4px; touch-action: none; cursor: pointer; }
.mirror-controls { display: flex; flex-direction: column; flex: 0 0 40px; gap: 6px; justify-content: center; }
.mirror-controls .icon-button { width: 40px; height: 40px; min-height: 40px; padding: 0; color: #e6edf3; background: #20272b; border: 1px solid #354148; }
.mirror-controls .icon-button:hover:not(:disabled) { background: #304450; border-color: #91cfff; }
.mirror-controls svg { width: 18px; height: 18px; }
.mirror-drag-bar { display: none; align-items: center; justify-content: space-between; gap: 10px; color: #fff; font-size: 12px; user-select: none; touch-action: none; cursor: move; }
.mirror-drag-bar > div { display: flex; gap: 4px; }
.mirror-float-exit.icon-button { width: 32px; height: 32px; min-height: 32px; border: 0; background: transparent; color: #cbd5db; padding: 6px; }
.mirror-float-exit.icon-button:hover { background: #293238; }
.mirror-stage.is-floating { position: fixed; z-index: 1000; left: max(8px, calc(100vw - 460px)); top: 80px; width: max-content; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); min-height: 0; overflow: auto; box-shadow: 0 16px 48px #0005; border-color: #354148; }
.mirror-stage.is-floating .mirror-drag-bar { display: flex; }
.mirror-stage.is-floating .mirror-stage-body { width: max-content; max-width: 100%; min-height: 0; gap: 8px; }
.mirror-stage.is-floating .mirror-canvas { width: min(calc(min(68dvh, 560px, calc(100dvh - 90px)) * var(--mirror-ratio, .5625)), calc(100vw - 90px)); height: auto; }
.mirror-stage.is-floating.is-minimized { min-height: 0; width: 88px; height: 44px; padding: 5px 8px; gap: 0; overflow: hidden; }
.mirror-stage.is-floating.is-minimized .mirror-stage-body { display: none; }
#mirrorMinimize .mirror-expand-icon { display: none; }
.mirror-stage.is-minimized #mirrorMinimize svg { display: none; }
.mirror-stage.is-minimized #mirrorMinimize .mirror-expand-icon { display: block; }
.mirror-stage.is-minimized .mirror-drag-bar { height: 32px; gap: 8px; }
.mirror-drag-bar .mirror-title-icon { display: none; }
.mirror-stage.is-minimized .mirror-drag-bar strong { display: flex; align-items: center; justify-content: center; width: 30px; height: 32px; flex-shrink: 0; color: #b9e2ff; }
.mirror-stage.is-minimized .mirror-drag-bar strong > span { display: none; }
.mirror-stage.is-minimized .mirror-title-icon { display: block; width: 18px; height: 18px; }
.mirror-stage.is-minimized #mirrorMinimize { background: #24333c; color: #b9e2ff; border-radius: 4px; }
.mirror-stage.is-minimized #mirrorMinimize:hover { background: #304450; }
.flash-workspace, .flash-main { min-width: 0; }
.flash-card { margin-bottom: 28px; min-width: 0; }
.flash-card-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.flash-card-heading h2 { margin: 0; }
.flash-card-heading > span, .flash-option { color: var(--muted); font-size: 11px; }
.flash-option { display: inline-flex; gap: 8px; align-items: center; }
.flash-table-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.flash-table-tools input { max-width: 280px; background: var(--canvas); }
.flash-table-tools span { margin-left: auto; font-size: 11px; color: var(--muted); }
.partition-scroll { max-height: 440px; min-height: 240px; overflow: auto; border-block: 1px solid var(--border); }
.partition-table { border-collapse: collapse; width: 100%; min-width: 580px; text-align: left; font-size: 12px; }
.partition-table th { position: sticky; top: 0; z-index: 1; background: var(--subtle); color: var(--soft); font-size: 11px; font-weight: 500; white-space: nowrap; }
.partition-table th, .partition-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.partition-table th:first-child { width: 36px; }
.partition-table tr { transition: background-color 160ms; }
.partition-table tr:hover { background: var(--canvas); }
.partition-table tr.is-selected { background: var(--primary-soft); }
.partition-table td small { display: block; color: var(--muted); font-size: 10px; max-width: 190px; overflow-wrap: anywhere; }
.partition-table .partition-protection { color: var(--warning); }
.partition-table td:nth-child(4) { min-width: 150px; }
.partition-table td:last-child { min-width: 82px; }
.partition-table input[type="file"] { min-height: 30px; max-width: 220px; font-size: 10px; padding: 3px; }
.partition-empty { padding: 35px 20px; text-align: center; color: var(--muted); }
.partition-empty > span { display: block; color: var(--primary); margin-bottom: 12px; }
.partition-empty svg { width: 32px; height: 32px; stroke-width: 1.3; }
.partition-empty strong { font-size: 13px; font-weight: 500; color: var(--soft); }
.partition-empty p { max-width: 380px; margin: 8px auto 0; font-size: 11px; }
.flash-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 16px 0; }
.flash-actions button { font-size: 11px; padding: 10px 8px; }
.flash-status { color: var(--soft); font-size: 12px; overflow-wrap: anywhere; }
.result-panel { min-height: 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; background: var(--canvas); }
.result-heading { display: flex; align-items: center; flex: 0 0 44px; gap: 10px; padding: 0 28px; border-bottom: 1px solid var(--border); }
.result-heading > svg { color: var(--muted); width: 15px; }
.result-heading h2 { margin: 0; font-size: 12px; }
.result-heading .icon-button { width: 28px; height: 28px; min-height: 28px; }
#clearLogBtn { margin-left: auto; }
.log-size-indicator { display: inline-flex; align-items: end; gap: 2px; height: 15px; padding: 0 3px; color: var(--primary); opacity: .78; }
.log-size-indicator i { display: block; width: 2px; height: 5px; border-radius: 2px; background: currentColor; transition: height 220ms var(--ease), opacity 220ms var(--ease); }
.log-size-indicator i:nth-child(2) { height: 9px; }
.log-size-indicator i:nth-child(3) { height: 13px; }
.log-size-indicator[data-size="0"] i { opacity: .38; }
.log-size-indicator[data-size="0"] i:first-child { height: 10px; opacity: 1; }
.log-size-indicator[data-size="0"] i:nth-child(2), .log-size-indicator[data-size="0"] i:nth-child(3) { height: 5px; }
.log-size-indicator[data-size="1"] i:nth-child(2) { opacity: 1; }
.log-size-indicator[data-size="2"] i { opacity: 1; }
.task-badge { padding: 2px 7px; border-radius: 4px; background: var(--subtle); color: var(--muted); font-size: 10px; }
.task-badge[data-state="running"], .task-badge[data-state="ok"] { color: var(--primary); background: var(--primary-soft); }
.task-badge[data-state="running"] { animation: status-pulse 1.5s ease-in-out infinite; }
.task-badge[data-state="error"] { color: var(--error); background: var(--error-soft); }
.log-body { overflow: auto; min-height: 0; padding: 12px 28px; }
.task-status { color: var(--muted); font-size: 11px; margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.log-empty { display: flex; align-items: center; gap: 8px; color: var(--muted); margin-top: 12px; }
.log-empty svg { width: 14px; height: 14px; }
.log-empty p { margin: 0; font-size: 11px; }
.log { margin: 0; padding: 0; font: 11px/1.9 Consolas, "Microsoft YaHei", monospace; color: var(--soft); max-height: 240px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.log .error-line { color: var(--error); }
.log .ok-line { color: var(--primary); }
.log > div { animation: log-arrive 180ms var(--ease); }
#logToggle svg { transition: transform 220ms var(--ease); }
#logToggle[aria-expanded="true"] svg { transform: rotate(180deg); }
progress { display: block; width: 100%; height: 5px; margin: 10px 0 5px; accent-color: var(--primary); }
#progressWrap { margin-bottom: 10px; }
dialog { width: min(480px, calc(100vw - 32px)); max-height: 85dvh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); padding: 28px; box-shadow: var(--shadow); }
dialog { opacity: 0; transform: translateY(12px); transition: opacity 200ms var(--ease), transform 200ms var(--ease), display 200ms allow-discrete, overlay 200ms allow-discrete; }
dialog[open] { opacity: 1; transform: translateY(0); }
dialog::backdrop { background: #0b121780; backdrop-filter: blur(5px); opacity: 0; transition: opacity 200ms, display 200ms allow-discrete, overlay 200ms allow-discrete; }
dialog[open]::backdrop { opacity: 1; }
@starting-style {
    dialog[open] { opacity: 0; transform: translateY(12px); }
    dialog[open]::backdrop { opacity: 0; }
}
dialog h2 { font-size: 20px; }
dialog p { font-size: 12px; color: var(--soft); white-space: pre-wrap; overflow-wrap: anywhere; }
dialog pre { padding: 14px; border: 1px solid var(--border); border-radius: 5px; background: var(--canvas); font: 12px/1.8 Consolas, "Microsoft YaHei", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
dialog input { margin-top: 8px; }
.terminal-dialog { width: min(720px, calc(100vw - 32px)); height: min(760px, calc(100vh - 48px)); margin: 24px 28px 24px auto; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: 0 24px 70px rgba(0,0,0,.2); }
.terminal-dialog::backdrop { background: rgba(20,28,38,.34); backdrop-filter: blur(3px); }
.terminal-panel { height: 100%; display: flex; flex-direction: column; padding: 22px; }
.terminal-heading { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.terminal-heading h2 { margin: 3px 0 0; font-size: 18px; }
.terminal-heading-actions { display: flex; align-items: center; gap: 10px; }
.terminal-output { counter-reset: terminal-line; flex: 1; min-height: 0; overflow: auto; margin: 16px 0; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: #101821; color: #d9e5ee; font: 12px/1.65 Consolas, "Cascadia Mono", monospace; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
.terminal-line { min-height: 1.65em; }
.terminal-output { min-width: 0; white-space: normal; overflow-wrap: normal; padding: 0; border: 0; background: #000; color: #e6edf3; color-scheme: dark; overflow: hidden; }
.terminal-output .xterm { height: 100%; padding: 8px; }
/* 保留 xterm 按字符网格计算的字距，避免全局样式导致列错位。 */
.terminal-output .xterm * { letter-spacing: inherit; }
.terminal-line::before { counter-increment: terminal-line; content: counter(terminal-line, decimal-leading-zero) "  "; display: inline-block; min-width: 3.2em; color: #5e7386; user-select: none; }
.terminal-command-line { color: #9dd7ff; }
.terminal-stderr, .terminal-error { color: #ffadad; }
.terminal-muted { color: #8699aa; }
.terminal-command-row { display: flex; align-items: center; gap: 9px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--canvas); padding: 7px 9px; }
.terminal-prompt { color: var(--primary); font: 700 13px Consolas, monospace; }
.terminal-command { flex: 1; min-width: 0; min-height: 24px; outline: 0; color: var(--text); font: 13px/1.8 Consolas, "Cascadia Mono", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal-command:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
@media (max-width: 760px) { .terminal-dialog { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; border: 0; border-radius: 0; } .terminal-panel { padding: 16px; } }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.connection-dialog .connection-panel { border: 0; padding: 0; }
@keyframes log-arrive { from { opacity: 0; } to { opacity: 1; } }
@keyframes status-pulse { 50% { opacity: .6; } }
@media (min-width: 1500px) {
    .tool-pane { padding: 40px 56px; }
    .info-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
    .workspace { grid-template-columns: 210px minmax(0, 1fr); }
    .workspace > .sidebar { padding-inline: 12px; }
    .tool-pane { padding: 26px 24px; }
    .info-list { column-gap: 20px; }
    .info-list dt { flex-basis: 80px; }
    .action-grid, .flash-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .topbar { height: 60px; flex-basis: 60px; padding: 0 16px; gap: 12px; }
    .brand { font-size: 20px; }
    .brand img { width: 26px; height: 26px; }
    .theme-switch { margin-left: auto; }
    .mobile-connect { display: inline-flex; }
    .workspace { display: block; padding-bottom: calc(68px + env(safe-area-inset-bottom)); position: relative; }
    .workspace > .sidebar { display: contents; }
    .workspace > .sidebar > .section-eyebrow, #connectionDock { display: none; }
    .mode-nav { position: absolute; bottom: 0; left: 0; right: 0; height: calc(68px + env(safe-area-inset-bottom)); padding: 7px 10px calc(7px + env(safe-area-inset-bottom)); margin: 0; z-index: 20; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; border-top: 1px solid var(--border); background: var(--surface); }
    .mode-tab { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 4px; text-align: center; border-radius: 6px; }
    .mode-tab > svg { width: 19px; height: 19px; }
    .mode-tab > span { font-size: 10px; }
    .mode-tab small, .mode-tab::before { display: none; }
    .content { height: 100%; grid-template-rows: minmax(0, 1fr) 126px; }
    .content.log-expanded { grid-template-rows: minmax(0, 1fr) min(44dvh, 340px); }
    .content.log-minimized { grid-template-rows: minmax(0, 1fr) 40px; }
    .content.log-standard { grid-template-rows: minmax(0, 1fr) 126px; }
    .tool-pane { padding: 24px 18px; }
    h1 { font-size: 24px; }
    .protocol-tag { max-width: 120px; text-align: right; font-size: 9px; }
    .info-list { grid-template-columns: minmax(0, 1fr); }
    .info-list > div { padding: 14px 0; }
    .info-list dt { flex-basis: 100px; }
    .action-grid { gap: 8px; }
    .action-grid button { padding: 13px; }
    .result-heading { padding: 0 16px; gap: 8px; flex-basis: 40px; }
    .log-body { padding: 8px 16px; }
    .content.log-minimized .log-body { display: none; }
    .log-empty { margin-top: 5px; }
    .task-status { margin-bottom: 4px; }
    .files-columns, .file-row { grid-template-columns: minmax(0, 1fr) 76px 38px; gap: 8px; padding: 12px 4px; }
    .files-actions { gap: 8px; }
    .files-actions > span { width: 100%; margin: 0; }
    .files-actions .btn-primary, .files-actions .btn-secondary { padding: 9px 10px; font-size: 11px; }
    .files-drop-hint { font-size: 10px; }
    .flash-table-tools { flex-wrap: wrap; }
    .flash-table-tools input { max-width: none; }
    .flash-table-tools span { margin: 0; }
    .flash-actions button { font-size: 10px; }
    .connection-dialog { padding: 24px; }
    .connection-dialog .connection-heading { margin-bottom: 10px; }
    .connection-dialog .section-eyebrow { margin: 0; }
    #environment { padding: 6px 16px; font-size: 10px; max-height: 64px; overflow: auto; }
}
@media (max-width: 640px) {
    .mirror-stage { padding: 8px; }
    .mirror-stage-body { flex-direction: column; gap: 8px; }
    #mirrorFloat { display: inline-flex; }
    .mirror-canvas { width: min(calc(min(50dvh, 480px) * var(--mirror-ratio, .5625)), calc(100cqw - 18px)); height: auto; }
    .mirror-controls { width: 100%; flex: 0 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
    .mirror-controls .icon-button { width: 100%; height: 40px; }
    .mirror-stage.is-floating { max-width: calc(100vw - 16px); }
    .mirror-stage.is-floating .mirror-stage-body { width: 100%; }
    .mirror-stage.is-floating .mirror-canvas { width: min(calc(min(48dvh, 420px, calc(100dvh - 136px)) * var(--mirror-ratio, .5625)), 300px, calc(100vw - 34px)); height: auto; }
    .mirror-toolbar > span { width: 100%; }
    dialog { padding: 22px; }
}
@media (max-width: 380px) {
    .topbar { padding-inline: 12px; gap: 8px; }
    .theme-switch .icon-button { width: 27px; }
    .tool-pane { padding-inline: 14px; }
    .protocol-tag { max-width: 94px; white-space: normal; }
    .flash-actions { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
