/* ============================================================
   AIガイド＆アドバイザー  共通スタイル
   ------------------------------------------------------------
   トークン
     --ink      深い藍墨（文字・ステージ背景）
     --paper    霧のような淡い青白（ページ背景）
     --indigo   ブランドカラー（藍）
     --sun      山吹（行動を促すボタン・強調）
     --leaf     若草（成功）  --coral 珊瑚（エラー）
   書体: Zen Maru Gothic（見出し・キャラ名）/ Zen Kaku Gothic New（本文）
   ============================================================ */
:root {
  --ink: #17233a;
  --ink-2: #22304d;
  --ink-soft: #4a5876;
  --paper: #eef2f6;
  --paper-2: #ffffff;
  --indigo: #2b4fb5;
  --indigo-deep: #1d3480;
  --indigo-soft: #dfe6f8;
  --sun: #f5b52b;
  --sun-deep: #d99a0c;
  --leaf: #2f9e6b;
  --coral: #e2574c;
  --line: #d4dbe6;
  --line-2: #b9c3d4;
  --radius: 14px;
  --font-display: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Rounded Mplus 1c", sans-serif;
  --font-body: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --input-h: 76px;
  --kb: 0px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--indigo); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(43, 79, 181, .45);
  outline-offset: 2px;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.35; margin: 0 0 .5em; letter-spacing: .01em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 900; }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
