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

.hidden { display: none !important; }

html, body {
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  font-family: 'Hiragino Kaku Gothic ProN', 'ヒラギノ角ゴ ProN W3', 'Meiryo', 'メイリオ', sans-serif;
}

/* ================================================
   ウェルカム画面 — 令和ポップ
   ================================================ */
#welcome {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
  /* 動くグラデーション背景 */
  background: linear-gradient(-45deg, #08000f, #18003a, #060018, #1c0040, #080010);
  background-size: 400% 400%;
  animation: welcomeGrad 12s ease infinite;
}

@keyframes welcomeGrad {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}

/* パーティクル風のグロー装飾 */
#welcome::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 30% 40%, rgba(168,85,247,0.12) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 70% 60%, rgba(236,72,153,0.10) 0%, transparent 70%);
  pointer-events: none;
}

#welcome-icon {
  width: 120px;
  height: 120px;
  object-fit: contain;
  filter: invert(1) drop-shadow(0 0 20px rgba(168,85,247,0.5));
  margin-bottom: 6px;
}

/* グラデーションテキスト */
.welcome-title {
  font-family: 'Kosugi Maru', 'M PLUS Rounded 1c', 'ヒラギノ丸ゴ ProN W4', sans-serif;
  font-size: 52px;
  font-weight: 400;
  letter-spacing: 2px;
  line-height: 1;
  background: linear-gradient(135deg, #c084fc 0%, #f472b6 55%, #fb923c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(192,132,252,0.35));
}

.welcome-en {
  font-size: 12px;
  color: rgba(196,132,252,0.45);
  letter-spacing: 5px;
  text-transform: uppercase;
  margin-top: -6px;
}

.welcome-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.28);
  letter-spacing: 0.5px;
}

/* ================================================
   配信画面
   ================================================ */
#stream-view {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#camera-feed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 上グラデーション — 紫寄りの暗さ */
.grad-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 140px;
  background: linear-gradient(to bottom,
    rgba(12,4,28,0.82) 0%,
    rgba(8,2,18,0.40) 60%,
    transparent 100%);
  pointer-events: none;
  z-index: 5;
}

/* 下グラデーション — 深め */
.grad-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 250px;
  background: linear-gradient(to top,
    rgba(6,2,16,0.94) 0%,
    rgba(10,3,24,0.60) 45%,
    transparent 100%);
  pointer-events: none;
  z-index: 5;
}

/* ================================================
   コメントステージ
   ================================================ */
/* ---- コメントフィード（YouTubeライブチャット式：消えずにスクロールで遡れる）---- */
#comment-stage {
  position: absolute;
  left: 12px;
  right: 22vw;            /* 右側を空ける（配信者の顔・エフェクト用） */
  bottom: calc(132px + env(safe-area-inset-bottom, 0px));  /* ツールバー＋終了ボタンの上 */
  top: auto;
  height: 50vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;            /* ← スクロール可能（履歴を遡れる）*/
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  pointer-events: auto;        /* ← スクロール操作を受け付ける */
  z-index: 30;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.25) transparent;
}
#comment-stage::-webkit-scrollbar { width: 5px; }
#comment-stage::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.22); border-radius: 3px; }
#comment-stage::-webkit-scrollbar-track { background: transparent; }
/* 少数時は最下部に寄せ、あふれたら上端まで遡れる（チャット定番パターン）*/
#comment-stage > .comment:first-child { margin-top: auto; }

/* ---- 個別コメント（吹き出しピル）---- */
.comment {
  position: relative;
  flex: 0 0 auto;          /* 縮まない＝自然な高さを保ち、あふれてスクロール可能に */
  align-self: flex-start;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  font-family: 'Kosugi Maru', 'Hiragino Maru Gothic ProN', 'ヒラギノ丸ゴ ProN', sans-serif;
  font-weight: 700;
  pointer-events: none;
  line-height: 1.3;
  /* 暗い半透明ピルで動画上の可読性を確保 ＋ 色は currentColor（視聴者カラー）*/
  background: rgba(10, 12, 18, 0.42);
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
  padding: 5px 12px;
  border-radius: 15px;
  border-left: 3px solid currentColor;
  text-shadow:
    0 1px 2px rgba(0,0,0,0.9),
    0 0 10px currentColor;
  animation: commentIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: transform, opacity;
}

