/* ============================================================
   Silvite OS · 「壁炉木屋」设计语言（星露谷物语质感）
   ------------------------------------------------------------
   白昼：羊皮纸 #F6D8A8 + 核桃木框 + 黄铜金/浆果红
   夜晚：深胡桃木 #1E1815 + 陈年米白 + 琥珀灯火（自动昼夜）
   材质：九宫格像素木窗框（--win-frame 运行时生成）+
         纸纹噪点 + 暖棕暗角 + 按键物理压下 + 拟音反馈
   ============================================================ */

:root {
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --serif: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --mono: "JetBrains Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
  --bar-h: 38px;

  --accent: #C84B31;        /* 浆果红 */
  --accent-rgb: 200, 75, 49;
  --accent2: #6B8E55;       /* 苔藓绿 */
  --honey: #F4B41B;         /* 黄铜金 */

  --bg0: #E9C188;           /* 桌面：烤羊皮纸 */
  --bg1: #E0B476;
  --paper: #F6D8A8;         /* 窗口羊皮纸 */
  --paper2: #E8B878;        /* 次级面板 */
  --ink: #3B1D0E;           /* 墨棕 */
  --ink-strong: #2A1408;    /* 烘焙胡桃木 */
  --muted: #8A5F33;
  --line: #d9a55e;
  --line-strong: #5C2E14;   /* 核桃木深边 */
  --wood: #C68540;
  --wood-light: #E8B878;
  --wood-dark: #8A5A2E;
  --shadow: rgba(59, 29, 14, .28);
}

/* 夜灯档：暮色木屋 + 台灯暖光（自动昼夜于 19:00–7:00 启用） */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: linear-gradient(165deg, var(--bg0), var(--bg1) 75%);
  user-select: none;
}

/* 台灯暗角：白天一圈暖棕晕影，夜晚更深并亮起一点琥珀台灯 */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 1100; pointer-events: none;
  background: radial-gradient(120% 95% at 50% 38%, transparent 52%, rgba(59, 29, 14, .22) 100%);
}

/* 纸纹噪点：一层极淡的颗粒，把所有东西统一成「手工纸」 */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 1200;
  pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='260' height='260' filter='url(%23n)'/></svg>");
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; }
::selection { background: rgba(244, 180, 27, .4); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--wood); border: 1px solid var(--wood-dark); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--wood-light); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 通用按键物理：底部硬边 + 按下回弹 ---------- */
.p-bar button, .n-tools button, .n-new, .s-seed, .ct-copy, .ct-vcard,
.me-chip, .pd-btn, .set-danger, .sp .made button, .win-ctl button, #sfxbtn {
  transition: transform .06s ease, box-shadow .06s ease, background .15s, border-color .15s;
}
.p-bar button, .n-tools button, .n-new, .s-seed, .ct-copy, .ct-vcard,
.me-chip, .pd-btn, .set-danger, .sp .made button {
  box-shadow: 0 2.5px 0 var(--wood-dark);
}
.p-bar button:active, .n-tools button:active, .n-new:active, .s-seed:active,
.ct-copy:active, .ct-vcard:active, .me-chip:active, .pd-btn:active,
.set-danger:active, .sp .made button:active {
  transform: translateY(2.5px);
  box-shadow: 0 0 0 var(--wood-dark);
}
.win-ctl button { box-shadow: 0 1.5px 0 var(--wood-dark); }
.win-ctl button:active { transform: translateY(1.5px); box-shadow: 0 0 0 var(--wood-dark); }
.dock-btn:active { transform: translateY(0) scale(.94) !important; }

/* ---------- 开机 ---------- */
#boot {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg0);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 24px; transition: opacity .5s ease;
}
#boot.done { opacity: 0; pointer-events: none; }
.boot-logo {
  font-family: var(--serif); font-size: 26px; letter-spacing: 6px;
  color: var(--ink);
}
.boot-bar {
  width: 210px; height: 10px; overflow: hidden;
  border: 2px solid var(--line-strong);
  background: var(--paper2);
  box-shadow: 0 2.5px 0 var(--wood-dark);
}
.boot-bar i {
  display: block; width: 0; height: 100%;
  background: repeating-linear-gradient(90deg, var(--accent) 0 8px, var(--honey) 8px 16px);
  animation: bootfill 1.15s ease forwards;
}
@keyframes bootfill { to { width: 100%; } }
.boot-tip { font-size: 12.5px; color: var(--muted); letter-spacing: 1px; }

