/* ============================================================
   青禾墨水屏 · 水墨视觉系统
   ------------------------------------------------------------
   规范文档：docs/ink-visual-spec.md（本文件 token 即规范落地）
   原则：宣纸为底，墨分五色，发丝为线，纯墨无彩。
   ============================================================ */

:root {
  /* 纸（底色，由亮到沉） */
  --paper: #f3f2ed;        /* 宣纸：页面画布 */
  --card: #fbfaf6;         /* 玉版宣：卡片面 */
  --screen: #eae8e0;       /* 屏纸：设备屏底、说明色块 */
  --screen-2: #e3e1d8;     /* 老纸：视觉面板、缩略图底 */
  --screen-3: #d6d4ca;     /* 淡墨纸：晕染、灰阶装饰 */
  --press: #eeede6;        /* 月白：悬停 / 按压 / 次级色块 */

  /* 墨（文字与图形，由浓到淡） */
  --ink: #262520;          /* 浓墨 */
  --ink-2: #4c4a42;        /* 重墨 */
  --muted: #6e6d66;        /* 淡墨 */
  --faint: #8b8a80;        /* 清墨 */

  /* 发丝线 */
  --line: #e2e0d6;
  --line-strong: #c9c7bb;
  --line-heavy: #b5b3a5;

  /* 功能语义（低饱和，仅状态用） */
  --warn: #7a5a1c;
  --warn-soft: #f2edde;
  --warn-line: #cfc0a0;
  --error: #96382c;
  --error-soft: #f1e7e4;
  --error-line: #cbb3ad;

  /* 终端（墨腔） */
  --term-bg: #262624;
  --term-ink: #c9c9bb;
  --term-dim: #74746c;
  --term-info: #e8e8e0;
  --term-error: #e2a49b;

  /* 形状与运动 */
  --radius: 5px;           /* 面板 / 弹窗 */
  --radius-sm: 3px;        /* 按钮 / 输入 / 徽标 / 印章 */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* 字体：宋体标题，黑体正文，等宽数字 */
  --serif: "Songti SC", "STSongti-SC-Regular", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --mono: "SFMono-Regular", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "Helvetica Neue", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.dim { color: var(--muted); }
.hidden { display: none !important; }

.container { max-width: 1160px; margin: 0 auto; padding: 0 48px; }

h1, h2, h3 { line-height: 1.35; margin: 0; letter-spacing: -0.01em; font-weight: 600; font-family: var(--serif); }

a { color: inherit; }

code {
  background: var(--screen);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.08em 0.4em;
  font-family: var(--mono);
  font-size: 0.86em;
}

button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

::selection { background: var(--ink); color: var(--card); }

/* ---------------- 顶栏 ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(241, 241, 239, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 84px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--ink);
}
.brand-mark svg { width: 27px; height: 27px; fill: currentColor; fill-rule: evenodd; }

.brand-text { font-family: var(--serif); font-weight: 600; font-size: 16.5px; white-space: nowrap; letter-spacing: 0.02em; }
.brand-en { font-size: 10px; color: var(--muted); font-weight: 400; margin-left: 6px; letter-spacing: 0.06em; }

.topnav {
  display: flex;
  gap: 24px;
  margin-left: auto;
}

.topnav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  padding: 4px 1px;
  border-bottom: 1px solid transparent;
  transition: color 0.15s;
}

.topnav a:hover { color: var(--ink); border-bottom-color: var(--ink); }

.support-badge {
  font-size: 11px;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.support-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--faint);
  flex: none;
}
.support-ok::before { background: var(--ink); border-color: var(--ink); }
.support-ok { color: var(--ink); }
.support-bad::before { background: transparent; }
.support-bad { color: var(--muted); }

.support-banner {
  background: var(--warn-soft);
  color: var(--warn);
  border-bottom: 1px solid var(--warn-line);
  padding: 10px 24px;
  font-size: 13.5px;
  text-align: center;
}

/* ---------------- Hero ---------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr);
  gap: 72px;
  align-items: stretch;
  padding-top: 80px;
  padding-bottom: 64px;
}

/* 左栏纵向布局：按钮组贴栏底，与右面板底边严格对齐 */
.hero-copy { display: flex; flex-direction: column; align-items: flex-start; }

.hero h1 { font-size: clamp(32px, 4.4vw, 46px); font-weight: 600; letter-spacing: -0.04em; line-height: 1.3; }

.hero-sub {
  color: var(--muted);
  font-size: 15px;
  line-height: 2;
  max-width: 32em;
  margin: 22px 0 0;
}
.hero-sub strong { color: var(--ink); font-weight: 550; }

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: auto; padding-top: 48px; }

