/* =========================================================
   同時通訳 — エディトリアル / 放送字幕グレード
   設計方針: 文字（内容）が主役。クロームは退く。
   彩度を抑えた言語カラー、グラデーション・絵文字なし、規律ある余白。
   slot-a = langA（既定 日本語） / slot-b = langB（既定 Tiếng Việt）
   ========================================================= */

:root {
  --ease: cubic-bezier(0.4, 0, 0.1, 1);
  --fs-scale: 1;
  --gap: 0.6em;
  --r: 10px;
  --r-sm: 8px;
  --font-ja: "Noto Sans JP", system-ui, sans-serif;
  --font-vi: "Be Vietnam Pro", system-ui, sans-serif;
  --font-ui: "Be Vietnam Pro", ui-sans-serif, system-ui, "Noto Sans JP", sans-serif;
  --rec: #e5484d;
  --ok: #41c98a;
}

/* ---- テーマ ---- */
body[data-theme="dark"] {
  --bg: #0b0b0d; --bg-grad: linear-gradient(180deg, #101013, #0a0a0c 60%);
  --surface: #16161a; --surface-2: #1d1d22;
  --line: rgba(255, 255, 255, 0.08); --line-2: rgba(255, 255, 255, 0.14);
  --text: #f2f1ec; --dim: #b4b3ad; --faint: #8a897f;
  --accent-a: #e2a85c; --accent-b: #56b0a0;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}
body[data-theme="light"] {
  --bg: #f3f2ee; --bg-grad: linear-gradient(180deg, #f6f5f1, #ecebe5 70%);
  --surface: #ffffff; --surface-2: #f1f0ec;
  --line: rgba(20, 18, 12, 0.1); --line-2: rgba(20, 18, 12, 0.18);
  --text: #1a1815; --dim: #5b594f; --faint: #6c6a60;
  --accent-a: #a06a18; --accent-b: #1d7d6e;
  --shadow: 0 24px 70px rgba(60, 55, 40, 0.16);
}
body[data-theme="contrast"] {
  --bg: #000000; --bg-grad: #000000;
  --surface: #0d0d0d; --surface-2: #161616;
  --line: rgba(255, 255, 255, 0.22); --line-2: rgba(255, 255, 255, 0.4);
  --text: #ffffff; --dim: #d6d6d6; --faint: #8f8f8f;
  --accent-a: #ffce6a; --accent-b: #6fe0cd;
  --shadow: none;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg-grad), var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.5s var(--ease), color 0.4s var(--ease);
}

/* =========================================================
   ツールバー
   ========================================================= */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  height: 56px; display: flex; align-items: center; gap: 18px; padding: 0 20px;
  padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(8px);
  transition: opacity 0.5s var(--ease);
}
body[data-running="true"] .bar { opacity: 0.08; }
body[data-running="true"] .bar:hover, body.show-ui .bar,
body[data-running="true"] .bar:focus-within { opacity: 1; }
/* スクリーンリーダー専用（視覚的には非表示だが読み上げ対象）。字幕のライブ読み上げ等に使用。 */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* 聴講画面はバーを常時表示（タッチ端末でも操作できるように） */
body[data-view="viewer"] .bar { opacity: 1; }

.brand { display: flex; align-items: center; gap: 9px; }
.brand-home { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: inherit; border-radius: 8px; }
.brand-home:hover { opacity: 0.85; }
.brand .logo { width: 24px; height: 24px; display: block; flex: none; }
/* ブランド名（ワードマーク） */
.brand-name { font-family: var(--font-ui); font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.005em; }
/* 言語ペア・バッジ（例 JA·VI）— 控えめなピル */
.mark {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; color: var(--dim);
  font-variant-numeric: tabular-nums; line-height: 1;
  padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px;
}
.mark em { color: var(--faint); font-style: normal; margin: 0 1px; }
.viewer-badge { color: var(--accent-b); }

/* 通訳する言語ペア（源 amber ⇄ 訳 teal）。クリックで言語選択を開く現在ペアのチップ。 */
.langpair-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px;
  background: transparent; cursor: pointer; color: var(--text);
  font-family: var(--font-ui); font-size: 12px; font-weight: 600; line-height: 1;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.langpair-chip:hover { border-color: var(--line-2); background: color-mix(in srgb, var(--text) 5%, transparent); }
