/* =====================================================================
   theme-wa.css — GyuraGyura v2 「和・禅・リアル・愛と平和」
   style.css の後に読み込み、シェル/コメント/メニュー/履歴/パネルを和の意匠に。
   パレット: 和紙(washi)・墨(sumi)・朱(shu)・金(kin)。
   ===================================================================== */

:root {
  --washi:      #f4ede0;   /* 和紙 */
  --washi-2:    #efe2cc;
  --sumi:       #22201c;   /* 墨（温かい黒） */
  --sumi-ink:   #1b1612;
  --sumi-card:  rgba(22,19,15,0.95);
  --shu:        #c3472e;   /* 朱 */
  --shu-soft:   #d1543c;
  --shu-deep:   #a5331f;
  --kin:        #d8c08a;   /* 金・砂子 */
  --kin-soft:   #e8dcc2;
  --paper-text: #241d15;
  --drawer-w:   clamp(280px, 26vw, 360px);
  --mincho: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --maru:   'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', sans-serif;
}

/* ============ ウェルカム（和紙） ============ */
#welcome {
  background: linear-gradient(160deg, #f5ecdb 0%, #efe2cc 55%, #ead7c2 100%) !important;
  animation: none !important;
}
#welcome::before {
  background:
    radial-gradient(ellipse 70% 50% at 50% 28%, rgba(195,71,46,0.06) 0%, transparent 70%),
    radial-gradient(ellipse 54% 42% at 72% 82%, rgba(216,192,138,0.16) 0%, transparent 70%) !important;
}
#welcome-icon { filter: none !important; opacity: 0.92; }
.welcome-title {
  font-family: var(--mincho) !important;
  font-weight: 800 !important;
  background: none !important;
  -webkit-text-fill-color: #2a241c !important;
  color: #2a241c !important;
  filter: none !important;
  letter-spacing: 6px !important;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}
.welcome-en  { color: rgba(165,51,31,0.65) !important; letter-spacing: 4px !important; }
.welcome-sub { color: rgba(42,36,28,0.5) !important; font-family: var(--maru); }

/* ============ 配信シェル（カメラ全画面＋和紙額装） ============ */
/* グラデを温かい墨トーンに */
.grad-top {
  height: 118px !important;
  background: linear-gradient(to bottom, rgba(24,18,12,0.56) 0%, rgba(24,18,12,0.22) 55%, transparent 100%) !important;
}
.grad-bottom {
  height: 200px !important;
  background: linear-gradient(to top, rgba(24,18,12,0.72) 0%, rgba(24,18,12,0.34) 48%, transparent 100%) !important;
}

/* 和紙の額装：ビネット ＋ 朱の内枠 */
#washi-frame {
  position: absolute; inset: 0; pointer-events: none; z-index: 6;
  box-shadow: inset 0 0 140px 26px rgba(24,16,10,0.42);
}
#washi-frame::after {
  content: ''; position: absolute; inset: 15px; border-radius: 3px;
  border: 1.5px solid rgba(179,58,46,0.45);
  box-shadow: 0 0 0 6px rgba(244,237,224,0.08), inset 0 0 0 1px rgba(255,255,255,0.05);
}
/* ギュラギュラ君ロゴ（上部バーの左端に小さく） */
#washi-logo {
  position: absolute; left: 16px; top: 13px; z-index: 21;
  width: 32px; height: 32px; object-fit: contain;
  pointer-events: none; opacity: 0.9;
  filter: invert(1) drop-shadow(0 1px 3px rgba(0,0,0,0.5)) drop-shadow(0 0 6px rgba(0,0,0,0.3));
}

/* ============ 流れるコメント（白抜き：白い文字＋墨の縁取り） ============ */
#danmaku-layer {
  position: absolute; inset: 0; overflow: hidden;   /* 映像領域内にクリップ */
  pointer-events: none; z-index: 12;
}
.danmaku {
  /* 縁取りの色。文字色ごとに変えられるよう変数に */
  --dm-edge: rgba(22,16,12,0.92);
  position: absolute; left: 100%; white-space: nowrap;
  font-family: var(--mincho); font-weight: 700; line-height: 1;
  color: #fff;
  /* 8方向の影で縁取り（文字サイズに比例）＋ うっすら落ち影で明るい映像でも読める */
  text-shadow:
    -0.03em -0.03em 0 var(--dm-edge),  0.03em -0.03em 0 var(--dm-edge),
    -0.03em  0.03em 0 var(--dm-edge),  0.03em  0.03em 0 var(--dm-edge),
     0       -0.04em  0 var(--dm-edge),  0        0.04em  0 var(--dm-edge),
    -0.04em   0       0 var(--dm-edge),  0.04em   0       0 var(--dm-edge),
     0 0.08em 0.18em rgba(0,0,0,0.45);
  will-change: transform;
}
.danmaku.accent { color: #ff9a7a; }      /* 朱を明るく：縁取りの上で映える */
/* テーマ募集コメントはネオンで目立たせる（色は JS がインラインで指定） */
.danmaku.topic {
  font-family: var(--maru); font-weight: 800;
  text-shadow:
    -0.03em -0.03em 0 var(--dm-edge),  0.03em -0.03em 0 var(--dm-edge),
    -0.03em  0.03em 0 var(--dm-edge),  0.03em  0.03em 0 var(--dm-edge),
     0       -0.04em  0 var(--dm-edge),  0        0.04em  0 var(--dm-edge),
    -0.04em   0       0 var(--dm-edge),  0.04em   0       0 var(--dm-edge),
     0 0 10px var(--neon, #0ef),
     0 0 20px var(--neon, #0ef);
}
.hc.topic { background: rgba(10,10,16,0.9); border-radius: 10px; }
.hc.topic .hc-name { color: rgba(255,255,255,0.72); }
.hc.topic .hc-text { font-weight: 700; text-shadow: 0 0 1px rgba(0,0,0,0.9), 0 1px 2px rgba(0,0,0,0.8); }
.dz-s { font-size: 22px; }
.dz-m { font-size: 31px; }
.dz-l { font-size: 41px; }
@keyframes danmakuFlow {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-1 * var(--danmaku-travel, 100vw))); }
}

/* ============ トップバー（墨バッジ） ============ */
.badge { font-family: var(--maru) !important; }
.badge-dark {
  background: rgba(26,20,14,0.46) !important;
  color: #f2ead9 !important;
  border: 1px solid rgba(240,230,210,0.18) !important;
}
.badge-live {
  background: rgba(179,58,46,0.9) !important;
  border: 1px solid rgba(214,120,96,0.5) !important;
}
@keyframes livePulse {
  0%,100% { box-shadow: 0 0 8px rgba(179,58,46,0.5); }
  50%     { box-shadow: 0 0 20px rgba(179,58,46,0.8), 0 0 40px rgba(179,58,46,0.2); }
}
.badge-timer { background: rgba(26,20,14,0.46) !important; color: var(--kin-soft) !important; border: 1px solid rgba(216,192,138,0.28) !important; }

