/* ============================================
   太阳能电池物理 · 交互式学习网站
   浅色商务风样式
   ============================================ */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f9;
  --border: #dfe7f1;
  --text: #22303f;
  --text-2: #5b6b7f;
  --text-3: #8a99ad;
  --primary: #1b6ec2;
  --primary-dark: #155a9e;
  --primary-soft: #e3f0fc;
  --teal: #0e9f8a;
  --teal-soft: #e0f5f2;
  --amber: #f0a020;
  --amber-soft: #fdf3e0;
  --red: #d64545;
  --violet: #6a5acd;
  --shadow-sm: 0 1px 3px rgba(30, 55, 90, .08);
  --shadow-md: 0 6px 22px rgba(30, 55, 90, .10);
  --radius: 12px;
  --sidebar-w: 264px;
  --font: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Segoe UI", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 15.5px;
  overflow-x: hidden;
}
::selection { background: rgba(27, 110, 194, .18); }

/* ---------- 加载启动页 ---------- */
#splash {
  position: fixed; inset: 0; z-index: 1000;
  background: radial-gradient(1200px 700px at 50% 42%, #10233f 0%, #060d1c 62%, #030710 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity .9s ease, visibility .9s;
}
#splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-ring {
  position: relative; width: 150px; height: 150px; margin-bottom: 42px;
}
.splash-ring .core {
  position: absolute; inset: 38px; border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #ffd97a 0%, #f5a623 46%, #e07f00 100%);
  box-shadow: 0 0 34px 8px rgba(245, 166, 35, .55), 0 0 90px 26px rgba(245, 166, 35, .22);
  animation: corePulse 2.6s ease-in-out infinite;
}
.splash-ring .orbit {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px dashed rgba(140, 190, 255, .4);
  animation: spin 7s linear infinite;
}
.splash-ring .orbit::before {
  content: ""; position: absolute; top: -5px; left: 50%; width: 9px; height: 9px;
  border-radius: 50%; background: #7db8ff; box-shadow: 0 0 12px 3px rgba(125, 184, 255, .8);
}
.splash-ring .orbit.o2 { inset: 14px; animation-duration: 4.5s; animation-direction: reverse; border-color: rgba(240, 160, 32, .45); }
.splash-ring .orbit.o2::before { background: #f0a020; box-shadow: 0 0 12px 3px rgba(240, 160, 32, .8); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes corePulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
#splash h1 {
  color: #eaf2fc; font-size: 30px; letter-spacing: 10px; font-weight: 600; margin-bottom: 14px;
  text-shadow: 0 0 26px rgba(125, 184, 255, .45);
}
#splash .sub { color: #7d93b5; font-size: 13px; letter-spacing: 5px; margin-bottom: 48px; }
.splash-quote {
  max-width: 620px; padding: 0 30px; text-align: center;
  color: #b9c9de; font-size: 15px; line-height: 1.9; font-style: italic;
  border-left: 3px solid rgba(240, 166, 35, .55); padding-left: 18px; text-align: left;
}
.splash-quote .who { display: block; margin-top: 8px; color: #f0a020; font-style: normal; font-size: 13px; letter-spacing: 2px; }
.splash-bar {
  width: 220px; height: 3px; background: rgba(125, 184, 255, .18); border-radius: 3px;
  margin-top: 44px; overflow: hidden;
}
.splash-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #1b6ec2, #f0a020); animation: load 1.8s ease forwards; }
@keyframes load { to { width: 100%; } }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }

