/* UKIYOai（スマホ向け）
   画面いっぱいの 3D の部屋の上に、リキッドグラス（すりガラスに、縁の光と影）の吹き出しとボタンを重ねる（2026-11-12 の案A。D-48）。
   ガラスは 2 組: 部屋が明るいあいだは白いガラス、暗くなったら暗いガラス（body の data-glass。main.js の syncGlass）。
   ガラスの中のボタンには、ガラスを重ねず、白（暗いガラスでは薄い白）で塗る。色を付けるのは、押してほしいボタンだけ（ローズ）。
   縦（portrait）と横（landscape）で並びを変える（body の data-orient。main.js）。 */
:root {
  --font: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  --logo: "Jost", "Futura", "Avenir Next", system-ui, sans-serif;
  --ink: #1e1a22;                  /* ガラスの上の字 */
  --ink-2: #3a3540;                /* 小さな字・説明（白いガラスの上でも 4.5 : 1 より濃い） */
  --muted: var(--ink-2);
  --accent: #c24a69;               /* 押してほしいボタン・選んでいるもの（ローズ。白い字で 4.5 : 1 より濃い） */
  --accent-shadow: rgba(150, 40, 75, .3);
  --red: #e5483f;
  --blue: #3d7ff0;                 /* フォーカスの枠 */
  /* 白いガラス（昼） */
  --glass: rgba(255, 255, 255, .6);
  --glass-dense: rgba(255, 255, 255, .68);      /* シート・メニュー・入力欄（字が多いので、少し濃く） */
  --glass-blur: blur(20px) saturate(190%) brightness(1.05);
  --glass-sheen: linear-gradient(165deg, rgba(255, 255, 255, .45) 0%, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0) 72%, rgba(255, 255, 255, .18) 100%);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, .9), inset 0 -1px 0 rgba(255, 255, 255, .3), inset 0 0 0 .5px rgba(255, 255, 255, .55), inset 0 0 24px rgba(255, 255, 255, .2);
  --glass-drop: 0 14px 36px rgba(34, 18, 30, .2), 0 2px 8px rgba(34, 18, 30, .12);
  /* 澄んだガラス（D-146。会話のログと入力欄。iOS の Liquid Glass のように、後ろの部屋が透けて見える。ぼかしは弱く、縁の光は強く）。
     字が後ろに負けないよう、字にうすい光のふち（--clear-halo）を付ける */
  --glass-clear: rgba(255, 255, 255, .46);                                 /* D-147: .3 だと字が見づらかったので .46 に。ぼかしも 10px → 18px */
  --glass-clear-blur: blur(18px) saturate(170%) brightness(1.08);
  --glass-clear-edge: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(255, 255, 255, .45), inset 0 0 0 1px rgba(255, 255, 255, .5), inset 0 0 30px rgba(255, 255, 255, .22);
  --clear-halo: 0 0 2px rgba(255, 255, 255, .95), 0 0 8px rgba(255, 255, 255, .85);
  --fill: rgba(255, 255, 255, .62);             /* ガラスの中のボタン */
  --fill-on: rgba(255, 255, 255, .84);          /* 選んでいるもの（タブ・メニュー） */
  --fill-edge: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 0 0 .5px rgba(30, 26, 34, .06), 0 1px 2px rgba(30, 26, 34, .06);
  --card: rgba(255, 255, 255, .5);              /* 設定のまとまり・ポーズのカード */
  --card-edge: inset 0 1px 0 rgba(255, 255, 255, .95);
  --well: rgba(30, 26, 34, .07);                /* 切り替えの溝・押せないボタン */
  --seg-on: #fff;
  --hair: rgba(30, 26, 34, .14);                /* 区切りの線 */
  --her: rgba(255, 255, 255, .68);
  --you: rgba(208, 223, 236, .74);
  --sys: rgba(48, 44, 58, .64);
  --bubble-edge: inset 0 1px 0 rgba(255, 255, 255, .9), inset 0 0 0 .5px rgba(255, 255, 255, .5), 0 6px 18px rgba(34, 18, 30, .13);
  --chip: rgba(255, 255, 255, .5);
  --chip-edge: inset 0 0 0 1.5px rgba(255, 255, 255, .95), inset 0 0 14px rgba(255, 255, 255, .4), 0 6px 18px rgba(34, 18, 30, .15);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --kb: 0px;                       /* 画面のキーボードの高さ（main.js が visualViewport から入れる） */
  --safe-kb: var(--safe-b);        /* 文字を打っているときの下のよけ（キーボードが開いていれば、ホームバーはキーボードの裏なので 0） */
  --kb-talk: 112px;                /* キーボードが開いているときの、縦の吹き出しの欄の高さ（画面案 12〜15: 入力欄の上に 2 つくらい） */
  --kb-talk-onboard: 172px;        /* 同じく、オンボード（画面案 65〜67: 3 つ） */
  --tab-h: 64px;
  --ctl-h: 48px;
  --bar-h: 52px;                   /* 文字の入力欄の高さ（横は 46px） */
  --gap: 16px;
  --side: 14px;                    /* 画面の左右の端から、ガラスの部品まで */
  --bar-b: max(calc(var(--safe-b) - 4px), 12px);   /* いちばん下のガラス（タブ・スタート画面の台）の下の端。ホームバーの少し上 */
  color-scheme: light;
}
/* 暗いガラス（夜。部屋が暗いとき） */
body[data-glass="dark"] {
  --ink: #f4f1f8;
  --ink-2: #d2ccda;
  --glass: rgba(26, 24, 40, .55);
  --glass-dense: rgba(26, 24, 40, .66);
  --glass-blur: blur(20px) saturate(170%) brightness(.92);
  --glass-sheen: linear-gradient(165deg, rgba(255, 255, 255, .16) 0%, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0) 72%, rgba(255, 255, 255, .06) 100%);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, .28), inset 0 -1px 0 rgba(255, 255, 255, .08), inset 0 0 0 .5px rgba(255, 255, 255, .16), inset 0 0 24px rgba(255, 255, 255, .05);
  --glass-drop: 0 14px 36px rgba(0, 0, 10, .42), 0 2px 8px rgba(0, 0, 10, .24);
  --glass-clear: rgba(22, 20, 36, .5);
  --glass-clear-blur: blur(18px) saturate(160%) brightness(.85);
  --glass-clear-edge: inset 0 1px 0 rgba(255, 255, 255, .36), inset 0 -1px 0 rgba(255, 255, 255, .12), inset 0 0 0 1px rgba(255, 255, 255, .16), inset 0 0 30px rgba(255, 255, 255, .06);
  --clear-halo: 0 0 2px rgba(10, 8, 20, .95), 0 0 8px rgba(10, 8, 20, .85);
  --fill: rgba(255, 255, 255, .13);
  --fill-on: rgba(255, 255, 255, .24);
  --fill-edge: inset 0 1px 0 rgba(255, 255, 255, .2), inset 0 0 0 .5px rgba(255, 255, 255, .08);
  --card: rgba(255, 255, 255, .08);
  --card-edge: inset 0 1px 0 rgba(255, 255, 255, .12);
  --well: rgba(255, 255, 255, .09);
  --seg-on: rgba(255, 255, 255, .24);
  --hair: rgba(255, 255, 255, .16);
  --her: rgba(34, 32, 50, .62);
  --you: rgba(64, 84, 120, .62);
  --sys: rgba(12, 10, 20, .58);
  --bubble-edge: inset 0 1px 0 rgba(255, 255, 255, .2), inset 0 0 0 .5px rgba(255, 255, 255, .1), 0 6px 18px rgba(0, 0, 10, .3);
  --chip: rgba(255, 255, 255, .12);
  --chip-edge: inset 0 0 0 1.5px rgba(255, 255, 255, .5), inset 0 0 14px rgba(255, 255, 255, .08), 0 6px 18px rgba(0, 0, 10, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: #d9d6d2;
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }

#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* 画面の切り替え（寄り添い・オンボードの場面）: 切り替える前の絵を、キャラの顔から広がる円の外側にだけ重ねる */
.wipe { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; display: none; z-index: 1; }
.wipe.on { display: block; }

/* ---- ガラス（共通） ----
   後ろの部屋をぼかして色を濃くし（backdrop-filter）、縁に光の線と、左上から差す光（--glass-sheen）、下に影。
   ぼかしは、ガラスの親に mask・filter・opacity があると効かない（後ろの部屋まで届かない）ので、ガラスはそれらの外に置く */
