/* ============================================================
   main.css — 観覧車 音声ガイド
   ============================================================ */

/* ---- Variables ---- */
:root {
  /* テーマ(アクセント)カラーの【デフォルト＝赤系】。
     ★キャンペーンごとの色変更は js/campaign-config.js の theme で上書きする★
     （未指定ならこの赤が使われる）。詳細手順 → docs/campaign-change.md */
  --accent:      #CF2A32;   /* メインのアクセント色（デフォルト赤） */
  --accent-dark: #a82028;   /* 押下時・立体ボタンの影など濃いめ（デフォルト赤） */
  --error:       #CF2A32;   /* エラー表示用（テーマと独立・固定） */
  --caution-bg: #FDECEA;
  --caution-bd: #f5c6c6;
  --bg:         #F5F5F5;   /* body の外側背景 */
  --page-bg:    #EAEAEA;   /* ページ本体の背景 */
  --text:       #1A1A1A;
  --text-sub:   #666666;
  --white:      #ffffff;
  --max-w:      430px;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  background: var(--bg);
  font-family: -apple-system, "Hiragino Sans", "Yu Gothic", sans-serif;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; width: 100%; height: auto; }
button { cursor: pointer; border: none; background: none; font: inherit; }

/* ---- Page wrapper ---- */
.page {
  max-width: var(--max-w);
  margin: 0 auto;
  background: var(--page-bg);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   S1: トップページ
   ============================================================ */

/* ---- Key Visual（アンビエントモード）----
   原画像はトリミングせずそのまま表示し、周囲のマージンに同じKV画像を
   ぼかして敷く（YouTubeのアンビエントモード風）。言語スイッチは上側の
   ぼかし余白に置くので、キャラクター画像本体には重ならない。 */
.kv-wrap {
  position: relative;
  width: 100%;
  flex-shrink: 0;
  padding: 46px 0 16px;        /* 縦方向のみ余白（上＝言語スイッチ用）。横は0＝画像は全幅のまま */
  overflow: hidden;
  background: #1a1a2e;          /* 画像読込前/失敗時のフォールバック */
}
/* 余白を埋めるぼかし背景：同じKV画像を拡大＆ぼかし */
.kv-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url(../images/kv.jpg) center center / cover no-repeat;
  filter: blur(22px) saturate(1.15);
  transform: scale(1.2);       /* ぼかしの端が切れないよう拡大 */
  z-index: 0;
}
/* 原画像：全幅でそのまま（トリミング・縮小なし）表示。上下のぼかし帯と影で分離 */
.kv-wrap img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  display: block;
  box-shadow: 0 0 16px rgba(0, 0, 0, .25);
}

/* ---- 言語スイッチャー ---- */
.lang-switcher {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;                  /* ぼかし背景・原画像より前面（上余白に表示） */
  display: flex;
  gap: 3px;
  background: rgba(0, 0, 0, .45);
  border-radius: 20px;
  padding: 4px;
  backdrop-filter: blur(4px);
}
.lang-btn {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, .6);
  padding: 4px 10px;
  border-radius: 16px;
  letter-spacing: .06em;
  transition: background .15s, color .15s;
}
.lang-btn--active {
  background: #fff;
  color: var(--text);
}
.lang-switcher--fixed {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 100;
}

/* ---- Red Banner ---- */
.red-banner {
  margin-top: 10px;
  background-color: var(--accent);
  color: var(--white);
  text-align: center;
  padding: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.red-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('../images/banner_bg.jpg') left center / cover no-repeat;
  opacity: 0.13;
}
.banner-inner {
  border: 3px solid rgba(255,255,255,.5);
  border-radius: 3px;
  padding: 12px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  position: relative;
  z-index: 1;
}
.banner-sub {
  font-size: 18px;
  line-height: 29px;
  font-weight: 700;
  letter-spacing: .08em;
  opacity: .9;
}
.banner-main {
  font-size: 27px;
  line-height: 29px;
  font-weight: 900;
  letter-spacing: .04em;
}

/* ---- S1 Body ---- */
.s1-body {
  flex: 1;
  padding: 20px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--page-bg);
}
/* fixed ボタン分の余白 */
.btn-spacer-block { height: 80px; flex-shrink: 0; }

/* ---- フッター ---- */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 16px;
  gap: 12px;
}
.footer-logo {
  height: 72px;
  width: auto;
  object-fit: contain;
}
.footer-powered-label {
  font-size: 11px;
  color: var(--text-sub);
  letter-spacing: .04em;
  text-align: center;
}
.footer-powered-logo {
  height: 72px;
  width: auto;
  object-fit: contain;
}
.footer-copy {
  font-size: 11px;
  color: var(--text-sub);
  letter-spacing: .04em;
  text-align: center;
}

/* ---- 音声言語注意バナー ---- */
.lang-notice {
  background: var(--caution-bg);
  border: 1px solid var(--caution-bd);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  text-align: center;
}

/* ---- Lead Text ---- */
.lead-text {
  font-size: 16px;
  font-weight: 700;
  line-height: 23px;
  text-align: center;
  color: var(--text);
}

