/* AiFriend — 植物の多いカフェ風 / 柔らかい緑＋白＋オレンジがかったベージュ / グラスモーフィズム */

:root {
  --bg: #f7f3ea;            /* オレンジがかったベージュの下地 */
  --ink: #2b2f28;           /* 緑みのある温かいダーク */
  --muted: #79806f;         /* 落ち着いたグレイッシュグリーン */
  --line: rgba(45, 50, 35, 0.10);
  --glass: rgba(255, 255, 255, 0.6);
  --glass-strong: rgba(255, 255, 255, 0.8);
  --accent: #6fa86e;        /* 柔らかい葉の緑 */
  --accent-2: #e0a96d;      /* オレンジがかったベージュ */
  --radius: 18px;
  --shadow: 0 12px 40px rgba(70, 80, 55, 0.12);
  --shadow-sm: 0 4px 16px rgba(70, 80, 55, 0.08);
}

/* 手書きフォント（ロゴ・キービジュアル見出し用）。
   app/assets/fonts/yorusugara.ttf を propshaft が配信（本番もフィンガープリント付きで配信）。
   未読込時は font-display:swap で Yomogi(Google Fonts) → 丸ゴシックへフォールバック。 */
@font-face {
  font-family: "Yorusugara Tegaki";
  src: url("/assets/yorusugara-c14ded58.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
.lp-handwriting,
.lp-top .lp-title,
.lp-top .lp-badge,
.lp-top-head h2 {
  font-family: "Yorusugara Tegaki", "Yomogi", "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif;
  font-weight: 700;
  letter-spacing: .04em;
}
/* メインキャッチ(.lp-title)は単一ウェイトのため縁取りで太さを補強 */
.lp-top .lp-title { -webkit-text-stroke: 0.9px var(--ink); }
.lp-top .lp-title .grad { -webkit-text-stroke: 0.9px #5b9a61; }

* { box-sizing: border-box; }
/* hidden 属性を確実に効かせる（.btn 等の display 指定が UA の [hidden] を上書きしてしまうため） */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ---- ぼかしオーロラ背景 ---- */
.bg-aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(180deg, #fdfbf4 0%, #f4f0e5 100%); }
.bg-aurora .blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; }
.blob-1 { width: 46vw; height: 46vw; left: -8vw; top: -10vw; background: radial-gradient(circle at 30% 30%, #bcdcb2, transparent 70%); }
.blob-2 { width: 42vw; height: 42vw; right: -10vw; top: 6vw; background: radial-gradient(circle at 60% 40%, #f3dcb4, transparent 70%); }
.blob-3 { width: 40vw; height: 40vw; left: 24vw; bottom: -16vw; background: radial-gradient(circle at 50% 50%, #d2e8c6, transparent 70%); }

/* ---- ヘッダー / フッター ---- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; letter-spacing: .2px; }
.brand-mark { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 19px; }
.site-nav { display: flex; align-items: center; gap: 18px; }
.site-nav a, .site-nav .linkish { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; background: none; border: none; cursor: pointer; padding: 4px 2px; font-family: inherit; }
.site-nav a:hover, .site-nav .linkish:hover { color: var(--ink); }
.site-nav a.active { color: var(--accent); }

.site-footer { margin-top: auto; display: flex; align-items: center; gap: 8px; justify-content: center; padding: 22px; font-size: 13px; color: var(--muted); }
.site-footer .muted { color: #9aa0ad; }
.footer-mark { width: 18px; height: 18px; vertical-align: middle; flex: none; }
.site-footer a.muted { text-decoration: none; }
.site-footer a.muted:hover { color: var(--ink); text-decoration: underline; }

.site-main { flex: 1; width: 100%; }

/* ---- フラッシュ ---- */
.flash { max-width: 920px; margin: 16px auto 0; padding: 12px 18px; border-radius: 12px; font-size: 14px; backdrop-filter: blur(10px); }
.flash.notice { background: rgba(209, 250, 229, 0.7); color: #065f46; border: 1px solid rgba(16,185,129,.2); }
.flash.alert { background: rgba(255, 228, 226, 0.7); color: #9f1239; border: 1px solid rgba(244,63,94,.2); }

/* ---- ページ ---- */
.page { max-width: 920px; margin: 0 auto; padding: 36px 22px 10px; }
.page.narrow { max-width: 620px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 700; margin: 0; letter-spacing: .2px; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.head-actions { display: flex; gap: 10px; align-items: center; }
.muted { color: var(--muted); font-size: 13px; }

/* ---- ボタン ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass-strong); color: var(--ink); cursor: pointer; text-decoration: none; font-size: 14px; font-weight: 600; font-family: inherit; transition: transform .08s ease, box-shadow .15s ease, background .15s ease; backdrop-filter: blur(8px); }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: none; box-shadow: 0 8px 22px rgba(111,168,110,.30); }
.btn.ghost { background: rgba(255,255,255,0.5); }
.btn.small { padding: 7px 12px; font-size: 12.5px; border-radius: 10px; }
.btn.danger { color: #e11d48; border-color: rgba(225,29,72,.25); background: rgba(255,255,255,0.55); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---- グラスカード ---- */
.glass { background: var(--glass); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px); border: 1px solid rgba(255,255,255,.7); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---- キャラ一覧 ---- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.char-card { background: var(--glass); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px); border: 1px solid rgba(255,255,255,.7); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; justify-content: space-between; min-height: 190px; transition: transform .12s ease, box-shadow .15s ease; }
.char-card:hover { transform: translateY(-3px); box-shadow: 0 18px 48px rgba(70, 80, 55,.14); }
.char-card .avatar-chip { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; margin-bottom: 12px; }
.char-card img.avatar-chip { object-fit: cover; }
.char-card h3 { margin: 0 0 2px; font-size: 17px; }
.char-card .personality-preview { font-size: 13px; color: var(--muted); margin: 8px 0 0; line-height: 1.5; }
.char-card-actions { display: flex; gap: 8px; align-items: center; margin-top: 16px; }
.char-card.add { align-items: center; justify-content: center; text-align: center; border-style: dashed; border-color: rgba(111,168,110,.35); background: rgba(255,255,255,.4); color: var(--accent); gap: 6px; text-decoration: none; font-weight: 600; }
.char-card.add small { color: var(--muted); font-weight: 400; }
.char-card.add.disabled { color: var(--muted); border-color: var(--line); }

/* ---- フォーム ---- */
.form { display: flex; flex-direction: column; gap: 16px; background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,.7); padding: 26px; border-radius: var(--radius); box-shadow: var(--shadow); }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: #4b5060; flex: 1; }
.form input, .form textarea, .form select { padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; font-family: inherit; background: rgba(255,255,255,.85); color: var(--ink); transition: border .15s, box-shadow .15s; }
.form input:focus, .form textarea:focus, .form select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(111,168,110,.15); }
.form textarea { resize: vertical; line-height: 1.6; }
.form .row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.form small.muted { font-weight: 400; }
.errors { background: rgba(255,228,226,.7); color: #9f1239; padding: 12px 16px; border-radius: 12px; font-size: 13px; }
.errors p { margin: 2px 0; }

/* ---- テーブル（モデルマスタ） ---- */
.table { width: 100%; border-collapse: collapse; background: var(--glass); backdrop-filter: blur(16px); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { background: rgba(255,255,255,.5); font-size: 12px; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; }
.table tr:last-child td { border-bottom: none; }
.row { display: flex; gap: 8px; align-items: center; }
pre.json { background: #1b1d2a; color: #d6d8e8; padding: 18px; border-radius: 14px; overflow: auto; font-size: 12px; line-height: 1.6; }

/* ---- プラン ---- */
.plan-card { display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.plan-badge { display: inline-block; padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.plan-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.plan-row:last-of-type { border-bottom: none; }

/* ---- 認証ページ（Devise）を中央に ---- */
.auth-wrap { max-width: 420px; margin: 8vh auto; padding: 0 20px; }
.auth-card { padding: 30px; }
.auth-card h2 { margin: 0 0 18px; font-size: 22px; display: flex; align-items: center; gap: 8px; }
.auth-logo { width: 30px; height: 30px; flex: none; }
.auth-card .field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.auth-card .field input { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; background: rgba(255,255,255,.85); }
.auth-links { margin-top: 16px; font-size: 13px; text-align: center; }
.auth-links a { color: var(--accent); }

/* ============ ルーム（音声チャット・没入レイアウト） ============ */
.room-body { margin: 0; height: 100dvh; overflow: hidden; background: #0e0e14; }
.room { position: relative; width: 100vw; height: 100dvh; overflow: hidden; }
#canvas { display: block; width: 100%; height: 100%; touch-action: manipulation; }

/* フローティングUIはタップでまとめて表示/非表示（没入モード） */
.chrome { transition: opacity .25s ease, transform .25s ease; }
.room.chrome-hidden .chrome { opacity: 0; pointer-events: none; transform: translateY(-4px); }

/* フローティングボタン共通（グラス） */
.fab { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid rgba(255,255,255,.6); background: rgba(255,255,255,.82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); color: #2b2f28; font-weight: 600; font-size: 14px; font-family: inherit; text-decoration: none; cursor: pointer; box-shadow: var(--shadow-sm); }
.fab.pill { padding: 10px 16px; border-radius: 999px; }
.fab.round { width: 46px; height: 46px; border-radius: 50%; font-size: 19px; padding: 0; }
.fab:hover { background: #fff; }

/* 上バー：退室 + 名前 + メニュー */
.room-top { position: absolute; top: 0; left: 0; right: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top) + 14px) 16px 14px; }
.room-name { flex: 1; text-align: center; font-weight: 700; font-size: 14px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.5); pointer-events: none; }

/* 右上メニュー（普段使わない操作を格納） */
.room-menu-wrap { position: relative; }
.room-menu { position: absolute; top: 54px; right: 0; display: flex; flex-direction: column; gap: 4px; padding: 8px; min-width: 170px; border-radius: 14px; background: rgba(255,255,255,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,.7); box-shadow: var(--shadow); }
.room-menu[hidden] { display: none; }
.room-menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 10px 12px; border: none; border-radius: 10px; background: none; cursor: pointer; font-size: 14px; font-family: inherit; color: var(--ink); }
.room-menu button:hover { background: rgba(111,168,110,.12); }

/* 履歴ボタン（右下フローティング） */
.history-fab { position: absolute; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 148px); z-index: 30; }

/* 下部の主役コントロール */
.room-bottom { position: absolute; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px 16px calc(env(safe-area-inset-bottom) + 20px); background: linear-gradient(180deg, transparent, rgba(0,0,0,.30)); pointer-events: none; }
.room-bottom > * { pointer-events: auto; }
/* 聞き取り中インジケータ（listening のときだけ表示） */
.listen-indicator { display: none; align-items: center; gap: 8px; padding: 7px 16px; border-radius: 999px; background: rgba(255,255,255,.88); color: #4e8a55; font-size: 13px; font-weight: 700; box-shadow: var(--shadow-sm); }
.listen-indicator.on { display: inline-flex; }
.listen-indicator .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: listenPulse 1.1s ease-in-out infinite; }
@keyframes listenPulse { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1.15); opacity: 1; } }

#start-btn { min-width: 220px; padding: 15px 28px; border-radius: 999px; border: none; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; font-size: 16px; cursor: pointer; box-shadow: 0 10px 26px rgba(111,168,110,.45); transition: background .2s ease, box-shadow .2s ease, color .2s ease; }
#start-btn:disabled { opacity: .55; cursor: not-allowed; }
/* 会話中の「やめる」は控えめなガラス調に（主張しすぎない） */
#start-btn.active { min-width: 0; padding: 11px 22px; font-size: 14px; font-weight: 600; background: rgba(45,50,35,.42); color: #fff; box-shadow: var(--shadow-sm); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
#start-btn.active:hover { background: rgba(45,50,35,.55); }
#status { font-size: 11px; color: #fff; text-shadow: 0 1px 5px rgba(0,0,0,.55); text-align: center; white-space: pre-wrap; line-height: 1.5; min-height: 16px; max-width: 320px; }

/* 履歴シート（下からスライド） */
.sheet-backdrop { position: absolute; inset: 0; z-index: 40; background: rgba(0,0,0,.3); opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease; }
.sheet-backdrop.open { opacity: 1; visibility: visible; }
.history-sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 41; display: flex; flex-direction: column; gap: 10px; max-height: 68dvh; padding: 8px 18px calc(env(safe-area-inset-bottom) + 18px); background: rgba(255,255,255,.93); backdrop-filter: saturate(160%) blur(22px); -webkit-backdrop-filter: saturate(160%) blur(22px); border-radius: 20px 20px 0 0; box-shadow: 0 -14px 40px rgba(0,0,0,.22); transform: translateY(102%); visibility: hidden; transition: transform .28s ease, visibility .28s ease; }
.history-sheet.open { transform: translateY(0); visibility: visible; }
.sheet-grip { width: 42px; height: 5px; border-radius: 999px; background: rgba(0,0,0,.18); margin: 6px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h3 { margin: 0; font-size: 16px; }
#chat { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; line-height: 1.55; padding-right: 4px; }
#chat:empty::before { content: "まだ会話はありません。"; color: var(--muted); font-size: 13px; }
.msg { padding: 8px 12px; border-radius: 14px; max-width: 92%; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.msg.ai { align-self: flex-start; background: rgba(0,0,0,.05); border: 1px solid var(--line); }
.msg.system { align-self: center; background: rgba(111,168,110,.12); color: #4e8a55; border: 1px dashed rgba(111,168,110,.4); font-size: 12px; max-width: 100%; text-align: center; }

/* 管理画面 */
.admin-tag { font-size: 11px; padding: 2px 9px; border-radius: 999px; background: #2b2f28; color: #fff; margin-left: 8px; font-weight: 700; letter-spacing: .04em; }
.admin-header { border-bottom: 1px solid rgba(29,32,48,.12); }

/* 部屋マスタのサムネ */
.room-thumb { width: 100%; height: 90px; border-radius: 12px; background-size: cover; background-position: center; margin-bottom: 10px; border: 1px solid var(--line); }

/* フォーム内の画像プレビュー */
.form-preview { display: block; max-width: 220px; border-radius: 10px; margin-bottom: 8px; border: 1px solid var(--line); }

/* 声の調整スライダー */
.voice-tune { background: rgba(255,255,255,.5); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.voice-tune .sec-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.slider-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end; }
.slider { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: #4b5060; }
.slider input[type=range] { width: 100%; accent-color: var(--accent); }
.slider-val { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 700; font-size: 13px; }
.preview-row { align-items: center; }
.preview-row #preview-text { flex: 1; min-width: 200px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; background: rgba(255,255,255,.85); }

/* アイコンサムネ（管理一覧） */
.icon-thumb { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; }
.icon-thumb.placeholder { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; }

/* モデル選択トリガー */
.model-trigger { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.85); cursor: pointer; font-size: 14px; text-align: left; }
.model-trigger:hover { border-color: var(--accent); }
.model-trigger-icon img, .model-trigger-icon .icon-thumb { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.model-trigger-label { flex: 1; font-weight: 600; color: var(--ink); }
.model-trigger-label.muted { color: var(--muted); font-weight: 400; }
.model-trigger-caret { color: var(--muted); }

/* モーダル */
.modal-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(45, 50, 35,.35); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay[hidden] { display: none; }
.modal { background: rgba(255,255,255,.92); backdrop-filter: blur(18px); border: 1px solid rgba(255,255,255,.7); border-radius: 20px; box-shadow: var(--shadow); width: 100%; max-width: 640px; max-height: 80vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; padding: 20px; overflow-y: auto; align-items: start; align-content: start; grid-auto-rows: min-content; }
.model-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 10px; border: 2px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; transition: .12s; }
.model-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.model-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(111,168,110,.18); }
.model-card-icon img { width: 88px; height: 88px; border-radius: 14px; object-fit: cover; }
.model-card-icon .icon-thumb { width: 88px; height: 88px; border-radius: 14px; font-size: 30px; }
.model-card-label { font-size: 13px; font-weight: 600; text-align: center; }

/* ボイス選択モーダル（話者ごとグルーピング） */
.voice-search { padding: 14px 22px 4px; }
.voice-search input { width: 100%; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; background: rgba(255,255,255,.9); }
.voice-search input:focus { outline: none; border-color: var(--accent); }
.voice-groups { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 22px 20px; display: flex; flex-direction: column; gap: 16px; }
.voice-group-name { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: #4b5060; position: sticky; top: 0; background: rgba(255,255,255,.92); padding: 4px 0; }
.voice-styles { display: flex; flex-wrap: wrap; gap: 8px; }
.voice-style { display: inline-flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; transition: .12s; }
.voice-style:hover { border-color: var(--accent); }
.voice-style.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(111,168,110,.18); }
.voice-sample { border: none; background: rgba(111,168,110,.1); color: var(--accent); cursor: pointer; padding: 0 11px; font-size: 12px; display: flex; align-items: center; border-right: 1px solid var(--line); }
.voice-sample:hover { background: rgba(111,168,110,.2); }
.voice-sample.playing { background: var(--accent); color: #fff; }
.voice-pick { border: none; background: none; cursor: pointer; padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--ink); }
.voice-style.selected .voice-pick { color: var(--accent); }

/* モデル選択フィールド */
.model-field { display: flex; flex-direction: column; gap: 6px; }
.model-field .field-label { font-size: 13px; font-weight: 600; color: #4b5060; }

/* 表情エディタ */
.expr-editor { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: stretch; }
.expr-stage { position: relative; min-height: 460px; border-radius: var(--radius); overflow: hidden; background: #10101a; border: 1px solid var(--line); }
.expr-stage canvas { width: 100%; height: 100%; display: block; }
.expr-panel { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.expr-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.expr-tab { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 12px; cursor: pointer; }
.expr-tab.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: none; }
.expr-gesture { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; background: rgba(255,255,255,.85); }
#expr-sliders { display: flex; flex-direction: column; gap: 10px; max-height: 40vh; overflow-y: auto; padding-right: 4px; }
#expr-sliders .slider { font-size: 12.5px; }
#expr-sliders input[type=range] { width: 100%; accent-color: var(--accent); }
/* exp3: 感情ごとの表現セット */
#expr-sets { max-height: 48vh; overflow-y: auto; padding-right: 4px; display: flex; flex-direction: column; gap: 10px; }
.expr-set { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: rgba(255,255,255,.6); }
.expr-set-head { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 700; color: #4b5060; margin-bottom: 8px; }
.set-row { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: #6b7180; margin-bottom: 8px; }
.set-row:last-child { margin-bottom: 0; }
.set-row select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 13.5px; background: rgba(255,255,255,.9); font-family: inherit; }
@media (max-width: 760px) { .expr-editor { grid-template-columns: 1fr; } .expr-stage { min-height: 340px; } }

/* 表情エディタのズーム */
.expr-zoom { position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.82); backdrop-filter: blur(10px); padding: 7px 12px; border-radius: 999px; font-size: 12px; box-shadow: var(--shadow-sm); }
.expr-zoom input[type=range] { width: 120px; accent-color: var(--accent); }

/* 表情エディタ 表示切替ボタン */
.expr-view-btn { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 11px; cursor: pointer; }
.expr-view-btn.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: none; }

/* 部屋ピッカー（横長サムネ） */
.model-trigger-icon.room img { width: 64px; height: 40px; border-radius: 8px; object-fit: cover; }
.model-card-icon { display: block; }
.room-card .model-card-icon.room { display: block; width: 100%; height: 64px; overflow: hidden; border-radius: 10px; }
.room-card .model-card-icon.room img { display: block; width: 100%; height: 64px; border-radius: 10px; object-fit: cover; }
.room-card .model-card-icon.room .icon-thumb { display: flex; align-items: center; justify-content: center; width: 100%; height: 64px; border-radius: 10px; }
.room-card { grid-column: span 1; }

/* トリガー内アイコンの高さを固定（縦伸び防止） */
.model-trigger-icon { flex: 0 0 auto; height: 40px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.model-trigger-icon.room { width: 64px; }
.model-trigger { min-height: 60px; }

/* ============================================================
   ランディングページ
   ============================================================ */
.lp-nav { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; padding: 14px 28px; background: rgba(255,255,255,.6); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); border-bottom: 1px solid var(--line); }
.lp-nav-actions { display: flex; align-items: center; gap: 10px; }

.grad { background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ヒーロー */
.lp-hero { max-width: 1120px; margin: 0 auto; padding: 64px 28px 40px; display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
.lp-badge { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: rgba(111,168,110,.10); color: var(--accent); font-size: 13px; font-weight: 700; border: 1px solid rgba(111,168,110,.2); }
.lp-title { font-size: clamp(34px, 5vw, 56px); line-height: 1.12; letter-spacing: .5px; margin: 18px 0 0; font-weight: 800; }
.lp-lead { font-size: 16.5px; line-height: 1.85; color: #50566a; margin: 20px 0 0; max-width: 540px; }
.lp-cta-row { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.lp-cta-row.center { justify-content: center; }
.lp-cta-row .btn { padding: 13px 26px; font-size: 15px; }
.lp-note { font-size: 12.5px; color: var(--muted); margin-top: 14px; }

/* 画像差し替えエリア（色付きで一目でわかる） */
.img-ph { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; border: 2px dashed rgba(111,168,110,.5); border-radius: 18px; background: repeating-linear-gradient(45deg, rgba(111,168,110,.08), rgba(111,168,110,.08) 12px, rgba(224,169,109,.08) 12px, rgba(224,169,109,.08) 24px); color: #4e8a55; font-weight: 700; font-size: 14px; }
.img-ph small { font-weight: 500; color: #8a9a7e; font-size: 11.5px; max-width: 80%; line-height: 1.5; }
.img-ph-hero { aspect-ratio: 4 / 3; box-shadow: var(--shadow); }
.img-ph-wide { aspect-ratio: 16 / 10; box-shadow: var(--shadow); }
.img-ph-icon { width: 56px; height: 56px; border-radius: 16px; font-size: 11px; }
.img-ph-icon span { font-size: 11px; }
.img-ph-card { width: 100%; aspect-ratio: 16 / 9; margin-bottom: 14px; }

/* 最上部のキービジュアル背景（ナビ〜見出しまでを1枚の画像に乗せる） */
/* 高さを画像のアスペクト比(約1.66)に合わせ、画像全体が見切れず収まるようにする */
.lp-top { position: relative; overflow: hidden; min-height: clamp(620px, 60vw, 900px); }
/* 背景画像の差し替えエリア（領域全体を覆う）。実画像は background-image か <img class="lp-top-bg"> に差し替え。 */
.lp-top-bg { position: absolute; inset: 0; z-index: 0; border-radius: 0; border-width: 0; }
.lp-top-bg.img-ph { border: none; }                 /* 全面なので破線枠は出さない */
.lp-top-bg span { font-size: 16px; }
img.lp-top-bg { width: 100%; height: 100%; object-fit: cover; object-position: center top;
  /* 下端をなめらかにフェードさせ、サイト背景へ自然につなぐ（ソファを残すため開始位置は下げる） */
  -webkit-mask-image: linear-gradient(180deg, #000 80%, rgba(0,0,0,.5) 92%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 80%, rgba(0,0,0,.5) 92%, transparent 100%); }
/* テキストを読みやすくするスクリム（実画像差し替え後も崩れない） */
.lp-top::after { content: ""; position: absolute; inset: 0; z-index: 0; background: linear-gradient(180deg, rgba(255,255,255,.45), rgba(255,255,255,.30) 45%, rgba(255,255,255,.72)); pointer-events: none; }
.lp-top-inner { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 78px 28px 8px; }
/* 追従ナビ（固定。最上部は透明、スクロールでガラス背景が出る） */
.lp-nav-over { position: fixed; top: 0; left: 0; right: 0; z-index: 40; background: transparent; border-bottom: 1px solid transparent; transition: background .25s ease, box-shadow .25s ease, border-color .25s ease; }
.lp-nav-inner { max-width: 1120px; margin: 0 auto; padding: 12px 28px; display: flex; align-items: center; justify-content: space-between; }
.lp-nav-over.scrolled { background: rgba(255,255,255,.72); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); border-bottom-color: var(--line); box-shadow: var(--shadow-sm); }
/* テキストロゴ（手書きフォント＋淡いグラデ＋右上がり）。細く繊細・素朴に。 */
.logo-text {
  display: inline-block;
  font-family: "Yorusugara Tegaki", "Yomogi", "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif;
  font-weight: 400;
  letter-spacing: .07em;
  line-height: 1;
  background: linear-gradient(95deg, #f3bcd6 0%, #cbb8f0 50%, #b6d6f0 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  transform: rotate(-2.5deg);
  /* 淡さは保ちつつ、やわらかいラベンダー影で輪郭を出す（白背景でも視認できる） */
  filter: drop-shadow(0 1px 2px rgba(150,140,180,.34));
}
.brand .logo-text { font-size: 25px; }
.lp-hero-logo { display: block; width: max-content; font-size: clamp(42px, 6vw, 62px); margin: 0 0 10px; transform: rotate(-3deg); transform-origin: left center; }
.lp-top .lp-hero { display: block; max-width: 760px; padding: 40px 0 36px; }
.lp-top .lp-hero-copy { max-width: 620px; }
.lp-top-head { text-align: center; padding: 8px 0 56px; }
.lp-top-head h2 { font-size: clamp(24px, 3.4vw, 34px); font-weight: 600; margin: 0 0 10px; }
.lp-top-head p { margin: 0; }

/* セクション共通 */
.lp-section { max-width: 1120px; margin: 0 auto; padding: 56px 28px; }
.lp-section-head { text-align: center; margin-bottom: 38px; }
.lp-section-head h2 { font-size: clamp(24px, 3.4vw, 34px); font-weight: 600; margin: 0 0 10px; }

/* 特徴 */
.lp-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.lp-feature { padding: 26px 24px; border-radius: 20px; }
.lp-feature h3 { font-size: 17px; margin: 16px 0 8px; }
.lp-feature p { font-size: 14px; color: #545a6c; line-height: 1.75; margin: 0; }

/* スプリット（つけっぱなし） */
.lp-split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.lp-split-copy h2 { font-size: clamp(24px, 3.4vw, 34px); font-weight: 800; line-height: 1.2; margin: 12px 0 16px; }
.lp-split-copy p { font-size: 15.5px; color: #545a6c; line-height: 1.85; margin: 0 0 24px; }
.lp-kicker { font-size: 12px; font-weight: 800; letter-spacing: .16em; color: var(--accent); }

/* こんな人に */
.lp-usecases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.lp-usecase { padding: 22px; border-radius: 20px; }
.lp-usecase h3 { font-size: 16.5px; margin: 0 0 8px; }
.lp-usecase p { font-size: 13.5px; color: #545a6c; line-height: 1.7; margin: 0; }

/* 最終CTA */
.lp-final { max-width: 880px; margin: 24px auto 64px; padding: 52px 28px; border-radius: 28px; text-align: center; }
.lp-final h2 { font-size: clamp(24px, 3.6vw, 36px); font-weight: 800; margin: 0 0 10px; }

/* レスポンシブ */
@media (max-width: 860px) {
  .lp-hero { grid-template-columns: 1fr; gap: 28px; padding-top: 40px; }
  .lp-hero-art { order: -1; }
  .lp-features, .lp-usecases { grid-template-columns: 1fr; }
  .lp-split { grid-template-columns: 1fr; gap: 24px; }
  .lp-split-art { order: -1; }
}

/* スマホ最適化 */
@media (max-width: 560px) {
  .lp-nav-inner { padding: 10px 16px; gap: 8px; }
  .lp-nav-actions { gap: 6px; }
  .lp-nav-actions .btn.small { padding: 7px 10px; font-size: 12px; }
  .brand .logo-text { font-size: 22px; }

  /* KV領域：スマホでは高さを抑え、文字の余白も詰める */
  .lp-top { min-height: 0; }
  .lp-top-inner { padding: 66px 18px 4px; }
  .lp-top .lp-hero { padding: 24px 0 28px; }
  .lp-hero-logo { font-size: 38px; margin-bottom: 8px; }
  .lp-title { font-size: 28px; line-height: 1.2; letter-spacing: .3px; }
  .lp-lead { font-size: 14.5px; line-height: 1.8; margin-top: 16px; }
  .lp-badge { font-size: 12px; }
  .lp-top-head { padding: 4px 0 36px; }
  .lp-top-head h2 { font-size: 22px; }

  /* セクション余白を圧縮 */
  .lp-section { padding: 40px 18px; }
  .lp-section-head { margin-bottom: 26px; }
  .lp-feature, .lp-usecase { padding: 20px 18px; }

  /* CTAはタップしやすいよう縦積み・全幅 */
  .lp-cta-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .lp-cta-row .btn { width: 100%; padding: 13px 18px; }

  .lp-final { margin: 16px 16px 48px; padding: 40px 22px; border-radius: 22px; }
  .lp-final h2 { font-size: 24px; }

  /* ログイン後の画面（ヘッダー付き）のスマホ最適化 */
  .page { padding: 24px 16px 10px; }
  .page-head { gap: 10px; margin-bottom: 18px; }
  .page-head h1 { font-size: 22px; }
  .site-header { padding: 10px 16px; }
  .site-nav { gap: 12px; }
  .form { padding: 20px 16px; }
  .form .row { flex-direction: column; gap: 12px; }   /* 2カラム行を縦積みに */
  .card-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   イントロアニメ（開いた瞬間は真っ白 → 中央から放射状に鮮明化）
   ============================================================ */
@property --intro-hole { syntax: "<percentage>"; inherits: false; initial-value: 0%; }

.intro-veil {
  position: fixed; inset: 0; z-index: 9000; background: #fff; pointer-events: none;
  -webkit-mask-image: radial-gradient(circle at 50% 42%, transparent var(--intro-hole), #fff calc(var(--intro-hole) + 18%));
          mask-image: radial-gradient(circle at 50% 42%, transparent var(--intro-hole), #fff calc(var(--intro-hole) + 18%));
  animation: introVeil 1.3s cubic-bezier(.22,.61,.36,1) forwards;
}
@keyframes introVeil {
  0%   { --intro-hole: 0%;   opacity: 1; }
  70%  { opacity: 1; }
  100% { --intro-hole: 140%; opacity: 0; visibility: hidden; }
}

/* 中央（ファーストビュー）のコンテンツはぼかし→鮮明にフェードイン */
.lp-top-inner { animation: introSharpen 1.3s cubic-bezier(.22,.61,.36,1) both; }
@keyframes introSharpen {
  0%   { filter: blur(16px); opacity: 0; transform: scale(1.014); }
  45%  { opacity: 1; }
  100% { filter: blur(0);    opacity: 1; transform: none; }
}

/* スクロールで各セクションがぼかし→鮮明にせり上がる（JS有効時のみ隠す） */
.reveal-ready .reveal { opacity: 0; filter: blur(10px); transform: translateY(20px);
  transition: opacity .7s ease, filter .7s ease, transform .7s ease; }
.reveal-ready .reveal.is-visible { opacity: 1; filter: blur(0); transform: none; }

@media (prefers-reduced-motion: reduce) {
  .intro-veil { display: none; }
  .lp-top-inner { animation: none; }
  .reveal-ready .reveal { opacity: 1; filter: none; transform: none; transition: none; }
}

/* 着替えモーダル（衣装リスト） */
.costume-list { padding: 18px; display: flex; flex-direction: column; gap: 10px; max-height: 70vh; overflow-y: auto; }
.costume-item { padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; transition: border .12s, box-shadow .12s; font-family: inherit; }
.costume-item:hover { border-color: var(--accent); }
.costume-item.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(111,168,110,.18); }

/* ============ PWA インストール導線 ============ */
.pwa-banner { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 16px); transform: translate(-50%, 160%); z-index: 60; display: flex; align-items: center; gap: 12px; width: calc(100% - 28px); max-width: 460px; padding: 12px 14px; border-radius: 18px; background: rgba(255,255,255,.96); backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px); border: 1px solid rgba(255,255,255,.7); box-shadow: var(--shadow); opacity: 0; visibility: hidden; transition: transform .35s cubic-bezier(.22,.61,.36,1), opacity .35s ease, visibility .35s; }
.pwa-banner.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.pwa-banner-icon { width: 46px; height: 46px; border-radius: 12px; flex: none; }
.pwa-banner-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.pwa-banner-body strong { font-size: 14px; }
.pwa-banner-body span { font-size: 12px; color: var(--muted); line-height: 1.45; }
.pwa-banner .btn { flex: none; white-space: nowrap; }
.pwa-banner-x { flex: none; width: 28px; height: 28px; border: none; background: rgba(0,0,0,.05); border-radius: 50%; color: var(--muted); cursor: pointer; font-size: 13px; }
.pwa-banner-x:hover { background: rgba(0,0,0,.1); }

.pwa-ios-steps { padding: 18px 22px 22px; font-size: 14px; line-height: 1.7; }
.pwa-ios-steps p { margin: 0 0 12px; }
.pwa-ios-steps ol { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.pwa-ios-steps .ios-share { display: inline-block; }

@media (max-width: 560px) {
  .pwa-banner-body span { font-size: 11.5px; }
}

/* ===== 法務ページ（利用規約・プライバシーポリシー） ===== */
.legal { max-width: 760px; margin: 0 auto; padding: 8px 4px 32px; line-height: 1.85; color: var(--ink); }
.legal h1 { font-size: 26px; margin: 8px 0 4px; }
.legal h2 { font-size: 17px; margin: 30px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.legal p { margin: 0 0 14px; }
.legal ul { margin: 0 0 14px; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.legal a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.legal .legal-meta { margin: 0 0 20px; font-size: 13px; }
.legal .legal-note { font-size: 13px; }
.legal .legal-warn { background: rgba(224, 169, 109, .14); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; font-size: 14px; }
.legal .legal-fill { color: var(--accent-2); font-weight: 600; }
.legal .legal-operator { list-style: none; padding-left: 0; }
.legal .legal-back { margin-top: 28px; }

/* ===== 登録フォームの規約同意チェックボックス ===== */
.agreement { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 2px; font-size: 13px; color: var(--muted); line-height: 1.6; font-weight: 400; }
.agreement input[type="checkbox"] { margin-top: 3px; flex: none; }
.agreement a { color: var(--accent); }

/* ===== 初回キャラ作成ウォークスルー ===== */
.wt { max-width: 560px; margin: 0 auto; }
.wt-progress { margin: 4px 0 22px; }
.wt-progress-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.wt-step-count { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .3px; }
.wt-cheer { font-size: 13px; font-weight: 700; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wt-bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.wt-bar-fill { display: block; height: 100%; width: 20%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .35s cubic-bezier(.22,1,.36,1); }

.wt-step { animation: wt-in .3s ease both; }
@keyframes wt-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.wt-title { font-size: 22px; margin: 0 0 6px; line-height: 1.4; }
.wt-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; line-height: 1.7; }
.wt-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.wt-field .field-label { font-size: 13px; font-weight: 600; color: #4b5060; }
.wt-field input[type="text"], .wt-field textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; font-family: inherit; background: rgba(255,255,255,.85); color: var(--ink); }
.wt-field input:focus, .wt-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(111,168,110,.15); }
.wt-hint { color: #e11d48; font-size: 13px; margin: 8px 0 0; }

.wt-nav { display: flex; gap: 10px; align-items: center; margin-top: 24px; }
.wt-nav .wt-next, .wt-nav .wt-finish { margin-left: auto; }

.wt-shake { animation: wt-shake .4s; }
@keyframes wt-shake { 10%,90% { transform: translateX(-1px); } 20%,80% { transform: translateX(2px); } 30%,50%,70% { transform: translateX(-4px); } 40%,60% { transform: translateX(4px); } }
