/* ============================================================
   Oracle Hall — NEON ORACLE テーマ (2026-07-09 全面刷新)
   漆黒 × ネオンマゼンタ × サイバーシアン。スマホ優先。
   クラス名・レイアウト構造は旧テーマから完全互換。
   ============================================================ */
:root {
  /* --- 新パレット --- */
  --bg-0: #030309;
  --bg-1: #0a0a1c;
  --bg-2: #10102a;
  --bg-3: #1b1b3f;
  --line: #262654;
  --neon-magenta: #e14eff;
  --neon-magenta-soft: #f0a2ff;
  --neon-cyan: #2ee6ff;
  --neon-cyan-soft: #9ff4ff;
  --neon-violet: #8b5cf6;
  --glow-m: rgba(225, 78, 255, 0.45);
  --glow-c: rgba(46, 230, 255, 0.4);
  --glass: rgba(16, 16, 42, 0.72);

  /* --- 旧変数名との互換マッピング (JS/HTML からの参照を維持) --- */
  --night-0: var(--bg-0);
  --night-1: var(--bg-1);
  --night-2: var(--bg-2);
  --night-3: var(--line);
  --gold: var(--neon-magenta);
  --gold-soft: var(--neon-magenta-soft);
  --ink: #eef0ff;
  --ink-dim: #9aa0c8;
  --accent: var(--neon-cyan);
  --accent-2: #4b4b8f;
  --blue: var(--neon-cyan);
  --purple: #c9a2ff;
  --danger: #ff5c7a;
  --ok: #45f0b0;
  --parchment: #0d1226;
  --parchment-ink: var(--neon-cyan-soft);
  --parchment-line: rgba(46, 230, 255, 0.35);
  --radius: 14px;
  --font: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  --serif: "Orbitron", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(139, 92, 246, 0.22) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 110%, rgba(46, 230, 255, 0.10) 0%, transparent 60%),
    var(--bg-0);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.7;
}
/* サイバーグリッド床 (画面下部にうっすら) */
body::before {
  content: "";
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 42vh;
  pointer-events: none;
  z-index: -1;
  background:
    linear-gradient(rgba(46, 230, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 230, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 85%);
  mask-image: linear-gradient(to bottom, transparent, #000 85%);
  transform: perspective(420px) rotateX(38deg);
  transform-origin: bottom;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 1rem; }

.hidden { display: none !important; }
.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;
}

.hall-frame {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 48px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- ヘッダー ---------- */
.hall-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px;
}
.hall-header .brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.1rem;
  letter-spacing: 0.14em;
  font-weight: 600;
  background: linear-gradient(100deg, var(--neon-cyan-soft), var(--neon-magenta-soft));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hall-header .brand .eyebrow {
  margin: 0;
  font-family: var(--serif);
  font-size: 0.62rem;
  letter-spacing: 0.42em;
  color: var(--neon-cyan);
  text-transform: uppercase;
  text-shadow: 0 0 10px var(--glow-c);
}
.hall-nav { display: flex; gap: 6px; }
.hall-nav button {
  background: rgba(46, 230, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  transition: color .2s, border-color .2s, box-shadow .2s;
}
.hall-nav button.active,
.hall-nav button:hover {
  color: var(--neon-cyan-soft);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(46, 230, 255, 0.25), inset 0 0 8px rgba(46, 230, 255, 0.08);
}

/* ---------- 共通パネル ---------- */
.panel {
  background: linear-gradient(165deg, rgba(27, 27, 63, 0.55), rgba(10, 10, 28, 0.85));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.panel h2 {
  margin-top: 0;
  font-family: var(--serif);
  color: var(--neon-magenta-soft);
  letter-spacing: 0.1em;
  font-weight: 600;
  text-shadow: 0 0 16px var(--glow-m);
}
.lead { color: var(--ink-dim); font-size: 0.95rem; }
.field-note { font-size: 0.8rem; color: var(--ink-dim); }
.field-note.warn { color: var(--danger); }
.field-note.ok { color: var(--ok); }

.primary-button {
  background: linear-gradient(135deg, var(--neon-magenta), var(--neon-violet));
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: transform .15s, box-shadow .15s, filter .15s;
  box-shadow: 0 0 22px var(--glow-m), 0 6px 18px rgba(0, 0, 0, 0.4);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.primary-button:hover { transform: translateY(-1px); filter: brightness(1.1); }
.primary-button:active { transform: translateY(1px); box-shadow: 0 0 12px var(--glow-m); }
.primary-button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.ghost-button {
  background: rgba(46, 230, 255, 0.04);
  border: 1px solid rgba(46, 230, 255, 0.35);
  color: var(--neon-cyan-soft);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 0.9rem;
  transition: border-color .2s, color .2s, box-shadow .2s;
}
.ghost-button:hover {
  border-color: var(--neon-cyan);
  color: #fff;
  box-shadow: 0 0 14px rgba(46, 230, 255, 0.3);
}
.ghost-button.danger { border-color: rgba(255, 92, 122, 0.5); color: var(--danger); background: rgba(255, 92, 122, 0.05); }
.ghost-button.danger:hover { box-shadow: 0 0 14px rgba(255, 92, 122, 0.3); }
.ghost-button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.chip {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}
.chip-blue { background: rgba(46, 230, 255, 0.12); color: var(--neon-cyan-soft); border: 1px solid rgba(46, 230, 255, 0.45); }
.chip-purple { background: rgba(201, 162, 255, 0.12); color: var(--purple); border: 1px solid rgba(201, 162, 255, 0.45); }
.chip-gold { background: rgba(225, 78, 255, 0.12); color: var(--neon-magenta-soft); border: 1px solid rgba(225, 78, 255, 0.45); }

/* ---------- オープニング (SC-01/02) ---------- */
.opening-stage {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 78vh;
  overflow: hidden;
}
.stars {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(159, 244, 255, 0.8) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 32% 12%, rgba(240, 162, 255, 0.7) 50%, transparent 51%),
    radial-gradient(1px 1px at 58% 30%, rgba(159, 244, 255, 0.7) 50%, transparent 51%),
    radial-gradient(2px 2px at 74% 16%, rgba(225, 78, 255, 0.75) 50%, transparent 51%),
    radial-gradient(1px 1px at 86% 40%, rgba(255, 255, 255, 0.5) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 44% 44%, rgba(46, 230, 255, 0.6) 50%, transparent 51%),
    radial-gradient(1px 1px at 20% 55%, rgba(255, 255, 255, 0.4) 50%, transparent 51%);
  animation: twinkle 5s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.55; } to { opacity: 1; } }

.hall-house { width: min(340px, 72vw); height: auto; margin-bottom: 10px; filter: drop-shadow(0 0 26px rgba(139, 92, 246, 0.35)); }
.hall-house .lantern-glow { animation: lantern 3.2s ease-in-out infinite alternate; }
@keyframes lantern { from { opacity: 0.55; } to { opacity: 0.95; } }

.opening-title {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 4.5vw, 2.2rem);
  letter-spacing: 0.2em;
  margin: 8px 0 4px;
  font-weight: 600;
  background: linear-gradient(100deg, var(--neon-cyan-soft) 10%, var(--neon-magenta-soft) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 18px var(--glow-m)) drop-shadow(0 0 34px rgba(46, 230, 255, 0.2));
}
.opening-sub { color: var(--ink-dim); margin: 0 0 26px; font-size: 0.95rem; }
.opening-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.opening-toggles { margin-top: 26px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.opening-note { margin-top: 18px; font-size: 0.75rem; color: var(--ink-dim); max-width: 520px; }

@media (prefers-reduced-motion: reduce) {
  .stars, .hall-house .lantern-glow { animation: none; }
}
body.reduced-motion .stars,
body.reduced-motion .hall-house .lantern-glow,
body.reduced-motion .avatar-figure { animation: none !important; }

/* ---------- 個人カード (SC-04/05) — ホログラム・ゲストパス ---------- */
.card-sheet {
  background:
    linear-gradient(135deg, rgba(46, 230, 255, 0.07) 0%, transparent 35%),
    linear-gradient(315deg, rgba(225, 78, 255, 0.07) 0%, transparent 35%),
    var(--parchment);
  color: var(--ink);
  border-radius: 12px;
  padding: 26px 24px;
  box-shadow: 0 0 0 1px var(--parchment-line), 0 0 34px rgba(46, 230, 255, 0.10), 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--parchment-line);
  position: relative;
  overflow: hidden;
}
.card-sheet::before {
  content: "◈ ORACLE HALL — GUEST PASS ◈";
  display: block;
  text-align: center;
  font-family: var(--serif);
  letter-spacing: 0.32em;
  font-size: 0.66rem;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--glow-c);
  margin-bottom: 14px;
}
.card-sheet::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), var(--neon-magenta), transparent);
  opacity: 0.8;
}
.card-sheet h2 {
  color: var(--neon-magenta-soft); text-align: center; margin: 0 0 16px; font-size: 1.15rem;
  font-family: var(--serif); letter-spacing: 0.1em; text-shadow: 0 0 14px var(--glow-m);
}
.card-sheet label { display: block; margin-bottom: 12px; }
.card-sheet label > span {
  display: block; font-size: 0.76rem; color: var(--neon-cyan); letter-spacing: 0.1em; margin-bottom: 3px;
}
.card-sheet input, .card-sheet select {
  width: 100%;
  background: rgba(3, 3, 9, 0.5);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  font-size: 1rem;
  transition: border-color .2s, box-shadow .2s;
}
.card-sheet input::placeholder { color: #565d8a; }
.card-sheet input:focus, .card-sheet select:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(46, 230, 255, 0.25);
}
.card-sheet .grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.card-sheet .grid.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.card-sheet .card-note { font-size: 0.75rem; color: var(--ink-dim); }
.card-sheet .card-note.warn { color: var(--danger); }
.card-sheet .stroke-box {
  border: 1px dashed rgba(46, 230, 255, 0.3);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 8px 0 14px;
  background: rgba(46, 230, 255, 0.03);
}
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; justify-content: center; }
.card-sheet .ghost-button { border-color: rgba(46, 230, 255, 0.4); color: var(--neon-cyan-soft); }
.card-sheet .ghost-button:hover { border-color: var(--neon-cyan); }

