:root {
  --bg-0: #0a0d14;
  --bg-1: #0f131f;
  --bg-2: #161d2b;
  --bg-3: #1e2638;
  --line: #253044;
  --line-hi: #354868;
  --text: #d4dae8;
  --text-dim: #7a8aaa;
  --cyan: #38bdf8;
  --cyan-dim: #0ea5e9;
  --amber: #fbbf24;
  --amber-dim: #d97706;
  --green: #4ade80;
  --green-dim: #16a34a;
  --red: #f87171;
  --red-dim: #dc2626;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
}

/* ===== 顶部系统栏 ===== */
.sysbar {
  height: 32px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  flex-shrink: 0;
}
.sysbar-left { display: flex; align-items: center; gap: 8px; }
.sys-logo {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--cyan);
}
.sys-tag {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.sysbar-right { display: flex; align-items: center; gap: 4px; }
.sys-btn {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-mono);
  border-radius: 3px;
  transition: all 0.2s;
}
.sys-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.sys-btn.active { background: var(--cyan-dim); color: #fff; border-color: var(--cyan); }

/* ===== 主布局 ===== */
.app { display: flex; flex-direction: column; height: 100dvh; }
.main { display: flex; flex: 1; overflow: hidden; }

/* ===== 左面板：参数输入 ===== */
.left-panel {
  flex: 1;
  min-width: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 12px; }
.panel-scroll::-webkit-scrollbar { width: 3px; }
.panel-scroll::-webkit-scrollbar-track { background: transparent; }
.panel-scroll::-webkit-scrollbar-thumb { background: var(--line-hi); }

/* 输入模式切换 Tab */
.tab-container {
  display: flex;
  background: var(--bg-0);
  border: 1px solid var(--line);
  padding: 2px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 4px 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 2px;
}
.tab-btn.active {
  background: var(--bg-3);
  color: var(--cyan);
  font-weight: bold;
}

.sec-title {
  font-size: 13px;
  color: var(--text-dim);
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ===== 行式输入 ===== */
.row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.row-label {
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  min-width: 70px;
  width: auto;
}
.row-input {
  width: 60px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  color: var(--cyan);
  padding: 4px 6px;
  font-family: var(--font-mono);
  font-size: 14px;
  text-align: right;
  border-radius: 3px;
}
.row-input.disabled {
  background: rgba(15, 23, 42, 0.4);
  color: var(--text-dim);
  border-color: var(--line);
  cursor: not-allowed;
}
.row-unit {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  width: 20px;
  text-align: left;
  flex-shrink: 0;
}
.row-input:focus:not(.disabled) { outline: none; border-color: var(--cyan); }

/* 下拉选择框 */
.select-input {
  background: var(--bg-0);
  border: 1px solid var(--line);
  color: var(--cyan);
  padding: 4px 6px;
  font-size: 13px;
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--font-mono);
}
.select-input:focus { outline: none; border-color: var(--cyan); }

/* ===== 滑块 ===== */
.slider-wrap { flex: 1; display: flex; align-items: center; gap: 4px; min-width: 0; }
input[type="range"] {
  -webkit-appearance: none;
  flex: 1;
  height: 15px;
  background: var(--bg-3);
  outline: none;
  min-width: 20px;
  touch-action: pan-y;
  border-radius: 3px;
}
input[type="range"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 2px;
  height: 15px;
  background: var(--cyan);
  cursor: pointer;
  border: none;
}
input[type="range"]::-moz-range-thumb {
  width: 2px;
  height: 15px;
  background: var(--cyan);
  cursor: pointer;
  border: none;
}

/* ===== 发动机行 ===== */
.eng-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 5px;
}
.eng-row .eng-label {
  font-size: 11px;
  color: var(--text-dim);
  width: 28px;
  flex-shrink: 0;
  text-align: right;
}
.eng-row .eng-input {
  width: 60px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  color: var(--cyan);
  padding: 3px 5px;
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: right;
  flex-shrink: 0;
  border-radius: 3px;
}
.eng-unit {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  width: 8px;
  text-align: left;
  flex-shrink: 0;
}
.eng-row .eng-input:focus { outline: none; border-color: var(--cyan); }
.eng-row .eng-del {
  background: transparent;
  border: none;
  color: var(--red-dim);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  width: 20px;
  flex-shrink: 0;
}
.eng-row .eng-del:hover { color: var(--red); }
.eng-add {
  width: 100%;
  background: var(--bg-2);
  border: 1px dashed var(--line-hi);
  color: var(--text-dim);
  padding: 4px;
  font-size: 11px;
  cursor: pointer;
  margin-top: 0px;
  border-radius: 3px;
  transition: all 0.2s;
}
.eng-add:hover { border-color: var(--cyan); color: var(--cyan); }
.eng-stat {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  text-align: right;
  margin-top: 4px;
  padding: 4px 6px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 3px;
}