/* 下から湧き上がるように登場 */
@keyframes commentIn {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* 寿命到達でフェードアウト */
.comment.out {
  animation: commentOut 0.5s ease forwards;
}
@keyframes commentOut {
  to { opacity: 0; transform: translateX(-10px); }
}

/* サイズ（チャット式に最適化） */
.s-sm { font-size: 15px; }
.s-md { font-size: 17px; }
.s-lg { font-size: 20px; }

/* ---- コメントカラー（ネオン管カラー） ---- */
.c-white  { color: #e8d8ff; }  /* 白ネオン（ラベンダー） */
.c-yellow { color: #ffff44; }  /* 黄ネオン              */
.c-cyan   { color: #00eeff; }  /* シアンネオン          */
.c-pink   { color: #ff44dd; }  /* ピンクネオン          */
.c-orange { color: #ff8822; }  /* オレンジネオン        */
.c-lime   { color: #99ff00; }  /* 緑ネオン              */
.c-blue   { color: #5599ff; }  /* 青ネオン              */
.c-peach  { color: #ffaa77; }  /* ピーチネオン          */
.c-purple { color: #cc44ff; }  /* 紫ネオン              */
.c-mint   { color: #00ffcc; }  /* ミントネオン          */
.c-gold   { color: #ffcc00; }  /* ゴールドネオン        */
.c-rose   { color: #ff2255; }  /* 赤ネオン              */
.c-expert { color: #00ffaa; }  /* エメラルドネオン      */

/* ================================================
   トップバー
   ================================================ */
#top-bar {
  position: absolute;
  top: 14px; left: 16px; right: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
  z-index: 20;
}

/* バッジ共通 — ピル型グラスモーフィズム */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  white-space: nowrap;
  letter-spacing: 0.3px;
  cursor: default;
  user-select: none;
}

/* LIVE バッジ — グロー付きパルス */
.badge-live {
  background: rgba(220,30,30,0.85);
  color: #fff;
  letter-spacing: 1.5px;
  border: 1px solid rgba(255,80,80,0.35);
  animation: livePulse 2.2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 8px rgba(220,0,0,0.5); }
  50%       { box-shadow: 0 0 20px rgba(220,0,0,0.8), 0 0 40px rgba(220,0,0,0.2); }
}

/* 通常バッジ — ガラス風 */
.badge-dark {
  background: rgba(0,0,0,0.32);
  color: rgba(255,255,255,0.88);
  border: 1px solid rgba(255,255,255,0.07);
}

/* 配信時間 — さらに控えめ */
.badge-timer {
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.45);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1.5px;
  padding: 4px 10px;
}

/* LIVE ドット（点滅なし。バッジ自体がアニメ） */
.live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  background: #fff;
  border-radius: 50%;
}

/* コメント入力中バッジ */
#ai-badge {
  transition: background 0.35s, color 0.35s, border-color 0.35s;
}
#ai-badge.generating {
  background: rgba(168,85,247,0.18);
  color: #c084fc;
  border-color: rgba(168,85,247,0.32);
}

/* ================================================
   テロップ — グラデーション左バー
   ================================================ */
/* テキスト字幕は非表示（オーラエフェクトに置き換え） */
#telop-container {
  display: none;
}

/* ========================================
   マイクオーラ — 発話中に縁から光が滲む
   ======================================== */
#mic-aura {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#mic-aura.speaking {
  opacity: 1;
  animation: aura-breathe 1.8s ease-in-out infinite;
  box-shadow:
    inset 0 0  60px rgba(110,  60, 255, 0.40),
    inset 0 0 130px rgba( 60, 180, 255, 0.28),
    inset 0 0 220px rgba(220,  60, 255, 0.18),
    inset 0 0 360px rgba( 60, 220, 200, 0.10);
}

#mic-aura.question {
  animation: aura-question 1.4s ease-in-out infinite;
  box-shadow:
    inset 0 0  60px rgba( 34, 211, 238, 0.50),
    inset 0 0 130px rgba(129, 140, 248, 0.35),
    inset 0 0 240px rgba( 34, 211, 238, 0.18);
}

@keyframes aura-breathe {
  0%, 100% {
    box-shadow:
      inset 0 0  45px rgba(110,  60, 255, 0.30),
      inset 0 0 100px rgba( 60, 180, 255, 0.20),
      inset 0 0 180px rgba(220,  60, 255, 0.12);
  }
  50% {
    box-shadow:
      inset 0 0  90px rgba(110,  60, 255, 0.55),
      inset 0 0 180px rgba( 60, 180, 255, 0.40),
      inset 0 0 320px rgba(220,  60, 255, 0.25),
      inset 0 0 480px rgba( 60, 220, 200, 0.12);
  }
}

@keyframes aura-question {
  0%, 100% {
    box-shadow:
      inset 0 0  45px rgba( 34, 211, 238, 0.35),
      inset 0 0 100px rgba(129, 140, 248, 0.22);
  }
  50% {
    box-shadow:
      inset 0 0  90px rgba( 34, 211, 238, 0.65),
      inset 0 0 180px rgba(129, 140, 248, 0.45),
      inset 0 0 320px rgba( 34, 211, 238, 0.20);
  }
}

.telop-box {
  position: relative;
  background: rgba(6, 3, 18, 0.84);
  border-radius: 16px;
  padding: 12px 24px 12px 22px;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  max-width: min(820px, 92vw);
  min-width: 120px;
  border: 1px solid rgba(255,255,255,0.07);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.5),
    0 2px 8px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.05);
  overflow: hidden;           /* ::before を rounded-clip するため */
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.38s ease, transform 0.38s ease;
}

/* グラデーション左バー（通常：紫→ピンク） */
.telop-box::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: linear-gradient(to bottom, #a855f7, #ec4899);
}

/* 話していないとき → 下にスッと消える */
.telop-box.silent {
  opacity: 0;
  transform: translateY(10px);
}

/* 問いかけ検知 → バーをシアン→パープルに変化 */
.telop-box.question-mode::before {
  background: linear-gradient(to bottom, #22d3ee, #818cf8);
}
.telop-box.question-mode {
  box-shadow:
    0 8px 32px rgba(0,0,0,0.5),
    0 0 20px rgba(34,211,238,0.15),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

/* テロップ本文 */
#telop-main {
  color: #f0f0ff;
  font-family: 'Kosugi Maru', 'ヒラギノ丸ゴ ProN W4', 'M PLUS Rounded 1c', sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.6;
  white-space: pre-line;
  letter-spacing: 0.4px;
  text-shadow: 0 1px 8px rgba(0,0,0,0.95);
  min-height: 30px;
}

/* ================================================
   コントロール（右下）
   ================================================ */
#controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 22;
  display: flex;
  justify-content: center;
  gap: 12px;
  pointer-events: none;   /* 子のボタンだけ操作可能に */
}
#controls > .btn { pointer-events: auto; }

/* ================================================
   ボタン
   ================================================ */
.btn {
  padding: 13px 30px;
  border: none;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
  letter-spacing: 0.3px;
}

.btn:hover  { transform: scale(1.06); }
.btn:active { transform: scale(0.95); }

/* 配信開始ボタン — グラデーション */
.btn-start {
  background: linear-gradient(135deg, #a855f7 0%, #ec4899 60%, #f97316 100%);
  color: #fff;
  box-shadow:
    0 4px 20px rgba(168,85,247,0.45),
    0 2px 8px rgba(236,72,153,0.30);
  margin-top: 10px;
  font-size: 15px;
  padding: 14px 36px;
}

.btn-start:hover {
  box-shadow:
    0 6px 28px rgba(168,85,247,0.60),
    0 3px 12px rgba(236,72,153,0.40);
}

/* 配信終了ボタン — ガラス */
.btn-stop {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.70);
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn-stop:hover {
  background: rgba(220,30,30,0.22);
  border-color: rgba(255,80,80,0.35);
  color: #fff;
  box-shadow: 0 0 16px rgba(220,0,0,0.25);
}

/* ================================================
   配信者ノートパネル
   ================================================ */
/* ツールバー：全幅・横スクロールの1行ストリップ（終了ボタンの上） */
#ref-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  z-index: 21;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  padding: 2px 12px;
  scroll-padding: 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;            /* Firefox */
  /* 端のフェードでスクロール可能を示唆 */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
          mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
}
#ref-wrap::-webkit-scrollbar { display: none; }  /* Chrome/Safari */

.btn-ref-toggle {
  flex: 0 0 auto;                   /* 縮まずスクロール */
  padding: 9px 15px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.70);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  letter-spacing: 0.2px;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

.btn-ref-toggle:hover {
  background: rgba(168,85,247,0.15);
  border-color: rgba(168,85,247,0.35);
  color: #c084fc;
}

.btn-ref-toggle:active { transform: scale(0.95); }

.btn-ref-toggle.active {
  background: rgba(168,85,247,0.20);
  border-color: rgba(168,85,247,0.40);
  color: #c084fc;
}

.btn-ref-toggle.has-note {
  border-color: rgba(168,85,247,0.50);
  color: #c084fc;
}

/* パネル本体 — #ref-wrapと独立した絶対配置 */
#ref-panel {
  position: absolute;
  left: 24px;
  bottom: calc(124px + env(safe-area-inset-bottom, 0px));   /* デフォルト: トグルボタン真上 */
  z-index: 25;    /* メディアプレビューより前面 */
  background: rgba(6, 3, 18, 0.92);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 14px 16px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  width: 310px;
  box-shadow: 0 8px 36px rgba(0,0,0,0.60), inset 0 1px 0 rgba(255,255,255,0.05);
  transition: opacity 0.22s ease, transform 0.22s ease;
  opacity: 1;
  transform: translateY(0);
}

#ref-panel.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.ref-panel-title {
  font-size: 11px;
  font-weight: 700;
  color: rgba(196,132,252,0.85);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.ref-hint {
  display: block;
  font-weight: 400;
  font-size: 10px;
  color: rgba(255,255,255,0.32);
  letter-spacing: 0;
  text-transform: none;
  margin-top: 2px;
}

#ref-textarea {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 9px 12px;
  color: rgba(255,255,255,0.88);
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.2s;
}

