/* 书包小精灵 Bobo。舞台固定 1920×1080，由 app.js 等比缩放到屏幕。
   不用 inset / flex gap / aspect-ratio 等新属性，老一点的希沃浏览器也要能跑。 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #fff3d6; }
body { font-family: "Comic Sans MS", "Chalkboard SE", "Century Gothic", "Microsoft YaHei", sans-serif; color: #3b3350; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
button { font-family: inherit; border: 0; cursor: pointer; outline: none; }

#stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; overflow: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,.75) 0, rgba(255,255,255,0) 22%),
    radial-gradient(circle at 88% 30%, rgba(255,255,255,.6) 0, rgba(255,255,255,0) 20%),
    linear-gradient(#fff6dd 0, #ffe9b8 64%, #ffd98f 64%, #ffcf7a 100%); }

/* —— 星星 */
#stars { position: absolute; left: 465px; top: 26px; width: 990px; height: 156px; }
.slot { position: absolute; top: 0; width: 150px; height: 156px; border-radius: 28px; background: rgba(255,255,255,.72); box-shadow: 0 6px 0 rgba(214,160,60,.25); }
.slot svg { position: absolute; left: 39px; top: 8px; width: 72px; height: 72px; }
.slot svg path { fill: #e6dcc6; stroke: #d3c6a8; stroke-width: 3; transition: fill .3s; }
.slot img { position: absolute; left: 41px; top: 80px; width: 68px; height: 68px; object-fit: contain; opacity: 0; transform: scale(.3); transition: opacity .4s, transform .4s; }
.slot.on svg path { fill: #ffc21c; stroke: #f09a00; }
.slot.on svg { animation: starPop .7s cubic-bezier(.3,1.6,.5,1); }
.slot.on img { opacity: 1; transform: scale(1); }
@keyframes starPop { 0% { transform: scale(.2) rotate(-60deg); } 60% { transform: scale(1.5) rotate(12deg); } 100% { transform: scale(1) rotate(0); } }

/* —— Bobo */
#bobo { position: absolute; left: 300px; top: 400px; width: 520px; height: 600px; }
#bobo svg { display: block; overflow: visible; }
#bobo .shadow { fill: rgba(150,100,20,.22); }
#bobo .shell { fill: #4fa8f5; }
#bobo .inside { fill: #1f4f8f; }
#bobo .flap { transform-origin: 260px 136px; transition: transform .45s cubic-bezier(.3,1.5,.5,1); }
#bobo .flap-top { fill: #3a8fe6; transition: fill .3s; }
#bobo .buckle { fill: #ffd34e; }
#bobo .buckle-hole { fill: #e0a91a; }
#bobo .handle { fill: none; stroke: #2f7bd0; stroke-width: 22; stroke-linecap: round; }
#bobo .pocket { fill: #ffd34e; }
#bobo .zip { stroke: #e0a91a; stroke-width: 8; stroke-linecap: round; stroke-dasharray: 2 16; }
#bobo .foot { fill: #2f7bd0; }
#bobo .arm rect { fill: #3a8fe6; }
#bobo .arm-l { transform-origin: 54px 316px; }
#bobo .arm-r { transform-origin: 466px 316px; transition: transform .3s; }
#bobo .cheek { fill: #ff9fb2; opacity: .85; }
#bobo .eye { fill: #fff; }
#bobo .pupil { fill: #2b2540; }
#bobo .glint { fill: #fff; }
#bobo .eyes { transform-origin: 260px 318px; animation: blink 4.2s infinite; }
#bobo .smile { fill: none; stroke: #2b2540; stroke-width: 9; stroke-linecap: round; }
#bobo .mouth { fill: #a8324a; display: none; transform-origin: 260px 362px; }
#bobo .body { transform-origin: 260px 540px; animation: bob 2.6s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) scale(1,1); } 50% { transform: translateY(-10px) scale(1.01,.99); } }
@keyframes blink { 0%,94%,100% { transform: scaleY(1); } 96.5% { transform: scaleY(.08); } }

#bobo.talking .smile { display: none; }
#bobo.talking .mouth { display: block; animation: talk .26s ease-in-out infinite alternate; }
@keyframes talk { from { transform: scale(.8,.25); } to { transform: scale(1,1); } }

#bobo.open .flap { transform: scaleY(-.72); }
#bobo.open .flap-top { fill: #2f7bd0; }

#bobo.happy { animation: jump .9s ease-in-out; }
@keyframes jump { 0%,100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-90px) rotate(-5deg); } 50% { transform: translateY(0) rotate(0); } 70% { transform: translateY(-46px) rotate(5deg); } }

#bobo.wave .arm-r { animation: wave .5s ease-in-out 5 alternate; }
@keyframes wave { from { transform: rotate(-150deg); } to { transform: rotate(-110deg); } }

#bobo.listening .arm-r { transform: rotate(-140deg); }
#bobo.listening .body { animation: lean 1.2s ease-in-out infinite alternate; }
@keyframes lean { from { transform: rotate(2deg); } to { transform: rotate(6deg); } }