.langpair-chip .lp-side { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.langpair-chip .lp-name { max-width: 8.5ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.langpair-chip .lp-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.langpair-chip .lp-a .lp-dot { background: var(--accent-a); }
.langpair-chip .lp-b .lp-dot { background: var(--accent-b); }
.langpair-chip .lp-arrow { color: var(--faint); font-style: normal; font-size: 11px; }
@media (max-width: 560px) {
  /* 狭い画面では言語名を隠し、色ドット＋⇄だけで現在ペアを示す（コードは title に残る）。 */
  .langpair-chip .lp-name { display: none; }
  .langpair-chip { padding: 5px 8px; gap: 5px; }
}

.meta { display: flex; align-items: center; gap: 9px; font-size: 12.5px; font-weight: 500; color: var(--dim); }
.state-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); transition: background 0.3s; }
body[data-state="connecting"] .state-dot { background: var(--accent-a); animation: pulse 1s infinite; }
body[data-state="live"] .state-dot { background: var(--ok); }
body[data-state="error"] .state-dot { background: var(--rec); }
@keyframes pulse { 50% { opacity: 0.3; } }

.level { width: 42px; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.level i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--ok), var(--accent-a)); transition: width 0.07s linear; }

.grow { flex: 1; }
.tools { display: flex; align-items: center; gap: 6px; }

/* 開始/停止 */
.start {
  display: inline-flex; align-items: center; gap: 9px; height: 38px; padding: 0 17px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface);
  color: var(--text); font-family: var(--font-ui); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.06s;
}
.start:hover { background: var(--surface-2); border-color: var(--text); }
.start:active { transform: translateY(1px); }
.start .rec { width: 9px; height: 9px; border-radius: 50%; background: var(--rec); transition: all 0.2s var(--ease); }
body[data-running="true"] .start .rec { border-radius: 2px; animation: recpulse 1.4s infinite; }
body[data-running="true"] .start { border-color: color-mix(in srgb, var(--rec) 55%, var(--line-2)); }
@keyframes recpulse { 50% { opacity: 0.45; } }

.ico-btn {
  position: relative;
  width: 38px; height: 38px; display: grid; place-items: center; border: none; border-radius: var(--r-sm);
  background: transparent; color: var(--dim); cursor: pointer; transition: background 0.16s, color 0.16s;
}
.ico-btn:hover { background: var(--surface-2); color: var(--text); }
.ico-btn.active { color: var(--text); }
.ico-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--text) 60%, transparent); outline-offset: 2px; }

.badge {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px;
  display: grid; place-items: center; font-size: 10px; font-weight: 700; line-height: 1;
  color: var(--bg); background: var(--accent-b); border-radius: 8px; font-variant-numeric: tabular-nums;
}

/* =========================================================
   フィード（発話ペアの同期スクロール）
   ========================================================= */
#stage { position: absolute; inset: 56px 0 0 0; }

.feed {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: calc(var(--gap) * 2.4);
  padding: 58px clamp(24px, 7vw, 150px) clamp(20px, 5vh, 64px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 58px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 58px);
}
.feed > .ex:first-child { margin-top: auto; }
.feed::-webkit-scrollbar { width: 8px; }
.feed::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
.feed::-webkit-scrollbar-track { background: transparent; }

/* 1発話 = 原文＋訳のペア */
.ex { position: relative; animation: rise 0.26s var(--ease); }
.ex:not(.live) { opacity: 0.86; }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } }

.side { display: flex; flex-direction: column; gap: 0.28em; min-width: 0; }
.lang {
  font-family: var(--font-ui); font-size: clamp(10px, 0.8vw, 13px); font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.92; display: inline-flex; align-items: center; gap: 0.5em;
}
.side.slot-a .lang { color: var(--accent-a); }
.side.slot-b .lang { color: var(--accent-b); }
/* 直接喋っている側に印 */
.ex[data-src="a"] .side.slot-a .lang::before,
.ex[data-src="b"] .side.slot-b .lang::before {
  content: ""; width: 0.5em; height: 0.5em; border-radius: 50%; background: currentColor;
}