#ref-textarea:focus {
  border-color: rgba(168,85,247,0.45);
}

#ref-textarea::placeholder {
  color: rgba(255,255,255,0.22);
  font-size: 12px;
}

.ref-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.btn-ref-submit {
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: #fff;
  transition: transform 0.15s ease, opacity 0.15s ease;
  letter-spacing: 0.3px;
}

.btn-ref-submit:hover  { transform: scale(1.05); }
.btn-ref-submit:active { transform: scale(0.95); }
.btn-ref-submit:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-ref-file {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.65);
  transition: transform 0.15s ease, background 0.2s ease;
  white-space: nowrap;
  user-select: none;
}

.btn-ref-file:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  transform: scale(1.04);
}

.ref-drag-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.22);
  text-align: center;
  padding: 6px 0 2px;
  letter-spacing: 0.3px;
}

#ref-panel.drag-over {
  border-color: rgba(168,85,247,0.55);
  background: rgba(168,85,247,0.07);
}

#ref-panel.drag-over::after {
  content: 'ドロップしてアップロード';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: rgba(196,132,252,0.95);
  background: rgba(6,3,18,0.75);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
}

/* 共通閉じるボタン */
.ref-win-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.30);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 5px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.ref-win-close:hover {
  color: #f472b6;
  background: rgba(244,114,182,0.10);
}

/* ================================================
   アジェンダカード
   ================================================ */
#agenda-display {
  position: absolute;
  top: 80px;
  right: 24px;
  z-index: 21;
  width: 300px;
  max-height: calc(100vh - 180px);
  background: rgba(4, 2, 14, 0.91);
  border: 1px solid rgba(34,211,238,0.18);
  border-radius: 16px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow:
    0 12px 40px rgba(0,0,0,0.65),
    0 0 0 1px rgba(34,211,238,0.04),
    inset 0 1px 0 rgba(255,255,255,0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

#agenda-display.hidden {
  opacity: 0;
  transform: translateX(14px);
  pointer-events: none;
}

/* シアン系グラデーション左バー */
#agenda-display::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(to bottom, #22d3ee, #0ea5e9);
  z-index: 1;
}

.agenda-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 11px 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.agenda-title {
  font-size: 11px;
  font-weight: 700;
  color: rgba(34,211,238,0.85);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.agenda-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.agenda-edit-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: rgba(255,255,255,0.40);
  cursor: pointer;
  font-size: 11px;
  padding: 3px 9px;
  line-height: 1.4;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.agenda-edit-btn:hover {
  color: #22d3ee;
  border-color: rgba(34,211,238,0.35);
  background: rgba(34,211,238,0.08);
}

.agenda-edit-btn.editing {
  color: #22d3ee;
  border-color: rgba(34,211,238,0.40);
  background: rgba(34,211,238,0.10);
}

.agenda-body {
  padding: 13px 14px 13px 18px;
  font-size: 13.5px;
  color: rgba(255,255,255,0.86);
  line-height: 1.85;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
}

.agenda-body::-webkit-scrollbar { width: 4px; }
.agenda-body::-webkit-scrollbar-track { background: transparent; }
.agenda-body::-webkit-scrollbar-thumb {
  background: rgba(34,211,238,0.28);
  border-radius: 2px;
}

.agenda-body-empty {
  color: rgba(255,255,255,0.22);
  font-style: italic;
  font-size: 12px;
}

.agenda-edit-area {
  margin: 10px 12px 4px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(34,211,238,0.25);
  border-radius: 10px;
  padding: 10px 12px;
  color: rgba(255,255,255,0.88);
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.75;
  min-height: 130px;
  transition: border-color 0.2s;
}

.agenda-edit-area:focus {
  border-color: rgba(34,211,238,0.50);
}

.agenda-edit-area::placeholder {
  color: rgba(255,255,255,0.20);
  font-size: 12px;
}

.agenda-edit-actions {
  display: flex;
  gap: 8px;
  padding: 8px 12px 12px;
  flex-shrink: 0;
}

.btn-agenda-cancel {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.13);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.50);
  transition: transform 0.15s, background 0.2s;
}

.btn-agenda-cancel:hover {
  background: rgba(255,255,255,0.09);
  color: rgba(255,255,255,0.78);
}

/* ================================================
   ノートリスト（統合表示）
   ================================================ */
/* 左上スタック：アンケート結果とノートを縦に積んで重ならないようにする。
   ウィンドウはヘッダーを掴んでマウス/タッチで移動できる（移動すると position:fixed に浮く）。 */
#left-stack {
  position: absolute;
  top: 60px;
  left: 18px;
  z-index: 31;
  width: 340px;
  max-width: calc(100% - 36px);
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

#note-list {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

/* 掴んで動かせるウィンドウ：ヘッダーがドラッグ用のつまみ */
.win-handle { cursor: grab; touch-action: none; }
.win-handle:active { cursor: grabbing; }
/* ドラッグで左上スタックから外に浮いた状態 */
.win-floated { position: fixed !important; margin: 0 !important; z-index: 60 !important; }
#note-list.win-floated { width: 340px; max-width: calc(100% - 36px); max-height: calc(100vh - 96px); }