#bobo.puzzled .body { animation: shake .5s ease-in-out 2; }
@keyframes shake { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }

#dots { position: absolute; left: 440px; top: 40px; display: none; }
#dots i { display: inline-block; width: 26px; height: 26px; margin-right: 12px; border-radius: 50%; background: #4fa8f5; animation: dot 1s infinite; }
#dots i:nth-child(2) { animation-delay: .15s; } #dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-18px); opacity: 1; } }
#bobo.thinking #dots { display: block; }

/* —— 对话气泡 */
#bubble { position: absolute; left: 240px; top: 212px; max-width: 860px; min-width: 300px; padding: 26px 44px; border-radius: 48px; background: #fff; box-shadow: 0 8px 0 rgba(214,160,60,.3); font-size: 58px; line-height: 1.25; font-weight: 700; opacity: 0; transform: scale(.6); transform-origin: 320px 100%; transition: opacity .2s, transform .25s cubic-bezier(.3,1.5,.5,1); pointer-events: none; }
#bubble:after { content: ""; position: absolute; left: 290px; bottom: -34px; border: 22px solid transparent; border-top-color: #fff; border-bottom-width: 14px; }
#bubble.on { opacity: 1; transform: scale(1); }
#bubble b { color: #f0562f; }

#heard { position: absolute; left: 1130px; top: 846px; max-width: 760px; padding: 8px 28px; border-radius: 30px; background: #7c6ee6; color: #fff; font-size: 34px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .3s; pointer-events: none; }
#heard.on { opacity: 1; }

/* —— 飞出来的文具 */
#show { position: absolute; left: 1130px; top: 206px; width: 600px; height: 624px; border-radius: 56px; background: #fff; box-shadow: 0 12px 0 rgba(214,160,60,.3); opacity: 0; pointer-events: none; overflow: hidden; }
#show .rays { position: absolute; left: -200px; top: -260px; width: 1000px; height: 1000px; background: repeating-conic-gradient(rgba(255,211,78,.28) 0 12deg, rgba(255,211,78,0) 12deg 24deg); animation: spin 26s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#show img { position: absolute; left: 90px; top: 34px; width: 420px; height: 420px; object-fit: contain; }
#showWord { position: absolute; left: 0; top: 462px; width: 100%; text-align: center; font-size: 112px; line-height: 1.2; font-weight: 700; color: #f0562f; white-space: nowrap; }
#showWord.long { font-size: 96px; }
#show.in { opacity: 1; animation: flyIn .85s cubic-bezier(.2,1.2,.4,1); }
@keyframes flyIn { 0% { transform: translate(-860px,-40px) scale(.06) rotate(-40deg); opacity: 0; } 15% { opacity: 1; } 60% { transform: translate(0,-30px) scale(1.08) rotate(4deg); } 100% { transform: none; } }

/* —— 提示条 */
#hint { position: absolute; left: 1085px; top: 922px; width: 825px; height: 116px; white-space: nowrap; }
#hint .frame { display: inline-block; padding: 14px 40px; border-radius: 40px; background: rgba(255,255,255,.85); border: 5px dashed #f5a623; font-size: 62px; line-height: 78px; font-weight: 700; }
#hint .blank { display: inline-block; width: 190px; height: 12px; margin: 0 8px; border-radius: 6px; background: #f0562f; vertical-align: baseline; }
#hint.nudge .frame { animation: nudge .5s ease-in-out 3; border-color: #f0562f; }
@keyframes nudge { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }
#hint .chip { display: inline-block; margin-right: 10px; padding: 12px 16px; border-radius: 30px; background: #fff; border: 4px solid #7c6ee6; color: #5a4bd0; font-size: 26px; line-height: 44px; font-weight: 700; vertical-align: top; margin-top: 22px; }

