/*-------------------------------------------
common
-------------------------------------------*/
html {
  font-size: 62.5%;
  overflow: auto;
}

body {
  font-family: "游ゴシック Medium", "Yu Gothic Medium", "游ゴシック体",
    "YuGothic", "ヒラギノ角ゴ ProN W3", "Hiragino Kaku Gothic ProN", "メイリオ",
    "Meiryo", "verdana", sans-serif;
  font-style: normal;
  font-size: 1.6rem;
  color: #232323;
  line-height: 1.7;
  overflow: hidden;
  touch-action: none;
  background-color: #fff;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
  vertical-align: bottom;
}

li {
  display: inline-block;
}

/*-------------------------------------------
動画
-------------------------------------------*/

#wrapper {
  width: 100vw;
  max-width: 580px;
  height: 100vh;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
}

/* iOSの動的ツールバー対策：対応ブラウザは svh を優先 */
@supports (height: 100svh) {
  #wrapper {
    height: 100svh;
  }
}

.sections {
  display: flex;
  flex-direction: column;
  transition: transform 0.6s ease;
  height: auto; /* ✅ 各切替時に1画面分を見せる */
  overflow: hidden; /* ✅ はみ出しを隠す（ここも重要） */
  will-change: transform;
  contain: layout paint; /* セクション内の描画影響を閉じ込めて再計算を減らす */
}

.section {
  position: relative;
  height: 100vh;
  overflow: hidden;
  background-color: #000;
}

:root {
  --video-width: 720px;
  --video-height: 1280px;
  --min-video-height: 500px;
}

video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--video-width);
  height: var(--video-height);
  object-fit: cover;
  background-color: #000;
}

/* 高さが1280px以下のときは縮小させる（縦横比維持） */
@media screen and (max-height: 1280px) {
  video {
    height: 100vh;
    width: auto;
    max-width: var(--video-width);
    max-height: var(--video-height);
  }
}

/* 高さが500px未満のときは縮小させない（上下カットさせる） */
@media screen and (max-height: 500px) {
  video {
    height: var(--min-video-height);
    width: auto;
  }
}

/*-------------------------------------------
ロード画面
-------------------------------------------*/

#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #fff;
  color: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  font-size: 24px;
  z-index: 9999;
}

.spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #3498db;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-top: 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Loader をふわっと消す */
#loading-screen {
  opacity: 1;
  transition: opacity 0.5s ease; /* フェード時間：必要なら調整 */
  z-index: 9999; /* いちおう最前面確保 */
}

#loading-screen.is-fading {
  opacity: 0;
  pointer-events: none; /* フェード中に操作を通す */
}

/* 省エネ派の人向け：モーション控えめ設定なら即非表示 */
@media (prefers-reduced-motion: reduce) {
  #loading-screen {
    transition: none;
  }
}

/*-------------------------------------------
UI上部
-------------------------------------------*/

.stream-header {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 10;
  color: #fff;
  font-family: sans-serif;
}

.user-info {
  display: flex;
  align-items: flex-start;
}

.avatar-wrapper {
  position: relative;
  width: 55px;
  height: 55px;
  margin-right: 10px;
}

.avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #fff;
}

.online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background-color: #00e600;
  border: 2px solid white;
  border-radius: 50%;
}

.user-text {
  display: flex;
  flex-direction: column;
}

.username {
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 4px;
}

.viewers {
  background-color: #333;
  border-radius: 20px;
  padding: 2px 12px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  margin-bottom: 4px;
  width: fit-content;
}

.icon {
  margin-right: 4px;
}

.tags {
  display: flex;
  gap: 6px;
}

.tag {
  font-size: 12px;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-block;
}

.tag.pink {
  background: #ff0080;
  color: #fff;
}

.tag.blue {
  background: #00aaff;
  color: #fff;
}

.tag.red {
  background: #ff0000;
  color: #fff;
}

.tag.green {
  background: #00cc8b;
  color: #fff;
}

.tag.purple {
  background: #6600ff;
  color: #fff;
}

.tag.orange {
  background: #ff8400;
  color: #fff;
}