.txt {
  font-family: var(--side-font, var(--font-ui));
  font-weight: 700; line-height: 1.4; letter-spacing: 0.005em;
  word-break: break-word; text-wrap: pretty;
}
.side.slot-a .txt { font-size: calc(clamp(1.5rem, 3vw, 3.7rem) * var(--fs-scale)); }
.side.slot-b .txt { font-size: calc(clamp(1.4rem, 2.8vw, 3.5rem) * var(--fs-scale)); }

/* 通訳側を控えめに */
.feed.emph-on .ex[data-src="a"] .side.slot-b .txt,
.feed.emph-on .ex[data-src="b"] .side.slot-a .txt { color: var(--dim); font-weight: 500; }

.ts { position: absolute; top: -1.4em; right: 0; font-size: 11px; font-weight: 500; color: var(--faint); font-variant-numeric: tabular-nums; display: none; }
.feed.show-time .ts { display: block; }

.rule { background: var(--line); align-self: stretch; }

/* 左右ならべ（split / 既定） */
body[data-layout="split"] .ex { display: grid; grid-template-columns: 1fr 1px 1fr; gap: clamp(20px, 3.5vw, 64px); align-items: start; }
body[data-layout="split"] .ex .side.slot-a { grid-column: 1; }
body[data-layout="split"] .ex .rule { grid-column: 2; width: 1px; }
body[data-layout="split"] .ex .side.slot-b { grid-column: 3; }

/* 上下かさね（stack） */
body[data-layout="stack"] .ex { display: flex; flex-direction: column; gap: var(--gap); }
body[data-layout="stack"] .ex .rule { display: none; }
body[data-layout="stack"] .side.slot-a { padding-left: 0.9em; border-left: 2px solid color-mix(in srgb, var(--accent-a) 55%, transparent); }
body[data-layout="stack"] .side.slot-b { padding-left: 0.9em; border-left: 2px solid color-mix(in srgb, var(--accent-b) 55%, transparent); }

/* 上下ならべ（vsplit）: 左右ならべ の縦版。原文＝上／横の区切り線／訳＝下 */
body[data-layout="vsplit"] .ex { display: grid; grid-template-rows: auto 1px auto; gap: clamp(10px, 1.8vh, 34px); }
body[data-layout="vsplit"] .ex .side.slot-a { grid-row: 1; }
body[data-layout="vsplit"] .ex .rule { grid-row: 2; height: 1px; width: auto; justify-self: stretch; }
body[data-layout="vsplit"] .ex .side.slot-b { grid-row: 3; }

/* 言語ペア・ピッカー */
.lang-pair { display: flex; align-items: center; gap: 10px; }
.lang-pair select {
  flex: 1; min-width: 0; font-family: var(--font-ui); font-size: 14px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; cursor: pointer;
}
.lang-pair select:focus { outline: none; border-color: var(--line-2); }
.lang-swap { flex: none; cursor: pointer; color: var(--dim); font-size: 16px; user-select: none; padding: 4px; }
.lang-swap:hover { color: var(--text); }

