/* ---------------------------------------------------------------- タイトル画面（title.js） */
/* 見本：A4_kohaku_mock（PC はロゴ幅 54%・中心 39%、帯 92.5%。横長のスマホはロゴ幅 50%・中心 37%、帯 93.5%） */
#title { position: fixed; inset: 0; z-index: 9700; overflow: hidden; background: #0b0410; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; -webkit-user-select: none; user-select: none;
  --logo-w: min(54vw, 120vh); --logo-y: 39%; --tap-y: 92.5%; --tap-fs: 5.9vh; }
@media (min-aspect-ratio: 2/1) { #title { --logo-w: min(50vw, 108vh); --logo-y: 37%; --tap-y: 93.5%; --tap-fs: 6.8vh; } }
@media (max-aspect-ratio: 4/3) { #title { --logo-w: 82vw; --logo-y: 34%; --tap-y: 88%; --tap-fs: min(5vh, 7vw); } }
/* 光（PixiJS のブルーム）を、タイトル画面の上に出す */
body.titling .glow-canvas { z-index: 9800; }
/* タイトルの間は、下のホームを描かない（重ねて描くとコマが落ちる） */
body.title-cover #app, body.title-cover > .myhandcards { visibility: hidden; }

/* 一枚絵：0.6秒で暗から明るく、そのあとゆっくり寄る（transform だけ） */
#title .tt-art { position: absolute; inset: -2%; background: center 70% / cover no-repeat; transform-origin: 50% 45%;
  animation: ttArtIn .6s ease-out both, ttArtZoom 26s ease-in-out .6s infinite alternate; will-change: transform; }
@keyframes ttArtIn { from { opacity: 0; filter: brightness(.2); } to { opacity: 1; filter: none; } }
@keyframes ttArtZoom { from { transform: scale(1); } to { transform: scale(1.07); } }
/* 下を少し落ち着かせる（文字が読めるように）＋ロゴの後ろの柔らかい光 */
#title .tt-shade { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 68%, rgba(26, 6, 30, .55) 100%),
    radial-gradient(ellipse 26% 26% at 50% var(--logo-y), rgba(255, 240, 220, .28), transparent 70%); }

/* ロゴ：1.3倍から1.0倍へ「ドン」と収まる */
#title .tt-logo { position: absolute; left: 50%; top: var(--logo-y); width: var(--logo-w); transform: translate(-50%, -50%); }
#title .tt-logo img { display: block; width: 100%; height: auto; animation: ttLogoIn .55s cubic-bezier(.25, 1.6, .45, 1) .6s both;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .55)); }
@keyframes ttLogoIn { 0% { opacity: 0; transform: scale(1.3); } 60% { opacity: 1; transform: scale(.97); } 100% { opacity: 1; transform: scale(1); } }
/* 収まった時に、金の光がふわっと広がる */
#title .tt-halo { position: absolute; left: 50%; top: 50%; width: 120%; height: 90%; transform: translate(-50%, -50%) scale(.6); border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 226, 140, .75), rgba(255, 190, 80, .25) 55%, transparent 75%); mix-blend-mode: screen; }
#title.landed .tt-halo { animation: ttHalo 1.4s ease-out both; }
@keyframes ttHalo { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.35); } }
/* 4〜5秒おきに、光の帯がロゴの上を走る（ロゴの形で切り抜く） */
#title .tt-shine { position: absolute; inset: 0; pointer-events: none; opacity: 0;
  -webkit-mask: var(--logo) center / 100% 100% no-repeat; mask: var(--logo) center / 100% 100% no-repeat;
  background: linear-gradient(110deg, transparent 38%, rgba(255, 255, 255, .0) 42%, rgba(255, 255, 245, .85) 50%, rgba(255, 255, 255, 0) 58%, transparent 62%) no-repeat;
  background-size: 250% 100%; background-position: 130% 0; mix-blend-mode: screen; }
#title.landed .tt-shine { opacity: 1; animation: ttShine 4.6s ease-in-out .3s infinite; }
@keyframes ttShine { 0% { background-position: 130% 0; } 22% { background-position: -30% 0; } 100% { background-position: -30% 0; } }

