/* ==========================================================
   なれる姿：全画面ストーリー（future-self.js と対）
   アプリの「色の診断結果」画面と同じ見た目の言葉を使う：
   一色の背景、横に流れる波の帯、細い縦の光の線、大きな同心円。
   人は色で塗ったシルエット。
   ========================================================== */

/* ---- 背景（オーバーレイとカード表紙で共通） ---- */
.fs-wash, .fs-wash > i { position: absolute; inset: 0; display: block; }
.fs-wash { overflow: hidden; }
.fs-wash > i { transition: opacity 1.8s ease; }
.fs-w0 { background: linear-gradient(180deg, var(--w0a) 0%, var(--w0b) 100%); }
.fs-w1 { opacity: 0; background: linear-gradient(180deg, var(--w1a) 0%, var(--w1b) 100%); }
.fs-w2 { opacity: 0; background: linear-gradient(180deg, var(--w2a) 0%, var(--w2b) 100%); }
.fs-overlay[data-scene="1"] .fs-w1, .fs-overlay[data-scene="2"] .fs-w1 { opacity: 1; }
.fs-overlay[data-scene="2"] .fs-w2, .fs-preview .fs-w2 { opacity: 1; }
.fs-wash > .fs-lines {
  background:
    linear-gradient(90deg, transparent calc(9% - 1px), rgba(255,255,255,.13) 9%, transparent calc(9% + 1px)),
    linear-gradient(90deg, transparent calc(21% - 1px), rgba(255,255,255,.1) 21%, transparent calc(21% + 1px)),
    linear-gradient(90deg, transparent calc(38% - 1px), rgba(255,255,255,.14) 38%, transparent calc(38% + 1px)),
    linear-gradient(90deg, transparent calc(53% - 1px), rgba(255,255,255,.1) 53%, transparent calc(53% + 1px)),
    linear-gradient(90deg, transparent calc(69% - 1px), rgba(255,255,255,.13) 69%, transparent calc(69% + 1px)),
    linear-gradient(90deg, transparent calc(86% - 1px), rgba(255,255,255,.1) 86%, transparent calc(86% + 1px));
}
.fs-waves { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.fs-wv path { fill: #fff; }
.fs-wv1 path { fill-opacity: .05; }
.fs-wv2 path { fill-opacity: .06; }
.fs-wv3 path { fill-opacity: .07; }
.fs-wm1, .fs-wm2 { opacity: 0; transition: opacity 2s ease .4s; }
.fs-wm1 path { fill: var(--m1); fill-opacity: .55; }
.fs-wm2 path { fill: var(--m2); fill-opacity: .6; }
.fs-overlay[data-scene="2"] .fs-wm1, .fs-overlay[data-scene="2"] .fs-wm2, .fs-preview .fs-wm1, .fs-preview .fs-wm2 { opacity: 1; }
.fs-wv { animation: fs-wave 26s linear infinite; }
.fs-wv2, .fs-wm1 { animation-duration: 34s; animation-direction: reverse; }
.fs-wv3 { animation-duration: 42s; }
.fs-overlay[data-scene="0"] .fs-wv { animation-duration: 90s; }
@keyframes fs-wave { to { transform: translateX(-150px); } }

/* ---- カード側のプレビュー ---- */
#future-self .fs-card { overflow: hidden; cursor: pointer; padding-top: 0; }
.fs-launch {
  display: block; width: calc(100% + 56px); margin: 0 -28px 22px; padding: 0;
  border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.fs-preview { position: relative; display: block; height: 220px; overflow: hidden; }
.fs-preview .fs-wv { animation: none; }
.fs-preview .fs-art { position: absolute; inset: 0; display: block; width: 100%; height: 100%; transition: transform .8s cubic-bezier(.2,.8,.2,1); transform-origin: 50% 100%; }
.fs-preview-shade { position: absolute; inset: auto 0 0 0; height: 70px; background: linear-gradient(transparent, rgba(20,20,28,.45)); }
.fs-play {
  position: absolute; right: 16px; bottom: 14px; display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%; color: #fff;
  border: 1.5px solid rgba(255,255,255,.85); background: rgba(255,255,255,.12);
  transition: transform .3s ease, background-color .3s ease;
}
.fs-play svg { width: 16px; height: 16px; fill: currentColor; margin-left: 2px; }
.fs-preview-label { position: absolute; left: 18px; bottom: 16px; color: #fff; font-weight: 700; font-size: .9rem; letter-spacing: .06em; text-shadow: 0 1px 8px rgba(0,0,0,.25); }
.fs-launch:hover .fs-preview .fs-art { transform: scale(1.03); }
.fs-launch:hover .fs-play { transform: scale(1.06); background: rgba(255,255,255,.24); }
.fs-launch:focus-visible { outline: none; }
.fs-launch:focus-visible .fs-preview { outline: 3px solid var(--accent-dark); outline-offset: -3px; }
#future-self .fs-card details { cursor: auto; }
#future-self .fs-card summary { font-size: .85rem; }

/* ---- 全画面オーバーレイ ---- */
.fs-overlay { position: fixed; inset: 0; z-index: 1000; overscroll-behavior: contain; }
.fs-overlay[hidden] { display: none; }
.fs-shell {
  position: absolute; inset: 0; overflow: hidden; isolation: isolate;
  color: #fff; background: #2a2c34; touch-action: pan-y pinch-zoom;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
/* 絵は画面いっぱい。人は画面の下端で切れる寄りの構図 */
.fs-stage { position: absolute; inset: 0; }
.fs-stage .fs-art { display: block; width: 100%; height: 100%; overflow: hidden; }
.fs-a { transition: transform 1.7s cubic-bezier(.22,1,.36,1), opacity 1.1s ease; }
.fs-v { transition: opacity .9s ease; }
.fs-in { animation: fs-enter .9s cubic-bezier(.2,.9,.25,1) both; animation-delay: calc(var(--ii, 0) * 30ms + 120ms); }
@keyframes fs-enter { from { opacity: 0; transform: translateY(18px); } }
.fs-scrim { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(10,10,16,.42) 0%, rgba(10,10,16,.14) 26%, rgba(10,10,16,0) 38%, rgba(10,10,16,0) 80%, rgba(10,10,16,.3) 100%); }
.fs-paused .fs-wv, .fs-holding .fs-wv { animation-play-state: paused; }

/* ---- 上部：進行バー・操作・見出し ---- */
.fs-top {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}
.fs-progress { display: flex; gap: 6px; }
.fs-bar { position: relative; flex: 1; height: 18px; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.fs-bar::before, .fs-bar span { content: ''; position: absolute; left: 0; right: 0; top: 8px; height: 2px; border-radius: 2px; background: currentColor; }
.fs-bar::before { opacity: .3; }
.fs-bar span { transform: scaleX(0); transform-origin: left; }
.fs-toolbar { display: flex; align-items: center; gap: 2px; margin-top: 2px; }
.fs-worry { margin: 0 auto 0 0; font-size: .78rem; font-weight: 600; letter-spacing: .08em; color: inherit; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-icon { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.fs-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fs-icon:hover { background: rgba(255,255,255,.14); }
.fs-icon:focus-visible, .fs-bar:focus-visible { outline: 2px solid currentColor; outline-offset: -3px; }
.fs-icon:disabled { opacity: .3; cursor: default; }
.fs-i-play { display: none; fill: currentColor; }
.fs-paused .fs-i-pause { display: none; }
.fs-paused .fs-i-play { display: block; }

.fs-copy { padding: 12px 4px 0; pointer-events: none; max-width: 30em; }
.fs-phase { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: .74rem; font-weight: 700; letter-spacing: .32em; color: inherit; opacity: .9; }
.fs-phase::after { content: ''; flex: none; width: 36px; height: 1px; background: currentColor; opacity: .55; }
.fs-title {
  margin: 0; color: inherit;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-weight: 500; font-size: clamp(1.05rem, 4.6vw, 1.25rem); line-height: 1.75; letter-spacing: .02em;
  text-shadow: 0 1px 10px rgba(0,0,0,.25);
  word-break: auto-phrase; line-break: strict;
}
.fs-swap { animation: fs-title-in 1s cubic-bezier(.2,.9,.25,1) both; }
@keyframes fs-title-in { from { opacity: 0; transform: translateY(10px); } }

/* ---- 下部：今日の一歩・前後 ---- */
.fs-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 0 max(14px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}
.fs-step {
  display: flex; flex-direction: column; gap: 4px; max-width: 30em; margin: 0 0 6px; padding: 12px 16px 13px;
  border-radius: 14px; background: rgba(16,16,24,.5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #fff;
  font-size: clamp(.9rem, 3.8vw, 1.02rem); font-weight: 600; line-height: 1.55;
  opacity: 0; transform: translateY(10px); transition: opacity .7s ease, transform .7s ease; pointer-events: none;
}
.fs-step-text { word-break: auto-phrase; line-break: strict; }
.fs-step-label { font-size: .7rem; font-weight: 700; letter-spacing: .24em; color: var(--fs-you); }
.fs-overlay[data-scene="2"] .fs-step { opacity: 1; transform: none; transition-delay: 1.8s; }
.fs-nav { display: flex; align-items: center; justify-content: space-between; }
.fs-hint { font-size: .7rem; opacity: .7; letter-spacing: .14em; }
.fs-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- 大きな画面：左に言葉、右に場面 ---- */
@media (min-width: 900px) {
  .fs-top { padding: 22px 40px 0; }
  .fs-progress { max-width: 520px; }
  .fs-toolbar { position: absolute; top: 12px; right: 28px; left: 600px; }
  .fs-worry { margin-left: auto; margin-right: 10px; font-size: .85rem; }
  .fs-copy { position: absolute; left: 56px; top: 22vh; width: min(36vw, 520px); padding: 0; }
  .fs-title { font-size: 1.4rem; line-height: 1.75; }
  .fs-phase { margin-bottom: 22px; }
  .fs-stage { left: 34vw; }
  .fs-stage .fs-art { overflow: visible; }
  .fs-scrim { background: linear-gradient(90deg, rgba(10,10,16,.35) 0%, rgba(10,10,16,.12) 30%, rgba(10,10,16,0) 42%); }
  .fs-bottom { padding: 0 40px 22px 56px; }
  .fs-step { position: absolute; left: 56px; bottom: 96px; width: min(34vw, 460px); margin: 0; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .fs-stage { left: 40vw; }
  .fs-copy { max-width: 38vw; }
  .fs-title { font-size: 1rem; }
  .fs-phase { display: none; }
  .fs-step { max-width: 38vw; }
}

/* ---- カードからの拡大（View Transitions） ---- */
::view-transition-group(fs-hero) { animation-duration: .6s; animation-timing-function: cubic-bezier(.2,.9,.25,1); }
::view-transition-old(fs-hero), ::view-transition-new(fs-hero) { height: 100%; object-fit: cover; }
::view-transition-old(fs-hero) { animation: fs-vt-out .22s ease both; }
::view-transition-new(fs-hero) { animation: fs-vt-in .22s ease both; }
@keyframes fs-vt-out { to { opacity: 0; } }
@keyframes fs-vt-in { from { opacity: 0; } }

/* ---- 動きを減らす設定：絵は場面ごとの完成形をそのまま出す ---- */
@media (prefers-reduced-motion: reduce) {
  .fs-overlay *, .fs-overlay *::before, .fs-launch *, .fs-launch *::before { animation: none !important; }
  .fs-a { transition: opacity .3s ease; }
  .fs-v, .fs-wash > i, .fs-wm1, .fs-wm2, .fs-step { transition-duration: .3s; transition-delay: 0s !important; }
  .fs-preview .fs-art, .fs-play { transition: none; }
  .fs-launch:hover .fs-preview .fs-art, .fs-launch:hover .fs-play { transform: none; }
}

/* ---- スマートフォン：そのうちの場面は人を少し上げ、「今日の一歩」を下の帯に置いて体に重ねない ---- */
@media (max-width: 899px) {
  .fs-stage { transform-origin: 50% 100%; transition: transform 1.6s cubic-bezier(.22,1,.36,1); }
  .fs-overlay[data-scene="2"] .fs-stage { transform: translateY(-11vh) scale(.9); }
  .fs-bottom::before {
    content: ''; position: absolute; inset: 0; z-index: -1;
    background: rgba(14,14,20,.7); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    opacity: 0; transition: opacity 1s ease;
  }
  .fs-overlay[data-scene="2"] .fs-bottom::before { opacity: 1; }
  .fs-bottom { padding-top: 6px; }
  .fs-step { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; padding: 10px 6px 4px; margin-bottom: 0; }
}
@media (max-width: 899px) and (prefers-reduced-motion: reduce) {
  .fs-stage, .fs-bottom::before { transition-duration: .3s; }
}