.card-view dl { display: grid; grid-template-columns: 9em 1fr; gap: 6px 12px; margin: 0; }
.card-view dt { color: var(--neon-cyan); font-size: 0.8rem; letter-spacing: 0.06em; }
.card-view dd { margin: 0; }

.privacy-box {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.8rem;
  color: var(--ink-dim);
  background: rgba(10, 10, 28, 0.5);
}
.privacy-box strong { color: var(--ink); }
.privacy-box ul { margin: 6px 0 0; padding-left: 1.2em; }

/* ---------- モーダル ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(2, 2, 10, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 16px;
}
.modal {
  background: linear-gradient(170deg, var(--bg-2), var(--bg-1));
  border: 1px solid rgba(225, 78, 255, 0.4);
  border-radius: var(--radius);
  max-width: 560px; width: 100%;
  max-height: 86vh; overflow-y: auto;
  padding: 22px 24px;
  box-shadow: 0 0 40px rgba(225, 78, 255, 0.18), 0 20px 60px rgba(0, 0, 0, 0.7);
}
.modal h3 { margin-top: 0; color: var(--neon-magenta-soft); font-family: var(--serif); letter-spacing: 0.08em; text-shadow: 0 0 12px var(--glow-m); }
.modal .modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; justify-content: flex-end; }

/* ---------- 相談室 (SC-07) ---------- */
.consult-layout { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 760px) { .consult-layout { grid-template-columns: 1fr; } }