.live-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: linear-gradient(
    120deg,
    rgb(247, 42, 188) 0%,
    rgb(190, 78, 245) 100%
  );
  color: #fff;
  font-weight: bold;
  font-size: 14px;
  padding: 1% 4%;
  letter-spacing: 0.05em;
  border-radius: 8px;
  z-index: 20;
}

/*-------------------------------------------
UI右
-------------------------------------------*/

.floating-icons {
  position: absolute;
  right: 16px;
  bottom: 170px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  z-index: 15;
}

.icon-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.icon-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.icon-label {
  color: #fff;
  font-size: 14px;
  margin-top: 4px;
}

/* ハートエフェクト */
#heart-container {
  position: absolute;
  bottom: 100px;
  right: 70px;
  pointer-events: none;
  z-index: 9999;
  width: 100px;
  height: 200px;
}

.heart {
  display: block;
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 24px;
  height: 24px;
  transform: translateX(-50%);
  animation: floatUp 2s ease-out forwards;
  opacity: 0;
  pointer-events: none;
}

.heart-flash {
  animation: flashPink 0.6s ease;
}

@keyframes flashPink {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes floatUp {
  0% {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) translateY(-100px) scale(1.5);
    opacity: 0;
  }
}

/*-------------------------------------------
UI下
-------------------------------------------*/
.bottom-ui {
  position: absolute;
  bottom: env(safe-area-inset-bottom, 0px); /* ← 位置ごと安全領域分だけ上げる */
  left: 0;
  width: 100%;
  padding: 12px;
  box-sizing: border-box;
  font-family: sans-serif;
  color: white;
  padding-bottom: calc(
    12px + env(safe-area-inset-bottom, 0px)
  ); /* ← iPhone下部の被り解消 */
}

/* ① 固定テキスト */
.fixed-text {
  font-weight: bold;
  font-size: 18px;
  margin-bottom: 6px;
}

/* ② スクロールテキスト */
.scrolling-text {
  margin-left: -12px;
  margin-right: -12px;
  overflow: hidden;
  white-space: nowrap;
  background: repeating-linear-gradient(
    90deg,
    #111 0px,
    #111 2px,
    #222 2px,
    #222 4px
  );
  padding: 6px 0;
  color: #ffb6ff;
  font-size: 14px;
  margin-bottom: 10px;
}

.scroll-inner {
  display: inline-block;
  padding-left: 100%;
  animation: scroll-left 15s linear infinite;
}

@keyframes scroll-left {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

/* ③ コメント入力エリア */
.comment-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-area input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 10px;
  outline: none;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

@supports (-webkit-touch-callout: none) {
  .comment-area input[type="text"],
  textarea,
  select {
    font-size: 16px; /* ← これでズームしなくなる */
    line-height: 1.2;
    padding: 10px 12px; /* 見た目調整（任意）*/
  }
}

.comment-area input::placeholder {
  color: #ccc;
}

.comment-area button {
  background: #ff1493;
  border: none;
  color: white;
  padding: 8px 20px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}

/* アクティブ以外のセクションでは帯アニメを止める */
.section:not(.is-active) .scroll-inner {
  animation-play-state: paused;
}

/* ===== Swipe Hint (下矢印) ===== */
.swipe-hint {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom)); /* iPhoneノッチ対応 */
  z-index: 60; /* 動画やUIより前に */
  pointer-events: none; /* 操作の邪魔をしない */
  padding: 8px 18px;
  border-radius: 14px;
}

.swipe-hint .chevron {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
  animation: swipeHintFloat 1.8s ease-in-out infinite;
}

/* 上下にふわふわ */
@keyframes swipeHintFloat {
  0% {
    transform: translateY(0);
    opacity: 0.9;
  }
  50% {
    transform: translateY(-8px);
    opacity: 1;
  }
  100% {
    transform: translateY(0);
    opacity: 0.9;
  }
}

