/* ---- 標題畫面動畫（搭配 js/title-fx.js） ---- */
.title-fx, .title-ov { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.title-fx { opacity: 0; transition: opacity .4s; }
.title-screen.tfx-gl .title-fx { opacity: 1; }
/* 圖還沒載好前不要露出破圖框 */
.title-logo-box img:not([src]), .title-logo-box img[src=""] { visibility: hidden; }
.title-screen > :not(.title-flash) { translate: var(--sx, 0px) var(--sy, 0px); }
.title-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 3; mix-blend-mode: screen; }

/* LOGO：字一層、劍一層（劍在字後面） */
.title-logo-box { position: relative; width: min(92vw, 520px); aspect-ratio: 640 / 360; flex: none; }
.title-logo-box .title-logo, .title-logo-box .tl-sword { position: absolute; inset: 0; width: 100%; height: 100%; animation: none; }
.title-logo-box .tl-sword { transform-origin: 47% 66%; filter: drop-shadow(0 6px 10px rgba(0,0,0,.5)); }
.title-logo-box .title-logo { filter: drop-shadow(0 6px 14px rgba(0,0,0,.6)); }
@media (min-aspect-ratio: 1/1) and (min-width: 700px) { .title-logo-box { width: min(46vw, 600px); } }
.title-screen.tfx-ready .title-logo-box { animation: tfxFloat 5s ease-in-out infinite; }
@keyframes tfxFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* 掃過字面、劍身的亮光 */
.title-logo-box::before, .title-logo-box::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(105deg, transparent 0%, transparent 40%, rgba(255,255,255,.95) 49%, rgba(255,246,200,.9) 51%, transparent 60%, transparent 100%);
  background-size: 300% 100%; background-position: 120% 0; mix-blend-mode: overlay;
  -webkit-mask: var(--mtext) center / 100% 100% no-repeat; mask: var(--mtext) center / 100% 100% no-repeat; }
.title-logo-box::before { mix-blend-mode: screen; -webkit-mask-image: var(--msword); mask-image: var(--msword);
  background: linear-gradient(140deg, transparent 0%, transparent 42%, rgba(255,255,255,.95) 50%, transparent 58%, transparent 100%); background-size: 300% 300%; background-position: 0% 0%; }
.title-logo-box .tl-sword { z-index: 0; } .title-logo-box::before { z-index: 1; } .title-logo-box .title-logo { z-index: 2; } .title-logo-box::after { z-index: 3; }
.tfx-shine .title-logo-box::after { animation: tfxShine 1.1s .1s ease-in-out both; }
.tfx-shine .title-logo-box::before { animation: tfxGlint .9s ease-in-out both; }
@keyframes tfxShine { 0% { opacity: 1; background-position: 120% 0; } 100% { opacity: 1; background-position: -20% 0; } }
@keyframes tfxGlint { 0% { opacity: 1; background-position: 0% 0%; } 100% { opacity: 1; background-position: 100% 100%; } }

/* 「觸碰畫面開始」 */
.title-tap { position: absolute; left: 0; right: 0; bottom: calc(22% + env(safe-area-inset-bottom, 0px)); z-index: 4; text-align: center; pointer-events: none;
  font-family: "Noto Serif TC", "Songti TC", "STSong", serif; font-weight: 900; font-size: 22px; letter-spacing: .4em; color: #ffe7a6;
  text-shadow: 0 0 12px rgba(255,190,80,.8), 0 2px 3px #000; opacity: 0; transition: opacity .3s; }
.title-tap .d { display: none; }
@media (hover: hover) and (pointer: fine) { .title-tap .m { display: none; } .title-tap .d { display: inline; } }
.title-tap::before, .title-tap::after { content: "◆"; font-size: 10px; vertical-align: middle; margin: 0 14px; letter-spacing: 0; color: #e8b04a; }
.tfx-gate .title-tap { opacity: 1; animation: tfxPulse 1.8s ease-in-out infinite; }
@keyframes tfxPulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.tfx-gate { cursor: pointer; }
.tfx-gate .title-art { filter: brightness(.35); }

/* 開場前、開場中：LOGO 和按鈕先藏起來 */
.tfx-gate .title-logo-box { opacity: 0; }
.tfx-gate .title-btns, .tfx-gate .title-foot, .tfx-intro .title-btns, .tfx-intro .title-foot { opacity: 0; pointer-events: none; animation: none; }
.tfx-ready .title-btns { animation: tfxUp .6s cubic-bezier(.2,1.2,.4,1) both; }
.tfx-ready .title-foot { animation: tfxUp .6s .15s both; }
@keyframes tfxUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .title-screen.tfx-ready .title-logo-box { animation: none; } }
/* 排行榜跟按鈕一起：開場前藏起來，開場後滑上來 */
.tfx-gate .lb, .tfx-intro .lb { opacity: 0; pointer-events: none; animation: none; }
.tfx-ready .lb { animation: tfxUp .6s .05s cubic-bezier(.2,1.2,.4,1) both; }
