/* ===========================================================
   软件工程本科生宝典 — Design System
   Zero external dependencies. Mobile-first. Light/Dark.
   =========================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC",
    "WenQuanYi Micro Hei", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono",
    "Courier New", monospace;

  --bg: #f5f6fa;
  --bg-soft: #eef0f6;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --text: #1b1f2a;
  --text-2: #4a5266;
  --text-3: #7b8398;
  --border: #e2e6ee;
  --border-2: #cfd6e4;

  --primary: #3b5bdb;
  --primary-soft: #eaefff;
  --primary-text: #2f4bc0;
  --accent: #7048e8;
  --accent-soft: #f0ebff;

  --ok: #0f9d58;
  --ok-soft: #e6f6ee;
  --warn: #e8590c;
  --warn-soft: #fff1e6;
  --danger: #d6336c;
  --danger-soft: #ffecf2;
  --info: #0b7285;
  --info-soft: #e3f6f9;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(20, 26, 45, .06), 0 1px 3px rgba(20, 26, 45, .04);
  --shadow: 0 2px 6px rgba(20, 26, 45, .07), 0 8px 24px rgba(20, 26, 45, .06);
  --shadow-lg: 0 10px 40px rgba(20, 26, 45, .14);

  --sidebar-w: 264px;
  --content-max: 880px;
  --toc-w: 220px;
  --nav-h: 56px;
  --bottom-h: 58px;
  --gutter: 20px;
}

html[data-theme="dark"] {
  --bg: #0e1016;
  --bg-soft: #13161e;
  --surface: #171b24;
  --surface-2: #1c212c;
  --text: #e7eaf2;
  --text-2: #a8b0c2;
  --text-3: #7e879c;
  --border: #262c39;
  --border-2: #333b4c;

  --primary: #7d9bff;
  --primary-soft: #1a2340;
  --primary-text: #a8bcff;
  --accent: #b197fc;
  --accent-soft: #241f3d;

  --ok: #4ade80;
  --ok-soft: #10281c;
  --warn: #fbbf24;
  --warn-soft: #2a2011;
  --danger: #f472b6;
  --danger-soft: #2d1424;
  --info: #67e8f9;
  --info-soft: #0d2830;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 8px rgba(0, 0, 0, .45), 0 12px 32px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 56px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.78;
  color: var(--text);
  background: var(--bg);
  overflow-wrap: break-word;
  word-break: break-word;
}

h1, h2, h3, h4, h5 { line-height: 1.35; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: 1.72rem; letter-spacing: -.02em; }
h2 { font-size: 1.32rem; letter-spacing: -.01em; }
h3 { font-size: 1.08rem; }
h4 { font-size: .98rem; }
p { margin: 0 0 1em; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: .12em .38em;
  border-radius: 5px;
  color: var(--text);
}
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ============ TOP BAR ============ */
.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar__menu {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: 0 0 38px;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; cursor: pointer; color: var(--text);
}
.topbar__brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; letter-spacing: -.02em; color: var(--text);
  font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__brand:hover { text-decoration: none; }
.topbar__logo {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; display: grid; place-items: center;
  font-size: 13px; font-weight: 800; font-family: var(--font-mono);
}
.topbar__spacer { flex: 1 1 auto; min-width: 4px; }
.topbar__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; min-width: 38px; padding: 0 10px;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; cursor: pointer; color: var(--text-2);
  font-size: .82rem; font-family: inherit; white-space: nowrap;
}
.topbar__btn:hover { border-color: var(--border-2); color: var(--text); }
.topbar__btn svg { width: 17px; height: 17px; flex: 0 0 17px; }
.topbar__search-hint { display: none; }

@media (min-width: 900px) {
  .topbar__menu { display: none; }
  .topbar__search-hint { display: inline; color: var(--text-3); }
}

/* ============ LAYOUT ============ */
.shell { display: flex; align-items: flex-start; gap: 0; max-width: 1500px; margin: 0 auto; }

.sidebar {
  flex: 0 0 var(--sidebar-w); width: var(--sidebar-w);
  position: sticky; top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 10px 40px 16px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  scrollbar-width: thin;
}
.sidebar__group { margin-bottom: 18px; }
.sidebar__title {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--text-3); padding: 0 10px; margin-bottom: 6px;
}
.sidebar__link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-2); font-size: .875rem; line-height: 1.4;
  transition: background .14s, color .14s;
}
.sidebar__link:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.sidebar__link.is-active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.sidebar__ico { flex: 0 0 18px; width: 18px; text-align: center; font-size: 15px; line-height: 1; }
.sidebar__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__badge {
  flex: 0 0 auto; font-size: .68rem; font-weight: 700;
  background: var(--bg-soft); color: var(--text-3);
  padding: 1px 6px; border-radius: 20px; font-family: var(--font-mono);
}