/* 下の漆の帯：読み込み中は細い金の線、読み終わったら「タップしてはじめる」 */
#title .tt-band { position: absolute; left: 50%; top: var(--tap-y); transform: translate(-50%, -50%); width: calc(var(--tap-fs) * 13); height: calc(var(--tap-fs) * 1.55);
  display: flex; align-items: center; justify-content: center; }
#title .tt-plate { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(40, 8, 6, .78), rgba(12, 2, 4, .78) 50%, rgba(40, 8, 6, .78));
  -webkit-mask: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); mask: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  box-shadow: inset 0 3px 0 #ffeca0, inset 0 6px 0 rgba(0, 0, 0, .2), inset 0 7px 0 #b8872b, inset 0 -3px 0 #ffeca0, inset 0 -7px 0 #b8872b; }
#title .tt-bar { position: absolute; left: 12%; right: 12%; top: 50%; height: 3px; margin-top: -1.5px; border-radius: 2px; background: rgba(255, 236, 160, .15); overflow: hidden; transition: opacity .4s; }
#title .tt-bar b { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0); transition: transform .35s ease-out;
  background: linear-gradient(90deg, #b8740e, #ffe9a0 60%, #fff); box-shadow: 0 0 8px rgba(255, 220, 120, .9); }
#title.ready .tt-bar { opacity: 0; }
/* 金の太ぶち文字。消える点滅ではなく、呼吸のように明るさと大きさを変える */
#title .tt-tap { position: relative; opacity: 0; transform: scale(.9); transition: opacity .35s, transform .35s cubic-bezier(.25, 1.6, .45, 1); white-space: nowrap; }
#title.ready .tt-tap { opacity: 1; transform: none; }
#title .tt-tap span { display: inline-block; font: 900 var(--tap-fs) / 1 "M PLUS Rounded 1c", "Yu Gothic", sans-serif; letter-spacing: .06em;
  background: linear-gradient(180deg, #fffef0 0%, #ffe680 30%, #ffb800 48%, #8a4a00 52%, #e89a10 70%, #fff2a0 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(2px 0 0 #7a3c00) drop-shadow(-2px 0 0 #7a3c00) drop-shadow(0 2px 0 #7a3c00) drop-shadow(0 -2px 0 #7a3c00)
    drop-shadow(2px 0 0 #120400) drop-shadow(-2px 0 0 #120400) drop-shadow(0 2.5px 0 #120400) drop-shadow(0 -2px 0 #120400) drop-shadow(0 0 14px rgba(255, 200, 90, .65)); }
#title.ready .tt-tap span { animation: ttBreathe 2.4s ease-in-out .35s infinite; }
@keyframes ttBreathe { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.06); opacity: .82; } }

/* 押した時：白金の光が広がって、ホームへ明ける */
#title .tt-flash { position: absolute; left: 50%; top: var(--tap-y); width: 40vmax; height: 40vmax; margin: -20vmax 0 0 -20vmax; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(closest-side, #fffdf4, rgba(255, 240, 200, .95) 40%, rgba(255, 220, 140, .6) 70%, transparent); }
#title.go { pointer-events: none; animation: ttOut .5s ease-in .4s both; }
#title.go .tt-flash { animation: ttFlash .7s ease-out both; }
#title.go .tt-tap span { animation: none; transform: scale(1.12); }
@keyframes ttFlash { 0% { opacity: 0; transform: scale(.1); } 40% { opacity: 1; } 100% { opacity: 1; transform: scale(5); } }
@keyframes ttOut { to { opacity: 0; } }

/* 2回目から：ロゴの演出を短く。押して飛ばした時は、すぐ収まった形に */
#title.quick .tt-art { animation-duration: .35s, 26s; animation-delay: 0s, .35s; }
#title.quick .tt-logo img { animation-duration: .3s; animation-delay: .1s; }
#title.skip .tt-art { animation: ttArtZoom 26s ease-in-out infinite alternate; }
#title.skip .tt-logo img { animation: none; opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { #title .tt-art, #title .tt-shine, #title.ready .tt-tap span { animation: none !important; } }