#note-list::-webkit-scrollbar { width: 4px; }
#note-list::-webkit-scrollbar-track { background: transparent; }
#note-list::-webkit-scrollbar-thumb {
  background: rgba(168,85,247,0.25);
  border-radius: 2px;
}

.note-card {
  background: rgba(5, 2, 15, 0.91);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
  overflow: hidden;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.04);
  pointer-events: auto;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.note-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px 7px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: grab;
  touch-action: none;
}
.note-card-header:active { cursor: grabbing; }

.note-card-icon { font-size: 11px; flex-shrink: 0; }

.note-card-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  flex: 1;
}

.note-card-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.28);
  cursor: pointer;
  font-size: 10px;
  padding: 2px 5px;
  line-height: 1;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.note-card-close:hover {
  color: #f472b6;
  background: rgba(244,114,182,0.10);
}

/* テキスト */
.note-type-text .note-card-label { color: rgba(196,132,252,0.80); }
.note-type-text { border-left: 3px solid rgba(168,85,247,0.50); }

.note-card-body {
  padding: 10px 13px 10px 14px;
  font-size: 13px;
  color: rgba(255,255,255,0.84);
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 140px;
  overflow-y: auto;
}

.note-card-body::-webkit-scrollbar { width: 3px; }
.note-card-body::-webkit-scrollbar-thumb {
  background: rgba(168,85,247,0.30);
  border-radius: 2px;
}

/* URL/OGP */
.note-type-ogp .note-card-label { color: rgba(34,211,238,0.80); }
.note-type-ogp { border-left: 3px solid rgba(34,211,238,0.50); }

.note-card-ogp-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.note-card-ogp-title {
  padding: 10px 13px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.88);
  line-height: 1.45;
}

/* 画像 */
.note-type-image .note-card-label { color: rgba(147,197,253,0.80); }
.note-type-image { border-left: 3px solid rgba(96,165,250,0.50); }

.note-card-img {
  width: 100%;
  display: block;
  object-fit: contain;
  max-height: 400px;
}

/* PDF */
.note-type-pdf .note-card-label { color: rgba(251,146,60,0.85); }
.note-type-pdf { border-left: 3px solid rgba(251,146,60,0.50); }

.note-card-pdf {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 14px;
  background: rgba(251,146,60,0.06);
}

.note-pdf-icon { font-size: 32px; flex-shrink: 0; }

.note-pdf-name {
  font-size: 13px;
  color: rgba(255,255,255,0.72);
  word-break: break-all;
  line-height: 1.4;
}

/* 共通：説明文 */
.note-card-desc {
  padding: 8px 13px 10px;
  font-size: 11px;
  color: rgba(255,255,255,0.44);
  line-height: 1.55;
  border-top: 1px solid rgba(255,255,255,0.05);
}

/* ================================================
   お悩みジェネレーター
   ================================================ */

/* 悩みボタン アクティブ状態 */
.btn-worry-toggle.active {
  background: rgba(168, 85, 247, 0.22);
  border-color: rgba(168, 85, 247, 0.6);
  color: #c084fc;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
}
.btn-worry-toggle.loading {
  opacity: 0.6;
  cursor: not-allowed;
}

/* お悩みテーマ入力パネル */
#worry-theme-panel {
  position: absolute;
  bottom: calc(124px + env(safe-area-inset-bottom, 0px));
  left: 24px;
  width: 320px;
  background: rgba(10, 4, 20, 0.92);
  border: 1px solid rgba(180, 80, 255, 0.45);
  border-radius: 16px;
  padding: 14px 16px 12px;
  z-index: 26;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 0 24px rgba(140,60,255,0.15), 0 8px 32px rgba(0,0,0,0.6);
  animation: worryPanelIn 0.25s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes worryPanelIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.worry-theme-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}
.worry-theme-title {
  font-size: 13px;
  font-weight: 700;
  color: rgba(200, 130, 255, 0.95);
  display: flex;
  align-items: center;
  gap: 5px;
}
.worry-theme-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
}
.worry-theme-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(180,80,255,0.30);
  border-radius: 10px;
  padding: 9px 12px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 10px;
}
.worry-theme-input:focus { border-color: rgba(180,80,255,0.65); }
.worry-theme-input::placeholder { color: rgba(255,255,255,0.22); }
.worry-theme-actions { display: flex; justify-content: flex-end; }
.btn-worry-submit {
  background: rgba(140,60,255,0.20);
  border: 1px solid rgba(180,80,255,0.55);
  border-radius: 10px;
  color: rgba(210,150,255,0.95);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 18px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.18s, border-color 0.18s;
}
.btn-worry-submit:hover { background: rgba(140,60,255,0.35); border-color: rgba(180,80,255,0.8); }
.btn-worry-submit:disabled { opacity: 0.45; cursor: default; }

/* カードステージ（画面右側・縦中央） */
#worry-stage {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 36;   /* コメント(30)より上 */
  max-width: 330px;
}

/* 個別の悩みカード */
.worry-card {
  background: rgba(8, 3, 22, 0.88);
  border: 1px solid rgba(168, 85, 247, 0.45);
  border-radius: 21px;
  padding: 17px 21px;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: worryCardIn 0.35s ease both;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.12), 0 4px 16px rgba(0,0,0,0.5);
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.15s;
}

.worry-card:hover {
  background: rgba(168, 85, 247, 0.2);
  border-color: rgba(204, 68, 255, 0.8);
  box-shadow: 0 0 22px rgba(168, 85, 247, 0.45), 0 4px 16px rgba(0,0,0,0.5);
  transform: translateX(-3px);
}

.worry-card-submitter {
  font-size: 19px;
  color: rgba(196, 132, 252, 0.72);
  margin-bottom: 8px;
  letter-spacing: 0.4px;
}

.worry-card-title {
  font-size: 20px;
  font-weight: 700;
  color: #f0e8ff;
  line-height: 1.4;
}

@keyframes worryCardIn {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* テーマラベル（カード上部） */
.worry-theme-label {
  font-size: 17px;
  font-weight: 700;
  color: rgba(196, 132, 252, 0.95);
  text-align: right;
  padding: 6px 4px 2px;
  letter-spacing: 0.5px;
  animation: worryCardIn 0.4s ease both;
  text-shadow: 0 0 12px rgba(168, 85, 247, 0.7);
}

/* ============= 応募中アニメーション ============= */
#worry-recruiting {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 37;
}