/* live のカーソル */
.ex.live[data-src="a"] .side.slot-a .txt::after,
.ex.live[data-src="b"] .side.slot-b .txt::after {
  content: ""; display: inline-block; width: 0.46em; height: 1em; margin-left: 0.06em;
  background: currentColor; border-radius: 2px; vertical-align: -0.12em; animation: blink 1.05s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* =========================================================
   空状態（エディトリアル）
   ========================================================= */
.empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 5vw; overflow: hidden; }
/* アンビエントなブランドグロー（amber/teal）がゆっくり漂う世界トップ級の背景。 */
.empty-glow {
  position: absolute; inset: -10%; pointer-events: none; z-index: 0;
  background:
    radial-gradient(42vw 42vw at 26% 28%, color-mix(in srgb, var(--accent-a) 24%, transparent), transparent 68%),
    radial-gradient(40vw 40vw at 78% 76%, color-mix(in srgb, var(--accent-b) 22%, transparent), transparent 68%);
  filter: blur(10px); opacity: 0.85;
  animation: glowDrift 20s ease-in-out infinite alternate;
}
@keyframes glowDrift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(2%, 2%, 0) scale(1.08); }
}
.empty-inner { max-width: 960px; width: 100%; text-align: center; position: relative; z-index: 1; }
.kicker {
  font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim);
  display: inline-flex; align-items: center; gap: 9px; margin-bottom: 28px;
  padding: 7px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: color-mix(in srgb, var(--card) 60%, transparent); backdrop-filter: blur(6px);
}
.kicker em { color: var(--accent-a); font-style: normal; }
.hero-h1 { margin: 0 0 24px; }
/* 対応言語が縦に回転するショーケース（ヒーローの主役）。 */
/* 通訳＝2言語間。源(amber) ⇄ 訳(teal) の言語ペアを縦回転で見せる。 */
.rotator-pair {
  display: flex; align-items: center; justify-content: center; gap: 0.28em; flex-wrap: nowrap;
  font-family: var(--font-ui); font-weight: 800; letter-spacing: -0.02em;
  font-size: clamp(1.7rem, 5vw, 3.9rem);
}
.rotator-pair .rot-sep { font-style: normal; font-weight: 600; color: var(--faint); font-size: 0.62em; }
.rotator {
  display: block; height: 1.34em; overflow: hidden;
  font-family: inherit; font-weight: inherit; font-size: inherit; line-height: 1.34; letter-spacing: inherit;
  /* 上下端をフェード。回転する語が端で優雅に消え、遷移中も破片が見えず高級感が出る。 */
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 16%, #000 84%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 16%, #000 84%, transparent 100%);
}
.rotator.slot-a { text-align: right; } .rotator.slot-b { text-align: left; }
.rotator-track { display: flex; flex-direction: column; will-change: transform;
  transition: transform 0.62s cubic-bezier(0.66, 0, 0.16, 1); }
.rotator-track > span {
  height: 1.34em; display: flex; align-items: center; justify-content: center; white-space: nowrap;
}
.hero-sub {
  display: block; font-family: var(--font-ja); color: var(--text); font-weight: 800;
  font-size: clamp(1.35rem, 3.4vw, 2.5rem); letter-spacing: -0.02em; line-height: 1.16;
}
.lede { font-size: clamp(15px, 1.4vw, 19px); color: var(--dim); line-height: 1.7; max-width: 50ch; margin: 0 auto 36px; }
.empty-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: center; }
.start.big { height: 56px; padding: 0 32px; font-size: 16px; border-radius: 12px; background: var(--text); color: var(--bg); border: none; }
.start.big:hover { opacity: 0.9; }
.ghost.big { height: 56px; padding: 0 28px; font-size: 15px; border-radius: 12px; flex: none; }
.hint { margin-top: 28px; font-size: 12.5px; color: var(--faint); letter-spacing: 0.02em; }
@media (prefers-reduced-motion: reduce) {
  .empty-glow { animation: none; }
  .rotator-track { transition: opacity 0.5s ease; }
}

/* 最新へ */
.jump {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 20;
  font-family: var(--font-ui); font-size: 13px; font-weight: 600; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 9px 16px; cursor: pointer; box-shadow: var(--shadow); animation: rise 0.25s var(--ease);
}
.jump:hover { border-color: var(--text); }

/* =========================================================
   聴講の状態オーバーレイ
   ========================================================= */
.notice { position: absolute; inset: 0; z-index: 15; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(2px); }
.notice-inner { display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; padding: 0 8vw; }
.notice-inner p { font-family: var(--font-ja); font-size: clamp(16px, 2.4vw, 24px); font-weight: 600; color: var(--dim); }
.notice-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent-b); animation: spin 0.9s linear infinite; }
.notice.no-spin .notice-spin { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   パネル（共有・設定）
   ========================================================= */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,0.5); backdrop-filter: blur(3px); animation: fade 0.25s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.panel {
  position: fixed; inset: 0 0 0 auto; z-index: 41; width: min(390px, 92vw);
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 20px 22px 30px; overflow-y: auto; animation: slide 0.34s var(--ease);
  padding-right: max(22px, env(safe-area-inset-right));
}
@keyframes slide { from { transform: translateX(100%); } }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.panel-head h2 { font-family: var(--font-ja); font-size: 16px; font-weight: 700; }
.panel-lede { font-size: 13px; line-height: 1.6; color: var(--dim); margin: 6px 0 4px; }

