* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1a73e8;
  --primary-dark: #1558b0;
  --bg: #f5f6f8;
  --card-bg: #ffffff;
  --text: #202124;
  --text-light: #5f6368;
  --border: #e2e4e8;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ---------- 页头（严格参照极速配送 header.html / portal.css .menu 渲染效果）----------
   极速配送根字号随屏宽设置：≥1400px→10px、1200-1399px→9px、992-1199px→9px、
   768-991px→8px、≤767px→7px。以下均按各断点的等价 px 写出。 */
.menu {
  background: #fff;
  box-shadow: 0 2px 7px 1px rgba(0, 0, 0, 0.1);
}
.menu a { display: flex; align-items: center; height: 100%; }
.menu__icon { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.menu .button--register {
  background: #ffd23b; color: #000; text-decoration: none;
  transition: background-color .2s ease;
}
.menu .button--register:hover { background: #eab502; color: #000; }

/* 桌面（≥992px）：固定顶栏 */
@media (min-width: 992px) {
  .menu {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 201;
    display: flex; align-items: center; justify-content: space-between;
  }
  .menu__brand { display: flex; align-items: center; justify-content: center; height: 100%; }
  .menu__toggle { display: none; }
  .menu__collapsible { display: contents; }
  .menu__right-side { display: flex; align-items: center; justify-content: flex-end; }
  .logo img { display: block; height: 100%; width: auto; padding: 13.5px 0 13.5px 13.5px; }
  .menu .button--register {
    display: flex; align-items: center; justify-content: center; gap: 7.2px;
    width: 155px; height: 45px; margin: 0 27px 0 0;
    padding: 9px 13.5px; border-radius: 6px; font-size: 16.2px;
  }
  .menu__user-mobile {
    display: flex; align-items: center; gap: 9px; margin: 0 27px 0 0;
  }
  .menu__user-mobile-name {
    font-size: 16.2px; color: #383b3b;
    max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .menu__user-mobile .button--register {
    width: auto; height: 36px; margin: 0; padding: 0 14.4px; font-size: 14.4px;
  }
}
@media (min-width: 1400px) {
  .logo img { padding: 15px 0 15px 15px; }
  .menu .button--register { gap: 8px; margin-right: 30px; padding: 10px 15px; font-size: 18px; }
  .menu__user-mobile { gap: 10px; margin-right: 30px; }
  .menu__user-mobile-name { font-size: 18px; }
  .menu__user-mobile .button--register { padding: 0 16px; font-size: 16px; }
}
@media (min-width: 1200px) {
  .menu { height: 100px; }
  body { padding-top: 100px; }
}
@media (min-width: 992px) and (max-width: 1199px) {
  .menu { height: 80px; }
  body { padding-top: 80px; }
}

/* 手机/平板（≤991px）：汉堡按钮 + 折叠面板 */
@media (max-width: 991px) {
  .menu { height: auto; }
  .menu__brand {
    display: flex; justify-content: space-between; align-items: center;
    height: 64px; padding: 0 10.5px;
  }
  .logo img { padding: 0; height: 48px; width: auto; }
  .menu__toggle {
    display: flex; flex-direction: column; align-items: stretch; justify-content: center;
    gap: 5px; width: 44px; min-width: 0; height: 44px; margin: 0; padding: 10px;
    background: transparent; border: 0; cursor: pointer;
  }
  .menu__toggle-bar {
    display: block; width: 100%; height: 2px; border-radius: 2px;
    background: #383b3b; transition: transform .25s ease, opacity .25s ease;
  }
  .menu--open .menu__toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu--open .menu__toggle-bar:nth-child(2) { opacity: 0; }
  .menu--open .menu__toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  #menu-items {
    display: block; width: 100%; max-height: 0; overflow: hidden;
    background: #fff; transition: max-height .3s ease;
  }
  .menu--open #menu-items { max-height: 420px; box-shadow: 0 6px 8px rgba(0, 0, 0, 0.08); }
  #menu-items .menu__right-side { display: block; width: 100%; padding: 0; }
  #menu-items .button--register {
    display: flex; align-items: center; justify-content: center; gap: 5.6px;
    width: 100%; height: 56px; margin: 0; padding: 0 10.5px;
    border: 0; border-radius: 0; font-size: 12.6px;
  }
  #menu-items .menu__user-mobile {
    display: flex; align-items: center; justify-content: space-between; gap: 7px;
    height: 56px; padding: 0 10.5px; border-bottom: 1px solid #ececec;
  }
  #menu-items .menu__user-mobile-name {
    font-size: 12.6px; color: #383b3b; max-width: 55%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  #menu-items .menu__user-mobile .button--register {
    display: flex; align-items: center; justify-content: center;
    height: 36px; width: auto; margin: 0; padding: 0 11.2px;
    font-size: 11.2px; border-radius: 6px;
  }
}
@media (min-width: 768px) and (max-width: 991px) {
  .menu__brand { padding: 0 12px; }
  #menu-items .button--register { gap: 6.4px; padding: 0 12px; font-size: 14.4px; }
  #menu-items .menu__user-mobile { gap: 8px; padding: 0 12px; }
  #menu-items .menu__user-mobile-name { font-size: 14.4px; }
  #menu-items .menu__user-mobile .button--register { padding: 0 12.8px; font-size: 12.8px; }
}