.avatar-panel {
  text-align: center;
  position: sticky;
  top: 10px;
}
.avatar-stage {
  position: relative;
  background: radial-gradient(ellipse at 50% 80%, rgba(139, 92, 246, 0.28) 0%, var(--bg-1) 75%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 10px 10px;
  overflow: hidden;
}
.avatar-figure { width: min(200px, 60vw); height: auto; }
/* 写真アバター(reader プロバイダ)の canvas。reader.jpg(941x1133)を縮小表示。 */
.reader-canvas {
  display: block;
  margin: 0 auto;
  width: min(100%, 400px);
  /* どのスキンでもルナ(reader.jpg 941x1133)と同じ表示枠にそろえる。
     縦長の base.png(941x1672) は cover で上寄せクロップして顔を見せる。 */
  aspect-ratio: 941 / 1133;
  height: auto;
  object-fit: cover;
  object-position: 50% 14%;
  border-radius: calc(var(--radius) - 6px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5);
}
.avatar-stage.av-speaking .reader-canvas { box-shadow: 0 0 26px var(--glow-m); }
.avatar-name {
  margin: 8px 0 2px; font-family: var(--serif); letter-spacing: 0.12em;
  color: var(--neon-cyan-soft); text-shadow: 0 0 12px var(--glow-c);
}
.avatar-state { font-size: 0.75rem; color: var(--ink-dim); min-height: 1.2em; }

/* アバター状態アニメーション */
.avatar-stage .crystal { transform-origin: 50% 85%; }
.avatar-stage.av-idle .avatar-figure { animation: breathe 4s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.avatar-stage.av-listening { box-shadow: inset 0 0 40px rgba(46, 230, 255, 0.3); }
.avatar-stage.av-thinking .crystal-glow { animation: crystalPulse 1.4s ease-in-out infinite; }
@keyframes crystalPulse { 0%,100% { opacity: .35; } 50% { opacity: .95; } }
.avatar-stage.av-speaking .mouth { animation: mouthTalk 0.42s ease-in-out infinite; transform-origin: center; }
@keyframes mouthTalk { 0%,100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }
.avatar-stage.av-error { box-shadow: inset 0 0 40px rgba(255, 92, 122, 0.25); }
.avatar-stage.av-ended { filter: grayscale(.6) brightness(.8); }

.subtitle-box {
  min-height: 3.2em;
  margin-top: 10px;
  background: rgba(3, 3, 9, 0.6);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.92rem;
  color: #fff;
  text-align: left;
}
.subtitle-box.empty { color: var(--ink-dim); font-style: italic; }

.speak-controls { display: flex; gap: 6px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.speak-controls button {
  background: rgba(46, 230, 255, 0.04); border: 1px solid var(--line); color: var(--ink-dim);
  border-radius: 8px; padding: 4px 10px; font-size: 0.78rem;
  transition: color .2s, border-color .2s, box-shadow .2s;
}
.speak-controls button:hover { color: var(--neon-cyan-soft); border-color: var(--neon-cyan); box-shadow: 0 0 10px rgba(46, 230, 255, 0.2); }

/* 会話 */
.chat-panel { display: flex; flex-direction: column; min-height: 60vh; }
.chat-log { flex: 1; overflow-y: auto; padding: 4px 2px; max-height: 52vh; scroll-behavior: smooth; padding-bottom: 6px; }
.chat-msg { margin-bottom: 14px; }
.chat-msg .who { font-size: 0.72rem; letter-spacing: 0.1em; color: var(--ink-dim); margin-bottom: 2px; opacity: 0.9; }
.chat-msg.oracle .who::before { content: "🔮 "; font-size: 0.8em; }
.chat-msg .bubble {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 92%;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
  line-height: 1.75;
}
.chat-msg.user { text-align: right; }
.chat-msg.user .bubble {
  background: linear-gradient(150deg, #0e7490, #155e75);
  border: 1px solid rgba(46, 230, 255, 0.35);
  color: #eafcff;
  border-bottom-right-radius: 3px;
  text-align: left;
  box-shadow: 0 2px 12px rgba(46, 230, 255, 0.10);
}
.chat-msg.oracle .bubble {
  background: linear-gradient(165deg, rgba(60, 22, 84, 0.75), rgba(20, 14, 46, 0.9));
  border: 1px solid rgba(225, 78, 255, 0.3);
  border-bottom-left-radius: 3px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}
.chat-msg.oracle .bubble.typing {
  border-color: rgba(225, 78, 255, 0.65);
  box-shadow: 0 0 16px rgba(225, 78, 255, 0.18);
}
.chat-msg.system .bubble { background: transparent; border: 1px dashed var(--line); color: var(--ink-dim); font-size: 0.82rem; }
.chat-msg .msg-actions { margin-top: 4px; display: flex; gap: 8px; }
.chat-msg .msg-actions button {
  background: rgba(225, 78, 255, 0.08); border: 1px solid rgba(225, 78, 255, 0.5); color: var(--neon-magenta-soft);
  border-radius: 999px; padding: 4px 12px; font-size: 0.78rem;
  transition: box-shadow .2s;
}
.chat-msg .msg-actions button:hover { box-shadow: 0 0 12px var(--glow-m); }

/* タイプライター演出のカーソル */
.chat-msg.oracle .bubble.typing .tw-caret {
  display: inline-block; width: 2px; height: 1em; margin-left: 1px;
  background: var(--neon-magenta-soft); vertical-align: -0.15em;
  box-shadow: 0 0 6px var(--glow-m);
  animation: twBlink 0.8s steps(1) infinite;
}
@keyframes twBlink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
body.reduced-motion .chat-msg.oracle .bubble.typing .tw-caret { animation: none; }

/* クイックボタン */
.quick-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.quick-row button {
  background: rgba(46, 230, 255, 0.06);
  border: 1px solid rgba(46, 230, 255, 0.35);
  color: var(--neon-cyan-soft);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.82rem;
  transition: border-color .2s, color .2s, box-shadow .2s;
}
.quick-row button:hover { border-color: var(--neon-cyan); color: #fff; box-shadow: 0 0 12px rgba(46, 230, 255, 0.25); }

/* 入力エリア */
.input-dock {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 8px;
}
/* PC: テキストエリアを横いっぱいに、ボタン類はその下の行に折り返す */
.input-row { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.input-row textarea {
  order: 1;
  flex: 1 1 100%;
  width: 100%;
  background: rgba(3, 3, 9, 0.6);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  resize: vertical;
  min-height: 60px;
  max-height: 180px;
  transition: border-color .2s, box-shadow .2s;
}
.input-row textarea::placeholder { color: #565d8a; }
.input-row textarea:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 14px rgba(46, 230, 255, 0.2);
}
/* 下段の並び: [🎙][🔮回数] …… [0/1000][送る][鑑定書] */
.input-row .mic-button { order: 2; }
.input-row .reading-count-chip { order: 3; }
.input-row #char-count { order: 4; margin-left: auto; align-self: center; }
.input-row .send-button { order: 5; }
.input-row .reading-button { order: 6; }
.mic-button {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(46, 230, 255, 0.4);
  background: rgba(46, 230, 255, 0.05);
  color: var(--ink);
  font-size: 1.2rem;
  flex-shrink: 0;
  transition: box-shadow .2s, border-color .2s;
}
.mic-button:hover { border-color: var(--neon-cyan); box-shadow: 0 0 12px rgba(46, 230, 255, 0.3); }
.mic-button.recording {
  background: rgba(255, 92, 122, 0.18);
  border-color: var(--danger);
  animation: micPulse 1.2s ease-in-out infinite;
}
@keyframes micPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,92,122,.45);} 50% { box-shadow: 0 0 0 8px rgba(255,92,122,0);} }
.send-button {
  height: 46px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--neon-magenta), var(--neon-violet));
  color: #fff;
  font-weight: 700;
  padding: 0 20px;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(225, 78, 255, 0.3);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: filter .15s, box-shadow .15s;
}
.send-button:hover { filter: brightness(1.1); }
.send-button:disabled { opacity: 0.5; box-shadow: none; }
.input-meta { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--ink-dim); margin-top: 4px; }
.mic-status { color: var(--danger); }
#char-count { white-space: nowrap; }