.main { flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; gap: 24px; padding: 0 var(--gutter); }
.content { flex: 1 1 auto; min-width: 0; max-width: var(--content-max); padding: 26px 0 96px; }
.toc {
  display: none; flex: 0 0 var(--toc-w); width: var(--toc-w);
  position: sticky; top: calc(var(--nav-h) + 26px);
  max-height: calc(100vh - var(--nav-h) - 60px); overflow-y: auto;
  padding: 26px 0 40px; font-size: .8rem; scrollbar-width: thin;
}
.toc__title { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.toc__list { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.toc__list a { display: block; padding: 4px 10px; color: var(--text-3); line-height: 1.45; }
.toc__list a:hover { color: var(--text); text-decoration: none; }
.toc__list a.is-active { color: var(--primary-text); font-weight: 600; border-left: 2px solid var(--primary); margin-left: -2px; }
.toc__list li.lv3 a { padding-left: 22px; font-size: .76rem; }

@media (min-width: 1100px) { .toc { display: block; } }

/* ============ MOBILE DRAWER ============ */
.scrim {
  position: fixed; inset: 0; background: rgba(10, 14, 26, .5);
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 70;
}
body.nav-open .scrim { opacity: 1; pointer-events: auto; }
body.nav-open { overflow: hidden; }

@media (max-width: 899px) {
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 80;
    width: min(86vw, 320px); flex-basis: auto;
    height: 100vh; padding-top: 16px;
    transform: translateX(-102%); transition: transform .26s ease;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .main { padding: 0 16px; }
  .content { padding-top: 20px; padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}

/* ============ BOTTOM NAV (mobile) ============ */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 65;
  display: flex; align-items: stretch;
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
}
.bottomnav__item {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-3); font-size: .68rem; line-height: 1.1;
}
.bottomnav__item:hover { text-decoration: none; }
.bottomnav__item.is-active { color: var(--primary-text); font-weight: 700; }
.bottomnav__ico { font-size: 19px; line-height: 1; }
@media (min-width: 900px) { .bottomnav { display: none; } }

/* ============ BREADCRUMB / HEADER ============ */
.crumbs { font-size: .8rem; color: var(--text-3); margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--primary-text); }
.crumbs span.sep { opacity: .5; }

.page-head { margin-bottom: 24px; }
.page-head__kicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--primary-text); background: var(--primary-soft);
  padding: 3px 10px; border-radius: 20px; margin-bottom: 10px;
}
.page-head h1 { margin-bottom: .35em; }
.page-head__lead { color: var(--text-2); font-size: 1rem; margin: 0; }

/* ============ CARDS ============ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card--flush { padding: 0; overflow: hidden; }
.card__head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.card__head h3 { margin: 0; font-size: 1rem; flex: 1 1 auto; min-width: 0; }
.card__body { padding: 16px 18px; }
.card__body > :last-child { margin-bottom: 0; }

.grid { display: grid; gap: 14px; }
.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 780px) { .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1150px) { .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* 指标卡：移动端两列，避免六张卡纵向过长 */
.grid--stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .grid--stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* link cards (index pages) */
.linkcard {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px;
  box-shadow: var(--shadow-sm); transition: transform .16s, box-shadow .16s, border-color .16s;
  height: 100%;
}
a.linkcard { color: inherit; }
a.linkcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-2); text-decoration: none; }
.linkcard__ico {
  flex: 0 0 40px; width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center; font-size: 20px; line-height: 1;
  background: var(--primary-soft);
}
.linkcard__body { flex: 1 1 auto; min-width: 0; }
.linkcard__title { font-weight: 700; font-size: .96rem; margin-bottom: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.linkcard__desc { font-size: .845rem; color: var(--text-2); line-height: 1.6; margin: 0; }
.linkcard__meta { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 5px; }

/* ============ BADGES / PILLS ============ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .72rem; font-weight: 600; line-height: 1.5;
  padding: 2px 8px; border-radius: 20px;
  background: var(--bg-soft); color: var(--text-2); border: 1px solid var(--border);
  white-space: nowrap; max-width: 100%;
}
.badge--primary { background: var(--primary-soft); color: var(--primary-text); border-color: transparent; }
.badge--accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge--ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge--warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge--danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge--info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge--mono { font-family: var(--font-mono); font-size: .7rem; }

/* rating bars */
.rate { display: inline-flex; align-items: center; gap: 5px; }
.rate__bar { display: inline-flex; gap: 2px; }
.rate__dot { width: 6px; height: 6px; border-radius: 2px; background: var(--border-2); }
.rate__dot.on { background: var(--primary); }
.rate__num { font-size: .72rem; color: var(--text-3); font-family: var(--font-mono); }

/* ============ LISTS ============ */
.list { list-style: none; margin: 0 0 1em; padding: 0; }
.list li { position: relative; padding-left: 20px; margin-bottom: .5em; }
.list li::before {
  content: ""; position: absolute; left: 6px; top: .68em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--primary); opacity: .55;
}
.list--check li::before { content: "▸"; background: none; width: auto; height: auto; left: 3px; top: 0; color: var(--primary); opacity: 1; font-size: .9em; }
.list--num { counter-reset: n; }
.list--num li { counter-increment: n; padding-left: 30px; }
.list--num li::before {
  content: counter(n); background: var(--primary-soft); color: var(--primary-text);
  width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center;
  font-size: .7rem; font-weight: 700; top: .28em; left: 0; opacity: 1; font-family: var(--font-mono);
}
.list--warn li::before { background: var(--warn); }
.list--num.list--warn li::before { background: var(--warn-soft); color: var(--warn); }