/* ---------------- 产品系列选择器 + 页签工具栏 ---------------- */

.browse-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 40px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin-bottom: 30px;
}

.product-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.product-chip {
  appearance: none;
  display: grid;
  gap: 1px;
  justify-items: start;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  cursor: pointer;
  font-family: var(--sans);
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.product-chip:hover { background: var(--press); }
.product-chip.is-active {
  background: var(--ink);
  color: var(--card);
}
.product-chip-name { font-size: 15px; font-weight: 600; color: inherit; letter-spacing: -0.01em; }
.product-chip-sub { font-size: 10px; color: var(--muted); }
.product-chip.is-active .product-chip-sub { color: var(--card); opacity: 0.72; }
.product-chip:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Hero 视觉面板：宣纸 + 晕染 + 浓墨圆 + 点阵 + 竖排题字 + 落款印 */
.hero-art {
  position: relative;
  display: grid;
  place-items: center;
  background: var(--screen-2);
  border-radius: var(--radius);
  min-height: 460px;
  overflow: hidden;
  isolation: isolate;
}
.hero-art::before {
  content: "";
  position: absolute;
  width: 480px;
  height: 480px;
  background: radial-gradient(closest-side, rgba(90, 89, 78, 0.30), rgba(90, 89, 78, 0.13) 52%, transparent 74%);
  top: -120px;
  left: -110px;
  z-index: -1;
}
.hero-art::after {
  content: "";
  position: absolute;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: var(--ink);
  bottom: -70px;
  right: -55px;
  z-index: -1;
}
.hero-art .dot-matrix {
  position: absolute;
  top: 30px;
  left: 34px;
  width: 130px;
  height: 88px;
  background-image: radial-gradient(#6d6c62 0.8px, transparent 0.8px);
  background-size: 7px 7px;
  z-index: -1;
}
.wash-caption {
  position: absolute;
  top: 30px;
  right: 28px;
  writing-mode: vertical-rl;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.42em;
  color: var(--faint);
  z-index: 1;
}
.device-svg {
  width: min(270px, 62vw);
  filter: drop-shadow(0 22px 24px rgba(36, 36, 34, 0.22));
  transform: rotate(-5deg);
  animation: screen-enter 0.5s var(--ease);
}

.empty-card {
  color: var(--muted);
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--line-strong);
  background: transparent;
}

/* ---------------- Tab 页签（固件仓库 / 烧录指南） ---------------- */

.tabs {
  display: flex;
  gap: 28px;
  margin-bottom: 0;
}

.tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 12px 2px 14px;
  cursor: pointer;
  position: relative;
  transition: color 0.15s;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); }
.tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--ink);
}
.tabpanel:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

/* ---------------- 区块 ---------------- */

.section { padding: 64px 48px 44px; }
.section-head { margin-bottom: 32px; }
.section-head h2 { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; }
.section-sub { color: var(--muted); margin: 14px 0 0; display: flex; gap: 16px; flex-wrap: wrap; align-items: center; font-size: 13px; }
#board-name { font-weight: 550; color: var(--ink); }

/* 型号选择 chip（位于产品名右侧） */
.model-picker { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.model-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.model-chip:hover { border-color: var(--ink); color: var(--ink); }
.model-chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--card); }
.model-chip-name { font-weight: 600; }
.model-chip-tag { font-size: 9px; color: var(--muted); letter-spacing: 0.08em; }
.model-chip.is-active .model-chip-tag { color: var(--card); opacity: 0.72; }
.model-chip:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------------- 卡片 ---------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 30px;
}
.card-error { color: var(--error); white-space: pre-wrap; }

.firmware-list { display: flex; flex-direction: column; gap: 24px; margin-bottom: 22px; }

.firmware-card { position: relative; }
.firmware-card.blank-safe {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 0.5px var(--ink);
  padding: 32px;
}

.badge-ribbon {
  position: absolute;
  top: -9px;
  right: 16px;
  background: var(--ink);
  color: var(--card);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  padding: 3px 11px;
  border-radius: 2px;
}

