@font-face { font-family: "MaShanZheng"; src: url("../fonts/MaShanZheng-Regular.ttf") format("truetype"); font-display: swap; }
:root {
  --paper: #f3ece0; --paper2: #e9dfcd; --ink: #1d1a17; --ink2: #4a433c; --ink3: #8a8076;
  --red: #b5342a; --red2: #8f2219; --gold: #c9a45c; --line: rgba(29,26,23,.16);
  --title: "MaShanZheng", "LXGW WenKai Screen", serif; --body: "LXGW WenKai Screen", serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0d0b0a; }
body { font-family: var(--body); color: var(--ink); }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
img { display: block; }
[hidden] { display: none !important; }

#stage { position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px; transform-origin: center;
  overflow: hidden; background: var(--paper); }
.view { position: absolute; inset: 0; display: none; }
.view.on { display: block; }

/* ---------- 首页 ---------- */
#home { background: #1a0d09; }
.home-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.curtain { position: absolute; top: 0; bottom: 0; width: 51%; z-index: 3;
  background: repeating-linear-gradient(90deg, #6e0f0b 0 26px, #9c1c14 46px, #6e0f0b 74px);
  box-shadow: inset 0 -60px 80px rgba(0,0,0,.5); transition: transform 1.8s cubic-bezier(.7,0,.3,1); }
.curtain.left { left: 0; } .curtain.right { right: 0; }
#home.open .curtain.left { transform: translateX(-100%); }
#home.open .curtain.right { transform: translateX(100%); }
.home-inner { position: absolute; left: 300px; right: 428px; top: 250px; text-align: center; z-index: 2;
  opacity: 0; transition: opacity 1s 1.2s; }
#home.open .home-inner { opacity: 1; }
.home-seal { display: inline-block; font-family: var(--title); font-size: 34px; color: #fff4e0; background: var(--red);
  padding: 6px 16px; border-radius: 6px; letter-spacing: 6px; box-shadow: 0 0 0 3px rgba(201,164,92,.7); }
.home-title { font-family: var(--title); font-weight: 400; font-size: 124px; line-height: 1.2; margin-top: 28px;
  color: #6e120c; letter-spacing: 12px; text-shadow: 0 3px 0 rgba(255,236,190,.9), 0 8px 30px rgba(255,220,150,.8); }
.home-sub { font-size: 28px; color: #6b3a1e; margin-top: 6px; }
.btn-gong { margin-top: 56px; font-family: var(--title); font-size: 56px; color: #fff4e0; letter-spacing: 10px;
  padding: 14px 70px 18px; border-radius: 999px; background: radial-gradient(circle at 50% 30%, #d4473a, #8f2219);
  box-shadow: 0 0 0 4px var(--gold), 0 14px 34px rgba(110,30,10,.45); transition: transform .2s; }
.btn-gong:hover { transform: scale(1.05); }
.home-note { margin-top: 26px; font-size: 24px; color: #7a4a26; letter-spacing: 3px; }

/* 莞香伯站在戏台右侧台板上 */
.home-figure { position: absolute; right: 200px; bottom: 30px; height: 600px; z-index: 2; cursor: pointer;
  opacity: 0; transform: translateX(160px); transition: opacity 1s 1.7s, transform 1.4s 1.7s cubic-bezier(.2,.7,.2,1); }
#home.open .home-figure { opacity: 1; transform: none; }
.home-figure img { height: 100%; width: auto; filter: drop-shadow(0 10px 14px rgba(60,20,0,.3));
  transform-origin: 50% 100%; }
@keyframes sway { 50% { transform: rotate(.8deg); } }
@keyframes talknod { 50% { transform: translateY(-5px) rotate(-.6deg); } }
.home-figure::after { content: ""; position: absolute; left: 10%; right: 10%; bottom: -12px; height: 30px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(90,30,5,.45), transparent); z-index: -1; }
.home-say { position: absolute; right: 20px; bottom: calc(100% + 18px); width: 300px; background: #fffaf0; color: var(--ink);
  font-size: 23px; line-height: 1.45; padding: 12px 20px; border-radius: 18px; border: 3px solid var(--gold);
  box-shadow: 0 10px 30px rgba(60,20,0,.25); opacity: 0; transition: opacity .6s 3s; }
#home.open .home-say { opacity: 1; }
.home-say::after { content: ""; position: absolute; right: 120px; bottom: -15px; border: 12px solid transparent;
  border-top-color: var(--gold); border-bottom: 0; }
.home-say b { display: block; font-family: var(--title); font-weight: 400; color: var(--red); font-size: 26px; }

/* ---------- 课堂页框架 ---------- */
#lesson { background:
  radial-gradient(1200px 700px at 15% 10%, rgba(255,255,255,.55), transparent 60%),
  radial-gradient(900px 600px at 90% 90%, rgba(160,130,90,.14), transparent 60%), var(--paper); }
.topbar { position: absolute; left: 0; right: 0; top: 0; height: 104px; display: flex; align-items: center;
  padding: 0 40px; gap: 30px; border-bottom: 2px solid var(--line); }
.brand { display: flex; align-items: center; gap: 16px; font-family: var(--title); font-size: 40px; cursor: pointer; }
.seal { font-family: var(--title); background: var(--red); color: #fff4e0; font-size: 28px; padding: 4px 10px;
  border-radius: 6px; letter-spacing: 2px; }
#steps { flex: 1; display: flex; justify-content: center; gap: 8px; }
.step { display: flex; align-items: center; gap: 10px; font-size: 26px; padding: 10px 20px; border-radius: 999px;
  color: var(--ink2); transition: background .2s; }
.step b { font-family: var(--title); font-weight: 400; width: 40px; height: 40px; line-height: 40px; border-radius: 50%;
  border: 2px solid var(--ink3); text-align: center; font-size: 24px; }
.step:hover { background: rgba(0,0,0,.05); }
.step.on { background: var(--ink); color: var(--paper); }
.step.on b { background: var(--red); border-color: var(--red); color: #fff; }
.tbtn { font-size: 22px; padding: 10px 20px; border-radius: 10px; border: 2px solid var(--ink3); color: var(--ink2); background: rgba(255,255,255,.4); }
.tbtn:hover { border-color: var(--ink); color: var(--ink); }
.tbtn.red { border-color: var(--red); color: var(--red); }
.tbtn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.nbtn { font-size: 28px; padding: 14px 34px; border-radius: 12px; background: var(--paper2); border: 2px solid var(--ink3); }
.nbtn.red { background: var(--red); border-color: var(--red); color: #fff; }
.nbtn:disabled { opacity: .35; cursor: default; }

#pages { position: absolute; left: 0; right: 0; top: 104px; bottom: 150px; }
.page { position: absolute; inset: 0; padding: 30px 60px; display: none; }
.page.on { display: block; animation: fadein .5s; }
@keyframes fadein { from { opacity: 0; transform: translateY(10px); } }
.ptitle { font-family: var(--title); font-weight: 400; font-size: 60px; display: flex; align-items: baseline; gap: 20px; }
.ptitle small { font-family: var(--body); font-size: 26px; color: var(--ink3); }

/* ---------- 底栏 莞香伯 ---------- */
.dock { position: absolute; left: 0; right: 0; bottom: 0; height: 150px; display: flex; align-items: center;
  gap: 24px; padding: 0 40px; border-top: 2px solid var(--line); background: rgba(233,223,205,.6); }
.dock-avatar { width: 116px; height: 116px; border-radius: 50%; object-fit: cover; border: 4px solid var(--red);
  cursor: pointer; flex: none; }
.dock-avatar.talk { animation: nod 1.2s ease-in-out infinite; }
@keyframes nod { 50% { transform: translateY(-4px) rotate(-2deg); } }
.dock-bubble { flex: 1; min-width: 0; background: #fffdf8; border-radius: 18px; padding: 8px 22px; position: relative;
  border: 2px solid var(--line); height: 126px; display: flex; flex-direction: column; justify-content: center; }
.dock-bubble::before { content: ""; position: absolute; left: -14px; top: 40px; border: 12px solid transparent;
  border-right-color: #fffdf8; border-left: 0; }
.dock-name { font-family: var(--title); color: var(--red); font-size: 22px; line-height: 1.1; }
.dock-text { font-size: 24px; line-height: 1.32; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.dock-tools, .dock-nav { display: flex; gap: 12px; flex: none; }
.dock-nav { margin-left: 10px; }
/* ---------- 通用卡片 ---------- */
.card { background: #fffdf8; border: 2px solid var(--line); border-radius: 20px; padding: 26px 30px; box-shadow: 0 6px 20px rgba(60,40,20,.06); }
.card h3 { font-family: var(--title); font-weight: 400; font-size: 38px; margin-bottom: 12px; display: flex; align-items: center; gap: 12px; }
.card h3 .tag { font-family: var(--body); font-size: 20px; background: var(--red); color: #fff; padding: 2px 10px; border-radius: 6px; }
.card p, .card li { font-size: 27px; line-height: 1.6; color: var(--ink2); }
.card ol { padding-left: 1.4em; }
.frame { background: #fffdf8; padding: 14px; border: 2px solid var(--line); border-radius: 12px; box-shadow: 0 8px 26px rgba(60,40,20,.1); }
.frame img { width: 100%; height: 100%; object-fit: contain; }
.ai-tag { position: absolute; right: 14px; bottom: 14px; font-size: 18px; background: rgba(29,26,23,.72); color: #fff; padding: 3px 10px; border-radius: 6px; }

/* s1 开场 */
.s1-grid { display: grid; grid-template-columns: 1120px 1fr; gap: 40px; margin-top: 22px; height: 630px; }
.s1-media { position: relative; height: 630px; min-height: 0; }
.s1-media video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.s1-side { display: flex; flex-direction: column; gap: 24px; }
.mtabs { display: flex; gap: 10px; margin-bottom: 12px; }
.mtab { font-size: 24px; padding: 8px 22px; border-radius: 999px; border: 2px solid var(--ink3); }
.mtab.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* s2 行当 */
.hang-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px; margin-top: 20px; height: 540px; }
.hang { position: relative; background: #fffdf8; border: 2px solid var(--line); border-radius: 22px; overflow: hidden; cursor: pointer;
  transition: transform .25s, box-shadow .25s; }
.hang:hover { transform: translateY(-6px); box-shadow: 0 16px 30px rgba(60,40,20,.15); }
.hang img { width: 100%; height: 390px; object-fit: contain; padding: 14px; }
.hang .hchar { position: absolute; left: 18px; top: 14px; font-family: var(--title); font-size: 80px; color: var(--red); line-height: 1; }
.hang .hinfo { padding: 0 24px; }
.hang .hsub { font-size: 28px; font-weight: 700; }
.hang .htypes { font-size: 24px; color: var(--ink3); }
.hang .hdraw { font-size: 24px; color: var(--red2); margin-top: 6px; opacity: 0; transition: opacity .3s; }
.hang.on { border-color: var(--red); box-shadow: 0 0 0 4px rgba(181,52,42,.25); }
.hang.on .hdraw { opacity: 1; }
.act-bar { margin-top: 20px; display: flex; align-items: center; gap: 24px; padding: 18px 30px; }
.act-bar p { flex: 1; }
.timer { font-family: var(--title); font-size: 54px; color: var(--red); min-width: 140px; text-align: center; }

/* s3 风格 */
.style-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px; margin-top: 20px; }
.style-col { display: flex; flex-direction: column; gap: 16px; }
.style-col .frame { position: relative; height: 470px; cursor: pointer; }
.style-col h4 { font-family: var(--title); font-weight: 400; font-size: 40px; text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 56px; }
.chip-key { font-size: 24px; padding: 6px 16px; border-radius: 8px; background: var(--paper2); color: var(--ink2); opacity: 0; transform: scale(.8); transition: all .4s; }
.style-col.on .chip-key { opacity: 1; transform: none; }
.style-col.on .frame { border-color: var(--red); }
.sum-bar { margin-top: 22px; text-align: center; font-size: 30px; }
.sum-bar b { font-family: var(--title); font-weight: 400; color: var(--red); font-size: 44px; margin: 0 8px; }

/* s4 笔墨 */
.s4-body { margin-top: 18px; height: 640px; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; height: 100%; }
.duo .frame { position: relative; height: 560px; }
.duo h4, .moshe h4 { font-family: var(--title); font-weight: 400; font-size: 38px; text-align: center; margin-top: 10px; }
.moshe { display: grid; grid-template-columns: 1100px 1fr; gap: 40px; height: 100%; }
.moshe .frame { height: 620px; }
.four { display: grid; grid-template-columns: 1fr 560px; gap: 40px; height: 100%; }
.four .frame { height: 630px; position: relative; }
.four-list { display: flex; flex-direction: column; gap: 16px; }
.four-item { display: flex; gap: 20px; align-items: center; padding: 20px 26px; border-radius: 18px; border: 2px solid var(--line); background: #fffdf8; cursor: pointer; font-size: 30px; }
.four-item b { font-family: var(--title); font-weight: 400; width: 64px; height: 64px; line-height: 64px; text-align: center; border-radius: 50%; background: var(--paper2); font-size: 36px; flex: none; }
.four-item.on { border-color: var(--red); background: #fff6ef; }
.four-item.on b { background: var(--red); color: #fff; }
.four-item small { display: block; font-size: 22px; color: var(--ink3); }

/* s5 构思坊 */
.s5-grid { display: grid; grid-template-columns: 860px 1fr; gap: 36px; margin-top: 14px; height: 690px; }
.opt-group { margin-bottom: 12px; }
.opt-group label { font-family: var(--title); font-size: 28px; display: block; margin-bottom: 6px; }
.opts { display: flex; flex-wrap: wrap; gap: 10px; }
.opt { font-size: 24px; padding: 6px 16px; border-radius: 10px; border: 2px solid var(--ink3); background: #fffdf8; }
.opt.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.idea { width: 100%; font: inherit; font-size: 24px; padding: 10px 16px; border-radius: 12px; border: 2px solid var(--ink3); background: #fffdf8; }
.btn-draw { margin-top: 6px; width: 100%; font-family: var(--title); font-size: 40px; padding: 10px; border-radius: 16px; background: var(--red); color: #fff; letter-spacing: 6px; }
.btn-draw:disabled { opacity: .5; }
.draft-area { display: grid; grid-template-rows: 1fr 130px; gap: 16px; height: 100%; }
.draft-main { position: relative; display: flex; align-items: center; justify-content: center; }
.draft-main img { cursor: zoom-in; }
.draft-wait { text-align: center; font-size: 30px; color: var(--ink3); }
.inkdrop { width: 90px; height: 90px; border-radius: 50%; background: var(--ink); margin: 0 auto 20px; animation: ink 1.6s ease-in-out infinite; }
@keyframes ink { 0% { transform: scale(.3); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }
.draft-hist { display: flex; gap: 12px; overflow-x: auto; }
.draft-hist img { height: 120px; width: 120px; object-fit: cover; border-radius: 10px; border: 3px solid transparent; cursor: pointer; background: #fff; flex: none; }
.draft-hist img.on { border-color: var(--red); }
.mark { position: absolute; left: 14px; top: 14px; font-size: 20px; color: var(--red); border: 2px solid var(--red); padding: 2px 10px; border-radius: 6px; background: rgba(255,253,248,.85); }

/* s6 展评 */
.s6-grid { display: grid; grid-template-columns: 400px 1fr; gap: 36px; margin-top: 18px; height: 700px; }
.qr-card { text-align: center; }
#qr { width: 300px; height: 300px; margin: 10px auto; background: #fff; padding: 12px; border-radius: 12px; }
#qr img, #qr svg { width: 100%; height: 100%; }
.qr-url { font-size: 17px; color: var(--ink3); word-break: break-all; }
.wall { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 330px; gap: 22px; overflow-y: auto; padding: 4px; align-content: start; }
.work { background: #fffdf8; border: 2px solid var(--line); border-radius: 14px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; animation: fadein .6s; }
.work img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.work .wname { font-size: 22px; text-align: center; padding-top: 6px; }
.work .wname em { font-style: normal; color: var(--red); margin-left: 6px; }
.wall-empty { grid-column: 1 / -1; text-align: center; font-size: 30px; color: var(--ink3); padding-top: 200px; }

/* 弹窗 */
.modal { position: absolute; inset: 0; background: rgba(13,11,10,.75); display: none; align-items: center; justify-content: center; z-index: 30; }
.modal.on { display: flex; }
.modal-box { background: var(--paper); border-radius: 24px; padding: 30px; display: flex; gap: 34px; max-width: 1760px; max-height: 960px; position: relative; }
.modal-box > img { max-height: 900px; max-width: 1100px; object-fit: contain; background: #fff; border-radius: 12px; }
.modal-side { width: 560px; display: flex; flex-direction: column; gap: 18px; }
.modal-side h3 { font-family: var(--title); font-weight: 400; font-size: 44px; }
.review { font-size: 28px; line-height: 1.7; white-space: pre-wrap; flex: 1; overflow-y: auto; }
.review b { color: var(--red); font-weight: 700; }
.modal-close { position: absolute; right: 18px; top: 14px; }

/* 对话抽屉 */
.drawer { position: absolute; right: 0; top: 104px; bottom: 150px; width: 640px; background: #fffdf8; border-left: 2px solid var(--line);
  box-shadow: -20px 0 40px rgba(0,0,0,.12); transform: translateX(105%); transition: transform .35s; z-index: 20; display: flex; flex-direction: column; }
.drawer.on { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; font-family: var(--title); font-size: 36px; border-bottom: 2px solid var(--line); }
#chatLog { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 86%; font-size: 26px; line-height: 1.5; padding: 12px 18px; border-radius: 16px; }
.msg.bot { background: var(--paper2); align-self: flex-start; }
.msg.me { background: var(--ink); color: var(--paper); align-self: flex-end; }
.msg.wait { color: var(--ink3); }
.chat-quick { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 24px 10px; }
.chat-quick button { font-size: 21px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--line); }
#chatForm { display: flex; gap: 12px; padding: 14px 24px 20px; }
#chatInput { flex: 1; font: inherit; font-size: 26px; padding: 12px 16px; border-radius: 12px; border: 2px solid var(--ink3); }

#toast { position: absolute; left: 50%; top: 130px; transform: translateX(-50%); background: var(--ink); color: var(--paper); font-size: 26px;
  padding: 14px 30px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 40; }
#toast.show { opacity: 1; }
/* s1 大图严格限制在框内，不压到底部对话栏 */
.s1-media .frame { box-sizing: border-box; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.s1-media .frame img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }

/* ---------- s2 活动一：整条可点，弹出钟表计时 ---------- */
#actBar { cursor: pointer; transition: border-color .2s, box-shadow .2s; }
#actBar:hover { border-color: var(--red); box-shadow: 0 8px 24px rgba(181,52,42,.15); }
.clock-mask { position: absolute; inset: 0; z-index: 25; display: none; align-items: center; justify-content: center;
  background: rgba(29,26,23,.55); }
.clock-mask.on { display: flex; }
.clock-box { width: 760px; background: var(--paper); border-radius: 28px; padding: 34px 40px 40px; text-align: center;
  border: 3px solid var(--gold); box-shadow: 0 30px 80px rgba(0,0,0,.35); position: relative; }
.clock-title { font-family: var(--title); font-size: 40px; display: flex; align-items: center; justify-content: center; gap: 14px; }
.clock-title .tag { font-family: var(--body); font-size: 22px; background: var(--red); color: #fff; padding: 2px 10px; border-radius: 6px; }
.clock { width: 470px; height: 470px; display: block; margin: 14px auto 0; }
.c-face { fill: #fffdf8; stroke: var(--ink); stroke-width: 6; }
.c-ticks line { stroke: var(--ink3); stroke-width: 3; stroke-linecap: round; }
.c-ticks line.big { stroke: var(--ink); stroke-width: 6; }
.c-track { fill: none; stroke: var(--paper2); stroke-width: 22; }
.c-ring { fill: none; stroke: var(--red); stroke-width: 22; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.c-hand { stroke: var(--ink); stroke-width: 7; stroke-linecap: round; transition: transform .3s; }
.c-hub { fill: var(--red); }
.clock-num { position: absolute; left: 0; right: 0; top: 345px; font-family: var(--title); font-size: 96px; color: var(--ink);
  pointer-events: none; text-shadow: 0 0 12px #fffdf8, 0 0 12px #fffdf8; }
.clock-mask.last .c-ring { stroke: #d9822b; }
.clock-mask.last .clock-num { color: #c0571a; animation: pulse 1s ease-in-out infinite; }
.clock-mask.over .clock-num { color: var(--red); }
@keyframes pulse { 50% { transform: scale(1.08); } }
.clock-btns { display: flex; gap: 16px; justify-content: center; margin-top: 22px; }
.clock-btns .nbtn { min-width: 140px; }

/* ---------- s1：图框贴合 3:2 原图，不留白边 ---------- */
.s1-grid { grid-template-columns: 1020px 1fr; height: 680px; }
.s1-media { height: auto; aspect-ratio: 3 / 2; }
.s1-media .frame { padding: 10px; }
.s1-media .frame img { object-fit: cover; border-radius: 6px; }
.s1-side { justify-content: flex-start; }

/* ---------- 首页：只留一个入口，莞香伯只负责说话 ---------- */
.home-figure { cursor: default; }
.btn-gong.playing { animation: gongPulse 1.2s ease-in-out infinite; }
@keyframes gongPulse { 50% { box-shadow: 0 0 0 4px var(--gold), 0 0 0 16px rgba(201,164,92,.25), 0 14px 34px rgba(110,30,10,.45); } }
