/* =========================================================
   listen.css — Stance 記事の読み上げプレーヤー（listen.js が組み立てる。2026-11-26）
   コーポレートサイト SMART（galaxia-agency.co.jp/assets/css/smart/single.css の「音声読み上げ」）と同じ見た目。
   色の変数（--accent / --accent-to / --ink / --ink-soft / --line）は blog.css のもの。
   ========================================================= */
.sg-listen { margin: 18px 0 0; }
.sg-listen[hidden], .sg-lp [hidden] { display: none !important; }
.sg-listen__start { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 520px; min-height: 56px;
  padding: 8px 18px 8px 8px; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.sg-listen__start:hover { border-color: var(--accent-to); box-shadow: 0 6px 18px rgba(91,140,255,.16); }
.sg-listen__icon { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; }
.sg-listen__icon svg { width: 18px; height: 18px; }
.sg-listen__txt { min-width: 0; }
.sg-listen__txt b { display: block; font-size: 14px; font-weight: 800; line-height: 1.5; }
.sg-listen__txt small { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); line-height: 1.5; }
.sg-listen__note { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-soft); }

/* 再生の部品（PC の再生ボックスとスマホの再生バーで共通） */
.sg-lp__row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.sg-lp__sp { flex: 1; }
.sg-lp__play { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; cursor: pointer; }
.sg-lp__play svg { width: 20px; height: 20px; }
/* ボタンの中の絵はクリックを受けない（再生中に絵を描き直しても、押したクリックがボタンに届くように） */
.sg-lp button svg, .sg-listen__start svg, .sg-here svg { pointer-events: none; }
.sg-lp__ic { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft);
  display: grid; place-items: center; cursor: pointer; }