img { max-width: 100%; height: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--ink-soft); }
.small { font-size: .85rem; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font-family: var(--font-display); font-weight: 700; font-size: .95rem;
  padding: .7em 1.4em; border-radius: 999px; border: 2px solid transparent;
  background: var(--indigo); color: #fff; cursor: pointer; text-decoration: none;
  transition: background .15s, transform .05s;
  min-height: 44px;
}
.btn:hover { background: var(--indigo-deep); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.sun { background: var(--sun); color: var(--ink); }
.btn.sun:hover { background: var(--sun-deep); }
.btn.ghost { background: transparent; color: var(--indigo); border-color: var(--indigo); }
.btn.ghost:hover { background: var(--indigo-soft); }
.btn.quiet { background: var(--paper); color: var(--ink-soft); border-color: var(--line); }
.btn.quiet:hover { background: #fff; color: var(--ink); }
.btn.danger { background: transparent; color: var(--coral); border-color: var(--coral); }
.btn.danger:hover { background: #fdecea; }
.btn.sm { font-size: .82rem; padding: .45em 1em; min-height: 36px; }
.btn.lg { font-size: 1.1rem; padding: .85em 1.9em; }
.btn.block { display: flex; width: 100%; }

/* ---------- ナビ ---------- */
.site-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .8rem 20px; background: var(--paper-2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--font-display); font-weight: 900; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.brand-icon { width: 28px; height: 28px; border-radius: 8px; flex: none; }
.brand-mark {
  width: 26px; height: 22px; background: var(--indigo); border-radius: 11px 11px 11px 3px; position: relative; flex: none;
}
.brand-mark::after { content: ""; position: absolute; left: 7px; top: 8px; width: 12px; height: 4px; border-radius: 2px; background: var(--sun); }
.nav-links { display: flex; align-items: center; gap: .3rem 1.1rem; flex-wrap: wrap; font-size: .92rem; }
.nav-links a { color: var(--ink-2); text-decoration: none; }
.nav-links a:hover { color: var(--indigo); }
.nav-links .nav-btn { background: var(--indigo); color: #fff; padding: .45em 1.1em; border-radius: 999px; font-family: var(--font-display); font-weight: 700; }
.nav-links .nav-btn:hover { background: var(--indigo-deep); color: #fff; }
.nav-user { color: var(--ink-soft); font-size: .85rem; }
.nav-user small { background: var(--indigo-soft); color: var(--indigo-deep); padding: .1em .6em; border-radius: 999px; font-size: .75rem; }
@media (max-width: 640px) { .nav-user { display: none; } .nav-links { gap: .3rem .7rem; font-size: .85rem; } }

/* ---------- フッター ---------- */
.site-footer { margin-top: 5rem; padding: 2rem 20px 2.5rem; border-top: 1px solid var(--line); text-align: center; font-size: .85rem; color: var(--ink-soft); }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.4rem; margin-bottom: .8rem; }
.footer-nav a { color: var(--ink-soft); }

/* ---------- LP ---------- */
.hero { padding: 3.5rem 20px 2.5rem; }
.hero-grid { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: 1.15fr 1fr; gap: 2.5rem; align-items: center; }
@media (max-width: 880px) { .hero-grid { grid-template-columns: 1fr; } }
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); line-height: 1.25; margin-bottom: 1rem; }
.hero .lead { font-size: 1.08rem; color: var(--ink-2); max-width: 34em; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.4rem; align-items: center; }
.hero-note { font-size: .85rem; color: var(--ink-soft); }
/* シグネチャ: 吹き出しの中でガイドが語りかけるデモ */
.bubble-demo { position: relative; padding: 1rem; }
.bubble {
  position: relative; background: var(--paper-2); border: 2px solid var(--ink); border-radius: 22px 22px 22px 6px;
  padding: 1rem 1.2rem; font-family: var(--font-display); font-weight: 700; box-shadow: 6px 6px 0 var(--indigo-soft);
}
.bubble + .bubble { margin-top: .9rem; }
.bubble.visitor { border-color: var(--line-2); background: var(--paper); font-weight: 500; border-radius: 22px 22px 6px 22px; margin-left: 2.5rem; box-shadow: none; }
.bubble .who { display: block; font-size: .72rem; color: var(--ink-soft); font-weight: 500; margin-bottom: .2rem; }
.bubble .lang { display: inline-block; margin-left: .5em; font-size: .7rem; background: var(--sun); color: var(--ink); padding: 0 .5em; border-radius: 999px; }
.section { padding: 3rem 20px; }
.section.alt { background: var(--paper-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { max-width: 1120px; margin: 0 auto 1.6rem; }
.section-head p { color: var(--ink-soft); max-width: 44em; }
.feature-grid { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.2rem; }
.feature { padding: 1.3rem 1.3rem 1.1rem; border-left: 4px solid var(--indigo); background: var(--paper-2); }
.section.alt .feature { background: var(--paper); }
.feature h3 { margin-bottom: .35em; }
.feature p { margin: 0; font-size: .93rem; color: var(--ink-2); }
.feature .icon { font-size: 1.5rem; line-height: 1; margin-bottom: .5rem; display: block; }
.scene-list { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.scene { padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2); }
.scene strong { font-family: var(--font-display); display: block; margin-bottom: .2rem; }
.scene span { font-size: .88rem; color: var(--ink-soft); }
.steps { max-width: 1120px; margin: 0 auto; counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.2rem; }
.step { counter-increment: step; position: relative; padding: 1.2rem 1.2rem 1rem 1.2rem; background: var(--paper-2); border-radius: var(--radius); border: 1px solid var(--line); }
.step::before { content: counter(step); font-family: var(--font-display); font-weight: 900; font-size: 1.6rem; color: var(--indigo); display: block; line-height: 1; margin-bottom: .4rem; }
.step h3 { font-size: 1.05rem; }
.step p { margin: 0; font-size: .9rem; color: var(--ink-2); }

/* ---------- 料金 ---------- */
.plan-grid { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.3rem; align-items: stretch; }
.plan { background: var(--paper-2); border: 2px solid var(--line); border-radius: var(--radius); padding: 1.6rem 1.5rem; display: flex; flex-direction: column; position: relative; }
.plan.featured { border-color: var(--indigo); box-shadow: 8px 8px 0 var(--indigo-soft); }
.plan.current { border-color: var(--leaf); }
.plan-tag { position: absolute; top: -.85em; left: 1.2rem; background: var(--sun); color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: .78rem; padding: .15em .9em; border-radius: 999px; }
.plan h3 { font-size: 1.25rem; margin-bottom: .2em; }
.plan .price { font-family: var(--font-display); font-weight: 900; font-size: 2rem; line-height: 1.1; margin: .3rem 0 .1rem; }
.plan .price small { font-size: .9rem; font-weight: 500; color: var(--ink-soft); }
.plan .price-note { font-size: .8rem; color: var(--ink-soft); margin-bottom: 1rem; }
.plan ul { list-style: none; padding: 0; margin: 0 0 1.4rem; font-size: .92rem; flex: 1; }
.plan li { padding: .35em 0 .35em 1.5em; position: relative; border-top: 1px dashed var(--line); }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--leaf); font-weight: 700; }
.plan li.no::before { content: "－"; color: var(--line-2); }
.plan li.no { color: var(--ink-soft); }

/* ---------- フォーム ---------- */
.card { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem; }
.card + .card { margin-top: 1.2rem; }
.card h2 { font-size: 1.2rem; margin-bottom: .8rem; }
.form-grid { display: grid; gap: 1rem; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .form-grid.two { grid-template-columns: 1fr; } }
.field label { display: block; font-size: .85rem; font-weight: 700; color: var(--ink-2); margin-bottom: .3rem; }
.field .hint { display: block; font-size: .78rem; color: var(--ink-soft); font-weight: 400; margin-top: .25rem; line-height: 1.55; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number], .field input[type=url],
.field select, .field textarea {
  width: 100%; font: inherit; font-size: .98rem; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line-2); border-radius: 10px; padding: .6em .8em; min-height: 44px;
}
.field textarea { min-height: 6em; resize: vertical; line-height: 1.65; }
.field input[type=range] { width: 100%; accent-color: var(--indigo); }
.field input[type=color] { width: 60px; height: 40px; border: 1px solid var(--line-2); border-radius: 8px; padding: 2px; background: #fff; }
.field input[type=file] { font-size: .9rem; }
.check { display: inline-flex; align-items: center; gap: .5em; font-size: .92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--indigo); }
.check-list { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.auth-card { max-width: 440px; margin: 3rem auto; }
.auth-card h1 { font-size: 1.6rem; }
.msg { font-size: .88rem; min-height: 1.4em; margin-top: .5rem; }
.msg.error { color: var(--coral); }
.msg.ok { color: var(--leaf); }
.notice { background: #fff8e1; border: 1px solid #f3dd9a; border-radius: 10px; padding: .8rem 1rem; font-size: .9rem; }
.notice.info { background: var(--indigo-soft); border-color: #bcc9ee; }
.notice.error { background: #fdecea; border-color: #f2b3ad; }
.notice.ok { background: #e6f5ec; border-color: #b6dfc6; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.log-list { list-style: none; padding: 0; margin: .8rem 0 0; font-size: .85rem; }
.log-list li { padding: .3rem 0; border-bottom: 1px dotted var(--line); }
.log-list li.ok { color: var(--leaf); }
.log-list li.ng { color: var(--coral); }
.badge { display: inline-block; font-size: .72rem; padding: .1em .6em; border-radius: 999px; background: var(--indigo-soft); color: var(--indigo-deep); font-weight: 700; vertical-align: middle; }
.badge.on { background: #e6f5ec; color: #1f7a4d; }
.badge.off { background: #f1f1f1; color: #777; }
.badge.warn { background: #fff3cd; color: #8a6100; }
.pill-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.pill-row .badge { font-size: .78rem; }

/* ---------- ダッシュボード ---------- */
.dash-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin: 2rem 0 1.2rem; }
.usage-bar { height: 8px; background: var(--indigo-soft); border-radius: 999px; overflow: hidden; margin-top: .3rem; }
.usage-bar i { display: block; height: 100%; background: var(--indigo); border-radius: 999px; }
.usage-bar i.warn { background: var(--sun); }
.usage-bar i.over { background: var(--coral); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem; }
.stat { background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1.1rem; }
.stat .v { font-family: var(--font-display); font-weight: 900; font-size: 1.5rem; line-height: 1.2; }
.stat .k { font-size: .8rem; color: var(--ink-soft); }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.2rem; }
.guide-card { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.guide-card .thumb { aspect-ratio: 4 / 3; background: var(--ink); display: grid; place-items: center; overflow: hidden; position: relative; }
.guide-card .thumb img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.guide-card .thumb .initial { font-family: var(--font-display); font-size: 4rem; font-weight: 900; color: var(--sun); }
.guide-card .thumb .type { position: absolute; top: .6rem; left: .6rem; }
.guide-card .body { padding: 1rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.guide-card h3 { margin: 0; font-size: 1.15rem; }
.guide-card .place { font-size: .85rem; color: var(--ink-soft); }
.guide-card .url { font-size: .78rem; word-break: break-all; }
.guide-card .actions { margin-top: auto; padding-top: .5rem; }
.guide-new { border: 2px dashed var(--line-2); background: transparent; display: grid; place-items: center; min-height: 260px; text-align: center; padding: 1.5rem; color: var(--ink-soft); }
.guide-new strong { font-family: var(--font-display); display: block; font-size: 1.1rem; color: var(--ink); margin-bottom: .4rem; }

/* ---------- ガイド編集（タブ） ---------- */
.tabs { display: flex; gap: .2rem; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin: 1.5rem 0 1.2rem; }
.tabs button { font: inherit; font-family: var(--font-display); font-weight: 700; font-size: .95rem; background: none; border: none; padding: .6em 1em; cursor: pointer; color: var(--ink-soft); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs button.on { color: var(--indigo); border-bottom-color: var(--indigo); }
.tab-panel { display: none; }
.tab-panel.on { display: block; }
.edit-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }
.edit-head h1 { margin: 0; font-size: 1.6rem; }
.frame-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .8rem; }
.frame { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: .5rem; text-align: center; font-size: .78rem; }
.frame .fimg { aspect-ratio: 4 / 5; background: var(--ink); border-radius: 6px; display: grid; place-items: center; overflow: hidden; margin-bottom: .4rem; color: var(--line-2); }
.frame .fimg img { width: 100%; height: 100%; object-fit: contain; }
.frame .fname { font-weight: 700; }
.frame .fbtn { display: flex; gap: .3rem; justify-content: center; margin-top: .3rem; flex-wrap: wrap; }
.frame .fbtn button { font: inherit; font-size: .72rem; padding: .2em .6em; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; cursor: pointer; }
.frame .fbtn button:hover { border-color: var(--indigo); color: var(--indigo); }
.preview-stage { background: var(--ink); border-radius: var(--radius); aspect-ratio: 3 / 4; max-height: 460px; display: grid; place-items: center; overflow: hidden; position: relative; }
.preview-stage img { max-height: 100%; max-width: 100%; object-fit: contain; }
.preview-stage model-viewer { width: 100%; height: 100%; }
.job-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.job { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: .5rem; font-size: .78rem; }
.job.sel { border-color: var(--indigo); box-shadow: 0 0 0 2px var(--indigo-soft); }
.job .jthumb { aspect-ratio: 1; background: var(--ink); border-radius: 6px; display: grid; place-items: center; overflow: hidden; color: var(--line-2); margin-bottom: .3rem; cursor: pointer; }
.job .jthumb img { width: 100%; height: 100%; object-fit: cover; }
.job .jname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job .jbtn { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3rem; }
.job .jbtn button { font: inherit; font-size: .7rem; padding: .15em .5em; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; cursor: pointer; }
.job .jbtn button.primary { background: var(--indigo); color: #fff; border-color: var(--indigo); }
.progress { height: 8px; background: var(--indigo-soft); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--indigo); transition: width .4s; }
.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.doc-list .title { flex: 1; min-width: 200px; font-weight: 700; }
.doc-list .meta { color: var(--ink-soft); font-size: .8rem; }
.embed-code { background: var(--ink); color: #dfe6f8; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .8rem; padding: 1rem; border-radius: 10px; overflow-x: auto; white-space: pre; margin: .5rem 0 0; }
.qr-box { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: center; }
.qr-box img { width: 160px; height: 160px; border: 1px solid var(--line); background: #fff; border-radius: 8px; }
.sticky-save { position: sticky; bottom: 0; background: rgba(238,242,246,.95); backdrop-filter: blur(6px); padding: .8rem 0; border-top: 1px solid var(--line); margin-top: 1.5rem; display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; z-index: 5; }

/* ---------- 管理テーブル ---------- */
.table-wrap { overflow-x: auto; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.tbl th, table.tbl td { padding: .55rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
table.tbl th { background: var(--paper); font-weight: 700; font-size: .78rem; color: var(--ink-soft); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl input, table.tbl select { font: inherit; font-size: .82rem; padding: .25em .4em; border: 1px solid var(--line-2); border-radius: 6px; }

/* ---------- 法務・ガイドページ ---------- */
.doc { max-width: 760px; margin: 0 auto; padding: 2.5rem 20px 3rem; }
.doc h1 { margin-bottom: .3em; }
.doc .lead { color: var(--ink-soft); margin-bottom: 2rem; }
.doc h2 { font-size: 1.15rem; margin: 2.2rem 0 .6rem; padding-bottom: .4rem; border-bottom: 2px solid var(--indigo-soft); }
.doc table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .92rem; background: var(--paper-2); }
.doc th, .doc td { padding: .7rem .9rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.doc th { width: 12em; background: var(--paper); font-weight: 700; }
.doc ol, .doc ul { padding-left: 1.5em; }
.doc li { margin: .3em 0; }
.doc .date { color: var(--ink-soft); font-size: .85rem; margin-top: 2rem; }
@media (max-width: 640px) { .doc th, .doc td { display: block; width: 100%; } .doc th { border-bottom: none; } }

/* ============================================================
   会話画面（talk.php）
   ============================================================ */
body.talk-body {
  overflow: hidden; position: fixed; inset: 0; width: 100%; height: 100%;
  background: var(--ink);
  --accent: var(--sun);
}
.stage-full {
  position: fixed; inset: 0;
  bottom: calc(var(--input-h) + env(safe-area-inset-bottom, 0px) + var(--kb));
  background: radial-gradient(110% 80% at 50% 25%, color-mix(in srgb, var(--theme, #2b4fb5) 38%, transparent), transparent 62%), var(--ink);
}
.stage-full.bg-day { background: radial-gradient(110% 80% at 50% 25%, color-mix(in srgb, var(--theme, #2b4fb5) 22%, #fff), #dfe8f5 65%); }
.stage-full.bg-day .speech-full { background: #fff; }
.figure-layer { position: absolute; inset: 0; transition: transform .08s linear; will-change: transform; }
.stage-full img.portrait { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.stage-full img.portrait-fade { opacity: 0; transition: opacity .14s ease; pointer-events: none; }
.stage-full:not(.talking) .figure-layer { animation: idle-breath 4.5s ease-in-out infinite; }
.stage-full:has(.glb-canvas):not(.talking) .figure-layer { animation: none; }
@keyframes idle-breath { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-1.5px) scale(1.004); } }
@media (prefers-reduced-motion: reduce) { .stage-full:not(.talking) .figure-layer { animation: none; } }
.no-image-full { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-weight: 900; font-size: clamp(6rem, 30vw, 14rem); color: var(--accent); opacity: .85; }
.glb-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.glb-canvas:active { cursor: grabbing; }
.glb-loading { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #dfe6f8; font-size: .9rem; text-align: center; padding-top: 44px; }
.glb-loading::before { content: ""; position: absolute; top: 0; left: 50%; margin-left: -16px; width: 32px; height: 32px; border: 3px solid rgba(255,255,255,.25); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.stage-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .7rem .9rem calc(.7rem + 18px); background: linear-gradient(rgba(23,35,58,.85), transparent); z-index: 3; }
.stage-top .left, .stage-top .right { display: flex; align-items: center; gap: .5rem; }
.stage-back { color: #dfe6f8; text-decoration: none; font-size: .85rem; background: rgba(23,35,58,.5); padding: .3rem .8rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.2); }
.stage-back:hover { color: #fff; border-color: var(--accent); }
.lang-select { font: inherit; font-size: .82rem; color: #fff; background: rgba(23,35,58,.6); border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: .3rem .7rem; min-height: 34px; }
.lang-select option { color: var(--ink); }
.icon-btn { background: rgba(23,35,58,.6); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; font-size: 1rem; }
.icon-btn:hover { border-color: var(--accent); }
.emotion-label { font-family: var(--font-display); color: var(--accent); border: 1px solid var(--accent); background: rgba(23,35,58,.7); padding: .05em .55em; border-radius: 999px; font-size: .85rem; }

.stage-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 2.2rem .8rem .8rem; background: linear-gradient(transparent, rgba(23,35,58,.9) 55%); z-index: 3; }
.voice-bars { display: flex; gap: 4px; justify-content: center; align-items: flex-end; height: 16px; margin: 0 auto .4rem; visibility: hidden; }
.voice-bars span { width: 5px; height: 3px; background: var(--accent); border-radius: 2px; transition: height .06s linear; }
.stage-full.talking .voice-bars { visibility: visible; }
.speech-box { max-width: 760px; margin: 0 auto; position: relative; }
.name-plate { display: inline-block; background: var(--theme, #2b4fb5); color: #fff; font-family: var(--font-display); font-weight: 700; padding: .2rem 1rem; border-radius: 999px 999px 0 0; letter-spacing: .04em; transform: translateY(4px); position: relative; z-index: 2; }
.name-plate .np-sub { font-size: .7rem; font-weight: 500; opacity: .85; margin-left: .6em; }
.speech-full {
  background: rgba(255,255,255,.96); color: var(--ink); padding: 1rem 1.2rem .9rem; font-size: 1rem; line-height: 1.75;
  min-height: 4.2em; max-height: 8.5em; overflow-y: auto; border-radius: 0 18px 18px 18px; border-top: 3px solid var(--theme, #2b4fb5);
}
.speech-full.thinking { color: #7a8398; font-style: italic; }
.hist-toggle { position: absolute; right: .4rem; bottom: calc(100% + .5rem); background: rgba(23,35,58,.6); color: #dfe6f8; border: 1px solid rgba(255,255,255,.25); font: inherit; font-size: .75rem; padding: .3rem .8rem; border-radius: 999px; cursor: pointer; z-index: 4; }
.hist-toggle:hover { border-color: var(--accent); color: #fff; }
.history-panel { position: fixed; top: 0; right: 0; bottom: calc(var(--input-h) + env(safe-area-inset-bottom, 0px) + var(--kb)); width: min(92vw, 380px); background: rgba(23,35,58,.97); border-left: 2px solid var(--accent); transform: translateX(105%); transition: transform .25s ease; z-index: 30; display: flex; flex-direction: column; color: #fff; }
.history-panel.open { transform: translateX(0); }
.hp-head { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; font-family: var(--font-display); font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.15); }
.hp-close { background: none; border: none; color: #dfe6f8; font-size: 1.4rem; cursor: pointer; }
.history { margin: 0; padding: .8rem; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: .6rem; }
.history .msg { max-width: 88%; padding: .55rem .9rem; font-size: .88rem; border-radius: 14px; margin: 0; min-height: 0; }
.history .msg.user { align-self: flex-end; background: var(--theme, #2b4fb5); border-bottom-right-radius: 4px; }
.history .msg.guide { align-self: flex-start; background: rgba(255,255,255,.1); border-bottom-left-radius: 4px; }
.history .msg .who { font-size: .65rem; color: var(--accent); display: block; }

.input-bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--ink-2); border-top: 2px solid var(--accent); padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom)); transform: translateY(calc(-1 * var(--kb))); z-index: 20; }
.input-bar .inner { max-width: 760px; margin: 0 auto; display: flex; gap: .5rem; align-items: center; }
.input-bar input[type=text] { flex: 1; background: var(--ink); border: 1px solid rgba(255,255,255,.25); color: #fff; padding: .7rem 1rem; font-size: 1rem; font-family: var(--font-body); border-radius: 999px; min-height: 44px; min-width: 0; }
.input-bar input[type=text]:focus { outline: 2px solid var(--accent); }
.input-bar .btn { min-width: 44px; padding: .6em 1.1em; }
.input-bar .btn.mic { background: transparent; border: 2px solid rgba(255,255,255,.35); color: #fff; padding: 0; width: 44px; height: 44px; font-size: 1.15rem; }
.input-bar .btn.mic.rec { border-color: var(--coral); color: var(--coral); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(226,87,76,.5); } 50% { box-shadow: 0 0 0 8px rgba(226,87,76,0); } }
.input-bar .btn.send { background: var(--accent); color: var(--ink); }
.input-bar .btn.send:hover { filter: brightness(.95); }
.powered { position: absolute; left: .9rem; bottom: calc(100% + .4rem); font-size: .68rem; color: rgba(255,255,255,.55); z-index: 4; }
.powered a { color: inherit; }

/* ---- キオスクモード（施設設置・大画面） ---- */
body.kiosk { --input-h: 112px; }
body.kiosk .stage-back { display: none; }
body.kiosk .speech-full { font-size: 1.35rem; line-height: 1.7; max-height: 7em; }
body.kiosk .name-plate { font-size: 1.15rem; }
body.kiosk .input-bar input[type=text] { font-size: 1.2rem; min-height: 56px; }
body.kiosk .input-bar .btn { min-height: 56px; font-size: 1.1rem; }
body.kiosk .input-bar .btn.mic { width: 72px; height: 72px; font-size: 1.8rem; background: var(--accent); color: var(--ink); border-color: var(--accent); }
body.kiosk .input-bar .btn.mic.rec { background: var(--coral); border-color: var(--coral); color: #fff; }
body.kiosk .hist-toggle { display: none; }
.attract { position: fixed; inset: 0; z-index: 60; display: none; place-items: center; text-align: center; background: rgba(23,35,58,.55); color: #fff; cursor: pointer; padding: 2rem; }
.attract.on { display: grid; }
.attract h2 { font-size: clamp(1.6rem, 4vw, 3rem); color: #fff; text-shadow: 0 2px 20px rgba(0,0,0,.5); }
.attract p { font-size: 1.2rem; }
.attract .tap { display: inline-block; margin-top: 1rem; background: var(--accent); color: var(--ink); font-family: var(--font-display); font-weight: 900; padding: .8em 2em; border-radius: 999px; font-size: 1.2rem; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ---- 埋め込み（iframe内） ---- */
body.embed .stage-back { display: none; }