/* （任意）非表示トランジション用のクラス */
.swipe-hint.is-hidden {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

/*-------------------------------------------
UIコメント
-------------------------------------------*/
.comment-box {
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-weight: bold;
  margin: 4px 0;
  padding: 6px 12px;
  border-radius: 16px;
  display: inline-block;
  max-width: 85%;
}

.comment-box .name {
  color: hotpink;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.fade-out {
  animation: fadeOut 1s forwards;
}

.comment-container {
  display: flex;
  position: absolute;
  bottom: calc(
    175px + env(safe-area-inset-bottom, 0px)
  ); /* ← 下端のかぶり対策 */
  left: 10px;
  flex-direction: column;
  gap: 8px;
}

/* iOS Safari の 100vh 問題対策：セクション＆動画も svh を優先 */
@supports (height: 100svh) {
  .section {
    height: 100svh;
  }
  video {
    height: 100svh;
    width: auto;
    max-height: 100svh;
  }
}

/* ---- Overlayを常に合成レイヤー化してチラつき防止 ---- */
.stream-header,
.floating-icons,
.bottom-ui {
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform, opacity;
  contain: layout paint;
}

/* 動画の上にUIを確実に載せるため念のため */
.section {
  isolation: isolate;
}
video {
  z-index: 0;
}
.stream-header,
.floating-icons,
.bottom-ui {
  z-index: 10;
}

/*-------------------------------------------
ラストセクション
-------------------------------------------*/
.promo-section {
  position: relative;
  height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #000; /* 画像未読込時の黒背景 */
}

.promo-container {
  background: #f2f4f6;
  border-radius: 14px;
  text-align: center;
  padding: 5%;
}

.promo-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(14px) brightness(0.75);
  transform: scale(1.08) translateZ(0);
  will-change: transform, filter;
}

/* カード全体コンテナ（ヘッダ帯＋白カード） */
.promo-glass {
  position: relative;
  width: 100%;
  max-width: 600px;
  padding: 0 5%;
  transform: translateZ(0);
  will-change: transform, opacity;
}

/* 上の帯（「続きはこちらから」） */
.promo-head {
  background: #4a413c;
  color: #fff;
  font-weight: 800;
  font-size: clamp(18px, 4vw, 28px);
  text-align: center;
  padding: 14px 18px;
  border-radius: 18px 18px 0 0;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}
.promo-head .arrow {
  font-size: 1.1em;
  margin: 0 0.1em;
}

/* 白いカード本体 */
.promo-card {
  background: #fff;
  padding: clamp(18px, 4vw, 28px);
  border-radius: 0 0 22px 22px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}

/* 「年齢認証」バッジ風 */
.promo-badge {
  display: inline-block;
  color: #d43b3b;
  font-weight: bold;
  font-size: 25px;
}

.promo-note {
  color: #333;
  line-height: 1.6;
  font-size: clamp(12px, 3vw, 16px);
  margin-bottom: 16px;
}

.logo {
  width: 100%;
}

/* CTA テキスト */
.promo-cta-text {
  text-align: center;
  font-weight: bold;
  font-size: clamp(13px, 4vw, 26px);
  margin: 10px 0 14px;
}
.promo-cta-text .accent {
  color: #ff2c9a;
  font-weight: bolder;
}

/* グラデボタン */
.promo-button {
  display: block;
  text-align: center;
  text-decoration: none;
  color: #fff;
  font-weight: 900;
  font-size: clamp(16px, 4.4vw, 22px);
  padding: 16px 20px;
  border-radius: 18px;
  background: linear-gradient(90deg, #8a58ff, #ff4bd1);
  transition: transform 0.06s ease, filter 0.2s ease;
}
.promo-button:hover {
  filter: brightness(1.05);
}
.promo-button:active {
  transform: translateY(1px) scale(0.99);
}

/* 安全域（小さな端末での余白） */
@media (max-height: 700px) {
  .promo-glass {
    width: min(94vw, 640px);
  }
  .promo-card {
    padding: 14px;
  }
}

/* 親ビューのバウンス/スワイプ帰属を断つ */
html,
body {
  overscroll-behavior: none; /* iOS/Android 双方で有効 */
}

/* ヘッダー上でのドラッグ開始を通す（クリック可能な要素は除外するので安全） */
.stream-header {
  pointer-events: none;
}
/* ただし右側のアイコン群と下部UIは操作を通す */
.floating-icons,
.bottom-ui {
  pointer-events: auto;
}

/* 念のため：ドラッグの責務をこのページに寄せる */
#wrapper,
.sections,
.section {
  touch-action: none; /* 既にbodyでnoneにしているが、Slackでの伝播漏れを塞ぐ */
}

#heart-container {
  pointer-events: none;
}
#heart-container .heart {
  pointer-events: none;
}