/* ===== 智能拼配方案展示 ===== */
.blueprint-card {
  background: rgba(15, 23, 42, 0.4);
  border: 1px dashed var(--line-hi);
  border-radius: 4px;
  padding: 8px 10px;
  margin-top: 8px;
  min-height: 150px;
}
.blueprint-card.active {
  border-color: var(--cyan-dim);
}
.blueprint-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: bold;
}
.blueprint-item {
  position: relative;
  overflow: hidden;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  background: rgba(56, 189, 248, 0.04);
  border-left: 3px solid var(--cyan-dim);
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: 2px;
}
.blueprint-item.boost {
  border-left-color: var(--amber-dim);
  background: rgba(251, 191, 36, 0.04);
}
.blueprint-bg {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  z-index: -1;
  background: rgba(56, 189, 248, 0.25);
  transition: width 0.3s ease;
}
.blueprint-item.boost .blueprint-bg {
  background: rgba(251, 191, 36, 0.25);
}
.blueprint-content {
  display: flex;
  justify-content: space-between;
  width: 100%;
  position: relative;
  z-index: 2;
}
.blueprint-empty {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  padding: 4px 0;
}

/* ===== 右面板：数据+可视化+时序 ===== */
.right-panel {
  flex: 1;
  min-width: 260px;
  background: var(--bg-1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 数据卡片网格 */
.data-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  flex-shrink: 0;
}
.data-cell {
  background: var(--bg-1);
  padding: 6px 12px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.data-cell .d-label {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.data-cell .d-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--cyan);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  text-align: right;
}
.data-cell.warn .d-val { color: var(--amber); }
.data-cell.danger .d-val { color: var(--red); }
.data-cell.ok .d-val { color: var(--green); }

/* 底部区域：火箭+阶段+时序 */
.bottom-area {
  flex: 1;
  display: flex;
  overflow: hidden;
  border-top: 1px solid var(--line);
  min-height: 0;
}

/* 火箭图 */
.rocket-viz {
  width: 160px;
  min-width: 140px;
  background: var(--bg-0);
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  flex-shrink: 0;
}
.rocket-svg {
  width: 100%;
  height: 100%;
  max-height: 280px;
}

/* 阶段+时序 */
.phase-timeline {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* 阶段条 */
.phase-bar {
  height: auto;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-shrink: 0;
}
.phase-block {
  flex: 1;
  border-right: 1px solid var(--line);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.phase-block:last-child { border-right: none; }
.phase-block .phase-label {
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.phase-block .phase-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--cyan);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.phase-block.warn .phase-val { color: var(--amber); }
.phase-block.danger .phase-val { color: var(--red); }
.phase-block.ok .phase-val { color: var(--green); }

/* 时序 */
.timeline-sec {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px;
  min-height: 0;
}
.timeline-sec::-webkit-scrollbar { width: 3px; }
.timeline-sec::-webkit-scrollbar-track { background: transparent; }
.timeline-sec::-webkit-scrollbar-thumb { background: var(--line-hi); }
.timeline-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
.timeline-row:last-child { border-bottom: none; }
.timeline-dot {
  width: 8px;
  height: 8px;
  background: var(--line-hi);
  flex-shrink: 0;
  margin-top: 3px;
}
.timeline-dot.active { background: var(--cyan); }
.timeline-dot.sep { background: var(--amber); }
.timeline-dot.end { background: var(--green); }
.timeline-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
  width: 55px;
  flex-shrink: 0;
}
.timeline-event {
  font-size: 13px;
  color: var(--text);
}
.timeline-detail {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* 燃料条 */
.fuel-bar-sec { padding: 6px 12px; border-top: 1px solid var(--line); flex-shrink: 0; }
.fuel-track {
  height: 18px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  display: flex;
  overflow: hidden;
  border-radius: 3px;
}
.fuel-seg { height: 100%; transition: width 0.3s ease; }
.fuel-seg-core { background: var(--cyan-dim); }
.fuel-seg-boost { background: var(--amber-dim); }
.fuel-seg-dry { background: var(--bg-3); }
.fuel-legend {
  display: flex;
  gap: 12px;
  margin-top: 5px;
  font-size: 11px;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.fuel-legend span { display: flex; align-items: center; gap: 3px; }
.fuel-legend .dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; }

/* ===== 底部状态栏 ===== */
.statusbar {
  height: 22px;
  background: var(--bg-1);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* 分隔线 */
.hr { height: 1px; background: var(--line); margin: 8px 0; }

/* 警告条 */
.alert-strip {
  padding: 5px 8px;
  background: var(--bg-0);
  border-left: 3px solid var(--red);
  color: var(--red);
  font-size: 12px;
  margin-bottom: 4px;
  display: none;
  flex-shrink: 0;
  border-radius: 2px;
}
.alert-strip.show { display: block; }

/* SVG Animated Nozzle Flame styling */
@keyframes pulse-flame {
  0% { transform: scaleY(1); opacity: 0.8; }
  50% { transform: scaleY(1.3); opacity: 1; }
  100% { transform: scaleY(0.95); opacity: 0.8; }
}
.pulsate-flame {
  animation: pulse-flame 0.1s infinite alternate;
  transform-origin: top;
}

/* ===== 大屏优化 ===== */
@media (min-width: 1300px) {
  .left-panel { flex: 1; min-width: 0; }
  .row { margin-bottom: 10px; }
  .row-label { font-size: 16px; min-width: 80px; width: auto; }
  .eng-row .eng-label { font-size: 13px; }
  .sec-title { font-size: 15px; }
  .data-grid { grid-template-columns: repeat(2, 1fr); }
  .data-cell { padding: 12px 16px; }
  .data-cell .d-label { font-size: 16px; }
  .data-cell .d-val { font-size: 18px; }
  .rocket-viz { width: 200px; min-width: 180px; }
  .rocket-svg { max-height: 360px; }
  .fuel-track { height: 20px; }
  .phase-block { padding: 12px 16px; }
  .phase-block .phase-val { font-size: 18px; }
  .timeline-sec { padding: 10px 16px; }
  .timeline-event { font-size: 15px; }
  .timeline-detail { font-size: 12px; }
}

/* ===== 移动端适配 ===== */
@media (max-width: 900px) and (orientation: portrait) {
  .app { height: 100dvh; }
  .main { flex-direction: column; }
  .left-panel {
    width: 100%;
    min-width: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
  }
  .panel-scroll { padding: 4px; overflow-x: hidden; }

  .right-panel {
    width: 100%;
    min-width: auto;
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
  }
  .data-grid { grid-template-columns: repeat(2, 1fr); }
  .fuel-track { height: 10px; }

  .bottom-area {
    flex-direction: row;
    min-height: 0;
  }
  .rocket-viz {
    width: 70px;
    min-width: 60px;
    padding: 2px;
  }
  .rocket-svg { max-height: 100%; max-width: 60px; }
  .phase-bar { flex-direction: column; border-bottom: 1px solid var(--line); }
  .phase-block {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 2px 6px;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-height: 0;
  }
  .phase-block:last-child { border-bottom: none; }
  .phase-block .phase-label { margin-bottom: 0; width: 80px; flex-shrink: 0; }
  .phase-block .phase-val { flex: 1; text-align: right; }

  .timeline-sec { padding: 3px 6px; }
  .timeline-row { padding: 2px 0; gap: 5px; }
  .timeline-time { font-size: 10px; width: 45px; }
  .timeline-event { font-size: 11px; }
  .timeline-detail { font-size: 9px; }

  .sysbar { padding: 0 6px; height: 30px; }
  .sys-logo { font-size: 12px; }
  .sys-btn { padding: 2px 6px; font-size: 11px; }
  .sec-title { font-size: 11px; padding: 3px 0 2px; margin-bottom: 3px; }
  .row { margin-bottom: 5px; }
  .row-label { font-size: 12px; min-width: 60px; width: auto; }
  .row-input { width: 55px; font-size: 12px; padding: 2px 4px; }
  .eng-row .eng-input { width: 45px; font-size: 11px; padding: 2px 3px; }
  .eng-row .eng-label { font-size: 10px; width: 24px; }
  .eng-stat { font-size: 10px; padding: 2px 3px; }
  .fuel-bar-sec { padding: 3px 6px; }
}

/* ===== 手机横屏 ===== */
@media (max-height: 500px) and (orientation: landscape) and (max-width: 1000px) {
  .main { flex-direction: row; }
  .left-panel { flex: 1.2; min-width: 0; border-right: 1px solid var(--line); }
  .right-panel { flex: 1; min-width: 0; }
  .data-cell { padding: 8px 12px; }
  .data-cell .d-label { font-size: 12px; }
  .data-grid { grid-template-columns: repeat(2, 1fr); }
  .rocket-viz { width: 70px; min-width: 60px; padding: 2px; }
  .rocket-svg { max-height: 100px; max-width: 60px; }
  .timeline-sec { padding: 2px 4px; }
  .timeline-row { padding: 1px 0; gap: 4px; }
  .timeline-time { font-size: 9px; width: 40px; }
  .timeline-event { font-size: 10px; }
  .timeline-detail { font-size: 8px; }
  .fuel-track { height: 8px; }
  .fuel-bar-sec { padding: 2px 4px; }
  .sysbar { height: 26px; padding: 0 6px; }
  .sys-logo { font-size: 11px; }
  .sys-btn { padding: 1px 5px; font-size: 10px; }
  .statusbar { height: 18px; font-size: 9px; }
  .row { margin-bottom: 6px; gap: 4px; }
  .row-label { font-size: 11px; min-width: 60px; width: auto; }
  .row-input { width: 45px; font-size: 10px; padding: 1px 3px; }
  .eng-row { margin-bottom: 4px; gap: 3px; }
  .eng-row .eng-input { width: 35px; font-size: 10px; padding: 1px 2px; }
  .eng-row .eng-label { font-size: 10px; }
  .eng-stat { font-size: 9px; padding: 1px 2px; margin-top: 1px; }
  .sec-title { font-size: 11px; padding: 2px 0 1px; margin-bottom: 2px; }
  .panel-scroll { padding: 4px; }
}

@media (max-width: 500px) {
  .data-grid { grid-template-columns: repeat(2, 1fr); }
  .rocket-viz { width: 60px; min-width: 50px; }
  .rocket-svg { max-width: 50px; }
}

::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-hi); }

/* 芯级配置区域背景 */
.core-section {
  background: rgba(56, 189, 248, 0.06);
  margin: 0 -6px;
  padding: 6px;
  border-radius: 4px;
}
/* 助推器配置区域背景 */
.boost-section {
  background: rgba(251, 191, 36, 0.06);
  margin: 0 -6px;
  padding: 6px;
  border-radius: 4px;
}

/* ===== 预设选择器 ===== */
.preset-select {
  background: var(--bg-0);
  border: 1px solid var(--line);
  color: var(--cyan);
  padding: 2px 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  max-width: 130px;
  border-radius: 2px;
}
.preset-select:focus { outline: none; border-color: var(--cyan); }
.preset-select option { background: var(--bg-2); color: var(--text); }

/* ===== 预设管理弹窗 ===== */
.preset-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 10px;
}
.preset-modal-overlay.show { display: flex; }
.preset-modal {
  background: var(--bg-1);
  border: 1px solid var(--line);
  width: 100%; max-width: 520px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  border-radius: 6px;
}
.preset-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  flex-shrink: 0;
}
.preset-modal-title { font-size: 14px; font-weight: 600; color: var(--cyan); }
.preset-modal-close {
  background: transparent; border: none; color: var(--text-dim);
  font-size: 20px; cursor: pointer; line-height: 1;
}
.preset-modal-close:hover { color: var(--red); }
.preset-tabs {
  display: flex; border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.preset-tab {
  flex: 1; text-align: center; padding: 8px;
  font-size: 12px; color: var(--text-dim);
  cursor: pointer; background: var(--bg-0);
  border: none; font-family: var(--font-ui);
}
.preset-tab.active { color: var(--cyan); background: var(--bg-2); border-bottom: 2px solid var(--cyan); }
.preset-body {
  flex: 1; overflow-y: auto; padding: 10px 14px;
}
.preset-item {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 6px; padding: 6px;
  background: var(--bg-0); border: 1px solid var(--line);
  border-radius: 4px;
}
.preset-item input {
  background: var(--bg-1); border: 1px solid var(--line);
  color: var(--cyan); padding: 3px 5px;
  font-family: var(--font-mono); font-size: 12px;
  border-radius: 3px;
}
.preset-item input:focus { outline: none; border-color: var(--cyan); }
.preset-item .p-name { flex: 1; min-width: 0; }
.preset-item .p-num { width: 60px; text-align: right; }
.preset-item .p-del {
  background: transparent; border: none; color: var(--red-dim);
  cursor: pointer; font-size: 14px; padding: 0 4px; flex-shrink: 0;
}
.preset-item .p-del:hover { color: var(--red); }
.preset-add-btn {
  width: 100%; background: var(--bg-2);
  border: 1px dashed var(--line-hi); color: var(--text-dim);
  padding: 8px; font-size: 12px; cursor: pointer; margin-top: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}
.preset-add-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.preset-group-title {
  font-size: 12px; color: var(--text-dim);
  margin: 8px 0 4px; padding-bottom: 2px;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 1300px) {
  .preset-select { font-size: 14px; padding: 3px 8px; max-width: 160px; }
  .preset-modal-title { font-size: 16px; }
  .preset-tab { font-size: 14px; padding: 10px; }
  .preset-item input { font-size: 14px; padding: 4px 6px; }
  .preset-item .p-num { width: 80px; }
  .preset-add-btn { font-size: 14px; padding: 8px; }
}

@media (max-width: 900px) and (orientation: portrait) {
  .preset-select { font-size: 11px; padding: 1px 4px; max-width: 110px; }
  .preset-modal { max-width: 100%; max-height: 90vh; }
  .preset-item { gap: 4px; padding: 4px; }
  .preset-item input { font-size: 11px; padding: 2px 4px; }
  .preset-item .p-num { width: 50px; }
  .preset-tab { font-size: 11px; padding: 6px; }
}
@media (max-height: 500px) and (orientation: landscape) and (max-width: 1000px) {
  .preset-select { font-size: 10px; padding: 1px 3px; max-width: 100px; }
  .preset-modal { max-width: 100%; max-height: 95vh; }
  .preset-item input { font-size: 10px; padding: 1px 3px; }
  .preset-item .p-num { width: 45px; }
}

/* 输入框内小三角 */
.input-wrap { position: relative; display: inline-block; }
.preset-trigger {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8px;
  color: var(--text-dim);
  cursor: pointer;
  z-index: 2;
  user-select: none;
  line-height: 1;
}
.preset-trigger:hover { color: var(--cyan); }

/* 预设下拉菜单 */
.preset-dropdown {
  position: fixed;
  background: var(--bg-2);
  border: 1px solid var(--line-hi);
  border-radius: 4px;
  z-index: 100;
  min-width: 170px;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  display: none;
}
.preset-dropdown-item {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.preset-dropdown-item:last-child { border-bottom: none; }
.preset-dropdown-item:hover { background: var(--bg-3); color: var(--cyan); }

.preset-dropdown-actions {
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 6px;
}
.preset-dropdown-actions button {
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 2px;
}
.preset-dropdown-actions button:hover { border-color: var(--cyan); color: var(--cyan); }

@media (max-width: 900px) and (orientation: portrait) {
  .preset-trigger { font-size: 7px; left: 3px; }
}
@media (max-height: 500px) and (orientation: landscape) and (max-width: 1000px) {
  .preset-trigger { font-size: 6px; left: 2px; }
}

/* ===== 信息提示图标 ===== */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--text-dim);
  font-size: 10px;
  margin-left: 4px;
  cursor: pointer;
  border: 1px solid var(--line);
  flex-shrink: 0;
  line-height: 1;
  vertical-align: middle;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.info-icon:active { background: var(--cyan); color: #fff; border-color: var(--cyan); }

/* 全局提示框 */
.tooltip {
  position: fixed;
  background: var(--bg-2);
  border: 1px solid var(--line-hi);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 2000;
  max-width: 260px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  line-height: 1.4;
}
.tooltip.show { opacity: 1; }

@media (max-width: 900px) and (orientation: portrait) {
  .info-icon { width: 16px; height: 16px; font-size: 11px; margin-left: 3px; }
  .tooltip { font-size: 13px; max-width: 280px; padding: 10px 14px; }
}
@media (max-height: 500px) and (orientation: landscape) and (max-width: 1000px) {
  .info-icon { width: 12px; height: 12px; font-size: 9px; margin-left: 2px; }
  .tooltip { font-size: 11px; max-width: 220px; }
}

/* ===== 更新说明弹窗 ===== */
.changelog-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: none; align-items: center; justify-content: center;
  z-index: 2000; padding: 16px;
  animation: fadeIn 0.2s ease;
}
.changelog-overlay.show { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.changelog-modal {
  background: var(--bg-1);
  border: 1px solid var(--line);
  width: 100%; max-width: 420px;
  max-height: 80vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  border-radius: 6px;
  animation: slideUp 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.changelog-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  flex-shrink: 0;
}
.changelog-title {
  font-size: 15px; font-weight: 700; color: var(--cyan);
  display: flex; align-items: center; gap: 8px;
}
.changelog-badge {
  background: var(--cyan-dim); color: #fff;
  font-size: 11px; padding: 2px 8px;
  border-radius: 10px; font-family: var(--font-mono);
}
.changelog-close {
  background: transparent; border: none; color: var(--text-dim);
  font-size: 20px; cursor: pointer; line-height: 1;
  padding: 0; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; transition: all 0.2s;
}
.changelog-close:hover { background: var(--bg-3); color: var(--red); }

.changelog-body {
  flex: 1; overflow-y: auto; padding: 14px 18px;
  font-size: 13px; line-height: 1.6;
}
.changelog-body::-webkit-scrollbar { width: 3px; }
.changelog-body::-webkit-scrollbar-thumb { background: var(--line-hi); }

.changelog-date {
  font-size: 11px; color: var(--text-dim);
  font-family: var(--font-mono); margin-bottom: 10px;
}

.changelog-section {
  margin-bottom: 12px;
}
.changelog-section-title {
  font-size: 12px; font-weight: 600; color: var(--amber);
  margin-bottom: 6px; display: flex; align-items: center; gap: 4px;
}
.changelog-section-title::before {
  content: ''; display: inline-block; width: 6px; height: 6px;
  background: var(--amber); border-radius: 50%;
}
.changelog-section-title.new::before { background: var(--green); }
.changelog-section-title.fix::before { background: var(--red); }

.changelog-list {
  list-style: none; padding: 0; margin: 0;
}
.changelog-list li {
  padding: 3px 0 3px 16px;
  position: relative; color: var(--text);
  font-size: 12.5px;
}
.changelog-list li::before {
  content: '›'; position: absolute; left: 4px;
  color: var(--cyan); font-weight: bold;
}

.changelog-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  display: flex; gap: 8px; justify-content: flex-end;
  flex-shrink: 0;
}
.changelog-btn {
  padding: 6px 14px; font-size: 12px;
  border-radius: 4px; cursor: pointer;
  font-family: var(--font-ui); transition: all 0.2s;
  border: 1px solid var(--line);
}
.changelog-btn-secondary {
  background: var(--cyan-dim); color: #fff; border-color: var(--cyan-dim);
}
.changelog-btn-secondary:hover { background: var(--cyan); border-color: var(--cyan); }
.changelog-btn-primary {
  background: transparent; color: var(--text-dim);
}
.changelog-btn-primary:hover { border-color: var(--cyan); color: var(--cyan); }

/* ===== 快照管理弹窗 ===== */
.snapshot-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 10px;
}
.snapshot-modal-overlay.show { display: flex; }
.snapshot-modal {
  background: var(--bg-1);
  border: 1px solid var(--line);
  width: 100%; max-width: 480px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  border-radius: 6px;
}
.snapshot-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  flex-shrink: 0;
}
.snapshot-modal-title { font-size: 14px; font-weight: 600; color: var(--cyan); }
.snapshot-modal-close {
  background: transparent; border: none; color: var(--text-dim);
  font-size: 20px; cursor: pointer; line-height: 1;
}
.snapshot-modal-close:hover { color: var(--red); }
.snapshot-body {
  flex: 1; overflow-y: auto; padding: 12px 14px;
}
.snapshot-save-row {
  display: flex; gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.snapshot-name-input {
  flex: 1;
  background: var(--bg-0);
  border: 1px solid var(--line);
  color: var(--cyan);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  border-radius: 4px;
}
.snapshot-name-input:focus { outline: none; border-color: var(--cyan); }
.snapshot-save-btn {
  background: var(--green-dim);
  border: 1px solid var(--green);
  color: #fff;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
  white-space: nowrap;
  font-family: var(--font-ui);
  transition: all 0.2s;
}
.snapshot-save-btn:hover { background: var(--green); }
.snapshot-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.snapshot-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 20px 0;
}
.snapshot-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.snapshot-item:hover {
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.06);
}
.snapshot-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.snapshot-item-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.snapshot-item-meta {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.snapshot-item-load {
  background: var(--cyan-dim);
  border: 1px solid var(--cyan);
  color: #fff;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 3px;
  font-family: var(--font-ui);
  transition: all 0.2s;
  flex-shrink: 0;
}
.snapshot-item-load:hover { background: var(--cyan); }
.snapshot-item-del {
  background: transparent;
  border: none;
  color: var(--red-dim);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  flex-shrink: 0;
  line-height: 1;
}
.snapshot-item-del:hover { color: var(--red); }

@media (min-width: 1300px) {
  .snapshot-modal-title { font-size: 16px; }
  .snapshot-name-input { font-size: 14px; padding: 8px 12px; }
  .snapshot-save-btn { font-size: 13px; padding: 8px 14px; }
  .snapshot-item-name { font-size: 14px; }
  .snapshot-item-meta { font-size: 12px; }
}

@media (max-width: 900px) and (orientation: portrait) {
  .snapshot-modal { max-width: 100%; max-height: 90vh; }
  .snapshot-save-row { flex-direction: column; }
  .snapshot-name-input { width: 100%; }
  .snapshot-save-btn { width: 100%; }
  .snapshot-item { padding: 6px 8px; }
  .snapshot-item-name { font-size: 12px; }
  .snapshot-item-meta { font-size: 10px; }
}

@media (max-height: 500px) and (orientation: landscape) and (max-width: 1000px) {
  .snapshot-modal { max-width: 100%; max-height: 95vh; }
  .snapshot-item { padding: 5px 6px; }
  .snapshot-item-name { font-size: 11px; }
  .snapshot-item-meta { font-size: 9px; }
  .snapshot-save-btn { padding: 4px 8px; font-size: 10px; }
}