:root {
  color-scheme: dark;
  --bg: #1b1b1d;
  --panel: #2a2a2d;
  --panel-soft: #242427;
  --panel-dark: #202023;
  --border: #3a3a40;
  --text: #f3f4f7;
  --muted: #b5b7c0;
  --pink: #ea580c;
  --pink-soft: rgba(234, 88, 12, 0.18);
  --green: #31c653;
  --red: #e74c3c;
  --yellow: #f6b43f;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
  --radius: 14px;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(234, 88, 12, 0.08), transparent 22%),
    linear-gradient(180deg, #18181a 0%, #111113 100%);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 16px;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.sticky-top-shell {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: 8px;
  margin: -8px 0 14px;
  background: linear-gradient(180deg, rgba(17, 17, 19, 0.98) 0%, rgba(17, 17, 19, 0.92) 78%, rgba(17, 17, 19, 0) 100%);
  backdrop-filter: blur(10px);
}

.top-panel,
.content-panel,
.log-panel,
.side-panel,
.param-panel,
.flash-panel,
.comment-panel {
  background: linear-gradient(180deg, rgba(48, 48, 52, 0.94), rgba(32, 32, 35, 0.96));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.top-panel,
.content-panel,
.log-panel {
  padding: 14px;
  margin-bottom: 14px;
  overflow: visible;
}

.sticky-top-shell .top-panel {
  margin-bottom: 0;
}

.content-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.window-bar,
.connection-toolbar,
.motor-toolbar,
.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.window-bar {
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.title-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  margin-left: auto;
}

.lang-top-btn {
  align-self: flex-start;
  min-width: auto;
  min-height: auto;
  margin-left: 8px;
  margin-top: 0;
  padding: 0;
  flex: 0 0 auto;
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  border-radius: 0;
}

.lang-top-btn:hover,
.lang-top-btn:focus {
  color: var(--text);
  background: transparent;
  border: none;
  box-shadow: none;
}

.brand-block {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex: 0 0 auto;
}

.brand-block h1 {
  margin: 0;
  max-width: 210px;
  font-size: 38px;
  font-weight: 700;
  line-height: 0.96;
  white-space: normal;
  color: var(--text);
}

.brand-block span {
  display: inline-flex;
  align-items: flex-end;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  padding-bottom: 4px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 260px;
}

.field.narrow {
  min-width: 160px;
}

.compact-field {
  min-width: 220px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

select,
input[type="number"],
input[type="text"],
input[type="file"] {
  width: 100%;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid #4a4a51;
  background: #17171a;
  color: var(--text);
  padding: 8px 12px;
}

.toolbar-buttons,
.action-stack,
.tab-strip,
.motor-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.title-toolbar-buttons {
  flex-wrap: nowrap;
  margin-left: auto;
}

button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: saturate(0.72);
}

button:disabled:hover {
  transform: none;
}

.btn-active {
  /* 仅作为语义标记，当前主要依赖 primary-btn 的显色 */
}

.btn-inactive {
  /* 仅作为语义标记；若未来需要更“暗”的效果可在这里加深背景 */
}

.i18n-btn {
  white-space: nowrap;
}

.btn-w-usb { min-width: 170px; }
.btn-w-conn { min-width: 110px; }
.btn-w-disconn { min-width: 140px; }
.btn-w-check { min-width: 90px; }
.btn-w-action { min-width: 120px; }
.btn-w-reset { min-width: 150px; }
.btn-w-clear { min-width: 110px; }
.btn-w-flash { min-width: 90px; }
.btn-w-preview { min-width: 140px; }
.btn-w-file { min-width: 120px; }

.file-source-buttons {
  width: 100%;
  flex-wrap: nowrap;
}

.file-source-buttons .btn-w-file {
  flex: 1 1 0;
  min-width: 0;
}

.file-display-input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #4a4a51;
  background: #17171a;
  color: var(--text);
  padding: 8px 12px;
  font-family: "Cascadia Mono", Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.primary-btn,
.check-btn {
  color: #fff;
  background: linear-gradient(180deg, #ff9a4d 0%, var(--pink) 100%);
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.24);
}

.ghost-btn,
.tab-btn {
  color: var(--text);
  background: #313138;
  border-color: #4a4a54;
}

.tab-strip {
  margin: 0;
  align-items: center;
}

.tab-btn.active {
  background: linear-gradient(180deg, rgba(234, 88, 12, 0.22), rgba(234, 88, 12, 0.10));
  border-color: rgba(234, 88, 12, 0.55);
}

.top-action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.in-top-panel {
  margin-top: 12px;
  margin-bottom: 0;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}


.top-action-row .tab-strip {
  justify-content: flex-start;
  flex: 0 0 auto;
}

.motor-toolbar {
  margin-bottom: 0;
  justify-content: flex-end;
  flex-wrap: wrap;
  flex: 1 1 auto;
}

.connection-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  user-select: none;
}

.connection-state.connected {
  border-color: rgba(49, 198, 83, 0.35);
  background: rgba(49, 198, 83, 0.12);
  color: #eafff0;
  text-shadow: 0 0 10px rgba(49, 198, 83, 0.25);
}

