@charset "UTF-8";

:root{
  --pink:#f75ca4;
  --pink2:#ff9acb;
  --deep:#4b2738;
  --white:#fff;
  --blue:#80c7ff;
  --shadow:rgba(74,25,48,.22);
}

*{
  box-sizing:border-box;
}

html,
body{
  width:100%;
  min-height:100%;
  margin:0;
}

body{
  font-family:
    "Zen Maru Gothic",
    "M PLUS Rounded 1c",
    "Hiragino Maru Gothic ProN",
    system-ui,
    sans-serif;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.9), transparent 38%),
    linear-gradient(180deg,#ffe8f4 0%,#fff8fc 48%,#ffe1f0 100%);
  color:var(--deep);
  overflow:hidden;
}

.app{
  width:100vw;
  height:100svh;
  display:grid;
  place-items:center;
  padding:clamp(0px,1.2vw,14px);
}

.novel-stage{
  position:relative;
  width:min(100vw, 1600px);
  aspect-ratio:16 / 9;
  max-height:100svh;
  overflow:hidden;
  border-radius:clamp(0px,1.6vw,22px);
  box-shadow:
    0 24px 70px rgba(120,36,74,.22),
    0 0 0 2px rgba(255,255,255,.8) inset;
  background:#ffeaf4;
}

.scene-bg{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  user-select:none;
  pointer-events:none;
}

/* 画像の上に少しだけ読みやすさを足す */
.novel-stage::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background:
    linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,230,245,.08)),
    radial-gradient(circle at 50% 40%, transparent 55%, rgba(255,112,172,.08) 100%);
}

/* 進捗 */
.progress-panel{
  position:absolute;
  z-index:5;
  top:5.2%;
  right:9.6%;
  width:31%;
  height:5.8%;
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:1.1vw;
  align-items:center;
  padding:0.45vw 1.1vw;
  border-radius:999px;
  background:rgba(255,255,255,.62);
  border:2px solid rgba(255,150,200,.65);
  box-shadow:
    0 8px 20px rgba(100,28,60,.10),
    inset 0 0 0 1px rgba(255,255,255,.75);
  backdrop-filter:blur(6px);
}

.progress-title{
  font-size:clamp(11px,1.05vw,17px);
  font-weight:900;
  color:var(--pink);
  white-space:nowrap;
}

.progress-track{
  height:35%;
  min-height:8px;
  border-radius:999px;
  overflow:hidden;
  background:rgba(255,230,242,.88);
  border:1px solid rgba(255,147,194,.45);
  box-shadow:inset 0 2px 4px rgba(60,20,35,.12);
}

.progress-fill{
  height:100%;
  width:0%;
  border-radius:999px;
  background:linear-gradient(90deg,var(--pink),var(--blue));
  box-shadow:0 0 16px rgba(255,94,164,.5);
  transition:width .35s ease;
}

.progress-count{
  font-size:clamp(13px,1.25vw,21px);
  font-weight:900;
  color:#392433;
  min-width:4em;
  text-align:right;
}

/* 吹き出し */
.speech-bubble{
  position:absolute;
  z-index:6;
  width:clamp(270px,31vw,500px);
  min-height:clamp(112px,15vw,220px);
  padding:clamp(16px,1.65vw,28px);
  border-radius:clamp(28px,3vw,48px);
  background:
    radial-gradient(160px 80px at 20% 5%, rgba(255,255,255,.95), transparent 65%),
    rgba(255,255,255,.88);
  border:3px solid rgba(255,134,190,.9);
  box-shadow:
    0 16px 34px rgba(92,24,54,.18),
    0 0 0 8px rgba(255,255,255,.34) inset;
  backdrop-filter:blur(3px);
  opacity:0;
  transform:translateY(8px) scale(.98);
  pointer-events:none;
  transition:opacity .2s ease, transform .2s ease;
}

.speech-bubble.is-active{
  opacity:1;
  transform:translateY(0) scale(1);
}

.speech-bubble::before{
  content:"";
  position:absolute;
  inset:clamp(10px,1vw,16px);
  border:2px dashed rgba(255,166,207,.55);
  border-radius:inherit;
  pointer-events:none;
}