/* ============ SECTION BLOCKS ============ */
.block { margin-bottom: 26px; }
.block__title {
  display: flex; align-items: center; gap: 9px;
  font-size: 1.06rem; font-weight: 700; margin: 0 0 12px;
  padding-bottom: 8px; border-bottom: 2px solid var(--border);
}
.block__title .ico { font-size: 1.05em; line-height: 1; }
.section { scroll-margin-top: calc(var(--nav-h) + 16px); }
.subsection { margin: 18px 0; }
.subsection__h { font-size: .95rem; font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 7px; }
.muted { color: var(--text-3); font-size: .85rem; }
.small { font-size: .85rem; }
.note { color: var(--text-2); font-size: .9rem; }

/* callouts */
.callout {
  border-radius: var(--radius); padding: 14px 16px; margin: 14px 0;
  border: 1px solid var(--border); border-left: 4px solid var(--primary);
  background: var(--surface-2); font-size: .92rem;
}
.callout > :last-child { margin-bottom: 0; }
.callout__h { font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 7px; }
.callout--warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout--ok { border-left-color: var(--ok); background: var(--ok-soft); }
.callout--danger { border-left-color: var(--danger); background: var(--danger-soft); }
.callout--info { border-left-color: var(--info); background: var(--info-soft); }
.callout--accent { border-left-color: var(--accent); background: var(--accent-soft); }

/* ============ TABLES ============ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 14px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; min-width: 560px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; font-size: .78rem; color: var(--text-2); white-space: nowrap; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.num { font-family: var(--font-mono); text-align: center; white-space: nowrap; }

/* ============ TIMELINE ============ */
.timeline { position: relative; margin: 0; padding: 0 0 0 30px; list-style: none; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline > li { position: relative; padding-bottom: 18px; }
.timeline > li::before {
  content: ""; position: absolute; left: -25px; top: 7px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--primary);
}
.timeline > li.is-done::before { background: var(--primary); }
.timeline__t { font-weight: 700; font-size: .9rem; margin-bottom: 3px; }

/* ============ SEMESTER / COURSE / CAREER CARDS ============ */
.hcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px;
}
.hcard__top { display: flex; align-items: flex-start; gap: 11px; }
.hcard__ico { flex: 0 0 42px; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 21px; background: var(--primary-soft); }
.hcard h3 { margin: 0 0 2px; font-size: 1rem; }
.hcard__sub { font-size: .8rem; color: var(--text-3); margin: 0; }
.hcard__desc { font-size: .875rem; color: var(--text-2); margin: 0; flex: 1 1 auto; }
.hcard__foot { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }

/* pills / filter bar */
.filterbar { display: flex; flex-wrap: wrap; gap: 7px; margin: 4px 0 18px; }
.chip {
  font-size: .8rem; font-weight: 600; padding: 6px 13px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; font-family: inherit; transition: all .15s; white-space: nowrap;
}
.chip:hover { border-color: var(--border-2); color: var(--text); }
.chip.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
html[data-theme="dark"] .chip.is-active { color: #0e1016; }

.filterbox {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; padding: 8px 12px; margin-bottom: 14px; max-width: 420px;
}
.filterbox input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font-size: .9rem; font-family: inherit; }

