/* =============================================================================
 * base.css —— reset + 排版 + 布局工具类 + 断点可见性 + 防溢出
 * 顺序：tokens.css → base.css → components.css → shell.css → student/teacher.css
 * ========================================================================== */

@font-face {
  font-family: 'ClassicRoundSC';
  /* 与工程同一份字体（src/static 会原样进构建产物），保证设计稿与 App 字形一致 */
  src: url('static/fonts/classic-round.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }

/* 组件类会写 display（.page 是 flex），必须让 [hidden] 仍然生效 ——
   否则 hub 页里被隐藏的模块面板会一起排下来（真机上表现为首页下面拖出几百 px）。 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  letter-spacing: var(--ls);
  font-size: var(--f-body);
  line-height: var(--lh);
  color: var(--ink-3);
  background: var(--surface-2);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;                /* 页面壳体自己管理滚动，避免双滚动条 */
}

h1, h2, h3, h4, p, figure, figcaption, blockquote, pre, fieldset, ul, ol, dl {
  margin: 0;
}
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
img, svg, video { display: block; max-width: 100%; }
a { color: var(--brand-dd); text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ------------------------------- 排版工具类 ------------------------------- */
.t-display { font-size: var(--f-display); font-weight: 700; color: var(--ink-1); line-height: var(--lh-tight); }
.t-h1 { font-size: var(--f-h1); font-weight: 700; color: var(--ink-1); line-height: var(--lh-tight); }
.t-h2 { font-size: var(--f-h2); font-weight: 600; color: var(--ink-1); line-height: var(--lh-tight); }
.t-h3 { font-size: var(--f-h3); font-weight: 600; color: var(--ink-1); line-height: var(--lh-tight); }
.t-lg { font-size: var(--f-lg); font-weight: 600; color: var(--ink-1); }
.t-body { font-size: var(--f-body); color: var(--ink-3); }
.t-sm { font-size: var(--f-sm); color: var(--ink-3); }
.t-xs { font-size: var(--f-xs); color: var(--ink-4); }
.t-cap { font-size: var(--f-cap); }
.t-muted { color: var(--ink-3); }
.t-faint { color: var(--ink-4); }
.t-inv { color: var(--ink-inv); }
.t-brand { color: var(--brand-dd); }
.t-ok { color: var(--green-d); }
.t-warn { color: var(--orange-d); }
.t-dan { color: var(--red-d); }
.t-b { font-weight: 700; }
.t-num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.t-trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.t-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.t-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.t-center { text-align: center; }
.t-right { text-align: right; }

/* ------------------------------- 布局工具类 ------------------------------- */
.grid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-keep { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
/* 列数随断点收敛：平板竖屏最多 2 列，手机 1 列（4 项类保留 2 列，避免 4 行堆叠） */
@media (min-width: 701px) and (max-width: 1100px) {
  .g-3, .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack-2 { gap: var(--s2); }
.stack-3 { gap: var(--s3); }
.stack-6 { gap: var(--s6); }
.stack-8 { gap: var(--s8); }

.row { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.row-2 { gap: var(--s2); }
.row-4 { gap: var(--s4); }
.row-6 { gap: var(--s6); }
.col { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { justify-content: center; align-items: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.mt-2 { margin-top: var(--s2); } .mt-3 { margin-top: var(--s3); } .mt-4 { margin-top: var(--s4); }
.mt-6 { margin-top: var(--s6); } .mt-8 { margin-top: var(--s8); }
.mb-2 { margin-bottom: var(--s2); } .mb-3 { margin-bottom: var(--s3); } .mb-4 { margin-bottom: var(--s4); }
.mb-6 { margin-bottom: var(--s6); } .mb-8 { margin-bottom: var(--s8); }

/* ------------------------------- 断点可见性 ------------------------------- */
.only-phone, .only-tablet, .only-pc { display: none !important; }
@media (max-width: 700px) { .only-phone { display: revert !important; } }
@media (min-width: 701px) and (max-width: 1100px) { .only-tablet { display: revert !important; } }
@media (min-width: 1101px) { .only-pc { display: revert !important; } }
.hide-phone { }
@media (max-width: 700px) { .hide-phone { display: none !important; } }
@media (max-width: 1100px) { .hide-narrow { display: none !important; } }

/* ------------------------------- 防溢出 ------------------------------- */
.stack > *, .row > *, .grid > *, .col > * { min-width: 0; }
img, svg { max-width: 100%; }

/* 滚动容器统一：细滚动条、触摸顺滑 */
.scroll { overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: rgba(82, 67, 55, 0.18); border-radius: var(--r-pill); }
.scroll::-webkit-scrollbar-thumb:hover { background: rgba(82, 67, 55, 0.3); }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* 屏幕阅读器专用 */
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--s4); top: -60px; z-index: var(--z-probe);
  background: var(--brand); color: #fff; padding: 10px 16px; border-radius: var(--r-sm);
  transition: top var(--dur-2) var(--ease);
}
.skip-link:focus { top: var(--s4); }

/* 页面进入动画（交错淡入） */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rise { animation: rise var(--dur-4) var(--ease) both; }
.rise-2 { animation-delay: 60ms; }
.rise-3 { animation-delay: 120ms; }
.rise-4 { animation-delay: 180ms; }
