﻿/* ====== レイアウト（共通） ====== */
:root{
  /* コントロールと干渉する場合はここで下マージンを微調整 */
  --caption-bottom: 50px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background: #111;
  color: #ddd;
}

h3 {
  max-width: 960px;
  margin: 16px auto 8px;
  padding: 0 4px;
  font-weight: 600;
}

.video-wrap {
  position: relative;
  max-width: 960px;
  margin: 8px auto 32px;
  padding: 0 4px;
}

.captioned-video {
  width: 100%;
  height: auto;
  display: block;
  background: #000;
  border-radius: 8px;
}

/* ====== テロップ帯（動画最下部に重ねる） ====== */
.subtitle-bar {
  position: absolute;
  left: 4px;                 /* video の左右paddingに合わせる */
  right: 4px;
  bottom: var(--caption-bottom);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  pointer-events: none;      /* クリックは動画に通す */
}

.subtitle-text {
  max-width: min(92%, 1100px);
  background: rgba(0,0,0,.8);
  color: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: clamp(14px, 2.2vw, 16px);
  line-height: 1.55;
  white-space: pre-wrap;      /* \n を改行表示 */
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,.7);
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
  transition: opacity .18s ease, transform .18s ease;
  will-change: opacity, transform;
  opacity: 0;
  transform: translateY(6px);
}

/* 表示時のフェードイン */
.subtitle-text.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* 小さめ画面での可読性を底上げ */
@media (max-width: 480px) {
  .subtitle-text {
    padding: 8px 12px;
    font-size: clamp(14px, 3.6vw, 18px);
  }
}
