/* ============================================================
   动效增强：入场 / 交互反馈 / 状态提示
   原则：只加"能传达信息"的动效（进场次序、选中反馈、忙碌状态、
   出错提醒），不做纯装饰的晃动。全部在末尾的 prefers-reduced-motion
   里统一关掉，系统开了「减弱动态效果」的用户不会被晃到。
   ============================================================ */

/* ① 首屏卡片依次浮现。
      用 backwards 让元素在 delay 期间保持起始态，纯 CSS 实现 ——
      不依赖 JS，也就不会出现"先渲染出来、再闪一下重播"的抖动。
      ⚠️ animation-delay 必须单独写：若用 animation 简写，
      简写会顺带把 delay 重置成 0s，且简写所在规则特异性更高，
      会把下面 nth-child 的 delay 全部吃掉，错落效果就没了。
      排除「运行时会切换 display 的元素」：CSS 动画在元素从
      display:none 恢复显示时会整个重播一遍 —— 这些元素每次显隐
      都会闪一次入场动画（如 deb/dylib 切换时越狱类型块重新出现）。
      toast / 结果框同理：它们靠自己的 class 控制显隐，
      跟着入场会露出一个空框。 */
@keyframes cardIn{from{opacity:0;transform:translateY(16px) scale(.985);}to{opacity:1;transform:none;}}
.container > *:not(#toast_box):not(#result_box):not(#schemeBlock):not(#log_box):not(#confirmOverlay){
    animation-name:cardIn;
    animation-duration:.55s;
    animation-timing-function:cubic-bezier(.22,.9,.3,1);
    animation-fill-mode:backwards;
}
.container > *:nth-child(1){animation-delay:.03s;}
.container > *:nth-child(2){animation-delay:.09s;}
.container > *:nth-child(3){animation-delay:.15s;}
.container > *:nth-child(4){animation-delay:.21s;}
.container > *:nth-child(5){animation-delay:.27s;}
.container > *:nth-child(6){animation-delay:.33s;}
.container > *:nth-child(n+7){animation-delay:.38s;}

/* ② 顶栏 Logo：缓慢上下浮动 + 光晕呼吸；鼠标移上去定住并微微倾斜。
      hover 必须用 animation:none（而不是 play-state:paused）——
      暂停时动画值仍然覆盖 transform，只暂停的话 hover 位移不会生效。 */
@keyframes logoFloat{0%,100%{transform:translateY(0);}50%{transform:translateY(-3px);}}
@keyframes logoGlow{
    0%,100%{box-shadow:0 12px 24px -10px rgba(10,132,255,.85), inset 0 1px 0 rgba(255,255,255,.7), inset 0 -3px 8px rgba(0,34,102,.38);}
    50%{box-shadow:0 18px 32px -8px rgba(10,132,255,1), inset 0 1px 0 rgba(255,255,255,.85), inset 0 -3px 8px rgba(0,34,102,.38);}
}
.top-bar .logo{
    animation:logoFloat 4.6s ease-in-out infinite, logoGlow 4.6s ease-in-out infinite;
    transition:transform .3s cubic-bezier(.34,1.3,.5,1);
}
.top-bar .logo:hover{animation:none;transform:translateY(-2px) rotate(-4deg);}

/* ③ 主按钮：编译期间是 disabled 灰态，用呼吸光晕表示"正在忙"，
      比死灰一片更能说明此刻在干活 */
@keyframes btnBusy{
    0%,100%{box-shadow:inset 0 1px 0 #fff, inset 0 -2px 6px rgba(20,40,80,.06);}
    50%{box-shadow:0 14px 30px -14px rgba(10,132,255,.55), inset 0 1px 0 #fff, inset 0 -2px 6px rgba(20,40,80,.1);}
}
.main-btn:disabled{animation:btnBusy 1.7s ease-in-out infinite;}

/* ④ 选项按钮：点中的那一下弹一下，给出明确的"选中了"反馈 */
@keyframes optPop{0%{transform:scale(1);}40%{transform:scale(1.055);}100%{transform:scale(1);}}
.opt-opt.just-picked{animation:optPop .42s cubic-bezier(.34,1.5,.5,1);}

/* ⑤ 下载卡片：编译完成后逐个弹出，不要一整块砸出来 */
@keyframes dlPop{from{opacity:0;transform:translateY(14px) scale(.94);}to{opacity:1;transform:none;}}
.download-card{animation:dlPop .5s cubic-bezier(.22,.9,.3,1) backwards;}
.download-card:nth-child(1){animation-delay:.06s;}
.download-card:nth-child(2){animation-delay:.16s;}
.download-card:nth-child(3){animation-delay:.26s;}

/* ⑥ 结果框：编译失败时轻轻抖一下，把注意力拉过来 */
@keyframes boxShake{
    0%,100%{transform:translateX(0);}
    20%{transform:translateX(-5px);}40%{transform:translateX(5px);}
    60%{transform:translateX(-3px);}80%{transform:translateX(3px);}
}
.result-box.error.show{animation:boxShake .5s ease;}

/* ⑦ 页签切换：内容淡入上移，切换不再生硬 */
@keyframes panelIn{from{opacity:0;transform:translateY(8px);}to{opacity:1;transform:none;}}
.tab-panel.is-switching{animation:panelIn .34s cubic-bezier(.22,.9,.3,1);}

@media (prefers-reduced-motion: reduce){
    .bg-canvas .blob,.main-btn::after{animation:none !important;}
    .container > *:not(#toast_box):not(#result_box):not(#schemeBlock):not(#log_box):not(#confirmOverlay),
    .top-bar .logo,.main-btn:disabled,.opt-opt.just-picked,
    .download-card,.result-box.error.show,.tab-panel.is-switching{animation:none !important;}
}