/* ============ 役割で左右に分ける ============
   右下＝読む（コメント履歴ボタン）／左下＝操作（メニュー）。
   履歴を開いても操作ボタンの位置は動かない。 */
#side-controls {
  position: fixed; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px; z-index: 46;
}
/* 履歴を開いている間はドロワー自身の ✕ で閉じる（ボタンは隠す） */
body.history-open #history-fab { display: none; }
#menu-dock {
  position: fixed; left: 18px; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 46;
}
/* 上部バーはロゴの右から */
#top-bar { left: 58px !important; }
.fab {
  font-family: var(--maru); font-weight: 700; font-size: 14px; letter-spacing: 0.6px;
  border-radius: 999px; padding: 12px 20px; cursor: pointer;
  box-shadow: 0 6px 24px rgba(20,14,8,0.42); transition: filter .15s, transform .15s, outline .15s;
}
.fab:active { transform: scale(0.96); }
.fab-primary { background: linear-gradient(180deg, #c3472e, #a5331f); color: #fdf3e8; border: 1px solid rgba(255,205,186,0.32); }
.fab-primary:hover { filter: brightness(1.07); }
.fab-ghost { background: rgba(26,20,14,0.62); color: #f2ead9; border: 1px solid rgba(240,230,210,0.22); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.fab-ghost:hover { background: rgba(26,20,14,0.78); }
.fab.active { outline: 2px solid rgba(216,192,138,0.55); outline-offset: 1px; }

/* ============ 折りたたみグループメニュー ============ */
#menu-sheet {
  position: fixed; left: 18px; right: auto; bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  width: 302px; max-height: 72vh; overflow-y: auto; z-index: 47;
  background: var(--sumi-card); border: 1px solid rgba(216,192,138,0.22); border-radius: 18px;
  padding: 8px; backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 18px 54px rgba(0,0,0,0.5);
  transition: opacity .2s ease, transform .2s ease;
}
#menu-sheet.hidden { opacity: 0; transform: translateY(14px); pointer-events: none; }
.menu-sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 8px 10px; border-bottom: 1px solid rgba(240,230,210,0.1);
}
.menu-sheet-title { font-family: var(--mincho); font-weight: 700; color: var(--kin-soft); font-size: 15px; letter-spacing: 2px; }
.menu-close { background: none; border: none; color: rgba(240,230,210,0.5); font-size: 16px; cursor: pointer; line-height: 1; padding: 4px; }
.menu-close:hover { color: #fff; }
.menu-groups { padding: 4px 2px 2px; }
.menu-group { margin-top: 4px; }
.menu-group-head {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px 10px;
  background: none; border: none; cursor: pointer; border-radius: 10px;
  font-family: var(--mincho); font-size: 13px; letter-spacing: 1.5px; color: var(--kin);
}
.menu-group-head:hover { background: rgba(240,230,210,0.06); }
.mg-emoji { font-size: 14px; }
.mg-title { flex: 1; text-align: left; }
.mg-chevron { color: rgba(240,230,210,0.42); transition: transform .2s ease; font-size: 11px; }
.menu-group.collapsed .mg-chevron { transform: rotate(-90deg); }
.menu-group-body {
  display: flex; flex-direction: column; gap: 6px; padding: 4px 4px 8px;
  overflow: hidden; max-height: 320px; transition: max-height .24s ease, opacity .2s ease;
}
.menu-group.collapsed .menu-group-body { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }
.menu-item {
  text-align: left; padding: 10px 14px; border-radius: 12px; cursor: pointer;
  border: 1px solid rgba(240,230,210,0.12); background: rgba(244,237,224,0.05);
  color: #f2ead9; font-family: var(--maru); font-weight: 500; font-size: 13.5px;
  transition: .14s;
}
.menu-item:hover { background: rgba(195,71,46,0.16); border-color: rgba(195,71,46,0.42); color: #fbe7dd; }
.menu-item.active, .menu-item.loading { background: rgba(195,71,46,0.22); border-color: rgba(195,71,46,0.5); color: #fff; }
.menu-item.has-note { border-color: rgba(216,192,138,0.5); color: var(--kin-soft); }

/* ============ コメント履歴ドロワー（右・YouTube風） ============ */
#history-panel {
  position: fixed; top: 0; right: 0; width: var(--drawer-w); height: 100vh; z-index: 44;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(245,238,225,0.975), rgba(238,228,210,0.975));
  border-left: 1px solid rgba(179,58,46,0.32);
  box-shadow: -14px 0 42px rgba(0,0,0,0.34);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform .28s cubic-bezier(.22,1,.36,1), opacity .2s ease;
}
#history-panel.hidden { transform: translateX(100%); opacity: 0; pointer-events: none; }
.history-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 16px; border-bottom: 1px solid rgba(28,20,12,0.12);
  background: rgba(244,237,224,0.6);
}
.history-title { font-family: var(--mincho); font-weight: 700; color: #2a241c; font-size: 15px; letter-spacing: 1.5px; }
.history-close { background: none; border: none; font-size: 16px; color: rgba(42,36,28,0.5); cursor: pointer; line-height: 1; padding: 4px; }
.history-close:hover { color: var(--shu-deep); }
/* comment-stage をドロワーの中身に（旧フルスクリーン配置を無効化） */
#history-panel #comment-stage {
  position: static !important; inset: auto !important;
  left: auto !important; right: auto !important; top: auto !important; bottom: auto !important;
  width: 100% !important; height: auto !important; flex: 1 1 auto;
  display: flex; flex-direction: column; gap: 0; padding: 8px 6px 18px;
  overflow-y: auto; z-index: auto; pointer-events: auto !important;
  scrollbar-color: rgba(42,36,28,0.3) transparent;
}
#history-panel #comment-stage::-webkit-scrollbar { width: 6px; }
#history-panel #comment-stage::-webkit-scrollbar-thumb { background: rgba(42,36,28,0.26); border-radius: 3px; }
#history-panel #comment-stage > .hc:first-child { margin-top: auto; }
.hc { display: flex; gap: 9px; align-items: flex-start; padding: 7px 10px; border-radius: 10px; }
.hc:hover { background: rgba(28,20,12,0.05); }
.hc-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; background: currentColor; box-shadow: 0 0 0 2px rgba(255,255,255,0.55); }
.hc-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.hc-name { font-family: var(--maru); font-weight: 700; font-size: 11.5px; letter-spacing: .3px; color: rgba(42,36,28,0.6); }
.hc-text { font-family: var(--maru); font-weight: 500; font-size: 14.5px; line-height: 1.45; color: var(--paper-text); word-break: break-word; }
.hc.accent .hc-text { color: var(--shu-deep); }