.worry-recruiting-card {
  background: rgba(8, 3, 22, 0.92);
  border: 1.5px solid rgba(168, 85, 247, 0.7);
  border-radius: 24px;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.35), 0 6px 24px rgba(0,0,0,0.6);
  animation: worryRecruitPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  max-width: 300px;
}

@keyframes worryRecruitPop {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

.worry-recruiting-icon {
  font-size: 42px;
  animation: worryIconBounce 0.9s ease-in-out infinite alternate;
}

@keyframes worryIconBounce {
  from { transform: translateY(0) rotate(-8deg); }
  to   { transform: translateY(-8px) rotate(8deg); }
}

.worry-recruiting-label {
  font-size: 18px;
  font-weight: 700;
  color: #f0e8ff;
  text-align: center;
  line-height: 1.5;
  animation: worryLabelPulse 1.4s ease-in-out infinite;
}

@keyframes worryLabelPulse {
  0%, 100% { color: #f0e8ff; text-shadow: 0 0 8px rgba(168, 85, 247, 0.4); }
  50%       { color: #d8a4ff; text-shadow: 0 0 18px rgba(168, 85, 247, 0.9); }
}

.worry-recruiting-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.worry-recruiting-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(168, 85, 247, 0.8);
  animation: worryDotBounce 1.1s ease-in-out infinite;
}

.worry-recruiting-dots span:nth-child(2) { animation-delay: 0.18s; }
.worry-recruiting-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes worryDotBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%            { transform: scale(1.3); opacity: 1; }
}

/* 詳細パネル */
#worry-panel {
  position: absolute;
  bottom: 76px;
  left: 12px;
  right: 12px;
  background: rgba(6, 2, 18, 0.94);
  border: 1px solid rgba(168, 85, 247, 0.55);
  border-radius: 16px;
  padding: 12px 16px 12px;
  z-index: 36;   /* コメント(30)より上 */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 0 30px rgba(168, 85, 247, 0.18),
    0 12px 40px rgba(0, 0, 0, 0.65);
  animation: worryPanelIn 0.28s ease both;
}

@keyframes worryPanelIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ヘッダー行: バッジ＋タイトル（左）／ボタン群（右） を1行に */
.worry-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

/* バッジ＋タイトルを横並びに */
.worry-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.worry-submitter-badge {
  display: inline-block;
  flex-shrink: 0;
  font-size: 15px;
  color: rgba(196, 132, 252, 0.88);
  background: rgba(168, 85, 247, 0.18);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 999px;
  padding: 3px 12px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.worry-title-text {
  font-size: 19px;
  font-weight: 800;
  color: #f0e8ff;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ボタン群（横並び） */
.worry-panel-actions {
  display: flex;
  flex-direction: row;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

/* 読み終えた（薄め・紫） */
.worry-close-btn {
  padding: 6px 13px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.38);
  border-radius: 999px;
  color: #c084fc;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s;
}
.worry-close-btn:hover {
  background: rgba(168, 85, 247, 0.28);
  border-color: rgba(168, 85, 247, 0.65);
}

/* 回答済み（赤系） */
.worry-resolve-btn {
  padding: 6px 13px;
  background: rgba(255, 60, 100, 0.12);
  border: 1px solid rgba(255, 60, 100, 0.35);
  border-radius: 999px;
  color: #ff7799;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s;
}
.worry-resolve-btn:hover {
  background: rgba(255, 60, 100, 0.25);
  border-color: rgba(255, 60, 100, 0.65);
}

/* 本文（大きめに・行間を詰める） */
.worry-body {
  font-size: 18px;
  color: rgba(240, 232, 255, 0.90);
  line-height: 1.7;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 4px;
}

.worry-body::-webkit-scrollbar       { width: 3px; }
.worry-body::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); border-radius: 3px; }
.worry-body::-webkit-scrollbar-thumb { background: rgba(168,85,247,0.4); border-radius: 3px; }

/* 選択中カード */
.worry-card.selected {
  background: rgba(168, 85, 247, 0.22);
  border-color: rgba(204, 68, 255, 0.8);
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.4);
}

/* ================================================
   対談モード
   ================================================ */

/* トップバー ゲスト接続中バッジ */
.badge-guest {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(20, 8, 0, 0.72);
  border: 1px solid rgba(255, 185, 30, 0.55);
  border-radius: 999px;
  padding: 4px 10px 4px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #ffd060;
  animation: guestBadgePulse 2.5s ease-in-out infinite;
}
@keyframes guestBadgePulse {
  0%, 100% { box-shadow: 0 0 6px rgba(255,185,30,0.3); }
  50%       { box-shadow: 0 0 16px rgba(255,185,30,0.65); }
}

/* 通話終了中 — バッジが暗くなって右にフェードアウト */
.badge-guest.ending {
  animation: badgeEnding 2s ease forwards !important;
  border-color: rgba(180,180,180,0.3);
  color: rgba(255,255,255,0.4);
}
@keyframes badgeEnding {
  0%   { opacity: 1;   transform: translateX(0);   filter: grayscale(0); }
  60%  { opacity: 0.4; transform: translateX(0);   filter: grayscale(0.8); }
  100% { opacity: 0;   transform: translateX(12px); filter: grayscale(1); }
}

/* ゲストステージ — 終了時に全体がふわっと下に沈んで消える */
#guest-stage.outro {
  animation: stageOutro 1.4s cubic-bezier(0.4, 0, 0.6, 1) forwards;
  pointer-events: none;
}
@keyframes stageOutro {
  0%   { opacity: 1;   transform: translateY(0px); }
  100% { opacity: 0;   transform: translateY(20px); }
}
.guest-badge-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ffcc33;
  box-shadow: 0 0 6px #ffcc33;
  animation: dot-blink 1.2s ease-in-out infinite;
}
@keyframes dot-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}
.guest-end-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 0 0 0 4px;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.guest-end-btn:hover { opacity: 1; }

/* 対談トグルボタン */
.btn-call-toggle {
  background: rgba(255, 185, 30, 0.12) !important;
  border-color: rgba(255, 185, 30, 0.4) !important;
  color: #ffd060 !important;
}
.btn-call-toggle.active {
  background: rgba(255, 185, 30, 0.28) !important;
  border-color: rgba(255, 185, 30, 0.8) !important;
}
.btn-call-toggle.loading {
  opacity: 0.6;
  animation: loadingPulse 0.9s ease-in-out infinite;
}