.field { padding: 18px 0; border-top: 1px solid var(--line); }
.field h3 { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); margin-bottom: 13px; display: flex; justify-content: space-between; align-items: center; }
.field h3 output { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.field.danger { border-top: none; padding-top: 4px; }

.seg-control { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 3px; }
.seg-control.seg-wrap { flex-wrap: wrap; }
.seg-control.seg-wrap button { flex: 1 1 30%; }
.seg-control button {
  flex: 1; font-family: var(--font-ui); font-size: 13px; font-weight: 600; color: var(--dim);
  background: transparent; border: none; border-radius: 6px; padding: 9px 6px; cursor: pointer; transition: all 0.18s;
}
.seg-control button[aria-pressed="true"] { color: var(--text); background: var(--bg); box-shadow: 0 1px 3px rgba(0,0,0,0.3); }

input[type="range"] { width: 100%; accent-color: var(--text); height: 22px; cursor: pointer; }

.check { display: flex; align-items: center; gap: 11px; padding: 7px 0; font-size: 13.5px; color: var(--text); cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--text); cursor: pointer; flex: none; }

.glossary {
  width: 100%; resize: vertical; min-height: 84px; font-family: var(--font-ui); font-size: 13.5px; line-height: 1.6;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px;
}
.glossary:focus { border-color: var(--line-2); outline: none; }

.btn-row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
/* account のボタン行: リンク(.as-btn)とボタン(.ghost-danger)の高さ・整列を揃える
   （.as-btn の display:block+margin-top、.ghost-danger の width:100% が flex 行で崩れるのを修正）。 */
.btn-row .ghost.as-btn { display: inline-flex; align-items: center; justify-content: center; margin-top: 0; padding: 10px 14px; }
.btn-row .ghost-danger { width: auto; padding: 10px 14px; }
.ghost {
  flex: 1; font-family: var(--font-ui); font-size: 13px; font-weight: 600; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 8px; cursor: pointer; transition: all 0.16s;
  text-align: center; text-decoration: none;
}
.ghost:hover { border-color: var(--text); }
.ghost.as-btn { display: block; margin-top: 8px; }
.ghost-danger {
  width: 100%; font-family: var(--font-ui); font-size: 13px; font-weight: 600; color: var(--rec);
  background: transparent; border: 1px solid color-mix(in srgb, var(--rec) 38%, transparent); border-radius: var(--r-sm); padding: 11px; cursor: pointer; transition: all 0.16s;
}
.ghost-danger:hover { background: color-mix(in srgb, var(--rec) 12%, transparent); }
.muted { color: var(--faint); font-size: 12px; margin-top: 11px; }
.tag-dev { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; color: var(--dim); vertical-align: middle;
  border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 8px; margin-left: 8px; }

/* 共有 */
.qr-wrap { display: grid; place-items: center; padding: 18px 0 6px; }
.qr-wrap img { width: 200px; height: 200px; background: #fff; border-radius: 12px; padding: 10px; box-shadow: var(--shadow); }
.link-row { display: flex; gap: 8px; }
.link-row input {
  flex: 1; min-width: 0; font-family: var(--font-ui); font-size: 12.5px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px;
}
.link-row .ghost { flex: none; }
.viewers-count { text-align: center; color: var(--dim); font-size: 13px; font-weight: 500; margin-top: 18px; }

/* トースト */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 12px 20px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow); animation: rise 0.25s var(--ease);
}

/* =========================================================
   認証・アカウントページ
   ========================================================= */