.glass {
  background-color: var(--glass); background-image: var(--glass-sheen);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-edge), var(--glass-drop);
  color: var(--ink);
}
/* 色の付いたガラス（押してほしいボタン・入っているモード） */
.tinted, .glass.tinted {
  background: var(--accent) linear-gradient(180deg, rgba(255, 255, 255, .28) 0%, rgba(255, 255, 255, 0) 55%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -2px 6px rgba(0, 0, 0, .14), 0 10px 24px var(--accent-shadow);
}

/* ---- 共通の部品 ---- */
.pill {
  height: var(--ctl-h); padding: 0 20px; border-radius: 999px; border: 0;
  color: var(--ink); font-size: 14px; font-weight: 700; letter-spacing: .02em;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.pill svg { width: 18px; height: 18px; stroke-width: 2.2; }
.round {
  width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 0; color: var(--ink);
  display: grid; place-items: center;
}
.round svg { width: 20px; height: 20px; stroke-width: 1.8; }
.bar-divider { width: 1px; align-self: stretch; margin: 9px 0; background: var(--hair); }
/* 頭文字の丸（ユーザー）。色は、その人のパートナー */
.av {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: #fff; font-size: 16px; font-weight: 700; line-height: 1;
  background: linear-gradient(160deg, #8d8794, #5f5966);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -2px 5px rgba(0, 0, 0, .16);
}
.av svg { width: 52%; height: 52%; stroke-width: 1.8; }       /* 36px の丸で 19px。プロフィールの大きな丸でも同じ割合 */
.av.empty, .av.tool { background: var(--well); color: var(--ink-2); box-shadow: none; }
.av[data-partner="anna"] { background: linear-gradient(160deg, #da6584, #b23f5e); }
.av[data-partner="ritsu"] { background: linear-gradient(160deg, #6377d6, #3f52b3); }
.av[data-partner="siori"] { background: linear-gradient(160deg, #3aa092, #24766a); }
.av[data-partner="reika"] { background: linear-gradient(160deg, #a06bd4, #7a45b0); }
/* ユーザーのアイコン（12 個。D-50。形は js/icons.js）。アイコンがあれば、頭文字とパートナーの色の代わりに出す */
.av[data-icon="moon"] { background: linear-gradient(160deg, #7c6fd6, #4f43a8); }
.av[data-icon="star"] { background: linear-gradient(160deg, #f2c450, #d4962a); }
.av[data-icon="flower"] { background: linear-gradient(160deg, #e2789a, #b8436a); }
.av[data-icon="cat"] { background: linear-gradient(160deg, #a08a76, #6f5b49); }
.av[data-icon="cloud"] { background: linear-gradient(160deg, #6fb6e6, #3a7fc0); }
.av[data-icon="leaf"] { background: linear-gradient(160deg, #7cc06a, #3f8f3c); }
.av[data-icon="sun"] { background: linear-gradient(160deg, #f59a5b, #d9652a); }
.av[data-icon="snow"] { background: linear-gradient(160deg, #9fd8e6, #5aa7bd); }
.av[data-icon="note"] { background: linear-gradient(160deg, #b073d8, #7f45b2); }
.av[data-icon="drop"] { background: linear-gradient(160deg, #4dbfb6, #22887f); }
.av[data-icon="rabbit"] { background: linear-gradient(160deg, #b8a6c9, #8a77a0); }
.av[data-icon="wave"] { background: linear-gradient(160deg, #4f7fb0, #2c5684); }

/* ---- スタート画面（62・63・82）: 下に 1 枚のガラスの台。ユーザーは、カプセルから広がるガラスのメニューで選ぶ ---- */
.start { position: fixed; inset: 0; z-index: 5; display: none; cursor: pointer; }
body[data-screen="start"] .start { display: block; }
/* タイトル画面の形（D-200。依頼者が見せた画面の並べ方: 右下にキャラ・上に縦書きの言葉・左にロゴ・右上に丸いボタン・下に「タップしてはじめる」）。
   絵やロゴはまねず、浮世の部屋と 3D のキャラ（js/main.js の TITLE_CAM）で作る。上と下を少し暗くして、白い文字を読みやすくする */
.start::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(20, 18, 30, .42) 0%, rgba(20, 18, 30, 0) 30%, rgba(20, 18, 30, 0) 62%, rgba(20, 18, 30, .5) 100%);
}
.start-catch {
  position: absolute; top: calc(var(--safe-t) + 70px); left: 26%; margin: 0;
  writing-mode: vertical-rl; display: flex; flex-direction: column; gap: .5em;   /* 縦書きの段は、左へ並べる（column が横の向き） */
  font: 600 clamp(16px, 4.6vw, 21px) / 1.5 "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif; letter-spacing: .16em;
  color: #fff; text-shadow: 0 1px 10px rgba(0, 0, 0, .45); pointer-events: none;
}
.start-catch span:last-child { margin-top: 1.6em; }        /* 2 行目を少し下げて、段をつける */
.start-title { position: absolute; left: calc(18px + var(--safe-l)); top: 56%; transform: translateY(-50%); pointer-events: none; }
.logo {
  margin: 0; font: 600 clamp(38px, 11vw, 54px) / 1 var(--logo); letter-spacing: .04em; color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .35), 0 0 2px rgba(0, 0, 0, .25);
  pointer-events: none;            /* メニューを開くとロゴの上に重なる。iPhone の Safari では、ロゴがメニューのタップを取ってしまった */
}
.start-sub {
  margin: 10px 0 0; padding: 5px 12px; display: inline-block; border-radius: 4px; white-space: nowrap;
  font: 600 clamp(10px, 2.9vw, 12px) / 1.4 "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif; letter-spacing: .08em;
  color: #fff; background: rgba(40, 32, 56, .55); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}
.start-top { position: absolute; z-index: 1; top: calc(var(--safe-t) + 14px); right: calc(14px + var(--safe-r)); display: flex; gap: 12px; }
.start-round {
  width: 54px; padding: 0; border: 0; background: none; display: grid; justify-items: center; gap: 4px; color: #fff; cursor: pointer;
  font-size: 11px; font-weight: 700; text-shadow: 0 1px 6px rgba(0, 0, 0, .5);
}
.start-round svg {
  width: 48px; height: 48px; padding: 13px; box-sizing: border-box; border-radius: 50%; stroke: #fff; stroke-width: 2.2; fill: none;
  background: rgba(40, 34, 52, .42); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45); backdrop-filter: blur(8px);
}
.start-bottom {
  position: absolute; z-index: 1; left: calc(var(--side) + var(--safe-l)); right: calc(var(--side) + var(--safe-r)); bottom: calc(var(--bar-b) + 30px);
  max-width: 440px; margin: 0 auto;
}
.start-form { display: grid; justify-items: center; gap: 14px; }
.user-pick {
  width: auto; max-width: 100%; height: 44px; border: 0; border-radius: 22px; display: flex; align-items: center; gap: 10px; padding: 0 14px 0 6px;
  background: rgba(40, 34, 52, .45); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .4); backdrop-filter: blur(8px);
  color: #fff; font-size: 15px; font-weight: 700; text-align: left; cursor: pointer;
}
.user-pick .av { width: 32px; height: 32px; }
.user-pick.placeholder { font-weight: 500; color: rgba(255, 255, 255, .85); }
.user-pick[aria-expanded="true"] { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .4), 0 0 0 2px var(--accent); }
.user-pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-pick-chev { width: 18px; height: 18px; stroke-width: 2; flex: none; }
/* 「タップしてはじめる」（.start-tap）は D-204 で外した。ユーザーの一覧で選ぶと、そのまま入る */
.start-note { margin: 0; text-align: center; font-size: 12px; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .5); }
.start-ver { position: absolute; right: calc(14px + var(--safe-r)); bottom: calc(var(--bar-b) + 2px); margin: 0; font-size: 10px; color: rgba(255, 255, 255, .7); pointer-events: none; }
.user-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 10px); max-height: min(56vh, 430px);
  padding: 8px; border-radius: 30px; background-color: var(--glass-dense); display: flex; flex-direction: column;
  transform-origin: 50% 100%; animation: menu-in .22s cubic-bezier(.2, .8, .3, 1) both;
}
.menu-head { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 14px 6px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.menu-head b { font-size: 13px; letter-spacing: .04em; }
.menu-list { overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 2px; scrollbar-width: none; }
.menu-list::-webkit-scrollbar { display: none; }
.menu-item {
  width: 100%; min-height: 56px; flex: none; border: 0; border-radius: 22px; display: flex; align-items: center; gap: 12px;
  padding: 0 14px 0 10px; background: transparent; color: var(--ink); text-align: left;
}
.menu-item .name { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item .sub { flex: none; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.menu-item[aria-current="true"], .menu-item:active { background: var(--fill-on); box-shadow: var(--fill-edge); }
.menu-sep { flex: none; height: .5px; margin: 6px 14px; background: var(--hair); }
@keyframes menu-in { from { opacity: 0; transform: translateY(10px) scale(.94); } }

/* ---- 吹き出し（会話） ---- */
.talk {
  position: fixed; z-index: 3; display: none;
  left: calc(var(--side) + var(--safe-l)); right: calc(var(--side) + var(--safe-r));
  bottom: calc(var(--bar-b) + var(--tab-h) + 20px + var(--ctl-h) + 14px);
  height: calc(44vh - var(--talk-cut, 0px));   /* --talk-cut: キャラにかからないように低くする（main.js。縦だけ） */
}
body[data-screen="onboard"] .talk, body[data-screen="home"] .talk { display: block; }
body[data-screen="onboard"] .talk { bottom: calc(var(--safe-b) + 40px); height: calc(52vh - var(--talk-cut, 0px)); }
/* 上の端で消えていくのは、吹き出しごとの --fade と --blur（talk.js）。欄に mask をかけると、吹き出しのガラスのぼかしが効かなくなるため */
.talk-scroll {
  height: 100%; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column;
  scrollbar-width: none; touch-action: pan-y;
}
.talk-scroll::-webkit-scrollbar { display: none; }
.talk-list { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 40px 0 4px; }
.msg {
  max-width: 82%; padding: 9px 14px; border-radius: 20px; font-size: 14px; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink);
  background: var(--her); box-shadow: var(--bubble-edge);
  -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%);
  filter: blur(var(--blur, 0px)) opacity(var(--fade, 1)); transition: filter .2s linear;
  animation: msg-in .28s ease-out both;
}
.msg.her { align-self: flex-start; }
.msg.you { align-self: flex-end; background: var(--you); }
.msg.sys { align-self: flex-start; max-width: 86%; padding: 8px 13px; border-radius: 16px; font-size: 12.5px; line-height: 1.55; background: var(--sys); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 6px 16px rgba(20, 12, 24, .16); }
.msg.muted { color: var(--ink-2); }
.msg.live::after { content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 3px; vertical-align: -.15em; border-radius: 1px; background: var(--red); animation: caret 1s steps(1) infinite; }
.msg.thinking { letter-spacing: .3em; color: var(--ink-2); padding-right: 10px; }
.msg.thinking i { font-style: normal; animation: dot 1.2s ease-in-out infinite; }
.msg.thinking i:nth-child(2) { animation-delay: .15s; } .msg.thinking i:nth-child(3) { animation-delay: .3s; }
.msg.thinking i:nth-child(4) { animation-delay: .45s; } .msg.thinking i:nth-child(5) { animation-delay: .6s; } .msg.thinking i:nth-child(6) { animation-delay: .75s; }
.day-sep { align-self: center; font-size: 11px; color: #fff; padding: 3px 11px; border-radius: 999px; background: rgba(30, 28, 36, .5); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); filter: opacity(var(--fade, 1)); }
.choices { align-self: flex-end; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 92%; }
.choices.stack { flex-direction: column; align-items: flex-end; }
/* 選択肢: ふちの光るガラスのカプセル。「はい」「合ってるよ」（value が yes）だけローズ色 */
.chip {
  min-height: 46px; padding: 10px 16px; border: 0; border-radius: 23px; font-size: 14px; font-weight: 700; line-height: 1.5; text-align: left;
  color: var(--ink); background: var(--chip); box-shadow: var(--chip-edge);
  -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%);
  animation: msg-in .28s ease-out both;
}
.chip[data-value="yes"] {
  background: var(--accent) linear-gradient(180deg, rgba(255, 255, 255, .28) 0%, rgba(255, 255, 255, 0) 55%); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -2px 6px rgba(0, 0, 0, .14), 0 8px 20px var(--accent-shadow);
}
.chip:active { filter: brightness(.95); }
/* 物語モード（docs/spec/story.md）: いちばん上にタイトルのカード。地の文は、吹き出しの幅いっぱいに、明朝寄りの字で 1 字下げ。セリフはふつうの吹き出し */
.story-card {
  align-self: center; display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 4px 0 6px; padding: 10px 20px 12px;
  border-radius: 18px; background: var(--her); box-shadow: var(--bubble-edge); color: var(--ink); text-align: center;
  -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%);
  filter: blur(var(--blur, 0px)) opacity(var(--fade, 1)); animation: msg-in .28s ease-out both;
}
.story-card span { font-size: 11px; letter-spacing: .2em; color: var(--ink-2); }
.story-card b { font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif; font-size: 15px; font-weight: 600; letter-spacing: .04em; }
.msg.story-narr {
  align-self: stretch; max-width: none; border-radius: 14px; text-indent: 1em; line-height: 1.75; letter-spacing: .02em;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
}
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes caret { 50% { opacity: 0; } }
@keyframes dot { 0%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---- 文字の入力欄（✏️）: キーボードのすぐ上の、白いガラスのカプセル。右のボタンは、空ならマイク、文字があればローズの送る ---- */
.input-bar {
  position: fixed; z-index: 6; display: flex; align-items: center; gap: 8px;
  left: calc(var(--side) + var(--safe-l)); right: calc(var(--side) + var(--safe-r));
  bottom: calc(var(--kb) + 12px + var(--safe-kb));
  height: var(--bar-h); padding: 0 6px 0 18px; border-radius: 26px; background-color: var(--glass-dense);
}
.input-bar input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent;
  font: inherit; font-size: 16px; color: var(--ink); caret-color: var(--accent); user-select: text; -webkit-user-select: text;   /* 16px より小さいと、iPhone は入力欄へ拡大する */
}
.input-bar input::placeholder { color: var(--ink-2); }
.input-bar .bar-divider { display: none; }
.bar-action { width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--fill); box-shadow: var(--fill-edge); color: var(--ink); }
.bar-action svg { width: 20px; height: 20px; stroke-width: 1.9; }
.bar-action .i-send { display: none; stroke-width: 2.6; }
.input-bar.has-text .bar-action { background: var(--accent); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 4px 10px var(--accent-shadow); }
.input-bar.has-text .bar-action .i-mic { display: none; }
.input-bar.has-text .bar-action .i-send { display: block; }

/* ---- 下のボタン（ふだんの画面）: 左に「寄り添い」、真ん中に寝返り（寄り添いモード）、右に ✏️🎤。どれも浮いたガラス ---- */
.controls {
  position: fixed; z-index: 4; display: none; align-items: center; justify-content: space-between;
  left: calc(var(--side) + var(--safe-l)); right: calc(var(--side) + var(--safe-r));
  bottom: calc(var(--bar-b) + var(--tab-h) + 20px); height: var(--ctl-h);
  pointer-events: none;
}
.controls > * { pointer-events: auto; }
body[data-screen="home"] .controls { display: flex; }
.snuggle-btn { padding: 0 18px 0 14px; gap: 8px; }
.snuggle-btn svg { width: 19px; height: 19px; stroke-width: 1.9; }
/* 寄り添いモードのあいだは、ローズ色のガラス（D-20 の「ピンクになる」） */
.snuggle-btn[aria-pressed="true"] {
  background: var(--accent) linear-gradient(180deg, rgba(255, 255, 255, .28) 0%, rgba(255, 255, 255, 0) 55%); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -2px 6px rgba(0, 0, 0, .14), 0 10px 24px var(--accent-shadow);
}
.snuggle-btn[aria-pressed="true"] svg path { fill: currentColor; }
.roll-btn { position: absolute; left: 50%; transform: translateX(-50%); width: var(--ctl-h); height: var(--ctl-h); }
.roll-btn svg { width: 21px; height: 21px; stroke-width: 2; }
.roll-btn:disabled { background-color: rgba(60, 58, 66, .62); background-image: none; color: rgba(255, 255, 255, .7); cursor: default; }
.roll-btn.ccw svg { transform: scaleX(-1); }
.input-pill { padding: 0 2px; gap: 0; }
.input-pill .bar-divider { margin: 14px 0; }
.pill-icon { width: 48px; height: 44px; border: 0; border-radius: 22px; background: transparent; display: grid; place-items: center; color: var(--ink); }
.pill-icon svg { width: 20px; height: 20px; stroke-width: 1.9; }
.mic-btn[aria-pressed="true"] {
  width: 40px; height: 40px; margin: 0 4px; border-radius: 50%; background: var(--red); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 0 0 4px rgba(229, 72, 63, .22), 0 4px 12px rgba(229, 72, 63, .35);
}
.mic-btn[aria-pressed="true"] svg { stroke-width: 2.1; }

/* ---- いちばん下のタブ（置くだけ）: 浮いたガラスの帯。「会話」だけ白く塗って、ローズの線 ---- */
.tabbar {
  position: fixed; z-index: 4; display: none; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px;
  left: calc(var(--side) + var(--safe-l)); right: calc(var(--side) + var(--safe-r));
  bottom: var(--bar-b); height: var(--tab-h); padding: 6px; border-radius: 32px;
}
body[data-screen="home"][data-orient="portrait"] .tabbar { display: grid; }
.tab { height: 52px; border: 0; border-radius: 26px; background: transparent; display: grid; place-items: center; color: var(--ink-2); cursor: default; }
.tab:not([tabindex="-1"]) { cursor: pointer; }               /* 使えるタブ（会話・人） */
.tab svg { width: 23px; height: 23px; stroke-width: 1.7; }
.tab.on { background: var(--fill-on); box-shadow: var(--fill-edge), 0 2px 8px rgba(34, 18, 30, .1); color: var(--accent); }
.tab.on svg { stroke-width: 2; }

/* ---- 設定のボタン ---- */
.settings-btn { position: fixed; z-index: 4; display: none; top: calc(var(--safe-t) + 12px); right: calc(var(--side) + var(--safe-r)); }
body[data-screen="home"] .settings-btn { display: grid; }
body[data-orient="landscape"][data-side="right"] .settings-btn { right: auto; left: calc(var(--side) + var(--safe-l)); }

/* ---- 会話のモード（日常・物語）: 上の真ん中の、小さな切り替え。選んでいるほうを白く塗る ---- */
.mode-seg {
  position: fixed; z-index: 4; display: none; top: calc(var(--safe-t) + 16px); left: 50%; transform: translateX(-50%);
  padding: 4px; gap: 2px; border-radius: 22px;
}
body[data-screen="home"] .mode-seg { display: flex; }
.mode-seg button {
  min-width: 64px; height: 34px; padding: 0 14px; border: 0; border-radius: 17px; background: transparent;
  font: inherit; font-size: 13.5px; font-weight: 700; color: var(--ink-2);
}
.mode-seg button[aria-checked="true"] { background: var(--fill-on); box-shadow: var(--fill-edge); color: var(--accent); }
body[data-sheet] .mode-seg, body[data-page="profile"] .mode-seg { display: none !important; }

/* ---- 浮世町の入口へ戻るボタン（D-55）: 左上の丸いガラス。横向きで設定のボタンが左に来るときは右上 ---- */
.town-btn { position: fixed; z-index: 4; display: none; top: calc(var(--safe-t) + 12px); left: calc(var(--side) + var(--safe-l)); }
body[data-screen="home"] .town-btn { display: grid; }
body[data-orient="landscape"][data-side="right"] .town-btn { left: auto; right: calc(var(--side) + var(--safe-r)); }
body[data-sheet] .town-btn, body[data-page="profile"] .town-btn { display: none !important; }

/* ---- 物語の状態パネル（シアター。D-57）: 上の切り替えのすぐ下の、小さなガラス。現在地・目的・持ち物の 3 行。変わったら少し光る ---- */
/* ふだんは折りたたむ（D-136）: 📍 と回数だけの小さな札（.folded）。開いたパネルは会話の欄の上に重ねる（欄の位置は、折りたたんだ札の高さ --state-h で決めるので、開いても欄は動かない）。
   部屋を動かしている・文字を打っているあいだは、開いていても札だけにする。
   札とパネルは、右上の設定のボタンのすぐ下（D-140。前は真ん中で、札が大きくてじゃまだった）。横向きで設定のボタンが左のときは、左上 */
:root { --state-h: 22px; }
.story-state {
  position: fixed; z-index: 4; top: calc(var(--safe-t) + 62px); right: calc(var(--side) + var(--safe-r));
  width: var(--state-w, min(320px, calc(100% - 2 * var(--side) - var(--safe-l) - var(--safe-r)))); padding: 0; border-radius: 16px;
  font-size: 11.5px; line-height: 1.45; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.story-state > dl { padding: 7px 12px; }
.state-chip { display: none; align-items: center; gap: 3px; height: var(--state-h); padding: 0 7px 0 6px; border: 0; background: none; font: inherit; font-size: 10.5px; font-weight: 700; color: var(--ink); cursor: pointer; opacity: .85; }
.state-chip svg { width: 12px; height: 12px; stroke-width: 2; }
.state-chip .chip-caret { display: none; }                                          /* ▾ は出さない（小さく。D-140） */
body[data-orient="landscape"][data-side="right"] .story-state { right: auto; left: calc(var(--side) + var(--safe-l)); }
.state-chip .chip-turns { font-variant-numeric: tabular-nums; white-space: nowrap; }
.story-state.folded, body:is([data-activity="room"], [data-activity="typing"]) .story-state { width: auto; border-radius: 11px; }
.story-state.folded > dl, body:is([data-activity="room"], [data-activity="typing"]) .story-state > dl { display: none; }
.story-state.folded .state-chip, body:is([data-activity="room"], [data-activity="typing"]) .story-state .state-chip { display: inline-flex; }
.story-state[hidden], body:not([data-screen="home"]) .story-state, body[data-sheet] .story-state, body[data-page="profile"] .story-state { display: none !important; }
.story-state dl { margin: 0; display: grid; gap: 2px; }
.story-state dl > div { display: grid; grid-template-columns: 4.2em 1fr; gap: 6px; }
.story-state dt { font-weight: 700; color: #1f7f7a; letter-spacing: .04em; }
body[data-glass="dark"] .story-state dt { color: #7fd6cf; }
.story-state dd { margin: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.story-state.changed { animation: state-glow 1.6s ease-out; }
@keyframes state-glow { 0% { box-shadow: 0 0 0 2px rgba(42, 157, 143, .75), 0 0 18px rgba(42, 157, 143, .55); } 100% { box-shadow: 0 0 0 0 rgba(42, 157, 143, 0); } }
body[data-orient="landscape"] .story-state { --state-w: min(300px, 38vw); }   /* 幅は変数で（折りたたんだ札の width: auto を上書きしないように。D-136） */
/* やりとりの回数（D-102）: 「12 / 50」・細い棒・終盤/結末へ/終幕 */
.story-state dd.state-turns { display: flex; align-items: center; gap: 7px; -webkit-line-clamp: unset; }
.state-turns .turns-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.state-turns .turns-bar { flex: 1; height: 4px; min-width: 40px; border-radius: 2px; background: rgba(31, 127, 122, .18); overflow: hidden; }
.state-turns .turns-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: #2a9d8f; transition: width .5s ease; }
.state-turns .turns-stage { white-space: nowrap; font-weight: 700; }
.state-turns .turns-stage:empty { display: none; }
.state-turns[data-stage="near"] .turns-bar i, .state-turns[data-stage="last"] .turns-bar i { background: #d08a2e; }
.state-turns[data-stage="near"] .turns-stage, .state-turns[data-stage="last"] .turns-stage { color: #b06e17; }
body[data-glass="dark"] .state-turns[data-stage] .turns-stage { color: #f0b665; }
body[data-glass="dark"] .state-turns .turns-bar { background: rgba(127, 214, 207, .2); }
.brief-turns { margin: 6px 0 0; font-size: 12px; line-height: 1.6; opacity: .8; }

/* ---- ポーズのボタン（キャラをタップしたとき。頭の近く。--px・--py は main.js） ---- */
.pose-btn {
  position: fixed; z-index: 4; left: 0; top: 0; transform: translate(calc(var(--px, -200px) - 50%), calc(var(--py, -200px) - 50%));
  width: 60px; height: 60px; border-radius: 50%; border: 0; padding: 6px 0 0;
  display: grid; justify-items: center; align-content: center; gap: 2px;
  animation: pop .22s ease-out both;
}
.pose-btn svg { width: 22px; height: 22px; stroke-width: 1.9; }
.pose-btn span { font-size: 10px; font-weight: 700; line-height: 1; }
@keyframes pop { from { opacity: 0; transform: translate(calc(var(--px) - 50%), calc(var(--py) - 50%)) scale(.6); } }

/* ---- シート（ポーズの一覧・設定）: 画面の端から少し浮いたガラスの板。縦は下（高さ 52vh）、横は右半分 ---- */
.sheet {
  position: fixed; z-index: 7; left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); bottom: max(calc(var(--safe-b) - 14px), 10px); height: 52vh;
  border-radius: 38px; display: flex; flex-direction: column; overflow: hidden; background-color: var(--glass-dense);
  animation: sheet-up .3s cubic-bezier(.2, .8, .3, 1) both;
}
body[data-orient="landscape"] .sheet {
  left: auto; top: calc(10px + var(--safe-t)); bottom: calc(10px + var(--safe-b)); width: calc(50vw - 10px - var(--safe-r)); height: auto;
  border-radius: 32px; animation-name: sheet-left;
}
@keyframes sheet-up { from { transform: translateY(calc(100% + 24px)); } }
@keyframes sheet-left { from { transform: translateX(calc(100% + 24px)); } }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 8px 22px; }
.sheet-title { margin: 0; flex: 1; font-size: 18px; font-weight: 700; color: var(--ink); }
.settings .sheet-head:has(.sheet-tabs:not([hidden])) .sheet-title { display: none; }
.sheet-close { width: 36px; height: 36px; flex: none; margin-left: auto; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center; background: var(--fill); box-shadow: var(--fill-edge); color: var(--ink-2); }
.sheet-close svg { width: 16px; height: 16px; stroke-width: 2.4; }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 14px 16px; user-select: text; -webkit-user-select: text; }
.pose-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pose-card {
  position: relative; aspect-ratio: 1 / 1; border-radius: 24px; border: 0; background: var(--card); box-shadow: var(--card-edge), 0 1px 3px rgba(30, 26, 34, .06);
  display: grid; place-items: center; font-size: 14px; font-weight: 700; color: var(--ink); padding: 8px; text-align: center;
}
.pose-card[aria-checked="true"] { background: var(--fill-on); box-shadow: var(--fill-edge), 0 0 0 2px var(--accent), 0 6px 16px var(--accent-shadow); }
.pose-card[aria-checked="true"]::after {
  content: "いまのポーズ"; position: absolute; left: 10px; top: 10px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 1.5; color: #fff; background: var(--accent);
}
body[data-orient="landscape"] .pose-card { aspect-ratio: 1.05 / 1; }
body[data-sheet] .talk, body[data-sheet] .tabbar, body[data-sheet] .pose-btn { display: none !important; }
body[data-sheet][data-orient="portrait"] .controls { display: none !important; }
body[data-sheet][data-orient="landscape"] .input-pill, body[data-sheet][data-orient="landscape"] .roll-btn { display: none !important; }
body[data-sheet] .settings-btn { display: none !important; }

/* 設定の中身: まとまりごとに白い板。切り替えは、白いつまみが動く溝（iPhone と同じ形） */
.sheet-tabs { flex: 1; display: flex; gap: 2px; padding: 3px; border-radius: 18px; background: var(--well); overflow-x: auto; scrollbar-width: none; }
.sheet-tabs button { flex: 1 0 auto; border: 0; background: transparent; padding: 6px 12px; border-radius: 15px; font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.sheet-tabs button[aria-selected="true"] { background: var(--seg-on); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(30, 26, 34, .14); }
.settings .sheet-body { padding: 4px 14px 18px; }
.group { margin: 0 0 12px; padding: 14px; border-radius: 24px; background: var(--card); box-shadow: var(--card-edge); }
.group h3 { margin: 0 0 4px 2px; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--ink-2); }
.label, .field { margin: 12px 0 7px 2px; font-size: 14px; font-weight: 500; color: var(--ink); }
.field { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.field output { color: var(--ink); font-family: var(--logo), var(--font); font-weight: 600; font-variant-numeric: tabular-nums; }
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 18px; background: var(--well); }
.seg button {
  flex: 1 1 0; min-width: 0; height: 30px; padding: 0 6px; border: 0; border-radius: 15px; background: transparent;
  font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seg button.on, .seg button[aria-checked="true"] { background: var(--seg-on); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(30, 26, 34, .14), 0 0 0 .5px rgba(30, 26, 34, .04); }
.seg button:disabled { opacity: .45; }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 6px 0 2px; }
.check { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.select { width: 100%; padding: 9px 12px; border-radius: 12px; border: 0; background: var(--fill); box-shadow: var(--fill-edge); color: var(--ink); font: inherit; font-size: 14px; }
.hint { margin: 8px 0 0 2px; font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.hint.state { margin: 4px 0 12px; color: var(--ink); }
.credit { margin: 8px 0 0 2px; font-size: 11px; color: var(--ink-2); }
.ghost { border: 0; background: var(--fill); box-shadow: var(--fill-edge); border-radius: 999px; padding: 9px 18px; font-size: 13px; font-weight: 700; color: var(--ink); }
.sheet-foot { padding: 4px 2px 0; display: grid; gap: 10px; justify-items: start; }
.keys-box summary { font-size: 12px; color: var(--ink-2); cursor: pointer; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; margin: 8px 0 0; font-size: 12px; }
.keys div { display: flex; gap: 8px; align-items: baseline; }
.keys dt { min-width: 3.6em; }
.keys dd { margin: 0; color: var(--ink-2); }
kbd { font: 11px ui-monospace, Menlo, monospace; padding: 0 4px; border: 1px solid var(--hair); border-radius: 4px; background: var(--fill); color: var(--ink); }
.motions { display: grid; gap: 6px; margin-top: 8px; }
.motion { border: 0; border-radius: 14px; background: var(--fill); box-shadow: var(--fill-edge); padding: 0 12px; }
.motion.off .motion-open { color: var(--ink-2); opacity: .6; }
.motion-head { display: flex; align-items: center; gap: 8px; }
.motion-open { flex: 1; text-align: left; border: 0; background: transparent; padding: 10px 0; font-size: 14px; font-weight: 500; color: var(--ink); }
.motion-on { width: 18px; height: 18px; accent-color: var(--accent); }
.motion-body { padding: 0 0 10px; }

/* ---- プロフィール（タブの「人」。P-1。D-50）: ぼかした部屋の上に 3 枚のガラス。下のタブは、そのまま上に残る（同じ z-index で、後ろに書いてある） ---- */
.profile-bg {
  position: fixed; inset: 0; z-index: 4; display: none;
  -webkit-backdrop-filter: blur(30px) saturate(150%); backdrop-filter: blur(30px) saturate(150%); background: rgba(248, 245, 247, .5);
}
body[data-glass="dark"] .profile-bg { background: rgba(22, 20, 32, .45); }
body[data-page="profile"] .profile-bg { display: block; }
.profile {
  position: fixed; inset: 0; z-index: 4; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  padding: calc(var(--safe-t) + 14px) calc(var(--side) + var(--safe-r)) calc(var(--bar-b) + var(--tab-h) + 16px) calc(var(--side) + var(--safe-l));
  animation: profile-in .28s cubic-bezier(.2, .8, .3, 1) both;          /* 動かすのは位置だけ（透明度を変えると、中のガラスのぼかしが効かない） */
}
.profile::-webkit-scrollbar { display: none; }
@keyframes profile-in { from { transform: translateY(14px); } }
.profile-inner { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.profile-title { margin: 0 0 0 8px; font-size: 28px; font-weight: 700; line-height: 1.2; color: var(--ink); }
.profile-sec { display: block; margin: 0 0 10px 4px; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--ink-2); }
.profile-me { min-height: 96px; border-radius: 30px; padding: 0 14px 0 16px; display: flex; align-items: center; gap: 14px; }
.profile-me .av { width: 64px; height: 64px; font-size: 26px; }
.profile-me-text { flex: 1; min-width: 0; }
.profile-name { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-sub { margin: 2px 0 0; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.profile-edit {
  flex: none; height: 36px; padding: 0 14px 0 11px; border: 0; border-radius: 18px; display: flex; align-items: center; gap: 5px;
  font-size: 14px; font-weight: 700; color: var(--ink); background: var(--fill); box-shadow: var(--fill-edge);
}
.profile-edit svg { width: 15px; height: 15px; stroke-width: 2.1; }
.profile-edit:disabled { opacity: .45; cursor: default; }
.profile-act { border-radius: 28px; padding: 14px; }
.act-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.act-tile { padding: 10px 12px; border-radius: 18px; background: var(--fill); box-shadow: var(--fill-edge); min-width: 0; }
.act-num { margin: 0; min-height: 25px; font: 600 22px/1.15 var(--logo), var(--font); color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-num small { margin-left: 3px; font: 700 12px/1 var(--font); color: var(--ink-2); }
.act-num.when { font: 700 18px/1.4 var(--font); }                         /* 最後に話した（今日 11:02） */
.act-num.when span { font-family: var(--logo), var(--font); font-weight: 600; }
.act-cap { margin: 3px 0 0; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.act-week { margin: 12px 0 6px 4px; font-weight: 700; }
.act-bars, .act-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; padding: 0 4px; }
.act-bars { align-items: end; height: 46px; }
.act-bars span { min-height: 4px; border-radius: 5px; background: var(--hair); }
.act-bars span.today { background: var(--accent); }
.act-days { padding-top: 4px; font-size: 11px; font-weight: 500; color: var(--ink-2); text-align: center; }
.act-days .today { font-weight: 700; color: var(--ink); }
.profile-actions { border-radius: 28px; padding: 4px; }
.profile-row { width: 100%; height: 52px; border: 0; border-radius: 24px; background: transparent; display: flex; align-items: center; gap: 12px; padding: 0 14px; text-align: left; color: var(--ink); }
.profile-row svg { width: 20px; height: 20px; flex: none; stroke-width: 1.9; }
.profile-row-label { flex: 1; font-size: 15px; font-weight: 700; }
.profile-row-sub { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.profile-row.danger { color: #c9302c; }
body[data-glass="dark"] .profile-row.danger { color: #ff8a80; }
.profile-row:active:not(:disabled) { background: var(--fill); }
.profile-row:disabled { opacity: .45; cursor: default; }
.profile-sep { height: .5px; margin: 0 14px; background: var(--hair); }
body[data-page="profile"] .talk, body[data-page="profile"] .controls, body[data-page="profile"] .settings-btn,
body[data-page="profile"] .pose-btn, body[data-page="profile"] .input-bar { display: none !important; }

/* 境界の門へ歩く（D-68。元のアプリの D-64。main.js の walkThroughGate）: 門のあたり（画面の中央より少し上）から広がる、やわらかな金色の光。
   歩いているあいだ（data-page="gate"）は、吹き出し・入力欄・ボタン・場所の切り替え・家のボタン・状態パネルを隠す */
.gate-glow { position: fixed; inset: 0; z-index: 7; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 38%, #fffaf0 0%, #fff1cf 35%, rgba(255, 236, 196, .92) 60%, rgba(255, 246, 228, .85) 100%); }
body[data-page="gate"] .talk, body[data-page="gate"] .controls, body[data-page="gate"] .settings-btn, body[data-page="gate"] .pose-btn,
body[data-page="gate"] .input-bar, body[data-page="gate"] .mode-seg, body[data-page="gate"] .town-btn, body[data-page="gate"] .story-state,
body[data-page="gate"] .tabbar { display: none !important; }
/* 物語の背景の前（data-backdrop）は、キャラは「立つ」のままにするので、ポーズのボタンと寄り添いのボタンを出さない */
body[data-backdrop] .pose-btn, body[data-backdrop] .snuggle-btn { display: none !important; }

/* 編集のシート（P-2）: ポーズ・設定のシートと同じ浮いたガラス。高さは中身に合わせ、キーボードが開いたら、その上に上げる */
.profile-dim { position: fixed; inset: 0; z-index: 6; background: rgba(20, 16, 24, .24); animation: dim-in .2s ease-out both; }
@keyframes dim-in { from { background: rgba(20, 16, 24, 0); } }
.profile-sheet { height: auto; max-height: calc(100% - var(--safe-t) - 20px - var(--kb)); bottom: calc(var(--kb) + max(calc(var(--safe-kb) - 14px), 10px)); }
.edit-head { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 40px; margin: 14px 16px 0; }
.edit-cancel { justify-self: start; height: 36px; padding: 0 6px; border: 0; background: transparent; font-size: 15px; font-weight: 500; color: var(--ink-2); }
.edit-title { margin: 0; font-size: 17px; font-weight: 700; color: var(--ink); }
.edit-save {
  justify-self: end; height: 36px; padding: 0 18px; border: 0; border-radius: 18px; font-size: 15px; font-weight: 700; color: #fff;
  background: var(--accent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 6px 14px var(--accent-shadow);
}
.edit-save:disabled { opacity: .5; cursor: default; }
.edit-body { padding: 0 16px 20px; }
.edit-preview { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 10px 0 14px; }
.edit-preview .av { width: 76px; height: 76px; font-size: 30px; }
.edit-preview p { margin: 0; max-width: 100%; font-size: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-body .profile-sec { margin: 0 0 8px 6px; }
.name-field { height: 50px; border-radius: 25px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 18px; background: var(--fill); box-shadow: var(--fill-edge); }
.name-field:focus-within { box-shadow: var(--fill-edge), 0 0 0 2px var(--accent); }
.name-field input {
  flex: 1; min-width: 0; border: 0; padding: 0; background: transparent; outline: none;
  font: inherit; font-size: 16px; color: var(--ink); caret-color: var(--accent); user-select: text; -webkit-user-select: text;   /* 16px より小さいと、iPhone は入力欄へ拡大する */
}
.name-count { flex: none; font: 500 12px/1 var(--logo), var(--font); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.name-clear { flex: none; width: 28px; height: 28px; border: 0; padding: 0; border-radius: 14px; display: grid; place-items: center; color: #fff; background: rgba(30, 26, 34, .32); }
body[data-glass="dark"] .name-clear { background: rgba(255, 255, 255, .28); }
.name-clear svg { width: 12px; height: 12px; stroke-width: 3; }
.name-hint { margin: 7px 0 0 8px; font-size: 12px; line-height: 1.5; color: var(--ink-2); }
.name-hint.error { color: #c9302c; font-weight: 700; }
body[data-glass="dark"] .name-hint.error { color: #ff8a80; }
.edit-body .icon-title { margin-top: 16px; }
.icon-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 6px; padding-top: 4px; }
.icon-pick { display: flex; flex-direction: column; align-items: center; gap: 5px; border: 0; padding: 4px 0; background: transparent; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.icon-pick .av { position: relative; width: 52px; height: 52px; }
.icon-pick[aria-checked="true"] { color: var(--ink); font-weight: 700; }
.icon-pick[aria-checked="true"] .av { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -2px 5px rgba(0, 0, 0, .16), 0 0 0 3px #fff, 0 0 0 5px var(--accent); }
.icon-pick[aria-checked="true"] .av::after {                              /* 右上のチェックの印 */
  content: ""; position: absolute; right: -6px; top: -6px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 10px no-repeat;
}

/* 削除の確かめ（P-3）: 暗くした上に、まんなかのガラスのカード */
.confirm { position: fixed; inset: 0; z-index: 8; display: grid; place-items: center; padding: 20px; background: rgba(20, 16, 24, .36); animation: confirm-dim .2s ease-out both; }
@keyframes confirm-dim { from { background: rgba(20, 16, 24, 0); } }
.confirm-card {
  width: min(306px, 100%); border-radius: 32px; padding: 24px 20px 18px; background-color: var(--glass-dense);
  display: flex; flex-direction: column; align-items: center; text-align: center; animation: confirm-in .24s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes confirm-in { from { transform: scale(.92); } }
.confirm-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: #c9302c; background: rgba(201, 48, 44, .12); }
body[data-glass="dark"] .confirm-icon { color: #ff8a80; background: rgba(255, 138, 128, .14); }
.confirm-icon svg { width: 26px; height: 26px; stroke-width: 1.9; }
.confirm-card h2 { margin: 14px 0 0; font-size: 18px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; color: var(--ink); }
.confirm-card p { margin: 8px 0 0; font-size: 13px; font-weight: 500; line-height: 1.65; color: var(--ink-2); }
.confirm-buttons { align-self: stretch; display: grid; gap: 8px; margin-top: 20px; }
.confirm-buttons button { height: 50px; border: 0; border-radius: 25px; font-size: 16px; font-weight: 700; }
.confirm-danger { color: #fff; background: #c9302c; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 8px 18px rgba(201, 48, 44, .28); }
.confirm-danger:disabled { opacity: .6; cursor: default; }
.confirm-cancel { color: var(--ink); background: var(--fill); box-shadow: var(--fill-edge); }

/* 物語の入口（ブリーフィング。docs/spec/story.md）: 削除の確かめと同じ、暗くした上のガラスのカード。文が長いので、文（.brief-body）だけが
   カードの中でスクロールし、ボタンはいつもカードの下に見えている（横向きでも）。ふだんの画面（home）でだけ出す */
body:not([data-screen="home"]) .story-brief { display: none; }
.brief-card {
  width: min(360px, 100%); max-height: calc(100dvh - var(--safe-t) - var(--safe-b) - 40px); overflow: hidden;
  align-items: stretch; text-align: left; padding: 22px 20px 18px;
}
.brief-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
.brief-card .confirm-buttons { flex: none; margin-top: 14px; }
body[data-orient="landscape"] .brief-card .confirm-buttons { grid-template-columns: 1fr 1fr; }
body[data-orient="landscape"] .brief-card .confirm-buttons button { height: 44px; }
.brief-kicker { align-self: center; font-size: 11px; letter-spacing: .2em; color: var(--ink-2); }
.brief-card .brief-title {
  margin: 2px 0 0; text-align: center; font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  font-size: 18px; font-weight: 600; letter-spacing: .04em;
}
.brief-card .brief-synopsis {
  margin: 12px 0 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif; font-size: 13.5px;
  line-height: 1.8; color: var(--ink); white-space: pre-line;
}
.brief-role, .brief-cast { margin-top: 12px; padding: 12px 14px; border-radius: 18px; background: var(--fill); box-shadow: var(--fill-edge); }
.brief-role.partner h3 { color: var(--accent); }
.brief-card h3 { margin: 0; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; color: var(--ink-2); }
.brief-card .brief-role p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.65; color: var(--ink); }
.brief-cast ul { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.brief-cast li { font-size: 13px; line-height: 1.6; color: var(--ink); }
.brief-cast li b { font-weight: 700; }
.brief-cast li small { font-size: 11.5px; color: var(--ink-2); }
/* 演目の絵（D-66）: 先頭の top 絵は、カードの幅いっぱいの横長に切り出す（縦 2:3 の絵の、禁書と巫女のあたり）。横向きは低めにして、文を読む場所を残す */
.brief-top {
  flex: none; display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; margin: 0 0 12px;
  object-fit: cover; object-position: 50% 66%; border-radius: 14px; background: #10162a;
}
body[data-orient="landscape"] .brief-top { aspect-ratio: 16 / 7; object-position: 50% 64%; }
/* 登場人物の絵: 左に顔のあたりを縦長に切り出した小さい絵、右に名前と説明 */
.brief-cast li.has-art { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: start; }
.brief-cast-art {
  display: block; width: 64px; height: 84px; object-fit: cover; object-position: 50% 18%;
  border-radius: 12px; background: #1b2236; box-shadow: 0 0 0 1px rgba(255, 255, 255, .6), 0 3px 8px rgba(40, 30, 50, .18);
}
.brief-enter {
  color: #fff; background: var(--accent) linear-gradient(180deg, rgba(255, 255, 255, .28) 0%, rgba(255, 255, 255, 0) 55%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 8px 18px var(--accent-shadow);
}
.brief-enter:disabled { opacity: .6; cursor: default; }

/* ---- 浮世町の入口（D-55）: 町の場所を選ぶ画面。浮世町の空気（パステルの和風、薄いグレーの地・白いカード・濃い紺の見出し・ティールと青のアクセント）。
   この画面の中だけの色にして、ほかの画面（ローズのガラス）とは混ぜない。ふだんの画面（home）でだけ出す ---- */
.town {
  --town-bg: #eef1f4; --town-card: #fff; --town-navy: #1d2b4f; --town-text: #3c4658; --town-teal: #2a8f8a; --town-blue: #3d6fb4; --town-line: #dde3ea;
  position: fixed; inset: 0; z-index: 8; display: flex; overflow-y: auto; overscroll-behavior: contain;   /* カードは margin: auto でまんなか（はみ出すときは上から読める） */
  padding: calc(var(--safe-t) + 16px) calc(var(--safe-r) + 16px) calc(var(--safe-b) + 16px) calc(var(--safe-l) + 16px);
  background: rgba(238, 241, 244, .94); color: var(--town-text); animation: confirm-dim .2s ease-out both;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.town[hidden], body:not([data-screen="home"]) .town { display: none; }
.town-card { width: min(400px, 100%); margin: auto; display: flex; flex-direction: column; gap: 14px; animation: confirm-in .24s cubic-bezier(.2, .8, .3, 1) both; }
.town-head { text-align: center; }
.town-kicker { font-size: 11px; letter-spacing: .24em; color: var(--town-teal); font-weight: 700; }
.town-head h2 {
  margin: 2px 0 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  font-size: 26px; font-weight: 600; letter-spacing: .18em; color: var(--town-navy);
}
.town-lead { margin: 6px 0 0; font-size: 13.5px; line-height: 1.6; }
.town-places { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.town-place {
  grid-column: span 3; min-height: 132px; padding: 14px 14px 12px; border: 1px solid var(--town-line); border-radius: 18px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; font: inherit;
  background: var(--town-card); color: var(--town-text); box-shadow: 0 6px 16px rgba(29, 43, 79, .07);
  border-top: 4px solid var(--town-teal);
}
.town-place[data-place="story"] { border-top-color: var(--town-blue); }
.town-place:not(:disabled):active { transform: scale(.98); }
.town-place:not(:disabled):focus-visible { outline: 2px solid var(--town-blue); outline-offset: 2px; }
.town-place-name { font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif; font-size: 19px; font-weight: 600; letter-spacing: .08em; color: var(--town-navy); }
.town-place-sub { font-size: 11.5px; font-weight: 700; color: var(--town-teal); }
.town-place[data-place="story"] .town-place-sub { color: var(--town-blue); }
.town-place-text { margin-top: 4px; font-size: 12.5px; line-height: 1.6; }
/* まだない場所: グレーで、押せない。「準備中」の札 */
.town-place.soon { grid-column: span 2; min-height: 0; padding: 10px 10px 9px; border-top: 1px solid var(--town-line); background: #f5f6f8; color: #8a92a0; box-shadow: none; cursor: not-allowed; }
.town-place.soon .town-place-name { font-size: 15px; color: #7c8494; }
.town-place.soon .town-place-sub { color: #9aa1ad; }
.town-soon { margin-top: 4px; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; color: #6f7785; background: #e3e7ec; }
.town-place[data-place="shop"] { grid-column: span 6; min-height: 0; border-top-color: #d9822b; }   /* コンビニ（見本だけ）。準備中は 2 つになったので 3 ずつ */
.town-place[data-place="shop"] .town-place-sub { color: #c0661c; }
.town-place.soon { grid-column: span 3; }
.town-note { margin: 0; text-align: center; font-size: 11.5px; line-height: 1.6; color: #5f6878; }
/* 横向き: 高さが足りないので詰める（使える 2 つを上の段に、準備中の 3 つを下の段に） */
body[data-orient="landscape"] .town-card { width: min(720px, 100%); gap: 8px; }
body[data-orient="landscape"] .town-head h2 { font-size: 21px; }
body[data-orient="landscape"] .town-lead { margin-top: 2px; font-size: 12.5px; }
body[data-orient="landscape"] .town-places { gap: 8px; }
body[data-orient="landscape"] .town-place { min-height: 0; padding: 10px 14px 9px; }
body[data-orient="landscape"] .town-place-text { margin-top: 2px; font-size: 12px; line-height: 1.5; }
body[data-orient="landscape"] .town-place.soon { padding: 7px 10px; flex-direction: row; align-items: center; gap: 8px; }
body[data-orient="landscape"] .town-place.soon .town-soon { margin: 0 0 0 auto; }

/* ---- 横向き（44〜61）: タブはなし。吹き出しは、キャラのいない側（data-side）に縦に並べる ---- */
body[data-orient="landscape"] { --gap: 14px; --bar-h: 46px; }
body[data-orient="landscape"] .controls { bottom: calc(var(--safe-b) + 14px); }
body[data-orient="landscape"] .talk {
  top: calc(var(--safe-t) + 8px); height: auto; width: min(46vw, 420px);
  bottom: calc(var(--safe-b) + 14px + var(--ctl-h) + 10px);
  transition: left .45s ease, right .45s ease;
}
body[data-orient="landscape"][data-side="right"] .talk { left: auto; right: calc(var(--side) + var(--safe-r)); }
body[data-orient="landscape"][data-side="left"] .talk { right: auto; left: calc(var(--side) + var(--safe-l) + 44px + 10px); }
body[data-orient="landscape"] .input-bar { left: 50%; right: auto; width: min(44vw, 420px); border-radius: 23px; padding: 0 5px 0 16px; transform: translateX(-50%); }
body[data-orient="landscape"] .bar-action { width: 36px; height: 36px; }
body[data-orient="landscape"][data-input="text"] .talk { bottom: calc(var(--kb) + 12px + var(--bar-h) + 10px + var(--safe-kb)); }
body[data-input="text"] .controls, body[data-input="text"] .tabbar { display: none !important; }
body[data-screen="home"][data-orient="portrait"][data-input="text"] .talk { bottom: calc(var(--kb) + 12px + var(--bar-h) + 12px + var(--safe-kb)); }
body[data-screen="onboard"][data-input="text"] .talk { bottom: calc(var(--kb) + 12px + var(--bar-h) + 12px + var(--safe-kb)); }
/* キーボードが開いているとき（data-kb。main.js の syncKeyboard）: ホームバーのよけはいらない。縦の吹き出しの欄は、入力欄のすぐ上に短く
   （画面案 12〜15・65〜67。キャラが見えている範囲に残るように）。短いので、欄を低くする --talk-cut は使わない */
body[data-kb] { --safe-kb: 0px; }
body[data-kb][data-screen="home"][data-orient="portrait"][data-input="text"] .talk { height: var(--kb-talk); }
body[data-kb][data-screen="onboard"][data-input="text"] .talk { height: var(--kb-talk-onboard); }

/* ---- オンボード・スタート画面で横にしたとき: 画面全体をぼかして暗くし、暗いガラスの札を出す ---- */
.rotate-note {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  background: rgba(30, 28, 36, .5); color: #f4f1f8;
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
}
/* 札は覆いの中なので、自分ではぼかさない（覆いがもうぼかしている） */
.rotate-card {
  width: min(320px, calc(100vw - 48px)); padding: 26px 28px 24px; border-radius: 32px; display: grid; justify-items: center; gap: 10px; text-align: center;
  background: rgba(26, 24, 40, .6) linear-gradient(165deg, rgba(255, 255, 255, .16) 0%, rgba(255, 255, 255, 0) 30%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), inset 0 0 0 .5px rgba(255, 255, 255, .16), 0 16px 40px rgba(0, 0, 10, .45);
}
.rotate-card svg { width: 54px; height: 54px; stroke-width: 1.4; animation: turn 2.4s ease-in-out infinite; }
.rotate-card p { margin: 0; font-size: 17px; font-weight: 700; }
.rotate-card small { font-size: 13px; line-height: 1.6; color: #d2ccda; }
@keyframes turn { 0%, 30% { transform: rotate(-90deg); } 60%, 100% { transform: rotate(0); } }

/* H キー: 表示をまとめて隠す（スクリーンショット用） */
body.ui-hidden .talk, body.ui-hidden .controls, body.ui-hidden .tabbar, body.ui-hidden .settings-btn, body.ui-hidden .start-bottom,
body.ui-hidden .input-bar, body.ui-hidden .pose-btn, body.ui-hidden .debug-view, body.ui-hidden .town-btn, body.ui-hidden .story-state { display: none !important; }

.toast {
  position: fixed; z-index: 30; left: 50%; top: calc(var(--safe-t) + 64px); transform: translate(-50%, -6px);
  max-width: min(88vw, 520px); padding: 10px 18px; border-radius: 18px; color: #fff;
  background: rgba(28, 26, 36, .74); -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 8px 24px rgba(0, 0, 10, .3);
  font-size: 13px; line-height: 1.5; text-align: center; opacity: 0; transition: opacity .25s ease, transform .25s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* ローディング（依頼者の指示）: スタート画面ではロゴの下、入ったあとは下の真ん中（入力欄の上）。浮世町の上にも出す */
.loader {
  position: fixed; z-index: 31; left: 50%; top: calc(52% + 52px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 9px; padding: 8px 16px 8px 12px; border-radius: 999px; color: #fff;
  background: rgba(28, 26, 36, .62); -webkit-backdrop-filter: blur(14px) saturate(150%); backdrop-filter: blur(14px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 6px 18px rgba(0, 0, 10, .25);
  font-size: 13px; line-height: 1; white-space: nowrap; pointer-events: none; animation: loader-in .3s ease both;
}
.loader[hidden] { display: none; }
body:not([data-screen="start"]) .loader { top: auto; bottom: calc(var(--safe-b) + 96px); }
.loader-ring { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .28); border-top-color: #fff; animation: loader-spin .8s linear infinite; }
.loader-pct { font-variant-numeric: tabular-nums; opacity: .85; min-width: 0; }
.loader-pct:empty { display: none; }
@keyframes loader-spin { to { transform: rotate(360deg); } }
@keyframes loader-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .loader-ring { animation-duration: 2.4s; } }

/* 計測表示（P キー） */
.perf {
  position: fixed; right: 12px; top: calc(12px + var(--safe-t)); z-index: 50; margin: 0;
  padding: 8px 10px; border-radius: 8px; background: rgba(10, 9, 18, .78); color: #e8e4f4;
  font: 12px/1.5 ui-monospace, Menlo, monospace; pointer-events: none; white-space: pre;
}
/* デバッグ視点（D キー） */
.debug-view {
  position: fixed; left: 12px; bottom: calc(12px + var(--safe-b)); z-index: 50;
  max-width: min(560px, calc(100vw - 24px)); padding: 8px 12px; border-radius: 10px;
  background: rgba(10, 9, 18, .82); color: #e8e4f4; font-size: 12px; line-height: 1.7;
}
.debug-view p { margin: 0; }
.debug-view kbd { background: transparent; border-color: rgba(255, 255, 255, .3); color: inherit; }
.debug-view code { font: 12px/1.5 ui-monospace, Menlo, monospace; color: #9fe3ff; word-break: break-all; }
.debug-view button { margin-left: 8px; padding: 1px 8px; font-size: 12px; border: 1px solid rgba(255, 255, 255, .28); border-radius: 6px; background: rgba(255, 255, 255, .08); }
.debug-view button.on { border-color: rgba(239, 143, 160, .7); background: rgba(239, 143, 160, .28); }
body:has(.debug-view:not([hidden])) .controls, body:has(.debug-view:not([hidden])) .tabbar,
body:has(.debug-view:not([hidden])) .talk { display: none !important; }
/* ?audio・?kb: 声の状態・キーボードの値（確かめ用） */
.debug-readout {
  position: fixed; left: calc(8px + var(--safe-l)); top: calc(8px + var(--safe-t)); z-index: 50; padding: 5px 9px; border-radius: 8px;
  background: rgba(10, 9, 18, .72); color: #e8e4f4; font: 11px/1.5 ui-monospace, Menlo, monospace; white-space: pre; pointer-events: none;
}

.fileproto { position: fixed; inset: 0; display: grid; place-content: center; padding: 24px; text-align: center; background: #f2f0ee; z-index: 100; }

@media (prefers-reduced-motion: reduce) {
  .msg, .chip, .sheet, .pose-btn, .user-menu { animation: none !important; }
}

/* ---- ここから下は v5 から: 眠っているあいだの Zzz と、会話の気持ちの漫符（fx.js）---- */
.zzz {
  position: fixed; left: 0; top: 0; width: 0; height: 0; pointer-events: none;
  transform: translate(var(--zx, -200px), var(--zy, -200px));
  opacity: 0; transition: opacity .8s ease;
}
.zzz.on { opacity: 1; }
/* 暖かい白に、ランプのような柔らかな光（部屋の電球色に合わせる） */
.zzz span {
  position: absolute; left: 0; bottom: 0;
  font: 800 calc(var(--zs, 32px) * var(--k, 1) * 1.3) / 1 var(--font);
  color: #fff8ee; -webkit-text-stroke: .05em #c48b58; text-shadow: 0 0 .14em rgba(255, 190, 120, .9), 0 0 .5em rgba(255, 170, 100, .5);
  paint-order: stroke fill;
  animation: zzz-rise 3.4s ease-out forwards;
}
@keyframes zzz-rise {
  0% { transform: translate(.3em, .2em) rotate(-10deg) scale(.45); opacity: 0; }
  16% { opacity: 1; }
  70% { opacity: .9; }
  100% { transform: translate(calc(var(--dx, .3em) + 1.1em), -2.4em) rotate(12deg) scale(1.1); opacity: 0; }
}

/* 漫符（fx.js）: 会話の気持ちに合わせて頭のまわりに出す記号。外側（.fx-p）は fx.js が毎フレーム頭の位置と向きに置き、
   大きさ（font-size）を頭の大きさに合わせる。内側（i）が CSS で動く（em 単位なので、頭と一緒に大きさが変わる） */
.fx { position: fixed; inset: 0; pointer-events: none; overflow: hidden; opacity: 0; transition: opacity .3s ease; --ink: #fffaf2; --lw: 1.3; }   /* 縁は暖かい白 */
.fx.on { opacity: 1; }
.fx-p { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.fx-p > i { position: absolute; left: -.5em; top: -.5em; width: 1em; height: 1em; display: block; animation-fill-mode: both; animation-timing-function: ease-out;
  filter: drop-shadow(0 0 .04em rgba(110, 72, 40, .55)) drop-shadow(0 0 .2em rgba(255, 196, 130, .65)); }
.fx-p svg { display: block; width: 100%; height: 100%; overflow: visible; stroke-linecap: round; stroke-linejoin: round; }
.fx-p svg path, .fx-p svg ellipse { stroke: var(--ink); stroke-width: var(--lw); }
.fx-p b { display: block; font: 900 1em / 1 var(--font); text-align: center; color: #fff; -webkit-text-stroke: .08em var(--ink); paint-order: stroke fill; text-shadow: 0 0 .12em #ffb878, 0 0 .4em #ff9c6a; }
.fx-heart > i, .fx-note > i { animation-name: fx-rise; }
.fx-sparkle > i { animation-name: fx-twinkle; }
.fx-sweat > i { animation-name: fx-slide; }
.fx-anger > i { animation-name: fx-pulse; }
.fx-question > i { animation-name: fx-wobble; }
.fx-exclaim > i { animation-name: fx-jolt; }
.fx-tear > i { animation-name: fx-fall; }
.fx-gloom > i { animation-name: fx-gloom; }
.fx-blush > i { animation-name: fx-blush; }
.fx-dots > i { animation-name: fx-fade; }
.fx-yawn > i { animation-name: fx-bubble; }
.fx-heart { color: #ff5f9e; }
.fx-sparkle { color: #ffe680; }
.fx-sweat, .fx-tear { color: #8fd2ff; }
.fx-anger { color: #ff4d5e; }
.fx-gloom { color: #8a7dd8; }
.fx-heart path, .fx-sparkle path, .fx-sweat path, .fx-tear path { fill: currentColor; }
.fx-p .hl { fill: none; stroke: #fff; stroke-width: 1.2; }
.fx-anger path { fill: none; stroke: currentColor; stroke-width: 2.6; }
.fx-gloom path { fill: none; stroke: currentColor; stroke-width: 1.4; }
.fx-blush ellipse { fill: #ff8fb4; opacity: .5; stroke: none; }
.fx-blush .ln { fill: none; stroke: #ff5f8f; stroke-width: 1.3; }
.fx-note b { color: #9fe3ff; }
/* あくびの泡: 縁だけの泡（中は少し白く）に、光の弧。〜は線だけ */
.fx-yawn { color: #e6f6ff; }
.fx-yawn svg circle { fill: rgba(255, 255, 255, .14); stroke: currentColor; stroke-width: 1.5; }
.fx-yawn svg path { fill: none; stroke: currentColor; stroke-width: 1.7; }
.fx-yawn svg .hl { stroke-width: 1.2; }
@keyframes fx-rise {
  0% { transform: translate(0, .3em) scale(.3); opacity: 0; }
  15% { transform: translate(0, 0) scale(1); opacity: 1; }
  70% { opacity: .95; }
  100% { transform: translate(calc(var(--ux, 0) * 2.4em + var(--sx, 0em)), calc(var(--uy, 1) * -2.4em)) rotate(10deg) scale(.9); opacity: 0; }
}
@keyframes fx-twinkle {
  0% { transform: scale(0) rotate(0); opacity: 0; }
  35% { transform: scale(1.15) rotate(45deg); opacity: 1; }
  100% { transform: scale(0) rotate(90deg); opacity: 0; }
}
@keyframes fx-slide {
  0% { transform: translate(0, -.2em) scale(.6); opacity: 0; }
  15% { transform: translate(0, 0) scale(1); opacity: 1; }
  75% { opacity: 1; }
  100% { transform: translate(0, .9em); opacity: 0; }
}
@keyframes fx-pulse {
  0% { transform: scale(0); opacity: 0; }
  12% { transform: scale(1.25); opacity: 1; }
  24%, 56% { transform: scale(.95); }
  40%, 72% { transform: scale(1.2); }
  85% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.1); opacity: 0; }
}
@keyframes fx-wobble {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  15% { transform: scale(1.2) rotate(8deg); opacity: 1; }
  30% { transform: scale(1) rotate(-6deg); }
  45%, 75% { transform: rotate(5deg); }
  60% { transform: rotate(-5deg); }
  85% { opacity: 1; }
  100% { transform: translate(0, -.3em); opacity: 0; }
}
@keyframes fx-jolt {
  0% { transform: translate(0, .3em) scale(0); opacity: 0; }
  14% { transform: scale(1.3); opacity: 1; }
  22% { transform: scale(.95) rotate(-6deg); }
  30% { transform: scale(1.05) rotate(5deg); }
  38% { transform: scale(1) rotate(0); }
  80% { opacity: 1; }
  100% { transform: translate(0, -.2em); opacity: 0; }
}
@keyframes fx-fall {
  0% { transform: translate(0, 0) scale(.4); opacity: 0; }
  20% { transform: scale(1); opacity: 1; }
  100% { transform: translate(0, 2.4em) scale(.8); opacity: 0; }
}
@keyframes fx-gloom {
  0% { transform: translate(0, -.4em); opacity: 0; }
  25%, 75% { opacity: .85; }
  100% { transform: translate(0, .3em); opacity: 0; }
}
@keyframes fx-blush {
  0% { transform: scale(.8); opacity: 0; }
  18% { transform: scale(1); opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}
/* 浮かぶ向き（--ux・--uy）は、置く向きの上（fx.js が入れる。寝ころんでいれば画面の上） */
@keyframes fx-bubble {
  0% { transform: scale(.2); opacity: 0; }
  16% { transform: scale(1); opacity: 1; }
  80% { opacity: .95; }
  100% { transform: translate(calc(var(--ux, 0) * var(--lift, 2em) + var(--sx, 0em)), calc(var(--uy, 1) * var(--lift, 2em) * -1)) scale(1.3); opacity: 0; }
}
@keyframes fx-fade {
  0% { transform: translate(0, .2em); opacity: 0; }
  15% { transform: none; opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .fx-p > i { animation-name: fx-fade !important; } }
/* 添い寝のつんつん（fx.js の tap）: 指先がガラスに触れたところ。font-size が波紋の直径。輪（i）は広がって消え、光る点（b）は
   ぱっと光り、つついた線（s。--a の向き）は外へ飛んで消える */
.fx-tap { position: absolute; left: 0; top: 0; width: 0; height: 0; filter: drop-shadow(0 0 .02em #ffd2a2) drop-shadow(0 0 .08em #ff9f6c); }
.fx-tap i { position: absolute; left: -.5em; top: -.5em; width: 1em; height: 1em; border-radius: 50%; border: max(2px, .016em) solid var(--ink); animation: fx-ripple .8s cubic-bezier(.15, .7, .3, 1) both; }
.fx-tap i + i { animation-delay: .14s; }
.fx-tap b { position: absolute; left: -.13em; top: -.13em; width: .26em; height: .26em; border-radius: 50%; background: radial-gradient(closest-side, #fff, rgba(255, 255, 255, 0)); animation: fx-flash .4s ease-out both; }
.fx-tap s { position: absolute; left: 0; top: max(-1.5px, -.012em); width: .15em; height: max(3px, .024em); border-radius: 1em; background: var(--ink); transform-origin: 0 50%; animation: fx-poke .5s ease-out both; }
@keyframes fx-ripple { from { transform: scale(.12); opacity: 1; } to { transform: scale(1); opacity: 0; } }
@keyframes fx-flash { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
@keyframes fx-poke {
  from { transform: rotate(var(--a)) translateX(.2em) scaleX(.3); opacity: 0; }
  25% { opacity: 1; }
  to { transform: rotate(var(--a)) translateX(.34em) scaleX(1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .fx-tap i, .fx-tap s { display: none; } }
/* 添い寝で、指でガラスに描いたハートの線（fx.js の stroke）。描き終えると少し明るくなってから消える */
.fx-stroke { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; --heart: #fff1f3; }
.fx-stroke path { fill: none; stroke: var(--heart); stroke-width: var(--w); stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 2px #ffb3c1) drop-shadow(0 0 8px #ff8fa8); }
.fx-stroke.done { animation: fx-stroke-out 1.8s ease-in both; }
@keyframes fx-stroke-out { 0% { opacity: 1; filter: brightness(1); } 25% { opacity: 1; filter: brightness(1.35); } 100% { opacity: 0; filter: brightness(1); } }
@media (prefers-reduced-motion: reduce) { .fx-stroke.done { animation-duration: .6s; } }

/* ---- チャットの見た目「ライザ風」（D-61。LAYOUT_SPEC2。試作）: 会話のログと文字の入力欄だけ ----
   ここの決まりは、どれも body[data-chat-look="ryza"][data-screen="home"] の下だけ（js/chat-look.js が付ける。標準では付けない）。
   なので、標準の見た目と、オンボードの会話には何も効かない。欄の置き場と大きさは標準のまま（広げるボタンを押したときだけ、上へ伸ばす）。
   色は白が基調（D-65。WHITE_ART_SPEC）: 半透明の白い板に濃い字。送るの丸だけオレンジ（アクセント）。
   字の色: ふつう #2b2633（濃いすみ色）、自分 #1f4f8f（濃い青）、地の文 #6b4a1c（濃いセピア）。どれも白の上で読める濃さにしてある */
/* ライザ風だけの部品（ログを広げるボタン・速さの丸・バーの中のマイク）は、標準とオンボードでは出さない */
body:not([data-chat-look="ryza"]) .ryza-only, body:not([data-screen="home"]) .ryza-only { display: none !important; }

/* ログ: 欄全体を、半透明の白い板に（キャラの上に重なる。後ろが少し透けるよう、ぼかしを少し強めに）。吹き出しはやめて、小さい丸（頭文字）とセリフの行を並べる */
body[data-chat-look="ryza"][data-screen="home"] .talk {
  border-radius: 16px; background: linear-gradient(180deg, rgba(255, 255, 255, .72) 0%, rgba(255, 255, 255, .86) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .9), 0 10px 28px rgba(40, 30, 50, .18);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
/* 何も出ていないときは、板も出さない */
body[data-chat-look="ryza"][data-screen="home"] .talk:has(.talk-list:empty) { background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
body[data-chat-look="ryza"][data-screen="home"] .talk:has(.talk-list:empty) .talk-expand { display: none !important; }
/* 上の端で消えていくのは、欄の mask で（行にはガラスのぼかしがないので、標準の --blur・--fade は使わない） */
body[data-chat-look="ryza"][data-screen="home"] .talk-scroll {
  padding: 0 10px 0 8px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 30px); mask-image: linear-gradient(180deg, transparent 0, #000 30px);
}
body[data-chat-look="ryza"][data-screen="home"] .talk-list { gap: 0; padding: 30px 0 8px; }
body[data-chat-look="ryza"][data-screen="home"] .msg {
  align-self: stretch; max-width: none; position: relative; padding: 6px 4px 6px 38px; border-radius: 0;
  background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; filter: none; transition: none;
  font-size: 13.5px; line-height: 1.65; color: #2b2633; text-shadow: none;
  border-bottom: 1px solid rgba(60, 45, 70, .08);
}
/* 小さい丸（頭文字）。キャラはオレンジ、自分は青 */
body[data-chat-look="ryza"][data-screen="home"] .msg[data-av]::before {
  content: attr(data-av); position: absolute; left: 3px; top: 5px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; line-height: 1; color: #fff; text-shadow: none;
  background: linear-gradient(160deg, #f7a24e 0%, #d8602a 100%); box-shadow: 0 0 0 1.5px #fff, 0 2px 5px rgba(60, 30, 10, .25);
}
/* 自分の行: 濃い青の字と、左から薄い青の帯（白の上でも、キャラの行と見分けられる） */
body[data-chat-look="ryza"][data-screen="home"] .msg.you { color: #163f7c; background: linear-gradient(90deg, rgba(61, 111, 180, .16) 0%, rgba(61, 111, 180, 0) 80%); }
body[data-chat-look="ryza"][data-screen="home"] .msg.you[data-av]::before { background: linear-gradient(160deg, #78a6e6 0%, #3f6db6 100%); }
/* 丸の絵（依頼者の指示）: パートナーの顔・自分のアイコン・物語の登場人物の顔。絵があれば頭文字は出さない（js/talk.js の setAvatar） */
body[data-chat-look="ryza"][data-screen="home"] .msg[data-av][data-av-img]::before { content: ""; background: var(--av-img) center / cover no-repeat, #fff; }
body[data-chat-look="ryza"][data-screen="home"] .msg.sys { color: #5f5868; font-size: 12px; }
body[data-chat-look="ryza"][data-screen="home"] .msg.muted { color: #6e6777; }
body[data-chat-look="ryza"][data-screen="home"] .msg.thinking { color: #5a5361; }
/* 物語の地の文: 丸はなし、セピアの色と明朝で、セリフの行と見分ける（白の上で読めるよう、濃いセピア） */
body[data-chat-look="ryza"][data-screen="home"] .msg.story-narr { text-indent: 0; color: #6b4a1c; font-size: 13px; line-height: 1.75; }
body[data-chat-look="ryza"][data-screen="home"] .day-sep {
  padding: 8px 0 4px; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; filter: none;
  font-size: 10.5px; letter-spacing: .08em; color: rgba(60, 45, 70, .6);
}
body[data-chat-look="ryza"][data-screen="home"] .story-card { margin: 2px 0 6px; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; filter: none; color: #2b2633; }
body[data-chat-look="ryza"][data-screen="home"] .story-card span { color: #6b4a1c; }
/* ログを広げる・戻すボタン（板の右上の端。ライザの上下の矢印）。白い板の上なので、白い丸に濃い矢印 */
.talk-expand {
  position: absolute; z-index: 1; top: 6px; right: 6px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; color: #4a4452; background: rgba(255, 255, 255, .8); box-shadow: inset 0 0 0 1px rgba(60, 45, 70, .22), 0 1px 3px rgba(40, 30, 50, .12);
}
.talk-expand svg { width: 16px; height: 16px; stroke-width: 2; }
.talk-expand .i-close, .talk-expand[aria-pressed="true"] .i-open { display: none; }
.talk-expand[aria-pressed="true"] .i-close { display: inline; }
/* 広げたとき: 縦は、上のボタンの下まで伸ばす（シアターで物語の状態パネルが出ているときは、その下まで）。横は、幅を広げる */
body[data-chat-look="ryza"][data-screen="home"][data-orient="portrait"] .talk.expanded { top: calc(var(--safe-t) + 68px); height: auto; }
body[data-chat-look="ryza"][data-screen="home"][data-orient="portrait"]:has(#storyState:not([hidden])) .talk.expanded { top: calc(var(--safe-t) + 62px + var(--state-h) + 8px); }
body[data-chat-look="ryza"][data-screen="home"][data-orient="landscape"] .talk.expanded { width: min(64vw, 600px); }

/* 入力欄: 白いピル。左に文字の速さの丸、真ん中に入力、右にマイクの丸と、オレンジの送るの丸 */
body[data-chat-look="ryza"][data-screen="home"] .input-bar {
  gap: 6px; padding: 0 5px; border-radius: 999px;
  background: rgba(255, 255, 255, .9); background-image: none;
  box-shadow: inset 0 0 0 1px rgba(60, 45, 70, .1), 0 8px 22px rgba(40, 30, 50, .2);
}
body[data-chat-look="ryza"][data-screen="home"] .input-bar input { padding: 0 4px; color: #2b2633; caret-color: #e2701f; }
body[data-chat-look="ryza"][data-screen="home"] .input-bar input::placeholder { color: rgba(60, 45, 70, .5); }
/* 速さの丸・マイクの丸: 白地の上で見えるよう、薄いグレーの地に濃い字（速さは細いふちも） */
.bar-speed {
  width: 40px; height: 40px; flex: none; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; letter-spacing: -.02em; color: #4a4452;
  background: rgba(60, 45, 70, .06); box-shadow: inset 0 0 0 1.5px rgba(60, 45, 70, .32);
}
.bar-mic { width: 40px; height: 40px; flex: none; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; color: #4a4452; background: rgba(60, 45, 70, .07); }
.bar-mic svg { width: 20px; height: 20px; stroke-width: 1.9; }
/* 送る: いつもオレンジの丸と矢印（空のときは押しても何もしない。main.js） */
body[data-chat-look="ryza"][data-screen="home"] .bar-action {
  background: linear-gradient(180deg, #f8a54c 0%, #e2701f 100%); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 4px 10px rgba(226, 112, 31, .4);
}
body[data-chat-look="ryza"][data-screen="home"] .bar-action .i-mic { display: none; }
body[data-chat-look="ryza"][data-screen="home"] .bar-action .i-send { display: block; }
body[data-chat-look="ryza"][data-screen="home"] .input-bar:not(.has-text) .bar-action { opacity: .6; }
body[data-chat-look="ryza"][data-orient="landscape"] .bar-speed, body[data-chat-look="ryza"][data-orient="landscape"] .bar-hint, body[data-chat-look="ryza"][data-orient="landscape"] .bar-mic { width: 36px; height: 36px; }
/* 物語のあいだは、速さの丸の代わりに 💡（D-137）。候補がないあいだ（考えている・話している・結末）は薄く、候補があると黄色く灯る。出しているあいだは押した印 */
.bar-hint {
  width: 40px; height: 40px; flex: none; padding: 0; border: 0; border-radius: 50%; display: none; place-items: center; cursor: pointer;
  color: var(--ink); background: var(--fill); box-shadow: var(--fill-edge); transition: color .25s ease, background-color .25s ease, opacity .25s ease;
}
.bar-hint svg { width: 21px; height: 21px; stroke-width: 1.8; }
.bar-hint .bulb { fill: transparent; transition: fill .25s ease; }
body[data-chat-look="ryza"] .input-bar .bar-hint { display: grid; }   /* 物語でも日常でも（D-142） */
.bar-hint[aria-busy="true"] { animation: hint-busy 1s ease-in-out infinite; }   /* 日常: 候補を作っているあいだ */
@keyframes hint-busy { 50% { opacity: .45; } }
.bar-hint:disabled { opacity: .35; cursor: default; }
.bar-hint[data-ready] { color: #e0a21c; }
.bar-hint[data-ready] .bulb { fill: rgba(255, 205, 80, .35); }
.bar-hint[aria-pressed="true"] { color: #fff; background: linear-gradient(180deg, #f6c650 0%, #e0a21c 100%); box-shadow: 0 3px 8px rgba(224, 162, 28, .4); }
.bar-hint[aria-pressed="true"] .bulb { fill: rgba(255, 255, 255, .35); }
@keyframes hint-ready { 0% { box-shadow: 0 0 0 0 rgba(224, 162, 28, .6); } 100% { box-shadow: 0 0 0 10px rgba(224, 162, 28, 0); } }
.bar-hint.lit { animation: hint-ready .9s ease-out 1; }

/* ==== ライザ風の浮世町の入口: ワールドマップ（D-62。LAYOUT_SPEC3）====
   ライザ風のときだけ、入口の場所カード（.town-card）の代わりに、町の絵（img/town_map.webp。縦 1:2）の上に地点を置いたマップを出す。
   決まりはどれも body[data-chat-look="ryza"] の下か、標準では出さない .town-map の中だけ（標準の入口は前のまま）。
   絵は、標準では出さない要素の背景なので、標準のときは読み込まない */
.town-map { display: none; }
body[data-chat-look="ryza"] .town { padding: 0; overflow: hidden; background: #f3efe6; -webkit-backdrop-filter: none; backdrop-filter: none; animation: map-open .28s ease-out both; }
body[data-chat-look="ryza"] .town-card { display: none; }
body[data-chat-look="ryza"] .town-map { display: block; position: absolute; inset: 0; --map-w: min(max(100vw, 50dvh), 100dvh / 1.12); }
/* 絵が画面より細いとき（横向き）の両わき: 同じ絵をぼかして敷く */
body[data-chat-look="ryza"] .town-map::before {
  content: ""; position: absolute; inset: -40px; background: url(../img/town_map.webp) center / cover no-repeat;
  filter: blur(18px) saturate(.85); opacity: .7;
}
/* 絵の大きさ（MAP）: 縦は画面いっぱい（はみ出す分は指でずらせる）。ただし地点のある帯（札も入れて、絵の高さの 56% ＝ 絵の幅の 1.12 倍）が、画面の高さに必ず収まる大きさまで（--map-w の 100dvh / 1.12）。
   横向きでは、この上限で、まんなかに縦長の絵を出す（両わきは上のぼかし） */
.town-map-scroll { position: absolute; inset: 0; display: flex; overflow: auto; overscroll-behavior: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.town-map-scroll::-webkit-scrollbar { display: none; }
.town-map-world {
  position: relative; flex: none; margin: auto; width: var(--map-w); aspect-ratio: 1 / 2;
  background: url(../img/town_map.webp) center / 100% 100% no-repeat;
}
/* 時間で絵を替える（D-141。main.js の mapTime が #townMap の data-time に day・evening・night）。形は昼の絵と同じで、光と空だけがちがう
   （tools/make_town_map_times.py で、昼の絵から作った）。読むのは、いまの時間の絵だけ */
.town-map[data-time="evening"] .town-map-world { background-image: url(../img/town_map_evening.webp); }
.town-map[data-time="night"] .town-map-world { background-image: url(../img/town_map_night.webp); }
body[data-chat-look="ryza"] .town-map[data-time="evening"]::before { background-image: url(../img/town_map_evening.webp); }
body[data-chat-look="ryza"] .town-map[data-time="night"]::before { background-image: url(../img/town_map_night.webp); }
/* 夜は、見出しと下の注意書きのぼかしを、紙の色から夜の藍色に（字は明るく）。横向きでは、両わきの暗いぼかしの上に字が乗るので、字だけ明るく */
.town-map[data-time="night"] :is(.town-map-head, .town-map-note) { --town-navy: #f1ecdf; --town-text: #dfe4f0; }   /* 地点の札（白い札）は、そのままの濃い字 */
.town-map[data-time="night"] .town-map-head { background: linear-gradient(180deg, rgba(24, 33, 62, .94) 0%, rgba(24, 33, 62, .78) 60%, rgba(24, 33, 62, 0) 100%); }
.town-map[data-time="night"] .town-map-note { color: #c9d0e2; background: linear-gradient(0deg, rgba(24, 33, 62, .9) 0%, rgba(24, 33, 62, 0) 100%); }
body[data-chat-look="ryza"] .town:has(.town-map[data-time="night"]) { background: #18213e; }
body[data-orient="landscape"] .town-map[data-time="night"] .town-map-head, body[data-orient="landscape"] .town-map[data-time="night"] .town-map-note { background: none; }
/* 見出し（町名「浮世町」）と、下の注意書き。絵の上に、紙の色のぼかしで重ねる */
.town-map-head {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2; pointer-events: none; text-align: center;
  padding: calc(var(--safe-t) + 14px) 16px 26px; color: var(--town-text);
  background: linear-gradient(180deg, rgba(243, 239, 230, .96) 0%, rgba(243, 239, 230, .82) 60%, rgba(243, 239, 230, 0) 100%);
}
.town-map-head h2 { margin: 2px 0 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif; font-size: 24px; font-weight: 600; letter-spacing: .18em; color: var(--town-navy); }
.town-map-lead { margin: 4px 0 0; font-size: 13px; line-height: 1.5; }
/* いまの時間（見出しの上。日付は小さく、時刻は数字の幅をそろえて） */
.town-clock { margin: 0; display: flex; justify-content: center; align-items: baseline; gap: 8px; color: var(--town-navy); }
.town-clock-date { font-size: 11.5px; letter-spacing: .08em; opacity: .75; }
.town-clock-time { font-size: 17px; font-weight: 700; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.town-map-note {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; margin: 0; pointer-events: none; text-align: center;
  padding: 18px 16px calc(var(--safe-b) + 10px); font-size: 11px; color: #5f6878;
  background: linear-gradient(0deg, rgba(243, 239, 230, .92) 0%, rgba(243, 239, 230, 0) 100%);
}
body[data-orient="landscape"] .town-map-head {
  right: auto; width: calc((100vw - var(--map-w)) / 2); top: 50%; transform: translateY(-50%);
  padding: 0 calc(var(--safe-l) + 12px); background: none;
}
body[data-orient="landscape"] .town-map-note { left: auto; right: 0; width: calc((100vw - var(--map-w)) / 2); top: 50%; bottom: auto; transform: translateY(-50%); padding: 0 calc(var(--safe-r) + 12px) 0 12px; background: none; }

/* 地点: 札（名前と、何の場所か）の下の三角の先が、絵の (--x, --y) を指す */
.map-pin {
  position: absolute; left: var(--x); top: var(--y); z-index: 1; transform: translate(-50%, -100%);
  display: flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 12px 5px; border: 0; border-radius: 14px; font: inherit;
  background: #fff; color: var(--town-navy); box-shadow: 0 6px 16px rgba(29, 43, 79, .22), inset 0 0 0 1.5px rgba(42, 143, 138, .55);
  animation: pin-drop .42s cubic-bezier(.2, .9, .3, 1.3) both; cursor: pointer;
}
.map-pin::after {   /* 下の三角（建物を指す） */
  content: ""; position: absolute; left: 50%; bottom: -7px; width: 14px; height: 14px; transform: translateX(-50%) rotate(45deg);
  background: inherit; border-radius: 0 0 4px 0; box-shadow: 3px 3px 6px rgba(29, 43, 79, .12); z-index: -1;
  border: solid var(--pin-line, transparent); border-width: 0 1.5px 1.5px 0; box-sizing: border-box;   /* 札と同じ枠の線（依頼者の指摘） */
}
.map-pin[data-place="daily"] { --pin-line: rgba(42, 143, 138, .55); }
.map-pin[data-place="story"] { --pin-line: rgba(61, 111, 180, .55); }
.map-pin-name { font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif; font-size: 15px; font-weight: 600; letter-spacing: .06em; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.map-pin-sub { font-size: 10.5px; font-weight: 700; color: var(--town-teal); white-space: nowrap; }
.map-pin[data-place="story"] { box-shadow: 0 6px 16px rgba(29, 43, 79, .22), inset 0 0 0 1.5px rgba(61, 111, 180, .55); }
.map-pin[data-place="story"] .map-pin-sub { color: var(--town-blue); }
/* 行ける場所: 足もとに、ゆっくり広がる輪（ここに行ける、の印） */
.map-pin:not(.locked)::before {
  content: ""; position: absolute; left: 50%; bottom: -16px; width: 26px; height: 12px; margin-left: -13px; border-radius: 50%;
  border: 2px solid var(--town-teal); animation: pin-ring 1.8s ease-out infinite; pointer-events: none;
}
.map-pin[data-place="story"]::before { border-color: var(--town-blue); }
.map-pin:not(.locked):active { transform: translate(-50%, -100%) scale(.95); }
.map-pin:focus-visible { outline: 2px solid var(--town-blue); outline-offset: 3px; }
/* まだ開いていない場所: すりガラスのグレーの札に、鍵の印と「準備中」 */
.map-pin.locked { padding: 4px 10px 4px; background: rgba(236, 238, 242, .86); color: #6f7785; box-shadow: 0 4px 10px rgba(29, 43, 79, .14); cursor: default; }
.map-pin.locked .map-pin-name { font-size: 13px; }
.map-pin.locked .map-pin-sub { color: #8a92a0; font-size: 10px; }
.map-pin-lock {   /* 鍵の印（四角の本体と、上の輪） */
  position: relative; width: 9px; height: 7px; margin-top: 4px; border-radius: 2px; background: currentColor; flex: none;
}
.map-pin-lock::before { content: ""; position: absolute; left: 1.5px; top: -5px; width: 6px; height: 6px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 4px 4px 0 0; box-sizing: border-box; }
/* まだない場所を押したときの、小さな理由の表示（押した地点の上に、少しのあいだ） */
.map-note {
  position: absolute; z-index: 3; left: var(--x); top: var(--y); transform: translate(-50%, calc(-100% - 52px)); margin: 0;
  width: max-content; max-width: min(240px, 80vw); padding: 7px 12px; border-radius: 12px; font-size: 12px; line-height: 1.5; text-align: center;
  color: #fff; background: rgba(29, 43, 79, .88); box-shadow: 0 6px 14px rgba(29, 43, 79, .25); animation: note-in .18s ease-out both; pointer-events: none;
}
.map-note[hidden] { display: none; }
/* 移動の演出（main.js の MAP.travelMs）: 押した地点へ寄りながら、マップが薄くなって、部屋が見えてくる */
body[data-chat-look="ryza"] .town.traveling { animation: map-leave var(--travel-ms, 520ms) ease-in both; pointer-events: none; }
.town.traveling .town-map-world { transform-origin: var(--to-x, 50%) var(--to-y, 50%); animation: map-zoom var(--travel-ms, 520ms) cubic-bezier(.5, 0, .7, .4) both; }
.town.traveling .town-map-head, .town.traveling .town-map-note { opacity: 0; transition: opacity .15s; }
.map-pin.going { animation: pin-go .3s ease-out both; }
@keyframes map-open { from { opacity: 0; } }
@keyframes map-leave { 0%, 35% { opacity: 1; } 100% { opacity: 0; } }
@keyframes map-zoom { to { transform: scale(1.8); } }
@keyframes pin-drop { from { opacity: 0; transform: translate(-50%, calc(-100% - 14px)); } }
@keyframes pin-go { 50% { transform: translate(-50%, calc(-100% - 8px)) scale(1.08); } }
@keyframes pin-ring { from { transform: scale(.5); opacity: .9; } to { transform: scale(1.8); opacity: 0; } }
@keyframes note-in { from { opacity: 0; transform: translate(-50%, calc(-100% - 46px)); } }
@media (prefers-reduced-motion: reduce) {
  .map-pin, .map-pin::before, .map-note, .town.traveling .town-map-world, .map-pin.going { animation: none !important; }
}

/* いっしょに進めていること（D-71。元のアプリの D-65。js/main.js の renderGoals） */
.profile-goals { border-radius: 30px; padding: 16px; }
.goal-list { display: flex; flex-direction: column; gap: 10px; }
.goal-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: 18px; background: var(--fill); box-shadow: var(--fill-edge); }
.goal-ic { flex: none; font-size: 20px; line-height: 1.3; }
.goal-text { flex: 1; min-width: 0; }
.goal-text p { margin: 0; overflow-wrap: anywhere; }
.goal-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.goal-step { font-size: 13px; color: var(--ink); margin-top: 2px !important; }
.goal-meta { font-size: 11.5px; color: var(--ink-2); margin-top: 4px !important; }
.goal-acts { flex: none; display: flex; flex-direction: column; gap: 6px; }
.goal-btn { height: 30px; padding: 0 12px; border: 0; border-radius: 15px; font-size: 12px; font-weight: 700; color: var(--ink); background: var(--fill-on); box-shadow: var(--fill-edge); }
.goal-btn.ok { color: #fff; background: var(--accent); }
.goal-empty { margin: 0; font-size: 13px; line-height: 1.7; color: var(--ink-2); }
.goal-done summary { cursor: pointer; font-size: 13px; color: var(--ink-2); padding: 4px 2px; }
.goal-done-item { margin: 4px 0 0 8px; font-size: 13px; color: var(--ink); }
.goal-coach { margin-top: 12px; font-size: 13px; }

/* ---- 下のメニューを設定に集める（D-74。元のアプリの D-57）: いちばん下のタブ（?・?・会話・人）は出さず、プロフィールは設定の「自分」から開いて、
   右上の × で戻る。「寄り添い」と寝返りのボタンも設定に入れる。✏️🎤 は画面に残す（横も縦も）。タブのぶん（--tab-h）を 0 にして、
   ボタンの列と吹き出しの欄を下げる */
.tabbar { display: none !important; }
body[data-screen="home"] { --tab-h: 0px; }
body[data-screen="home"] .snuggle-btn, body[data-screen="home"] .roll-btn { display: none !important; }
body[data-screen="home"] .controls { justify-content: flex-end; }
.profile-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile-back { flex: none; width: 44px; height: 44px; }
.profile-back svg { width: 20px; height: 20px; stroke-width: 2; }
#setRoll, #btnOpenAlbum { margin-top: 8px; }

/* ---- アルバム（D-75）: 物語の 📷、場面の絵の吹き出し、部屋の本の札、アルバムのページ（プロフィールと同じ形）、絵を大きく見る ---- */
.photo-btn { display: none; width: var(--ctl-h); height: var(--ctl-h); margin-right: 10px; }
body[data-screen="home"][data-backdrop][data-chat-mode="story"]:not([data-page]) .photo-btn { display: inline-flex; align-items: center; justify-content: center; }
.photo-btn.busy { pointer-events: none; }
.photo-btn.busy svg { animation: photo-busy 1.2s ease-in-out infinite; }
@keyframes photo-busy { 50% { opacity: .35; transform: scale(.88); } }
.msg.photo-msg { padding: 8px 0 10px; cursor: pointer; }
.msg.photo-msg img { display: block; width: min(62%, 240px); aspect-ratio: 2 / 3; object-fit: cover; border-radius: 16px; box-shadow: 0 6px 18px rgba(30, 26, 34, .18); }
.msg.photo-msg span { display: block; margin-top: 6px; font-size: 12px; color: #5f5868; }
body[data-page="album"] .profile-bg { display: block; }
body[data-page="album"] .talk, body[data-page="album"] .controls, body[data-page="album"] .settings-btn, body[data-page="album"] .pose-btn,
body[data-page="album"] .input-bar, body[data-page="album"] .mode-seg, body[data-page="album"] .town-btn, body[data-page="album"] .story-state,
body[data-page="album"] .album-tag { display: none !important; }
/* コンビニ（手伝いと手配。見本だけ）: 思い出のページと同じ、ぼかした部屋の上のガラス */
body[data-page="shop"] .profile-bg { display: block; }
body[data-page="shop"] .talk, body[data-page="shop"] .controls, body[data-page="shop"] .settings-btn, body[data-page="shop"] .pose-btn,
body[data-page="shop"] .input-bar, body[data-page="shop"] .mode-seg, body[data-page="shop"] .town-btn, body[data-page="shop"] .story-state,
body[data-page="shop"] .album-tag { display: none !important; }
.profile.shop { padding-bottom: calc(var(--safe-b) + 24px); }
.shop-hero { margin: 0; border-radius: 26px; overflow: hidden; }
.shop-hero img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
.shop-hero figcaption { display: grid; gap: 4px; padding: 12px 16px 14px; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.shop-hero figcaption b { font-size: 16px; color: var(--ink); }
.shop-note { margin: -4px 4px 0; padding: 8px 12px; border-radius: 14px; font-size: 12px; line-height: 1.6; color: #8a5a12; background: rgba(240, 180, 80, .18); }
body[data-glass="dark"] .shop-note { color: #f3c477; background: rgba(240, 180, 80, .14); }
.shop-item-icon { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(160deg, #f0a54a, #d9732a); box-shadow: 0 3px 8px rgba(217, 115, 42, .3); }
.shop-item-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.shop-item-icon svg .fill { fill: currentColor; stroke: none; }
/* コンビニの棚（D-111）: つなげるものごとの札と「つなぐ」 */
.ext-list { display: grid; gap: 10px; }
.ext-item { border-radius: 20px; padding: 12px; display: flex; gap: 12px; align-items: center; }
.ext-item-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ext-item-body b { font-size: 15px; color: var(--ink); }
.ext-item-body small { font-size: 11.5px; color: var(--ink-2); }
.ext-item-body p { margin: 2px 0 0; font-size: 12px; line-height: 1.5; color: var(--ink-2); }
.ext-toggle { flex: none; min-width: 84px; min-height: 36px; padding: 6px 14px; border: 0; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 700; color: #fff; background: linear-gradient(160deg, #f0a54a, #d9732a); cursor: pointer; }
.ext-toggle.on { color: #b0601a; background: transparent; box-shadow: inset 0 0 0 1.5px rgba(208, 120, 40, .6); }
.ext-toggle.on::before { content: "✓ "; }
/* 図書館（D-115。もとのメモリー。D-120）: コンビニと同じページの形。覚えていることの札と、思い出の年表 */
body[data-page="memory"] .profile-bg { display: block; }
body[data-page="memory"] .talk, body[data-page="memory"] .controls, body[data-page="memory"] .settings-btn, body[data-page="memory"] .pose-btn,
body[data-page="memory"] .input-bar, body[data-page="memory"] .mode-seg, body[data-page="memory"] .town-btn, body[data-page="memory"] .story-state,
body[data-page="memory"] .album-tag { display: none !important; }
.memory-status { color: #4b4f8a; background: rgba(120, 110, 200, .14); }
.memory-item { padding: 10px 10px 10px 12px; }
.memory-kind { flex: none; min-width: 58px; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; text-align: center; color: #fff; background: #8b84c9; }
.memory-kind[data-kind="like"] { background: #e0819d; }
.memory-kind[data-kind="dislike"] { background: #8a9bb0; }
.memory-kind[data-kind="plan"] { background: #3fa3a0; }
.memory-kind[data-kind="day"] { background: #d99a3a; }
.memory-kind[data-kind="important"] { background: #7a6cc0; }
.memory-kind[data-kind="event"] { background: #5f9fd6; }
.memory-kind[data-kind="note"] { background: #9a8a78; }
.memory-item .ext-item-body b { font-size: 14px; font-weight: 600; line-height: 1.5; }
.memory-del { flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); background: var(--fill); cursor: pointer; }
.memory-del svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.memory-empty { margin: 4px 2px; font-size: 13px; line-height: 1.7; color: var(--ink-2); }
.memory-add { margin-top: 10px; border-radius: 20px; padding: 8px; display: flex; gap: 8px; align-items: center; }
.memory-add input { flex: 1; min-width: 0; min-height: 40px; padding: 8px 12px; border: 0; border-radius: 14px; font: inherit; font-size: 16px; color: var(--ink); background: var(--fill); box-shadow: var(--fill-edge); }
.memory-add .ext-toggle { background: linear-gradient(160deg, #9c92dc, #6f64bd); }
.memory-timeline { list-style: none; margin: 0; padding: 0 0 0 14px; display: grid; gap: 12px; border-left: 2px solid rgba(122, 108, 192, .35); }
.memory-event { position: relative; display: grid; gap: 2px; padding-left: 10px; }
.memory-event::before { content: ""; position: absolute; left: -21px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #7a6cc0; box-shadow: 0 0 0 3px rgba(255, 255, 255, .8); }
.memory-event[data-kind="goal"]::before { background: #d99a3a; }
.memory-event[data-kind="ending"]::before { background: #4f7fd0; }
.memory-event-day { font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.memory-event b { font-size: 14px; color: var(--ink); }
.memory-event p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.memory-album { margin-top: 14px; width: 100%; }
.map-pin[data-place="memory"] { --pin-line: rgba(122, 108, 192, .6); box-shadow: 0 6px 16px rgba(29, 43, 79, .22), inset 0 0 0 1.5px rgba(122, 108, 192, .6); }
.map-pin[data-place="memory"] .map-pin-sub { color: #5d50a8; }
.map-pin[data-place="memory"]::before { border-color: #7a6cc0; }
.town-place[data-place="memory"] .town-place-sub { color: #5d50a8; }
/* カフェ（D-114）: コンビニと同じページの形。パートナーの札 */
body[data-page="cafe"] .profile-bg { display: block; }
body[data-page="cafe"] .talk, body[data-page="cafe"] .controls, body[data-page="cafe"] .settings-btn, body[data-page="cafe"] .pose-btn,
body[data-page="cafe"] .input-bar, body[data-page="cafe"] .mode-seg, body[data-page="cafe"] .town-btn, body[data-page="cafe"] .story-state,
body[data-page="cafe"] .album-tag { display: none !important; }
/* パートナーの札（D-117）: 2 列。絵（3D のキャラを撮ったもの）と名前・ひとこと・相性 */
.cafe-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cafe-card { display: grid; padding: 0; border: 0; border-radius: 20px; overflow: hidden; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.cafe-card:active { transform: scale(.98); }
.cafe-card.now { box-shadow: inset 0 0 0 2px rgba(200, 110, 140, .6); }
.cafe-card-pic { display: block; aspect-ratio: 6 / 5; overflow: hidden; background: #eee; }
.cafe-card-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cafe-card-body { display: grid; gap: 2px; padding: 9px 11px 11px; }
.cafe-card-body b { font-size: 16px; }
.cafe-card-body small { font-size: 11px; line-height: 1.45; color: var(--ink-2); }
.cafe-card-body em { margin-top: 3px; font-style: normal; font-size: 11.5px; font-weight: 700; color: #b0506f; }
/* くわしい紹介（D-117） */
.cafe-profile { display: grid; gap: 12px; }
.cafe-pic { position: relative; margin: 0; border-radius: 26px; overflow: hidden; touch-action: pan-y; }
.cafe-pic img { display: block; width: 100%; height: auto; aspect-ratio: 6 / 5; object-fit: cover; }
.cafe-nav { position: absolute; top: 50%; width: 40px; height: 40px; margin-top: -20px; display: grid; place-items: center; border: 0; cursor: pointer; }
.cafe-nav svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cafe-nav.prev { left: 10px; }
.cafe-nav.next { right: 10px; }
.cafe-now { position: absolute; left: 12px; top: 12px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; background: rgba(192, 96, 127, .92); }
.cafe-dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 6px; }
.cafe-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .7); box-shadow: 0 1px 3px rgba(29, 43, 79, .3); }
.cafe-dots i.on { width: 18px; border-radius: 4px; background: #fff; }
.cafe-name { display: flex; align-items: baseline; gap: 10px; padding: 0 4px; }
.cafe-name h2 { margin: 0; font-size: 26px; color: var(--ink); }
.cafe-type { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #b0506f; box-shadow: inset 0 0 0 1.5px rgba(200, 110, 140, .55); }
.cafe-sub { margin: -6px 4px 0; font-size: 13.5px; color: var(--ink-2); }
.cafe-match { margin: -4px 4px 0; font-size: 13px; font-weight: 700; color: #b0506f; }
.cafe-quote { margin: 0; padding: 14px 16px; border-radius: 20px; display: grid; gap: 10px; }
.cafe-quote blockquote { margin: 0; font-size: 14px; line-height: 1.75; color: var(--ink); }
.cafe-voice { justify-self: start; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border: 0; border-radius: 18px; font: inherit; font-size: 13px; font-weight: 700; color: #b0506f; background: rgba(228, 138, 168, .16); cursor: pointer; }
.cafe-voice svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cafe-voice.on { color: #fff; background: linear-gradient(160deg, #e48aa8, #c0607f); }
.cafe-voice.on span::after { content: '中…'; }
.cafe-facts { padding: 14px 16px 16px; border-radius: 20px; display: grid; }
.cafe-facts ul { margin: 0 0 14px; padding-left: 1.2em; display: grid; gap: 4px; font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.cafe-facts p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.cafe-likes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.cafe-likes span { padding: 5px 11px; border-radius: 999px; font-size: 12.5px; color: var(--ink); background: rgba(228, 138, 168, .14); }
.cafe-note { margin: 0 4px; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); }
.cafe-buttons { display: grid; gap: 10px; padding-bottom: 8px; }
.cafe-buttons button { height: 50px; border: 0; border-radius: 25px; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.map-pin[data-place="cafe"] { --pin-line: rgba(200, 110, 140, .6); box-shadow: 0 6px 16px rgba(29, 43, 79, .22), inset 0 0 0 1.5px rgba(200, 110, 140, .6); }
.map-pin[data-place="cafe"] .map-pin-sub { color: #b0506f; }
.map-pin[data-place="cafe"]::before { border-color: #c96a8b; }
.town-place[data-place="cafe"] .town-place-sub { color: #b0506f; }
.map-pin[data-place="shop"] { --pin-line: rgba(208, 120, 40, .6); box-shadow: 0 6px 16px rgba(29, 43, 79, .22), inset 0 0 0 1.5px rgba(208, 120, 40, .6); }
.map-pin[data-place="shop"] .map-pin-sub { color: #c0661c; }
.map-pin[data-place="shop"]::before { border-color: #d9822b; }
.album-lead { margin: 0 8px; font-size: 13px; line-height: 1.7; color: var(--ink-2); }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
body[data-orient="landscape"] .album-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.album-item { position: relative; padding: 0; border: 0; border-radius: 18px; overflow: hidden; aspect-ratio: 2 / 3; background: var(--fill); box-shadow: var(--fill-edge); }
.album-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-item .album-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 8px; font-size: 11px; font-weight: 700; color: #fff; text-align: left;
  background: linear-gradient(transparent, rgba(0, 0, 0, .55)); }
/* だれと撮った絵か（D-161）: 絵の左上の顔と名前・上のパートナーの切り替え */
.album-who-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; line-height: 1; }
.album-who-tag img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; display: block; }
.album-item .album-who-tag { position: absolute; left: 6px; top: 6px; padding: 3px 9px 3px 3px; border-radius: 999px; color: #fff;
  background: rgba(18, 16, 24, .55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.album-who { display: flex; gap: 6px; overflow-x: auto; padding: 2px 4px; scrollbar-width: none; }
.album-who::-webkit-scrollbar { display: none; }
.album-who[hidden] { display: none; }
.album-who button { flex: none; display: inline-flex; align-items: center; min-height: 34px; padding: 4px 12px 4px 5px; border: 0; border-radius: 999px;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--fill); box-shadow: var(--fill-edge); }
.album-who button[data-who="all"] { padding-left: 12px; }
.album-who button[aria-pressed="true"] { background: var(--fill-on); color: var(--ink); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .75); }
.album-who img { width: 24px; height: 24px; }
.album-who small { margin-left: 6px; font-size: 11px; font-weight: 600; opacity: .7; }
.photo-view { position: fixed; inset: 0; z-index: 9; background: rgba(12, 10, 18, .92); display: flex; align-items: center; justify-content: center; }
.photo-view[hidden] { display: none; }
.photo-view img { max-width: 100%; max-height: 100%; object-fit: contain; }
.photo-view-bar { position: absolute; left: calc(var(--side) + var(--safe-l)); right: calc(var(--side) + var(--safe-r)); bottom: var(--bar-b); max-width: 520px; margin: 0 auto;
  border-radius: 24px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.photo-view-cap { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--ink); max-height: 5.4em; overflow-y: auto; white-space: pre-line; }
.photo-view-acts { display: flex; gap: 10px; justify-content: flex-end; }
.photo-view-acts .ghost { text-decoration: none; }
.ghost.danger { color: #c0392b; }
.photo-view-close { position: absolute; top: calc(var(--safe-t) + 14px); right: calc(var(--side) + var(--safe-r)); width: 44px; height: 44px; }
.photo-view-close svg { width: 20px; height: 20px; stroke-width: 2; }

/* ---- D-77（2026-11-20、依頼者の指示）---- */
/* ハーフモーダル（設定・ポーズ・目標・プロフィールの編集）: 縦は、横幅いっぱい・画面の下の端まで（上の角だけ丸く）。中は、ホームバーのぶん下をあける */
body[data-orient="portrait"] .sheet { left: 0; right: 0; bottom: 0; border-radius: 28px 28px 0 0; height: calc(52vh + var(--safe-b)); }
body[data-orient="portrait"] .sheet .sheet-body { padding-bottom: calc(16px + var(--safe-b)); }
body[data-orient="portrait"] .sheet .sheet-foot { padding-bottom: calc(10px + var(--safe-b)); }
@keyframes sheet-up { from { transform: translateY(100%); } }
/* 目標の 🚩（ログを広げるボタンの左）。リビングだけ */
.talk-goals {
  position: absolute; z-index: 1; top: 6px; right: 40px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
  display: none; place-items: center; color: var(--ink); background: var(--fill); box-shadow: var(--fill-edge);
}
body[data-chat-look="ryza"][data-screen="home"][data-chat-mode="daily"] .talk-goals { display: grid; }
.talk-goals svg { width: 15px; height: 15px; stroke-width: 2.2; fill: none; }
.talk-goals svg .flag { fill: var(--accent); stroke: var(--accent); stroke-width: 1.2; stroke-linejoin: round; }
.talk-goals-n { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  font-size: 10px; font-weight: 700; line-height: 16px; color: #fff; background: var(--accent); box-shadow: 0 0 0 1.5px #fff; }
.talk-goals-n[hidden] { display: none; }
body[data-sheet] .talk-goals { display: none !important; }
.goals-sheet .goal-coach { margin-top: 14px; }
/* 会話のログの板: 澄んだガラス（D-146。前は上のボタンと同じ、濃いめのガラス）。昼は白いガラスに濃い字、夜は暗いガラスに明るい字（D-48 の data-glass） */
body[data-chat-look="ryza"][data-screen="home"] .talk {
  background-color: var(--glass-clear); background-image: var(--glass-sheen);
  -webkit-backdrop-filter: var(--glass-clear-blur); backdrop-filter: var(--glass-clear-blur);
  box-shadow: var(--glass-clear-edge), var(--glass-drop);
}
body[data-chat-look="ryza"][data-screen="home"] .talk .msg, body[data-chat-look="ryza"][data-screen="home"] .talk .day-sep,
body[data-chat-look="ryza"][data-screen="home"] .talk .story-card, body[data-chat-look="ryza"][data-screen="home"] .talk .hints-head { text-shadow: var(--clear-halo); }
body[data-chat-look="ryza"][data-screen="home"] .msg { color: var(--ink); border-bottom-color: color-mix(in srgb, var(--ink) 9%, transparent); }
body[data-chat-look="ryza"][data-screen="home"] .msg.sys, body[data-chat-look="ryza"][data-screen="home"] .msg.muted,
body[data-chat-look="ryza"][data-screen="home"] .msg.thinking, body[data-chat-look="ryza"][data-screen="home"] .msg.photo-msg span { color: var(--ink-2); }
body[data-chat-look="ryza"][data-screen="home"] .day-sep { color: color-mix(in srgb, var(--ink) 60%, transparent); }
body[data-chat-look="ryza"][data-screen="home"] .story-card { color: var(--ink); }
/* 会話のログと入力欄は、昼でも夜でも、暗いガラスに白い字（D-148。依頼者の指摘「iOS 27 のデザインは、枠の中を暗くして白文字で書いている」）。
   部屋の明るさで替えるガラス（data-glass）は、上のボタン・シート・メニューだけ。ここでは、板の中の色の変数を、暗いガラスのものに置きかえる */
body[data-chat-look="ryza"][data-screen="home"] :is(.talk, .input-bar) {
  --ink: #f6f3fa; --ink-2: #d6d0de;
  --glass-clear: rgba(14, 12, 24, .5);
  --glass-clear-blur: blur(18px) saturate(160%) brightness(.8);
  --glass-sheen: linear-gradient(165deg, rgba(255, 255, 255, .14) 0%, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0) 72%, rgba(255, 255, 255, .05) 100%);
  --glass-clear-edge: inset 0 1px 0 rgba(255, 255, 255, .4), inset 0 -1px 0 rgba(255, 255, 255, .12), inset 0 0 0 1px rgba(255, 255, 255, .18), inset 0 0 30px rgba(255, 255, 255, .06);
  --clear-halo: 0 0 2px rgba(6, 4, 14, .9), 0 0 8px rgba(6, 4, 14, .7);
  --fill: rgba(255, 255, 255, .14); --fill-on: rgba(255, 255, 255, .26);
  --fill-edge: inset 0 1px 0 rgba(255, 255, 255, .2), inset 0 0 0 .5px rgba(255, 255, 255, .08);
  --card: rgba(255, 255, 255, .08); --card-edge: inset 0 1px 0 rgba(255, 255, 255, .12); --well: rgba(255, 255, 255, .09); --hair: rgba(255, 255, 255, .16);
  --chip: rgba(255, 255, 255, .12); --chip-edge: inset 0 0 0 1.5px rgba(255, 255, 255, .5), inset 0 0 14px rgba(255, 255, 255, .08), 0 6px 18px rgba(0, 0, 10, .3);
  --you: rgba(64, 84, 120, .62);
}
body[data-chat-look="ryza"][data-screen="home"] .msg.you { color: #bdd6ff; background: linear-gradient(90deg, rgba(120, 166, 230, .2) 0%, rgba(120, 166, 230, 0) 80%); }
body[data-chat-look="ryza"][data-screen="home"] .msg.story-narr,
body[data-chat-look="ryza"][data-screen="home"] .story-card span { color: #e8d4a2; }
.talk-expand { color: var(--ink); background: var(--fill); box-shadow: var(--fill-edge); }
.msg.photo-msg.missing span { color: var(--ink-2); }

/* ---- D-78（2026-11-20、依頼者の指示）---- */
/* アイコンはすべて白（昼の白いガラスの上でも見えるよう、細い影）。数の印と送るの丸は、そのまま */
.round, .pill-icon, .talk-expand, .talk-goals, .sheet-close, .bar-mic, .pose-btn, .photo-btn, .town-btn, .settings-btn { color: #fff; }
.round svg, .pill-icon svg, .talk-expand svg, .talk-goals svg, .sheet-close svg, .bar-mic svg, .pose-btn svg {
  filter: drop-shadow(0 1px 1.5px rgba(20, 14, 28, .45));
}
.talk-goals svg .flag { fill: #fff; stroke: #fff; }
/* 文字の入力欄（ライザ風のピル）: 会話のログと同じ澄んだガラス（D-146）。字は、ガラスの字の色 */
body[data-chat-look="ryza"][data-screen="home"] .input-bar {
  background-color: var(--glass-clear); background-image: var(--glass-sheen);
  -webkit-backdrop-filter: var(--glass-clear-blur); backdrop-filter: var(--glass-clear-blur);
  box-shadow: var(--glass-clear-edge), var(--glass-drop);
}
body[data-chat-look="ryza"][data-screen="home"] .input-bar input { color: var(--ink); }
body[data-chat-look="ryza"][data-screen="home"] .input-bar input::placeholder { color: color-mix(in srgb, var(--ink) 50%, transparent); }
.bar-speed { color: var(--ink); background: var(--fill); box-shadow: var(--fill-edge); }
.bar-mic { background: var(--fill); box-shadow: var(--fill-edge); }
/* シアター: 物語の状態パネル（上の真ん中）と会話のログが重ならないように、ログはパネルの下から（--state-h は折りたたんだ札の高さ。D-136） */
body[data-chat-look="ryza"][data-screen="home"][data-orient="portrait"]:has(#storyState:not([hidden])) .talk.expanded { top: calc(var(--safe-t) + 62px + var(--state-h) + 8px); }
body[data-orient="landscape"][data-screen="home"] .talk { top: calc(var(--safe-t) + 62px); }   /* 横は、上の切り替えのボタンの下から */
body[data-orient="landscape"][data-screen="home"]:has(#storyState:not([hidden])) .talk { top: calc(var(--safe-t) + 62px + var(--state-h) + 8px); }
body[data-orient="portrait"][data-screen="home"]:has(#storyState:not([hidden])) .talk { max-height: calc(100vh - var(--safe-t) - 62px - var(--state-h) - 8px - var(--bar-b) - var(--ctl-h) - 34px); }

/* ---- 二人の日記（D-79）: 思い出のページのタブ・日記の一冊ずつ・会話の中の知らせ ---- */
.album-tabs { margin: 0 4px; }
.album-tabs [aria-selected="true"] { background: var(--fill-on); box-shadow: var(--fill-edge); color: var(--ink); }
.diary-list { display: flex; flex-direction: column; gap: 12px; }
.diary-list[hidden], .album-grid[hidden] { display: none; }
.diary-item { border-radius: 22px; padding: 16px 18px; }
.diary-item h3 { margin: 0 0 8px; font-size: 13px; font-weight: 700; letter-spacing: .04em; color: var(--ink-2); }
.diary-item p { margin: 0; font: 400 14.5px/1.95 "Noto Serif JP", "Hiragino Mincho ProN", serif; color: var(--ink); white-space: pre-wrap; }
.msg.diary-note { cursor: pointer; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--ink) 30%, transparent); text-underline-offset: 3px; }

/* ---- 物語の結末と帰還（D-81） ---- */
body[data-chat-look="ryza"][data-screen="home"] .ending-card { margin: 10px 0 8px; padding: 12px 8px; text-align: center; border-top: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); }
.ending-card span { display: block; font-size: 11px; letter-spacing: .2em; }
.ending-card b { display: block; margin: 4px 0 2px; font: 700 16px/1.5 "Noto Serif JP", "Hiragino Mincho ProN", serif; }
.ending-card i { display: block; font-style: normal; font-size: 12px; color: var(--ink-2); }
body[data-story-ended][data-chat-mode="story"] .input-pill, body[data-story-ended][data-chat-mode="story"] .photo-btn,
body[data-story-ended][data-chat-mode="story"] .input-bar { display: none !important; }
.brief-ending { margin: 4px 0 8px; font-size: 12px; line-height: 1.6; color: #8a6a2e; }

/* ---- 門へ歩く演出のスキップ（D-82）: 右下。門の光（z-index 7）より上 ---- */
/* フルダイブシステムに乗り込む演出（D-163。js/dive.js）: まぶた → 起動の文字と同期の輪 → 光のトンネル → 白く光る。スキップのボタンだけ上に出す */
.dive { position: fixed; inset: 0; z-index: 12; pointer-events: none; overflow: hidden; color: #dff7f4; font-family: inherit; transition: opacity .6s ease; }
.dive.out { opacity: 0; }
.dive-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: var(--lid, 0); }
.dive-lid { position: absolute; left: 0; right: 0; height: 50.5%; background: #06121c; }
.dive-lid.top { top: 0; transform: translateY(calc((var(--lid, 0) - 1) * 100%)); box-shadow: 0 2px 18px rgba(127, 214, 207, calc(var(--lid, 0) * .6)); }
.dive-lid.bottom { bottom: 0; transform: translateY(calc((1 - var(--lid, 0)) * 100%)); box-shadow: 0 -2px 18px rgba(127, 214, 207, calc(var(--lid, 0) * .6)); }
.dive.booting .dive-lid, .dive.warping .dive-lid { opacity: 0; transition: opacity .35s ease; }
.dive-hud { position: absolute; left: 0; right: 0; top: 42%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 16px;
  opacity: 0; transition: opacity .3s ease; text-shadow: 0 0 10px rgba(127, 214, 207, .7); }
.dive.booting .dive-hud { opacity: 1; }
.dive-brand { font-size: 11px; font-weight: 800; letter-spacing: .34em; color: #7fd6cf; }
/* 同期の輪: 縁（::before。mask で縁だけにする）が 0→100% で満ちる。数字は輪の上に重ねる */
.dive-ring { position: relative; width: 132px; height: 132px; border-radius: 50%; display: flex; align-items: baseline; justify-content: center; padding-top: 44px; box-sizing: border-box; }
.dive-ring::after { content: ''; position: absolute; inset: 12px; border-radius: 50%; border: 1px dashed rgba(127, 214, 207, .5); animation: dive-spin 3s linear infinite; }
.dive-pct { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.dive-ring small { font-size: 13px; font-weight: 700; margin-left: 2px; }
.dive-ring::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(#7fd6cf calc(var(--sync, 0) * 360deg), rgba(127, 214, 207, .14) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  filter: drop-shadow(0 0 8px rgba(127, 214, 207, .8)); }
.dive-log { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; min-height: 92px; font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-align: center; }
.dive-log li { animation: dive-line .35s ease both; }
.dive-log li::before { content: '▸ '; color: #7fd6cf; }
.dive-word { position: absolute; left: 0; right: 0; top: 42%; transform: translateY(-50%) scale(.8); text-align: center; font-size: 44px; font-weight: 900; letter-spacing: .5em; padding-left: .5em;
  color: #fff; text-shadow: 0 0 18px #7fd6cf, 0 0 42px rgba(127, 214, 207, .8); opacity: 0; transition: opacity .25s ease, transform .9s cubic-bezier(.2, .7, .2, 1); }
.dive.word .dive-word { opacity: 1; transform: translateY(-50%) scale(1.15); }
.dive-flash { position: absolute; inset: 0; opacity: var(--flash, 0);
  background: radial-gradient(circle at 50% 42%, #fffaf0 0%, #fff1cf 40%, rgba(255, 246, 228, .96) 100%); }
body[data-dive] .gate-skip { z-index: 13; }
@keyframes dive-spin { to { transform: rotate(360deg); } }
@keyframes dive-line { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.gate-skip { position: fixed; z-index: 8; right: calc(var(--side) + var(--safe-r)); bottom: calc(var(--bar-b) + 8px); height: 40px; padding: 0 18px;
  border: 0; border-radius: 20px; font-size: 14px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(20, 14, 28, .45); }
.gate-skip[hidden], body:not([data-page="gate"]) .gate-skip { display: none; }

/* ---- コネクター（D-83。talk.js の pocket）: キャラの返事の下、左に寄せたカプセルのリンク ---- */
.choices.pocket { align-self: flex-start; justify-content: flex-start; flex-wrap: wrap; gap: 6px; }
.choices.pocket .pocket-head { width: 100%; font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.choices.pocket .chip { display: inline-flex; align-items: center; min-height: 34px; padding: 6px 12px; font-size: 12.5px; text-decoration: none; }

/* ---- 新しい日記のバッジ（D-85。main.js の syncDiaryBadge）: 🚩 の数と同じ形。札・設定のボタン・日記のタブの右上 ---- */
[data-diary-badge] { position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  font-size: 10px; font-weight: 700; line-height: 16px; color: #fff; background: var(--accent); box-shadow: 0 0 0 1.5px #fff; pointer-events: none; }
[data-diary-badge][hidden] { display: none; }
#btnOpenAlbum, #albumTabs [data-album-tab="diary"] { position: relative; overflow: visible; }
#btnOpenAlbum [data-diary-badge] { position: static; display: inline-block; margin-left: 6px; vertical-align: 1px; box-shadow: none; }   /* 設定のボタンは、字のあと */
#btnOpenAlbum [data-diary-badge][hidden] { display: none; }

/* ---- 会話の履歴のハーフモーダル（D-87）: ログを広げるボタンで、会話のログの欄を、設定と同じ形にする（縦は下の端まで・横幅いっぱい、横は右半分） ---- */
.talk-sheet-head { display: none; }
body[data-sheet="history"][data-screen="home"] .talk.expanded {
  display: flex !important; flex-direction: column; z-index: 7;
  left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important; width: auto !important;
  height: calc(62vh + var(--safe-b)) !important; max-height: none !important; border-radius: 28px 28px 0 0;
  animation: sheet-up .3s cubic-bezier(.2, .8, .3, 1) both;
}
body[data-sheet="history"][data-screen="home"][data-orient="landscape"] .talk.expanded {
  left: auto !important; right: calc(10px + var(--safe-r)) !important; top: calc(10px + var(--safe-t)) !important; bottom: calc(10px + var(--safe-b)) !important;
  width: calc(50vw - 10px - var(--safe-r)) !important; height: auto !important; border-radius: 32px; animation-name: sheet-left;
}
body[data-sheet="history"] .talk .talk-sheet-head { display: flex; flex: none; }
body[data-sheet="history"] .talk .talk-scroll { flex: 1; min-height: 0; height: auto; padding-bottom: var(--safe-b); -webkit-mask-image: none; mask-image: none; }
body[data-sheet="history"] .talk .talk-list { padding-top: 4px; }
body[data-sheet="history"] .talk-expand { display: none !important; }

/* ---- シアターの演目の一覧（D-88）: 部屋をぼかした上のページ（アルバムと同じ形）。一覧と入口の画面のあいだは、会話のログやボタンを出さない ---- */
body[data-theater] .profile-bg { display: block; }
body[data-theater] .talk, body[data-theater] .controls, body[data-theater] .settings-btn, body[data-theater] .pose-btn, body[data-theater] .input-bar,
body[data-theater] .mode-seg, body[data-theater] .town-btn, body[data-theater] .story-state, body[data-theater] .album-tag,
body[data-theater] .talk-goals { display: none !important; }
body:not([data-screen="home"]) .story-list { display: none; }
.story-cards { display: grid; gap: 12px; }
body[data-orient="landscape"] .story-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.story-pick { display: flex; gap: 14px; align-items: stretch; padding: 10px; border: 0; border-radius: 24px; text-align: left; color: var(--ink); cursor: pointer; }
.story-pick img { flex: none; width: 96px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 16px; box-shadow: 0 4px 12px rgba(30, 26, 34, .2); }
.story-pick div { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 4px 4px 4px 0; }
.story-pick-kicker { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--accent); }
.story-pick b { font-size: 16px; line-height: 1.4; }
.story-pick p { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.story-pick small { font-size: 11.5px; color: var(--ink-2); }
/* 途中の物語（D-163）: 「つづき」の札と、進み具合の細い棒 */
.story-pick { position: relative; }
.story-pick.in-progress { box-shadow: inset 0 0 0 1.5px rgba(127, 214, 207, .55), var(--glass-shadow, 0 8px 24px rgba(0, 0, 0, .2)); }
.story-pick-resume { align-self: flex-start; padding: 2px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; color: #06302d; background: #7fd6cf; }
.story-pick .story-pick-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 600; color: var(--ink); }
.story-pick-progress i { flex: 0 0 64px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, #7fd6cf calc(var(--p) * 100%), rgba(255, 255, 255, .18) 0); }
.brief-resume { margin: 2px 0 6px; padding: 6px 10px; border-radius: 12px; font-size: 12px; line-height: 1.6; font-weight: 600; color: #bff0ea; background: rgba(127, 214, 207, .14); }
.brief-resume[hidden], .brief-restart[hidden] { display: none; }
/* 物語の中の「最初から」（D-163）: 状態パネルを開いたときだけ */
.state-restart { display: block; margin: 0 12px 8px auto; padding: 4px 12px; border: 0; border-radius: 999px; font: inherit; font-size: 11px; font-weight: 700; color: var(--ink); background: var(--fill); box-shadow: var(--fill-edge); cursor: pointer; }
.story-state.folded .state-restart, body:is([data-activity="room"], [data-activity="typing"]) .story-state .state-restart { display: none; }
.story-more { margin: 0 8px; font-size: 12px; color: var(--ink-2); }

/* ---- 縦のログの欄を、横幅いっぱい・画面の下の端まで（D-90。設定のハーフモーダルと同じ形）----
   欄の上の端は前と同じ（キャラの映り方・欄を低くする --talk-cut はそのまま）で、下だけ画面の端まで伸ばし、伸ばしたところ（--talk-foot）に
   ✏️🎤（.controls）と、文字の入力欄（.input-bar）が乗る。吹き出しのスクロールは、前と同じ ✏️🎤 の上の端まで */
body[data-chat-look="ryza"][data-screen="home"][data-orient="portrait"] {
  --talk-foot: calc(var(--bar-b) + var(--tab-h) + 20px + var(--ctl-h) + 14px);                 /* ✏️🎤 のとき */
  --talk-foot-text: calc(var(--safe-kb) + 12px + var(--bar-h) + 12px);                        /* 文字を打っているとき（キーボードの上に入力欄） */
}
body[data-chat-look="ryza"][data-screen="home"][data-orient="portrait"] .talk {
  box-sizing: border-box; left: 0; right: 0; bottom: 0; border-radius: 28px 28px 0 0;
  height: calc(44vh - var(--talk-cut, 0px) + var(--talk-foot)); padding-bottom: var(--talk-foot);
}
body[data-chat-look="ryza"][data-screen="home"][data-orient="portrait"][data-input="text"] .talk {
  bottom: var(--kb); height: calc(44vh - var(--talk-cut, 0px) + var(--talk-foot-text)); padding-bottom: var(--talk-foot-text);
}
body[data-kb][data-chat-look="ryza"][data-screen="home"][data-orient="portrait"][data-input="text"] .talk { height: calc(var(--kb-talk) + var(--talk-foot-text)); }
body[data-chat-look="ryza"][data-screen="home"][data-orient="portrait"]:has(#storyState:not([hidden])) .talk {
  max-height: calc(100vh - var(--safe-t) - 62px - var(--state-h) - 8px);                 /* シアター: 状態パネルの下から（前の max-height に、下の分を足したもの） */
}
/* 吹き出しがないときも、板は出す（✏️🎤 が板の上に乗るので） */
body[data-chat-look="ryza"][data-screen="home"][data-orient="portrait"] .talk:has(.talk-list:empty) {
  background-color: var(--glass-clear); background-image: var(--glass-sheen);
  -webkit-backdrop-filter: var(--glass-clear-blur); backdrop-filter: var(--glass-clear-blur); box-shadow: var(--glass-clear-edge), var(--glass-drop);
}
/* 会話の履歴（D-87）のときも、✏️🎤・入力欄を、履歴の板の中の下に出す */
body[data-sheet="history"][data-chat-look="ryza"][data-screen="home"][data-orient="portrait"] .talk.expanded {
  box-sizing: border-box; height: calc(62vh + var(--talk-foot)) !important; padding-bottom: var(--talk-foot);
}
body[data-sheet="history"][data-chat-look="ryza"][data-screen="home"][data-orient="portrait"][data-input="text"] .talk.expanded {
  bottom: var(--kb) !important; height: calc(62vh + var(--talk-foot-text)) !important; padding-bottom: var(--talk-foot-text);
}
body[data-sheet="history"][data-orient="portrait"]:not([data-input="text"]) .controls { display: flex !important; z-index: 8; }   /* 打っているあいだは、ふだんと同じく隠す */
body[data-sheet="history"] .input-bar { z-index: 8; }

/* ---- 絵を作っているあいだの仮置き（D-92。talk.js の photoPending）: 絵と同じ大きさの枠に、光がゆっくり流れる ---- */
.msg.photo-msg.pending, .msg.photo-msg.failed { cursor: default; }
.photo-wait {
  position: relative; width: min(62%, 240px); aspect-ratio: 2 / 3; border-radius: 16px; overflow: hidden;
  background: color-mix(in srgb, var(--ink) 10%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 14%, transparent);
}
.photo-wait::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 30%, color-mix(in srgb, #fff 26%, transparent) 50%, transparent 70%);
  transform: translateX(-100%); animation: photo-wait 1.8s ease-in-out infinite;
}
.photo-wait::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--ink) 22%, transparent); border-top-color: var(--accent); animation: photo-spin 1s linear infinite;
}
@keyframes photo-wait { to { transform: translateX(100%); } }
@keyframes photo-spin { to { transform: rotate(360deg); } }
.msg.photo-msg.failed .photo-wait::before, .msg.photo-msg.failed .photo-wait::after { display: none; }
.msg.photo-msg.failed .photo-wait { opacity: .5; }
@media (prefers-reduced-motion: reduce) { .photo-wait::before { animation: none; display: none; } .photo-wait::after { animation-duration: 2.4s; } }

/* ---- 町のマップの「フルダイブシアター」（D-93）: 長いので、「フルダイブ」を小さく上に置いた 2 段（画面の右にはみ出さないように） ---- */
.map-pin-name.map-pin-two { flex-direction: column; gap: 0; line-height: 1.15; }
.map-pin-name.map-pin-two small { font-size: 10.5px; letter-spacing: .12em; }
/* 上の切り替えの「フルダイブシアター」も、「フルダイブ」を小さく上に置いた 2 段（D-93。1 行だと折り返して崩れた） */
.mode-seg button { white-space: nowrap; }
.mode-seg button.seg-two { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.mode-seg button.seg-two small { font-size: 9.5px; letter-spacing: .1em; opacity: .85; }

/* ---- 操作のしかた（D-98。「視点を戻す」のボタンは D-164 で消した） ---- */
.help-card { width: min(340px, 100%); align-items: stretch; text-align: left; }
.help-card h2 { text-align: center; }
.help-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.help-list li { display: grid; gap: 2px; }
.help-list b { font-size: 14px; color: var(--ink); }
.help-list span { font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }

/* ---------- 会話の欄の高さのつまみ（D-121） ---------- */
.talk-grip { display: none; }
body[data-chat-look="ryza"][data-screen="home"][data-orient="portrait"]:not([data-kb][data-input="text"]) .talk-grip {
  display: grid; place-items: center; position: absolute; z-index: 2; top: 0; left: 50%; transform: translateX(-50%);
  width: 132px; height: 26px; cursor: ns-resize; touch-action: none; border-radius: 0 0 14px 14px; outline: none; -webkit-tap-highlight-color: transparent;
}
.talk-grip span { width: 40px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 32%, transparent); transition: width .18s, background-color .18s; }
.talk-grip:hover span, .talk-grip:focus-visible span { width: 48px; background: color-mix(in srgb, var(--ink) 55%, transparent); }
.talk-grip.held span { width: 60px; background: var(--accent); }
.talk-grip:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
body[data-sheet="history"] .talk-grip { display: none !important; }
body[data-talk-size="user"][data-chat-look="ryza"][data-screen="home"][data-orient="portrait"]:not([data-input="text"]) .talk { height: calc(var(--talk-user, 44vh) + var(--talk-foot)); }
/* 文字の入力欄を出しているだけ（キーボードは閉じている）のときも、決めた高さ（D-123）。下の足もとは入力欄の分 */
body[data-talk-size="user"][data-chat-look="ryza"][data-screen="home"][data-orient="portrait"][data-input="text"]:not([data-kb]) .talk { height: calc(var(--talk-user, 44vh) + var(--talk-foot-text)); }
.talk-expand { display: none !important; }                  /* 広げるボタン（D-87）は、つまみに替えた */

/* ---------- 操作の案内（D-122。js/coach.js） ---------- */
.coach, .gesture-cue { position: fixed; z-index: 6; top: calc(var(--safe-t) + 64px); left: 50%; transform: translateX(-50%); color: var(--ink); }
.coach[hidden], .gesture-cue[hidden] { display: none; }
.coach { width: min(calc(100vw - 24px), 380px); box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 10px 38px 10px 10px; border-radius: 20px; }
.coach-ico { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--fill); }
.coach-ico svg { width: 40px; height: 40px; overflow: visible; }
.coach-ico .f { fill: var(--accent); transform-box: fill-box; transform-origin: center; }
.coach-ico .trail { fill: none; stroke: color-mix(in srgb, var(--ink) 28%, transparent); stroke-width: 2; stroke-dasharray: 2 4; }
.coach-ico .ring { fill: none; stroke: var(--accent); stroke-width: 2; transform-box: fill-box; transform-origin: center; }
.coach-ico .bar { fill: color-mix(in srgb, var(--ink) 45%, transparent); }
.coach-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.coach-body b { font-size: 14px; line-height: 1.45; }
.coach-body small { font-size: 11.5px; line-height: 1.5; color: var(--ink-2); }
.coach-side { flex: none; display: grid; justify-items: center; gap: 4px; }
.coach-n { font-size: 10.5px; color: var(--ink-2); }
.coach-next { height: 28px; padding: 0 12px; border: 0; border-radius: 14px; font: inherit; font-size: 12px; font-weight: 700; color: var(--ink); background: var(--fill); box-shadow: var(--fill-edge); cursor: pointer; }
.coach-close { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); background: none; cursor: pointer; }
.coach-close svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.coach.done .coach-ico { background: rgba(80, 180, 120, .2); }
.coach.done .coach-ico .f { fill: #3a9a63; animation: none; }
.coach.done b { color: #2f8a57; }
body[data-glass="dark"] .coach.done b { color: #7fd6a2; }
.coach.done .coach-side { visibility: hidden; }
.gesture-cue { display: flex; align-items: center; gap: 8px; padding: 5px 16px 5px 5px; border-radius: 999px; font-size: 13px; font-weight: 700; pointer-events: none; white-space: nowrap; }
.gesture-cue .coach-ico { width: 32px; height: 32px; border-radius: 50%; }
.gesture-cue .coach-ico svg { width: 28px; height: 28px; }
/* 指の絵の動き（なぞる・広げる・ずらす・たたく・つまみ） */
.coach-ico[data-k="swipe"] .f { animation: coach-swipe 1.6s ease-in-out infinite; }
.coach-ico[data-k="pinch"] .f1 { animation: coach-out-l 1.6s ease-in-out infinite; }
.coach-ico[data-k="pinch"] .f2 { animation: coach-out-r 1.6s ease-in-out infinite; }
.coach-ico[data-k="pan"] .f { animation: coach-pan 1.8s ease-in-out infinite; }
.coach-ico[data-k="tap"] .f { animation: coach-tap 1.4s ease-in-out infinite; }
.coach-ico[data-k="tap"] .ring { animation: coach-ring 1.4s ease-out infinite; }
.coach-ico[data-k="grip"] .f { animation: coach-grip 1.6s ease-in-out infinite; }
@keyframes coach-swipe { 0%, 100% { transform: translateX(-11px); } 50% { transform: translateX(11px); } }
@keyframes coach-out-l { 0%, 100% { transform: translateX(4px); } 50% { transform: translateX(-7px); } }
@keyframes coach-out-r { 0%, 100% { transform: translateX(-4px); } 50% { transform: translateX(7px); } }
@keyframes coach-pan { 0%, 100% { transform: translate(-6px, 4px); } 50% { transform: translate(6px, -4px); } }
@keyframes coach-tap { 0%, 100% { transform: scale(1); } 35% { transform: scale(.78); } }
@keyframes coach-ring { 0% { transform: scale(.55); opacity: .8; } 100% { transform: scale(1.25); opacity: 0; } }
@keyframes coach-grip { 0%, 100% { transform: translateY(8px); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .coach-ico * { animation: none !important; } }

/* ---------- 上のボタンを、ふだんは隠す（D-124） ---------- */
body[data-screen="home"] :is(.town-btn, .mode-seg, .settings-btn) { transition: opacity .28s ease; }
body[data-screen="home"][data-chrome="hide"] :is(.town-btn, .mode-seg, .settings-btn) { opacity: 0; pointer-events: none; }

/* ---------- いま何をしているか（D-126。main.js の activity）: 操作しているあいだは、関係のないものを出さない ---------- */
/* | 場面      | 隠すもの                                                                                     | 目立たせるもの |
   | room      | 会話の欄（つまみの 1 行だけ残す）・入力欄・下のボタン・🚩・アルバムの札・ポーズ・案内・状態パネル（札だけに）       | 動きの知らせ（慣れるまで） |
   | reading   | アルバムの札・ポーズ・案内                                                                      | 会話 |
   | typing    | 🚩・つまみ・アルバムの札・ポーズ・案内・状態パネル（札だけに）                                  | 会話と入力欄 |
   | listening | 🚩・つまみを薄く                                                                              | 「聞いています」 |
   アルバムの札（3D）・ポーズ・案内・話しかけ・お知らせは、main.js が act.now を見て出し分ける */
body[data-screen="home"] .talk { transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .25s ease; }
body[data-screen="home"][data-orient="portrait"][data-activity="room"] .talk { transform: translateY(calc(100% - 30px)); }
body[data-screen="home"][data-orient="landscape"][data-activity="room"] .talk { opacity: .1; }
body[data-screen="home"] :is(.input-bar, .controls) { transition: opacity .2s ease; }
body[data-screen="home"][data-activity="room"] :is(.input-bar, .controls) { opacity: 0; pointer-events: none !important; }
body[data-screen="home"][data-activity="room"] .controls > * { pointer-events: none; }
body[data-activity="typing"] :is(.talk-goals, .talk-grip) { opacity: 0; pointer-events: none; }
body[data-activity="listening"] :is(.talk-goals, .talk-grip) { opacity: .35; }
/* 新しい返事 ↓（読んでいるあいだ。talk.js の newMark） */
.talk-new { position: absolute; z-index: 3; left: 50%; transform: translateX(-50%); bottom: calc(var(--talk-foot, 0px) + 10px); height: 32px; padding: 0 14px; border: 0; border-radius: 16px;
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink); cursor: pointer; }
body[data-input="text"] .talk-new { bottom: calc(var(--talk-foot-text, 0px) + 10px); }
.talk-new[hidden] { display: none; }
/* 聞いています（声の入力のあいだ） */
/* 🎤 の丸（右のカプセル）の左に、同じ高さで（会話の行に重ねない） */
.listen-cue { position: fixed; z-index: 5; right: calc(var(--side) + var(--safe-r) + 112px); bottom: calc(var(--bar-b) + var(--tab-h) + 20px + (var(--ctl-h) - 30px) / 2);
  display: none; align-items: center; gap: 8px; height: 30px; padding: 0 14px 0 10px; border-radius: 15px; font-size: 12.5px; font-weight: 700; color: var(--ink); pointer-events: none; }
body[data-screen="home"][data-activity="listening"] .listen-cue { display: flex; }
.listen-wave { display: flex; align-items: center; gap: 2px; height: 14px; }
.listen-wave i { width: 3px; height: 4px; border-radius: 2px; background: #e5483f; animation: listen-wave 1.1s ease-in-out infinite; }
.listen-wave i:nth-child(2) { animation-delay: .15s; } .listen-wave i:nth-child(3) { animation-delay: .3s; }
.listen-wave i:nth-child(4) { animation-delay: .45s; } .listen-wave i:nth-child(5) { animation-delay: .6s; }
@keyframes listen-wave { 0%, 100% { height: 4px; } 50% { height: 14px; } }
@media (prefers-reduced-motion: reduce) { .listen-wave i { animation: none; height: 8px; } body[data-screen="home"] .talk { transition: none; } }

/* ---------- 物語の、次にできることの候補（D-132。talk.js の storyHints） ---------- */
.story-hints { margin-top: 6px; }
.story-hints .hints-head { display: block; margin: 0 2px 2px; font-size: 11px; font-weight: 700; letter-spacing: .03em; color: var(--ink-2); }
.story-hints .chip { text-align: left; }
/* ---- きもちボタン（D-159）: 会話の欄のいちばん下に、横に並べる小さなカプセル。モードのあいだは、1 つ目が光る ---- */
/* 目標の案のカード（D-166。js/talk.js の goalOffer）: 返事の下に、目標・一歩と「目標にする」「今はいい」 */
.goal-offer { align-self: stretch; margin: 6px 8px 8px 40px; padding: 10px 12px; border-radius: 16px; display: grid; gap: 4px;
  color: #fff; background: rgba(20, 16, 30, .5); box-shadow: inset 0 0 0 1px rgba(255, 209, 102, .45); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.goal-offer-head { font-size: 11px; font-weight: 800; letter-spacing: .06em; color: #ffd166; }
.goal-offer b { font-size: 15px; line-height: 1.45; }
.goal-offer small { font-size: 12px; opacity: .8; }
.goal-offer-buttons { display: flex; gap: 8px; margin-top: 6px; }
.goal-offer-buttons button { flex: 1; height: 38px; border: 0; border-radius: 19px; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.goal-offer-yes { color: #2b1d00; background: #ffd166; }
.goal-offer-no { color: #fff; background: rgba(255, 255, 255, .14); }
.goal-offer-buttons button:disabled { opacity: .55; }
.goal-offer-result { font-size: 12.5px; font-weight: 700; color: #ffd166; }
.goal-offer[data-done="no"] { opacity: .7; box-shadow: none; }
.mood-bar { align-self: stretch; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 6px 4px 2px; }
.mood-bar .chip { min-height: 34px; padding: 5px 12px; font-size: 13px; border-radius: 17px; animation: none; }
.mood-bar .chip.on { background: linear-gradient(180deg, rgba(255, 196, 92, .5), rgba(239, 120, 72, .45)); box-shadow: inset 0 0 0 1.5px rgba(255, 220, 150, .9), 0 4px 12px rgba(239, 120, 72, .35); }
/* ベタ褒めのお祝いの紙ふぶき（chat.js の celebrate） */
.confetti { position: fixed; inset: 0; z-index: 9; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 13px; border-radius: 2px; animation: confetti-fall 2.6s cubic-bezier(.25, .6, .45, 1) both; }
@keyframes confetti-fall { to { transform: translate(var(--dx, 0), 105vh) rotate(var(--rot, 360deg)); opacity: .9; } }

/* ---------- 新規登録のおすすめのカードと一覧（D-169。js/match.js。画面案 ukiyo-onboarding-mock） ---------- */
body[data-match] .talk, body[data-match] .input-bar { display: none !important; }
.match-view { position: fixed; inset: 0; z-index: 6; pointer-events: none; color: #fff; }
.match-view[hidden] { display: none; }
.match-view > * { pointer-events: auto; }
.match-top { position: absolute; left: calc(var(--side) + var(--safe-l)); right: calc(var(--side) + var(--safe-r)); top: calc(var(--safe-t) + 16px); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.match-pill { padding: 4px 12px; border-radius: 20px; font-size: 12.5px; background: rgba(18, 16, 24, .55); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.match-pill b { color: #ffb3c6; }
.match-dots { display: flex; gap: 5px; }
.match-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .55); }
.match-dots i.on { width: 18px; border-radius: 4px; background: #ff8fab; }
.match-back { width: 36px; height: 36px; border: 0; border-radius: 50%; font-size: 20px; color: #fff; background: rgba(18, 16, 24, .55); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.match-sheet { position: absolute; left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); bottom: calc(10px + var(--safe-b)); max-width: 520px; margin: 0 auto;
  border-radius: 28px; padding: 16px 16px 12px; display: flex; flex-direction: column; gap: 9px;
  background: rgba(18, 16, 26, .72); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), 0 10px 30px rgba(0, 0, 0, .3); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.match-reason { margin: 0; padding: 6px 12px; border-radius: 12px; font-size: 12px; text-align: center; background: rgba(255, 255, 255, .1); }
.match-name { display: flex; align-items: baseline; gap: 8px; }
.match-name h3 { margin: 0; font-size: 22px; }
.match-name span { font-size: 12px; opacity: .75; }
.match-name em { margin-left: auto; font-style: normal; font-size: 11px; opacity: .75; }
.match-catch { margin: -4px 0 0; font-size: 13px; font-weight: 700; color: #ff9eb6; }
.match-prof { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 12.5px; line-height: 1.55; }
.match-prof dt { padding-top: 2px; font-size: 10.5px; font-weight: 700; opacity: .7; white-space: nowrap; }
.match-prof dd { margin: 0; }
.match-prof .lock { opacity: .7; }
.match-acts { display: grid; grid-template-columns: 46px 1fr 46px; gap: 8px; }
.match-acts button { height: 46px; border: 0; border-radius: 23px; font: inherit; font-size: 18px; color: #fff; background: rgba(255, 255, 255, .14); }
.match-acts .yes { font-size: 15px; font-weight: 700; background: #d2557a; box-shadow: 0 6px 16px rgba(150, 40, 75, .35); }
.match-acts button:disabled { opacity: .3; }
.match-link { align-self: center; padding: 4px; border: 0; background: none; font: inherit; font-size: 12px; color: rgba(255, 255, 255, .8); text-decoration: underline; }
.match-view.grid { background: rgba(14, 12, 20, .78); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); display: flex; flex-direction: column; pointer-events: auto; }
.match-grid-head { padding: calc(var(--safe-t) + 16px) 16px 10px; display: flex; flex-direction: column; gap: 10px; }
.match-grid-head h3 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.match-seg { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 12px; background: rgba(255, 255, 255, .1); }
.match-seg button { border: 0; padding: 6px; border-radius: 9px; font: inherit; font-size: 12.5px; color: #fff; background: none; }
.match-seg button[aria-selected="true"] { font-weight: 700; background: rgba(255, 255, 255, .22); }
.match-grid-body { overflow-y: auto; padding: 0 16px calc(var(--safe-b) + 20px); display: flex; flex-direction: column; gap: 14px; }
.match-soon-note { margin: 0; padding: 8px 12px; border-radius: 12px; font-size: 12.5px; background: rgba(255, 255, 255, .08); }
.match-fam h4 { margin: 0 0 6px; font-size: 11px; letter-spacing: .08em; opacity: .7; }
.match-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.match-card { position: relative; padding: 0; border: 0; border-radius: 14px; overflow: hidden; text-align: left; font: inherit; color: #fff; background: rgba(255, 255, 255, .1); }
.match-card .match-face { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: rgba(255, 255, 255, .08); }
.match-face.soon { background: radial-gradient(circle at 50% 38%, rgba(255, 255, 255, .28) 0 18%, transparent 19%), radial-gradient(ellipse at 50% 100%, rgba(255, 255, 255, .22) 0 38%, transparent 39%), rgba(255, 255, 255, .06); }
.match-card div { padding: 5px 7px 7px; }
.match-card b { display: block; font-size: 13px; }
.match-card small { display: block; font-size: 9.5px; line-height: 1.35; opacity: .75; }
.match-card.soon { opacity: .55; }
.match-badge { position: absolute; top: 6px; left: 6px; padding: 1px 6px; border-radius: 8px; font-size: 9.5px; font-weight: 700; background: #d2557a; }
/* ---------- 会話のモード（D-176・D-177）: 欄の左上の小さな札（つまみ・🚩 と同じ高さ）。押すと一覧。リビングの日常だけ ---------- */
/* D-176 の、欄の上いっぱいの 3 つのボタンと一言は、目に入りすぎた（依頼者）ので、札にした */
.talk-mode { display: none; }
body[data-chat-look="ryza"][data-screen="home"][data-chat-mode="daily"]:not([data-sheet]) .talk-mode { display: block; position: absolute; z-index: 3; top: 6px; left: 8px; }
.talk-mode-btn { display: flex; align-items: center; gap: 3px; height: 26px; padding: 0 6px 0 9px; border: 0; border-radius: 13px;
  font: inherit; font-size: 11.5px; font-weight: 700; color: var(--ink); background: var(--fill); box-shadow: var(--fill-edge);
  cursor: pointer; -webkit-tap-highlight-color: transparent; opacity: .92; }
.talk-mode-btn .tm-icon { font-size: 12px; }
.talk-mode-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; opacity: .6; }
.talk-mode-btn[data-talk-mode="vent"] { box-shadow: var(--fill-edge), inset 0 0 0 1.5px rgba(63, 159, 176, .7); }   /* 色は、ふちだけ（文字の色は昼・夜の見た目のまま。読みやすく） */
.talk-mode-btn[data-talk-mode="praise"] { box-shadow: var(--fill-edge), inset 0 0 0 1.5px rgba(232, 145, 58, .75); }
.talk-mode-btn[aria-expanded="true"] { opacity: 1; }
.talk-mode-menu { position: absolute; top: 31px; left: 0; width: min(270px, 78vw); padding: 5px; border-radius: 14px;
  display: flex; flex-direction: column; gap: 2px; background: rgba(255, 255, 255, .96); box-shadow: 0 8px 24px rgba(40, 30, 50, .25), inset 0 0 0 1px rgba(60, 45, 70, .12); }
.talk-mode-menu[hidden] { display: none; }
.talk-mode-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 10px; border: 0; border-radius: 10px;
  font: inherit; text-align: left; color: #3b3542; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.talk-mode-menu button b { font-size: 13px; }
.talk-mode-menu button small { font-size: 11px; line-height: 1.45; color: #6a6272; }
.talk-mode-menu button[aria-checked="true"] { background: color-mix(in srgb, var(--mode-c, #8a7cc4) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mode-c, #8a7cc4) 45%, transparent); }
.talk-mode-menu button[aria-checked="true"] b { color: var(--mode-c, #8a7cc4); }
.talk-mode-menu [data-talk-mode="chat"] { --mode-c: #8a7cc4; }
.talk-mode-menu [data-talk-mode="vent"] { --mode-c: #3f9fb0; }
.talk-mode-menu [data-talk-mode="praise"] { --mode-c: #e8913a; }
/* 札・つまみ・🚩 の並び（上の 32px）には、会話の文字を出さない（流れてきた文字が札に透けて読みにくかった）。いちばん上の行は、その下から */
body[data-chat-look="ryza"][data-screen="home"][data-chat-mode="daily"]:not([data-sheet]) .talk-scroll {
  -webkit-mask-image: linear-gradient(180deg, transparent 0, transparent 32px, #000 50px); mask-image: linear-gradient(180deg, transparent 0, transparent 32px, #000 50px); }
body[data-chat-look="ryza"][data-screen="home"][data-chat-mode="daily"]:not([data-sheet]) .talk-list { padding-top: 46px; }
/* 聞いて・ほめてのあいだは、会話の欄のふちを、うすくその色に（雑談はいつもどおり） */
body[data-chat-look="ryza"][data-screen="home"][data-talk-mood="vent"] .talk { box-shadow: inset 0 0 0 1.5px rgba(63, 159, 176, .4), 0 10px 28px rgba(40, 30, 50, .18); }
body[data-chat-look="ryza"][data-screen="home"][data-talk-mood="praise"] .talk { box-shadow: inset 0 0 0 1.5px rgba(232, 145, 58, .4), 0 10px 28px rgba(40, 30, 50, .18); }
/* 会話の中の、モードを替えた印の 1 行 */
.talk-list .mode-note { align-self: center; width: auto; margin: 8px 0 4px; padding: 2px 14px; border-radius: 11px;
  font-size: 12px; font-weight: 700; line-height: 1.6; color: var(--mode-c, #8a7cc4); background: color-mix(in srgb, var(--mode-c, #8a7cc4) 14%, rgba(255, 255, 255, .85));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mode-c, #8a7cc4) 45%, transparent); }
.mode-note[data-talk-mode="chat"] { --mode-c: #8a7cc4; }
.mode-note[data-talk-mode="vent"] { --mode-c: #3f9fb0; }
.mode-note[data-talk-mode="praise"] { --mode-c: #e8913a; }
/* ---------- Gemini の結果を受け取る（D-178。コンビニの Gemini の下） ---------- */
.gemini-wrap { display: grid; gap: 6px; }
.gemini-open { justify-self: end; margin-right: 6px; }
.gemini-panel { border-radius: 16px; padding: 12px 14px; display: grid; gap: 8px; font-size: 12.5px; line-height: 1.6; color: var(--ink); }
.gemini-panel p { margin: 0; }
.gemini-lead, .gemini-note { color: var(--ink-2); }
.gemini-ok { font-weight: 700; }
.gemini-steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.gemini-code { width: 100%; box-sizing: border-box; font: 11px/1.45 ui-monospace, Menlo, Consolas, monospace; padding: 8px; border-radius: 10px; border: 0;
  color: var(--ink); background: var(--fill); box-shadow: var(--fill-edge); resize: vertical; }
.gemini-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gemini-url { flex: 1; min-width: 0; min-height: 36px; padding: 6px 12px; border: 0; border-radius: 12px; font: inherit; font-size: 12.5px;
  color: var(--ink); background: var(--fill); box-shadow: var(--fill-edge); }
.gemini-sub { font-size: 12.5px; }
.gemini-results { margin: 0; padding-left: 18px; display: grid; gap: 3px; color: var(--ink-2); }
.pocket .pocket-gemini { font-weight: 700; }
/* ---------- ⑧ 清書の小説の画面（D-180） ---------- */
.novel-view { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: calc(16px + var(--safe-t, 0px)) 16px calc(16px + var(--safe-b, 0px));
  background: rgba(20, 16, 26, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.novel-view[hidden] { display: none; }
.novel-paper { width: min(640px, 100%); max-height: 100%; display: flex; flex-direction: column; border-radius: 18px; overflow: hidden;
  background: #fbf7ef; color: #2b2520; box-shadow: 0 18px 48px rgba(0, 0, 0, .35); }
.novel-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px 20px; border-bottom: 1px solid rgba(80, 60, 40, .15); }
.novel-title { flex: 1; margin: 0; font-family: "Noto Serif JP", "Yu Mincho", serif; font-size: 17px; line-height: 1.5; }
.novel-head .sheet-close { color: #4a4036; }
.novel-body { flex: 1; overflow-y: auto; padding: 16px 22px 8px; font-family: "Noto Serif JP", "Yu Mincho", serif; font-size: 15px; line-height: 2; }
.novel-body p { margin: 0 0 1.1em; text-indent: 1em; white-space: pre-wrap; }
.novel-note { margin: 0; padding: 8px 20px 14px; font-size: 12px; color: #7a6d60; }
.state-novel { margin-left: 6px; }
/* ---------- BGM（D-184。設定の中） ---------- */
.bgm-list { display: grid; gap: 6px; margin: 4px 0 8px; }
.bgm-item { display: grid; gap: 1px; width: 100%; text-align: left; padding: 8px 12px; border: 0; border-radius: 12px; font: inherit; color: var(--ink);
  background: var(--fill); box-shadow: var(--fill-edge); cursor: pointer; }
.bgm-item b { font-size: 13.5px; }
.bgm-item small { font-size: 11px; color: var(--ink-2); }
.bgm-item[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--accent), var(--fill-edge); }
.bgm-item[aria-checked="true"] b::before { content: "♪ "; color: var(--accent); }
.bgm-mine { display: flex; gap: 6px; align-items: stretch; }
.bgm-mine .bgm-item { flex: 1; }
.bgm-remove { flex: none; width: 40px; border: 0; border-radius: 12px; font-size: 18px; color: var(--ink-2); background: var(--fill); box-shadow: var(--fill-edge); cursor: pointer; }
.bgm-add { display: inline-flex; margin: 0 0 8px; cursor: pointer; }
.bgm-vol-label { display: block; font-size: 12px; color: var(--ink-2); margin-top: 4px; }
#bgmVolume { width: 100%; }
/* 英語の難しさ（D-185。入口の画面） */
.brief-level { margin: 10px 0 4px; }
.brief-level h3 { margin: 0 0 6px; font-size: 13px; }
/* シアターの一覧の見出し（D-186: 物語・レッスン） */
.story-group { margin: 10px 4px 2px; font-size: 13px; letter-spacing: .08em; color: var(--ink-2); grid-column: 1 / -1; }
.story-group:first-child { margin-top: 0; }
.bgm-credit { font-size: 10.5px; opacity: .8; word-break: break-word; }
/* ---- 英会話レッスン（D-188・D-189。js/lesson.js）: ふだんの会話の欄の中で。左上に、いまの段と「やめる」（会話のモードの札の代わり） ---- */
.lesson-bar { display: none; }
body[data-lesson][data-screen="home"]:not([data-sheet]) .lesson-bar { display: flex; align-items: center; gap: 6px; position: absolute; z-index: 3; top: 6px; left: 8px; height: 26px; padding: 0 4px 0 10px; border-radius: 13px;
  background: var(--fill); box-shadow: var(--fill-edge); font-size: 12px; font-weight: 700; color: var(--ink); }
.lesson-bar button { border: 0; height: 20px; padding: 0 9px; border-radius: 10px; font-size: 11px; font-weight: 700; background: var(--well); color: var(--ink-2); }
body[data-lesson] .talk-mode { display: none !important; }
body[data-lesson][data-screen="home"] .talk-list { padding-top: 40px; }
.lesson-card { margin-top: 2px; }
.msg .lesson-sub { display: block; margin-top: 3px; font-size: 12px; line-height: 1.5; opacity: .78; }
.msg .lesson-as { display: block; font-size: 10px; font-weight: 700; opacity: .7; margin-bottom: 1px; }
.msg.lesson-role, .msg.lesson-phrase, .msg.lesson-fix, .lesson-line { cursor: pointer; }
.msg.lesson-phrase { font-weight: 700; }
.msg.lesson-fix { box-shadow: inset 3px 0 0 var(--accent); }
.msg.lesson-script { display: flex; flex-direction: column; gap: 6px; }
.lesson-script-head { font-size: 12px; }
.lesson-line { margin: 0; font-size: 14px; line-height: 1.45; }
.lesson-line .lesson-who { display: block; font-size: 10px; font-weight: 700; opacity: .65; }
.lesson-line.you .lesson-who { color: var(--accent); opacity: 1; }
.lesson-grade { display: block; }
.lesson-grade b { font-size: 18px; margin-right: 2px; }
.lesson-grade.g0 b { color: #2e8b57; }
.lesson-grade.g1 b { color: #c08a1e; }
.lesson-grade.g2 b { color: var(--accent); }
.lesson-words { display: block; margin-top: 3px; font-size: 14px; }
.lesson-words .miss { color: var(--accent); font-weight: 700; text-decoration: underline wavy; text-underline-offset: 3px; }
/* ユーザーを消す（D-193。デバッグモードの設定） */
.debug-users { display: flex; flex-direction: column; gap: 6px; }
.debug-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--ink); }
.debug-user button { flex: none; width: auto; min-height: 32px; padding: 4px 14px; }
.debug-user button.danger { color: #e0506e; }