.firmware-head { display: flex; gap: 26px; align-items: center; }

.firmware-thumb {
  flex: none;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  background: var(--screen-2);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.firmware-thumb svg { width: 48px; height: 70px; }

.firmware-title h3 { font-size: 20px; font-weight: 600; }
.firmware-sub { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.badge {
  display: inline-block;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 2px;
  border: none;
  color: var(--ink-2);
  background: var(--press);
  white-space: nowrap;
}
.badge-version { font-family: var(--mono); color: var(--ink); background: var(--screen-2); }
.badge-official { color: var(--ink-2); }
.badge-bundle { color: var(--card); background: var(--ink); }
.badge-single { color: var(--muted); }
.badge-optional { font-size: 10px; margin-left: 6px; color: var(--muted); }

.firmware-meta { color: var(--muted); font-size: 11.5px; margin-top: 18px; }

.firmware-notes {
  margin-top: 18px;
  padding: 20px 24px;
  background: var(--screen);
  border: none;
  border-radius: var(--radius-sm);
}
.firmware-notes-title { font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.firmware-notes ul { margin: 0; padding-left: 1.2em; color: var(--ink-2); font-size: 13.5px; line-height: 1.95; }
.firmware-notes li + li { margin-top: 8px; }

.package-details { margin-top: 18px; }
.package-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  user-select: none;
}
.package-details summary:hover { color: var(--ink); }
.package-details table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 12.5px;
}
.package-details th, .package-details td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.package-details th { color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: 0.06em; }
.package-details .td-desc { color: var(--muted); font-family: var(--sans); }

.firmware-actions { margin-top: 26px; display: flex; gap: 14px; }

/* ---------------- 本地烧录卡 ---------------- */

.local-card { margin-top: 10px; }
.local-head h3 { font-size: 18px; font-weight: 600; }
.local-head .hint { margin: 10px 0 20px; max-width: 46em; }

.local-drop {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  padding: 36px 20px;
  text-align: center;
  color: var(--ink-2);
  font-size: 14px;
  transition: border-color 0.15s, background 0.15s;
}
.local-drop.dragover { border-color: var(--ink); background: var(--press); }
.local-drop.has-file { border-style: solid; border-color: var(--ink); }
.local-drop input[type="file"] { display: none; }

.file-label {
  color: var(--ink);
  font-weight: 550;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.local-info { min-height: 1.4em; font-size: 12.5px; color: var(--ink-2); margin: 12px 0 6px; }
.local-info.warn { color: var(--error); }

.local-row { display: flex; gap: 20px; align-items: end; flex-wrap: wrap; }
.local-addr { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.local-addr input {
  width: 150px;
  height: 52px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
}
.local-addr input:focus { border-color: var(--ink); outline: none; }

/* ---------------- 按钮 ----------------
   BoBoOS 语言：1px 描边、小圆角、墨色实心为主按钮，
   按钮内「标签居左 / 箭头居右」，按下轻微缩放。 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 14px 26px;
  min-height: 52px;
  font-size: 14px;
  font-family: var(--sans);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.16s var(--ease), opacity 0.15s, background 0.15s;
}
.btn:active:not(:disabled) { transform: scale(0.985); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--card);
}

.btn-lg { padding: 16px 28px; min-height: 56px; font-size: 15px; }
.btn-ghost { background: transparent; border-color: var(--line-strong); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink); }

.btn-arrow { display: inline-block; transition: transform 0.2s var(--ease); }
.btn:hover:not(:disabled) .btn-arrow { transform: translateX(3px); }

.icon-btn {
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------------- 指南 / FAQ ---------------- */

.guide-steps {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 36px;
}
.guide-step {
  position: relative;
  padding-top: 22px;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--ink);
  border-radius: 0;
}
.step-no {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 12px;
}
.step-no::before { content: "— "; color: var(--line-heavy); }
.guide-step h3 { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.guide-step p { color: var(--muted); font-size: 13.5px; line-height: 2; margin: 0; }

.callout {
  border: 1px solid var(--line);
  background: var(--screen);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  font-size: 13.5px;
  line-height: 1.95;
  color: var(--ink-2);
}
.callout.warn { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn); }
.callout.error { border-color: var(--error-line); background: var(--error-soft); color: var(--error); }

.faq-list { display: grid; gap: 0; border-top: 1px solid var(--line-strong); }
.faq-item {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 2px 4px;
}
.faq-item summary {
  cursor: pointer;
  font-weight: 550;
  font-size: 15px;
  padding: 20px 0;
  user-select: none;
  list-style: none;
  position: relative;
  padding-right: 30px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
}
.faq-item[open] summary::after { content: "–"; }
.faq-item p { color: var(--muted); font-size: 13.5px; line-height: 2; margin: 0 0 22px; max-width: 46em; }

/* ---------------- 页脚 ---------------- */

.footer { border-top: 1px solid var(--line-strong); margin-top: 64px; padding: 26px 0 34px; color: var(--muted); font-size: 10.5px; letter-spacing: 0.06em; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------------- 烧录弹窗 ---------------- */

.flash-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: min(86vh, 900px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 30px 70px rgba(36, 36, 34, 0.3);
  /* 不设 display：未打开时保持 UA 默认 display:none，避免弹窗内容混入文档流 */
}
.flash-dialog::backdrop { background: rgba(36, 36, 34, 0.42); }
.flash-dialog[open] { display: flex; flex-direction: column; }

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--line);
}
.dialog-head h2 { font-size: 19px; font-weight: 600; }
.dialog-subtitle { margin: 8px 0 0; font-size: 11px; color: var(--muted); }

.dialog-body { padding: 24px 28px 28px; overflow-y: auto; display: grid; gap: 22px; }

.field-label {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
  margin: 0;
}
.field-desc { margin: 6px 0 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.9; }

.row-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  background: var(--press);
}
.row-title { font-weight: 550; margin: 0; font-size: 14px; }
.row-toggle-text .hint { margin: 6px 0 0; }

