:root {
  --clay: #bc4528;
  --clay-dark: #a93e24;
  --paper: #f4f1ed;
  --paper2: #faf7f2;
  --card: #efeae2;
  --ink: #5d4e47;
  --deep: #3d342f;
  --muted: #8a8178;
  --line: rgba(93, 78, 71, 0.12);
  --shadow: 0 24px 70px rgba(93, 78, 71, 0.18);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; color: var(--ink); background: var(--paper); }
button, input, textarea { font: inherit; }
button { border: 0; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
.boot { position: fixed; z-index: 1000; inset: 0; overflow: hidden; cursor: pointer; color: var(--paper); background: #070e1c; }
.boot.instant { display: none; }
.boot.skip { animation: bootOut .6s ease forwards; }
.boot-tip { position: absolute; bottom: 40px; left: 0; right: 0; text-align: center; color: rgba(244,241,237,.45); font-size: .8rem; z-index: 10; }
@keyframes bootOut { to { opacity: 0; visibility: hidden; } }
.desktop { position: relative; width: 100vw; height: 100vh; overflow: hidden; background: url("../assets/05-content-surfaces.webp") left center / cover no-repeat, var(--paper); }
.desktop::after { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(rgba(93,78,71,.035) 1px, transparent 1px); background-size: 4px 4px; opacity: .8; }
.topbar { position: fixed; z-index: 80; left: 0; right: 0; top: 0; height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; color: var(--deep); background: rgba(244,241,237,.78); border-bottom: 1px solid var(--line); }
.brand { font-size: 1.08rem; font-weight: 800; letter-spacing: .02em; }
.clock { font-size: .9rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.hint { position: absolute; left: 28px; bottom: 102px; z-index: 2; color: rgba(93,78,71,.68); font-size: .9rem; background: rgba(250,247,242,.72); border-radius: 999px; padding: 8px 12px; }
.icon { position: absolute; z-index: 3; width: 104px; text-align: center; color: var(--deep); user-select: none; cursor: default; }
.icon.selected .shape { outline: 2px solid rgba(188,69,40,.45); outline-offset: 5px; }
.shape { width: 62px; height: 58px; margin: 0 auto 8px; border-radius: 15px; display: grid; place-items: center; box-shadow: 0 12px 24px rgba(93,78,71,.14); transition: transform .16s ease; }
.icon:hover .shape { transform: translateY(-2px); }
.folder .shape { background: linear-gradient(#f1cf72, #d9aa41); border-radius: 10px 10px 15px 15px; }
.folder .shape::before { content: ""; width: 32px; height: 9px; border-radius: 8px 8px 0 0; background: #f7dd91; transform: translate(-9px,-27px); }
.file .shape { background: linear-gradient(#faf7f2, #efeae2); color: var(--clay); border: 2px solid rgba(93,78,71,.12); }
.file .shape::after { content: attr(data-ext); font-size: .75rem; font-weight: 800; color: var(--clay); }
.agent .shape { background: #faf7f2; border: 2px solid rgba(188,69,40,.16); }
.agent .shape::before { content: "Moon"; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--clay); color: var(--paper); font-size: .68rem; font-weight: 800; }
.books .shape { background: linear-gradient(145deg, #3D342F 0%, #5D4E47 60%, #8A6E5E 100%); border-radius: 18px; box-shadow: 0 14px 28px rgba(61,52,47,.25), inset 0 1px 0 rgba(255,255,255,.06); }
.books .shape::before { content: "📚"; font-size: 1.6rem; display: grid; place-items: center; }
.books .shape::after { content: ""; position: absolute; top: 6px; left: 10px; width: 6px; height: 20px; background: rgba(255,255,255,.15); border-radius: 4px; }
.label { display: block; font-size: .82rem; line-height: 1.25; text-shadow: 0 1px 2px rgba(250,247,242,.5); }
.delete-file { display: none; position: absolute; right: 9px; top: -8px; z-index: 2; width: 22px; height: 22px; border-radius: 50%; background: var(--clay); color: var(--paper); cursor: pointer; box-shadow: 0 6px 14px rgba(188,69,40,.25); }
.uploaded-icon:hover .delete-file, .uploaded-icon.selected .delete-file { display: grid; place-items: center; }
.window { position: absolute; z-index: 20; width: min(720px, calc(100vw - 48px)); height: min(520px, calc(100vh - 128px)); left: 80px; top: 88px; border-radius: 18px; overflow: hidden; background: rgba(250,247,242,.97); box-shadow: var(--shadow); border: 1px solid rgba(93,78,71,.1); resize: both; }
.finder-window { width: min(680px, calc(100vw - 48px)); height: min(420px, calc(100vh - 128px)); }
.doc-window { width: min(980px, calc(100vw - 48px)); height: min(700px, calc(100vh - 96px)); }
.window.active { box-shadow: 0 30px 86px rgba(93,78,71,.26); }
.winbar { height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 14px; background: rgba(244,241,237,.82); border-bottom: 1px solid var(--line); cursor: grab; }
.winbar:active { cursor: grabbing; }
.dots { display: flex; align-items: center; gap: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; cursor: pointer; }
.red { background: #ff5f57; } .yellow { background: #ffbd2f; } .green { background: #28c840; }
.wtitle { font-size: .9rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.open-new { min-width: 24px; color: var(--clay); cursor: pointer; }
.content { height: calc(100% - 48px); overflow: auto; padding: 28px; }
.finder-window .content { padding: 28px 42px; }
.content h2 { margin: 0 0 16px; font-size: 2.2rem; font-weight: 800; line-height: 1.1; color: var(--deep); }
.content p { color: var(--muted); }
.editbar { position: sticky; bottom: 0; margin: 18px -28px -28px; padding: 12px 18px; background: rgba(244,241,237,.9); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.pill { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 14px; border-radius: 10px; background: rgba(188,69,40,.08); color: var(--clay); cursor: pointer; font-weight: 600; }
.pill.primary { background: var(--clay); color: var(--paper); }
.editable { outline: 0; }
.editing .editable { padding: 12px; border-radius: 14px; background: var(--paper2); border: 1px dashed rgba(188,69,40,.36); }
.chatlog { display: grid; gap: 12px; }
.bubble { max-width: 82%; padding: 12px 14px; border-radius: 16px; background: var(--card); color: var(--ink); }
.bubble.me { justify-self: end; background: rgba(188,69,40,.08); color: var(--clay); border-bottom-right-radius: 5px; }
.chatbox { display: flex; gap: 10px; margin-top: 18px; }
.chatbox input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 999px; padding: 12px 16px; background: var(--paper2); }
.dock { position: fixed; z-index: 90; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; gap: 8px; padding: 8px; border-radius: 999px; background: rgba(250,247,242,.9); box-shadow: 0 18px 36px rgba(93,78,71,.14); border: 1px solid rgba(93,78,71,.08); }
.dock button { padding: 12px 18px; border-radius: 999px; color: var(--muted); cursor: pointer; }
.dock button:hover { background: rgba(188,69,40,.06); color: var(--deep); }
.dock button.active { background: var(--clay); color: var(--paper); }
.upload .shape { background: linear-gradient(#faf7f2, #efeae2); color: var(--clay); }
.upload .shape::before { content: "+"; font-size: 2rem; font-weight: 700; }
.upload-preview iframe, .upload-preview img, .upload-preview embed { width: 100%; height: 420px; border: 0; border-radius: 12px; background: var(--paper2); }
.upload-window .content { padding: 0; overflow: hidden; }
.upload-window .editable, .upload-window .upload-preview, .upload-window .upload-preview iframe, .upload-window .upload-preview embed { width: 100%; height: 100%; }
.upload-window .upload-preview img { width: 100%; height: 100%; object-fit: contain; border-radius: 0; }
.upload-preview pre { white-space: pre-wrap; padding: 16px; border-radius: 12px; background: var(--paper2); border: 1px solid var(--line); }
.doc-preview, .doc-preview iframe { width: 100%; height: 100%; min-height: calc(100vh - 150px); border: 0; display: block; }
.doc-window .content { padding: 0; overflow: hidden; }
.dashboard-page .eyebrow { color: var(--clay); letter-spacing: .14em; text-transform: uppercase; font-size: .78rem; }
.underline-hand { position: relative; display: inline-block; }
.underline-hand::after { content: ""; position: absolute; left: -2px; right: -2px; bottom: -6px; height: 9px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='12'%3E%3Cpath d='M2 8Q20 3 40 7T78 5' stroke='%23bc4528' stroke-width='2.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x; background-size: auto 100%; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 20px; }
.dash-grid > div { padding: 18px; border-radius: 0 12px 12px 0; background: var(--card); border-left: 3px solid var(--clay); }
.finder-grid { display: grid; grid-template-columns: repeat(4, 110px); grid-auto-rows: 150px; column-gap: 36px; row-gap: 22px; align-items: start; }
.finder-item { width: 110px; min-height: 132px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--deep); cursor: pointer; text-align: center; }
.finder-item:hover .doc-icon { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(93,78,71,.12); }
.finder-item strong { font-size: .98rem; line-height: 1.28; font-weight: 500; }
.doc-icon { width: 60px; height: 60px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(#faf7f2,#efeae2); border: 2px solid rgba(93,78,71,.12); color: var(--clay); box-shadow: 0 2px 10px rgba(93,78,71,.06); transition: .18s; }
.doc-icon::before { content: attr(data-ext); font-size: .82rem; font-weight: 800; }
.git-item .doc-icon { background: var(--deep); color: var(--paper); border-color: var(--deep); border-radius: 12px; }
.git-item .doc-icon::before { content: "git"; font-size: 1rem; }
.missing-item { opacity: .72; }
.missing-item .doc-icon { border-style: dashed; background: rgba(250,247,242,.58); color: var(--muted); }
.missing-item .doc-icon::before { content: "soon"; font-size: .72rem; }
.missing-item strong { color: var(--muted); }

/* ── 书库预览 ── */
.books-preview { padding: 8px 0; }
.books-preview .bp-eyebrow { font-size: .78rem; color: var(--stone); margin-bottom: 18px; text-align: center; letter-spacing: .04em; }
.bp-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 14px; }
.bp-card { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bp-card img { width: 56px; height: 78px; border-radius: 4px; object-fit: cover; box-shadow: 0 4px 12px rgba(61,52,47,.12); transition: transform .2s; }
.bp-card img:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(61,52,47,.2); }
.bp-card span { font-size: .68rem; color: var(--deep); text-align: center; line-height: 1.2; font-weight: 500; }

@media (max-width: 760px) { .icon { width: 82px; } .window { left: 16px !important; top: 70px !important; width: calc(100vw - 32px); height: calc(100vh - 150px); } .hint { display: none; } .dock { width: calc(100% - 24px); justify-content: center; } .dock button { padding: 10px 12px; font-size: .86rem; } .dash-grid, .finder-grid { grid-template-columns: 1fr 1fr; } .bp-grid { grid-template-columns: repeat(3,1fr); } }

/* Mobile-first fallback for small screens: keep the desktop metaphor, remove overflow and oversized windows. */
@media (max-width: 760px) {
  html, body { overflow: hidden; }
  .desktop { width: 100%; min-height: 100dvh; height: 100dvh; background-position: 32% center; }
  .topbar { height: 44px; padding: 0 12px; }
  .brand { font-size: .96rem; }
  .clock { font-size: .78rem; }
  .icon { width: 76px; transform: scale(.88); transform-origin: top center; }
  .icon .label { font-size: .72rem; }
  .dock { bottom: max(10px, env(safe-area-inset-bottom)); gap: 4px; padding: 5px; }
  .dock button { min-height: 40px; padding: 9px 10px; font-size: .78rem; }
  .window, .finder-window, .doc-window { left: 10px !important; top: 58px !important; width: calc(100vw - 20px) !important; height: calc(100dvh - 116px) !important; max-height: none; resize: none; border-radius: 14px; }
  .winbar { height: 42px; padding: 0 10px; }
  .content, .finder-window .content { padding: 18px 16px; }
  .content h2 { font-size: 1.55rem; }
  .dash-grid, .finder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .finder-grid { grid-auto-rows: 120px; column-gap: 10px; row-gap: 12px; }
  .finder-item { width: auto; min-height: 112px; gap: 7px; font-size: .78rem; }
  .doc-preview, .doc-preview iframe { min-height: calc(100dvh - 190px); }
  .chatbox { flex-wrap: wrap; }
  .chatbox input { width: 100%; flex-basis: 100%; }
  .bp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
}