body[data-authpage], body[data-page="account"] { overflow: auto; }
.auth-shell { min-height: 100%; display: grid; place-items: center; padding: 6vh 20px; }
.auth-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 34px 30px;
}
.auth-brand { display: inline-flex; align-items: baseline; gap: 10px; text-decoration: none; margin-bottom: 22px; }
.auth-brand .mark { font-size: 12px; font-weight: 700; letter-spacing: 0.18em; color: var(--text); }
.auth-brand .brand-name { font-family: var(--font-ja); font-size: 13px; color: var(--dim); }
.auth-card h1 { font-family: var(--font-ja); font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.auth-sub { color: var(--dim); font-size: 14px; line-height: 1.6; margin-bottom: 22px; }
.auth-form { display: flex; flex-direction: column; gap: 15px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--dim); }
.auth-form input {
  font-family: var(--font-ui); font-size: 15px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px;
}
.auth-form input:focus { outline: none; border-color: var(--text); }
.auth-submit {
  margin-top: 6px; height: 48px; font-family: var(--font-ui); font-size: 15px; font-weight: 700;
  color: var(--bg); background: var(--text); border: none; border-radius: var(--r-sm); cursor: pointer; transition: opacity 0.15s;
}
.auth-submit:hover { opacity: 0.9; }
.auth-submit:disabled { opacity: 0.5; cursor: default; }
/* SSO(Google) で続ける */
.sso-box { margin-top: 4px; }
.sso-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: var(--faint); font-size: 12px; }
.sso-divider::before, .sso-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sso-btn {
  width: 100%; height: 48px; display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-ui); font-size: 14.5px; font-weight: 600; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm); cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.sso-btn:hover { background: var(--surface-2); border-color: var(--text); }
.sso-btn svg { flex: none; }

/* 確認ダイアログ */
.confirm-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 62%, transparent); backdrop-filter: blur(3px); padding: 20px; }
.confirm-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 24px 22px 18px; max-width: 360px; width: 100%; }
.confirm-msg { font-family: var(--font-ja); font-size: 15.5px; line-height: 1.6; color: var(--text); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.confirm-actions .ghost { flex: none; padding: 0 16px; height: 40px; }
.confirm-ok { flex: none; height: 40px; padding: 0 18px; font-family: var(--font-ui); font-size: 14px; font-weight: 700;
  color: #fff; background: var(--rec); border: none; border-radius: var(--r-sm); cursor: pointer; }
.confirm-ok:hover { opacity: 0.9; }
.auth-links { margin-top: 16px; font-size: 13px; color: var(--dim); text-align: center; }
.auth-links a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line-2); }
.auth-error {
  background: color-mix(in srgb, var(--rec) 12%, transparent); border: 1px solid color-mix(in srgb, var(--rec) 40%, transparent);
  color: var(--text); border-radius: var(--r-sm); padding: 11px 14px; font-size: 13.5px; margin-bottom: 16px; white-space: pre-line;
}
.auth-ok {
  background: color-mix(in srgb, var(--ok) 14%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent);
  color: var(--text); border-radius: var(--r-sm); padding: 12px 14px; font-size: 14px; margin-bottom: 16px;
}

/* アカウントページ */
.account-wrap { max-width: 860px; margin: 0 auto; padding: 40px 22px 80px; }
.account-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.account-head h1 { font-family: var(--font-ja); font-size: 26px; font-weight: 800; }
.account-sub { color: var(--dim); font-size: 14px; margin-bottom: 30px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; margin-bottom: 20px;
}
.card h2 { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin-bottom: 16px; }
.plan-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.plan-name { font-family: var(--font-ja); font-size: 22px; font-weight: 800; }
.plan-badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 20px; background: var(--surface-2); color: var(--dim); }
.meter { height: 8px; background: var(--surface-2); border-radius: 6px; overflow: hidden; margin: 6px 0 4px; }
.meter > i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), var(--accent-a)); }
.usage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.usage-grid .k { font-size: 12px; color: var(--faint); }
.usage-grid .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.plan-opt { border: 1px solid var(--line-2); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.plan-opt h3 { font-size: 16px; font-weight: 800; }
.plan-opt ul { list-style: none; font-size: 13px; color: var(--dim); display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.key-list { display: flex; flex-direction: column; gap: 8px; }
.key-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 14px; font-size: 13px; }
.key-item code { font-family: ui-monospace, monospace; color: var(--dim); }
.key-reveal { background: color-mix(in srgb, var(--ok) 12%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); border-radius: var(--r-sm); padding: 12px 14px; margin-top: 10px; font-size: 13px; }
.key-reveal code { font-family: ui-monospace, monospace; color: var(--text); word-break: break-all; }
.account-top-link { position: fixed; top: 16px; right: 20px; }

[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; } }

@media (max-width: 560px) {
  .brand-name { display: none; }
  .feed { padding-left: clamp(16px, 5vw, 24px); padding-right: clamp(16px, 5vw, 24px); }
  body[data-layout="split"] .ex { gap: 16px; }
}