/* タイマーボタン */
.btn-timer-toggle {
  background: rgba(34, 197, 144, 0.12) !important;
  border-color: rgba(34, 197, 144, 0.35) !important;
  color: #6ee7b7 !important;
}
.btn-timer-toggle.active {
  background: rgba(34, 197, 144, 0.25) !important;
  border-color: rgba(34, 197, 144, 0.75) !important;
}

/* 話サイコロボタン */
.btn-dice-toggle {
  background: rgba(251, 146, 60, 0.12) !important;
  border-color: rgba(251, 146, 60, 0.35) !important;
  color: #fdba74 !important;
}
.btn-dice-toggle.active {
  background: rgba(251, 146, 60, 0.25) !important;
  border-color: rgba(251, 146, 60, 0.75) !important;
}

/* 多言語ボタン */
.btn-multilingual-toggle {
  background: rgba(56, 189, 248, 0.10) !important;
  border-color: rgba(56, 189, 248, 0.32) !important;
  color: #7dd3fc !important;
}
.btn-multilingual-toggle.active {
  background: rgba(56, 189, 248, 0.22) !important;
  border-color: rgba(56, 189, 248, 0.72) !important;
  color: #bae6fd !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

/* 英語テロップボタン */
.btn-en-sub-toggle {
  background: rgba(250, 204, 21, 0.08) !important;
  border-color: rgba(250, 204, 21, 0.28) !important;
  color: #fde68a !important;
}
.btn-en-sub-toggle.active {
  background: rgba(250, 204, 21, 0.20) !important;
  border-color: rgba(250, 204, 21, 0.70) !important;
  color: #fef08a !important;
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.22);
}

/* コメント少なめボタン */
.btn-reduced-toggle {
  border-color: rgba(99, 179, 237, 0.3);
  color: rgba(99, 179, 237, 0.7) !important;
}
.btn-reduced-toggle.active {
  background: rgba(99, 179, 237, 0.18) !important;
  border-color: rgba(99, 179, 237, 0.65) !important;
  color: #90cdf4 !important;
}

/* しーボタン */
.btn-shh-toggle {
  border-color: rgba(255, 255, 255, 0.18);
}
.btn-shh-toggle.active {
  background: rgba(220, 50, 50, 0.28);
  border-color: rgba(255, 80, 80, 0.7);
  color: #ff8080;
  box-shadow: 0 0 10px rgba(255, 60, 60, 0.3);
  animation: shhPulse 2.5s ease-in-out infinite;
}
@keyframes shhPulse {
  0%, 100% { box-shadow: 0 0  8px rgba(255,60,60,0.25); }
  50%       { box-shadow: 0 0 18px rgba(255,60,60,0.50); }
}

/* コールパネル */
#call-panel {
  position: absolute;
  left: 24px;
  bottom: calc(124px + env(safe-area-inset-bottom, 0px));
  z-index: 26;
  background: rgba(16, 6, 0, 0.93);
  border: 1px solid rgba(255, 185, 30, 0.35);
  border-radius: 16px;
  padding: 14px 16px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  width: 320px;
  box-shadow: 0 8px 36px rgba(0,0,0,0.60), 0 0 20px rgba(255,185,30,0.08);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
#call-panel.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}
.call-panel-header {
  margin-bottom: 10px;
}
.call-panel-title {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,185,30,0.9);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.call-panel-hint {
  display: block;
  font-size: 10px;
  color: rgba(255,255,255,0.35);
}
.call-input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,185,30,0.25);
  border-radius: 10px;
  padding: 9px 12px;
  color: #fff8e0;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.call-input:focus { border-color: rgba(255,185,30,0.6); }
.call-input::placeholder { color: rgba(255,255,255,0.25); }
.call-actions { display: flex; justify-content: flex-end; }
.btn-call-start {
  padding: 7px 18px;
  background: rgba(255,185,30,0.2);
  border: 1px solid rgba(255,185,30,0.5);
  border-radius: 999px;
  color: #ffd060;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  font-family: inherit;
}
.btn-call-start:hover  { background: rgba(255,185,30,0.35); border-color: rgba(255,185,30,0.8); }
.btn-call-start:disabled { opacity: 0.5; cursor: default; }

/* コール中ステータス表示 */
#call-status {
  padding: 10px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.call-ringing {
  display: flex;
  align-items: center;
  gap: 4px;
}
.call-ring-icon {
  font-size: 26px;
  animation: ringShake 0.5s ease-in-out infinite;
  transform-origin: bottom center;
}
@keyframes ringShake {
  0%, 100% { transform: rotate(-12deg); }
  50%       { transform: rotate( 12deg); }
}
.call-ring-dots {
  font-size: 22px;
  color: rgba(255,185,30,0.9);
  letter-spacing: 2px;
}
.call-ring-dots span {
  animation: dotBlink 1.2s ease-in-out infinite;
}
.call-ring-dots span:nth-child(2) { animation-delay: 0.2s; }
.call-ring-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBlink {
  0%, 80%, 100% { opacity: 0.2; }
  40%            { opacity: 1;   }
}
.call-status-name {
  font-size: 15px;
  font-weight: 700;
  color: #ffc030;
  max-width: 260px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.call-status-label {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  letter-spacing: 1px;
}

/* コール中はパネル枠が脈動 */
#call-panel.calling {
  animation: callRing 1.4s ease-in-out infinite;
}
@keyframes callRing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,185,30,0.0), 0 8px 32px rgba(0,0,0,0.6); }
  50%       { box-shadow: 0 0 0 6px rgba(255,185,30,0.2), 0 8px 32px rgba(0,0,0,0.6); }
}

/* ========================================
   ゲスト招待中ローディングカード
   ======================================== */
#guest-loading {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

@keyframes guestLoadingIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.guest-loading-card {
  background: rgba(14, 6, 0, 0.92);
  border: 1.5px solid rgba(255, 185, 30, 0.6);
  border-radius: 24px;
  padding: 36px 48px 32px;
  text-align: center;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow:
    0 0 0 1px rgba(255,185,30,0.15),
    0 0 40px rgba(255,165,0,0.20),
    0 24px 64px rgba(0,0,0,0.70);
  animation: cardGlow 2s ease-in-out infinite;
  min-width: 260px;
}

@keyframes cardGlow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,185,30,0.15), 0 0 30px rgba(255,165,0,0.15), 0 24px 64px rgba(0,0,0,0.70); }
  50%       { box-shadow: 0 0 0 1px rgba(255,185,30,0.40), 0 0 60px rgba(255,165,0,0.35), 0 24px 64px rgba(0,0,0,0.70); }
}

