/* ============================================================================
   合少下载站 — 视觉沿用 wingpinger_web / wingpinger-flasher
   设计 token 来源：wingpinger_web/apps/web/src/app.css
   （ink0..3 + bg；无圆角；像素字体；zoom 200%）
   色板表从 wingpinger-flasher/styles.css 同步拷贝，事实源链 =
   固件 ui_palette.cpp → 主站 app.css → flasher → 本文件；改色/改序先改上游。
   默认 PAPER（浅色）；偏好读共享 cookie（wingpinger_palette / wingpinger_zoom，
   Domain=.wingpinger.com，与主站、刷机台、产测台同步），index.html 内联脚本首帧前应用。
   ============================================================================ */

@font-face {
  font-family: "Fusion Pixel 12px M";
  src: url("fonts/fusion-pixel-12px-monospaced-latin.otf.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Fusion Pixel 12px M";
  src: url("fonts/fusion-pixel-12px-monospaced-zh_hans.otf.woff2") format("woff2");
  unicode-range: U+2E80-9FFF, U+3000-303F, U+FF00-FFEF, U+20000-2FA1F;
  font-display: swap;
}
@font-face {
  font-family: "Fusion Pixel 12px M";
  src: url("fonts/fusion-pixel-12px-monospaced-ja.otf.woff2") format("woff2");
  unicode-range: U+3040-30FF, U+31F0-31FF, U+FF66-FF9F;
  font-display: swap;
}
@font-face {
  font-family: "Px437 IBM EGA 8x14";
  src: url("fonts/Px437_IBM_EGA_8x14.ttf") format("truetype");
  font-display: swap;
}
/* 页尾标专用：寒蝉点阵体 7px 子集（合成少数派 + bilibili）。
   block = 加载前不露回退字形，避免看到系统黑体。 */
@font-face {
  font-family: "Chill Bitmap 7px";
  src: url("fonts/ChillBitmap7x-sm.woff2") format("woff2");
  font-display: block;
  unicode-range: U+0062, U+0069, U+006C, U+5408, U+6210, U+5C11, U+6570, U+6D3E;
}

:root {
  color-scheme: light;
  /* 默认 PAPER（与 [data-palette="paper"] 同值；无 JS / 无 cookie 时的兜底） */
  --ink0: #101008;
  --ink1: #393831;
  --ink2: #8c867b;
  --ink3: #cec7bd;
  --bg: #f7f3ef;

  --fg: var(--ink1);
  --fg-bright: var(--ink0);
  --frame: var(--ink2);
  --disabled: var(--ink3);

  --font-pixel: "Fusion Pixel 12px M", "Px437 IBM EGA 8x14", ui-monospace, monospace;
  --maxw: 52rem;
  --line-h: 1.5;
  --pad: 0.75rem;
  --touch: 36px;
}

/* ── 色板（与主站 app.css 同步拷贝；事实源固件 ui_palette.cpp，改色先改固件）── */

/* 固件深色预设段 17 套（与 kPalettePresets 0..16 顺序/色值一致） */
[data-palette="mono"] {
  --ink0: #ffffff; --ink1: #adaaad; --ink2: #525552; --ink3: #000000; --bg: #181c18;
}
[data-palette="warm"] {
  --ink0: #ffdbb5; --ink1: #d69600; --ink2: #844d00; --ink3: #422400; --bg: #211000;
}
[data-palette="dmg"] {
  --ink0: #9cbe08; --ink1: #8cae08; --ink2: #316131; --ink3: #083808; --bg: #001000;
}
/* NIGHTFLY：用户给定 hex 原值（截断量化到固件同款 RGB565） */
[data-palette="nightfly"] {
  --ink0: #60b000; --ink1: #005c98; --ink2: #282c28; --ink3: #101410; --bg: #000400;
}
[data-palette="pipboy"] {
  --ink0: #00ff42; --ink1: #00cf31; --ink2: #008e10; --ink3: #003800; --bg: #080008;
}
[data-palette="virtual"] {
  --ink0: #ff0000; --ink1: #ad0000; --ink2: #520000; --ink3: #290000; --bg: #000000;
}
[data-palette="cga"] {
  --ink0: #ffffff; --ink1: #52ffff; --ink2: #ff55ff; --ink3: #00aaad; --bg: #000000;
}
[data-palette="hotline"] {
  --ink0: #d6ffff; --ink1: #21fff7; --ink2: #f765bd; --ink3: #8c186b; --bg: #180829;
}
[data-palette="celeste"] {
  --ink0: #bdf7ff; --ink1: #b5cbff; --ink2: #523c6b; --ink3: #392863; --bg: #182852;
}
[data-palette="inside"] {
  --ink0: #a5aab5; --ink1: #6b798c; --ink2: #39416b; --ink3: #182031; --bg: #080c10;
}
[data-palette="amber"] {
  --ink0: #ffb200; --ink1: #ce8a00; --ink2: #845500; --ink3: #422800; --bg: #080400;
}
[data-palette="morandi"] {
  --ink0: #efcfd6; --ink1: #b57d84; --ink2: #9c867b; --ink3: #6b658c; --bg: #393442;
}
[data-palette="macaron"] {
  --ink0: #bdebe7; --ink1: #ffefb5; --ink2: #ce9a9c; --ink3: #8c796b; --bg: #292421;
}
[data-palette="sakura"] {
  --ink0: #ffcbbd; --ink1: #8c719c; --ink2: #5a8ead; --ink3: #4a2018; --bg: #212018;
}
[data-palette="vapor"] {
  --ink0: #ff71ce; --ink1: #bd65ff; --ink2: #00cfff; --ink3: #00ffa5; --bg: #310052;
}
[data-palette="nordic"] {
  --ink0: #f7f7ff; --ink1: #adbac6; --ink2: #6b7d8c; --ink3: #293842; --bg: #182029;
}
[data-palette="spring"] {
  --ink0: #ffd700; --ink1: #ce1800; --ink2: #840400; --ink3: #310000; --bg: #180000;
}

/* 网站浅色板（路径 A：追加在固件 17 套之后。ink0=最深=反显填充） */
[data-palette="paper"] {
  --ink0: #101008; --ink1: #393831; --ink2: #8c867b; --ink3: #cec7bd; --bg: #f7f3ef;
}
[data-palette="lcd"] {
  --ink0: #083808; --ink1: #214121; --ink2: #5a7931; --ink3: #adba7b; --bg: #cedf9c;
}
[data-palette="manila"] {
  --ink0: #291808; --ink1: #5a3810; --ink2: #a57939; --ink3: #d6c794; --bg: #f7e7c6;
}
[data-palette="washi"] {
  --ink0: #291418; --ink1: #5a384a; --ink2: #c68294; --ink3: #e7cbc6; --bg: #fff3ef;
}
[data-palette="snow"] {
  --ink0: #212c31; --ink1: #212c31; --ink2: #63717b; --ink3: #bdc3ce; --bg: #efeff7;
}
[data-palette="mint"] {
  --ink0: #082418; --ink1: #186139; --ink2: #398a5a; --ink3: #b5dbc6; --bg: #effbef;
}

html[data-scheme="light"] {
  color-scheme: light;
}
html[data-scheme="dark"] {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  border-radius: 0; /* 硬件无圆角 */
}

/* 缩放档位（与主站同款）：纯整数 100/200/300%，data-zoom 属性盖过本默认；
   窄竖屏（≤600px + portrait）无 JS 时兜底 100%（JS 里 matchMedia 同款重算）。 */
html {
  zoom: 2;
}
@media (orientation: portrait) and (max-width: 600px) {
  html {
    zoom: 1;
  }
}
html[data-zoom="100"] { zoom: 1; }
html[data-zoom="200"] { zoom: 2; }
html[data-zoom="300"] { zoom: 3; }
html[data-zoom="200"] body { --maxw: 28rem; }
html[data-zoom="300"] body { --maxw: 18.5rem; }

html {
  line-height: var(--line-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0 auto;
  max-width: var(--maxw);
  padding: var(--pad);
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: none;
  font-smooth: never;
}

::selection {
  background: var(--ink0);
  color: var(--bg);
}

h1, h2, h3 {
  color: var(--fg-bright);
  line-height: 1.3;
  font-weight: normal;
}
h1 { font-size: 1.5em; }
h2 { font-size: 1.17em; }
h3 { font-size: 1em; }

a {
  color: var(--ink0);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover {
  background: var(--ink0);
  color: var(--bg);
  text-decoration: none;
}
a:visited { color: var(--ink1); }
a:visited:hover { background: var(--ink1); color: var(--bg); }

input,
button,
select,
textarea {
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--frame);
  padding: 0.25em 0.6em;
  min-height: var(--touch);
}

/* ── 按键 = 主站 app.css 逐字复用（2026-10-09）──────────────────────
   主站两段合一：全局四态（normal = ink2 框 + ink1 字；hover = ink1 框 + ink0 字；
   pressed/latched = CG_REV 反显；disabled = 全 ink3）+ Pixel 层（2px 粗框 +
   中性叠层斜面：亮上左/暗下右，:active/[aria-pressed] 对调 = 下沉）。
   本站无双模式层，恒为 Pixel，故不加 [data-ui-mode] 门。旧「产线触控大按钮」
   几何（min-height 52 / min-width 12em / bevel 3px）随逐字复用撤销——如需
   大触点再议。事实源链：主站 apps/web/src/app.css → 本文件，改画法先改主站。 */
button {
  cursor: pointer;
  text-transform: inherit;
  user-select: none;
  border-width: 2px;
  box-shadow:
    inset 2px 2px 0 rgb(255 255 255 / 0.1),
    inset -2px -2px 0 rgb(0 0 0 / 0.35);
}
button:hover {
  border-color: var(--ink1);
  color: var(--ink0);
}
button:active,
button[aria-pressed="true"] {
  background: var(--ink0);
  color: var(--bg);
  border-color: var(--ink0);
  box-shadow:
    inset -2px -2px 0 rgb(255 255 255 / 0.1),
    inset 2px 2px 0 rgb(0 0 0 / 0.35);
}
button:disabled {
  color: var(--disabled);
  border-color: var(--disabled);
  cursor: default;
}
:focus-visible {
  outline: 1px solid var(--ink0);
  outline-offset: 1px;
}

pre, code { font-family: inherit; }
pre {
  border: 1px solid var(--frame);
  padding: 0.5em;
  overflow: auto;
}
:not(pre) > code { color: var(--ink0); }

hr {
  border: none;
  border-top: 1px solid var(--frame);
  margin: 1rem 0;
}

table {
  border-collapse: collapse;
  width: 100%;
}
th, td {
  border: 1px solid var(--frame);
  padding: 0.3em 0.6em;
  text-align: left;
  vertical-align: top;
  overflow-wrap: break-word;
}
th {
  color: var(--ink0);
  font-weight: normal;
  width: 9em;
}

/* ---- 顶栏（web 同款：链接一排、控件二排；语言切换） ---- */
/* ── 顶栏 = 主站 app.css nav.topbar 结构同款（2026-10-10 节奏）────────
   列向 flex + gap 0.6em 分行（主站行距：行盒均回归内容高后按可见墨水量
   行距，行间不再吃 min-height --touch 的居中空边；.topbar-row 折行
   row-gap 同距保持一致）。topbar-break / 首行触摸带 hack 均退役。 */
nav.topbar {
  display: flex;
  flex-direction: column;
  gap: 0.6em;
  border-bottom: 1px solid var(--frame);
  /* 分割线内边距 = 主站同款（body --pad）：外观/语言行与标题的接缝间距 */
  padding-bottom: var(--pad);
  margin-bottom: 1rem;
}
.topbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0;
  row-gap: 0.6em;
}
/* 顶栏 = 密集文字 chrome：按钮不吃全局 --touch 最小高，盒高=内容高，
   与页签 <a> 同节奏（主站 2026-10-10 同款集中声明；.seg 已自带
   min-height: 0，此处兜未来新增顶栏按钮）。 */
nav.topbar button {
  min-height: 0;
}
nav.topbar .brand {
  display: flex;
  align-items: center;
}
nav.topbar .brand a {
  /* 品牌 = 页签一员（主站 2026-09-20）：非激活与页签同档 ink2 */
  color: var(--ink2);
  font-weight: normal;
}
nav.topbar a {
  display: flex;
  align-items: center;
  text-decoration: none;
  padding: 0.3em 0.7em;
  color: var(--ink2);
}
nav.topbar a:hover {
  color: var(--ink0);
  background: none;
}
nav.topbar a[aria-current="page"] {
  background: var(--ink0);
  color: var(--bg);
}
nav.topbar .lang-switch {
  display: flex;
  align-items: center;
  margin-left: 0.4em; /* 与 ▶→A- 的组间分隔同宽 */
}
nav.topbar .lang-switch a {
  padding: 0.3em 0.4em;
}
nav.topbar .lang-switch a[aria-current="page"] {
  background: var(--ink0);
  color: var(--bg);
}

/* ---- 外观控件（与主站 AppearancePanel 同款配方逐字复用） ----
   .seg 只压高度与内边距，框线与 bevel 全由基础 button 规则提供；
   .pal-val/.zoom-val 上下框 2px 与按键对齐（主站 Pixel 层同款）。 */
.appearance {
  display: inline-flex;
  align-items: stretch;
  margin-left: auto; /* 顶栏右贴：外观组在语言切换左侧 */
}
.pal-switch,
.zoom-switch {
  display: inline-flex;
  align-items: stretch;
  margin-left: 0.4em;
}
.seg {
  min-height: 0;
  padding: 0.15em 0.5em;
  font-size: inherit;
}
/* 分段组内相邻按钮去重框线 */
.seg + .pal-val,
.seg + .seg,
.pal-val + .seg,
.seg + .zoom-val,
.zoom-val + .seg {
  border-left-width: 0;
}
.pal-val,
.zoom-val {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.15em 0.5em;
  border: 1px solid var(--frame);
  color: var(--ink1);
  font-variant-numeric: tabular-nums;
  /* Pixel 模式 2px 上下框与按键对齐（主站同款） */
  border-top-width: 2px;
  border-bottom-width: 2px;
}
.pal-val {
  min-width: 8ch;
}
.zoom-val {
  min-width: 4.5ch;
}

/* ---- 页面骨架 ---- */
.hero {
  margin-bottom: 1rem;
}
.hero h1 {
  margin: 0 0 0.4em;
}
.lead {
  margin: 0.2em 0;
  color: var(--fg);
}
.muted {
  color: var(--ink2);
}

.panel {
  border: 1px solid var(--frame);
  padding: 0.8rem;
  margin-bottom: 1rem;
}
.panel h2 {
  margin: 0 0 0.7em;
}

.row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.6rem 0;
}

