﻿/* ═══════════════════════════════════════
   江西兴国平川中学 — 校本资源交互教学平台
   Physics Blueprint 主题
   ═══════════════════════════════════════ */

/* ── 配色变量 ── */
:root {
  --bg-body:          #eef1f5;
  --bg-container:     #ffffff;
  --bg-canvas:        #fafbfc;
  --bg-controls:      #f8f9fb;
  --bg-nav-hover:     #e3e8ef;

  --text-primary:     #1a2a3a;
  --text-secondary:   #7f8c8d;
  --text-light:       #8895a0;
  --text-on-primary:  #ffffff;

  --border-light:     #e8ecf0;
  --border-canvas:    #dee4ea;
  --border-divider:   #eef2f5;

  --accent-blue:      #3d7eba;
  --accent-blue-hover:#2e6ba5;
  --accent-blue-light: #e8f0f8;

  --color-yellow:     #f0a030;
  --color-green:      #2ecc71;
  --color-red:        #d63a2e;

  --btn-sec-bg:       #ecf0f1;
  --btn-sec-hover:    #d5dbde;

  --header-height:    auto;
  --nav-height:       48px;
  --max-width:        1200px;
  --radius:           12px;
  --radius-sm:        8px;
  --shadow:           0 2px 12px rgba(0,0,0,0.06);
  --shadow-hover:     0 4px 20px rgba(0,0,0,0.10);
  --transition:       0.2s ease;
}

/* ── 全局重置 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── 根字体自适应缩放 ──
   vw 让所有 rem 单位随视口宽度比例变化。
   这是全站屏幕适配的唯一主轴——所有 font-size / padding / gap / margin
   都应使用 rem 或 em 单位，避免写死 px。
   ─ 桌面（≥641px）：clamp(15px, 4.8vw, 18px)
   ─ 手机（≤640px）：clamp(17px, 5.6vw, 20px) 再额外放大一档
   在 393px 手机上 1rem ≈ 20px（比浏览器默认大 25%） */
html { font-size: clamp(15px, 4.8vw, 18px); }
@media (max-width: 640px) { html { font-size: clamp(17px, 5.6vw, 20px); } }

body {
  background: var(--bg-body);
  color: var(--text-primary);
  font-family: 'Noto Sans SC', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { color: var(--accent-blue-hover); }

/* ═══════════════════════════════════════
   页眉
   ═══════════════════════════════════════ */
.school-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 0 8px;
  border-bottom: 2px solid var(--accent-blue);
  width: 100%;
  max-width: var(--max-width);
}
.school-header img {
  height: 3.6rem;
  width: auto;
  display: block;
}
.school-header .school-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: #1a2a3a;
  letter-spacing: .05em;
}

/* ═══════════════════════════════════════
   全站顶部导航栏
   ═══════════════════════════════════════ */
.top-nav {
  width: 100%;
  max-width: var(--max-width);
  margin: 8px 0 10px;
}
.top-nav-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-height: 40px;
  padding: 4px 14px;
  background: linear-gradient(135deg, var(--accent-blue) 0%, #2c5f8a 100%);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(61,126,186,0.25);
}
.top-nav-inner .tn-link {
  color: rgba(255,255,255,0.85);
  font-size: 0.85rem;
  padding: 6px 10px;
  white-space: nowrap;
  text-decoration: none;
  border-radius: 4px;
  transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  position: relative;
}
.top-nav-inner .tn-link:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.12);
  transform: translateY(-1px);
}
.top-nav-inner .tn-link:active {
  transform: translateY(0);
}
.top-nav-inner .tn-home {
  font-weight: 600;
}
.top-nav-inner .tn-home .tn-icon {
  display: inline-block;
  transition: transform 0.2s ease;
}
.top-nav-inner .tn-home:hover .tn-icon {
  transform: scale(1.15);
}

/* ── 下拉菜单触发器箭头 ── */
.tn-dd-arrow {
  display: inline-block;
  margin-left: 3px;
  font-size: 0.7rem;
  transition: transform 0.25s ease;
}
.tn-dd-wrap:hover .tn-dd-arrow {
  transform: rotate(180deg);
}

/* ── 下拉菜单容器 ── */
.tn-dd-wrap {
  position: relative;
}
.tn-dd-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 260px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  padding: 6px 0;
  z-index: 1000;
  display: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scaleY(0.96);
  transform-origin: top center;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}