/* ---------- 壁纸 / 桌面 ---------- */
#wallpaper { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 1; }
#desktop { position: fixed; inset: 0; z-index: 2; }

/* ---------- 桌角像素三花猫 & 头顶气泡 ---------- */
#pixelpet {
  position: fixed; left: 14px; bottom: 10px; z-index: 640;
  width: 72px; height: 72px;
  image-rendering: pixelated; cursor: pointer;
}
#pet-bubble {
  position: fixed; left: 16px; bottom: 88px; z-index: 645;
  max-width: 240px; padding: 7px 12px; border-radius: 8px;
  font-size: 12px; line-height: 1.5; color: var(--ink-strong);
  background: var(--paper); border: 2px solid var(--line-strong);
  box-shadow: 0 2.5px 0 var(--wood-dark), 0 8px 18px var(--shadow);
  pointer-events: none; opacity: 0; transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease;
}
#pet-bubble::after {
  content: ""; position: absolute; left: 22px; bottom: -7px;
  width: 10px; height: 10px; transform: rotate(45deg);
  background: var(--paper); border-right: 2px solid var(--line-strong); border-bottom: 2px solid var(--line-strong);
}
#pet-bubble.show { opacity: 1; transform: translateY(0); }

/* ---------- 顶部状态栏：木屋挂钟面板 ---------- */
#statusbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--bar-h); z-index: 500;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; font-size: 12.5px;
  background: var(--paper2);
  border-bottom: 3px solid var(--wood-dark);
  box-shadow: inset 0 -2px 0 var(--wood), inset 0 2px 0 rgba(255, 244, 214, .35);
}
.sb-left, .sb-right { display: flex; align-items: center; gap: 10px; }
.sb-brand {
  font-family: var(--serif); font-size: 14.5px; font-weight: 700;
  letter-spacing: 1px; color: var(--ink);
  padding: 3px 7px; border-radius: 6px;
}
.sb-brand:hover { background: var(--paper); }
.sb-sep { width: 2px; height: 14px; background: var(--wood-dark); border-radius: 2px; }
#fps { font-family: var(--mono); color: var(--muted); min-width: 58px; text-align: right; font-size: 11.5px; }
#sb-hint { color: var(--muted); }
#sfxbtn, #cmdbtn, #deskbtn { font-size: 12.5px; line-height: 1; padding: 4px 7px; border-radius: 6px; }
#sfxbtn:hover, #cmdbtn:hover, #deskbtn:hover { background: var(--paper); }

/* ---------- 桌面快捷图标 ---------- */
#desk-icons {
  position: absolute; inset: 0;
  z-index: 1; pointer-events: none;
}
.desk-icon {
  position: absolute; pointer-events: auto; touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  width: 78px; padding: 8px 6px 7px; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--ink-strong); border: 2px solid transparent;
  transition: transform .12s ease, background .15s, border-color .15s, left .14s ease, top .14s ease;
}
.desk-icon.dragging {
  transition: none; z-index: 20; opacity: .9; transform: scale(1.06); cursor: grabbing;
}
.desk-icon:hover {
  background: color-mix(in srgb, var(--paper) 65%, transparent);
  border-color: color-mix(in srgb, var(--wood-dark) 45%, transparent);
  transform: translateY(-2px);
}
.desk-icon.selected {
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border-color: var(--wood-dark);
  box-shadow: 0 2px 0 var(--wood-dark);
}
.desk-icon .di-ic {
  width: 40px; height: 40px; border-radius: 9px; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); border: 2px solid var(--wood-dark);
  box-shadow: 0 2.5px 0 var(--wood-dark);
}
.desk-icon .di-ic .ic { width: 21px; height: 21px; color: var(--accent); }
.desk-icon .di-ic .ic-img { width: 100%; height: 100%; object-fit: cover; border-radius: 7px; display: block; -webkit-user-drag: none; }
.ic-img { object-fit: cover; border-radius: 5px; display: block; -webkit-user-drag: none; pointer-events: none; }
.dock-btn .ic-img { width: 26px; height: 26px; border-radius: 6px; }
.win-title .ic-img, .ctx-item .ic-img { width: 16px; height: 16px; border-radius: 4px; }
.cmd-item .ic-img { width: 20px; height: 20px; border-radius: 5px; }