.connection-state.disconnected {
  opacity: 0.85;
}

.motor-progress {
  width: 160px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  align-self: center;
  flex: 0 0 auto;
}

.motor-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 154, 77, 0.92), rgba(234, 88, 12, 0.88));
  transition: width 0.2s ease;
}

.motor-progress-text {
  min-width: 42px;
  text-align: right;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.motor-progress.idle {
  opacity: 0.55;
}

.motor-progress-text.idle {
  opacity: 0.75;
}

.motor-chip {
  position: relative;
  min-width: 150px;
  padding: 0 18px 0 16px;
  justify-content: space-between;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #33333a;
  border: 1px solid #4a4a54;
  color: #fff;
}

.motor-chip.active {
  border-color: rgba(234, 88, 12, 0.65);
  box-shadow: 0 0 0 1px rgba(234, 88, 12, 0.28) inset;
}

.motor-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7a7a7a;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
  flex: 0 0 auto;
}

.motor-chip .kind {
  color: var(--muted);
  font-size: 12px;
}

.tab-panel {
  display: none;
  height: 100%;
}

.tab-panel.active {
  display: block;
}

.main-grid {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  height: 100%;
  min-height: 0;
}

.flash-grid {
  grid-template-columns: 400px minmax(0, 1fr);
}

.side-column {
  align-self: start;
  height: 100%;
  min-height: 0;
}

.side-panel,
.param-panel,
.flash-panel {
  padding: 12px;
}

.sticky-side-panel {
  position: static;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.param-panel,
.flash-panel {
  height: 100%;
  min-height: 0;
}

/* 参数区：面板自身可滚动 */
.param-panel {
  overflow-y: auto;
  overflow-x: hidden;
}

/* 预览区：避免整个面板滚动导致预览窗口失去“内滚动”能力 */
.flash-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.flash-fixed-top {
  flex: 0 0 auto;
}

.side-group + .side-group {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.group-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}

.esc-info-grid {
  display: grid;
  gap: 8px;
}

.info-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
}

.info-row span {
  color: var(--muted);
  font-size: 13px;
}

.info-row strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-stack {
  flex-direction: column;
}

.params-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  margin-bottom: 14px;
  align-items: stretch;
}

.param-column {
  display: grid;
  gap: 8px;
}

.param-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 220px 48px;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.param-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.param-row-placeholder {
  background: transparent !important;
  border-bottom-color: transparent;
  pointer-events: none;
}

.param-row-placeholder > div {
  min-height: 1px;
}

.param-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  color: #f0f1f6;
}

.param-label-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.param-help {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.72);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.param-help:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.90);
}

.param-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 20, 24, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.param-tooltip-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.param-tooltip-body {
  color: rgba(255, 255, 255, 0.84);
  white-space: pre-wrap;
}

.param-tooltip-body br {
  content: "";
}

.param-unit {
  color: var(--muted);
  font-size: 12px;
}

.editor-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.editor-wrap select,
.editor-wrap input[type="number"] {
  min-width: 0;
  font-size: 14px;
}

.editor-wrap select option {
  font-size: 14px;
}

.range-editor input[type="range"] {
  width: 100%;
  accent-color: var(--pink);
}

.range-editor input[type="number"] {
  width: 84px;
  flex: 0 0 84px;
}

.comment-panel {
  padding: 12px;
  min-height: 152px;
}

.embedded-log-panel {
  margin-top: 12px;
  padding: 12px;
  position: relative;
}

.log-jump-latest {
  position: absolute;
  right: 16px;
  bottom: 18px;
  z-index: 3;
  min-height: 28px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(234, 88, 12, 0.32);
  background: rgba(234, 88, 12, 0.18);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}

.log-jump-latest:hover {
  background: rgba(234, 88, 12, 0.26);
  border-color: rgba(234, 88, 12, 0.38);
}

.comment-body {
  color: var(--muted);
  line-height: 1.75;
  white-space: pre-wrap;
}

.flash-header {
  margin-bottom: 12px;
}

.flash-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.flash-fixed-top {
  flex: 0 0 auto;
}

.flash-meta-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.flash-meta-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 10px 12px;
}

.flash-meta-chip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.flash-meta-input {
  width: 100%;
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 15, 17, 0.6);
  color: var(--text);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
}

.flash-meta-input.invalid {
  border-color: rgba(231, 76, 60, 0.55);
  box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.14);
}

.flash-meta-chip-actions .flash-meta-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.small-btn {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.full-width-btn {
  width: 100%;
  min-height: 42px;
}

.progress-wrap {
  margin-bottom: 12px;
}

.progress-pill {
  height: 14px;
  border-radius: 999px;
  background: #44444a;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff9a4d 0%, var(--pink) 60%, #ffb36b 100%);
  transition: width 0.22s ease;
}

.progress-texts {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
}

.hex-preview {
  /* 预览窗口保持在面板内部滚动：不要因内容变多而撑大窗口 */
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  border-radius: 12px;
  background: #151517;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: auto;
}

.hex-table-shell {
  min-width: 980px;
}

.hex-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
}