/* 鑑定書ボタン */
.reading-button {
  height: 38px; border-radius: 10px; border: 1px solid rgba(225, 78, 255, 0.55);
  background: rgba(225, 78, 255, 0.1); color: var(--neon-magenta-soft);
  font-weight: 700; padding: 0 14px; font-size: 0.85rem; flex-shrink: 0;
  transition: background .2s, box-shadow .2s;
}
.reading-button:hover { background: rgba(225, 78, 255, 0.2); box-shadow: 0 0 12px var(--glow-m); }
.reading-button:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
.reading-button:disabled:hover { background: rgba(225, 78, 255, 0.1); }

/* 占い回数チップ（🔮 1/5） */
.reading-count-chip {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 0.78rem; color: var(--neon-magenta-soft);
  background: rgba(225, 78, 255, 0.08);
  border: 1px solid rgba(225, 78, 255, 0.4);
  border-radius: 999px; padding: 2px 10px;
  white-space: nowrap; flex-shrink: 0;
}

/* 詳細設定 (UI簡素化のため非表示。override-* は DOM に残り既定 auto) */
.detail-settings { display: none !important; }
.detail-settings summary { cursor: pointer; color: var(--ink-dim); font-size: 0.82rem; }
.detail-settings .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.detail-settings label span { display: block; font-size: 0.72rem; color: var(--ink-dim); margin-bottom: 2px; }
.detail-settings select {
  width: 100%; background: var(--bg-0); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
}

/* 「占いは参考…」注意書きはオープニングに集約 (1行節約) */
#usage-note { display: none !important; }