.hint { color: var(--muted); font-size: 12.5px; line-height: 1.9; margin: 8px 0 0; }

/* 开关（墨色） */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.slider {
  width: 42px;
  height: 22px;
  border-radius: 999px;
  background: var(--screen-3);
  position: relative;
  transition: background 0.18s;
  flex: none;
}
.slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--card);
  transition: transform 0.18s var(--ease);
}
.switch input:checked + .slider { background: var(--ink); }
.switch input:checked + .slider::after { transform: translateX(20px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--ink); outline-offset: 3px; }
.switch-text { font-size: 13px; font-weight: 550; min-width: 3.2em; }

.row-select { display: grid; gap: 8px; justify-items: start; }
select, .row-select input, .local-addr input {
  font-family: var(--mono);
}
select {
  appearance: none;
  padding: 11px 40px 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  min-width: 200px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236e6e69' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
select:focus { border-color: var(--ink); outline: none; }
select:disabled, input:disabled { opacity: 0.5; }
.row-select input {
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  width: 240px;
}
.row-select input:focus { border-color: var(--ink); outline: none; }

/* 折叠面板 */
.fold { border-top: 1px solid var(--line); padding-top: 16px; }
.fold summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 550;
  font-size: 13.5px;
  user-select: none;
  list-style: none;
}
.fold summary:hover { color: var(--ink); }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::before { content: "▸ "; }
.fold[open] summary::before { content: "▾ "; }
.fold-body { padding: 14px 0 4px; display: grid; gap: 14px; }

.howto-steps { margin: 0; padding-left: 1.4em; color: var(--ink-2); font-size: 13.5px; line-height: 2; display: grid; gap: 8px; }

/* 进度（发丝细轨 + 墨色填充） */
.progress-wrap { border-top: 1px solid var(--line); padding-top: 18px; }
.progress-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); margin-bottom: 10px; }
.progress-track {
  height: 3px;
  border-radius: 0;
  background: var(--line);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 0;
  background: var(--ink);
  transition: width 0.2s linear;
}

/* 过程视图切换（进度 / 日志） */
.view-switch { display: inline-flex; gap: 4px; }
.view-btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  padding: 3px 12px;
  border-radius: 2px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.view-btn:hover { color: var(--ink); border-color: var(--ink); }
.view-btn.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--card);
}

/* 文件级进度条目（UI 视图） */
.entries-view {
  margin-top: 14px;
  display: grid;
  gap: 3px;
  max-height: 216px;
  overflow-y: auto;
  padding-right: 2px;
}
.entry-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
}
.entry-row.is-running { background: var(--press); }
.entry-row.is-done { opacity: 0.75; }
.entry-row.is-error { background: var(--error-soft); }

