/* ========================================
   チュートリアル完了画面
   tutorial-complete.js が組み立てる。
   ここは「見せ場」なので、作業画面と違って絵と動きで派手にする
   （CLAUDE.md「見せ場と作業場を分ける」）。
   ======================================== */

/* キャラ会話(3000)より前面。シャッター(9999)より後ろ。 */
#tutorial-complete-screen { z-index: 5000; }
#tutorial-complete-screen.overlay-screen {
  box-sizing: border-box;   /* padding を高さに含める（含めないと画面より縦に長くなる） */
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  padding: clamp(10px, 2vh, 24px) 16px;
  /* 奥から光が差しているように見せる。画面いっぱいを使う。 */
  background:
    radial-gradient(ellipse 80% 55% at 50% 38%, rgba(56, 189, 248, 0.22), rgba(3, 8, 20, 0) 70%),
    rgba(2, 8, 20, 0.92);
}

/* ==== 背景の放射光 ==== */
/* 光そのものは ::before に描いて、親で切り落とす。
   親を画面いっぱいより大きくすると、そのぶん縦スクロールが生まれてしまうため
   （.overlay-screen は backdrop-filter を持つので、中の fixed もここを基準にする）。 */
.tc-burst {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.tc-burst::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 38%;
  width: min(1100px, 150vw);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(
    from 0deg,
    rgba(125, 211, 252, 0.10) 0deg 3deg,
    rgba(125, 211, 252, 0) 3deg 15deg,
    rgba(254, 240, 138, 0.08) 15deg 18deg,
    rgba(254, 240, 138, 0) 18deg 30deg);
  -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 68%);
  mask-image: radial-gradient(circle, #000 20%, transparent 68%);
  animation: tcSpin 36s linear infinite;
}
@keyframes tcSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* ==== 紙吹雪（JSで生成。動きを減らす設定の人には出さない） ==== */
.tc-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.tc-confetti i {
  position: absolute;
  top: -8%;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation: tcFall linear both;
}
@keyframes tcFall {
  0%   { opacity: 0; transform: translateY(-10vh) rotate(0deg); }
  8%   { opacity: 1; }
  85%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(104vh) rotate(760deg); }
}

/* ==== 主役の段（フリエ・文字・パル） ==== */
.tc-stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(8px, 2vw, 36px);
  width: min(1180px, 100%);
}
.tc-furie, .tc-pal-frame {
  flex: 0 0 auto;
  animation: tcEnter 0.6s cubic-bezier(.2, 1.3, .4, 1) both;
}
.tc-furie {
  height: clamp(170px, 33vh, 400px);
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.55));
  animation-name: tcEnterLeft;
}
/* パルの絵は横長(900x491)で、本体は真ん中あたりだけ。枠で切り抜いて大きく見せる。 */
.tc-pal-frame {
  position: relative;
  height: clamp(130px, 25vh, 300px);
  aspect-ratio: 0.95;
  overflow: hidden;
  animation-name: tcEnterRight;
  animation-delay: 0.1s;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.5));
}
.tc-pal-frame img {
  position: absolute;
  left: 50%;
  top: 50%;
  height: 112%;
  width: auto;
  max-width: none;
  transform: translate(-52%, -50%);
}
@keyframes tcEnterLeft  { from { opacity: 0; transform: translateX(-40px) translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes tcEnterRight { from { opacity: 0; transform: translateX(40px)  translateY(14px); } to { opacity: 1; transform: none; } }

.tc-center {
  text-align: center;
  padding-bottom: clamp(4px, 2vh, 24px);
  animation: tcPop 0.5s cubic-bezier(.2, 1.4, .4, 1) 0.15s both;
}
@keyframes tcPop { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }

.tc-eyebrow {
  margin: 0;
  letter-spacing: 0.34em;
  font-size: clamp(0.66rem, 1.4vh, 0.82rem);
  font-weight: 700;
  color: var(--cyber-blue);
}
#tutorial-complete-title {
  margin: 4px 0 8px;
  font-size: clamp(1.9rem, 5.6vh, 3.4rem);
  line-height: 1.15;
  font-weight: 700;
  color: #fef08a;
  text-shadow: 0 0 24px rgba(254, 240, 138, 0.5), 0 2px 0 rgba(120, 80, 0, 0.35);
}
.tc-lead {
  margin: 0;
  font-size: clamp(0.92rem, 1.9vh, 1.06rem);
  line-height: 1.8;
  color: var(--cyber-text);
}

/* ==== 覚えたこと（ブロックの絵つき） ==== */
.tc-learned {
  width: min(900px, 100%);
  margin-top: clamp(8px, 1.8vh, 24px);
  animation: tcRise 0.5s ease 0.3s both;
}
@keyframes tcRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.tc-learned-title {
  text-align: center;
  font-size: clamp(0.72rem, 1.5vh, 0.84rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #9fc0de;
  margin-bottom: 10px;
}
.tc-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1.4vw, 14px);
}
.tc-card {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: clamp(8px, 1.3vh, 15px) 12px;
  text-align: center;
}
.tc-card-art {
  height: clamp(26px, 4vh, 34px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.tc-card-art svg { max-width: 100%; height: 100%; }
.tc-card-name { font-weight: 700; font-size: clamp(0.9rem, 1.8vh, 1rem); color: #eaf4ff; }
.tc-card-desc { margin: 4px 0 0; font-size: clamp(0.76rem, 1.5vh, 0.86rem); line-height: 1.6; color: #9fc0de; }

/* ==== 使えるようになった公式 ==== */
.tc-formulas {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: clamp(8px, 1.6vh, 18px);
  animation: tcRise 0.5s ease 0.42s both;
}
.tc-formulas-label { font-size: clamp(0.74rem, 1.5vh, 0.84rem); color: #9fc0de; }
.tc-formulas svg { height: clamp(24px, 3.4vh, 30px); width: auto; }

/* ==== 締めとボタン ==== */
.tc-next {
  margin: clamp(8px, 1.7vh, 20px) 0 0;
  font-weight: 700;
  font-size: clamp(0.92rem, 1.9vh, 1.06rem);
  color: var(--cyber-blue);
  text-align: center;
  animation: tcRise 0.5s ease 0.5s both;
}
.tutorial-complete-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: clamp(10px, 1.9vh, 20px);
  animation: tcRise 0.5s ease 0.58s both;
}
.tutorial-complete-actions .action-btn { font-size: clamp(0.92rem, 1.9vh, 1.05rem); }
/* 「使い方をもう一度」からのやり直しでは、行き先がステージ選択だけになる。
   本編1問目へ送るボタンは出さない（進み具合を見失わせないため）。 */
.tutorial-complete-actions .action-btn.hidden { display: none !important; }

/* ==== 狭い画面 ====
   立ち絵を横に並べると文字が潰れるので、人を小さくして上下に分ける。 */
@media (max-width: 860px) {
  .tc-stage { flex-wrap: wrap; gap: 4px; }
  .tc-center { order: -1; width: 100%; }
  .tc-furie { height: clamp(130px, 24vh, 220px); }
  .tc-pal-frame { height: clamp(110px, 20vh, 180px); }
  .tc-cards { grid-template-columns: 1fr; }
  .tc-card { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 14px; }
  .tc-card-art { margin-bottom: 0; flex: 0 0 auto; }
  .tc-card-desc { margin: 0; }
}