/* —— 话筒 */
#mic { position: absolute; left: 865px; top: 850px; width: 190px; height: 190px; border-radius: 50%; background: #ff7a45; box-shadow: 0 12px 0 #d9541f, 0 0 0 12px rgba(255,255,255,.7); transition: transform .1s, background .2s; }
#mic svg { position: absolute; left: 45px; top: 42px; }
#mic svg rect { fill: #fff; } #mic svg path { stroke: #fff; }
#mic:active { transform: translateY(8px); box-shadow: 0 4px 0 #d9541f, 0 0 0 12px rgba(255,255,255,.7); }
#mic.ready { animation: micPulse 1.6s ease-in-out infinite; }
@keyframes micPulse { 0%,100% { box-shadow: 0 12px 0 #d9541f, 0 0 0 12px rgba(255,255,255,.7); } 50% { box-shadow: 0 12px 0 #d9541f, 0 0 0 30px rgba(255,122,69,.28); } }
#mic.rec { background: #e8384f; box-shadow: 0 12px 0 #a81f33, 0 0 0 16px rgba(232,56,79,.3); }
#mic.rec svg { opacity: .25; }
#mic.busy { background: #c9c1b0; box-shadow: 0 12px 0 #a39a86, 0 0 0 12px rgba(255,255,255,.7); }
#level { position: absolute; left: 35px; top: 50px; width: 120px; height: 90px; display: none; }
#mic.rec #level { display: block; }
#level i { position: absolute; bottom: 45px; width: 14px; height: 14px; margin-bottom: -7px; border-radius: 7px; background: #fff; }
#level i:nth-child(1) { left: 6px; } #level i:nth-child(2) { left: 30px; } #level i:nth-child(3) { left: 54px; } #level i:nth-child(4) { left: 78px; } #level i:nth-child(5) { left: 102px; }
#micTip { position: absolute; left: 760px; top: 792px; width: 400px; text-align: center; font-size: 34px; font-weight: 700; color: #b0563a; pointer-events: none; }

/* —— 老师控制栏 */
#gear { position: absolute; left: 22px; top: 22px; width: 68px; height: 68px; border-radius: 50%; background: rgba(255,255,255,.55); color: #b79a66; font-size: 40px; line-height: 68px; padding: 0; }
#gear.alert { background: #ff7a45; color: #fff; animation: nudge .6s ease-in-out infinite; }
#panel { position: absolute; left: 18px; top: 102px; width: 218px; padding: 12px 12px 4px; border-radius: 24px; background: rgba(255,255,255,.96); box-shadow: 0 8px 24px rgba(120,80,10,.25); display: none; font-family: "Microsoft YaHei", sans-serif; }
#panel.on { display: block; }
.panel-title { font-size: 20px; color: #9a8a6a; text-align: center; margin-bottom: 8px; }
#panel button { display: block; width: 100%; height: 58px; margin-bottom: 8px; border-radius: 16px; background: #f1ead9; color: #4a4030; font-size: 23px; font-family: inherit; }
#panel button:active { background: #e2d7bd; }
#panel button.warn { background: #ffe1dc; color: #c23a2a; }
#shortcuts button { height: 74px; background: #e8f3ff; text-align: left; padding: 0 10px 0 78px; position: relative; font-family: "Comic Sans MS", "Century Gothic", sans-serif; font-size: 21px; font-weight: 700; color: #2b5d9c; white-space: nowrap; }
#shortcuts button img { position: absolute; left: 10px; top: 7px; width: 60px; height: 60px; object-fit: contain; }
#shortcuts button.got { background: #fff3c9; }
#shortcuts button kbd { position: absolute; right: 8px; top: 6px; font-size: 15px; font-family: Consolas, monospace; color: #9ab; font-weight: 400; }

/* —— 彩纸 */
#confetti { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; }
#confetti i { position: absolute; top: -40px; width: 18px; height: 30px; border-radius: 4px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(1200px) rotate(720deg); } }

/* —— 开场和结尾 */
#cover, #end { position: absolute; left: 0; top: 0; width: 100%; height: 100%; text-align: center; }
#cover { background: linear-gradient(#ffcf5c, #ffa94d); }
#cover.off { display: none; }
.cover-title { margin-top: 250px; font-size: 150px; font-weight: 700; color: #fff; text-shadow: 0 8px 0 #e07b1a; }
.cover-sub { margin-top: 10px; font-size: 62px; color: #7a3d00; }
#again { font-size: 72px !important; white-space: nowrap; }
#start, #again { margin-top: 80px; width: 460px; height: 170px; border-radius: 85px; background: #fff; color: #f0562f; font-size: 96px; font-weight: 700; box-shadow: 0 14px 0 #e07b1a; }
#start:active, #again:active { transform: translateY(8px); box-shadow: 0 6px 0 #e07b1a; }
#start.loading { color: #c9b9a0; }
.cover-note { margin-top: 70px; font-size: 30px; color: #7a3d00; font-family: "Microsoft YaHei", sans-serif; }
.cover-note.bad { display: inline-block; padding: 12px 30px; border-radius: 20px; background: #fff; color: #c23a2a; }
#end { display: none; background: rgba(255,246,221,.94); }
#end.on { display: block; }
.end-title { margin-top: 330px; font-size: 150px; font-weight: 700; color: #f0562f; }

/* —— 学校视频：盖住整个屏幕 */
#videoLayer { position: fixed; left: 0; top: 0; width: 100%; height: 100%; background: #000; display: none; z-index: 50; }
#videoLayer.on { display: block; }
#video { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
#skip { position: absolute; right: 24px; top: 24px; padding: 10px 22px; border-radius: 24px; background: rgba(255,255,255,.22); color: #fff; font-size: 20px; font-family: "Microsoft YaHei", sans-serif; }

#toast { position: fixed; left: 50%; bottom: 4%; transform: translateX(-50%); max-width: 90%; padding: 12px 28px; border-radius: 30px; background: rgba(40,30,20,.88); color: #fff; font-size: 20px; font-family: "Microsoft YaHei", sans-serif; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 60; }
#toast.on { opacity: 1; }

/* —— 结束页：Bobo 留在左边挥手，右边是告别语 */
#stage.ended #show, #stage.ended #hint, #stage.ended #mic, #stage.ended #micTip, #stage.ended #heard { display: none; }
#end { left: 900px; width: 1000px; background: none; }
.end-title { margin-top: 300px; font-size: 98px; white-space: nowrap; }