/* ---- Caution Card ---- */
.caution-card {
  background: var(--white);
  border-radius: 16px;
}
.caution-header-wrap { padding: 16px 18px 0; }
.caution-header {
  background: var(--caution-bg);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
}
.caution-header-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}
.caution-items {
  padding: 14px 18px 27px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.caution-item {
  display: flex;
  align-items: center;
  gap: 14px;
}
.c-icon-wrap {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #2a2a2a;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.c-text { display: flex; flex-direction: column; gap: 3px; padding-top: 2px; }
.c-title { font-weight: 700; font-size: 14px; color: var(--text); }
.c-desc  { font-size: 12px; color: var(--text-sub); line-height: 1.6; }

/* ---- Fixed CTA ---- */
.btn-fixed-wrap {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-w);
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to bottom, transparent, var(--page-bg) 40%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.denied-msg {
  font-size: 13px;
  color: var(--accent);
  text-align: center;
}

/* ---- Buttons ---- */
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: var(--white);
  font-size: 16px;
  font-weight: 700;
  border-radius: 100px;
  padding: 15px 24px;
  text-align: center;
  transition: background .15s;
  letter-spacing: .02em;
}
.btn-primary:active { background: var(--accent-dark); }

/* 矢印付きCTAボタン */
.btn-primary--arrow {
  font-size: 21px;
  padding: 16px 20px 16px 24px;
  box-shadow: 0 4px 0 0 var(--accent-dark), 0 10px 11px 0 rgba(0,0,0,.20);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform .1s, box-shadow .1s;
}
.btn-primary--arrow:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 0 var(--accent-dark), 0 4px 6px 0 rgba(0,0,0,.20);
  background: var(--accent);
}
.btn-spacer { width: 36px; height: 36px; flex-shrink: 0; }
.btn-arrow {
  width: 36px; height: 36px;
  border-radius: 39px;
  background: #FFCCCC;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.btn-ghost {
  width: 100%;
  background: transparent;
  color: var(--text-sub);
  font-size: 15px;
  border-radius: 100px;
  padding: 12px 24px;
  text-align: center;
  border: 1px solid #ddd;
}
.btn-ghost:active { background: #f0f0f0; }

/* ============================================================
   Modal（GPS許可）
   ============================================================ */
.modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex; align-items: flex-end;
}
.modal.hidden { display: none; }

.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.5);
}
.modal-content {
  position: relative;
  background: var(--white);
  border-radius: 20px 20px 0 0;
  padding: 28px 24px calc(40px + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}
.modal-body {
  font-size: 14px;
  color: var(--text-sub);
  text-align: center;
  line-height: 1.7;
}
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

/* ============================================================
   S2: GPS認証
   ============================================================ */
.s2-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px calc(100px + env(safe-area-inset-bottom, 0px));
  gap: 20px;
  text-align: center;
}

/* ---- 状態パネル ---- */
.s2-state {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}
.s2-state--active { display: flex; }

.s2-state-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}
.s2-state-title--error { color: var(--error); }
.s2-state-desc {
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.7;
}