/* ── コメント履歴：配信ごとの区切り（今回の配信がどこからか分かるように）──
   区切りは細い墨の線＋朱の「今回の配信」印。前回までのコメントは薄く沈める。 */
#history-panel #comment-stage > .hc-sep:first-child { margin-top: auto; }
.hc-sep {
  display: flex; align-items: center; gap: 8px;
  margin: 14px 4px 8px; padding: 0 2px;
  font-family: var(--mincho); font-size: 11.5px; letter-spacing: 1px;
  color: rgba(42,36,28,0.45);
}
.hc-sep::before, .hc-sep::after {
  content: ''; flex: 1 1 auto; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(42,36,28,0.22) 30%, rgba(42,36,28,0.22) 70%, transparent);
}
.hc-sep-tag { display: none; }
.hc-sep-time { white-space: nowrap; }
.hc-sep.current { color: var(--shu-deep); margin-top: 18px; }
.hc-sep.current::before, .hc-sep.current::after {
  background: linear-gradient(90deg, transparent, rgba(195,71,46,0.55) 25%, rgba(195,71,46,0.55) 75%, transparent);
}
.hc-sep.current .hc-sep-tag {
  display: inline-block; white-space: nowrap;
  padding: 2px 8px; border: 1px solid var(--shu); border-radius: 3px;
  font-weight: 700; color: var(--shu-deep); background: rgba(195,71,46,0.06);
}
.hc.hc-past { opacity: .42; transition: opacity .2s ease; }
.hc.hc-past:hover { opacity: .8; }
.hc.hc-past .hc-acts { display: none; }

/* ── コメント履歴を出しても、カメラの画角（映る範囲）は変えない ──
   ドロワー分だけ映像エリアを左に寄せ、カメラは全フレームを縮小表示（contain）。
   顔が中央のまま丸ごと見え、右側が隠れたり切り取られたりしない。 */
#camera-feed { transition: right 0.28s cubic-bezier(.22,1,.36,1); }
body.history-open #camera-feed {
  left: 0; right: auto; width: calc(100% - var(--drawer-w));
  object-fit: contain;                 /* 画角を変えず全体を収める（cropしない） */
  background: #120d09;                  /* 余白（レターボックス）は墨色 */
}
/* 映像オーバーレイ類も見えている映像エリア内に収める */
body.history-open #washi-frame,
body.history-open #danmaku-layer,
body.history-open .grad-top,
body.history-open .grad-bottom,
body.history-open #mic-aura { right: var(--drawer-w); }
/* 上部バッジ・終了ボタンもドロワーに被らない位置へ */
body.history-open #top-bar { right: calc(var(--drawer-w) + 16px); }
body.history-open #controls { right: var(--drawer-w); }

/* ============ 機能パネルは左下（メニューの真上）に統一配置＋墨の意匠に ============ */
#ref-panel, #agenda-display, #worry-theme-panel, #call-panel, #timer-panel,
#language-panel, #filter-panel, #poll-panel {
  left: 18px !important; right: auto !important; top: auto !important;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
  width: 320px !important; max-width: calc(100vw - 36px);
  background: var(--sumi-card) !important;
  border: 1px solid rgba(216,192,138,0.24) !important;
  box-shadow: 0 16px 48px rgba(0,0,0,0.55) !important;
  z-index: 48 !important;
}
/* タイマーは旧来の中央寄せ（translateX(-50%)アニメ＋min-width）を解除して左下に揃える */
#timer-panel { min-width: 0 !important; transform: none !important; animation: none !important; }
/* ドロワーを開いた状態でも左端を割らないよう幅を制限（狭い画面の保険） */
body.history-open #menu-sheet,
body.history-open #ref-panel, body.history-open #agenda-display,
body.history-open #worry-theme-panel, body.history-open #call-panel,
body.history-open #timer-panel, body.history-open #language-panel,
body.history-open #filter-panel, body.history-open #poll-panel {
  max-width: calc(100vw - var(--drawer-w) - 36px) !important;
}

/* パネル見出し・ヒントの色を金/墨に */
.ref-panel-title, .call-panel-title, .worry-theme-title, .timer-panel-title,
.agenda-title, #menu-sheet .menu-sheet-title {
  color: var(--kin-soft) !important;
}
.ref-hint, .call-panel-hint, .worry-theme-hint, .timer-panel-hint {
  color: rgba(216,192,138,0.6) !important;
}

/* 送信・開始系ボタンは朱に */
.btn-ref-submit, .btn-call-start, .btn-worry-submit, .btn-timer-start,
.btn-dice-roll, #agenda-save-btn {
  background: linear-gradient(180deg, #c3472e, #a5331f) !important;
  color: #fdf3e8 !important; border: 1px solid rgba(255,205,186,0.3) !important;
}

/* 言語・フィルターの選択チップ */
.lang-option {
  background: rgba(244,237,224,0.06) !important;
  border: 1px solid rgba(240,230,210,0.18) !important;
  color: #f2ead9 !important; font-family: var(--maru);
}
.lang-option:hover { border-color: rgba(195,71,46,0.5) !important; background: rgba(195,71,46,0.12) !important; }
.lang-option.active { border-color: var(--shu-soft) !important; background: rgba(195,71,46,0.22) !important; color: #fff !important; }

/* ダイス・ゲスト・字幕などのセンター/オーバーレイ系も墨＋金に */
#dice-card, .guest-loading-card {
  background: var(--sumi-card) !important;
  border: 1px solid rgba(216,192,138,0.24) !important;
}