/* ---------- MoDi 内嵌窗口 ---------- */
.modi-wrap { height: 100%; display: flex; flex-direction: column; background: var(--paper); }
.modi-bar {
  flex: 0 0 38px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 12px; background: var(--paper2); border-bottom: 2px solid var(--wood-dark);
}
.modi-url { font-family: var(--mono); font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modi-ext {
  font-size: 12px; padding: 4px 10px; border-radius: 6px; text-decoration: none;
  background: var(--paper); border: 1.5px solid var(--wood-dark); color: var(--ink-strong);
  box-shadow: 0 1.5px 0 var(--wood-dark); flex-shrink: 0;
}
.modi-ext:hover { background: color-mix(in srgb, var(--honey) 35%, var(--paper)); }
.modi-frame { flex: 1; width: 100%; border: none; background: #fff; }
.desk-icon .di-lbl {
  pointer-events: none;
  font-size: 11.5px; font-weight: 600; line-height: 1.25;
  padding: 2px 6px; border-radius: 4px;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  text-shadow: 0 1px 0 rgba(255, 248, 232, .8);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 窗口：星露谷对话木框（九宫格 border-image） ---------- */
.win {
  position: absolute; display: flex; flex-direction: column;
  min-width: 300px; min-height: 200px;
  border: 8px solid transparent;
  border-image: var(--win-frame) 8 fill / 8px stretch;
  image-rendering: pixelated;
  box-shadow: 0 4px 8px var(--shadow), 0 16px 36px var(--shadow);
  overflow: visible;
  animation: winIn .18s ease;
}
@keyframes winIn { from { opacity: 0; transform: scale(.96) translateY(6px); } }
.win.closing { opacity: 0; transform: scale(.95); transition: .15s ease; }
.win.minimized { display: none; }
.win.focused { box-shadow: 0 4px 8px var(--shadow), 0 20px 44px var(--shadow); }

.win-bar {
  height: 40px; flex: 0 0 40px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px 0 8px; cursor: grab; touch-action: none;
  margin: 0 4px;
  border-bottom: 2px solid var(--wood-dark);
}
.win-bar:active { cursor: grabbing; }
.win-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink-strong); }
.win-title .ic { width: 16px; height: 16px; color: var(--accent); }
.win-title b { font-weight: 700; }
.win-ctl { display: flex; gap: 6px; }
.win-ctl button {
  width: 21px; height: 21px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--ink);
  background: var(--paper2); border: 1.5px solid var(--wood-dark);
}
.win-ctl button:hover { background: var(--wood-light); }
.win-ctl .w-close:hover { background: var(--accent); color: #fff; }

.win-body {
  flex: 1; position: relative; overflow: hidden;
  background: var(--paper);
  margin: 0 4px 4px;
  border: 2px solid color-mix(in srgb, var(--wood-dark) 55%, transparent);
  border-top: none;
}

.win.maxed {
  top: var(--bar-h) !important; left: 10px !important; right: 10px !important;
  bottom: 84px !important;
  width: auto !important; height: auto !important;
}
.win-grip {
  position: absolute; right: 8px; bottom: 8px; width: 18px; height: 18px;
  cursor: nwse-resize; touch-action: none; z-index: 5;
  background: linear-gradient(135deg, transparent 55%, var(--wood-dark) 55%, var(--wood-dark) 65%, transparent 65%,
              transparent 75%, var(--wood-dark) 75%, var(--wood-dark) 85%, transparent 85%);
}

/* ---------- Dock：木质托盘 ---------- */
#dock {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
  z-index: 600; display: flex; align-items: flex-end; gap: 4px;
  padding: 8px 10px;
  border: 8px solid transparent;
  border-image: var(--win-frame) 8 fill / 8px stretch;
  image-rendering: pixelated;
  box-shadow: 0 6px 10px var(--shadow), 0 14px 30px var(--shadow);
}
.dock-btn {
  position: relative; width: 44px; height: 44px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); transition: transform .16s cubic-bezier(.3, 1.5, .5, 1), background .16s;
}
.dock-btn .ic { width: 22px; height: 22px; }
.dock-btn:hover {
  transform: translateY(-6px) scale(1.1);
  background: color-mix(in srgb, var(--honey) 40%, var(--paper));
}
.dock-btn.running::after {
  content: ""; position: absolute; bottom: 1px; left: 50%; transform: translateX(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  border: 1px solid var(--line-strong);
}
.dock-btn.active {
  background: color-mix(in srgb, var(--honey) 52%, var(--paper));
  box-shadow: inset 0 0 0 1.5px var(--wood-dark);
}
.dock-btn.minimized { opacity: .72; }
.dock-btn.minimized::after { background: var(--honey); }

/* ---------- 快速启动面板 (Ctrl+K) ---------- */
#cmdpalette {
  position: fixed; inset: 0; z-index: 960;
  background: rgba(42, 20, 8, .36);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: min(16vh, 120px);
}
#cmdpalette[hidden] { display: none; }
.cmd-box {
  width: min(440px, calc(100vw - 24px));
  border: 8px solid transparent;
  border-image: var(--win-frame) 8 fill / 8px stretch;
  image-rendering: pixelated;
  box-shadow: 0 14px 36px var(--shadow);
  padding: 6px;
}
.cmd-in {
  width: 100%; padding: 9px 12px; border: 2px solid var(--wood-dark); border-radius: 6px;
  background: #FBF0D2; color: var(--ink-strong); font-size: 13.5px; outline: none;
}
.cmd-list { margin-top: 6px; max-height: 280px; overflow: auto; display: flex; flex-direction: column; gap: 3px; }
.cmd-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 6px; text-align: left;
}
.cmd-item .ic { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.cmd-item span { display: flex; flex-direction: column; min-width: 0; }
.cmd-item b { font-size: 13px; color: var(--ink-strong); }
.cmd-item small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-item:hover, .cmd-item.on { background: color-mix(in srgb, var(--honey) 45%, var(--paper)); }
.cmd-empty { padding: 18px; text-align: center; font-size: 12.5px; color: var(--muted); }

/* ---------- 右键菜单：小木牌 ---------- */
#ctxmenu {
  position: fixed; z-index: 950; min-width: 195px; padding: 6px;
  border: 8px solid transparent;
  border-image: var(--win-frame) 8 fill / 8px stretch;
  image-rendering: pixelated;
  box-shadow: 0 10px 26px var(--shadow);
}
.ctx-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 12px; border-radius: 6px; font-size: 13px; text-align: left;
}
.ctx-item:hover { background: color-mix(in srgb, var(--honey) 45%, var(--paper)); }
.ctx-item .ic { width: 15px; height: 15px; color: var(--accent); }
.ctx-sep { height: 2px; margin: 5px 9px; background: var(--wood); }