.tn-dd-wrap:hover .tn-dd-menu {
  display: block;
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scaleY(1);
}
.tn-dd-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 24px;
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-top: 1px solid var(--border-light);
  border-left: 1px solid var(--border-light);
  transform: rotate(45deg);
}

/* ── 章条目 ── */
.tn-dd-chapter {
  position: relative;
}
.tn-dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: background 0.15s ease;
  cursor: pointer;
}
.tn-dd-item:hover {
  background: var(--accent-blue-light);
}
.tn-dd-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--accent-blue);
  color: white;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
}
.tn-dd-name {
  flex: 1;
  min-width: 0;
}
.tn-dd-count {
  font-size: 0.72rem;
  color: var(--text-light);
  background: var(--bg-body);
  padding: 1px 8px;
  border-radius: 8px;
  flex-shrink: 0;
}
.tn-sub-arrow {
  color: var(--text-secondary);
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}
.tn-dd-chapter.has-sub:hover .tn-sub-arrow {
  transform: translateX(3px);
}

/* ── 二级子菜单（节） ── */
.tn-sub-menu {
  position: absolute;
  top: -6px;
  left: 100%;
  margin-left: 6px;
  min-width: 260px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  padding: 6px 0;
  z-index: 1001;
  display: none;
  opacity: 0;
  visibility: hidden;
  transform: translateX(6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.tn-dd-chapter.has-sub:hover .tn-sub-menu {
  display: block;
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}
.tn-sub-menu::before {
  content: '';
  position: absolute;
  top: 16px;
  left: -6px;
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-left: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  transform: rotate(45deg);
}
.tn-sub-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.82rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.tn-sub-item:hover {
  background: var(--accent-blue-light);
  color: var(--accent-blue);
}
.tn-sub-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-blue);
  width: 20px;
  flex-shrink: 0;
}
.tn-sub-name {
  flex: 1;
  min-width: 0;
}
.tn-sub-count {
  font-size: 0.68rem;
  color: var(--text-light);
  background: var(--bg-body);
  padding: 0 7px;
  border-radius: 6px;
}



/* ═══════════════════════════════════════
   导航栏
   ═══════════════════════════════════════ */
.nav-bar {
  width: 100%;
  max-width: var(--max-width);
  background: var(--bg-container);
  border: 1px solid var(--border-light);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  display: flex;
  align-items: center;
  min-height: var(--nav-height);
  padding: 0 12px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.nav-bar .breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
}
.nav-bar .breadcrumb a {
  color: var(--accent-blue);
  white-space: nowrap;
}
.nav-bar .breadcrumb a:hover {
  text-decoration: underline;
}
.nav-bar .breadcrumb .sep {
  color: var(--text-light);
  margin: 0 2px;
}
.nav-bar .breadcrumb .current {
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 导航箭头按钮 ── */
.nav-arrows {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.nav-arrows a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-light);
  border-radius: 50%;
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 1.1rem;
  transition: background var(--transition), border-color var(--transition);
}
.nav-arrows a:hover {
  background: var(--accent-blue-light);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}
.nav-arrows a.disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* ═══════════════════════════════════════
   主容器
   ═══════════════════════════════════════ */
.main-wrap {
  width: 100%;
  max-width: var(--max-width);
  margin-top: 12px;
}

/* ═══════════════════════════════════════
   首页 — 书籍/章导航
   ═══════════════════════════════════════ */
.book-section {
  margin-bottom: 20px;
}
.book-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-blue);
  padding: 10px 14px;
  background: var(--bg-container);
  border: 1px solid var(--border-light);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition);
}
.book-title:hover {
  background: var(--accent-blue-light);
}
.book-title .toggle-icon {
  font-size: 0.8rem;
  transition: transform var(--transition);
  color: var(--text-light);
}
.book-title .toggle-icon.expanded {
  transform: rotate(90deg);
}

.chapter-list {
  background: var(--bg-container);
  border: 1px solid var(--border-light);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: none;
}
.chapter-list.open { display: block; }

.chapter-item {
  display: flex;
  align-items: center;
  padding: 10px 14px 10px 28px;
  border-bottom: 1px solid var(--border-divider);
  font-size: 0.95rem;
  transition: background var(--transition);
  cursor: pointer;
}
.chapter-item:last-child { border-bottom: none; }
.chapter-item:hover { background: var(--bg-nav-hover); }
.chapter-item .chapter-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent-blue);
  color: white;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
  margin-right: 10px;
}
.chapter-item .chapter-name {
  flex: 1;
  color: var(--text-primary);
}
.chapter-item .chapter-count {
  font-size: 0.8rem;
  color: var(--text-light);
  background: var(--bg-body);
  padding: 2px 10px;
  border-radius: 10px;
}
.chapter-item a {
  display: flex;
  align-items: center;
  width: 100%;
  color: inherit;
}