/* ---------- 鑑定中 (SC-08) ---------- */
.divining-overlay {
  position: fixed; inset: 0;
  background: rgba(2, 2, 10, 0.9);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 60; text-align: center; padding: 20px;
}
.divining-overlay .crystal-orb {
  position: relative;
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #c8f6ff 0%, var(--neon-violet) 45%, #1b0b3d 100%);
  box-shadow: 0 0 60px var(--glow-m);
  animation: orbGlow 2.2s ease-in-out infinite alternate, orbFloat 3.6s ease-in-out infinite;
  margin-bottom: 22px;
}
@keyframes orbGlow { from { box-shadow: 0 0 30px var(--glow-m);} to { box-shadow: 0 0 80px rgba(46, 230, 255, 0.6);} }
/* 内側で光の筋が回転 */
.divining-overlay .crystal-orb::before {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  background: conic-gradient(from 0deg,
    transparent 0 55%,
    rgba(46, 230, 255, 0.2) 66%,
    rgba(225, 78, 255, 0.9) 76%,
    rgba(46, 230, 255, 0.3) 86%,
    transparent 96%);
  -webkit-mask: radial-gradient(circle, transparent 50%, #000 53%);
  mask: radial-gradient(circle, transparent 50%, #000 53%);
  animation: orbSpin 3.4s linear infinite;
  pointer-events: none;
}
/* 外周リングが広がって消える */
.divining-overlay .crystal-orb::after {
  content: ""; position: absolute; inset: -16px; border-radius: 50%;
  border: 2px solid rgba(46, 230, 255, 0.5);
  animation: orbRing 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes orbSpin { to { transform: rotate(360deg); } }
@keyframes orbRing { 0% { transform: scale(0.8); opacity: 0.85; } 100% { transform: scale(1.35); opacity: 0; } }
@keyframes orbFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
body.reduced-motion .divining-overlay .crystal-orb,
body.reduced-motion .divining-overlay .crystal-orb::before,
body.reduced-motion .divining-overlay .crystal-orb::after { animation: none; }

.divining-stage-text {
  font-family: var(--serif); color: var(--neon-cyan-soft); font-size: 1.05rem;
  min-height: 1.6em; letter-spacing: 0.1em; text-shadow: 0 0 14px var(--glow-c);
  animation: stagePulse 3.5s ease-in-out infinite;
}
@keyframes stagePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.72; } }
body.reduced-motion .divining-stage-text { animation: none; }
.divining-sub { color: var(--ink-dim); font-size: 0.8rem; margin-top: 8px; }

/* ---------- 鑑定結果 (SC-09) ---------- */
.result-summary {
  border-left: 3px solid var(--neon-magenta);
  padding: 6px 14px;
  margin: 12px 0;
  font-size: 1.05rem;
  background: linear-gradient(90deg, rgba(225, 78, 255, 0.08), transparent 70%);
  border-radius: 0 8px 8px 0;
}
.result-meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; align-items: center; font-size: 0.78rem; color: var(--ink-dim); }
.reading-body h1, .reading-body h2, .reading-body h3 {
  font-family: var(--serif); color: var(--neon-cyan-soft); font-size: 1.05rem; margin: 18px 0 6px;
  letter-spacing: 0.06em; text-shadow: 0 0 10px rgba(46, 230, 255, 0.25);
}
.reading-body p { margin: 8px 0; }
.reading-body ul { padding-left: 1.3em; }
.caution-box {
  border: 1px solid rgba(225, 78, 255, 0.4);
  background: rgba(225, 78, 255, 0.06);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 14px 0;
  font-size: 0.85rem;
  color: var(--neon-magenta-soft);
}
.crisis-box { border-color: var(--danger); color: #ffc4d0; background: rgba(255,92,122,.07); }
.action-list { list-style: none; padding: 0; }
.action-list li { padding: 6px 0 6px 1.6em; position: relative; }
.action-list li::before { content: "◈"; position: absolute; left: 2px; color: var(--neon-cyan); text-shadow: 0 0 8px var(--glow-c); }
.rating-bar { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 14px; }
.rating-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.rating-buttons button.selected {
  border-color: var(--neon-magenta); color: var(--neon-magenta-soft);
  background: rgba(225, 78, 255, 0.12); box-shadow: 0 0 12px rgba(225, 78, 255, 0.25);
}
.result-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* ---------- 履歴 (SC-10) ---------- */
.history-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  background: rgba(10, 10, 28, 0.4);
  transition: border-color .2s, box-shadow .2s;
}
.history-item:hover { border-color: var(--neon-cyan); box-shadow: 0 0 14px rgba(46, 230, 255, 0.15); }
.history-item .h-title { font-family: var(--serif); color: var(--neon-cyan-soft); letter-spacing: 0.04em; }
.history-item .h-meta { font-size: 0.75rem; color: var(--ink-dim); }
.followup-box textarea {
  width: 100%; background: rgba(3, 3, 9, 0.6); border: 1px solid var(--line);
  color: var(--ink); border-radius: 8px; padding: 8px 10px; min-height: 70px;
}
.followup-box textarea:focus { outline: none; border-color: var(--neon-cyan); }

/* ---------- 設定 (SC-11) ---------- */
.settings-group { border-bottom: 1px solid var(--line); padding: 14px 0; }
.settings-group:last-child { border-bottom: none; }
.settings-group h3 { margin: 0 0 8px; font-size: 0.95rem; color: var(--neon-cyan-soft); font-family: var(--serif); letter-spacing: 0.06em; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; flex-wrap: wrap; }
.setting-row .label { font-size: 0.9rem; }
.setting-row .desc { font-size: 0.75rem; color: var(--ink-dim); }
.toggle {
  appearance: none; width: 44px; height: 24px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--line);
  position: relative; cursor: pointer; transition: background .2s, box-shadow .2s;
  flex-shrink: 0;
}
.toggle::after {
  content: ""; position: absolute; top: 2px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--ink-dim); transition: left .2s, background .2s, box-shadow .2s;
}
.toggle:checked { background: rgba(46, 230, 255, 0.25); box-shadow: inset 0 0 8px rgba(46, 230, 255, 0.3); }
.toggle:checked::after { left: 22px; background: var(--neon-cyan); box-shadow: 0 0 8px var(--glow-c); }