main.container { padding-top: 24px; padding-bottom: 48px; min-height: 60vh; }

.page-title { font-size: 24px; margin-bottom: 20px; }

/* 视频卡片网格（响应式） */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.video-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; text-decoration: none; color: inherit;
  transition: box-shadow .15s ease, transform .15s ease;
  display: block;
}
.video-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateY(-2px); }
.video-cover { position: relative; aspect-ratio: 16 / 9; background: #202124; }
.video-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-cover-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: #9aa0a6; font-size: 18px;
}
.video-duration {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(0,0,0,.75); color: #fff; font-size: 12px;
  padding: 2px 6px; border-radius: 4px;
}
.video-card-body { padding: 12px 14px 16px; }
.video-card-title {
  font-size: 15px; font-weight: 600; margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.video-card-meta { font-size: 13px; color: var(--text-light); }

/* 详情页 */
.breadcrumb { margin-bottom: 12px; font-size: 14px; }
.breadcrumb a { color: var(--primary); text-decoration: none; }

.player-wrap {
  background: #000; border-radius: 10px; overflow: hidden;
  margin-bottom: 20px;
}
.player-wrap video { display: block; width: 100%; aspect-ratio: 16 / 9; }
.player-wrap .plyr { aspect-ratio: 16 / 9; }

.video-info { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.video-desc { margin-bottom: 14px; white-space: pre-wrap; }
.video-meta { display: flex; flex-wrap: wrap; gap: 20px; font-size: 14px; color: var(--text-light); margin-bottom: 16px; }

.btn-download {
  display: inline-block; background: var(--primary); color: #fff;
  padding: 10px 28px; border-radius: 6px; text-decoration: none; font-size: 15px;
  transition: background .15s ease;
}
.btn-download:hover { background: var(--primary-dark); }
.btn-download:active { transform: scale(.98); }

.empty { color: var(--text-light); padding: 40px 0; text-align: center; }

/* 页脚（严格参照极速配送 portal.css .footer 的渲染效果）
   极速配送根字号按屏幕设置：≥1400px 时 html=10px，故 4.5rem=45px、1.6rem=16px；
   ≤767px 时 html=7px，故 4.5rem=31.5px、1.6rem=11.2px。此处直接写成等价 px。 */
.footer {
  padding: 45px 0 45px 0;
  background-color: #f89938;
  box-shadow: 0 -2px 7px 1px rgba(0, 0, 0, 0.1);
  text-align: center;
}
.footer .copyright { font-size: 16px; color: #fff; }
.footer .copyright a { color: #fff; text-decoration: none; }

@media (max-width: 767px) {
  .footer { padding: 31.5px 0 31.5px 0; }
  .footer .copyright { font-size: 11.2px; }
}

/* 小屏手机 */
@media (max-width: 480px) {
  .page-title { font-size: 20px; }
  .video-grid { grid-template-columns: 1fr; }
  .video-meta { gap: 12px; }
}

.flash-messages { margin-bottom: 16px; }
.flash {
  background: #fef7e0; border: 1px solid #f5d98c; color: #8a5a00;
  border-radius: 6px; padding: 10px 14px; font-size: 14px;
}
.flash--error { background: #fdecec; border-color: #f3b8b8; color: #8c2f2f; }

/* 学科手风琴（对齐极速配送首页）；资料下载区块复用同款面板 */
#subjects .panel, #resources .panel {
  margin-bottom: 12px; border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; background: var(--card-bg);
}
#subjects .panel-header, #resources .panel-header { background: var(--primary); }
#subjects .panel-title, #resources .panel-title {
  width: 100%; display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: none; border: 0; color: #fff; font-size: 16px; font-weight: 600;
  padding: 14px 16px; text-align: left;
}
#resources .panel-title { cursor: default; }
#subjects .panel-caret::before { content: "▾"; font-size: 12px; display: inline-block; transition: transform .15s ease; }
#subjects .panel-title.collapsed .panel-caret::before { transform: rotate(-90deg); }
#subjects .panel-name { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#subjects .panel-range { margin-left: auto; font-size: 13px; font-weight: 400; opacity: .9; white-space: nowrap; }
#subjects .collapse { display: none; }
#subjects .collapse.open { display: block; }
#subjects .panel-body, #resources .panel-body { border-top: 1px solid var(--border); padding: 8px 16px; }

.lesson-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 4px;
  text-decoration: none; color: inherit; border-bottom: 1px dashed var(--border);
}
.lesson-row:last-child { border-bottom: 0; }
.lesson-row:hover .lesson-title { color: var(--primary); }
.lesson-no { flex: 0 0 28px; text-align: center; color: var(--text-light); font-variant-numeric: tabular-nums; }
.lesson-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lesson-tag { flex: 0 0 auto; font-size: 12px; padding: 1px 8px; border-radius: 999px; }
.lesson-tag--free { background: #e6f4ea; color: #137333; }
.lesson-tag--vip { background: #fef7e0; color: #b06000; }
.lesson-tag--resource { background: #e8f0fe; color: #1a56db; }

.lesson-progress { flex: 0 0 110px; display: flex; align-items: center; gap: 6px; }
.lesson-progress--empty { visibility: hidden; }
.lesson-progress-track { flex: 0 0 70px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.lesson-progress-bar { display: block; height: 100%; border-radius: 3px; background: var(--primary); min-width: 1px; }
.lesson-progress-text { font-size: 12px; color: var(--text-light); width: 34px; text-align: right; }

/* 详情页标签与进度提示 */
.video-tags { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.video-progress-hint { font-size: 13px; color: var(--text-light); }

/* 移动端（参照极速配送首页样式） */
@media (max-width: 767px) {
  #subjects .panel-header, #resources .panel-header { background: #6e7171; }
  #subjects .panel-title, #resources .panel-title { padding: 12px; font-size: 15px; }
  #subjects .panel-range, #resources .panel-range { width: auto; font-size: 12px; }
  #subjects .panel-body, #resources .panel-body { padding: 0.8rem; background: #f1ecec; }
  .lesson-row { gap: 6px; padding: 8px 0; font-size: 15px; }
  .lesson-title { white-space: normal; word-break: break-word; line-height: 1.4; }
  .lesson-no { flex-basis: 22px; }
  .lesson-tag { padding: 1px 6px; font-size: 11px; }
  .lesson-progress { flex-basis: auto; gap: 4px; }
  .lesson-progress-track { flex-basis: 40px; }
  .lesson-progress-text { width: auto; font-size: 13px; }
  .lesson-progress--empty { display: none; }
}