.device-info {
  font-size: 0.9em;
  color: var(--ink2);
}

.whatsnew {
  margin: 0;
}
.steps {
  margin: 0;
  padding-left: 1.6em;
}
.whatsnew li, .steps li {
  margin: 0.4em 0;
}
.whatsnew h3 {
  margin: 0.7em 0 0.2em;
}
/* changelog 版本折叠：最新默认展开，旧版折叠（V2.1.0 起） */
.changelog-ver {
  margin-bottom: 0.8em;
}
.changelog-ver summary {
  cursor: pointer;
  font-weight: bold;
  margin: 0.4em 0;
}
.changelog-ver ul {
  margin: 0;
  padding-left: 1.6em;
}
.slogan {
  color: var(--ink2);
  margin: -0.3em 0 0.8em;
}

/* ---- 下载卡片 ---- */
.item-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.2em 0.8em;
  margin: 0 0 0.7em;
}
.item-head h2 { margin: 0; }
.item-head .tag { color: var(--ink2); }
.desc { margin: 0 0 0.8em; }

/* 下载链接 = 按钮（复用 button 的 Pixel 画法；<a> 没有 :disabled，故单独写） */
a.btn {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0.25em 0.9em;
  color: var(--fg);
  background: var(--bg);
  border: 2px solid var(--frame);
  text-decoration: none;
  box-shadow:
    inset 2px 2px 0 rgb(255 255 255 / 0.1),
    inset -2px -2px 0 rgb(0 0 0 / 0.35);
}
a.btn:hover {
  border-color: var(--ink1);
  color: var(--ink0);
  background: var(--bg);
}
a.btn:active {
  background: var(--ink0);
  color: var(--bg);
  border-color: var(--ink0);
  box-shadow:
    inset -2px -2px 0 rgb(255 255 255 / 0.1),
    inset 2px 2px 0 rgb(0 0 0 / 0.35);
}
a.btn:visited { color: var(--fg); }
a.btn:visited:hover { color: var(--ink0); background: var(--bg); }