.footer-note {
  margin-top: 26px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--ink-dim);
}
.footer-note a { color: var(--neon-cyan); }

/* エラーボックス */
.error-box {
  border: 1px solid rgba(255, 92, 122, 0.5);
  background: rgba(255, 92, 122, 0.08);
  color: #ffc4d0;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.9rem;
}

/* ---------- 写真アバター (簡易リップシンク演出) ---------- */
/* assets/oracle-luna.jpg が存在する場合に使用。口元・水晶の位置は
   画像に合わせた%指定。画像を差し替えた場合はここを調整する。 */
.avatar-photo-wrap {
  position: relative;
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
}
.avatar-photo-wrap img { width: 100%; display: block; }
.photo-veil { position: absolute; inset: 0; pointer-events: none; transition: box-shadow .3s; }
.avatar-stage.av-listening .photo-veil { box-shadow: inset 0 0 46px rgba(46, 230, 255, 0.45); }
.avatar-stage.av-error .photo-veil { box-shadow: inset 0 0 46px rgba(255, 92, 122, 0.4); }
.avatar-stage.av-ended .avatar-photo-wrap { filter: grayscale(.6) brightness(.8); }

/* 口元: 話している間だけ薄い開閉アニメーションを重ねる */
.photo-mouth {
  position: absolute;
  left: 46%; top: 35.1%;
  width: 8%; height: 2.6%;
  border-radius: 50%;
  background: transparent;
  mix-blend-mode: multiply;
  pointer-events: none;
  transform-origin: center;
}
.avatar-stage.av-speaking .photo-mouth {
  background: rgba(46, 12, 16, 0.5);
  animation: photoTalk 0.38s ease-in-out infinite;
}
@keyframes photoTalk {
  0%, 100% { transform: scaleY(0.25); opacity: .55; }
  50% { transform: scaleY(1); opacity: .9; }
}
body.reduced-motion .avatar-stage.av-speaking .photo-mouth { animation: none; opacity: .6; }

/* 水晶玉: 考えている間は光る */
.photo-crystal {
  position: absolute;
  left: 37%; top: 71%;
  width: 26%; height: 21%;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, rgba(46, 230, 255, 0.75) 0%, rgba(225, 78, 255, 0.4) 55%, transparent 75%);
  transition: opacity .3s;
}
.avatar-stage.av-thinking .photo-crystal { opacity: 1; animation: crystalPulse 1.4s ease-in-out infinite; }
body.reduced-motion .avatar-stage.av-thinking .photo-crystal { animation: none; opacity: .8; }

/* 待機中の静かな呼吸 */
.avatar-stage.av-idle .avatar-photo-wrap img { animation: photoBreathe 5s ease-in-out infinite; }
@keyframes photoBreathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.012); } }
body.reduced-motion .avatar-stage.av-idle .avatar-photo-wrap img { animation: none; }

/* ---------- 共通の細かな磨き ---------- */
html { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.toggle:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 2px;
}

/* スクロールバーをネオン夜色に (WebKit/Blink) */
.chat-log::-webkit-scrollbar { width: 8px; }
.chat-log::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 8px; }
.chat-log::-webkit-scrollbar-thumb:hover { background: rgba(46, 230, 255, 0.4); }

/* 画面切替時の軽いフェード */
.screen:not(.hidden) { animation: screenFade 0.26s ease; }
@keyframes screenFade { from { opacity: 0.4; } to { opacity: 1; } }
body.reduced-motion .screen:not(.hidden) { animation: none; }

/* ============================================================
   スマホ最適化 (NFR-03) — 汎用調整
   ============================================================ */
@media (max-width: 600px) {
  .panel { padding: 18px 14px; }
  .card-sheet .grid.two, .card-sheet .grid.three { grid-template-columns: 1fr; }
  .card-view dl { grid-template-columns: 7em 1fr; }
  .hall-nav button { padding: 5px 10px; font-size: 0.78rem; }
  .chat-log { max-height: 44vh; }
  .input-dock { position: sticky; bottom: 0; background: var(--bg-1); padding-bottom: 8px; }
}

/* モバイルでは字幕トグルは冗長（タイプライター表示のため） */
@media (max-width: 760px) {
  #opening-subtitle-toggle { display: none; }
}

/* ============================================================
   モバイル相談画面 統合レイアウト (body.consulting / max-width:760px)
   縦の並び:
     1. 占い師の顔（バストアップ・発話で光る）＋名前＋操作1行
     2. 会話ログ（鑑定テキスト。主役・スクロール）
     3. クイック運勢ボタン（横スクロール1行）
     4. 1行入力
     5. 操作1行 [🎙][🔮回数] … [鑑定書][送る]
   100dvh基準でソフトキーボード表示時も破綻しない。
   全要素 min-width:0 / max-width:100% で横あふれを防止。
   ============================================================ */