.sg-lp__ic:hover { background: rgba(122,107,255,.1); color: var(--ink); }
.sg-lp__ic svg { width: 24px; height: 24px; }
.sg-lp__seek { flex: 1; min-width: 0; width: 100%; height: 28px; margin: 0; accent-color: #7a6bff; cursor: pointer; }
.sg-lp__time { flex: none; font-size: 12px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sg-lp__lbl { display: block; font-size: 11px; font-weight: 800; color: #5b5ce8; letter-spacing: .04em; line-height: 1.5; }
.sg-lp__ch { display: block; font-size: 13px; font-weight: 800; color: var(--ink); line-height: 1.5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sg-lp__rate, .sg-lp__btn { position: relative; flex: none; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 800; padding: 0 10px; cursor: pointer; white-space: nowrap; }
.sg-lp__rate { min-width: 58px; font-size: 13px; font-variant-numeric: tabular-nums; }
.sg-lp__rate::after, .sg-lp__btn::after { content: ""; position: absolute; inset: -5px 0; } /* 押せる範囲を 44px に */
.sg-lp__rate:hover, .sg-lp__btn:hover { border-color: #b9b2ff; }
.sg-lp__rate[aria-expanded="true"], .sg-lp__btn[aria-expanded="true"] { border-color: #7a6bff; color: #5b5ce8; background: #f3f1ff; }
.sg-lp button:focus-visible, .sg-lp input:focus-visible, .sg-here:focus-visible, .sg-listen__start:focus-visible,
.sg-drum__list:focus-visible { outline: 2px solid #5b5ce8; outline-offset: 2px; }

/* PC：右の列の目次の上（860px 以下では出さない＝下の再生バーを使う） */
.sg-lp--card { flex: none; display: flex; flex-direction: column; gap: 4px; padding: 12px 12px 8px; border: 1px solid #e2ddf7;
  border-radius: 18px; background: linear-gradient(150deg, rgba(91,140,255,.07), rgba(155,107,255,.1)); }
.sg-lp--card .sg-lp__top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sg-lp--card .sg-lp__ch { margin-bottom: 2px; }
.sg-lp--card .sg-lp__row { gap: 8px; }
.sg-lp--card .sg-lp__row + .sg-lp__row { gap: 2px; }

/* PC の目次：見出しごとの時刻と、読み上げ中の見出しの印 */
.sg-toc a.has-time { display: flex; align-items: baseline; gap: 8px; }
.sg-toc__time { margin-left: auto; flex: none; font-size: 11px; font-weight: 600; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.sg-toc a.is-playing { background: rgba(122,107,255,.08); border-radius: 0 8px 8px 0; }
.sg-toc a.is-playing .sg-toc__time { color: #5b5ce8; font-weight: 800; }
.sg-toc a.is-playing .sg-toc__time::before { content: "▶ "; font-size: 9px; }
/* 高さが低い PC（ノートPCの 720〜860px など）：再生ボックスを足した分、目次が数行しか見えなくなるため、
   相談の箱を詰める（見出しとボタンは残し、小見出しと説明文を省く）。目次は 140px を下限にし、
   それでも入らない画面では右の列の中をスクロールできるようにする（何も見えなくならないように） */
@media (min-width: 861px) and (max-height: 860px) {
  .sg-side:has(.sg-lp--card) { overflow-y: auto; scrollbar-width: thin; }
  .sg-side:has(.sg-lp--card) .sg-toc { min-height: 140px; }
  .sg-side:has(.sg-lp--card) .sg-sidecta { padding: 14px 16px; }
  .sg-side:has(.sg-lp--card) .sg-sidecta__eye,
  .sg-side:has(.sg-lp--card) .sg-sidecta p:not(.sg-sidecta__ttl) { display: none; }
  .sg-side:has(.sg-lp--card) .sg-sidecta .sg-sidecta__ttl { margin: 0 0 10px; font-size: 14px; word-break: auto-phrase; text-wrap: balance; }
  .sg-side:has(.sg-lp--card) .sg-sidecta .sg-btn { height: 42px; }
}

/* 本文の見出しの「ここから聞く」 */
.sg-here { position: relative; top: -3px; display: inline-flex; align-items: center; gap: 5px; margin-left: 10px; vertical-align: middle;
  border: 1px solid #dcd8f5; border-radius: 999px; background: #fff; color: #5b5ce8; font: inherit; font-size: 12px; font-weight: 800;
  line-height: 1.4; letter-spacing: 0; padding: 4px 10px 4px 8px; cursor: pointer; white-space: nowrap; }
.sg-here::after { content: ""; position: absolute; inset: -9px -4px; }
.sg-here svg { width: 10px; height: 10px; }
.sg-here:hover { border-color: #b9b2ff; background: #f7f5ff; }
.sg-here.is-on { background: #5b5ce8; border-color: #5b5ce8; color: #fff; }

/* 倍速のドラム（押したボタンの上に開く。位置は single.js が決める） */
.sg-drum { position: fixed; z-index: 100000; /* AI相談のボタン（99998）より上 */ width: 132px; background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 40px rgba(20,24,40,.22); padding: 8px; }
.sg-drum__h { font-size: 11px; font-weight: 800; color: var(--ink-soft); text-align: center; letter-spacing: .08em; margin: 2px 0 4px; }
.sg-drum__win { position: relative; }
.sg-drum__list { height: 180px; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; overscroll-behavior: contain;
  border-radius: 8px; -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
  mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); }
.sg-drum__list::-webkit-scrollbar { display: none; }
.sg-drum__pad { height: 72px; }
.sg-drum__opt { height: 36px; display: grid; place-items: center; scroll-snap-align: center; font-size: 17px; font-weight: 700;
  color: var(--ink-soft); font-variant-numeric: tabular-nums; cursor: pointer; transition: color .15s, font-size .15s; }
.sg-drum__opt[aria-selected="true"] { color: var(--ink); font-size: 20px; font-weight: 800; }
.sg-drum__lens { position: absolute; left: 0; right: 0; top: 72px; height: 36px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  border-radius: 8px; background: rgba(122,107,255,.06); pointer-events: none; }

/* スマホ：画面の下に固定する再生バー。メニュー（z-index:100）より下、AI相談より下。
   html の --sg-lp-h（目次を閉じたときのバーの高さ）は single.js が入れる */
.sg-lp--bar { display: none; }
@media (max-width: 860px) {
  .sg-lp--card { display: none; }
  .sg-lp--bar { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 99; background: #fff;
    border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(20,24,40,.08); padding: 6px 12px calc(8px + env(safe-area-inset-bottom)); }
  .sg-lp--bar .sg-lp__in { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 0; }
  .sg-lp--bar .sg-lp__row { gap: 8px; }
  .sg-lp--bar .sg-lp__row:last-child { gap: 4px; flex-wrap: wrap; row-gap: 4px; } /* 文字を大きくしたときなどに画面の外へ出さない */
  .sg-lp--bar .sg-lp__mid { flex: 1; min-width: 0; }
  .sg-lp--bar .sg-lp__seek { flex: none; height: 32px; margin: 0; } /* 縦に並べるので flex:1 だと高さが潰れる */
  .sg-lp__toc { max-height: min(330px, calc(100vh - 250px)); overflow-y: auto; overscroll-behavior: contain; scroll-padding-top: 40px; margin: 0 -12px 4px;
    padding: 0 12px 6px; border-bottom: 1px solid var(--line); }
  .sg-lp__toch { position: sticky; top: 0; z-index: 1; display: flex; align-items: baseline; gap: 8px; padding: 8px 0; background: #fff;
    font-size: 13px; font-weight: 800; }
  .sg-lp__toch span { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); }
  .sg-lp__item { display: flex; align-items: baseline; gap: 8px; width: 100%; min-height: 44px; padding: 9px 4px 9px 12px; border: 0;
    border-left: 2px solid var(--line); background: none; color: var(--ink-soft); font: inherit; font-size: 13px; font-weight: 700;
    line-height: 1.5; text-align: left; cursor: pointer; }
  .sg-lp__item.lv3 { padding-left: 24px; font-weight: 600; }
  .sg-lp__item.is-on { color: #5b5ce8; border-left-color: #5b5ce8; background: rgba(122,107,255,.07); }
  .sg-lp__t { margin-left: auto; flex: none; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
  .sg-lp__item.is-on .sg-lp__t { color: #5b5ce8; }
  /* 本文の最後・キーで移ったフォーカスがバーの裏に隠れないように。AI相談はバーの上へ */
  html.sg-has-lp { scroll-padding-bottom: var(--sg-lp-h, 0px); }
  html.sg-has-lp body { padding-bottom: var(--sg-lp-h, 0px); }
  html.sg-has-lp .gxai-root .gxai-launcher { bottom: calc(var(--sg-lp-h, 0px) + 14px); }
  /* 目次を開いている間は AI相談のボタンを隠す（上へずらすとヘッダーのメニューに重なるため） */
  html.sg-lp-toc-open .gxai-root .gxai-launcher:not(.is-open) { visibility: hidden; }
  .sg-here { margin-left: 8px; }
}
/* 320〜360px：下の段のボタンが2px足りずに折り返していたため、ボタンの左右の余白を詰める（押せる高さはそのまま） */
@media (max-width: 360px) {
  .sg-lp--bar .sg-lp__row:last-child { gap: 3px; }
  .sg-lp--bar .sg-lp__btn { padding: 0 7px; }
  .sg-lp--bar .sg-lp__rate { min-width: 50px; padding: 0 6px; }
}

/* Stance だけ：右の列は sticky なので、再生ボックスを足しても画面に収まるよう高さを抑える */
/* あわせて、右の列の追従位置（top:160px）が Stance のヘッダー（高さ約207px）の下に潜って上端が隠れていたのを、ヘッダーの下へ */
@media (min-width: 861px) {
  .sg-side { top: 226px; }
  .sg-side:has(.sg-lp--card) { max-height: calc(100vh - 246px); overflow-y: auto; scrollbar-width: thin; }
}
/* スマホ：画面の下の「エントリー」バー（.sg-stickybar）は、再生バーと重なるので出さない（本文の最後のエントリー欄は残る） */
@media (max-width: 860px) { html.sg-has-lp .sg-stickybar { display: none; } }