/* ═══════════════════════════════════════
   章页面 — 节内容卡片
   ═══════════════════════════════════════ */
.section-block {
  margin-bottom: 16px;
}
.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  padding: 10px 14px;
  background: var(--bg-container);
  border: 1px solid var(--border-light);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow);
  color: var(--text-primary);
}
.section-title .section-tag {
  display: inline-block;
  background: var(--accent-blue-light);
  color: var(--accent-blue);
  font-size: 0.8rem;
  padding: 1px 10px;
  border-radius: 10px;
  margin-right: 8px;
  font-weight: 500;
}

.content-grid {
  background: var(--bg-container);
  border: 1px solid var(--border-light);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.section-empty {
  background: var(--bg-container);
  border: 1px solid var(--border-light);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 14px;
  color: var(--text-light);
  font-size: 0.9rem;
  text-align: center;
}

/* ── 内容卡片 ── */
.content-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  background: var(--bg-container);
}
.content-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.content-card a {
  display: block;
  color: inherit;
}
.content-card .card-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-light);
}
.content-card .card-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-canvas);
  color: var(--text-light);
  font-size: 2rem;
  border-bottom: 1px solid var(--border-light);
}
.content-card .card-title {
  padding: 10px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.4;
}

/* ═══════════════════════════════════════
   内容播放页面（play.php）
   ═══════════════════════════════════════ */
.content-player {
  background: var(--bg-container);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  width: 100%;
}

.content-player h1 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-blue);
  margin-bottom: 10px;
  text-align: center;
}

/* ── 画布容器（由交互内容自带样式覆盖） ── */
.content-player .canvas-wrap {
  position: relative;
  width: 100%;
  background: var(--bg-canvas);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-canvas);
  overflow: hidden;
}
.content-player canvas {
  display: block;
  width: 100%;
}
.content-player .controls-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.content-player .ctrl-row {
  background: var(--bg-controls);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* ═══════════════════════════════════════
   页脚
   ═══════════════════════════════════════ */
.school-footer {
  text-align: center;
  margin-top: 14px;
  padding: 10px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-light);
  width: 100%;
  max-width: var(--max-width);
}

/* ═══════════════════════════════════════
   管理后台样式
   ═══════════════════════════════════════ */
.admin-login {
  max-width: 460px;
  margin: 60px auto;
  background: var(--bg-container);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
}
.admin-login h2 {
  text-align: center;
  margin-bottom: 20px;
  color: var(--accent-blue);
}
.admin-login input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  margin-bottom: 12px;
}
.admin-login button {
  width: 100%;
  padding: 10px;
  background: var(--accent-blue);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--transition);
}
.admin-login button:hover { background: var(--accent-blue-hover); }

.admin-page {
  max-width: var(--max-width);
  width: 100%;
}
.admin-page h2 {
  font-size: 1.3rem;
  color: var(--accent-blue);
  margin-bottom: 16px;
}
.admin-card {
  background: var(--bg-container);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.admin-card h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

/* ── 上传区域 ── */
.drop-zone {
  border: 2px dashed var(--border-canvas);
  border-radius: var(--radius-sm);
  padding: 40px 20px;
  text-align: center;
  color: var(--text-light);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent-blue);
  background: var(--accent-blue-light);
}
.drop-zone .icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}
.drop-zone .hint {
  font-size: 0.9rem;
}
.drop-zone input[type="file"] {
  display: none;
}

/* ── 上传队列 ── */
.upload-queue {
  margin-top: 12px;
}
.upload-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-body);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.upload-item .progress {
  flex: 1;
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
}
.upload-item .progress .bar {
  height: 100%;
  background: var(--accent-blue);
  width: 0%;
  transition: width 0.3s;
}
.upload-item .status {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.upload-item .status.success { color: var(--color-green); }
.upload-item .status.error { color: var(--color-red); }

/* ── 消息提示 ── */
.msg {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 0.9rem;
}
.msg.success {
  background: #e8f8ef;
  color: #1a7a3a;
  border: 1px solid #b8e6c8;
}
.msg.error {
  background: #fde8e8;
  color: #b91c1c;
  border: 1px solid #f5c6c6;
}

/* ═══════════════════════════════════════
   移动端汉堡按钮（默认为隐藏，JS 控制显隐）
   触控标准：至少 44×44px，此处用 48×48px
   ═══════════════════════════════════════ */
.tn-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,0.15);
  cursor: pointer;
  padding: 10px;
  flex-shrink: 0;
  transition: background 0.2s;
}
.tn-hamburger:hover { background: rgba(255,255,255,0.25); }
.tn-hamburger:active { background: rgba(255,255,255,0.35); }
.tn-hamburger span {
  display: block;
  width: 26px;
  height: 3px;
  background: rgba(255,255,255,0.95);
  border-radius: 2px;
  transition: all 0.3s;
}

