*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --error: #ef4444;
  --border: #334155;
  --radius: 12px;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  /* 端のストライプ(body::before/after)を絶対配置で貼り付けるための基準 */
  position: relative;
  font-family: 'Zen Kaku Gothic New', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    'Hiragino Sans', 'Yu Gothic UI', 'Noto Sans JP', sans-serif;
  /* iOS Safari の上下ラバーバンド(引っ張り)で露出する下地。
     コンテンツのピンクと揃え、黒帯が出ないようにする。 */
  background: #ffe1ec;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font-family: inherit;
}

/* 配布カードと世界観を合わせる、画面上下のピンク斜線ストライプ装飾。
   ログイン/視聴ページ共通。端の細い帯なのでコンテンツには被らない。 */
body::before,
body::after {
  content: '';
  /* fixed(ビューポート固定=フローティング)をやめ、body の高さに貼り付けて
     ページと一緒にスクロールさせる(iOS Safari のバー伸縮ズレも解消)。 */
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12px;
  z-index: 10;
  pointer-events: none;
  background: repeating-linear-gradient(
    -45deg,
    #ef8eb8 0,
    #ef8eb8 7px,
    transparent 7px,
    transparent 14px
  );
}

body::before {
  left: 0;
}

body::after {
  right: 0;
  /* 右側だけ斜線の向きを左右反転(左は -45deg、右は 45deg で鏡像) */
  background: repeating-linear-gradient(
    45deg,
    #ef8eb8 0,
    #ef8eb8 7px,
    transparent 7px,
    transparent 14px
  );
}

/* ===== Auth Screen ===== */

.auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
  padding: 2rem 1.25rem;
  padding-top: max(2rem, env(safe-area-inset-top));
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  /* top(視聴ページ)と統一したピンク基調グラデーション。下部はロゴの黄色と馴染ませる。 */
  background: linear-gradient(180deg, #ffd4ea 0%, #fff3cf 100%);
  color: #3a3340;
}

.auth-card {
  width: 95%;
  max-width: 420px;
  /* top の注釈カード(.notes)と同じ半透明白。ログインカード/closed-card 共通 */
  background: rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  /* カードデザインに寄せたピンク細ボーダー(section-badge と同色) */
  border: 3px solid #ef8eb8;
  /* 上の余白だけ詰める(上1.5rem / 左右1.5rem / 下2rem) */
  padding: 1.5rem 1.5rem 2rem;
  box-shadow: 0 12px 36px rgba(60, 20, 40, 0.16);
}

.auth-title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  text-align: center;
  font-weight: 700;
}

/* ログイン画面: フォームカードの下にゆとりを足す(画面下側の余白)。
   top 画面には #login-card が無いため影響しない。 */
#login-card {
  margin-bottom: 7rem;
}

.auth-lead {
  /* 入力欄とログインボタンの間に置く補足説明。
     form の gap:1.25rem が効くため、上マージンをマイナスにして入力欄との隙間を詰める */
  margin: -0.7rem 0 0.75rem;
  /* 補足説明っぽく一回り小さく */
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.5;
  /* Cookie 注意書き(.cookie-notice)と同じ文字色に揃える */
  color: #4a3f46;
  text-align: left;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #4a3f46;
}

.field input {
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 1rem;
  background: #fff;
  color: #3a3340;
  border: 1px solid #f0cdd9;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus {
  border-color: #d6336c;
}

.error-message {
  margin: 0;
  padding: 0.75rem 1rem;
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  font-size: 0.875rem;
}