.speech-bubble::after{
  content:"";
  position:absolute;
  width:clamp(26px,3vw,44px);
  height:clamp(26px,3vw,44px);
  bottom:calc(clamp(15px,1.8vw,30px) * -1);
  background:rgba(255,255,255,.88);
  border-right:3px solid rgba(255,134,190,.9);
  border-bottom:3px solid rgba(255,134,190,.9);
  transform:rotate(45deg);
}

.teacher-bubble{
  left:7.5%;
  top:15.5%;
}

.teacher-bubble::after{
  left:18%;
}

.student-bubble{
  right:7.8%;
  top:18.5%;
}

.student-bubble::after{
  right:18%;
}

.speaker-badge{
  display:inline-flex;
  align-items:center;
  gap:.4em;
  position:relative;
  z-index:1;
  margin-bottom:.7em;
  padding:.28em .88em .34em;
  border-radius:999px;
  color:#fff;
  font-size:clamp(15px,1.3vw,22px);
  font-weight:900;
  background:linear-gradient(180deg,#ff7db8,#f44e9a);
  box-shadow:0 8px 18px rgba(246,77,154,.25);
}

.speaker-badge::before{
  content:"♡";
  opacity:.9;
}

.line-text{
  position:relative;
  z-index:1;
  margin:0;
  font-size:clamp(18px,1.85vw,30px);
  line-height:1.75;
  font-weight:900;
  letter-spacing:.02em;
  color:#352635;
  text-shadow:0 1px 0 rgba(255,255,255,.75);
  white-space:pre-line;
}

/* タップ領域 */
.tap-layer{
  position:absolute;
  z-index:4;
  inset:0;
  cursor:pointer;
}

/* 操作ボタン */
.control-bar{
  position:absolute;
  z-index:8;
  left:3.2%;
  right:3.2%;
  bottom:2.8%;
  height:8.3%;
  display:grid;
  grid-template-columns:1fr 1.25fr 1fr;
  gap:clamp(10px,2vw,32px);
  align-items:center;
}

.control-btn{
  width:100%;
  height:100%;
  appearance:none;
  border:0;
  border-radius:999px;
  font-family:inherit;
  font-size:clamp(18px,2vw,34px);
  font-weight:1000;
  letter-spacing:.04em;
  cursor:pointer;
  transition:transform .12s ease, filter .12s ease;
  box-shadow:
    0 10px 0 rgba(166,44,96,.24),
    0 18px 34px rgba(90,24,52,.20),
    inset 0 2px 0 rgba(255,255,255,.85);
}

.control-btn:hover{
  transform:translateY(-2px);
  filter:brightness(1.04);
}

.control-btn:active{
  transform:translateY(3px);
  box-shadow:
    0 5px 0 rgba(166,44,96,.20),
    0 10px 20px rgba(90,24,52,.15),
    inset 0 2px 0 rgba(255,255,255,.85);
}

.control-btn.sub{
  color:#633248;
  background:
    radial-gradient(120px 40px at 30% 15%, rgba(255,255,255,.95), transparent 60%),
    linear-gradient(180deg,#fff,#fff0f6);
  border:2px solid rgba(255,175,211,.75);
}

.control-btn.auto{
  color:#fff;
  background:
    radial-gradient(180px 50px at 30% 12%, rgba(255,255,255,.65), transparent 65%),
    linear-gradient(90deg,#f75ca4,#84c8ff);
  border:2px solid rgba(255,255,255,.76);
}

.control-btn.main{
  color:#fff;
  background:
    radial-gradient(140px 45px at 30% 12%, rgba(255,255,255,.55), transparent 65%),
    linear-gradient(180deg,#ff79b8,#f34292);
  border:2px solid rgba(255,255,255,.76);
}

/* 小さめPC・タブレット */
@media (max-width: 900px){
  .app{
    padding:0;
  }

  .novel-stage{
    width:100vw;
    height:100svh;
    max-height:none;
    aspect-ratio:auto;
    border-radius:0;
  }

  .scene-bg{
    object-fit:cover;
  }

  .progress-panel{
    top:5.5%;
    right:5%;
    width:36%;
  }

  .teacher-bubble{
    left:4.5%;
    top:15%;
  }

  .student-bubble{
    right:4.5%;
    top:17%;
  }

  .speech-bubble{
    width:42%;
  }
}

/* スマホ縦 */
@media (max-width: 560px) and (orientation: portrait){
  body{
    overflow:hidden;
  }

  .novel-stage{
    width:100vw;
    height:100svh;
  }

  .scene-bg{
    width:100%;
    height:100%;
    object-fit:cover;
    object-position:center;
  }

  .progress-panel{
    top:2.2%;
    left:5%;
    right:5%;
    width:auto;
    height:5.4%;
    padding:1.2vw 3vw;
  }

  .progress-title{
    font-size:12px;
  }

  .progress-count{
    font-size:14px;
  }

  .speech-bubble{
    left:5% !important;
    right:5% !important;
    top:auto;
    bottom:14.5%;
    width:auto;
    min-height:132px;
    padding:17px 19px 20px;
    border-radius:28px;
  }

  .speech-bubble::after{
    display:none;
  }

  .speaker-badge{
    font-size:15px;
  }

  .line-text{
    font-size:18px;
    line-height:1.65;
  }

  .control-bar{
    left:4%;
    right:4%;
    bottom:2%;
    height:8%;
    grid-template-columns:1fr 1.2fr 1fr;
    gap:8px;
  }

  .control-btn{
    font-size:14px;
  }
}

/* 横幅がかなり狭い時 */
@media (max-width: 380px){
  .line-text{
    font-size:16px;
  }

  .control-btn{
    font-size:13px;
  }
}

/* =========================
   横向き案内 iPhone見切れ対策版
   ※ 既存の「横向き案内」CSSをこの内容で丸ごと置き換え
========================= */

#rotateNotice{
  position:fixed;
  inset:0;
  z-index:999999;
  display:none;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.7), transparent 35%),
    radial-gradient(circle at 80% 30%, rgba(255,255,255,.5), transparent 28%),
    linear-gradient(180deg,#ffd6ea 0%,#fff0f7 100%);
}

#rotateNotice::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  opacity:.35;
  background-image:radial-gradient(#ff8fc3 1.6px, transparent 1.6px);
  background-size:22px 22px;
}

.rotateInner{
  position:relative;
  z-index:2;
  width:min(88vw, 440px);
  max-height:calc(100svh - 48px);
  overflow:hidden;
  padding:24px 20px 22px;
  text-align:center;
  border-radius:28px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.95), transparent 60%),
    rgba(255,255,255,.86);
  border:3px solid rgba(255,133,191,.75);
  box-shadow:
    0 18px 50px rgba(110,28,62,.18),
    0 0 0 8px rgba(255,255,255,.35) inset;
  backdrop-filter:blur(8px);
}