.guest-loading-phone {
  font-size: 44px;
  margin-bottom: 16px;
  display: block;
  animation: phoneRing 0.5s ease-in-out infinite;
  transform-origin: bottom center;
}
@keyframes phoneRing {
  0%, 100% { transform: rotate(-15deg); }
  50%       { transform: rotate( 15deg); }
}

.guest-loading-name {
  font-size: 22px;
  font-weight: 800;
  color: #ffc030;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.guest-loading-status {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 2px;
  margin-bottom: 20px;
}
.guest-loading-dot {
  animation: dotBlink 1.2s ease-in-out infinite;
  font-size: 16px;
}
.guest-loading-dot:nth-child(2) { animation-delay: 0.2s; }
.guest-loading-dot:nth-child(3) { animation-delay: 0.4s; }
.guest-loading-dot:nth-child(4) { animation-delay: 0.6s; }

.guest-loading-bar {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.guest-loading-progress {
  height: 100%;
  background: linear-gradient(90deg, #ffc030, #ff8c00, #ffc030);
  background-size: 200% 100%;
  border-radius: 2px;
  animation: progressSlide 1.6s ease-in-out infinite;
}
@keyframes progressSlide {
  0%   { width: 0%;   margin-left: 0%; }
  50%  { width: 60%;  margin-left: 20%; }
  100% { width: 0%;   margin-left: 100%; }
}

/* ゲストコメントステージ */
#guest-stage {
  position: absolute;
  left: 16px;
  bottom: 100px;
  width: min(480px, 56vw);
  z-index: 32;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

/* 個別ゲストコメント */
.guest-comment {
  background: rgba(22, 10, 0, 0.90);
  border: 1px solid rgba(255, 185, 30, 0.55);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 0 18px rgba(255,165,0,0.15), 0 4px 16px rgba(0,0,0,0.55);
  animation: guestCommentIn 0.35s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes guestCommentIn {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}
/* 古くなったコメントのフェードアウト（上にふわっと浮いて消える） */
.guest-comment.fading {
  transition: opacity 1.3s ease, transform 1.3s cubic-bezier(0.2, 0, 0.4, 1);
  opacity: 0 !important;
  transform: translateY(-14px) scale(0.96) !important;
}
.guest-comment-name {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: #ffc030;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.guest-comment-text {
  display: block;
  font-size: 17px;
  color: #fff8e0;
  line-height: 1.55;
  white-space: pre-wrap;
}

/* 接続時スパークルエフェクト */
.sparkle-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
}
.sparkle-particle {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #ffd700;
  animation: sparklePop 0.8s ease-out forwards;
}
.sparkle-particle:nth-child(3n)   { background: #ff9900; width: 5px; height: 5px; }
.sparkle-particle:nth-child(3n+1) { background: #ffffff; width: 4px; height: 4px; }
@keyframes sparklePop {
  0%   { transform: scale(0) translate(0,0); opacity: 1; }
  60%  { opacity: 1; }
  100% { transform: scale(1) translate(var(--dx,20px), var(--dy,-40px)); opacity: 0; }
}
/* 接続フラッシュ */
.connect-flash {
  position: fixed;
  inset: 0;
  background: rgba(255,200,30,0.12);
  pointer-events: none;
  z-index: 199;
  animation: connectFlash 0.6s ease-out forwards;
}
@keyframes connectFlash {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* ============================================
   タイマーパネル
   ============================================ */
#timer-panel {
  position: absolute;
  bottom: calc(124px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(6, 18, 12, 0.93);
  border: 1.5px solid rgba(34, 197, 144, 0.45);
  border-radius: 20px;
  padding: 20px 24px;
  z-index: 40;
  min-width: 320px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 0 24px rgba(34, 197, 144, 0.15), 0 8px 32px rgba(0,0,0,0.6);
  animation: timerPanelIn 0.25s ease both;
}

@keyframes timerPanelIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.timer-panel-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
}

.timer-panel-title {
  font-size: 16px;
  font-weight: 700;
  color: #6ee7b7;
}

.timer-panel-hint {
  font-size: 12px;
  color: rgba(110, 231, 183, 0.55);
}

/* プリセットボタン */
.timer-presets {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.btn-timer-preset {
  flex: 1;
  padding: 8px 0;
  border-radius: 10px;
  border: 1px solid rgba(34, 197, 144, 0.35);
  background: rgba(34, 197, 144, 0.1);
  color: #6ee7b7;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-timer-preset:hover {
  background: rgba(34, 197, 144, 0.25);
  border-color: rgba(34, 197, 144, 0.7);
}

/* カスタム入力行 */
.timer-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timer-num-input {
  width: 64px;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid rgba(34, 197, 144, 0.4);
  background: rgba(255,255,255,0.06);
  color: #e0fff4;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}
.timer-num-input::-webkit-inner-spin-button,
.timer-num-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.timer-num-input:focus {
  border-color: rgba(34, 197, 144, 0.8);
  background: rgba(34, 197, 144, 0.08);
}

.timer-colon {
  font-size: 24px;
  font-weight: 700;
  color: rgba(110, 231, 183, 0.6);
}

.btn-timer-start {
  flex: 1;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(34, 197, 144, 0.5);
  background: rgba(34, 197, 144, 0.18);
  color: #6ee7b7;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-timer-start:hover {
  background: rgba(34, 197, 144, 0.32);
  border-color: rgba(34, 197, 144, 0.85);
}

/* カウントダウン表示 */
.timer-display {
  font-size: 56px;
  font-weight: 700;
  color: #6ee7b7;
  text-align: center;
  letter-spacing: 4px;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
  text-shadow: 0 0 20px rgba(34, 197, 144, 0.5);
  margin: 8px 0 16px;
}

.timer-display.timer-urgent {
  color: #f87171;
  text-shadow: 0 0 20px rgba(248, 113, 113, 0.7);
  animation: timerUrgent 0.6s ease-in-out infinite;
}

.timer-display.timer-done {
  color: #fbbf24;
  text-shadow: 0 0 28px rgba(251, 191, 36, 0.9);
  animation: timerDone 0.4s ease-in-out infinite;
}

@keyframes timerUrgent {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.04); }
}

@keyframes timerDone {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(1.06); opacity: 0.85; }
}

.timer-running-actions {
  display: flex;
  justify-content: center;
}

.btn-timer-stop {
  padding: 10px 32px;
  border-radius: 10px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.14);
  color: #fca5a5;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-timer-stop:hover {
  background: rgba(248, 113, 113, 0.28);
  border-color: rgba(248, 113, 113, 0.8);
}

/* ============================================
   話サイコロ オーバーレイ
   ============================================ */
#dice-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: diceOverlayIn 0.2s ease both;
}

@keyframes diceOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.dice-card {
  background: rgba(8, 6, 24, 0.95);
  border: 2px solid rgba(251, 146, 60, 0.5);
  border-radius: 28px;
  padding: 40px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 0 40px rgba(251, 146, 60, 0.25), 0 16px 48px rgba(0,0,0,0.7);
  animation: diceCardIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes diceCardIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

.dice-card.dice-rolling {
  animation: diceShake 0.55s ease-in-out infinite;
}

@keyframes diceShake {
  0%   { transform: rotate(0deg)   scale(1); }
  20%  { transform: rotate(-7deg)  scale(1.05); }
  40%  { transform: rotate(7deg)   scale(1.05); }
  60%  { transform: rotate(-4deg)  scale(1.02); }
  80%  { transform: rotate(4deg)   scale(1.02); }
  100% { transform: rotate(0deg)   scale(1); }
}

.dice-icon {
  font-size: 52px;
  line-height: 1;
  transition: transform 0.15s;
}

.dice-topic {
  font-size: 26px;
  font-weight: 700;
  color: #fff7ed;
  text-align: center;
  line-height: 1.5;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 0 16px rgba(251, 146, 60, 0.4);
}

.dice-topic.dice-loading {
  color: rgba(251, 146, 60, 0.5);
  animation: diceLoadingPulse 0.9s ease-in-out infinite;
}

@keyframes diceLoadingPulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.9; }
}

