/* ===========================================================
   遇影学习区 (study) —— 独立样式
   站点底色 #0d0d0d / 主色 #c9a96e，各学科有独立主题色
   =========================================================== */

.study-wrap { width: 100%; max-width: 1420px; margin: 0 auto; padding: 0 22px; }

/* ---------- Hero ---------- */
.study-hero {
  padding: 34px 0 22px;
  background:
    radial-gradient(900px 380px at 12% -40%, rgba(201,169,110,.16), transparent 60%),
    linear-gradient(180deg, #171717 0%, #101010 100%);
  border-bottom: 1px solid rgba(201,169,110,.16);
  margin-top: var(--nav-height, 72px);
}
.sh-top { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.sh-brand { display: flex; align-items: center; gap: 14px; flex: 1 1 380px; min-width: 280px; }
.sh-icon {
  font-size: 30px; line-height: 1; width: 58px; height: 58px; flex: none;
  display: grid; place-items: center; border-radius: 16px;
  background: rgba(201,169,110,.12); border: 1px solid rgba(201,169,110,.3);
}
.sh-brand h1 { margin: 0; font-size: 26px; letter-spacing: 2px; color: #f5f5f5; font-weight: 700; }
.sh-brand p { margin: 5px 0 0; font-size: 12.5px; color: #909090; line-height: 1.6; }

.sh-search { flex: 1 1 320px; position: relative; display: flex; align-items: center; }
.sh-search input {
  width: 100%; height: 46px; padding: 0 42px 0 42px; font-size: 14px;
  color: #f5f5f5; background: #1b1b1b; border: 1px solid rgba(255,255,255,.09);
  border-radius: 12px; outline: none; font-family: inherit; transition: border-color .2s, background .2s;
}
.sh-search input::placeholder { color: #6a6a6a; }
.sh-search input:focus { border-color: rgba(201,169,110,.5); background: #202020; }
.sh-search::before {
  content: '🔍'; position: absolute; left: 14px; font-size: 14px; opacity: .55; pointer-events: none;
}
.sh-search button {
  position: absolute; right: 10px; width: 26px; height: 26px; border: none; cursor: pointer;
  background: rgba(255,255,255,.08); color: #b0b0b0; border-radius: 50%; font-size: 12px; line-height: 1;
}
.sh-search button:hover { background: rgba(201,169,110,.25); color: #fff; }

.sh-stats { display: flex; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.sh-stats .stat {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 13px; font-size: 12px;
  background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.07); border-radius: 20px; color: #909090;
}
.sh-stats .stat b { font-size: 15px; color: var(--color-accent, #c9a96e); font-weight: 700; }
.sh-stats .stat i { font-style: normal; }
.sh-only-mistake {
  margin-left: auto; font-size: 12.5px; color: #909090; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.sh-only-mistake input { accent-color: #c9a96e; width: 15px; height: 15px; cursor: pointer; }

/* ---------- 科目 / 年级 选择条 ---------- */
.study-filterbar {
  position: sticky; top: var(--nav-height, 72px); z-index: 60;
  background: rgba(13,13,13,.94); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.07); padding: 12px 0 10px;
}
.subject-row { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.subject-row::-webkit-scrollbar { display: none; }
.subject-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 8px 15px; border-radius: 11px; font-size: 13.5px; white-space: nowrap;
  color: #a8a8a8; background: #1a1a1a; border: 1px solid rgba(255,255,255,.07); transition: .18s;
}
.subject-chip:hover { color: #fff; transform: translateY(-1px); }
.subject-chip.active {
  color: #fff; font-weight: 600;
  background: var(--sc, rgba(201,169,110,.16));
  border-color: var(--sc-b, rgba(201,169,110,.5));
  box-shadow: 0 3px 14px -4px var(--sc, rgba(201,169,110,.6));
}
.subject-chip .sc-ico { font-size: 15px; }

.grade-row { display: flex; align-items: center; gap: 12px; margin-top: 11px; flex-wrap: wrap; }
.grade-label { font-size: 12px; color: #707070; flex: none; letter-spacing: 1px; }
.grade-tabs { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.grade-tabs::-webkit-scrollbar { display: none; }
.grade-tab {
  flex: none; cursor: pointer; padding: 6px 14px; border-radius: 9px; font-size: 13px; white-space: nowrap;
  color: #9a9a9a; background: transparent; border: 1px solid rgba(255,255,255,.08); transition: .16s;
}
.grade-tab:hover { color: #fff; border-color: rgba(255,255,255,.2); }
.grade-tab.active { color: #141414; font-weight: 600; background: var(--color-accent, #c9a96e); border-color: transparent; }
.grade-hint { margin-left: auto; font-size: 12px; color: #6f6f6f; flex: none; }
/* 教材版本徽标：数学显式高亮人教B版 */
.ver-badge { display: inline-flex; align-items: center; flex: none; padding: 4px 11px; border-radius: 999px; font-size: 11.5px; line-height: 1.5; color: #a49c90; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.13); white-space: nowrap; }
.ver-badge.bver { color: #e9cb8c; background: rgba(201,169,110,.13); border-color: rgba(201,169,110,.48); font-weight: 600; }

/* ---------- 主体网格 ---------- */
.study-main { padding: 24px 0 60px; }
.study-grid { display: grid; grid-template-columns: 262px minmax(0, 1fr); gap: 24px; align-items: start; }

.study-side { position: sticky; top: calc(var(--nav-height, 72px) + 96px); }
.side-inner {
  background: #151515; border: 1px solid rgba(255,255,255,.07); border-radius: 14px;
  padding: 14px; max-height: calc(100vh - var(--nav-height,72px) - 140px); display: flex; flex-direction: column;
}
.side-title { font-size: 11.5px; color: #707070; letter-spacing: 2px; margin-bottom: 10px; padding-left: 3px; }
.chapter-nav { overflow-y: auto; flex: 1; padding-right: 4px; }
.chapter-nav::-webkit-scrollbar { width: 4px; }
.chapter-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 4px; }
.cn-item {
  display: block; width: 100%; text-align: left; cursor: pointer; font-family: inherit;
  padding: 8px 10px; margin-bottom: 3px; border-radius: 8px; border: none; background: transparent;
  color: #a0a0a0; font-size: 12.8px; line-height: 1.45; transition: .15s;
}
.cn-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.cn-item.active { background: rgba(201,169,110,.15); color: var(--color-accent, #c9a96e); font-weight: 600; }
.cn-idx { color: #5f5f5f; margin-right: 6px; font-size: 11px; }
.cn-item.active .cn-idx { color: var(--color-accent, #c9a96e); }

.side-progress { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.07); }
.sp-bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; }
.sp-bar span { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg,#c9a96e,#e8d5a3); transition: width .35s; }
.sp-text { margin-top: 7px; font-size: 11.5px; color: #707070; text-align: right; }

/* ---------- 内容区 ---------- */
.study-loading { padding: 60px 0; text-align: center; color: #707070; font-size: 14px; }
.study-empty { padding: 60px 0; text-align: center; color: #707070; font-size: 14px; }

.chapter-block { margin-bottom: 26px; scroll-margin-top: calc(var(--nav-height,72px) + 120px); }
.cb-head {
  display: flex; align-items: center; gap: 11px; cursor: pointer; width: 100%; text-align: left;
  background: linear-gradient(90deg, rgba(201,169,110,.1), rgba(201,169,110,.02));
  border: 1px solid rgba(201,169,110,.22); border-left: 3px solid var(--color-accent, #c9a96e);
  border-radius: 12px; padding: 13px 16px; font-family: inherit; transition: .18s;
}
.cb-head:hover { border-color: rgba(201,169,110,.45); }
.cb-idx {
  flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: var(--color-accent, #c9a96e); color: #141414; font-size: 12.5px; font-weight: 700;
}
.cb-name { font-size: 16px; font-weight: 600; color: #f0f0f0; }
.cb-count { font-size: 11.5px; color: #808080; background: rgba(255,255,255,.07); padding: 3px 9px; border-radius: 10px; flex: none; }
.cb-caret { margin-left: auto; color: #707070; font-size: 12px; transition: transform .22s; flex: none; }
.chapter-block.collapsed .cb-caret { transform: rotate(-90deg); }
.chapter-block.collapsed .cb-body { display: none; }
.cb-intro { margin: 10px 0 0; font-size: 12.8px; color: #8d8d8d; line-height: 1.7; padding: 0 4px; }
.cb-body { padding: 12px 0 0; }

/* 知识点条目 */
.kp-item {
  border: 1px solid rgba(255,255,255,.075); border-radius: 12px; margin-bottom: 9px;
  background: #161616; overflow: hidden; transition: border-color .18s;
}
.kp-item:hover { border-color: rgba(255,255,255,.14); }
.kp-item.open { border-color: rgba(201,169,110,.34); }
.kp-item.done .kp-title::before { content: '✔ '; color: #4caf7d; }

.kp-head { display: flex; align-items: center; gap: 10px; padding: 12px 15px; cursor: pointer; user-select: none; }
.kp-check {
  flex: none; width: 17px; height: 17px; border-radius: 5px; cursor: pointer;
  border: 1.5px solid rgba(255,255,255,.22); background: transparent; transition: .15s;
  display: grid; place-items: center; font-size: 11px; color: transparent;
}
.kp-check.on { background: #4caf7d; border-color: #4caf7d; color: #0d0d0d; }

.kp-title { flex: 1; font-size: 14.2px; color: #ededed; font-weight: 500; line-height: 1.45; }
.kp-item.open .kp-title { color: #fff; }
.kp-tags { display: flex; gap: 5px; flex: none; }
.kp-tag { font-size: 10.5px; padding: 2px 7px; border-radius: 6px; line-height: 1.6; white-space: nowrap; }
.tag-base { background: rgba(120,160,220,.16); color: #8fb4e8; }
.tag-key  { background: rgba(224,120,90,.16);  color: #f0a184; }
.tag-hard { background: rgba(190,110,210,.16); color: #d9a6ea; }
.tag-hot  { background: rgba(224,84,84,.18);   color: #f08585; }
.kp-caret { flex: none; color: #6f6f6f; font-size: 11px; transition: transform .2s; }
.kp-item.open .kp-caret { transform: rotate(180deg); }

.kp-body { display: none; padding: 2px 15px 15px; border-top: 1px dashed rgba(255,255,255,.09); margin-top: 2px; }
.kp-item.open .kp-body { display: block; }
.kp-summary {
  font-size: 13.2px; color: #bfbfbf; line-height: 1.8; margin: 12px 0 0;
  padding: 10px 13px; background: rgba(255,255,255,.035); border-radius: 9px;
  border-left: 2px solid rgba(201,169,110,.4);
}
.kp-sec { margin-top: 14px; }
.kp-sec h4 {
  margin: 0 0 8px; font-size: 12px; letter-spacing: 1px; color: #8a8a8a; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.kp-sec h4::before { content: ''; width: 3px; height: 12px; border-radius: 2px; background: currentColor; opacity: .6; }
.kp-sec.f-points  h4 { color: #7fb3e8; }
.kp-sec.f-formula h4 { color: #e8c27f; }
.kp-sec.f-method  h4 { color: #86cfa8; }
.kp-sec.f-mistake h4 { color: #ef9a9a; }

.kp-list { list-style: none; margin: 0; padding: 0; }
.kp-list li {
  font-size: 13.2px; color: #c4c4c4; line-height: 1.82; padding: 3px 0 3px 18px; position: relative;
}
.kp-list li::before {
  content: '·'; position: absolute; left: 6px; top: 0; color: #6a6a6a; font-size: 17px; line-height: 1.6;
}
.kp-list.num li { counter-increment: kpn; }
.kp-list.num { counter-reset: kpn; }
.kp-list.num li::before {
  content: counter(kpn) '.'; font-size: 12px; color: #8a8a8a; line-height: 1.9; left: 2px;
}

/* 公式块：等宽 + 可复制感 */
.kp-formula-box {
  font-family: "Cambria Math","Times New Roman",Consolas,serif;
  font-size: 14px; color: #f0dcae; background: rgba(201,169,110,.07);
  border: 1px solid rgba(201,169,110,.2); border-radius: 8px;
  padding: 8px 12px; margin-bottom: 7px; line-height: 1.75; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}
.kp-formula-box b { color: #ffe9b8; font-weight: 700; }
.kp-method-box {
  font-size: 13.2px; color: #c8e5d5; background: rgba(90,190,150,.06);
  border: 1px solid rgba(90,190,150,.16); border-radius: 8px; padding: 8px 12px; margin-bottom: 7px; line-height: 1.78;
}
.kp-mistake-box {
  font-size: 13.2px; color: #f2c4c4; background: rgba(224,92,92,.07);
  border: 1px solid rgba(224,92,92,.18); border-radius: 8px; padding: 8px 12px; margin-bottom: 7px; line-height: 1.78;
}

/* ---------- 搜索结果浮层 ---------- */
.study-search-modal {
  position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.62); backdrop-filter: blur(3px);
  display: flex; justify-content: center; padding: 8vh 16px 16px;
}
.study-search-modal[hidden] { display: none; }
.ssm-panel {
  width: 100%; max-width: 780px; max-height: 84vh; display: flex; flex-direction: column;
  background: #171717; border: 1px solid rgba(255,255,255,.1); border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
}
.ssm-head {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08); font-size: 14px; color: #dcdcdc; font-weight: 600;
}
.ssm-head button { border: none; background: rgba(255,255,255,.08); color: #b0b0b0; border-radius: 50%; width: 26px; height: 26px; cursor: pointer; }
.ssm-head button:hover { background: rgba(201,169,110,.25); color: #fff; }
.ssm-body { overflow-y: auto; padding: 8px 10px 14px; }
.sr-item {
  display: block; width: 100%; text-align: left; cursor: pointer; font-family: inherit;
  padding: 11px 13px; border-radius: 10px; border: none; background: transparent; margin-bottom: 4px; transition: .15s;
}
.sr-item:hover { background: rgba(201,169,110,.1); }
.sr-path { font-size: 11px; color: #7d7d7d; margin-bottom: 3px; }
.sr-title { font-size: 13.8px; color: #ededed; font-weight: 500; }
.sr-title mark { background: rgba(201,169,110,.32); color: #ffe9b8; border-radius: 3px; padding: 0 1px; }
.sr-snip { font-size: 12px; color: #8f8f8f; margin-top: 3px; line-height: 1.6; }
.sr-snip mark { background: rgba(201,169,110,.22); color: #dbbf86; border-radius: 3px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .study-grid { grid-template-columns: 1fr; }
  .study-side { position: static; }
  .side-inner { max-height: none; }
  .chapter-nav { max-height: 240px; }
}
@media (max-width: 760px) {
  .study-wrap { padding: 0 14px; }
  .study-hero { padding: 22px 0 16px; margin-top: var(--nav-height, 60px); }
  .sh-brand h1 { font-size: 21px; }
  .sh-icon { width: 46px; height: 46px; font-size: 24px; border-radius: 13px; }
  .sh-search { flex-basis: 100%; }
  .sh-stats { gap: 7px; }
  .sh-stats .stat { padding: 5px 10px; font-size: 11px; }
  .sh-stats .stat b { font-size: 13px; }
  .sh-only-mistake { margin-left: 0; width: 100%; }
  .study-filterbar { top: var(--nav-height, 60px); padding: 10px 0 8px; }
  .grade-label { display: none; }
  .grade-hint { display: none; }
  .cb-name { font-size: 14.5px; }
  .kp-title { font-size: 13.4px; }
  .kp-item .kp-tags { display: none; }
  .study-search-modal { padding: 6vh 10px 10px; }
}

/* 打印 */
@media print {
  .navbar, .study-filterbar, .study-side, .sh-search, .study-search-modal, .footer { display: none !important; }
  .study-grid { grid-template-columns: 1fr; }
  .kp-body { display: block !important; }
  body { background: #fff; color: #000; }
}

/* ===========================================================
   v2 追加：子导航 + 学习区首页 Hub 卡片
   =========================================================== */

/* ---------- 子导航 ---------- */
.study-subnav {
  position: sticky; top: var(--nav-height, 72px); z-index: 70;
  background: rgba(13,13,13,.96); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.07);
  margin-top: var(--nav-height, 72px);
}
.study-hero ~ .study-subnav, .study-subnav + .study-hero { margin-top: 0; }
.study-subnav .study-wrap { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-top: 9px; padding-bottom: 9px; }
.study-subnav .study-wrap::-webkit-scrollbar { display: none; }
.ssn-item {
  flex: none; display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: 10px; font-size: 13px; text-decoration: none;
  color: #a0a0a0; background: transparent; border: 1px solid transparent; transition: .15s;
  white-space: nowrap;
}
.ssn-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.ssn-item.active {
  color: #f0e3c8; background: rgba(201,169,110,.14);
  border-color: rgba(201,169,110,.45); font-weight: 600;
}
.ssn-soon { color: #5f5f5f; cursor: default; }

/* ---------- Hub 入口卡片 ---------- */
.hub-main { padding: 34px 0 60px; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.hub-card {
  position: relative; display: flex; align-items: flex-start; gap: 16px;
  padding: 26px 24px; border-radius: 18px; text-decoration: none;
  background: linear-gradient(160deg, #1a1a1a 0%, #141414 100%);
  border: 1px solid rgba(255,255,255,.09);
  transition: transform .18s, border-color .18s, box-shadow .18s;
  overflow: hidden;
}
.hub-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(201,169,110,.55), transparent);
  opacity: 0; transition: opacity .18s;
}
.hub-card:hover { transform: translateY(-3px); border-color: rgba(201,169,110,.4); box-shadow: 0 14px 34px -18px rgba(201,169,110,.35); }
.hub-card:hover::before { opacity: 1; }
.hc-icon {
  flex: none; width: 56px; height: 56px; display: grid; place-items: center;
  font-size: 28px; border-radius: 15px;
  background: rgba(201,169,110,.12); border: 1px solid rgba(201,169,110,.3);
}
.hc-body { flex: 1; min-width: 0; }
.hc-body h2 { margin: 2px 0 8px; font-size: 18px; color: #f5f5f5; letter-spacing: 1px; }
.hc-body p { margin: 0 0 14px; font-size: 12.5px; color: #909090; line-height: 1.7; }
.hc-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.hc-stats span {
  font-size: 11.5px; color: #909090; padding: 4px 10px; border-radius: 14px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07);
}
.hc-stats b { color: var(--color-accent, #c9a96e); font-weight: 700; margin-right: 3px; }
.hc-arrow {
  flex: none; align-self: center; font-size: 20px; color: rgba(201,169,110,.5);
  transition: transform .18s, color .18s;
}
.hub-card:hover .hc-arrow { transform: translateX(4px); color: rgba(201,169,110,.9); }
.hub-soon { opacity: .55; cursor: default; }
.hub-soon:hover { transform: none; border-color: rgba(255,255,255,.09); box-shadow: none; }
.hub-soon::before { display: none; }
.hc-soon-tag {
  color: #c9a96e !important; border-color: rgba(201,169,110,.35) !important;
  background: rgba(201,169,110,.08) !important;
}

/* 子导航存在时，筛选条下移避让 */
.study-subnav ~ .study-filterbar { top: calc(var(--nav-height, 72px) + 45px); }

/* ===========================================================
   v3 追加：Hub 紧凑 Hero + 小方格入口墙（一屏 8 格容量）
   =========================================================== */
.study-hero.hub-hero { padding: 16px 0 10px; }
.study-hero.hub-hero .sh-icon { width: 46px; height: 46px; font-size: 24px; border-radius: 13px; }
.study-hero.hub-hero .sh-brand h1 { font-size: 21px; }
.study-hero.hub-hero .sh-brand p { margin-top: 3px; font-size: 12px; }

.hub-main { padding: 16px 0 44px; }
.tile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 14px 13px 12px; border-radius: 14px; text-decoration: none;
  background: linear-gradient(165deg, #1b1b1b 0%, #151515 100%);
  border: 1px solid rgba(255,255,255,.09);
  transition: transform .16s, border-color .16s, box-shadow .16s;
  min-height: 118px;
}
.tile:hover { transform: translateY(-3px); border-color: rgba(201,169,110,.45); box-shadow: 0 12px 26px -16px rgba(201,169,110,.4); }
.t-ico { font-size: 24px; line-height: 1; }
.t-name { font-size: 14.5px; font-weight: 700; color: #f5f5f5; letter-spacing: .5px; }
.t-desc { font-size: 11px; color: #8a8a8a; line-height: 1.5; }
.t-stat {
  margin-top: auto; font-size: 10.5px; color: #909090;
  padding: 3px 8px; border-radius: 11px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07);
  white-space: nowrap;
}
.t-stat b { color: var(--color-accent, #c9a96e); font-weight: 700; margin-right: 2px; }
.tile-soon { opacity: .5; cursor: default; }
.tile-soon:hover { transform: none; border-color: rgba(255,255,255,.09); box-shadow: none; }
.t-soon-tag { color: #c9a96e; border-color: rgba(201,169,110,.35); background: rgba(201,169,110,.08); }

/* 平板 3 列 / 手机 2 列（2×4=一屏 8 格容量） */
@media (max-width: 1024px) { .tile-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) {
  .tile-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .tile { min-height: 104px; padding: 12px 11px 10px; }
  .t-ico { font-size: 21px; }
  .t-name { font-size: 13.5px; }
  .t-desc { font-size: 10.5px; }
}