/* ---------- 通知：贴在桌边的小纸条 ---------- */
#toasts { position: fixed; right: 16px; bottom: 92px; z-index: 900; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 11px 16px; border-radius: 8px; font-size: 13px; max-width: 330px;
  background: var(--paper);
  border: 2px solid var(--line-strong);
  border-left: 5px solid var(--accent);
  box-shadow: 0 3px 0 var(--wood-dark), 0 10px 24px var(--shadow);
  line-height: 1.6;
  animation: toastIn .25s ease;
}
.toast.out { opacity: 0; transform: translateX(14px); transition: .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }

/* ---------- 桌面碎片手账卡 ---------- */
#fragment-card {
  position: fixed; right: 16px; bottom: 92px; z-index: 880;
  width: min(320px, calc(100vw - 32px));
  padding: 13px 15px 11px; border-radius: 9px; cursor: pointer;
  background: var(--paper); border: 2px solid var(--line-strong);
  border-left: 5px solid var(--honey);
  box-shadow: 0 3px 0 var(--wood-dark), 0 12px 26px var(--shadow);
  animation: toastIn .25s ease;
  transition: opacity .22s ease, transform .22s ease;
}
#fragment-card.out { opacity: 0; transform: translateY(8px); }
.frag-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.frag-tag { font-size: 12px; font-weight: 700; color: var(--accent); }
.frag-close { font-size: 11px; color: var(--muted); padding: 2px 4px; }
.frag-txt { font-size: 13px; line-height: 1.75; color: var(--ink-strong); }
.frag-foot { margin-top: 8px; font-size: 11px; color: var(--muted); opacity: .85; }

/* ============================================================
   终端：老木壳终端机（深胡桃屏 + 琥珀字）
   ============================================================ */