.rotateInner::before{
  content:"♡ ♡ ♡";
  position:static;
  display:block;
  transform:none;
  color:#ff69af;
  letter-spacing:.35em;
  font-size:15px;
  line-height:1;
  margin-bottom:10px;
  opacity:.85;
}

.rotateIcon{
  font-size:52px;
  line-height:1;
  margin-bottom:12px;
  animation:rotateFloat 2.4s ease-in-out infinite;
}

.rotateTitle{
  font-size:clamp(21px, 7vw, 28px);
  line-height:1.25;
  font-weight:1000;
  color:#f54296;
  margin-bottom:10px;
  text-shadow:0 2px 0 rgba(255,255,255,.8);
}

.rotateText{
  font-size:clamp(14px, 4.2vw, 17px);
  line-height:1.65;
  font-weight:800;
  color:#6b3b4f;
}

@keyframes rotateFloat{
  0%{ transform:translateY(0) rotate(0deg); }
  50%{ transform:translateY(-5px) rotate(8deg); }
  100%{ transform:translateY(0) rotate(0deg); }
}

/* スマホ縦なら表示 */
@media (orientation: portrait) and (max-width: 900px){
  #rotateNotice{
    display:flex;
  }

  .app{
    display:none !important;
  }

  body{
    overflow:hidden;
    touch-action:none;
  }
}

/* iPhone SEなど高さが低い端末用 */
@media (orientation: portrait) and (max-height: 700px){
  .rotateInner{
    width:min(90vw, 390px);
    padding:18px 16px 16px;
    border-radius:24px;
  }

  .rotateInner::before{
    font-size:13px;
    margin-bottom:8px;
  }

  .rotateIcon{
    font-size:42px;
    margin-bottom:8px;
  }

  .rotateTitle{
    font-size:22px;
    margin-bottom:8px;
  }

  .rotateText{
    font-size:14px;
    line-height:1.5;
  }
}