/* 配信終了ボタン（墨→朱ホバー） */
.btn-stop {
  background: rgba(26,20,14,0.6) !important; color: #f2ead9 !important;
  border: 1px solid rgba(240,230,210,0.2) !important; font-family: var(--maru);
}
.btn-stop:hover {
  background: rgba(179,58,46,0.26) !important; border-color: rgba(214,120,96,0.45) !important; color: #fff !important;
}
/* 開始ボタン（朱） */
.btn-start {
  background: linear-gradient(180deg, #c3472e, #a5331f) !important; color: #fdf3e8 !important;
  font-family: var(--maru); box-shadow: 0 6px 24px rgba(120,30,18,0.4) !important;
}
.btn-start:hover { box-shadow: 0 8px 30px rgba(120,30,18,0.52) !important; }

/* ============ コミュニティ統計（和紙の上・墨文字） ============ */
#community-stats { font-family: var(--maru) !important; }
/* トップの脚：視聴者はAIである明示＋法務リンク */
#welcome-foot { margin-top: 26px; text-align: center; font-family: var(--maru); }
#welcome-foot .wf-ai { font-size: 12px; color: rgba(42,36,28,0.5); letter-spacing: .3px; }
#welcome-foot .wf-links { margin-top: 8px; font-size: 12px; color: rgba(42,36,28,0.4); display: flex; gap: 8px; justify-content: center; align-items: center; }
#welcome-foot .wf-links a { color: rgba(42,36,28,0.55); text-decoration: none; border-bottom: 1px solid rgba(42,36,28,0.2); padding-bottom: 1px; }
#welcome-foot .wf-links a:hover { color: var(--shu-deep); border-color: var(--shu-deep); }
.cs-live { background: rgba(179,58,46,0.08) !important; border: 1px solid rgba(179,58,46,0.28) !important; }
.cs-live-dot { background: #c3472e !important; box-shadow: 0 0 10px #c3472e !important; }
.cs-live-num { color: var(--shu-deep) !important; }
.cs-live-label { color: rgba(42,36,28,0.6) !important; }
.cs-num { color: #2a241c !important; }
.cs-label { color: rgba(42,36,28,0.45) !important; }
.cs-sep { background: rgba(42,36,28,0.14) !important; }
.cs-tagline { color: rgba(42,36,28,0.55) !important; }

/* パネルの閉じる（✕）ボタン */
.panel-x {
  position: absolute; top: 8px; right: 10px; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%; cursor: pointer; z-index: 3; line-height: 1;
  background: rgba(240,230,210,0.09); color: rgba(240,230,210,0.72); font-size: 13px;
  transition: background .15s, color .15s;
}
.panel-x:hover { background: rgba(195,71,46,0.32); color: #fff; }

/* 相談コーナーのカード群：コメント履歴ドロワーと重ならないよう左へ、意匠も墨＋朱に */
#worry-stage { right: 18px; }
body.history-open #worry-stage { right: calc(var(--drawer-w) + 18px); }
.worry-card {
  background: var(--sumi-card) !important;
  border: 1px solid rgba(216,192,138,0.3) !important;
}
#worry-panel {
  background: var(--sumi-card) !important;
  border: 1px solid rgba(216,192,138,0.24) !important;
}
body.history-open #worry-panel { right: calc(var(--drawer-w) + 18px) !important; }

/* メニュー項目は旧ボタン別カラー（緑/金/橙など）を打ち消して墨で統一 */
#menu-sheet .menu-item {
  background: rgba(244,237,224,0.05) !important;
  border: 1px solid rgba(240,230,210,0.12) !important;
  color: #f2ead9 !important;
  box-shadow: none !important;
}
#menu-sheet .menu-item:hover {
  background: rgba(195,71,46,0.16) !important;
  border-color: rgba(195,71,46,0.42) !important;
  color: #fbe7dd !important;
}
#menu-sheet .menu-item.active,
#menu-sheet .menu-item.loading {
  background: rgba(195,71,46,0.22) !important;
  border-color: rgba(195,71,46,0.5) !important;
  color: #fff !important;
}

/* ============ 旧レイヤー規則の無効化（#ref-wrap は廃止） ============ */
body.panel-open #comment-stage { pointer-events: auto !important; }

/* アジェンダは旧「右上固定」の top を解除（右下カードとして内容に合わせた高さに） */
#agenda-display { top: auto !important; max-height: calc(100vh - 200px); overflow-y: auto; }

/* ============ 流れるコメントを捕まえる（配信者のアクション） ============ */
.danmaku { pointer-events: auto; cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; }
.danmaku:hover { animation-play-state: paused !important; z-index: 3; }
/* ホバー／捕まえた時に「誰のコメントか」を表示 */
.danmaku:hover::before, .danmaku.caught::before {
  content: attr(data-handle); position: absolute; left: 6px; bottom: calc(100% + 6px);
  font-family: var(--maru); font-size: 12px; font-weight: 700; letter-spacing: .3px; line-height: 1;
  color: #fff; background: rgba(26,20,14,0.8); padding: 4px 9px; border-radius: 999px;
  white-space: nowrap; text-shadow: none; pointer-events: none;
}
.danmaku[data-handle=""]::before { display: none; }
.danmaku.caught {
  z-index: 6; transform: scale(1.08); transform-origin: left center;
  background: rgba(26,20,14,0.9); padding: 6px 12px; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35), 0 0 0 2px var(--shu);
  text-shadow: none; transition: transform .15s ease, box-shadow .15s ease;
}
.danmaku.caught.topic { background: rgba(10,10,16,0.94); }
.danmaku.caught.liked { box-shadow: 0 10px 30px rgba(0,0,0,0.35), 0 0 0 2px #e0446a; }
.danmaku.dragging { cursor: grabbing; transform: scale(1.12) rotate(-1.5deg); }
.dm-actions { position: absolute; left: 0; top: calc(100% + 10px); display: flex; gap: 8px; }
.dm-actions button {
  pointer-events: auto; width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 19px; line-height: 1;
  background: #fffaf2; color: var(--sumi); box-shadow: 0 4px 14px rgba(0,0,0,0.3);
  transition: transform .12s ease;
}
.dm-actions button:hover { transform: scale(1.12); }
.dm-actions button[data-act="pin"] { background: linear-gradient(180deg, #c3472e, #a5331f); }
.dm-actions button[data-act="release"] { font-size: 15px; font-family: var(--maru); }
.dm-heart {
  position: absolute; z-index: 7; pointer-events: none; font-size: 26px; color: #ff4d7a;
  text-shadow: 0 0 10px rgba(255,77,122,0.6); animation: dmHeart 1.3s ease-out both;
}
@keyframes dmHeart {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.6); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, 0px), -100px) scale(1.25); }
}