@media (max-width: 760px) {
  body.consulting { overflow: hidden; height: 100dvh; }
  body.consulting .footer-note { display: none; }
  body.consulting .hall-frame { height: 100dvh; min-height: 0; padding-bottom: env(safe-area-inset-bottom, 8px); }
  body.consulting .hall-header { padding: 8px 2px; flex: 0 0 auto; }

  body.consulting #screen-consult { flex: 1 1 auto; min-height: 0; display: flex; min-width: 0; max-width: 100%; }
  body.consulting .consult-layout {
    display: flex; flex-direction: column;
    flex: 1 1 auto; min-height: 0; min-width: 0; width: 100%; max-width: 100%; gap: 8px;
  }

  /* 1. 占い師の顔（上部・バストアップ） */
  body.consulting .avatar-panel {
    display: flex; order: 0; flex: 0 0 auto; flex-direction: column; flex-wrap: nowrap;
    align-items: center; justify-content: flex-start;
    position: static; margin: 0; padding: 4px 0 2px; gap: 1px; text-align: center;
    width: 100%; max-width: 100%; border: none;
  }
  body.consulting .avatar-stage {
    display: block; position: relative; margin: 0 auto; padding: 0; overflow: hidden;
    width: min(46vw, 184px); height: min(51.5vw, 206px);   /* ≒ 420:470 の顔クロップ枠 */
    background: radial-gradient(ellipse at 50% 66%, rgba(139, 92, 246, 0.3) 0%, var(--bg-1) 82%);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  }
  body.consulting .avatar-figure,
  body.consulting .avatar-photo-wrap { display: none !important; }
  /* reader.jpg の顔まわり(元画像 x280..700 / y150..620)だけを枠に収める */
  body.consulting .reader-canvas {
    position: absolute; margin: 0; max-width: none; height: auto;
    border-radius: 0; box-shadow: none;
    width: 224%; left: -66.7%; top: -31.9%;
  }
  body.consulting .avatar-stage.av-speaking { box-shadow: 0 0 0 3px var(--glow-m), 0 0 22px var(--glow-m), 0 6px 20px rgba(0, 0, 0, 0.5); }
  body.consulting .avatar-stage.av-thinking { box-shadow: 0 0 0 3px var(--glow-c), 0 0 22px var(--glow-c), 0 6px 20px rgba(0, 0, 0, 0.5); }
  body.consulting .avatar-name { display: block; margin: 3px 0 0; font-size: 0.86rem; }
  body.consulting .avatar-state { display: none; }       /* 「待機中」等は非表示で省スペース */
  body.consulting .subtitle-box { display: none; }
  /* 操作(停止/聞き直す/音声)は名前の下に小さく1行 */
  body.consulting .speak-controls {
    display: flex; flex: 0 0 auto; flex-wrap: nowrap; justify-content: center; gap: 6px; margin: 3px 0 0;
  }
  body.consulting .speak-controls button { padding: 3px 9px; font-size: 0.7rem; }

  /* 2. 会話ログ（主役・スクロール） */
  body.consulting .chat-panel {
    order: 1; display: flex; flex-direction: column; flex: 1 1 auto;
    min-height: 0; min-width: 0; max-width: 100%;
    padding: 6px 12px 8px; border-top: 1px solid var(--line); margin-top: 4px;
  }
  body.consulting .chat-log {
    order: 1; flex: 1 1 auto; min-height: 0; min-width: 0; max-height: none;
    overflow-y: auto; overscroll-behavior: contain;
  }
  body.consulting .chat-msg .bubble { max-width: 100%; }

  /* 3. クイック運勢ボタン（横スクロール1行） */
  body.consulting .quick-row {
    display: flex; order: 2; flex: 0 0 auto; flex-wrap: nowrap; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 8px; margin: 6px 0 4px;
    min-width: 0; max-width: 100%;
  }
  body.consulting .quick-row::-webkit-scrollbar { display: none; }
  body.consulting .quick-row button { flex: 0 0 auto; white-space: nowrap; }

  /* 4-5. 入力ドック: 1行入力 ＋ 操作1行 */
  body.consulting .input-dock {
    order: 3; flex: 0 0 auto; position: static; margin: 0;
    padding-top: 6px; border-top: 1px solid var(--line);
    min-width: 0; max-width: 100%;
  }
  body.consulting .input-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; width: 100%; min-width: 0; max-width: 100%; }
  body.consulting .input-row textarea {
    order: 1; flex: 1 1 100%; width: 100%; min-width: 0; max-width: 100%;
    min-height: 44px; max-height: 88px; resize: none; padding: 9px 12px;
  }
  /* 操作行（必ず1行）: [🎙][🔮回数] …余白… [鑑定書][送る] */
  body.consulting .mic-button { order: 2; flex: 0 0 auto; width: 40px; height: 40px; font-size: 1.05rem; }
  body.consulting .reading-count-chip { order: 3; flex: 0 0 auto; font-size: 0.72rem; padding: 2px 8px; }
  body.consulting #view-reading-button { order: 4; flex: 0 0 auto; margin-left: auto; height: 40px; padding: 0 12px; font-size: 0.78rem; }
  body.consulting .send-button { order: 5; flex: 0 0 auto; height: 40px; padding: 0 18px; font-size: 0.9rem; margin: 0; }
  body.consulting #char-count { display: none; }
  body.consulting .input-meta { display: none; }
  body.consulting .detail-settings summary { font-size: 0.75rem; }
}

/* ============================================================
   アバターモード（横スワイプ: 相談⇄アバター / モバイルのみ）
   ・占い師ルナを大きく上部に表示（発話アニメあり）
   ・下に会話ログ／入力・クイックは非表示
   body.consulting.avatar-mode のとき有効
   ============================================================ */