/* 侧边导航 */
#sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.side-brand {
  padding: 22px 22px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.side-brand .logo {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #f7c948 0%, #f0a020 55%, #e07f00 100%);
  box-shadow: 0 3px 10px rgba(240, 160, 32, .4), inset 0 0 0 2px rgba(255,255,255,.35);
  position: relative; overflow: hidden;
}
.side-brand .logo::after {
  content: ""; position: absolute; inset: 8px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.85); border-top-color: transparent; border-left-color: transparent;
  transform: rotate(45deg);
}
.side-brand b { font-size: 16px; display: block; line-height: 1.3; }
.side-brand span { font-size: 11px; color: var(--text-3); letter-spacing: 1px; }
#nav { flex: 1; overflow-y: auto; padding: 12px 12px 20px; }
#nav::-webkit-scrollbar { width: 5px; }
#nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px; margin-bottom: 2px;
  color: var(--text-2); text-decoration: none; font-size: 14px;
  transition: all .2s; border-left: 3px solid transparent;
}
.nav-item .num {
  width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0;
  background: var(--surface-2); color: var(--text-2);
  font-size: 11.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.nav-item:hover { background: var(--surface-2); color: var(--primary); }
.nav-item.active {
  background: var(--primary-soft); color: var(--primary);
  border-left-color: var(--primary); font-weight: 600;
}
.nav-item.active .num { background: var(--primary); color: #fff; }
.side-foot { padding: 14px 20px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-3); line-height: 1.6; }

/* 主区域 */
main {
  flex: 1; margin-left: var(--sidebar-w);
  min-width: 0;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 42px 90px; }

/* ---------- Hero ---------- */
#hero {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, #0d2242 0%, #133a6b 45%, #1b6ec2 100%);
  color: #fff; padding: 96px 0 120px;
}
#hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 82% 18%, rgba(240, 166, 32, .28) 0%, transparent 34%),
    radial-gradient(circle at 12% 85%, rgba(14, 159, 138, .20) 0%, transparent 40%);
}
.hero-grid {
  position: absolute; inset: 0; opacity: .14;
  background-image:
    linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(700px 420px at 70% 30%, #000 0%, transparent 100%);
  -webkit-mask-image: radial-gradient(700px 420px at 70% 30%, #000 0%, transparent 100%);
}
.hero-inner { position: relative; max-width: 1080px; margin: 0 auto; padding: 0 42px; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
  padding: 6px 16px; border-radius: 100px; font-size: 12.5px; letter-spacing: 2px;
  margin-bottom: 26px; backdrop-filter: blur(4px);
}
.hero-tag i { width: 7px; height: 7px; border-radius: 50%; background: #f0a020; box-shadow: 0 0 10px 2px rgba(240,166,32,.8); animation: corePulse 2s infinite; }
#hero h1 { font-size: 46px; line-height: 1.25; letter-spacing: 3px; margin-bottom: 18px; font-weight: 700; }
#hero h1 em { font-style: normal; color: #ffd97a; }
#hero p.lead { max-width: 640px; color: #c6d8ee; font-size: 16.5px; margin-bottom: 38px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: 10px; font-size: 15px; font-weight: 600;
  text-decoration: none; cursor: pointer; border: none; font-family: var(--font);
  transition: transform .18s, box-shadow .18s, background .18s;
}
.btn:hover { transform: translateY(-2px); }
.btn-sun { background: linear-gradient(135deg, #f7c948, #f0a020); color: #3a2703; box-shadow: 0 6px 18px rgba(240,166,32,.4); }
.btn-ghost { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.4); }
.btn-ghost:hover { background: rgba(255,255,255,.2); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(27,110,194,.35); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 8px 18px; font-size: 13.5px; border-radius: 8px; }
.hero-stats { display: flex; gap: 42px; margin-top: 56px; flex-wrap: wrap; }
.hstat b { font-size: 30px; color: #ffd97a; font-weight: 700; display: block; line-height: 1.2; }
.hstat span { font-size: 13px; color: #a9c2de; }
#heroCanvas { position: absolute; inset: 0; pointer-events: none; }

/* ---------- 章节通用 ---------- */
section.chapter { padding: 78px 0 30px; scroll-margin-top: 10px; }
.chap-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 14px; }
.chap-no {
  flex-shrink: 0; width: 58px; height: 58px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, #3f8fe0 100%);
  color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 5px 16px rgba(27,110,194,.3);
}
.chap-no small { font-size: 9.5px; letter-spacing: 1.5px; opacity: .85; line-height: 1; }
.chap-no b { font-size: 24px; line-height: 1.15; font-weight: 700; }
.chap-head h2 { font-size: 28px; letter-spacing: 1px; line-height: 1.35; }
.chap-head .en { color: var(--text-3); font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; margin-top: 2px; }
.chap-intro { color: var(--text-2); max-width: 860px; margin-bottom: 26px; }
.chap-intro b, .card b { color: var(--text); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 26px 28px; margin-bottom: 24px;
}
.card h3 {
  font-size: 18px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px;
}
.card h3::before {
  content: ""; width: 5px; height: 19px; border-radius: 3px;
  background: linear-gradient(180deg, var(--primary), var(--teal));
}
.card h4 { font-size: 15.5px; margin: 18px 0 8px; color: var(--primary-dark); }
.card p { color: var(--text-2); margin-bottom: 10px; }
.card ul, .card ol { color: var(--text-2); padding-left: 22px; margin-bottom: 10px; }
.card li { margin-bottom: 5px; }

/* 公式 */
.formula {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 9px; padding: 13px 20px; margin: 12px 0;
  font-family: "Cambria Math", "Times New Roman", Georgia, serif;
  font-size: 17px; text-align: center; color: var(--text);
  overflow-x: auto; white-space: nowrap;
}
.formula .tag {
  float: right; font-size: 11.5px; color: var(--text-3); font-family: var(--font);
  background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 2px 10px; margin-left: 14px;
}
sub, sup { font-size: .68em; }

/* 关键概念块 */
.keypoints { display: grid; grid-template-columns: repeat(auto-fit, minmax(228px, 1fr)); gap: 14px; margin: 18px 0 6px; }
.kp {
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
  padding: 16px 17px; box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--primary);
}
.kp.amber { border-top-color: var(--amber); }
.kp.teal { border-top-color: var(--teal); }
.kp.violet { border-top-color: var(--violet); }
.kp b { display: block; font-size: 14.5px; margin-bottom: 6px; }
.kp span { font-size: 13px; color: var(--text-2); line-height: 1.65; display: block; }

.callout {
  border-radius: 10px; padding: 14px 18px; margin: 14px 0; font-size: 14px;
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--amber-soft); border: 1px solid #f3ddae; color: #7a5a13;
}
.callout.blue { background: var(--primary-soft); border-color: #c4ddf5; color: #1d4e80; }
.callout.teal { background: var(--teal-soft); border-color: #bde6df; color: #0c5f52; }
.callout .ico { font-size: 17px; line-height: 1.6; }

/* ---------- 动画/仿真面板 ---------- */
.lab {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  margin: 22px 0 30px; overflow: hidden;
}
.lab-head {
  padding: 15px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: linear-gradient(180deg, #fbfdff, #f3f7fc);
}
.lab-head .t { font-weight: 700; font-size: 15.5px; display: flex; align-items: center; gap: 9px; }
.lab-head .t .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px rgba(240,166,32,.7); }
.lab-ctrl { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.lab-body { padding: 18px 22px 22px; }
.lab-body canvas { display: block; width: 100%; border-radius: 9px; }
.lab-note { font-size: 12.5px; color: var(--text-3); padding: 10px 22px 14px; border-top: 1px dashed var(--border); }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button {
  border: none; background: transparent; font-family: var(--font); font-size: 13px;
  padding: 6px 14px; border-radius: 7px; cursor: pointer; color: var(--text-2); transition: all .18s;
}
.seg button:hover { color: var(--primary); }
.seg button.on { background: var(--primary); color: #fff; font-weight: 600; box-shadow: 0 2px 7px rgba(27,110,194,.3); }

/* 滑块组 */
.sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px 30px; margin: 6px 0 16px; }
.sl { display: flex; align-items: center; gap: 12px; }
.sl label { flex: 0 0 148px; font-size: 13.5px; color: var(--text-2); }
.sl input[type=range] { flex: 1; accent-color: var(--primary); height: 26px; cursor: pointer; }
.sl output {
  flex: 0 0 108px; text-align: right; font-size: 13px; font-weight: 600; color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}

/* 读数卡片 */
.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 14px 0; }
.ro {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 14px; text-align: center;
}
.ro.hot { background: var(--amber-soft); border-color: #f3ddae; }
.ro b { display: block; font-size: 21px; color: var(--primary-dark); font-variant-numeric: tabular-nums; line-height: 1.3; }
.ro.hot b { color: #b06f00; }
.ro span { font-size: 12px; color: var(--text-2); }

/* 图例 */
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-top: 10px; }
.legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legend i.box { width: 11px; height: 11px; border-radius: 3px; }

/* ---------- 对比表 ---------- */
table.cmp { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 8px; }
table.cmp th {
  background: var(--surface-2); color: var(--text); font-weight: 700;
  padding: 10px 12px; border: 1px solid var(--border); text-align: left; white-space: nowrap;
}
table.cmp td { padding: 9px 12px; border: 1px solid var(--border); color: var(--text-2); vertical-align: top; }
table.cmp tr:nth-child(even) td { background: #fafcfe; }
table.cmp td b { color: var(--primary-dark); }
.bar-mini { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; min-width: 90px; margin-top: 6px; }
.bar-mini i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--teal), var(--primary)); }

/* ---------- 测验 ---------- */
.quiz-q { border-bottom: 1px dashed var(--border); padding: 18px 0; }
.quiz-q:last-child { border-bottom: none; }
.quiz-q .q { font-weight: 600; margin-bottom: 11px; font-size: 15px; }
.quiz-q .q .qno {
  display: inline-flex; width: 24px; height: 24px; border-radius: 7px; background: var(--primary);
  color: #fff; font-size: 12.5px; align-items: center; justify-content: center; margin-right: 9px;
}
.opts { display: grid; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 9px; padding: 9px 14px; cursor: pointer; font-size: 14px; color: var(--text-2);
  transition: all .16s; text-align: left; font-family: var(--font); width: 100%;
}
.opt:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.opt .k { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--text-3); display: flex; align-items: center; justify-content: center; font-size: 12px; }
.opt.correct { border-color: var(--teal); background: var(--teal-soft); color: #0c5f52; font-weight: 600; }
.opt.correct .k { background: var(--teal); border-color: var(--teal); color: #fff; }
.opt.wrong { border-color: var(--red); background: #fdecec; color: #8f2f2f; }
.opt.wrong .k { background: var(--red); border-color: var(--red); color: #fff; }
.opt:disabled { cursor: default; }
.explain {
  display: none; margin-top: 10px; font-size: 13.5px; color: #0c5f52;
  background: var(--teal-soft); border-radius: 8px; padding: 10px 14px;
}
.explain.show { display: block; }
.quiz-score { text-align: center; padding: 16px; font-size: 15px; font-weight: 600; color: var(--primary-dark); }

/* ---------- 页脚 ---------- */
footer {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 30px 0; margin-top: 60px;
}
footer .wrap { padding-bottom: 0; }
footer p { color: var(--text-3); font-size: 12.5px; text-align: center; }

/* 移动端 */
#menuBtn {
  display: none; position: fixed; top: 14px; left: 14px; z-index: 200;
  width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow-md); cursor: pointer;
  font-size: 18px; color: var(--primary);
}
@media (max-width: 960px) {
  #sidebar { transform: translateX(-100%); transition: transform .3s; }
  #sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.25); }
  #menuBtn { display: block; }
  main { margin-left: 0; }
  .wrap { padding: 0 20px 70px; }
  .hero-inner { padding: 0 20px; }
  #hero h1 { font-size: 32px; }
  #hero { padding: 76px 0 84px; }
  .sl label { flex-basis: 120px; }
  .chap-head h2 { font-size: 23px; }
}

/* 3D 演示台 */
.pv3d-stage {
  position: relative; width: 100%; height: 430px;
  border-radius: 9px; overflow: hidden; cursor: grab;
  background:
    radial-gradient(60% 70% at 50% 12%, #ffffff 0%, #f2f7fd 55%, #e7eff8 100%);
  border: 1px solid var(--border);
  touch-action: none;
}
.pv3d-stage:active { cursor: grabbing; }
.pv3d-stage canvas { display: block; border-radius: 9px; }
.pv3d-hint {
  font-size: 12.5px; color: var(--text-3); margin: 10px 0 2px;
  display: flex; align-items: center; gap: 6px;
}
.pv3d-fallback {
  display: flex; align-items: center; justify-content: center; height: 100%;
  color: var(--text-2); font-size: 14px; text-align: center; padding: 0 30px;
}
@media (max-width: 960px) {
  .pv3d-stage { height: 340px; }
}

/* 滚动出现动画 */
.rise { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s ease; }
.rise.in { opacity: 1; transform: none; }
