:root {
  --bg: #0b0c0f;
  --card: #121419;
  --text: #e7eaf0;
  --muted: #b9c0cc;
  --accent: #6ea8fe;
  --border: #232734;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --scroll-track: #0f131a;
  --scroll-thumb: #2a3344;
  --scroll-thumb-hover: #3a4a5f;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif;
  background: radial-gradient(1200px 1200px at 10% -10%, rgba(110,168,254,.15), transparent 60%),
              radial-gradient(900px 900px at 110% 10%, rgba(110,168,254,.08), transparent 60%),
              var(--bg);
  color: var(--text);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

/* 全局滚动条样式（深色） */
* {
  scrollbar-width: thin;               /* Firefox */
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

/* WebKit 浏览器 */
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: var(--scroll-track);
}
*::-webkit-scrollbar-thumb {
  background-color: var(--scroll-thumb);
  border-radius: 8px;
  border: 2px solid var(--scroll-track);
}
*::-webkit-scrollbar-thumb:hover {
  background-color: var(--scroll-thumb-hover);
}

.site-header, .site-footer {
  backdrop-filter: blur(6px);
  background: linear-gradient(180deg, rgba(20,22,28,.85), rgba(18,20,25,.75));
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.site-footer { border-top: 1px solid var(--border); border-bottom: none; }

.header-inner, .footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 24px;
}

.site-title { margin: 0; font-size: 22px; font-weight: 700; }
.site-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.menu-btn { display: none; margin-left: auto; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: #141821; color: var(--text); cursor: pointer; }
.menu-btn:hover { border-color: rgba(110,168,254,.5); }

.container { 
  flex: 1; 
  overflow: hidden; 
  max-width: 1400px; 
  margin: 0 auto; 
  padding: 18px 24px; 
}

.layout { 
  display: grid; 
  grid-template-columns: 320px 1fr; 
  gap: 20px; 
  height: 100%; 
  overflow: hidden; 
}

.sidebar { 
  height: 100%; 
  overflow: hidden; 
}

.sidebar-card { 
  height: 100%; 
  display: flex; 
  flex-direction: column; 
  overflow: hidden;
  margin: 0;
}

.sidebar-card .card-body {
  flex: 1;
  overflow: hidden;
  padding: 0;
}

.article-list { 
  height: 100%;
  overflow-y: auto; 
  display: flex; 
  flex-direction: column; 
  gap: 8px; 
  padding: 16px;
  padding-right: 12px; 
}

.content { 
  height: 100%; 
  overflow-y: auto; 
  overflow-x: hidden;
  display: flex; 
  flex-direction: column; 
  gap: 16px; 
  padding-right: 8px;
}
.article-item { display: block; text-decoration: none; color: inherit; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #141821; transition: border-color .15s, background .15s; cursor: pointer; }
.article-item:hover { border-color: rgba(110,168,254,.35); background: #161b25; }
.article-item.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px rgba(110,168,254,.35); }
.article-item .title { font-weight: 600; }
.article-item .meta { margin-top: 4px; font-size: 12px; color: var(--muted); }

.card {
  background: linear-gradient(180deg, rgba(21,23,29,1), rgba(16,18,23,1));
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin: 0;
  flex-shrink: 0;
}

.content .card {
  overflow: visible;
}

.card-header { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-header h2, .card-header h3, .card-header h4 { margin: 0; }
.card-body { padding: 16px; }

.sidebar-header { display: flex; align-items: center; gap: 10px; }
.search-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #141821;
  color: var(--text);
  outline: none;
}
.search-input::placeholder { color: #7c8596; }
.search-input:focus { border-color: rgba(110,168,254,.5); box-shadow: 0 0 0 2px rgba(110,168,254,.15) inset; }

.meta { margin-top: 8px; display: flex; gap: 12px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }

.prose { white-space: pre-wrap; word-break: break-word; }
.prose.muted { color: var(--muted); }

.knowledge { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.knowledge.poetry-mode { grid-template-columns: 1fr; max-width: 600px; }
.knowledge-group { 
  border: 1px dashed var(--border); 
  border-radius: 12px; 
  display: flex;
  flex-direction: column;
  height: 280px;
  overflow: hidden;
}
.knowledge-group h4 { 
  margin: 0; 
  padding: 12px 14px; 
  border-bottom: 1px dashed var(--border); 
  color: var(--accent); 
  font-size: 15px; 
  flex-shrink: 0;
}
.knowledge-group ul { 
  margin: 0; 
  padding: 12px 16px; 
  list-style: none; 
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.knowledge-group .empty {
  color: var(--muted);
  text-align: center;
  padding: 16px 0;
}

.kv-list li { display: grid; grid-template-columns: minmax(92px, auto) 1fr; gap: 12px; padding: 8px 0; }
.kv-list li + li { border-top: 1px dashed var(--border); }
.kv-list .k { color: #dce3ef; font-weight: 600; }
.kv-list .v { color: var(--muted); }

.am-list li { padding: 10px 0; }
.am-list li + li { border-top: 1px dashed var(--border); }
.am-list .w { color: #dce3ef; font-weight: 600; }
.am-list .pair { display: grid; grid-template-columns: 88px 1fr; gap: 10px; color: var(--muted); margin-top: 6px; }

.poly-list li { padding: 10px 0; }
.poly-list li + li { border-top: 1px dashed var(--border); }
.poly-list .w { color: #dce3ef; font-weight: 600; }
.poly-list .meaning { color: var(--muted); margin-top: 6px; }
.poly-list .badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: rgba(110,168,254,.14); color: var(--accent); font-size: 12px; margin-left: 8px; vertical-align: middle; }

.wc-list li { padding: 10px 0; }
.wc-list li + li { border-top: 1px dashed var(--border); }
.wc-list .w { color: #dce3ef; font-weight: 600; }
.wc-list .pair { display: grid; grid-template-columns: 108px 1fr; gap: 10px; color: var(--muted); margin-top: 6px; }

.ann-list li { padding: 10px 0; }
.ann-list li + li { border-top: 1px dashed var(--border); }
.ann-list .frag { color: #dce3ef; font-weight: 600; }
.ann-list .ann { color: var(--muted); margin-top: 6px; }

.notice { background: #1a1f2b; color: #c9d2e3; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 16px 0; }
.notice.error { border-color: #4b1f28; background: #201218; color: #f0cbd2; }

.site-footer a {
  color: #ffffff;
  text-decoration: none;
}

@media (min-width: 1200px) {
  .knowledge { grid-template-columns: 1fr 1fr 1fr; }
  .knowledge-group { height: 260px; }
}

@media (max-width: 1000px) {
  .knowledge { grid-template-columns: 1fr; }
  .knowledge-group { height: 240px; }
}

@media (max-width: 920px) {
  .container { padding: 12px 16px; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .layout { grid-template-columns: 1fr; }

  /* 抽屉：左侧目录 */
  .sidebar { 
    position: fixed; 
    top: 56px; 
    left: 0; 
    width: 82vw; 
    max-width: 360px; 
    height: calc(100dvh - 56px); 
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 40;
  }
  .sidebar.open { transform: translateX(0); }
  .drawer-mask { 
    position: fixed; inset: 0; 
    background: rgba(0,0,0,.45); 
    backdrop-filter: blur(1px);
    z-index: 30;
  }
  .sidebar-card { height: 100%; }
  .sidebar-card .card-body { flex: 1; overflow: hidden; padding: 0; }
  .article-list { height: 100%; overflow-y: auto; padding: 12px; padding-right: 8px; }
  .content { height: calc(100dvh - 56px); overflow-y: auto; }
  .knowledge { grid-template-columns: 1fr; }
  .knowledge-group { height: 260px; }
  /* 提升手机模式下“课下注释”分组的可视高度 */
  #annotations.knowledge-group { height: 420px; }
}


