/* App 開啟動畫：點浮出 → 四個方塊照「勾」的筆順砸下 → 最後一塊落地時光圈＋火花 → 字逐一浮上 → 淡出。
   全長約 1.7 秒，點一下可跳過；同一次開啟只播一次（重新整理不再播）；系統設定「減少動態效果」時不播。
   畫面結構在 index.html 的 splash:start 區塊，由 logo/進場動畫/scripts/make-app-splash.cjs 產生。 */
.splash {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  background: var(--bg, #F4EFE6);
  --sp-dot: #B9AC98; --sp-ink: #2B2118; --sp-sub: #8A7A66;
  --sp-q0: #E2AE80; --sp-q1: #C9824A; --sp-q2: #AE5F27; --sp-q3: #8A4214;
  transition: opacity .32s ease, visibility 0s linear .32s;
}
@media (prefers-color-scheme: dark) {
  .splash {
    background: var(--bg, #1B1612);
    --sp-dot: #5A4D40; --sp-ink: #F1E8DA; --sp-sub: #A89880;
    --sp-q0: #7A4520; --sp-q1: #A9632F; --sp-q2: #D3884C; --sp-q3: #F0B27A;
  }
}
.splash.out { opacity: 0; visibility: hidden; }
.sp-logo { width: min(56vw, 240px); height: auto; overflow: visible; margin-bottom: 6vh; transition: transform .32s ease; }
.splash.out .sp-logo { transform: scale(1.06); }

.sp-dot, .sp-sq, .sp-ring, .sp-spark, .sp-ch, .sp-en path { transform-box: fill-box; transform-origin: center; }

/* 點：由中心往外彈出 */
.sp-dot { fill: var(--sp-dot); animation: sp-pop .34s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(var(--d) * .32s); }
@keyframes sp-pop { from { transform: scale(0); opacity: 0; } }

/* 方塊：從前方旋轉砸下，落地壓一下再彈回 */
.sp-sq { animation: sp-drop .42s both; animation-delay: calc(.16s + var(--i) * .09s); }
.sp-q0 { fill: var(--sp-q0); } .sp-q1 { fill: var(--sp-q1); } .sp-q2 { fill: var(--sp-q2); } .sp-q3 { fill: var(--sp-q3); }
@keyframes sp-drop {
  0%   { transform: scale(2.4) rotate(-40deg); opacity: 0; animation-timing-function: cubic-bezier(.5, 0, .9, .5); }
  55%  { transform: scale(.88) rotate(0deg); opacity: 1; animation-timing-function: ease-out; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* 最後一塊落地：光圈擴散＋小方塊火花 */
.sp-ring { fill: none; stroke: var(--sp-q3); stroke-width: 4; opacity: 0; animation: sp-ring .6s ease-out .62s both; }
@keyframes sp-ring { 0% { transform: scale(.7); opacity: 0; } 1% { transform: scale(.7); opacity: .9; } 100% { transform: scale(2.3); opacity: 0; } }
.sp-spark { fill: var(--sp-q3); opacity: 0; animation: sp-spark .55s cubic-bezier(.1, .9, .2, 1) .62s both; }
@keyframes sp-spark {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 0; }
  1%   { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--x), var(--y)) scale(0) rotate(180deg); opacity: 0; }
}

/* 字：待、辦、誌 逐字浮上，再淡入 TODO JOURNAL */
.sp-ch { fill: var(--sp-ink); animation: sp-rise .5s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(.55s + var(--i) * .07s); }
@keyframes sp-rise { from { opacity: 0; transform: translateY(28px); } }
.sp-en path { fill: var(--sp-sub); animation: sp-fade .45s ease-out .85s both; }
@keyframes sp-fade { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) { .splash { display: none; } }