/* ═══════════════════════════════════════
   移动端抽屉菜单（默认为隐藏，JS 控制显隐）
   ═══════════════════════════════════════ */
.mobile-drawer { display: none; }
.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.mobile-drawer.open .mobile-drawer-overlay {
  opacity: 1;
  visibility: visible;
}
.mobile-drawer-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 20001;
  width: calc(100% - 10px);
  max-width: 360px;
  background: #ffffff;
  box-shadow: 4px 0 30px rgba(0,0,0,0.12);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.mobile-drawer.open .mobile-drawer-panel { transform: translateX(0); }
.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid #eef1f5;
  flex-shrink: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a2a3a;
}
.mobile-drawer-close {
  width: 44px; height: 44px;
  border: none; border-radius: 10px;
  background: #f0f2f5; color: #5a6a7a;
  font-size: 1.5rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mobile-drawer-close:hover { background: #e4e8ec; }
.mobile-drawer-body { flex: 1; overflow-y: auto; padding: 6px 0; }

.mob-home {
  display: flex; align-items: center; padding: 14px 18px;
  font-size: 1.1rem; font-weight: 600; color: var(--accent-blue);
  text-decoration: none; border-bottom: 1px solid #eef1f5;
}
.mob-link {
  display: flex; align-items: center; padding: 14px 18px;
  font-size: 1rem; color: #3a4a5a; text-decoration: none;
  transition: background 0.12s;
}
.mob-link:hover { background: #f5f8fb; }

.mob-book { border-bottom: 1px solid #f0f3f7; }
.mob-book-header {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 14px 18px; border: none; background: none;
  font-size: 1.05rem; font-weight: 700; color: var(--accent-blue);
  cursor: pointer; font-family: inherit; text-align: left;
}
.mob-book-header:hover { background: #f5f8fb; }
.mob-arrow {
  font-size: 0.9rem; color: #8895a0;
  transition: transform 0.25s;
}
.mob-open > .mob-book-header .mob-arrow,
.mob-open > .mob-chapter-header .mob-arrow { transform: rotate(90deg); }
.mob-book-body { display: none; padding: 0 0 4px; }
.mob-open > .mob-book-body { display: block; }

.mob-chapter-header {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 12px 18px 12px 32px;
  border: none; background: none;
  font-size: 0.95rem; font-weight: 600; color: #3a4a5a;
  cursor: pointer; font-family: inherit; text-align: left;
}
.mob-chapter-header:hover { background: #f5f8fb; }
.mob-chapter-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; background: var(--accent-blue); color: #fff;
  border-radius: 50%; font-size: 0.8rem; font-weight: 600; flex-shrink: 0;
}
.mob-chapter-body { display: none; }
.mob-open > .mob-chapter-body { display: block; }

.mob-section-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px 10px 56px;
  font-size: 0.9rem; color: #4a5a6a; text-decoration: none;
  transition: background 0.12s;
}
.mob-section-link:hover { background: #eaf1f8; color: var(--accent-blue); }
.mob-count {
  font-size: 0.78rem; color: #8895a0;
  background: #f0f2f5; padding: 1px 9px; border-radius: 6px;
}
.mob-empty { padding: 10px 18px 10px 56px; font-size: 0.88rem; color: #8895a0; font-style: italic; }

/* ═══════════════════════════════════════
   响应式 —— 只处理布局结构，不覆写字体大小
   所有文字缩放由 html 根字体的 clamp() 统一控制
   ═══════════════════════════════════════ */

/* ── 平板及以下 · 显示汉堡按钮 · 隐藏桌面下拉导航 ── */
@media (max-width: 820px) {
  .tn-hamburger { display: flex; }
  .mobile-drawer { display: block; }
  .top-nav-inner .tn-dd-wrap,
  .top-nav-inner .tn-link[href*="table.wl.school"],
  .top-nav-inner .tn-link[href*="about.php"] {
    display: none;
  }
}

/* ── 手机竖屏 · 内容网格缩小 · 面包屑、按钮等紧凑 ── */
@media (max-width: 640px) {
  .content-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
  }
  .nav-bar { min-height: 36px; flex-wrap: wrap; gap: 4px; }
  .nav-arrows a { width: 44px; height: 44px; }
  .content-player { border-radius: 10px; }
  .content-player input[type=range] { width: 50px; }
  .content-player button,
  .content-player .ant-btn, .content-player .t-btn,
  .content-player .btn-primary, .content-player .btn-secondary {
    min-height: 36px;
  }
  .section-block { margin-bottom: 10px; }
  .table-wrap { max-height: 160px; }
  .hud-overlay { top: 6px; left: 6px; gap: 4px; }
  .hud-item .value { min-width: 40px; }
}

/* ── 极窄屏 · 内容列表单列 · 导航垂直堆叠 · 文字省略 ── */
@media (max-width: 450px) {
  .content-grid { grid-template-columns: 1fr; padding: 10px; gap: 8px; }
  .content-card .card-thumb { aspect-ratio: 16 / 9; }

  /* 面包屑溢出省略 */
  .nav-bar { flex-direction: column; gap: 2px; }
  .nav-bar .breadcrumb {
    width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-wrap: nowrap;
    gap: 1px;
  }
  .nav-bar .breadcrumb .current { overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
  .nav-bar .breadcrumb a { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
  .nav-arrows { align-self: flex-end; }

  /* 前后内容导航（play.php 底部）垂直堆叠 */
  .main-wrap div[style*="display:flex"][style*="justify-content:space-between"] {
    flex-direction: column !important;
  }
  .main-wrap div[style*="display:flex"][style*="justify-content:space-between"] > a,
  .main-wrap div[style*="display:flex"][style*="justify-content:space-between"] > div {
    width: 100% !important; flex: none !important;
  }

  /* 首页统计卡片 */
  .stat-card { min-width: 70px; }
  .stat-card .num { display: block; }
  /* 首页 book-card 封面缩小 */
  .book-card .book-cover { width: 140px !important; }
  .book-card .book-name .chapter-count-badge,
  .book-card .book-name .book-meta { display: block; margin-left: 0; }
}

/* ── 手机横屏 · 高度受限，最大化内容区域 ── */
@media (orientation: landscape) and (max-height: 500px) {
  .school-header { margin-bottom: 4px; }
  .school-header img { height: 1.4rem; }
  .top-nav-inner { min-height: 30px; }
  .main-card, .content-player { padding: 6px 8px; gap: 4px; }
  .canvas-wrap[style*="height"] { max-height: 160px !important; height: auto !important; }
  #canvas-container { max-height: 160px !important; height: auto !important; }
  .school-footer { margin-top: 4px; }
  .nav-bar { min-height: 30px; }
  .nav-arrows a { width: 26px; height: 26px; }
}

/* ── 触屏优化：加大可点击区域间距 ── */
@media (pointer: coarse) {
  .top-nav-inner .tn-link {
    padding: 10px 14px;
    min-height: 44px;
  }
  .chapter-item {
    padding-top: 14px;
    padding-bottom: 14px;
  }
  .content-card a {
    padding: 0;
  }
  .section-title {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}/* 鈹€鈹€ 瀹藉睆锛堢敓鏂囧睆/瓒呭ぇ灞忓箷锛?路 棣栭〉鍐呭涓ゅ垪鏄剧ず 鈹€鈹€ */
@media (min-width: 1200px) {
  .home-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

/* ====================================
   布局保护：确保标题不参与网格排列
   ==================================== */
/* 强制所有页面的main-wrap默认为block */
.main-wrap {
  display: block !important;
}

/* 首页两栏布局：只有书籍卡片参与两列排列 */
@media (min-width: 1200px) {
  .main-wrap.home-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  .main-wrap.home-grid > h1,
  .main-wrap.home-grid > h2,
  .main-wrap.home-grid > h3,
  .main-wrap.home-grid > .section-block,
  .main-wrap.home-grid > .content-grid,
  .main-wrap.home-grid > .nav-bar,
  .main-wrap.home-grid > div[style*="display:flex"] {
    grid-column: 1 / -1 !important; /* 跨两列显示 */
  }
  .main-wrap.home-grid .book-card {
    grid-column: auto !important; /* 只有书籍卡片两列排列 */
  }
}

/* 内容网格保护：确保section-block是块级 */
.section-block {
  display: block !important;
  width: 100% !important;
}