.meta { margin: 0.8em 0 0; }
.older { margin-top: 0.8em; }
.older summary { cursor: pointer; color: var(--ink2); }
.older ul { margin: 0.4em 0 0; padding-left: 1.6em; }
.params th { width: 7em; }

/* ---- 站点页尾标（与 wingpinger_web SiteMark.svelte 对齐） ---- */
/* 14px = 寒蝉 7px 网格 ×2，整数倍才不发虚；zoom 100/200/300 再整体整数放大 */
.site-mark {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5em;
  margin: 2rem auto 0;
  max-width: var(--maxw);
  color: var(--ink2);
  font-family: "Chill Bitmap 7px";
  font-size: 14px;
  line-height: 1;
  font-weight: normal;
  font-style: normal;
  font-synthesis: none;
  -webkit-font-smoothing: none;
  font-smooth: never;
}
.site-mark .logo {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: url("brand/meng-qi-logo.svg") center / contain no-repeat;
  mask: url("brand/meng-qi-logo.svg") center / contain no-repeat;
}
/* 寒蝉字盒几何居中后墨水仍略偏低，上移 1px 光学对齐 logo。不用 transform，免像素字发虚。 */
.site-mark .label {
  position: relative;
  top: -1px;
}
.site-mark .bili {
  margin-inline-start: 0.5em;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.site-mark .bili:visited {
  color: inherit;
}
.site-mark .bili:hover,
.site-mark .bili:visited:hover {
  background: var(--ink0);
  color: var(--bg);
  text-decoration: none;
}

.hidden { display: none; }
