/* Shared Claude-inspired visual system for every public and staff page.
   Keep local font fallbacks because external font CDNs are unreliable in China. */

@font-face {
  font-family: Inter;
  src: url('/assets/fonts/inter-latin-400-normal.woff2?v=79bfbcca750e') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url('/assets/fonts/inter-latin-600-normal.woff2?v=7800710824db') format('woff2');
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url('/assets/fonts/source-serif-4-latin-400-normal.woff2?v=7cad479bb784') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url('/assets/fonts/source-serif-4-latin-600-normal.woff2?v=8c88fa1f1a93') format('woff2');
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

:root {
  --navy: #a84f35;
  --navy-2: #c66548;
  --navy-soft: #f8e9e1;
  --on-navy: #ffffff;
  --accent: #c66548;
  --gold: #a88147;
  --bg: #faf6f1;
  --surface: #fffdf9;
  --surface-2: #f4eee6;
  --line: #e6ddd2;
  --text: #29251f;
  --muted: #675f55;
  --faint: #82786d;
  --ok: #3f7557;
  --ok-soft: #e8f1e9;
  --warn: #95651f;
  --warn-soft: #fbefda;
  --bad: #ad4d42;
  --bad-soft: #f9e8e4;
  --shadow: 0 1px 2px rgba(70, 48, 31, .035), 0 8px 28px rgba(70, 48, 31, .045);
  --radius: 16px;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-heading: "Source Serif 4", Georgia, "Noto Serif SC", "Songti SC", STSong, SimSun, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #e7a385;
    --navy-2: #f0b99c;
    --navy-soft: #423129;
    --on-navy: #2c211d;
    --accent: #eda588;
    --gold: #d0a76c;
    --bg: #211f1c;
    --surface: #2b2925;
    --surface-2: #35312c;
    --line: #494138;
    --text: #f1eae0;
    --muted: #c8bbab;
    --faint: #a99a88;
    --ok: #94c8a5;
    --ok-soft: #263b2f;
    --warn: #e2b975;
    --warn-soft: #413422;
    --bad: #ed9a8e;
    --bad-soft: #462b29;
    --shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 12px 28px rgba(0, 0, 0, .12);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --navy: #e7a385; --navy-2: #f0b99c; --navy-soft: #423129; --on-navy: #2c211d; --accent: #eda588; --gold: #d0a76c;
  --bg: #211f1c; --surface: #2b2925; --surface-2: #35312c; --line: #494138; --text: #f1eae0;
  --muted: #c8bbab; --faint: #a99a88; --ok: #94c8a5; --ok-soft: #263b2f; --warn: #e2b975;
  --warn-soft: #413422; --bad: #ed9a8e; --bad-soft: #462b29;
  --shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 12px 28px rgba(0, 0, 0, .12);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text); font: 15px/1.6 var(--font);
}
a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: 26px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
p { margin: 0 0 .8em; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; padding: 24px 0 48px; }