.hex-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #2f2f33;
  color: #f3f4f7;
  font-weight: 700;
}

.hex-table th,
.hex-table td {
  padding: 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
  white-space: nowrap;
}

.hex-table tbody tr:nth-child(odd) td {
  background: rgba(255, 255, 255, 0.04);
}

.hex-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

.hex-table td.empty {
  color: rgba(255, 255, 255, 0.18);
}

.hex-table .addr-col,
.hex-table .ascii-col {
  text-align: left;
}

.hex-table .addr-col {
  min-width: 120px;
}

.hex-table .ascii-col {
  min-width: 160px;
  letter-spacing: 0.08em;
}

.hex-fallback {
  margin: 0;
  padding: 14px;
  white-space: pre-wrap;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.condition-box {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.condition-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.condition-item .badge {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.condition-item.ok .badge {
  background: rgba(49, 198, 83, 0.16);
  color: var(--green);
}

.condition-item.bad .badge {
  background: rgba(231, 76, 60, 0.16);
  color: var(--red);
}

.log-list {
  min-height: 180px;
  max-height: 320px;
  overflow: auto;
  display: grid;
  gap: 3px;
}

.log-entry,
.log-head {
  display: grid;
  grid-template-columns: 44px 76px 58px max-content;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.25;
  /* 允许横向滚动查看完整信息 */
  min-width: max-content;
}

.log-head {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(8px);
}

.log-entry {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.log-entry:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.log-entry > span:last-child {
  white-space: nowrap;
}

.log-dir {
  color: #ffb36b;
}

.log-time {
  color: var(--muted);
}

.empty-tip {
  color: var(--muted);
  padding: 10px 8px;
}

/* -------- 网络固件选择框 -------- */
.hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-panel {
  width: min(860px, calc(100vw - 36px));
  max-height: min(680px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
  font-size: 14px;
  background: linear-gradient(180deg, rgba(48, 48, 52, 0.96), rgba(32, 32, 35, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-footer {
  border-bottom: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  justify-content: flex-end;
}

.modal-body {
  padding: 12px 14px;
  overflow: auto;
}

.modal-hint {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 10px;
}

.firmware-net-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: -2px 0 10px;
  font-size: 13px;
  color: var(--muted);
}

.firmware-net-sep {
  color: rgba(255, 255, 255, 0.16);
}

.firmware-net-crumb {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  user-select: none;
}

.firmware-net-crumb:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.26);
}

.firmware-net-crumb.current {
  cursor: default;
  opacity: 0.92;
}

.firmware-net-list {
  display: grid;
  gap: 6px;
}

.firmware-net-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.22);
  cursor: pointer;
  user-select: none;
}

.firmware-net-item.dir .firmware-net-name {
  color: #ffb36b;
}

.firmware-net-item:hover {
  background: rgba(0, 0, 0, 0.30);
  border-color: rgba(255, 255, 255, 0.10);
}

.firmware-net-item.selected {
  border-color: rgba(234, 88, 12, 0.45);
  box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.18) inset;
}

.firmware-net-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.firmware-net-meta {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.firmware-net-item.dir .firmware-net-name::before,
.firmware-net-item.file .firmware-net-name::before {
  content: "";
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  opacity: 0.95;
  background: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.firmware-net-item.dir .firmware-net-name::before {
  /* folder icon */
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M10 4l2 2h8a2 2 0 0 1 2 2v1H2V6a2 2 0 0 1 2-2h6zm12 7v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-9h20z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M10 4l2 2h8a2 2 0 0 1 2 2v1H2V6a2 2 0 0 1 2-2h6zm12 7v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-9h20z'/></svg>");
}

.firmware-net-item.file .firmware-net-name::before {
  /* file icon */
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M6 2h9l5 5v15a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm8 1.5V8h4.5L14 3.5z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M6 2h9l5 5v15a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm8 1.5V8h4.5L14 3.5z'/></svg>");
}

@media (max-width: 1200px) {
  .content-panel {
    /* 保持“桌面工具”形态：内容区固定在视口内滚动，避免把预览窗口/日志窗口撑大 */
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .main-grid,
  .flash-grid {
    grid-template-columns: 1fr;
    height: 100%;
    min-height: 0;
  }

  .sticky-side-panel {
    position: static;
    height: 100%;
    min-height: 0;
    overflow: auto;
  }

  .side-column,
  .param-panel,
  .flash-panel,
  .tab-panel {
    height: 100%;
    min-height: 0;
  }

  .flash-panel {
    overflow: hidden;
  }

  .status-summary {
    min-width: 0;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 10px;
  }

  .window-bar,
  .title-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .lang-top-btn {
    align-self: stretch;
    margin-left: 0;
    margin-top: 0;
  }

  .flash-meta-row {
    grid-template-columns: 1fr;
  }

  .top-action-row {
    justify-content: stretch;
  }

  .tab-strip,
  .motor-toolbar {
    width: 100%;
    justify-content: flex-start;
  }

  .title-toolbar-buttons {
    flex-wrap: wrap;
  }

  .log-entry,
  .log-head,
  .param-row {
    grid-template-columns: 1fr;
  }
}
