* {
  box-sizing: border-box;
}
/* シーン共通：全部重ねて、activeだけ見せる */
.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between; 
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.scene.active {
  opacity: 1;
  pointer-events: auto;
}

/* scene0：タイトル導入 */
#scene0 {
  background: #fff;
  color: #4b3b4f;
  overflow: hidden;
}

/* scene0：導入全体 */
#scene0 {
  background: #fff;
  color: #4b3b4f;
  overflow: hidden;
}

/* タイトルだけ */
.intro-title {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.intro-title.shown {
  opacity: 1;
}

.intro-main {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: clamp(42px, 13vw, 68px);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #3f3446;
  text-shadow:
    0 2px 0 #fff,
    0 10px 26px rgba(170, 120, 190, 0.24);
}

.intro-sub {
  font-size: clamp(14px, 4vw, 20px);
  font-weight: 600;
  color: #9a6f8f;
  letter-spacing: 0.06em;
}

/* Prologueだけ */
.intro-prologue {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: "Georgia", "Times New Roman", serif;
  font-size: clamp(30px, 9vw, 48px);
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.18em;
  color: #5a485f;
  text-shadow:
    0 1px 0 #fff,
    0 8px 24px rgba(160, 120, 180, 0.22);
  opacity: 0;
  transition: opacity 1.2s ease;
}

.intro-prologue.shown {
  opacity: 1;
}

/* ひとり語り全体 */
.intro-story {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.intro-story.shown {
  opacity: 1;
}

/* ひとり語りの各ページ */
.story-page {
  position: absolute;
  inset: 0;
  padding: 34px 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: left;
  font-size: clamp(15px, 4vw, 18px);
  line-height: 2.05;
  color: #4b3b4f;
  white-space: pre-line;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.story-page.shown {
  opacity: 1;
  transform: translateY(0);
}
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ffe6f6, #ece5ff, #fff2dc);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
}
/* ========== オープニング ========== */
#opening {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ゲーム本編は、オープニングが終わるまで隠す */
#game {
  display: none;
}

/* シーン共通：重ねて、activeだけ見せる */
.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.scene.active {
  opacity: 1;
  pointer-events: auto;
}

/* scene1 ChatGPT登場 */
#scene1 .chara-wrap {
  position: relative;
  width: min(100vw, 430px);
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#scene1 .chara-img {
  width: 70%;
  max-width: 280px;
  object-fit: contain;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s ease, transform 1s ease;
}

#scene1 .chara-img.shown {
  opacity: 1;
  transform: translateY(0);
}

#scene1 .speech-bubble {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  width: 78%;
  max-width: 300px;
  padding: 14px 18px;
  background: #fff;
  border: 2px solid #ffb7c5;
  border-radius: 16px;
  color: #333;
  text-align: center;
  line-height: 1.7;
  white-space: pre-line;
  box-shadow: 0 4px 16px rgba(255, 183, 197, 0.3);
  opacity: 0;
  transition: opacity 0.8s ease;
}

#scene1 .speech-bubble.shown {
  opacity: 1;
}

/* scene2 名前 */
#scene2 .name-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 24px;
  font-size: clamp(28px, 8vw, 48px);
  font-family: cursive;
}

.name-item,
.name-sep {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.name-item.shown,
.name-sep.shown {
  opacity: 1;
  transform: translateY(0);
}

.name-item.shown {
  color: #3f3446;
}

/* scene3 5人並び */
.five-grid {
  position: relative;
  width: min(100vw, 430px);
  height: 100dvh;
  overflow: hidden;
}

.member {
  position: absolute;
  width: 44%;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.member.shown {
  opacity: 1;
  transform: translateY(0);
}

.member img {
  width: 100%;
  display: block;
  object-fit: contain;
}

#m1 {
  top: 4%;
  left: 4%;
}

#m2 {
  top: 10%;
  right: 4%;
}

#m3 {
  top: 34%;
  left: 4%;
}

#m4 {
  top: 40%;
  right: 4%;
}

#m5 {
  bottom: 4%;
  left: 28%;
}

/* scene4 全員集合 */
#scene4 img {
  width: min(100vw, 430px);
  height: 100dvh;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

#scene4 img.shown {
  opacity: 1;
  transform: scale(1);
}
.game {
  position: relative;
  width: min(100vw, 430px);
  height: 100dvh;
  max-height: 760px;
  overflow: hidden;
  background: linear-gradient(160deg, #ffd6ed, #dcd2ff 45%, #fff0cc);
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(152, 88, 180, .35);
}

.title-screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 28px;
  padding: 24px;
  background: linear-gradient(145deg, #ffd3ec, #d8d4ff 55%, #fff3c9);
}

.title-logo {
  width: 92%;
  max-width: 390px;
  display: block;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,.15));
}