/* ============ RESOURCE ITEMS ============ */
.resgroup { margin-bottom: 24px; }
.resgroup__head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.resgroup__name { font-weight: 700; font-size: 1rem; }
.resgroup__note { font-size: .83rem; color: var(--text-3); margin: 0 0 12px; }
.reslist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.resitem {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; background: var(--surface);
}
.resitem__head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.resitem__title { font-weight: 700; font-size: .92rem; }
.resitem__title a { color: var(--primary-text); }
.resitem__meta { font-size: .76rem; color: var(--text-3); }
.resitem__note { font-size: .85rem; color: var(--text-2); margin: 0; line-height: 1.65; }
.tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* ============ SEARCH OVERLAY ============ */
.searchmodal {
  position: fixed; inset: 0; z-index: 200; display: none;
  background: rgba(10, 14, 26, .55); padding: 0;
}
body.search-open .searchmodal { display: block; }
.searchmodal__panel {
  background: var(--surface); width: 100%; height: 100%;
  display: flex; flex-direction: column;
}
@media (min-width: 700px) {
  .searchmodal { padding: 8vh 20px 20px; }
  .searchmodal__panel {
    max-width: 660px; margin: 0 auto; height: auto; max-height: 78vh;
    border-radius: var(--radius-lg); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg); overflow: hidden;
  }
}
.searchmodal__in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.searchmodal__in input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font-size: 1rem; font-family: inherit; }
.searchmodal__close { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 5px 9px; cursor: pointer; color: var(--text-3); font-size: .75rem; font-family: inherit; }
.searchmodal__res { overflow-y: auto; padding: 8px; flex: 1 1 auto; -webkit-overflow-scrolling: touch; }
.sres { display: block; padding: 10px 12px; border-radius: var(--radius-sm); color: inherit; }
.sres:hover, .sres.is-sel { background: var(--bg-soft); text-decoration: none; }
.sres__t { font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.sres__d { font-size: .8rem; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sres__empty { padding: 28px 16px; text-align: center; color: var(--text-3); font-size: .88rem; }

/* ============ MISC ============ */
.progress-track { height: 8px; border-radius: 20px; background: var(--bg-soft); overflow: hidden; }
.progress-track > span { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.stat { text-align: center; padding: 14px 10px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.stat__n { font-size: 1.55rem; font-weight: 800; font-family: var(--font-mono); color: var(--primary-text); line-height: 1.2; letter-spacing: -.02em; }
.stat__l { font-size: .76rem; color: var(--text-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 10px; font-size: .87rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.btn:hover { border-color: var(--border-2); text-decoration: none; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
html[data-theme="dark"] .btn--primary { color: #0e1016; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: none; }
.btn--sm { padding: 6px 11px; font-size: .8rem; }
.btn--done { background: var(--ok-soft); border-color: transparent; color: var(--ok); }

.totop {
  position: fixed; right: 14px; bottom: calc(var(--bottom-h) + 14px + env(safe-area-inset-bottom, 0px));
  z-index: 60; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  box-shadow: var(--shadow); cursor: pointer; display: none; place-items: center; font-size: 18px;
}
.totop.show { display: grid; }
@media (min-width: 900px) { .totop { bottom: 24px; right: 24px; } }

footer.foot {
  border-top: 1px solid var(--border); margin-top: 30px; padding: 22px 0 8px;
  font-size: .8rem; color: var(--text-3);
}
footer.foot a { color: var(--text-3); }
.foot__grid { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; }

.nextprev { display: flex; gap: 10px; margin-top: 30px; flex-wrap: wrap; }
.nextprev > * { flex: 1 1 200px; }
.nextprev a {
  display: block; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 14px; background: var(--surface); color: inherit;
}
.nextprev a:hover { border-color: var(--border-2); text-decoration: none; }
.nextprev__l { font-size: .72rem; color: var(--text-3); }
.nextprev__t { font-weight: 600; font-size: .88rem; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .87rem; }
.kv dt { color: var(--text-3); white-space: nowrap; }
.kv dd { margin: 0; }

.two-col { display: grid; gap: 0 22px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.hide { display: none !important; }

/* ============ PRINT ============ */
@media print {
  .sidebar, .topbar, .bottomnav, .toc, .totop, .searchmodal, .nextprev, .filterbar, .filterbox, .scrim { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .main { padding: 0; }
  .content { max-width: none; padding: 0; }
  .card, .linkcard, .resitem, .hcard { border-color: #ccc; box-shadow: none; break-inside: avoid; }
  a { color: #000; }
  a[href^="http"]:after { content: " (" attr(href) ")"; font-size: 8pt; color: #666; }
  .section { break-before: auto; }
  h2 { break-after: avoid; }
}