@media (max-width: 760px) {
  body.consulting.avatar-mode .avatar-panel {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    order: 0; flex: 0 0 auto; gap: 5px; border-top: none; padding-top: 6px;
    text-align: center; width: 100%; max-width: 100%; flex-wrap: nowrap;
  }
  /* 顔中心バストアップのクロップ枠。reader.jpg(941x1133)の顔周りだけを見せる。
     可視領域 = 元画像の x280..700 / y150..620 (align_mouths.py と同じ座標系)。 */
  body.consulting.avatar-mode .avatar-stage {
    display: block; position: relative; margin: 0 auto; padding: 0; overflow: hidden;
    width: min(62vw, 240px); aspect-ratio: 420 / 470; height: auto;
    background: radial-gradient(ellipse at 50% 68%, rgba(139, 92, 246, 0.3) 0%, var(--bg-1) 82%);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
  }
  body.consulting.avatar-mode .avatar-figure,
  body.consulting.avatar-mode .avatar-photo-wrap { display: none !important; }
  body.consulting.avatar-mode .reader-canvas {
    position: absolute; margin: 0; max-width: none; height: auto;
    border-radius: 0; box-shadow: none;
    width: 224%; left: -66.7%; top: -31.9%;
  }
  body.consulting.avatar-mode .avatar-stage.av-speaking {
    box-shadow: 0 0 0 3px var(--glow-m), 0 0 26px var(--glow-m), 0 8px 26px rgba(0, 0, 0, 0.5);
  }
  body.consulting.avatar-mode .avatar-stage.av-thinking {
    box-shadow: 0 0 0 3px var(--glow-c), 0 0 26px var(--glow-c), 0 8px 26px rgba(0, 0, 0, 0.5);
  }
  body.consulting.avatar-mode .avatar-name { display: block; margin: 2px 0 0; font-size: 1rem; }
  body.consulting.avatar-mode .avatar-state { display: block; margin: 0; font-size: 0.8rem; }

  /* 会話ログ＋クイックボタンを下に配置。入力欄は隠し、クイックで鑑定開始 */
  body.consulting.avatar-mode .chat-panel {
    order: 1; display: flex; flex-direction: column;
    min-height: 0; padding: 8px 12px 58px;
  }
  body.consulting.avatar-mode .chat-log {
    display: block; order: 1; flex: 1 1 auto; min-height: 0; overflow-y: auto;
  }
  body.consulting.avatar-mode .quick-row {
    display: flex; order: 2; flex: 0 0 auto; flex-wrap: nowrap; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 8px; margin: 8px 0 0;
  }
  body.consulting.avatar-mode .quick-row::-webkit-scrollbar { display: none; }
  body.consulting.avatar-mode .quick-row button { flex: 0 0 auto; white-space: nowrap; }
  body.consulting.avatar-mode .input-dock { display: none; }

  /* 操作ボタン(停止/聞き直す/音声)は最下部に固定 */
  body.consulting.avatar-mode .speak-controls {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
    flex: 0 0 auto; display: flex; flex-wrap: nowrap; justify-content: center; gap: 10px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(6, 6, 20, 0.96); border-top: 1px solid var(--line); margin: 0;
  }
  body.consulting.avatar-mode .speak-controls button { flex: 0 0 auto; }

  /* 戻り方のヒント */
  body.consulting.avatar-mode .avatar-panel::after {
    content: "← スワイプで相談に戻る"; color: var(--ink-dim); font-size: 0.72rem;
  }
}

/* ============================================================
   2026-07-10 追加: 根拠の透明性 / 追い質問チャット / シェア文言
   (knowledge 2026-07-10 アップデート反映)
   ============================================================ */
.basis-box {
  background: var(--glass);
  border: 1px solid var(--parchment-line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 8px 0 18px;
}
.basis-row {
  display: flex;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.92rem;
}
.basis-row:last-of-type { border-bottom: none; }
.basis-label {
  color: var(--gold-soft);
  min-width: 7.5em;
  flex-shrink: 0;
}

/* 専門家円卓 (2026-07-11): 各専門家の個別鑑定カード */
.expert-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 8px 0 16px;
}
.expert-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.expert-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.expert-card-head strong { color: var(--gold-soft); }
.expert-card p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--ink-dim);
  white-space: pre-wrap;
}

.followup-chat { margin: 18px 0; }
.fu-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  margin: 10px 0;
}
.fu-log:empty { margin: 0; }
.fu-msg {
  padding: 10px 14px;
  border-radius: var(--radius);
  max-width: 88%;
  white-space: pre-wrap;
  font-size: 0.95rem;
  line-height: 1.6;
}
.fu-visitor {
  align-self: flex-end;
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--ink);
}
.fu-oracle {
  align-self: flex-start;
  background: var(--glass);
  border: 1px solid var(--parchment-line);
  color: var(--parchment-ink);
}
.fu-system {
  align-self: center;
  color: var(--ink-dim);
  font-size: 0.85rem;
}
.fu-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.fu-input-row textarea { flex: 1; }
.field-note.error { color: var(--danger); }

.share-section { margin: 18px 0; }
.share-box {
  background: var(--glass);
  border: 1px solid var(--parchment-line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 10px;
}

/* ヴィオラ(reading2/base.png 941x1672)のモバイル顔寄せ。
   ルナと同じ枠(aspect 420/470)に顔が収まるようパン量をスキン別に調整。
   base.png は縦長なので aspect-ratio:auto で実寸比に戻してから寄せる。 */
@media (max-width: 760px) {
  body.consulting.skin-reading2 .reader-canvas,
  body.consulting.avatar-mode.skin-reading2 .reader-canvas {
    aspect-ratio: auto;
    width: 176%;
    left: -40.5%;
    top: -36.7%;
  }
}