.primary-btn {
  padding: 0.65rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  /* section-badge のピンクを一段濃くした色(通常時) */
  background: #e072aa;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.primary-btn:hover {
  background: #d1568f;
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== Top Screen (視聴ページ・ページ内埋め込み) ===== */

.video-screen {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1.25rem;
  padding-top: max(2rem, env(safe-area-inset-top));
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  /* デザインラフのピンク基調を淡いグラデーションで再現。下部はロゴの黄色と馴染ませる。 */
  background: linear-gradient(180deg, #ffd4ea 0%, #fff3cf 100%);
  color: #3a3340;
}

.video-card {
  width: 100%;
  max-width: 760px;
  /* 動画枠の基準幅。ロゴはこの値-6%で追従する(1か所変えれば両方変わる)。 */
  --video-w: 85%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.brand-logo {
  /* 動画枠の幅に追従し、それより6ポイント細く表示(動画80% → ロゴ74%)。
     video-card 基準の%なので、画面サイズに応じて動画と一緒に伸縮する。 */
  width: calc(var(--video-w));
  height: auto;
}

/* ログイン画面には --video-w が無いため、top画面と同じ比率を明示指定。
   横幅74%(=top のロゴ比)、上限は top のデスクトップ最大幅 760px×74%≒562px。 */
.auth-screen .brand-logo {
  width: min(85%, 562px);
}

.section-badge {
  /* video-card の gap(1.5rem)からロゴ↔バッジ間だけ詰める(上方向に引き上げ) */
  margin: -0.7rem 0 0;
  padding: 0.8rem 0.8rem;
  /* 1行固定。枠は中身(1行テキスト)にフィットさせ、フォント拡大に合わせて枠ごと拡大。 */
  width: fit-content;
  max-width: 100%;
  white-space: nowrap;
  text-align: center;
  /* 配布カードのバッジと同形に: 角丸長方形・ピンク枠線・ピンク文字・塗りなし・影なし */
  background: transparent;
  color: #ef8eb8;
  /* 画面幅連動で拡大、上限1.8remで頭打ち。下限は注釈(.notes)と同じ0.78rem。枠は中身に追従。 */
  font-size: clamp(0.78rem, 5.5vw, 1.8rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 3px solid #ef8eb8;
  /*border-radius: 12px;*/
  /* 和文フォントの字面上下の内部余白を削り、枠内で字面を中央に揃える。
     対応ブラウザ(Chrome133+/Safari18.2+)でのみ有効。未対応(Firefox等)は従来表示にフォールバック。 */
  line-height: 1;
  text-box: trim-both cap alphabetic;
}

/* 動画埋め込み枠: 16:9 を維持してページ内に直接埋め込む。 */
.video-frame {
  position: relative;
  width: var(--video-w);
  aspect-ratio: 16 / 9;
  background: #000;
  /*border-radius: 14px;*/
  overflow: hidden;
}

.video-embed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.video-embed[hidden] {
  display: none;
}

/* 公開前/終了/準備中の枠内メッセージ */
.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  color: #f1f5f9;
  font-size: 0.95rem;
  line-height: 1.7;
}

.video-placeholder[hidden] {
  display: none;
}

.copyright {
  /* 動画フレームと同じ幅にして右端を動画の右端に揃える(直下・右寄せ) */
  width: var(--video-w);
  /* video-card の gap(1.5rem)から動画↔コピーライト間だけ詰める(上方向に引き上げ) */
  margin: -1.4rem 0 0;
  font-size: 0.72rem;
  color: #202124;
  text-align: right;
}

.notes {
  width: 95%;
  margin: 0.5rem 0 0;
  padding: 1.25rem 1.25rem 1.25rem 1.5rem;
  list-style: none;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  font-size: 0.78rem;
  line-height: 1.85;
  color: #4a3f46;
}

.notes li {
  position: relative;
  padding-left: 1.1em;
}

.notes li::before {
  content: '※';
  position: absolute;
  left: 0;
  /* 本文の濃いグレーと同色に揃える */
  color: #4a3f46;
}

.notes li + li {
  margin-top: 0.4rem;
}

@media (min-width: 768px) {
  .notes {
    font-size: 0.8rem;
  }
}

/* ===== Cookie Notice / Turnstile ===== */

.cookie-notice {
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: #4a3f46;
  text-align: center;
  line-height: 1.6;
}

.turnstile-widget:empty {
  display: none;
}

/* Turnstile はサイト右下にフローティング固定(position:fixed)。
   中身(Cloudflare製iframe・幅300px固定)は scale で縮小し、右下を基準に縮める。
   右端のピンクストライプ(z-index:10)より前面に出すため z-index を上げる。 */
.turnstile-widget {
  position: fixed;
  /* 画面の右下角ぴったりに寄せる。下端は iOS のセーフエリアだけ確保。 */
  right: 4px;
  bottom: max(4px, env(safe-area-inset-bottom));
  z-index: 50;
  transform: scale(0.9);
  transform-origin: bottom right;
}

/* ===== 公開期間外カード(ログイン画面) ===== */

.closed-card {
  text-align: center;
}

.closed-icon {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 0.75rem;
}

.closed-title {
  margin: 0;
  font-size: 1.55rem;
  /* 太字は外す(通常ウェイト) */
  font-weight: 400;
}

.closed-text {
  margin: 1rem 0 0;
  font-size: 1.05rem;
  color: #4a3f46;
  line-height: 1.8;
  /* textContent 内の \n を改行として表示する(空白は畳む) */
  white-space: pre-line;
}