.term {
  height: 100%; display: flex; flex-direction: column; overflow: auto;
  background: #241A12; color: #EFE2CE;
  font-family: var(--mono); font-size: 13px; line-height: 1.6;
  padding: 13px 15px; user-select: text; cursor: text;
}
.t-row { white-space: pre-wrap; word-break: break-all; }
.t-echo { color: #94805E; }
.t-err { color: #E08A6A; }
.t-ok { color: #9EB08A; }
.t-c1 { color: #E8B878; font-weight: 700; }
.t-c2 { color: #9EB08A; font-weight: 700; }
.t-ps { color: #E59A3C; font-weight: 700; margin-right: 8px; }
.t-line { display: flex; align-items: baseline; }
.t-in {
  flex: 1; background: transparent; border: none; outline: none;
  color: #F7EDD9; font-family: var(--mono); font-size: 13px; caret-color: #E59A3C;
}
.t-in::placeholder { color: #7A5B3A; }
.t-neofetch { display: flex; gap: 22px; align-items: flex-start; margin: 4px 0; }
.t-neofetch pre { color: #9EB08A; font-size: 12px; line-height: 1.35; }
.t-neofetch .t-info div { white-space: nowrap; }
.t-info b { color: #E8B878; }

/* ============================================================
   画板
   ============================================================ */
.paint { height: 100%; display: flex; flex-direction: column; }
.p-bar {
  flex: 0 0 46px; display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  padding: 0 12px; border-bottom: 2px solid var(--wood-dark);
  background: var(--paper2);
}
.p-bar button {
  padding: 5px 11px; border-radius: 7px; font-size: 12.5px;
  border: 2px solid var(--wood-dark); color: var(--ink); background: var(--paper);
}
.p-bar button:hover { background: color-mix(in srgb, var(--honey) 30%, var(--paper)); }
.p-bar button.on { background: var(--accent); border-color: var(--line-strong); color: #fff; }
.p-sep { width: 2px; height: 18px; background: var(--wood-dark); margin: 0 2px; }
.p-size { width: 90px; accent-color: var(--accent); }
.p-swatches { display: flex; gap: 5px; }
.p-sw { width: 19px; height: 19px; border-radius: 4px; border: 2px solid var(--wood-dark); transition: .12s; }
.p-sw:hover { transform: scale(1.15); }
.p-sw.on { border-color: var(--ink-strong); box-shadow: 0 0 0 2px var(--paper); }
.p-color { width: 26px; height: 22px; padding: 0; border: none; background: none; }
.p-canvas-wrap { flex: 1; position: relative; background: #FBF0D2; cursor: crosshair; }
.p-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }

/* ============================================================
   合成器：木质留声机 + 环境音（雨声/柴火）
   ============================================================ */
.synth { height: 100%; display: flex; flex-direction: column; background: #241A12; }
.s-stage { flex: 1; position: relative; border-bottom: 3px solid var(--wood-dark); }
.s-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.s-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #8D7355; font-size: 13px; letter-spacing: 1px; pointer-events: none; padding: 0 30px;
  text-align: center; line-height: 1.8;
}
.s-ctl {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  min-height: 52px; padding: 8px 14px;
  background: var(--paper2); border-top: 3px solid var(--wood);
}
.s-play {
  width: 38px; height: 38px; border-radius: 8px; flex: 0 0 38px;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  background: var(--honey); color: var(--ink-strong);
  border: 2px solid var(--line-strong);
  box-shadow: 0 2.5px 0 var(--wood-dark);
  transition: transform .06s, box-shadow .06s;
}
.s-play:active { transform: translateY(2.5px); box-shadow: 0 0 0 var(--wood-dark); }
.s-select {
  background: var(--paper); color: var(--ink); border: 2px solid var(--wood-dark);
  border-radius: 7px; padding: 5px 8px; font-size: 12.5px;
}
.s-vol, .s-amb { accent-color: var(--accent); }
.s-amb-group { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.s-amb { width: 86px; }
.s-seed {
  padding: 5px 11px; font-size: 12.5px; border: 2px solid var(--wood-dark);
  border-radius: 7px; color: var(--muted); background: var(--paper);
}
.s-seed:hover { color: var(--accent); }

/* ============================================================
   贪吃蛇：木框小街机
   ============================================================ */
.snake { height: 100%; display: flex; flex-direction: column; background: #F6D8A8; }
.snk-hud {
  flex: 0 0 40px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; font-family: var(--mono); font-size: 13px; color: var(--muted);
  border-bottom: 2px solid var(--wood-dark);
  background: var(--paper2);
}
.snk-hud b { color: var(--accent); font-size: 16px; }
.snk-wrap { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; }
.snk-canvas { max-width: 94%; max-height: 94%; }
.snk-over {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center; background: rgba(43, 24, 10, .62);
  font-size: 15px; letter-spacing: 1px; color: #F6E4C4;
}
.snk-over small { color: #C9A97E; font-size: 12.5px; }

/* ============================================================
   便签：书桌手账 + 信纸
   ============================================================ */
.notes { height: 100%; display: grid; grid-template-columns: 168px 1fr; }
.n-list {
  border-right: 2px solid var(--wood-dark); overflow: auto; padding: 10px 8px;
  display: flex; flex-direction: column; gap: 6px;
  background: color-mix(in srgb, var(--honey) 10%, var(--paper2));
}
.n-new {
  padding: 8px; border-radius: 7px; font-size: 12.5px; text-align: center;
  border: 2px dashed var(--wood); color: var(--muted); margin-bottom: 4px;
}
.n-new:hover { border-color: var(--accent); color: var(--accent); }
.n-item {
  position: relative; padding: 8px 10px; border-radius: 6px; font-size: 12.5px; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted);
  border-bottom: 1.5px dashed var(--line);
}
.n-item:hover { background: var(--paper); color: var(--ink); }
.n-item.on { background: var(--paper); color: var(--ink); padding-left: 24px; }
/* 火漆印章 */
.n-item.on::before {
  content: ""; position: absolute; left: 7px; top: 50%; transform: translateY(-50%);
  width: 11px; height: 11px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #E06A50, var(--accent) 60%, #7E2A18);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .35);
}
.n-item time { display: block; font-size: 10.5px; opacity: .75; margin-top: 2px; }
.n-main { display: flex; flex-direction: column; }
.n-tools { flex: 0 0 40px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 2px solid var(--wood-dark); background: var(--paper2); }
.n-tools button { padding: 5px 11px; font-size: 12.5px; border: 2px solid var(--wood-dark); border-radius: 7px; background: var(--paper); }
.n-tools button:hover { color: var(--accent); }
.n-tools .on { background: var(--accent); color: #fff; }
.n-tools .n-del { margin-left: auto; color: var(--accent); }
.n-edit {
  flex: 1; border: none; outline: none; resize: none; padding: 18px 22px;
  background:
    linear-gradient(0deg, transparent 42%, rgba(92, 46, 20, .09) 43%, transparent 44%),
    repeating-linear-gradient(transparent 0 27px, rgba(92, 46, 20, .08) 27px 28px);
  background-attachment: local;
  font-size: 13.5px; line-height: 28px; user-select: text; color: var(--ink);
}
.n-view {
  flex: 1; overflow: auto; padding: 18px 22px; user-select: text;
  background: linear-gradient(0deg, transparent 42%, rgba(92, 46, 20, .07) 43%, transparent 44%);
}
.n-view h1, .n-view h2, .n-view h3 { margin: .6em 0 .35em; color: var(--ink-strong); }
.n-view h1, .n-view h2 { font-family: var(--serif); }
.n-view h1 { font-size: 20px; } .n-view h2 { font-size: 16.5px; } .n-view h3 { font-size: 14.5px; }
.n-view p, .n-view li { line-height: 1.85; font-size: 13.5px; }
.n-view ul { padding-left: 20px; }
.n-view code { font-family: var(--mono); font-size: 12.5px; background: var(--paper2); padding: 1.5px 6px; border-radius: 5px; border: 1px solid var(--line); }
.n-view pre.md-code { background: #241A12; color: #EFE2CE; padding: 11px 13px; border-radius: 8px; border: 2px solid var(--wood-dark); overflow: auto; margin: .5em 0; }
.n-view pre.md-code code { background: none; padding: 0; color: inherit; }
.n-view blockquote { border-left: 3px solid var(--honey); padding: 2px 12px; color: var(--muted); margin: .4em 0; }
.n-view hr { border: none; border-top: 1.5px dashed var(--line-strong); margin: .8em 0; }
.n-view a { color: var(--accent); }
.n-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }

/* ============================================================
   设置
   ============================================================ */
.settings { height: 100%; overflow: auto; padding: 16px 20px 22px; }
.set-h { font-size: 11px; color: var(--muted); letter-spacing: 2px; margin: 16px 0 9px; }
.set-h:first-child { margin-top: 0; }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 14px; border: 2px solid var(--wood); border-radius: 8px; margin-bottom: 8px;
  background: var(--paper);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--wood-dark) 55%, transparent);
}
.set-row label { font-size: 13px; }
.set-row small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.set-ctl { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.set-select { background: var(--paper2); border: 2px solid var(--wood-dark); border-radius: 7px; padding: 5px 8px; font-size: 12.5px; }
.set-range { width: 130px; accent-color: var(--accent); }
.set-check { width: 17px; height: 17px; accent-color: var(--accent); }
.swatches { display: flex; gap: 7px; align-items: center; }
.set-sw { width: 22px; height: 22px; border-radius: 5px; border: 2px solid var(--wood-dark); transition: .12s; }
.set-sw:hover { transform: scale(1.15); }
.set-sw.on { border-color: var(--ink-strong); box-shadow: 0 0 0 2px var(--paper); }
.set-color { width: 28px; height: 24px; padding: 0; border: none; background: none; }
.set-danger {
  width: 100%; padding: 9px; border-radius: 8px; font-size: 12.5px; color: var(--accent);
  border: 2px solid var(--accent); background: var(--paper);
}
.set-danger:hover { background: color-mix(in srgb, var(--accent) 12%, var(--paper)); }

/* ============================================================
   关于（系统）
   ============================================================ */
.about { height: 100%; overflow: auto; padding: 20px 22px; }
.about-top { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.about pre {
  font-family: var(--mono); font-size: 12px; line-height: 1.4;
  color: var(--accent2);
}
.about-info { font-size: 12.5px; line-height: 2; color: var(--muted); }
.about-info b { color: var(--ink); font-family: var(--mono); font-weight: 600; }
.about-info .live { color: var(--accent); }
.about-sub { font-size: 11px; color: var(--muted); letter-spacing: 2px; margin: 20px 0 10px; }
.caps { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; }
.cap {
  padding: 12px 13px; border: 2px solid var(--wood); border-radius: 8px; text-align: left;
  background: var(--paper); transition: .15s; color: var(--ink);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--wood-dark) 55%, transparent);
}
.cap:hover { transform: translateY(-3px); border-color: var(--wood-dark); }
.cap .ic { width: 18px; height: 18px; color: var(--accent); }
.cap h4 { font-size: 13px; margin: 7px 0 3px; }
.cap p { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.about-foot { margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 1.9; }
.about-foot code { font-family: var(--mono); background: var(--paper2); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); }

/* ============================================================
   关于我
   ============================================================ */
.me { height: 100%; overflow: auto; padding: 24px 28px; user-select: text; }
.me-hero { display: flex; gap: 20px; align-items: center; }
.me-avatar {
  width: 78px; height: 78px; border-radius: 10px; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px; color: var(--ink-strong);
  background: linear-gradient(140deg, var(--honey), color-mix(in srgb, var(--accent) 60%, var(--honey)));
  border: 3px solid var(--line-strong);
  box-shadow: 0 3px 0 var(--wood-dark), 0 10px 24px var(--shadow);
}
.me-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.me-name { font-family: var(--serif); font-size: 26px; font-weight: 700; color: var(--ink-strong); }
.me-name small { font-family: var(--sans); font-weight: 400; color: var(--muted); margin-left: 9px; font-size: 13px; letter-spacing: 1px; }
.me-title { color: var(--accent); font-size: 13.5px; margin-top: 4px; font-weight: 700; }
.me-tagline { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.me-bio { margin: 18px 0 4px; }
.me-bio p { font-size: 13.5px; line-height: 2; color: var(--ink); margin: 8px 0; }
.me-link {
  color: var(--accent); font-weight: 600;
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px;
}
.me-link:hover { color: var(--ink-strong); }
.me-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; }
.me-fact {
  border: 2px solid var(--wood); border-radius: 8px; padding: 9px 14px;
  background: var(--paper);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--wood-dark) 45%, transparent);
}
.me-fact b { display: block; font-size: 11px; color: var(--muted); font-weight: 500; margin-bottom: 3px; }
.me-fact span { font-size: 13px; font-weight: 600; }
.me-sub { font-size: 11px; color: var(--muted); letter-spacing: 2px; margin: 20px 0 10px; }
.me-ints { display: flex; flex-direction: column; gap: 9px; }
.me-int {
  display: flex; gap: 13px; align-items: flex-start;
  border: 2px solid var(--wood); border-radius: 9px; padding: 13px 15px;
  background: var(--paper);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--wood-dark) 45%, transparent);
}
.me-int .int-ic {
  width: 38px; height: 38px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 19px;
  background: color-mix(in srgb, var(--honey) 28%, var(--paper));
  border: 1.5px solid var(--wood);
}
.me-int h4 { font-size: 13.5px; margin-bottom: 4px; color: var(--ink-strong); }
.me-int p { font-size: 12.5px; line-height: 1.85; color: var(--muted); }
.me-end {
  text-align: center; color: var(--muted); font-size: 12px;
  margin-top: 20px; letter-spacing: 1.5px;
}

/* 这个空间 */
.sp { height: 100%; overflow: auto; padding: 22px 26px; user-select: text; }
.sp .p-main { font-size: 13.5px; line-height: 2; margin: 6px 0; }
.sp .grow { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.sp .grow span {
  padding: 6px 14px; border-radius: 7px;
  border: 2px dashed var(--wood); font-size: 12px; color: var(--muted);
  background: var(--paper);
}
.sp .made { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; margin-top: 6px; }
.sp .made button {
  border: 2px solid var(--wood); border-radius: 8px; padding: 12px 13px;
  text-align: left; background: var(--paper);
}
.sp .made button:hover { border-color: var(--wood-dark); background: color-mix(in srgb, var(--honey) 18%, var(--paper)); }
.sp .made b { font-size: 13px; display: block; color: var(--ink-strong); }
.sp .made small { font-size: 11px; color: var(--muted); }
.sp .quiet { margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 2; }

/* 想法 */
.th { height: 100%; overflow: auto; padding: 24px 30px; }
.th-item {
  display: flex; gap: 16px; align-items: baseline;
  padding: 14px 0; border-bottom: 2px dashed var(--line);
}
.th-item:last-of-type { border-bottom: none; }
.th-num { font-family: var(--serif); color: var(--accent); font-size: 15px; flex-shrink: 0; width: 1.8em; opacity: .9; }
.th-txt { font-family: var(--serif); font-size: 15.5px; line-height: 1.95; color: var(--ink-strong); }

@media (max-width: 720px) {
  .sb-hide-sm { display: none !important; }
  #statusbar { padding: 0 8px; font-size: 12px; }
  .sb-left, .sb-right { gap: 6px; }

  #desk-icons {
    inset: auto; top: calc(var(--bar-h) + 12px); left: 10px; right: 10px; max-height: none;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 4px;
  }
  .desk-icon { position: static; width: 100%; padding: 6px 2px; gap: 4px; touch-action: manipulation; }
  .desk-icon .di-ic { width: 38px; height: 38px; }
  .desk-icon .di-lbl { font-size: 11px; padding: 1px 5px; }

  /* 手机端精简 Dock：居中展示核心入口，不溢出滚动 */
  #dock {
    max-width: calc(100vw - 16px); justify-content: center;
    padding: 6px 10px; bottom: 10px; gap: 6px;
  }
  #dock .sb-sep,
  #dock .dock-btn[data-app="space"],
  #dock .dock-btn[data-app="thoughts"],
  #dock .dock-btn[data-app="paint"],
  #dock .dock-btn[data-app="snake"],
  #dock .dock-btn[data-app="notes"],
  #dock .dock-btn[data-app="about"] { display: none; }
  .dock-btn { width: 42px; height: 42px; flex-shrink: 0; }
  .dock-btn .ic { width: 20px; height: 20px; }

  #pixelpet { left: 10px; right: auto; bottom: 78px; width: 58px; height: 58px; }
  #pet-bubble { left: 10px; right: auto; bottom: 142px; max-width: 220px; }
  #pet-bubble::after { left: 20px; right: auto; }

  .win.maxed { left: 4px !important; right: 4px !important; bottom: 74px !important; }
  .win-grip { display: none; }
  .notes { grid-template-columns: 1fr; grid-template-rows: 132px 1fr; }
  .n-list { border-right: none; border-bottom: 2px solid var(--wood-dark); }
  .me { padding: 16px; }
  .me-facts { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