/* ---- アイコン ---- */
.s2-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 700;
}
.s2-icon--ok    { background: #dcfce7; color: #16a34a; }
.s2-icon--error { background: #fee2e2; color: var(--error); }

/* ---- スピナー ---- */
.spinner {
  width: 56px; height: 56px;
  border: 4px solid #e5e7eb;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 戻るボタン（エラー時） ---- */
.s2-back-btn { margin-top: 8px; }

/* ============================================================
   S3: 上映回選択
   ============================================================ */

/* ---- スクリーンヘッダー ---- */
.screen-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #d8d8d8;
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}
.screen-title { font-size: 17px; font-weight: 700; }
.btn-back {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text);
  flex-shrink: 0;
}
.btn-back:active { background: #f0f0f0; }

/* ---- リードテキスト（S3） ---- */
.s3-lead {
  padding: 20px 20px 4px;
  font-weight: 500;
}

/* ---- スロットリスト ---- */
.slot-list {
  padding: 12px 16px 120px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.slot-card {
  background: var(--white);
  border: 1.5px solid #e0e0e0;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.slot-card--accepting { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, #fff); }
.slot-card--playing   { border-color: #f59e0b; background: #fffbeb; }
.slot-card--ended     { opacity: .45; }

.slot-left { display: flex; flex-direction: column; gap: 5px; }
.slot-time    { font-size: 18px; font-weight: 700; }
.slot-elapsed { font-size: 12px; color: var(--text-sub); white-space: nowrap; }

.slot-badge {
  font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 100px;
  letter-spacing: .04em; white-space: nowrap;
  display: inline-block;
}
.badge--recommend { background: var(--accent); color: #fff; }
.badge--recommend::before { content: "★ "; font-size: 10px; }
.badge--accepting { background: var(--accent); color: #fff; }
.badge--playing   { background: #f59e0b; color: #fff; }
.badge--upcoming  { background: #e5e7eb; color: var(--text-sub); }
.badge--ended     { background: #e5e7eb; color: var(--text-sub); }

.slot-btn {
  font-size: 13px; font-weight: 700;
  padding: 8px 16px; border-radius: 100px;
  white-space: nowrap; flex-shrink: 0;
  color: #fff; background: var(--accent);
}
.slot-btn:disabled { background: #ccc; color: #888; cursor: default; }

/* ---- 途中参加バー（fixed） ---- */
.midway-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-w);
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to bottom, transparent, var(--page-bg) 40%);
}
.midway-text {
  width: 100%;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-sub);
  padding: 8px 0;
  cursor: pointer;
  text-decoration: underline;
}

/* ---- BottomSheet ---- */
.sheet-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 50;
}
.sheet-backdrop.open { display: block; }

.sheet-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.4);
}
.sheet-content {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--max-w);
  background: var(--white);
  border-radius: 20px 20px 0 0;
  max-height: 70vh; overflow-y: auto;
}
.sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 12px;
  border-bottom: 1px solid #eee;
  position: sticky; top: 0;
  background: var(--white);
}
.sheet-title { font-size: 16px; font-weight: 700; }
.btn-close {
  font-size: 18px; color: var(--text-sub);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.btn-close:active { background: #f0f0f0; }
.sheet-desc { font-size: 13px; color: var(--text-sub); padding: 10px 20px 4px; }
.sheet-list {
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 10px;
}

/* ============================================================
   S4: 再生中
   ============================================================ */
.s4-body {
  flex: 1;
  padding: 32px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---- セッション時刻ラベル ---- */
.slot-label {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
}

/* ---- プログレスカード ---- */
.progress-card {
  background: var(--white);
  border-radius: 16px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.progress-wrap { display: flex; flex-direction: column; gap: 8px; }
.progress-track {
  height: 6px;
  background: #e5e7eb;
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  width: 0%;
  transition: width .5s linear;
}
.progress-times {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-sub);
}

/* ---- 上映回選択に戻る ---- */
.back-to-select {
  text-align: center;
  font-size: 18px;
}
.back-to-select a {
  color: var(--text-sub);
  text-decoration: underline;
}

/* ---- 上映前注意書き ---- */
.intro-notice {
  text-align: center;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-sub);
  padding: 12px 0 4px;
}

/* ---- 再生ステータス ---- */
.status-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-sub);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.status-dot--active {
  animation: pulse 1.5s ease-in-out infinite;
}
.status-dot--muted { background: #9CA3AF; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .4; transform: scale(.8); }
}

/* ============================================================
   S5: ありがとうページ
   ============================================================ */

/* ページ中央寄せ（S5専用） */
.page--centered {
  align-items: center;
  justify-content: center;
  padding: 40px 24px calc(100px + env(safe-area-inset-bottom, 0px));
  text-align: center;
}

/* ---- イヤホンアイコン ---- */
.s5-icon-wrap {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  margin-bottom: 20px;
}
.s5-icon-wrap img {
  width: 52px; height: 52px;
  object-fit: contain;
}

/* ---- テキスト ---- */
.s5-title {
  font-size: 25px;
  font-weight: 700;
  line-height: 32px;
  color: #334155;
  margin-bottom: 8px;
}
.s5-sub {
  font-size: 16px;
  font-weight: 700;
  line-height: 23px;
  color: #334155;
  margin-bottom: 24px;
}

/* ---- キービジュアル（S5） ---- */
.s5-kv-wrap {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
}

/* ---- 白ベース CTA ボタン（S5）---- */
.btn-primary--white {
  background: var(--white);
  color: var(--accent);
  box-shadow: 0 4px 0 0 #F4E6E6, 0 10px 11px 0 rgba(0,0,0,.20);
}
.btn-primary--white:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 0 #F4E6E6, 0 4px 6px 0 rgba(0,0,0,.20);
  background: var(--white);
}
.btn-primary--white .btn-arrow {
  background: #FFCCCC;
}

/* ---- 中断カード（通話などで音声が止まった場合） ---- */
.reload-card {
  background: var(--white);
  border: 1.5px solid var(--caution-bd);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.reload-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.reload-card-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: pulse 1.5s ease-in-out infinite;
}
.reload-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}
.reload-card-desc {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.7;
}
.btn-reload {
  width: 100%;
  background: var(--accent);
  color: var(--white);
  font-size: 15px;
  font-weight: 700;
  border-radius: 100px;
  padding: 13px 24px;
  text-align: center;
  transition: background .15s;
}
.btn-reload:active { background: var(--accent-dark); }

/* ---- 再生オーバーレイ（iOS autoplay 対策） ---- */
.play-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-play-overlay {
  background: var(--accent);
  color: var(--white);
  font-size: 18px;
  font-weight: 700;
  border-radius: 100px;
  padding: 18px 48px;
  box-shadow: 0 4px 0 0 var(--accent-dark), 0 10px 24px color-mix(in srgb, var(--accent) 50%, transparent);
  letter-spacing: .04em;
}
.btn-play-overlay:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 0 var(--accent-dark), 0 4px 8px color-mix(in srgb, var(--accent) 40%, transparent);
}

/* ---- Utilities ---- */
.hidden { display: none !important; }