.dice-topic.dice-reveal {
  animation: diceReveal 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes diceReveal {
  from { opacity: 0; transform: scale(0.7) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.dice-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.btn-dice-roll {
  padding: 12px 28px;
  border-radius: 12px;
  border: 1.5px solid rgba(251, 146, 60, 0.55);
  background: rgba(251, 146, 60, 0.18);
  color: #fdba74;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn-dice-roll:hover:not(:disabled) {
  background: rgba(251, 146, 60, 0.32);
  border-color: rgba(251, 146, 60, 0.85);
  transform: scale(1.03);
}
.btn-dice-roll:disabled { opacity: 0.45; cursor: default; }

.btn-dice-close {
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.5);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-dice-close:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.8);
}

/* ============================================
   英語テロップ
   ============================================ */
#en-subtitle {
  position: absolute;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 80%;
  z-index: 45;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

#en-subtitle.en-sub-fade {
  opacity: 0;
}

#en-subtitle-text {
  display: inline-block;
  background: rgba(0, 0, 0, 0.72);
  color: #fffde7;
  font-size: 22px;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 8px;
  line-height: 1.5;
  text-align: center;
  letter-spacing: 0.3px;
  border-bottom: 3px solid rgba(250, 204, 21, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: enSubIn 0.25s ease both;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

@keyframes enSubIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   音声コマンド トースト
   ============================================ */
#voice-cmd-toast {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(10, 22, 14, 0.92);
  border: 1.5px solid rgba(52, 211, 153, 0.6);
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 700;
  color: #6ee7b7;
  white-space: nowrap;
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0 18px rgba(52, 211, 153, 0.25), 0 4px 16px rgba(0,0,0,0.5);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#voice-cmd-toast.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#voice-cmd-toast.toast-hide {
  opacity: 0;
  transform: translateX(-50%) translateY(-6px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

/* ====== Comment language panel (mobile/global) ====== */
#language-panel, #filter-panel {
  position: absolute;
  left: 24px;
  bottom: calc(124px + env(safe-area-inset-bottom, 0px));
  z-index: 26;
  background: rgba(16, 6, 0, 0.93);
  border: 1px solid rgba(255, 185, 30, 0.35);
  border-radius: 16px;
  padding: 14px 16px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  width: 300px;
  max-height: 60vh;
  overflow-y: auto;
  box-shadow: 0 8px 36px rgba(0,0,0,0.60), 0 0 20px rgba(255,185,30,0.08);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
#language-panel.hidden, #filter-panel.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}
#language-options, #filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.lang-option {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: 0.15s;
}
.lang-option:hover { border-color: rgba(255,185,30,0.6); background: rgba(255,185,30,0.10); }
.lang-option.active {
  border-color: #ffb91e;
  background: rgba(255,185,30,0.22);
  font-weight: 700;
}

/* ====== Community stats on the welcome screen (social proof / belonging) ====== */
#community-stats {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  opacity: 1;
  transition: opacity 0.5s ease;
  font-family: 'Kosugi Maru', sans-serif;
  max-width: 340px;
  text-align: center;
}
#community-stats.hidden { opacity: 0; pointer-events: none; }

.cs-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(156, 255, 87, 0.08);
  border: 1px solid rgba(156, 255, 87, 0.28);
}
.cs-live-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #9cff57;
  box-shadow: 0 0 10px #9cff57;
  animation: csPulse 1.8s ease-in-out infinite;
}
@keyframes csPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}
.cs-live-num { font-weight: 700; color: #b6ff7e; font-size: 15px; }
.cs-live-label { color: rgba(255,255,255,0.6); font-size: 13px; }

.cs-row {
  display: flex;
  align-items: stretch;
  gap: 18px;
}
.cs-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cs-num { font-weight: 700; font-size: 18px; color: #e8ebf2; letter-spacing: 0.3px; }
.cs-label { font-size: 11px; color: rgba(255,255,255,0.45); line-height: 1.3; max-width: 130px; }
.cs-sep { width: 1px; background: rgba(255,255,255,0.12); }

.cs-tagline {
  font-size: 12.5px;
  color: rgba(255,255,255,0.5);
  line-height: 1.5;
  margin-top: 2px;
}

/* ====== Layering fix: panels above comments, toolbar above comments ======
   コメントフィードを pointer-events:auto（スクロール可）にしたため、
   重なり順を明示して「パネル > ツールバー/終了 > コメント(30)」に固定する。 */
#ref-panel, #call-panel, #worry-theme-panel, #timer-panel,
#agenda-display, #language-panel, #filter-panel {
  z-index: 48 !important;
}
#ref-wrap, #controls { z-index: 38 !important; }
/* パネルを開いている間はコメントのタッチ奪取を無効化（確実に操作できるように）*/
body.panel-open #comment-stage { pointer-events: none; }