.entry-icon {
  flex: none;
  width: 20px;
  text-align: center;
  font-size: 13px;
  line-height: 20px;
}
.entry-icon.pending { color: var(--line-heavy); }
.entry-icon.done { color: var(--ink); font-weight: 600; }
.entry-icon.error { color: var(--error); font-weight: 600; }
.entry-icon.running {
  color: var(--ink);
  animation: entry-spin 0.9s linear infinite;
}
@keyframes entry-spin { to { transform: rotate(360deg); } }

.entry-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.entry-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  min-width: 0;
}
.entry-name { font-weight: 550; color: var(--ink); white-space: nowrap; flex: none; }
.entry-desc {
  color: var(--muted);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.entry-addr { color: var(--muted); font-size: 11px; flex: none; }
.entry-status { margin-left: auto; color: var(--muted); font-size: 11px; flex: none; }
.entry-row.is-running .entry-status { color: var(--ink); }
.entry-row.is-done .entry-status { color: var(--muted); }
.entry-row.is-error .entry-status { color: var(--error); }

.entry-track {
  height: 3px;
  border-radius: 0;
  background: var(--line);
  overflow: hidden;
}
.entry-bar {
  height: 100%;
  width: 0%;
  border-radius: 0;
  background: var(--ink);
  transition: width 0.15s linear;
}

/* 日志终端（墨腔：暖灰单色，无绿荧光） */
.log {
  background: var(--term-bg);
  color: var(--term-ink);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  height: 200px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}
.log-line { display: block; }
.log-dim { color: var(--term-dim); }
.log-info { color: var(--term-info); }
.log-esptool { color: var(--term-ink); }
.log-error { color: var(--term-error); }

.dialog-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  border-radius: 0 0 var(--radius) var(--radius);
}
.foot-status { display: grid; gap: 2px; font-size: 12px; }
#phase-text { color: var(--ink); font-weight: 550; }
body[data-flash-phase="error"] #phase-text { color: var(--error); }
body[data-flash-phase="done"] #phase-text { color: var(--ink); }

/* ---------------- 动效 ---------------- */

@keyframes screen-enter {
  0% { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0) rotate(-5deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* 产品授权 */
.auth-card { display: grid; gap: 14px; }
.auth-code {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  line-height: 1.7;
  padding: 12px 14px;
}
.auth-code:focus { border-color: var(--ink); outline: none; }
.auth-code::placeholder { color: var(--faint); }
.auth-status { min-height: 1.6em; }
.auth-actions { display: flex; gap: 14px; flex-wrap: wrap; }
#auth-log { height: 180px; }

/* ---------------- 用户模式 / 技术模式 ---------------- */

body[data-mode="user"] #tech-view { display: none; }
body[data-mode="tech"] #user-view { display: none; }
body[data-mode="user"] .topnav a:not(#nav-user-mode) { display: none; }
#nav-user-mode { display: none; }
body[data-mode="tech"] #nav-user-mode { display: inline; }

/* 用户模式视图：大标题 + 两张卡 + 三步说明 */
.user-view { padding: 64px 0 72px; }
.user-head { text-align: center; margin-bottom: 32px; }
.user-head h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 600; letter-spacing: -0.03em; }
.user-sub { color: var(--muted); font-size: 15px; line-height: 1.9; margin: 14px 0 0; }

/* 产品系列 + 型号选择行 */
.user-pickers {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.user-product-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  transition: border-color 0.15s;
}
.user-product-btn:hover { border-color: var(--ink); }
.user-product-chevron { color: var(--muted); font-size: 11px; }
.user-product-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.user-model { display: flex; justify-content: center; gap: 8px; }
.user-model.hidden { display: none; }
.user-model-chip {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 22px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.user-model-chip:hover { border-color: var(--ink); color: var(--ink); }
.user-model-chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--card); }
.user-model-chip:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.user-cards { max-width: 640px; margin: 0 auto; display: grid; gap: 18px; }
.user-card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 26px 28px;
}
.user-card-primary { border-color: var(--ink); box-shadow: inset 0 0 0 0.5px var(--ink); }
.user-card-head { display: flex; align-items: center; gap: 20px; }
.user-card-body { flex: 1; }
.user-card-body h2 { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.user-card-body p { margin: 8px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.9; }
.user-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
}
.user-meta { color: var(--muted); font-size: 11px; }