/* ピン留め（＝「あとで答えるね」の約束）。最大3枚を下中央に重ねて置く */
#pinned-stack {
  /* 下中央（テレビの字幕位置）。左右 auto＋幅は中身に合わせて中央寄せ */
  position: absolute; left: 0; right: 0; margin: 0 auto; width: max-content;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  max-width: min(580px, calc(100% - 300px));
}
/* 履歴を開いたら、見えている映像エリアの中央に */
body.history-open #pinned-stack { right: var(--drawer-w); max-width: min(580px, calc(100% - var(--drawer-w) - 300px)); }
/* 狭い画面では左右のボタンと被らないよう少し上に */
@media (max-width: 720px) {
  #pinned-stack { bottom: calc(140px + env(safe-area-inset-bottom, 0px)); max-width: calc(100% - 36px); }
  body.history-open #pinned-stack { max-width: calc(100% - var(--drawer-w) - 36px); }
}
.pin-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 10px;
  background: rgba(255,250,242,0.96); border-radius: 10px; border-left: 4px solid var(--shu);
  box-shadow: 0 10px 30px rgba(0,0,0,0.32);
}
/* 古いピンほど少し控えめに（いちばん新しいのが主役） */
.pin-card:not(:last-child) { opacity: 0.88; transform: scale(0.97); transform-origin: bottom center; }
.pin-card:not(:last-child) .pc-text { font-size: 15px; }
.pin-card.pc-in { animation: pcIn .35s cubic-bezier(.22,1,.36,1) both; }
.pin-card.pc-out { animation: pcOut .6s ease both; }
@keyframes pcIn  { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes pcOut { to { opacity: 0; transform: translateY(-16px) scale(1.04); } }
.pc-answer {
  flex: 0 0 auto; height: 32px; padding: 0 12px; border: none; border-radius: 999px; cursor: pointer;
  font-family: var(--maru); font-weight: 700; font-size: 13px; white-space: nowrap;
  color: #fdf3e8; background: linear-gradient(180deg, #c3472e, #a5331f);
  box-shadow: 0 3px 10px rgba(120,30,18,0.3); transition: transform .1s, filter .15s;
}
.pc-answer:hover { filter: brightness(1.08); transform: scale(1.04); }
/* 答えた時に舞う花びら */
.petal {
  position: absolute; z-index: 40; pointer-events: none; font-size: 20px; color: #ff6b8a;
  animation: petalFly 1.5s ease-out both;
}
@keyframes petalFly {
  0%   { opacity: 0; transform: translate(0, 0) rotate(0deg) scale(.7); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, 0px), var(--dy, -100px)) rotate(200deg) scale(1.1); }
}
.pc-seal {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 6px; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #c3472e, #a5331f);
}
.pc-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pc-name { font-family: var(--maru); font-size: 11.5px; font-weight: 700; color: rgba(42,36,28,0.6); }
.pc-text { font-family: var(--mincho); font-weight: 700; font-size: 19px; line-height: 1.35; color: #241d15; word-break: break-word; }
.pc-close {
  flex: 0 0 auto; width: 28px; height: 28px; border: none; border-radius: 50%; cursor: pointer;
  background: rgba(42,36,28,0.08); color: rgba(42,36,28,0.6);
}
.pc-close:hover { background: rgba(195,71,46,0.2); color: var(--shu-deep); }
.hc-mark { margin-left: 6px; font-size: 11px; }

/* ============ お題クリップ（サイコロの話題を話している間、画面上に置いておく） ============ */
/* サイコロのカード：主役は「この話題で話す」、振り直しは控えめに */
.btn-dice-clip {
  padding: 12px 22px; border-radius: 12px; cursor: pointer; font-size: 15px; font-weight: 700;
  font-family: var(--maru); color: #fdf3e8; border: 1px solid rgba(255,205,186,0.3);
  background: linear-gradient(180deg, #c3472e, #a5331f);
  box-shadow: 0 6px 18px rgba(120,30,18,0.35); transition: transform .1s, filter .15s;
}
.btn-dice-clip:hover:not(:disabled) { filter: brightness(1.07); transform: scale(1.03); }
.btn-dice-clip:disabled { opacity: 0.45; cursor: default; }
.btn-dice-roll {
  background: rgba(244,237,224,0.08) !important; color: #f2ead9 !important;
  border: 1px solid rgba(240,230,210,0.25) !important; font-family: var(--maru);
}
.dice-actions { flex-wrap: wrap; justify-content: center; }

/* 上部中央に常駐する短冊（テレビのお題テロップの位置） */
#topic-clip {
  position: absolute; top: 60px; left: 0; right: 0; margin: 0 auto; width: max-content;
  max-width: min(720px, calc(100% - 120px)); z-index: 31;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 8px;
  background: rgba(255,250,242,0.96); border-radius: 10px; border-top: 3px solid var(--shu);
  box-shadow: 0 10px 30px rgba(0,0,0,0.32);
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
body.history-open #topic-clip:not(.placed) { right: var(--drawer-w); max-width: min(720px, calc(100% - var(--drawer-w) - 60px)); }
#topic-clip.placed { margin: 0; right: auto; }
#topic-clip.dragging { cursor: grabbing; box-shadow: 0 16px 40px rgba(0,0,0,0.4); }
#topic-clip.tc-in { animation: tcIn .45s cubic-bezier(.22,1,.36,1) both; }
@keyframes tcIn { from { opacity: 0; transform: translateY(-14px) scale(.96); } to { opacity: 1; transform: none; } }
.tc-seal {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 7px; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #c3472e, #a5331f); box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}
.tc-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tc-label { font-family: var(--maru); font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--shu-deep); }
.tc-text {
  font-family: var(--mincho); font-weight: 700; font-size: 18px; line-height: 1.35; color: #241d15;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
#topic-clip.rolling .tc-text { opacity: 0.55; }
.tc-time {
  flex: 0 0 auto; font-family: var(--maru); font-size: 12px; font-weight: 700;
  color: rgba(42,36,28,0.55); font-variant-numeric: tabular-nums; padding: 0 2px;
}
.tc-btn {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1;
  background: rgba(42,36,28,0.07); color: rgba(42,36,28,0.7); transition: background .15s, transform .1s;
}
.tc-btn:hover:not(:disabled) { background: rgba(195,71,46,0.18); color: var(--shu-deep); transform: scale(1.06); }
.tc-btn:disabled { opacity: 0.4; cursor: default; }
.tc-done { font-weight: 700; }

/* ============ 「ファンを喜ばせた」手応え ============ */
/* 上部の ♡ カウンター（喜ばせたファンの数） */
.badge-joy {
  background: rgba(214,72,104,0.88) !important; color: #fff !important;
  border: 1px solid rgba(255,190,205,0.5) !important; font-family: var(--maru);
}
.badge-joy .joy-heart { font-size: 13px; margin-right: 1px; }
.badge-joy.joy-pop { animation: joyPop .6s cubic-bezier(.22,1.6,.36,1) both; }
@keyframes joyPop { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* 喜んだファン本人の言葉（流れるコメント）：やわらかい桃色の光 */
.danmaku.joy { color: #ffc2d4; }   /* 桃色の白抜き */
.danmaku.joy::after {   /* 喜んだ人の印：封をした手紙（朱の封） */
  content: ''; display: inline-block; width: 0.95em; height: 0.95em; margin-left: 0.3em; vertical-align: -0.12em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23efe2cc' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='6' width='17' height='12.5' rx='1.5'/%3E%3Cpath d='M4 7l8 6.2L20 7'/%3E%3Ccircle cx='12' cy='13' r='2' fill='%23c3472e' stroke='none'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* 履歴：拾った・答えた・喜んでいる、が一目でわかる */
.hc { position: relative; }
.hc.hc-picked { background: rgba(195,71,46,0.06); }
.hc.hc-answered { background: rgba(195,71,46,0.1); }
.hc.hc-joy { background: rgba(214,72,104,0.1); }
.hc.hc-joy .hc-text { color: #a0203f; font-weight: 700; }
.hc-mark { margin-left: 6px; font-size: 11px; }
.hc.hc-flash { animation: hcFlash .8s ease; }
@keyframes hcFlash { 0% { background: rgba(214,72,104,0.35); } 100% { background: rgba(195,71,46,0.06); } }
/* 履歴の各行：マウスを乗せると ❤️ / 📌 */
.hc-acts {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: none; gap: 4px;
}
.hc:hover .hc-acts { display: flex; }
.hc-acts button {
  width: 28px; height: 28px; border: none; border-radius: 50%; cursor: pointer; font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  background: #fffaf2; box-shadow: 0 2px 8px rgba(0,0,0,0.18); transition: transform .1s;
}
.hc-acts button:hover { transform: scale(1.12); }
@media (hover: none) { .hc-acts { display: flex; opacity: 0.85; } }

/* 配信の終わり：今日笑顔にしたファン */
#joy-recap {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center;
  background: rgba(30,20,12,0.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.jr-card {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto;
  padding: 26px 24px 20px; border-radius: 16px; text-align: center;
  background: #fbf5ea; border-top: 4px solid var(--shu); box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  animation: pcIn .45s cubic-bezier(.22,1,.36,1) both;
}
.jr-title { font-family: var(--mincho); font-weight: 700; font-size: 18px; color: #2a241c; letter-spacing: 1px; }
.jr-num { margin-top: 14px; font-family: var(--mincho); font-weight: 800; font-size: 44px; color: #c2365a; line-height: 1; }
.jr-label { margin-top: 6px; font-family: var(--maru); font-size: 13px; color: rgba(42,36,28,0.6); }
.jr-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.jr-row { padding: 9px 12px; border-radius: 10px; background: rgba(214,72,104,0.07); display: flex; flex-direction: column; gap: 2px; }
.jr-name { font-family: var(--maru); font-weight: 700; font-size: 13px; color: #2a241c; }
.jr-quote { font-family: var(--maru); font-size: 13.5px; color: #a0203f; line-height: 1.45; }
.jr-close {
  margin-top: 18px; padding: 10px 26px; border: none; border-radius: 999px; cursor: pointer;
  font-family: var(--maru); font-weight: 700; font-size: 14px; color: #fdf3e8;
  background: linear-gradient(180deg, #c3472e, #a5331f);
}

/* ============ 見送りの間（またね） ============ */
.jr-farewell .jr-title { line-height: 1.5; }
/* 絆 recall：一緒に過ごした配信の数 */
.jr-bond { font-family: var(--maru); font-size: 11.5px; font-weight: 700; color: var(--shu-deep); }
/* 初めての人への約束 */
.jr-promise {
  margin-top: 14px; font-family: var(--mincho); font-size: 13.5px; color: rgba(42,36,28,0.72);
  line-height: 1.7;
}
/* 開いたループ：村の誰かが残す、続きの約束 */
.jr-openloop {
  margin-top: 16px; padding: 12px 14px; border-radius: 12px; text-align: left;
  background: rgba(195,71,46,0.06); border-left: 3px solid var(--shu);
}
.jr-voice-name { display: block; font-family: var(--maru); font-weight: 700; font-size: 12px; color: var(--shu-deep); margin-bottom: 3px; }
.jr-voice-line { font-family: var(--mincho); font-size: 14.5px; color: #2a241c; line-height: 1.6; }
/* 導線：続ける／また今度（壁ではなく選択） */
.jr-cta { margin-top: 20px; display: flex; flex-direction: column; gap: 9px; }
.jr-keep {
  width: 100%; padding: 13px 20px; border: none; border-radius: 999px; cursor: pointer;
  font-family: var(--maru); font-weight: 700; font-size: 15px; color: #fdf3e8;
  background: linear-gradient(180deg, #c3472e, #a5331f);
  box-shadow: 0 6px 18px rgba(120,30,18,0.28); transition: transform .1s, filter .15s;
}
.jr-keep:hover { filter: brightness(1.07); transform: translateY(-1px); }
.jr-keep.jr-bye { background: linear-gradient(180deg, #8a7f72, #6f655a); box-shadow: none; }
.jr-later {
  width: 100%; padding: 9px 20px; border: none; border-radius: 999px; cursor: pointer; background: none;
  font-family: var(--maru); font-weight: 700; font-size: 13px; color: rgba(42,36,28,0.55);
  text-decoration: underline; text-underline-offset: 2px;
}
.jr-later:hover { color: rgba(42,36,28,0.8); }

/* ============ アンケート ============ */
#poll-panel { position: absolute; padding: 14px 16px; border-radius: 16px; }
#poll-panel .call-input { width: 100%; }
#poll-panel .poll-options-input { margin-top: 8px; font-size: 13px; }

/* 結果カード：左上（顔にかぶらない）。集計中→結果でバーが伸びる */
#poll-card {
  position: relative; flex: 0 0 auto; width: 100%; pointer-events: auto;
  padding: 12px 14px 12px; border-radius: 12px; background: rgba(255,250,242,0.97);
  border-top: 3px solid var(--shu); box-shadow: 0 12px 34px rgba(0,0,0,0.34);
  animation: pcIn .4s cubic-bezier(.22,1,.36,1) both;
}
/* ドラッグで浮いた時は固定幅に戻す（スタックの 100% 幅を引きずらない） */
#poll-card.win-floated { width: 320px; max-width: calc(100% - 36px); }
.poll-head { display: flex; align-items: center; gap: 8px; }
.poll-seal {
  width: 28px; height: 28px; border-radius: 6px; font-size: 14px;
  display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #c3472e, #a5331f);
}
.poll-kind { flex: 1; font-family: var(--maru); font-size: 11.5px; font-weight: 700; letter-spacing: 1px; color: var(--shu-deep); }
.poll-x {
  width: 26px; height: 26px; border: none; border-radius: 50%; cursor: pointer;
  background: rgba(42,36,28,0.08); color: rgba(42,36,28,0.6);
}
.poll-q { margin: 8px 0 10px; font-family: var(--mincho); font-weight: 700; font-size: 17px; line-height: 1.4; color: #241d15; }
.poll-opts { display: flex; flex-direction: column; gap: 6px; }
.poll-opt {
  position: relative; height: 34px; border-radius: 8px; overflow: hidden;
  background: rgba(42,36,28,0.06); display: flex; align-items: center; justify-content: space-between; padding: 0 10px;
}
.poll-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: rgba(195,71,46,0.18); transition: width 1.1s cubic-bezier(.22,1,.36,1);
}
.poll-opt.top .poll-fill { background: linear-gradient(90deg, rgba(195,71,46,0.5), rgba(195,71,46,0.32)); }
.poll-label, .poll-pct { position: relative; z-index: 1; font-family: var(--maru); font-weight: 700; font-size: 14px; color: #2a241c; }
.poll-opt.top .poll-pct { color: var(--shu-deep); font-size: 15px; }
#poll-card.loading .poll-opt {
  background: linear-gradient(90deg, rgba(42,36,28,0.05) 25%, rgba(195,71,46,0.14) 50%, rgba(42,36,28,0.05) 75%);
  background-size: 200% 100%; animation: pollShimmer 1.2s linear infinite;
}
@keyframes pollShimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.poll-foot { margin-top: 9px; font-family: var(--maru); font-size: 11.5px; color: rgba(42,36,28,0.62); line-height: 1.5; }
.poll-est { font-weight: 700; color: rgba(42,36,28,0.75); }
.poll-basis { margin-top: 2px; }
.poll-src { margin-top: 3px; }
.poll-src a { color: var(--shu-deep); text-decoration: underline; }
.poll-status { font-family: var(--maru); font-size: 13px; color: rgba(42,36,28,0.7); }

/* お題の短冊と同時に出ている時は、短冊がアンケートの右側に寄る（重ならない） */
body.poll-open #topic-clip:not(.placed) { left: 356px; right: 18px; margin: 0; width: auto; max-width: none; }
body.poll-open.history-open #topic-clip:not(.placed) { right: calc(var(--drawer-w) + 18px); }

/* フィルター：試している間はパネルを開いたまま。決まったら「これにする」 */
.filter-done {
  flex: 1 1 100%; margin-top: 6px; padding: 10px 14px; border: none; border-radius: 999px; cursor: pointer;
  font-family: var(--maru); font-weight: 700; font-size: 14px; color: #fdf3e8;
  background: linear-gradient(180deg, #c3472e, #a5331f);
}

/* ============ ウェルカム：言語をその言語の文字でずらっと並べる ============ */
#welcome-langs {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px;
  max-width: min(600px, calc(100vw - 32px)); margin-top: 6px;
}
#welcome-langs .wl-globe { font-size: 17px; margin-right: 2px; }
.wl-chip {
  padding: 6px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(42,36,28,0.16); background: rgba(255,252,246,0.75);
  font-family: var(--maru); font-size: 13.5px; line-height: 1.3; color: #2a241c;
  transition: border-color .15s, color .15s, background .15s, transform .1s;
}
.wl-chip:hover { border-color: var(--shu); color: var(--shu-deep); }
.wl-chip:active { transform: scale(0.96); }
.wl-chip.active {
  background: linear-gradient(180deg, #c3472e, #a5331f); color: #fff; border-color: transparent; font-weight: 700;
  box-shadow: 0 3px 10px rgba(120,30,18,0.25);
}

/* ウェルカムのキャッチコピー：どの言語でも中央寄せで折り返す（長い訳文でも端にはみ出さない） */
.welcome-en {
  text-align: center; text-transform: none !important; letter-spacing: 1.5px !important;
  max-width: min(560px, calc(100vw - 32px)); padding: 0 16px; line-height: 1.5;
}
.welcome-sub, .cs-tagline { text-align: center; max-width: min(520px, calc(100vw - 32px)); padding: 0 16px; }

/* 視聴者の村：魅力のある人の金の印（履歴のハンドル横） */
.hc-mark-charm { color: var(--kin); font-size: 10px; margin-left: 4px; }

/* 視聴者が詳しい地域（言語メニューの下） */
.region-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(216,192,138,0.25); font-size: 12px; color: var(--kin-soft); }
.region-row select { font: inherit; font-size: 12px; color: var(--kin-soft); background: rgba(22,19,15,0.6); border: 1px solid rgba(216,192,138,0.4); border-radius: 999px; padding: 4px 10px; max-width: 100%; }

/* お試しの残り時間 */
.badge-trial { background: rgba(26,20,14,0.46); color: var(--kin-soft); border: 1px solid rgba(216,192,138,0.28); white-space: nowrap; }
.badge-trial.trial-low { color: var(--shu, #c8553d); border-color: rgba(200,85,61,0.5); }

/* スマホ幅：上のバーが画面からはみ出さないように。入力中の表示は省き、入りきらないものは2段目へ */
@media (max-width: 560px) {
  #top-bar { flex-wrap: wrap; row-gap: 6px; right: 12px; }
  #top-bar #ai-badge { display: none; }
  #top-bar .badge { padding: 5px 10px; }
}

/* ============ 全画面ボタン（上部バーの右端・墨バッジ） ============ */
.badge-fs {
  cursor: pointer !important; padding: 5px 9px !important; font: inherit;
  -webkit-tap-highlight-color: transparent; transition: background .15s, border-color .15s;
}
.badge-fs:hover, .badge-fs:focus-visible { border-color: rgba(216,192,138,0.55) !important; outline: none; }
.badge-fs:active { transform: scale(0.94); }
.fs-ico { width: 15px; height: 15px; fill: none; stroke: var(--kin-soft); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.badge-fs .fs-ico-exit, .badge-fs.is-fs .fs-ico-enter { display: none; }
.badge-fs.is-fs .fs-ico-exit { display: block; }
/* スマホでは押しやすい大きさに */
@media (pointer: coarse) { .badge-fs { padding: 6px 11px !important; } .fs-ico { width: 17px; height: 17px; } }

/* 全画面にできない環境（iPhone Safari 等）の案内：和紙のカード */
#fs-guide {
  position: fixed; inset: 0; z-index: 320; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(30,20,12,0.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.fsg-card {
  width: min(400px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto;
  padding: 24px 22px 18px; border-radius: 16px;
  background: #fbf5ea; border-top: 4px solid var(--shu); box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  animation: pcIn .45s cubic-bezier(.22,1,.36,1) both;
}
.fsg-title { font-family: var(--mincho); font-weight: 700; font-size: 18px; color: #2a241c; letter-spacing: 1px; text-align: center; }
.fsg-lead { margin-top: 12px; font-family: var(--maru); font-size: 13.5px; line-height: 1.75; color: rgba(42,36,28,0.78); }
.fsg-steps { list-style: none; margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.fsg-steps li {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  background: rgba(195,71,46,0.06); font-family: var(--maru); font-size: 13.5px; color: #2a241c; line-height: 1.5;
}
.fsg-steps b { color: var(--shu-deep); font-weight: 700; }
.fsg-n {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mincho); font-weight: 700; font-size: 13px; color: #fdf3e8; background: var(--shu);
}
.fsg-actions { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.fsg-install, .fsg-close {
  padding: 10px 26px; border-radius: 999px; cursor: pointer; font-family: var(--maru); font-weight: 700; font-size: 14px;
}
.fsg-install { border: none; color: #fdf3e8; background: linear-gradient(180deg, #c3472e, #a5331f); }
.fsg-close { border: 1px solid rgba(42,36,28,0.2); background: transparent; color: rgba(42,36,28,0.7); }

/* ============ スマホのアドレスバー対策：100vh → 100dvh =====
   iPhone Safari では 100vh が「URL バーが隠れた時の高さ」になり、下端が隠れる。
   dvh は今見えている高さに追従する（未対応ブラウザは上の 100vh のまま）。 */
@supports (height: 100dvh) {
  #stream-view { height: 100dvh; }
  #history-panel { height: 100dvh; }
  #agenda-display { max-height: calc(100dvh - 200px); }
  #menu-sheet { max-height: 72dvh; }
  .jr-card { max-height: calc(100dvh - 48px); }
}

/* ホーム画面から開いた時は上端までカメラが広がる（black-translucent）。
   ノッチ／ステータスバーに上部バーとロゴが重ならないよう下げる。 */
#top-bar  { top: calc(14px + env(safe-area-inset-top, 0px)); }
#washi-logo { top: calc(13px + env(safe-area-inset-top, 0px)); }
/* ============ AIであることの常時表示（TASKS #20） ============ */
.badge-aiview {
  background: rgba(244,237,224,0.12);
  color: var(--kin-soft);
  border: 1px solid rgba(216,192,138,0.35);
  font-size: 11px;
  letter-spacing: 0.5px;
  text-decoration: none;
  white-space: nowrap;
}
.badge-aiview:hover { background: rgba(244,237,224,0.2); }

/* ============ 心の安全：谷からの手紙と相談窓口（TASKS #6） ============ */
#kokoro-card {
  position: fixed;
  z-index: 9000;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 32px));
  max-height: min(78vh, 640px);
  overflow-y: auto;
  padding: 22px 22px 16px;
  background: linear-gradient(170deg, #f7f0e3 0%, var(--washi) 60%, var(--washi-2) 100%);
  color: var(--paper-text);
  border: 1px solid rgba(165,51,31,0.28);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.45);
  font-family: var(--maru);
  animation: kk-in 0.6s ease-out;
}
@keyframes kk-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
#kokoro-card .kk-from { margin: 0 0 8px; font-size: 12px; color: #6b5d4c; }
#kokoro-card .kk-from strong { color: var(--shu-deep); font-weight: 700; }
#kokoro-card .kk-letter {
  margin: 0 0 16px;
  font-family: var(--mincho);
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-wrap;
}
#kokoro-card .kk-reach {
  margin: 0 0 8px;
  padding-top: 12px;
  border-top: 1px dashed rgba(36,29,21,0.2);
  font-size: 13px;
  font-weight: 700;
  color: var(--shu-deep);
}
#kokoro-card .kk-lines { list-style: none; margin: 0 0 10px; padding: 0; }
#kokoro-card .kk-lines li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(36,29,21,0.08);
  font-size: 13px;
}
#kokoro-card .kk-tel { color: var(--shu-deep); font-weight: 700; text-decoration: none; font-variant-numeric: tabular-nums; white-space: nowrap; }
#kokoro-card .kk-hours { grid-column: 1 / -1; font-size: 11px; color: #7a6b58; }
#kokoro-card .kk-emerg { margin: 8px 0; font-size: 12px; }
#kokoro-card .kk-emerg a { color: var(--shu-deep); font-weight: 700; }
#kokoro-card .kk-emerg span { color: #7a6b58; font-size: 11px; }
#kokoro-card .kk-more { margin: 6px 0; font-size: 12px; }
#kokoro-card .kk-more a { color: #5b4a36; }
#kokoro-card .kk-note { margin: 12px 0 0; font-size: 11px; color: #7a6b58; line-height: 1.6; }
#kokoro-card .kk-close {
  display: block;
  margin: 14px auto 0;
  padding: 7px 26px;
  background: transparent;
  color: var(--paper-text);
  border: 1px solid rgba(36,29,21,0.3);
  border-radius: 999px;
  font-family: var(--maru);
  font-size: 13px;
  cursor: pointer;
}

/* ============ 年齢の確認（18歳以上のみ・TASKS #6） ============ */
#age-gate {
  margin: 14px auto 0;
  width: min(380px, calc(100vw - 32px));
  padding: 18px 18px 14px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(165,51,31,0.25);
  border-radius: 12px;
  color: var(--paper-text);
  font-family: var(--maru);
  text-align: center;
}
#age-gate .ag-q { margin: 0 0 12px; font-size: 14px; line-height: 1.7; }
#age-gate .ag-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#age-gate button {
  padding: 8px 18px;
  border-radius: 999px;
  font-family: var(--maru);
  font-size: 13px;
  cursor: pointer;
}
#age-gate .ag-yes { background: var(--shu); color: #fff; border: 1px solid var(--shu-deep); }
#age-gate .ag-no { background: transparent; color: var(--paper-text); border: 1px solid rgba(36,29,21,0.3); }
#age-gate .ag-consent { margin: 0 0 4px; font-size: 11.5px; line-height: 1.6; opacity: 0.85; text-align: start; }
#age-gate .ag-links { font-size: 11.5px; margin-bottom: 12px; }
#age-gate .ag-links a { color: var(--shu-deep); }
#age-gate.sorry .ag-consent, #age-gate.sorry .ag-links { display: none; }
#age-gate .ag-sorry { display: none; margin: 12px 0 0; font-size: 13px; color: var(--shu-deep); }
#age-gate.sorry .ag-sorry { display: block; }
#age-gate.sorry .ag-actions { display: none; }
#age-gate { margin-top: 0; }
#age-gate .ag-back { display: none; margin: 12px auto 0; background: transparent; color: var(--paper-text); border: 1px solid rgba(36,29,21,0.3); }
#age-gate.sorry .ag-back { display: inline-block; }

/* ============ 墨の線アイコン（icons.js が絵文字から差し替える） ============ */
.wa-ico {
  display: inline-block; position: relative;
  width: 1.15em; height: 1.15em; vertical-align: -0.2em;
  line-height: 1; flex-shrink: 0;
}
.pc-seal { color: #fdf3e8; }   /* 朱の印の上の画鋲は白抜き */
.wa-ico > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.wa-ico-t {   /* 元の絵文字（見えないが textContent・翻訳キーのために残す） */
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.dice-icon .wa-ico, .call-ring-icon .wa-ico, .guest-loading-phone .wa-ico, .worry-recruiting-icon .wa-ico { width: 1em; height: 1em; }

/* ============ 谷をのぞく（谷の紹介と住人録への入口） ============ */
#valley-peek {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--mincho);
  font-size: 14px;
  letter-spacing: 1px;
  color: rgba(42,36,28,0.7);
  text-decoration: none;
  border-bottom: 1px solid rgba(165,51,31,0.35);
  padding-bottom: 2px;
}
#valley-peek:hover { color: var(--shu-deep); border-color: var(--shu-deep); }