.start-btn {
  border: none;
  border-radius: 999px;
  padding: 14px 46px;
  background: linear-gradient(90deg, #ff76b9, #9b7cff);
  color: white;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(255, 93, 170, .35);
}
.title-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.disclaimer {
  width: 88%;
  max-width: 340px;
  margin: 0;
  color: rgba(80, 60, 90, 0.72);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}
.title-site-link {
  color: rgba(80, 60, 90, 0.72);
  font-size: 11px;
  text-decoration: underline;
}
.character {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .25s ease;
}

.top-ui {
  display: none;
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  width: 132px;
  padding: 8px 10px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(255, 156, 210, .8);
  border-radius: 12px;
  font-size: 12px;
}

.game.playing .top-ui {
  display: block;
}

.day {
  color: #ff70aa;
  font-size: 18px;
  font-family: cursive;
  margin-bottom: 6px;
}

#hearts {
  color: #ff5b97;
}

.stars {
  color: #ffb45f;
}

.dialogue {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 40px;
  z-index: 6;
  min-height: 170px;
  max-height: 245px;
  overflow: visible;
  padding: 30px 16px 14px;
  background: rgba(255, 255, 255, 0.14);
  border: 1.5px solid rgba(255, 170, 200, 0.5);
  border-radius: 0 18px 18px 18px;
  box-shadow: 0 8px 24px rgba(144, 74, 168, 0.22);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.name {
  position: absolute;
  top: -32px;
  left: 18px;
  z-index: 10;
  min-width: 120px;
  padding: 6px 28px 6px 14px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(90deg, #e8558a, #c43070);
  color: white;
  text-align: center;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: 2px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 100%, 0 100%);
}
.text {
  white-space: pre-line;
  line-height: 1.65;
  font-size: 14px;
  color: #ffffff;
  max-height: 130px;
  overflow-y: auto;
  padding-right: 6px;
}

.choices {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.choice {
  border: 1px solid #ffc1dd;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255,255,255,.88);
  color: #8a4d8f;
  font-size: 13px;
  font-weight: bold;
  text-align: left;
  cursor: pointer;
}

.next-btn {
  position: absolute;
  right: 14px;
  bottom: 12px;
  z-index: 20;
  border: none;
  background: transparent;
  color: #ff9a3d;
  font-size: 28px;
  cursor: pointer;
}

.restart-btn {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 20;
  border: none;
  border-radius: 999px;
  padding: 9px 24px;
  background: linear-gradient(90deg, #ff76b9, #9b7cff);
  color: white;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
}
.hidden {
  display: none !important;
}
#ending {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
  background: #000;
}

#ending.active {
  display: flex;
}

/* エンディング本文画面 */
.ending-top {
  position: absolute;
  inset: 0;
  background: #ffe6f6;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px 16px 20px;
  gap: 16px;
  box-sizing: border-box;
}

.ending-chara {
  width: 55%;
  max-width: 220px;
  object-fit: contain;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 1s ease, transform 1s ease;
  flex-shrink: 0;
}

.ending-chara.shown {
  opacity: 1;
  transform: translateY(0);
}

.ending-bubble {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 183, 197, 0.75);
  border-radius: 14px;
  padding: 16px 24px;
  color: #333;
  font-size: 14px;
  line-height: 1.9;
  text-align: center;
  white-space: pre-line;
  opacity: 0;
  transition: opacity 0.8s ease 0.6s;
  width: 85%;
  max-width: 330px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ending-bubble.shown {
  opacity: 1;
}

.ending-credit {
  position: absolute;
  inset: 0;

  /* クレジット画面全体を黒 */
  background: #000;
  width: 100%;
  height: 100dvh;

  display: flex;
  flex-direction: column;
  align-items: center;

  /* 文字とボタンを画面下へ */
  justify-content: flex-end;

  gap: 10px;

  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease;

  padding: 28px 20px 36px;
  box-sizing: border-box;
}

.ending-credit.shown {
  opacity: 1;
  pointer-events: auto;
}

.ending-studio {
  font-family: 'Courier New', monospace;
  font-size: clamp(14px, 4vw, 18px);
  letter-spacing: 0.3em;
  color: #fff;
  font-weight: bold;
}

.ending-tagline {
  font-family: 'Courier New', monospace;
  font-size: clamp(11px, 2.8vw, 13px);
  letter-spacing: 0.2em;
  color: #aaa;
}

.ending-demo-note {
  opacity: 0;
  transition: opacity 0.8s ease;
  color: #aaa;
  font-size: 12px;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}

.ending-demo-note.shown {
  opacity: 1;
}

.next-project-btn {
  opacity: 0;
  transition: opacity 0.8s ease;
  background: none;
  border: 1px solid rgba(255, 183, 197, 0.5);
  border-radius: 24px;
  color: #ffb7c5;
  font-size: 15px;
  letter-spacing: 0.15em;
  padding: 12px 32px;
  cursor: pointer;
  margin-top: 12px;
  flex-shrink: 0;
  text-decoration: none;
  display: inline-block;
}

.next-project-btn.shown {
  opacity: 1;
}

.next-project-btn:active {
  background: rgba(255, 183, 197, 0.1);
}

.replay-link {
  opacity: 0;
  transition: opacity 0.8s ease;
  color: #999;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-decoration: underline;
  flex-shrink: 0;
  cursor: pointer;
}

.replay-link.shown {
  opacity: 1;
}