/* ---------- header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top .wrap { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 19px; letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.logo { width: 32px; height: 32px; flex: none; border-radius: 8px; }
.brand b { color: var(--navy); font-weight: 800; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--faint); letter-spacing: 1px; margin-top: -4px; }
.top form { flex: 1; max-width: 360px; margin-left: 8px; }
.top form input { width: 100%; height: 36px; border-radius: 18px; padding: 0 14px; background: var(--surface-2); border: 1px solid transparent; }
.top form input:focus { outline: none; border-color: var(--navy-2); background: var(--surface); }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { color: var(--navy); background: var(--navy-soft); font-weight: 600; }
.nav .up { background: var(--navy); color: var(--on-navy); }
.nav .up:hover { background: var(--navy-2); color: var(--on-navy); }

@media (max-width: 720px) {
  .top .wrap { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .top form { order: 3; max-width: none; flex-basis: 100%; margin: 0; }
  .brand small { display: none; }
  .nav a { padding: 6px 8px; }
}

/* ---------- footer */
.foot { border-top: 1px solid var(--line); color: var(--faint); font-size: 13px; padding: 20px 0 28px; background: var(--surface); }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* ---------- building blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.grid > .card, .sections > .card, .layout-side > .card { margin-top: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 12px; }
.section-head h2 { margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--navy-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: var(--on-navy); font-weight: 600; }
.btn.primary:hover { background: var(--navy-2); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.ok { color: var(--ok); }
.btn.ok:hover { border-color: var(--ok); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 46px; padding: 0 24px; font-size: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.field > span em { color: var(--accent); font-style: normal; }
.input, select.input, textarea.input {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
}
.input:focus { outline: none; border-color: var(--navy-2); box-shadow: 0 0 0 3px var(--navy-soft); }
textarea.input { min-height: 90px; resize: vertical; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.fields-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
@media (max-width: 640px) { .fields-2, .fields-3 { grid-template-columns: 1fr; } }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 13px;
  background: var(--surface-2); color: var(--muted); border: 1px solid transparent; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--line); color: var(--text); text-decoration: none; }
.chip.on { background: var(--navy-soft); color: var(--navy); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--navy-soft); color: var(--navy); white-space: nowrap; }
.tag.t-T1 { background: #fde8ea; color: #a1122b; }
.tag.t-T2 { background: #fdeee2; color: #9a3d0a; }
.tag.t-T3 { background: #e6f4ec; color: #1f6b44; }
.tag.t-T4 { background: #fff1db; color: #8a5300; }
.tag.t-T5 { background: #e8edf9; color: #2847a0; }
.tag.t-T6 { background: #efe7fb; color: #5b33a6; }
.tag.t-T7 { background: #eceef2; color: #4a5160; }
.tag.t-T8 { background: #e3f3f6; color: #13677a; }
.tag.t-T9 { background: #f3e9f5; color: #7a2e86; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag { filter: saturate(.85) brightness(.85); }
}
.badge { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.published, .badge.downloaded { background: var(--ok-soft); color: var(--ok); }
.badge.rejected, .badge.removed { background: var(--bad-soft); color: var(--bad); }
.badge.merged { background: var(--surface-2); color: var(--faint); }
.badge.restricted { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line); }
.badge.uncertain { background: #f1ecff; color: #5b3fb0; }

.notice { padding: 12px 14px; border-radius: 10px; background: var(--navy-soft); color: var(--text); font-size: 14px; margin-bottom: 16px; }
.notice.warn { background: var(--warn-soft); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.ok { background: var(--ok-soft); }

.empty { text-align: center; padding: 40px 16px; color: var(--faint); }
.empty b { display: block; color: var(--muted); font-size: 16px; margin-bottom: 4px; }

/* ---------- hero */
.hero { padding: 48px 0 28px; text-align: center; }
.hero .logo { width: 64px; height: 64px; margin: 0 auto 14px; display: block; border-radius: 16px; }
.hero h1 { font-size: 34px; letter-spacing: .5px; margin-bottom: 6px; }
.hero h1 b { color: var(--navy); }
.hero p { color: var(--muted); font-size: 16px; margin-bottom: 22px; }
.bigsearch { max-width: 620px; margin: 0 auto; display: flex; gap: 8px; }
.bigsearch input { flex: 1; height: 50px; border-radius: 14px; padding: 0 18px; font-size: 16px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.bigsearch input:focus { outline: none; border-color: var(--navy-2); }
.bigsearch .btn { height: 50px; border-radius: 14px; padding: 0 22px; }
.stats { display: flex; justify-content: center; gap: 28px; margin-top: 22px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.stats b { color: var(--text); font-size: 18px; margin-right: 4px; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .hero { padding-top: 28px; } .hero h1 { font-size: 26px; } }

/* ---------- nodes, tree & resource items */
.node-card { display: block; color: var(--text); padding: 14px 16px; }
.node-card:hover { text-decoration: none; border-color: var(--navy-2); }
.node-card h3 { margin: 0 0 2px; font-size: 15px; }
.node-card .meta { font-size: 12px; color: var(--faint); display: flex; gap: 10px; justify-content: space-between; }
.node-card .count { color: var(--navy); }
.node-card.empty-node { opacity: .6; }
.sections { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.section-card { padding: 18px; }
.section-card h3 { margin: 0 0 8px; font-size: 17px; display: flex; justify-content: space-between; align-items: baseline; }
.section-card h3 a { color: var(--text); }
.section-card .chips { gap: 6px; }
.tree { list-style: none; margin: 0; padding: 0; }
.tree ul { list-style: none; margin: 0 0 0 18px; padding: 0; border-left: 1px dashed var(--line); }
.tree li { margin: 2px 0; }
.tree .shelf { margin: 2px 0 8px 30px; padding: 4px 0 4px 12px; border-left: 2px solid var(--line); }
.tree .shelf li { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; padding: 3px 0; }
.tree .row-n { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 6px; }
.tree .row-n:hover, .tree .row-n.on { background: var(--surface-2); }
.tree .row-n.on { box-shadow: inset 0 0 0 1px var(--line); }
.tree .row-n.has-kids { cursor: pointer; }
.tree .tw { width: 26px; height: 26px; flex: none; border: 0; background: none; cursor: pointer; color: var(--faint); padding: 0; font-size: 12px; }
.tree .n { color: var(--text); }
.tree .n.zero { color: var(--faint); }
.tree .c { font-size: 12px; color: var(--faint); margin-left: auto; }
.tree .pick { margin-left: 6px; }
.item .note { font-size: 13px; color: var(--muted); margin-top: 2px; }

.course-card { display: block; color: var(--text); padding: 16px; }
.course-card:hover { text-decoration: none; border-color: var(--navy-2); }
.course-card h3 { margin: 0 0 4px; font-size: 16px; }
.course-card .meta { font-size: 13px; color: var(--faint); display: flex; gap: 10px; flex-wrap: wrap; }
.course-card .count { color: var(--navy); font-weight: 700; }

.list { display: flex; flex-direction: column; }
.item { display: flex; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.item:last-child { border-bottom: 0; }
.item .ficon {
  width: 40px; height: 48px; flex: none; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line);
  display: flex; align-items: flex-end; justify-content: center; font: 700 10px/1 var(--mono); color: var(--muted); padding-bottom: 7px; text-transform: uppercase;
}
.item .ficon.pdf { color: #c62828; } .item .ficon.doc, .item .ficon.docx { color: #1e5bb8; }
.item .ficon.ppt, .item .ficon.pptx { color: #c4501b; } .item .ficon.zip, .item .ficon.rar, .item .ficon.7z { color: #7a5a00; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 600; color: var(--text); display: block; overflow-wrap: anywhere; }
.item .title:hover { color: var(--navy-2); }
.item .meta { font-size: 13px; color: var(--faint); display: flex; gap: 6px 12px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.item .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }

.page-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.crumbs { font-size: 13px; color: var(--faint); margin-bottom: 6px; }
.crumbs a { color: var(--faint); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar select { min-height: 32px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }

.kv { display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.layout-side { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
@media (max-width: 860px) { .layout-side { grid-template-columns: 1fr; } }

/* ---------- upload */
.drop {
  display: block; border: 2px dashed var(--line); border-radius: var(--radius); padding: 36px 16px; text-align: center; cursor: pointer;
  background: var(--surface); transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--navy-2); background: var(--navy-soft); }
.drop b { display: block; font-size: 16px; margin-bottom: 4px; }
.progress { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--navy-2); transition: width .2s; }
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.steps span { font-size: 13px; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); color: var(--faint); }
.steps span.on { background: var(--navy); color: var(--on-navy); }
.steps span.done { background: var(--ok-soft); color: var(--ok); }

.suggest { position: relative; }
.suggest ul {
  position: absolute; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; z-index: 10;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 280px; overflow: auto;
}
.suggest li { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.suggest li:hover, .suggest li.on { background: var(--navy-soft); }
.suggest li small { color: var(--faint); margin-left: 6px; }
.picked { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--navy-soft); }

/* ---------- tables (admin) */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--faint); font-weight: 600; font-size: 12px; }
.scroll-x { overflow-x: auto; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--navy); border-bottom-color: var(--navy); font-weight: 600; }
code, .mono { font-family: var(--mono); font-size: 13px; }
.secret { font-family: var(--mono); font-size: 13px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; overflow-wrap: anywhere; user-select: all; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; max-width: calc(100% - 32px);
}
.toast.bad { background: var(--bad); color: #fff; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 16px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } .progress > i { transition: none; } }

/* ---------- batch upload rows */
.frows { display: flex; flex-direction: column; gap: 10px; }
.frow { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--surface); }
.frow.done { border-color: var(--ok); }
.frow.err { border-color: var(--bad); }
.frow .head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.frow .orig { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; flex: 1; min-width: 180px; }
.frow .gen { font-family: var(--mono); font-size: 13px; color: var(--navy); overflow-wrap: anywhere; margin: 8px 0; }
.frow .opts { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; align-items: end; }
.frow .opts label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.frow .opts .input { min-height: 34px; padding: 4px 8px; }
.frow .opts .wide { grid-column: span 2; }
.frow .st { font-size: 12px; margin-top: 6px; }
@media (max-width: 760px) { .frow .opts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bulkbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; background: var(--navy-soft); border-radius: 10px; margin-bottom: 12px; }
.bulkbar .input { min-height: 32px; padding: 4px 8px; width: auto; }
.review-filters select.input { max-width: min(260px, 100%); }
.auth-card { max-width: 420px; margin: 24px auto; }

/* ---- modal, preview, password, stars, comments, slogan ---- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(10, 20, 40, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); width: min(720px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal-box.wide { width: min(1100px, 100%); }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 14px 16px; overflow: auto; }
.preview-frame { width: 100%; height: min(75vh, 900px); border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.preview-img { max-width: 100%; border-radius: 8px; }
.pwbox { position: relative; display: block; }
.pwbox .input { padding-right: 58px; width: 100%; }
.pweye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--navy-2); cursor: pointer; font-size: 13px; padding: 4px 6px; }
.stars { color: #f5a623; letter-spacing: 1px; }
.stars i { color: var(--line); font-style: normal; }
.rate { display: inline-flex; gap: 2px; }
.rate button { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--line); padding: 0 1px; }
.rate button.on { color: #f5a623; }
.comment { padding: 10px 0; border-top: 1px solid var(--line); }
.comment:first-child { border-top: 0; }
.comment .who { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.comment .text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }
.slogan { display: inline-block; margin: 2px auto 20px; padding: 10px 22px; border-radius: 999px; background: var(--navy); color: var(--on-navy); font-weight: 700; font-size: 19px; letter-spacing: 2px; box-shadow: var(--shadow); }
@media (max-width: 640px) { .slogan { font-size: 15px; letter-spacing: 1px; padding: 8px 16px; } }
.results-nodes { margin-bottom: 16px; }
.results-nodes h2, .results-res h2 { font-size: 15px; margin: 0 0 10px; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stack > .card + .card { margin-top: 0; }
pre.code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-x: auto; font-size: 12.5px; white-space: pre; }
.item .subtitle { font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .bar-a { fill: var(--navy-2); }
.chart .bar-b { fill: var(--gold); }
.chart .line { fill: none; stroke: var(--navy); stroke-width: 2; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.kpi { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.kpi b { display: block; font-size: 22px; color: var(--navy); }
.kpi span { font-size: 12px; color: var(--muted); }
.selbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.item .rsel { margin: 4px 8px 0 0; flex: none; }
.frow .guess { background: var(--warn-soft); color: var(--warn); border-radius: 4px; padding: 0 4px; }
.pdfview { max-height: min(78vh, 1000px); overflow: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; -webkit-overflow-scrolling: touch; }
.pdfpage { background: #fff; margin: 0 auto 8px; width: 100%; max-width: 900px; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.pdfpage canvas { width: 100%; height: 100%; display: block; }
.help { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
.help-toc { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.help-toc a { color: var(--muted); }
.help-body { min-width: 0; }
.help-body .card + .card { margin-top: 16px; }
.help-body section { scroll-margin-top: 76px; }
.help-body li { margin: 6px 0; line-height: 1.7; }
@media (max-width: 860px) { .help { grid-template-columns: 1fr; } .help-toc { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px 12px; } }
pre.textview { max-height: min(75vh, 900px); overflow: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.docx-host, .sheet-host, .pptx-host { max-height: min(78vh, 1000px); overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); -webkit-overflow-scrolling: touch; }
.docx-host .docx-wrapper { background: transparent !important; padding: 8px !important; }
.sheet-host { background: #fff; color: #111; }
.sheet-host table { border-collapse: collapse; font-size: 13px; }
.sheet-host td, .sheet-host th { border: 1px solid #d9dce3; padding: 3px 6px; white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.sheet-tabs { margin-bottom: 8px; }
.pptx-host { background: #fff; padding: 8px 0; }
.epub-host { height: min(72vh, 820px); border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.archive-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.archive-list li { display: flex; gap: 10px; justify-content: space-between; padding: 6px 10px; border-top: 1px solid var(--line); font-size: 13px; }
.archive-list li:first-child { border-top: 0; }
.archive-list a { overflow-wrap: anywhere; }
.archive-list a.on { font-weight: 700; }
.fbfab { position: fixed; right: 16px; bottom: 16px; z-index: 40; border: 0; border-radius: 999px; padding: 10px 16px; background: var(--navy); color: var(--on-navy); box-shadow: var(--shadow); cursor: pointer; font-size: 14px; }
@media (max-width: 640px) { .fbfab { right: 12px; bottom: 12px; padding: 8px 13px; font-size: 13px; } }
.topfab {
  position: fixed; right: 16px; bottom: 68px; z-index: 40; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  font-size: 20px; line-height: 1; cursor: pointer; -webkit-backdrop-filter: blur(15px); backdrop-filter: blur(15px);
}
.topfab[hidden] { display: none; }
.announce { position: relative; z-index: 5; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--line); font-size: 14px; }
.announce .wrap { display: flex; gap: 10px; align-items: baseline; padding-top: 8px; padding-bottom: 8px; }
.announce b { flex: none; }
.announce button { flex: none; border: 0; background: none; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
@media (max-width: 640px) { .topfab { right: 12px; bottom: 58px; width: 40px; height: 40px; font-size: 18px; } }
@media print { .fbfab, .topfab { display: none; } }
.item .qpv { align-self: center; flex: none; margin-left: auto; }
.qpv-nav { display: inline-flex; gap: 6px; align-items: center; margin-left: 10px; flex-wrap: wrap; }
.modal-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.modal-head { flex-wrap: wrap; }
@media (max-width: 640px) { .modal { padding: 0; } .modal-box, .modal-box.wide { width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; } .qpv-nav { margin-left: 0; width: 100%; } }
.item .thumb { width: 66px; height: 88px; flex: none; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: zoom-in; }
@media (max-width: 640px) { .item .thumb { width: 54px; height: 72px; } }
.nav .gh { white-space: nowrap; }
@media (max-width: 520px) { .nav .gh { display: none; } }
.oss { display: flex; align-items: center; gap: 14px; margin: 0 0 20px; color: inherit; text-decoration: none; border: 1px solid var(--line); }
.oss:hover { border-color: var(--navy-2); }
.oss-icon { color: var(--navy); flex: none; display: flex; }
.oss-text { flex: 1; font-size: 14px; line-height: 1.6; }
.oss .btn { flex: none; }
@media (max-width: 640px) { .oss { flex-wrap: wrap; } .oss .btn { width: 100%; justify-content: center; } }

/* ---------- warm editorial theme, shared by all routes ---------- */
html { scroll-behavior: smooth; }
body { font-size: 15px; line-height: 1.65; letter-spacing: .005em; }
::selection { background: var(--navy-soft); color: var(--text); }
a { color: var(--navy); text-underline-offset: 3px; }
a:hover { color: var(--navy-2); }
h1, h2, h3 { color: var(--text); font-family: var(--font-heading); font-weight: 500; letter-spacing: -.025em; }
h1 { font-size: clamp(28px, 3.5vw, 38px); line-height: 1.24; }
h2 { font-size: 23px; line-height: 1.3; }
h3 { font-size: 18px; line-height: 1.35; }
button, input, select, textarea { accent-color: var(--navy); }
:focus-visible { outline: 2px solid var(--navy-2); outline-offset: 3px; }
main { padding-top: 36px; padding-bottom: 72px; }
.wrap { max-width: 1160px; padding-inline: 24px; }

.top { background: var(--bg); border-color: var(--line); box-shadow: 0 1px 0 rgba(70, 48, 31, .025); }
.top .wrap { height: 72px; gap: 24px; }
.brand { gap: 11px; font: 500 21px/1.1 var(--font-heading); letter-spacing: -.035em; }
.brand b { color: var(--text); font-weight: 600; }
.brand small { color: var(--faint); font: 500 10px/1.6 var(--font); letter-spacing: .13em; margin-top: 3px; }
.logo { border-radius: 10px; }
.top form { max-width: 320px; margin-left: auto; }
.top form input { height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding-left: 15px; }
.top form input:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px var(--navy-soft); }
.nav { margin-left: 0; gap: 3px; }
.nav a { border-radius: 9px; padding: 7px 11px; font-size: 14px; }
.nav a.on { font-weight: 600; }
.nav .up { margin-left: 4px; padding-inline: 15px; }
.foot { background: transparent; padding-block: 24px 34px; line-height: 1.8; }
.foot a { color: var(--muted); }

.card { box-shadow: var(--shadow); padding: 24px; }
.card + .card { margin-top: 18px; }
/* ...but not between cells of a grid: a pushed-down neighbour made the first cell of each row taller. */
.grid > .card, .sections > .card, .layout-side > .card { margin-top: 0; }
.grid, .sections { gap: 16px; }
.section-head { margin-top: 36px; margin-bottom: 14px; }
.section-head h2, .card > h2:first-child { font-size: 24px; }
.page-head { margin: 4px 0 28px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.page-head h1 { margin-bottom: 6px; }
.page-head .muted { max-width: 740px; line-height: 1.7; }
.crumbs { margin-bottom: 10px; }
.crumbs a:hover { color: var(--navy); }
/* 「返回上一级」 in front of the breadcrumbs on course and file pages. */
.crumbs .uplevel { display: inline-flex; align-items: center; margin-right: 10px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); font-weight: 600; }
.chip-sep { display: inline-block; width: 1px; height: 18px; margin: 0 4px; background: var(--line); vertical-align: middle; }
.lvl { display: inline-block; margin-left: 8px; padding: 0 7px; border-radius: 6px; font-size: 12px; font-weight: 600; line-height: 1.6; vertical-align: middle; border: 1px solid var(--line); color: var(--muted); }
.lvl-2 { background: rgba(240, 179, 159, .22); color: #ffe0d3; border-color: rgba(240, 179, 159, .45); }
.lvl-3 { background: rgba(242, 197, 140, .16); color: #ffe6c4; }
.crumbs .uplevel:hover { text-decoration: none; border-color: var(--navy-2); color: var(--navy); }

.btn { height: 40px; padding-inline: 17px; border-radius: 10px; font-weight: 550; box-shadow: 0 1px 1px rgba(70, 48, 31, .035); }
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn.primary, .nav .up, .fbfab { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }
.btn.primary:hover, .nav .up:hover, .fbfab:hover { background: var(--navy-2); border-color: var(--navy-2); color: var(--on-navy); }
.btn.sm { height: 32px; border-radius: 8px; }
.btn.lg { height: 48px; }
.input, select.input, textarea.input { min-height: 43px; background: var(--surface); border-color: var(--line); border-radius: 10px; }
.input:hover, select.input:hover, textarea.input:hover { border-color: var(--faint); }
.input::placeholder, .top input::placeholder, .bigsearch input::placeholder { color: var(--faint); }
.field { gap: 7px; margin-bottom: 17px; }
.field > span { font-weight: 550; color: var(--muted); }
.field > span em { color: var(--navy); }
.chip { border-color: var(--line); background: var(--surface); padding: 4px 11px; }
.chip:hover { border-color: var(--navy-2); }
.tag { border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.tag.t-T1 { background: #f8e8df; color: #9d4a35; }
.tag.t-T2 { background: #f7ebde; color: #8b5937; }
.tag.t-T3 { background: #e8f0e7; color: #477252; }
.tag.t-T4 { background: #f7efd9; color: #83662f; }
.tag.t-T5 { background: #e9edf0; color: #4d697b; }
.tag.t-T6 { background: #eee9f0; color: #725d7b; }
.tag.t-T7 { background: #efebe5; color: #675f55; }
.tag.t-T8 { background: #e5eff0; color: #4a7377; }
.tag.t-T9 { background: #f2e8ec; color: #835c6c; }
:root[data-theme="dark"] .tag, :root[data-theme="dark"] .badge.uncertain { filter: saturate(.65) brightness(.85); }
.badge.uncertain { background: #eee9f0; color: #725d7b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag[class*="t-T"],
  :root:not([data-theme="light"]) .badge.uncertain { background: var(--surface-2); color: var(--muted); filter: none; }
}
:root[data-theme="dark"] .tag[class*="t-T"],
:root[data-theme="dark"] .badge.uncertain { background: var(--surface-2); color: var(--muted); filter: none; }
.notice { border: 1px solid var(--line); border-left: 3px solid var(--navy); border-radius: 9px; }
.notice.warn { border-left-color: var(--warn); }
.notice.bad { border-left-color: var(--bad); }
.notice.ok { border-left-color: var(--ok); }

.hero { padding: clamp(44px, 8vw, 100px) 0 56px; }
.hero .logo { width: 46px; height: 46px; margin-bottom: 24px; border-radius: 12px; }
.hero h1 { font: 600 17px/1.4 var(--font); letter-spacing: .08em; margin-bottom: 9px; }
.hero h1 b { color: var(--text); }
.slogan { display: block; width: fit-content; max-width: 780px; margin: 0 auto 17px; padding: 0; background: none; color: var(--text); border-radius: 0; box-shadow: none; font: 500 clamp(30px, 5vw, 55px)/1.35 var(--font-heading); letter-spacing: -.035em; text-wrap: balance; }
.hero p { color: var(--muted); font-size: 15px; }
.bigsearch { max-width: 660px; margin-top: 28px; gap: 10px; }
.bigsearch input { height: 56px; border-radius: 13px; padding-inline: 20px; box-shadow: var(--shadow); }
.bigsearch input:focus { box-shadow: 0 0 0 3px var(--navy-soft); }
.bigsearch .btn { height: 56px; border-radius: 12px; padding-inline: 26px; }
.stats { margin-top: 30px; gap: 14px 30px; }
.stats b { font-family: var(--font-heading); font-size: 23px; font-weight: 500; }
.oss { background: var(--surface-2); box-shadow: none; padding: 18px 22px; }
.oss-icon { color: var(--text); }

.node-card, .course-card { min-height: 106px; padding: 21px; transition: border-color .15s, transform .15s, box-shadow .15s; }
.node-card:hover, .course-card:hover, .section-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(70, 48, 31, .075); }
.node-card h3, .course-card h3 { font-size: 19px; }
.section-card { padding: 22px; }
.section-card h3 { font-size: 20px; }
.tree .row-n { border-radius: 8px; padding: 6px 8px; }
.tree .row-n:hover { background: var(--surface-2); }
.tree ul { border-left-style: solid; }
.list { gap: 0; }
.item { padding: 17px 3px; gap: 16px; }
.item:hover { background: var(--surface-2); border-radius: 8px; padding-inline: 8px; margin-inline: -5px; }
.item .title { font-size: 15px; line-height: 1.5; }
.item .ficon { background: var(--surface-2); border-radius: 8px; }
.item .ficon.pdf { color: #a65040; } .item .ficon.doc, .item .ficon.docx { color: #567182; }
.item .ficon.ppt, .item .ficon.pptx { color: #b06a40; } .item .ficon.zip, .item .ficon.rar, .item .ficon.7z { color: #8c7543; }
.item .thumb { border-radius: 8px; }
.layout-side { gap: 22px; }

.drop { border-width: 1.5px; background: var(--surface-2); padding-block: 44px; }
.drop:hover, .drop.over { border-color: var(--navy); }
.picked, .bulkbar { border: 1px solid var(--line); }
.steps span { border-radius: 8px; }
.frow { padding: 16px; border-radius: 12px; }
.frow .gen { color: var(--navy); }
.tabs { gap: 8px; border-bottom-color: var(--line); }
.tabs button { padding: 10px 13px; border-radius: 8px 8px 0 0; }
.tabs button:hover { background: var(--surface-2); color: var(--text); }
.tabs button.on { background: var(--navy-soft); color: var(--navy); }
.tabs button .count { display: inline-block; min-width: 18px; margin-left: 5px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.tabs button .count[hidden] { display: none; }
.table th { background: var(--surface-2); color: var(--muted); }
.table th, .table td { padding: 11px 10px; }
.table tbody tr:hover { background: var(--surface-2); }
.kpi { border: 1px solid var(--line); background: var(--surface); padding: 16px; }
.kpi b { font: 500 28px/1.3 var(--font-heading); }
.auth-card { max-width: 460px; margin-block: 50px; padding: 30px; }
.help-toc { box-shadow: none; background: var(--surface-2); }
.help-toc a { border-radius: 7px; padding: 4px 8px; }
.help-toc a:hover { background: var(--surface); text-decoration: none; }
.help-body section { scroll-margin-top: 90px; }
pre.code, pre.textview, .secret { background: var(--surface-2); }
.modal { background: rgba(32, 25, 20, .58); backdrop-filter: blur(3px); }
.modal-box { border: 1px solid var(--line); border-radius: 16px; }
.modal-head { padding: 16px 20px; }
.modal-body { padding: 20px; }
.toast { color: var(--surface); }
.chart .bar-a { fill: var(--navy); }

@media (max-width: 720px) {
  .top .wrap { height: auto; gap: 8px 12px; padding-block: 10px; }
  .brand { font-size: 18px; }
  .nav { margin-left: auto; overflow-x: auto; max-width: 100%; }
  .nav a { padding: 6px 8px; font-size: 13px; }
  .top form { flex-basis: 100%; order: 3; max-width: none; margin: 0; }
  .wrap { padding-inline: 16px; }
  main { padding-top: 24px; padding-bottom: 48px; }
  .card { padding: 18px; }
  .hero { padding: 45px 0 40px; }
  .slogan { font-size: clamp(27px, 7vw, 39px); }
  .bigsearch { gap: 7px; }
  .bigsearch input { min-width: 0; font-size: 14px; padding-inline: 13px; }
  .bigsearch .btn { padding-inline: 15px; }
  .item .side { align-items: flex-start; }
  .page-head { margin-bottom: 20px; }
  .auth-card { margin-block: 20px; }
}

/* ---------- campus photograph and frosted glass ---------- */
:root, :root:not([data-theme="light"]), :root[data-theme="dark"] {
  --navy: #f0b39f;
  --navy-2: #ffd4c3;
  --navy-soft: rgba(240, 179, 159, .19);
  --on-navy: #291d21;
  --gold: #f2c58c;
  --bg: #101d2d;
  --surface: rgba(17, 29, 45, .62);
  --surface-2: rgba(24, 40, 57, .48);
  --line: rgba(255, 255, 255, .26);
  --text: #fffaf5;
  --muted: #eee9e4;
  --faint: #d2d5d9;
  --ok: #b9ebce;
  --ok-soft: rgba(78, 164, 113, .2);
  --warn: #ffe0a9;
  --warn-soft: rgba(198, 136, 52, .22);
  --bad: #ffb4aa;
  --bad-soft: rgba(189, 73, 66, .25);
  --shadow: 0 12px 35px rgba(5, 12, 23, .19), inset 0 1px rgba(255, 255, 255, .12);
  color-scheme: dark;
}
body { background: #101d2d; min-height: 100vh; }
/* The photograph sits on its own fixed layer: mobile browsers ignore `background-attachment:
   fixed` and would stretch it over the whole page, re-zooming it whenever the page height
   changes. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: #101d2d url('/assets/site/background.jpg?v=faaaa937c3df') center center / cover no-repeat;
}
.top, .foot, .card, .hero, .page-head, .tabs, .drop, .modal-box,
.suggest ul, .picked, .bulkbar, .frow, .kpi, .notice, .oss {
  background: var(--surface);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(20px) saturate(1.35);
  backdrop-filter: blur(20px) saturate(1.35);
  box-shadow: var(--shadow);
}
.top { background: rgba(16, 29, 45, .66); border-width: 0 0 1px; }
.foot { background: rgba(16, 29, 45, .66); border-width: 1px 0 0; }
.hero {
  max-width: 940px;
  margin: 44px auto 42px;
  padding: 48px 28px 43px;
  border-radius: 24px;
  background: rgba(16, 29, 45, .52);
  text-shadow: 0 1px 5px rgba(0, 0, 0, .15);
}
body[data-page="home"] .hero { position: relative; }
body[data-page="home"] .hero > :not(.home-calligraphy) { position: relative; z-index: 1; }
.home-calligraphy {
  position: absolute;
  z-index: 0;
  width: clamp(190px, 19vw, 250px);
  height: auto;
  opacity: .55;
  filter: invert(1) sepia(.15) saturate(.6);
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.home-calligraphy-left { left: clamp(-165px, calc(470px - 45vw), 0px); top: 47%; transform: translateY(-50%); }
.home-calligraphy-right { right: clamp(-165px, calc(470px - 45vw), 0px); top: 52%; transform: translateY(-50%); }
@media (max-width: 1200px) {
  .home-calligraphy { width: 160px; opacity: .4; }
  .home-calligraphy-left { left: -20px; top: 27%; }
  .home-calligraphy-right { right: -20px; top: 32%; }
}
@media (max-width: 900px) {
  .home-calligraphy { width: 130px; opacity: .32; }
  .home-calligraphy-left { left: -25px; }
  .home-calligraphy-right { right: -25px; }
}
@media (max-width: 720px) { .home-calligraphy-right { right: -10px; } }
@media (max-width: 480px) { .home-calligraphy { display: none; } }
.page-head { padding: 18px 22px; border-radius: var(--radius); }
.tabs { padding: 0 12px; border-radius: 12px; }
.card, .oss, .drop, .frow, .modal-box { border-color: rgba(255, 255, 255, .3); }
.card:hover, .oss:hover { border-color: rgba(255, 255, 255, .48); }
.oss, .help-toc { background: var(--surface); }
.oss .btn { text-shadow: none; }
.btn, .input, select.input, textarea.input, .top form input, .bigsearch input,
.chip, .toolbar select, .steps span, .secret, pre.code, pre.textview {
  background: rgba(20, 35, 52, .4);
  border-color: rgba(255, 255, 255, .32);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  backdrop-filter: blur(10px) saturate(1.2);
}
.btn:hover, .chip:hover, .tabs button:hover { background: rgba(255, 255, 255, .16); }
.btn.primary, .nav .up, .fbfab { background: var(--navy); border-color: rgba(255, 255, 255, .3); }
.btn.primary:hover, .nav .up:hover, .fbfab:hover { background: var(--navy-2); }
.top form input:focus, .input:focus, .bigsearch input:focus { background: rgba(17, 29, 45, .74); }
.input::placeholder, .top input::placeholder, .bigsearch input::placeholder { color: #dedfe1; }
.nav a { color: var(--text); }
.nav a:hover { background: rgba(255, 255, 255, .16); }
.nav a.on, .chip.on, .tabs button.on { background: var(--navy-soft); color: #ffe0d3; }
.tag[class*="t-T"], .badge.uncertain { background: rgba(255, 255, 255, .15); color: var(--text); border: 1px solid var(--line); filter: none; }
.item:hover, .tree .row-n:hover, .tree .row-n.on, .picklist li:hover, .table tbody tr:hover { background: rgba(255, 255, 255, .09); }
.table th, .kpi, .drop, .picked, .bulkbar { background: rgba(25, 42, 59, .48); }
.modal { background: rgba(7, 15, 27, .45); }
.modal-box { background: rgba(16, 29, 45, .82); }
.auth-card { background: rgba(17, 29, 45, .72); }
.notice { border-left-width: 3px; }
.fbfab { -webkit-backdrop-filter: blur(15px); backdrop-filter: blur(15px); }

/* On the first visit the landing page shows the photograph first (later visits in the
   same tab have html.seen and skip it); existing content then
   appears inside its glass panels without changing the page structure. */
html:not(.seen) body[data-page="home"] .top { animation: glass-reveal .8s ease-out .5s both; }
html:not(.seen) body[data-page="home"] .hero { animation: glass-reveal 1s cubic-bezier(.2, .7, .2, 1) .85s both; }
html:not(.seen) body[data-page="home"] .oss { animation: glass-reveal .8s ease-out 1.2s both; }
html:not(.seen) body[data-page="home"] .sections { animation: glass-reveal .8s ease-out 1.35s both; }
html:not(.seen) body[data-page="home"] .layout-side { animation: glass-reveal .8s ease-out 1.5s both; }
html:not(.seen) body[data-page="home"] .foot, html:not(.seen) body[data-page="home"] .fbfab { animation: glass-reveal .8s ease-out 1.5s both; }
@keyframes glass-reveal {
  from { opacity: 0; transform: translateY(16px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
@media (max-width: 720px) {
  .hero { margin: 24px auto 28px; padding: 36px 18px 30px; border-radius: 18px; }
  .page-head { padding: 16px 18px; }
}
@media print {
  :root, :root:not([data-theme="light"]), :root[data-theme="dark"] {
    --text: #111;
    --muted: #333;
    --faint: #555;
    --surface: #fff;
    --surface-2: #f5f5f5;
    --line: #ddd;
    --navy: #93432f;
    --on-navy: #fff;
    color-scheme: light;
  }
  body { background: #fff; color: #111; }
  .top, .foot, .card, .hero, .page-head { -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }
}

/* ---------- motion: page switches, content and dialogs ease in instead of popping */
@view-transition { navigation: auto; }
/* #anchor jumps stop below the sticky header instead of under it (two rows on phones). */
main h2[id], main section[id] { scroll-margin-top: 76px; }
@media (max-width: 720px) { main h2[id], main section[id] { scroll-margin-top: 116px; } }
/* A scrollbar that comes and goes between a short and a long page shifts everything sideways. */
html { scrollbar-gutter: stable; }
.top { view-transition-name: top; }
/* In-place page switch still waiting for the network (see app.js): a thin bar at the top. */
html.nav-busy::after { content: ""; position: fixed; top: 0; left: 0; z-index: 100; height: 2px; width: 30%; background: #ffe0d3; animation: nav-busy 1s ease-in-out infinite; }
@keyframes nav-busy { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@media (min-width: 721px) { .top { min-height: 61px; } }
::view-transition-group(top) { animation-duration: 0s; }
/* The old page stays fully drawn underneath while the new one fades in on top; fading both
   at once leaves a moment where neither covers the dark base and the screen flashes black. */
::view-transition-old(root), ::view-transition-new(root) { mix-blend-mode: normal; }
::view-transition-old(root) { animation: none; }
::view-transition-new(root) { animation: .2s cubic-bezier(.2, .7, .3, 1) both vt-in; }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }
/* Browsers without view transitions: the new content fades in once its data is there. */
main.nav-in { animation: fade .18s ease-out both; }
main.nav-wait { opacity: 0; }
@keyframes fade-up { from { opacity: 0; transform: translateY(4px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.list > .item, .tree > li, .sections > * { animation: fade-up .2s ease-out both; }
.modal { animation: fade .15s ease-out both; }
.modal-box { animation: pop .2s cubic-bezier(.2, .7, .3, 1) both; }
.toast { animation: fade-up .18s ease-out both; }
.btn, .nav a, .item { transition: background-color .15s, color .15s, border-color .15s, transform .1s; }
.btn:active:not(:disabled) { transform: scale(.97); }
a, button { -webkit-tap-highlight-color: transparent; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Home: every category card shows the same few rows of tags, so a long list (校选课's 35
   colleges) doesn't make its card much taller than the rest; 「展开全部」 opens one card. */
.home-lists { grid-template-columns: 1fr 1fr; }
#sections > .section-card { display: flex; flex-direction: column; }
#sections > .section-card .chips { align-content: flex-start; max-height: 142px; overflow: hidden; }
#sections > .section-card.clipped:not(.open) .chips {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent);
}
#sections > .section-card.open .chips { max-height: none; }
#sections .more {
  margin-top: auto; padding: 8px 0 0; align-self: flex-start; background: none; border: 0;
  color: var(--accent); font: inherit; font-size: 13px; cursor: pointer;
}
@media (min-width: 861px) {
  .home-lists > .card { height: 660px; display: flex; flex-direction: column; }
  .home-lists > .card > h2 { flex: none; }
  .home-lists .list {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 0 6px 20px 0;
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
  }
  .home-lists .item .title, .home-lists .item .subtitle, .home-lists .item .note {
    display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden;
  }
  .home-lists .item .title { -webkit-line-clamp: 2; line-clamp: 2; }
  .home-lists .item .subtitle, .home-lists .item .note { -webkit-line-clamp: 1; line-clamp: 1; }
}
@media (max-width: 860px) { .home-lists { grid-template-columns: 1fr; } }

/* Profile pictures: an image, or the first character of the nickname on a colour of its own. */
.avatar {
  --s: 28px; width: var(--s); height: var(--s); flex: none; border-radius: 50%;
  display: inline-grid; place-items: center; vertical-align: middle; overflow: hidden;
  font-size: calc(var(--s) * .48); font-weight: 600; line-height: 1; color: #fff;
  background: hsl(var(--h, 210) 38% 44%); user-select: none;
}
img.avatar { object-fit: cover; background: var(--surface-2); }
#nav-me { display: inline-flex; align-items: center; gap: 7px; }
#nav-me .avatar { margin: -3px 0; }
.who-inline { display: inline-flex; align-items: center; gap: 6px; }

/* 站内提醒: the unread count on the header link, and the list */
.nav .bell { position: relative; }
.nav .bell .count { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.notice-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.notice-item:last-child { border-bottom: 0; }
.bulletin { padding: 10px 0; border-bottom: 1px solid var(--line); }
.bulletin:last-child { border-bottom: 0; }
.bulletin.on { background: var(--navy-soft); border-radius: 8px; padding: 10px; }
.notice-item.unread .ntext { font-weight: 600; }
.notice-item.unread::before { content: ''; flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--bad); }
.notice-item.read::before { content: ''; flex: none; width: 8px; }
/* 统计 */
.statnums { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.statnums div { padding: 14px; border-radius: 12px; background: var(--surface-2); }
.statnums b { display: block; font-size: 24px; }
.rank { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.rank li { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); counter-increment: r; }
.rank li::before { content: counter(r); flex: none; width: 1.6em; color: var(--faint); font-weight: 700; }
.rank li .v { margin-left: auto; font-weight: 600; white-space: nowrap; }
.weekbars { display: flex; align-items: flex-end; gap: 3px; height: 140px; }
.weekbars i { flex: 1; min-width: 4px; border-radius: 3px 3px 0 0; background: var(--navy); opacity: .85; }

/* search pager: 跳到第几页 */
.jump { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.jump .input, .jump .input:focus { width: 4.5em; min-height: 32px; padding: 4px 6px; text-align: center; }

/* 合集: one row on the course page that opens to its files in order */
details.series { border-bottom: 1px solid var(--line); }
details.series:last-child { border-bottom: 0; }
details.series > summary { list-style: none; cursor: pointer; border-bottom: 0; }
details.series > summary::-webkit-details-marker { display: none; }
.item .ficon.series-icon { color: var(--navy-2); box-shadow: 3px -3px 0 -1px var(--surface), 3px -3px 0 0 var(--line), 6px -6px 0 -1px var(--surface), 6px -6px 0 0 var(--line); font-size: 12px; }
.series-toggle { align-self: center; flex: none; white-space: nowrap; }
.series-toggle::after { content: '展开 ▾'; }
details.series[open] .series-toggle::after { content: '收起 ▴'; }
.series-items { margin: 0 0 12px 18px; padding-left: 12px; border-left: 3px solid var(--navy-soft); }
.series-items .item:last-of-type { border-bottom: 1px solid var(--line); }
.series-no { flex: none; min-width: 1.8em; text-align: center; font-size: 12px; color: var(--faint); padding-top: 4px; font-variant-numeric: tabular-nums; }
.series-tools { padding: 10px 0 0; gap: 8px; }
.series-edit { margin: 0; padding: 0; list-style: none; counter-reset: s; max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.series-edit li { display: flex; gap: 6px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); counter-increment: s; }
.series-edit li:last-child { border-bottom: 0; }
.series-edit li:not(.faint)::before { content: counter(s); min-width: 1.8em; color: var(--faint); font-size: 12px; }
.series-edit .grow { min-width: 0; overflow-wrap: anywhere; }
.series-add { margin-top: 10px; }
.series-add #s_more { max-height: 30vh; overflow: auto; }
.series-cand { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.series-card .series-name { margin: 6px 0 10px; font-weight: 600; overflow-wrap: anywhere; }
.series-nav { gap: 8px; margin-bottom: 10px; }
.series-nav .btn { flex: 1; justify-content: center; text-align: center; }
.series-nav [aria-disabled] { opacity: .45; pointer-events: none; }
.series-list { margin: 0; padding: 0; list-style: none; max-height: 340px; overflow: auto; position: relative; border-top: 1px solid var(--line); }
.series-list li { display: flex; gap: 6px; align-items: baseline; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 14px; overflow-wrap: anywhere; min-width: 0; }
.series-list li.on { background: var(--navy-soft); border-radius: 6px; }
.series-review { margin: 8px 0 0; padding-left: 22px; font-size: 14px; }
.series-review li.add::marker { content: '＋ '; color: var(--ok); }
.series-review li.add a { color: var(--ok); }
.series-review li.gone { text-decoration: line-through; color: var(--faint); }
@media (max-width: 640px) { .series-items { margin-left: 4px; padding-left: 6px; } .series-no { min-width: 1.2em; } .series-items .item { gap: 8px; } }