.user-go {
  appearance: none;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--card);
  border-radius: 999px;
  padding: 13px 30px;
  min-height: 50px;
  font-size: 15px;
  font-family: var(--sans);
  font-weight: 600;
  cursor: pointer;
  flex: none;
  transition: transform 0.16s var(--ease), opacity 0.15s, background 0.15s, color 0.15s;
}
.user-go:hover:not(:disabled) { background: var(--card); color: var(--ink); }
.user-go:active:not(:disabled) { transform: scale(0.98); }
.user-go:disabled { opacity: 0.4; cursor: not-allowed; }
.user-go.is-confirm { animation: confirm-pulse 1.2s ease-in-out infinite; }
@keyframes confirm-pulse {
  50% { opacity: 0.75; }
}

.user-more-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 2px;
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.15s, border-color 0.15s;
}
.user-more-btn:hover { color: var(--ink); border-bottom-color: var(--ink); }

.user-steps {
  display: flex;
  justify-content: center;
  gap: 12px 32px;
  margin-top: 44px;
  flex-wrap: wrap;
}
.user-steps span { color: var(--muted); font-size: 12.5px; }
.user-steps b {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--screen);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  margin-right: 8px;
}

/* 用户模式弹窗：隐藏技术细节，只留进度 */
body[data-flash-simple="1"] .dialog-body > .field-label,
body[data-flash-simple="1"] .dialog-body > .field-desc,
body[data-flash-simple="1"] .row-toggle,
body[data-flash-simple="1"] .row-select,
body[data-flash-simple="1"] .fold,
body[data-flash-simple="1"] .view-switch,
body[data-flash-simple="1"] #entries-view,
body[data-flash-simple="1"] #blank-warning,
body[data-flash-simple="1"] #fw-footer-label { display: none !important; }

/* 产品系列选择弹窗 */
.product-dialog {
  width: min(720px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 30px 70px rgba(38, 37, 32, 0.3);
}
.product-dialog::backdrop { background: rgba(38, 37, 32, 0.42); }
.product-dialog[open] { display: flex; flex-direction: column; }
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 24px 26px 28px;
  overflow-y: auto;
}
.product-option {
  appearance: none;
  display: grid;
  grid-template-columns: 112px 1fr;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line-strong);
  background: var(--card);
  border-radius: var(--radius);
  padding: 0;
  cursor: pointer;
  font-family: var(--sans);
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}
.product-option:hover { border-color: var(--ink); }
.product-option:hover .product-option-media { background: var(--screen-2); }
.product-option.is-current { border-color: var(--ink); box-shadow: inset 0 0 0 0.5px var(--ink); }
.product-option:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.product-option-media {
  width: 100%;
  height: 100%;
  min-height: 128px;
  display: grid;
  place-items: center;
  background: var(--screen);
  overflow: hidden;
  transition: background 0.15s;
}
.product-option-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-option-media svg { width: 96px; height: auto; display: block; }
.product-option-body { padding: 16px 18px; align-self: center; }
.product-option-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.product-option-title h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.pill-current {
  border: 1px solid var(--ink);
  color: var(--ink);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  padding: 2px 9px;
  border-radius: 999px;
}
.product-option-series { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; letter-spacing: 0.06em; }
.product-option-desc {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: var(--ink-2);
  line-height: 1.8;
}
.product-option-note {
  margin: 8px 0 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--faint);
}

@media (max-width: 640px) {
  .product-grid { grid-template-columns: 1fr; }
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 900px) {
  .container { padding: 0 22px; }
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 44px; }
  .hero-art { min-height: 300px; order: -1; }
  .wash-caption { display: none; }
  .device-svg { width: min(200px, 52vw); }
  .topnav { display: none; }
  .support-badge { margin-left: auto; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .guide-steps { grid-template-columns: 1fr; gap: 28px; }
  .row-toggle { flex-direction: column; align-items: stretch; }
  .dialog-foot { flex-direction: column; align-items: stretch; }
  .dialog-foot .btn { justify-content: center; }
  .firmware-head { flex-direction: column; align-items: flex-start; }
  .section { padding: 48px 22px 32px; }
}
