/* 公開画面。色は営業資料の猫と同じ紺・黄・生成り。アクセントは黄の1色 */
:root {
  --font-sans:
    system-ui, -apple-system,
    "Hiragino Sans", "BIZ UDPGothic", "Yu Gothic UI", "Meiryo",
    sans-serif;
  --ink: #16233a;
  --ink-soft: #46556f;
  --paper: #fbf9f3;
  --veil: rgba(18, 28, 48, .78);
  --veil-line: rgba(255, 255, 255, .16);
  --on-veil: #f6f3ea;
  --on-veil-soft: #b9c3d6;
  --accent: #f7cf46;
  --accent-deep: #c79a12;
  --danger: #c2412d;
  --r-1: 18px;
  --r-2: 999px;
  --pill-w: 140px;   /* 左右の札の幅 */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --nav-h: 0px;   /* 下のタブは廃止した（2026-10-04）。板は画面の下端から上がる */
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
/* アプリのように、画面そのものは動かさない。指で引いても、上下に流れたり跳ねたりしない
   （長い中身は、板の中だけが流れる） */
html, body { position: fixed; top: 0; left: 0; width: 100%; height: var(--app-h, 100%); margin: 0; overflow: hidden; overscroll-behavior: none; touch-action: manipulation; }
/* いちばん外側にも色を敷く。高さの計算がずれても、白い余りが見えない */
html { background: linear-gradient(var(--edge-top, #0f1728) 0 50%, var(--edge-bottom, #0f1728) 50% 100%); background-color: var(--edge-top, #0f1728); }
/* ⚠️ iOS 26 は、上の帯（ステータスバーの所）を theme-color ではなく、ページの上端の背景色で塗る。
   グラデーションだけだと背景色が無い扱いになり、帯が白くなった（2026-11-08・ホーム画面から開いたとき）。背景色にも空の色を入れておく */
/* ホーム画面から開いたとき（standalone）。
   ⚠️ iPhone は、ステータスバーを透かす設定のとき、ページの「基準の高さ」をステータスバーのぶん短く報告する。
      見えている範囲は画面いっぱいなのに、基準は約47pt 短い。html に overflow: hidden や position: fixed を
      付けると、その短い基準で切られて、下が白く余る（2026-10-04 に実機で2回起きた）。
      だからここでは切らない。高さは画面そのものの高さ（JS が --app-h に入れる）にし、
      画面が流れないようにするのは JS（指で引く動きを止める）に任せる */
html.is-standalone, html.is-standalone body {
  position: static; overflow: visible;
  height: var(--app-h, 100vh); min-height: var(--app-h, 100vh);
}
html.is-standalone .phone { height: var(--app-h, 100vh); }
body {
  /* 絵が届かない端（ステータスバーの裏・下の縁）も、その時の空と地面の色で埋める。黒い帯にしない */
  background: linear-gradient(var(--edge-top, #0f1728) 0 50%, var(--edge-bottom, #0f1728) 50% 100%);
  background-color: var(--edge-top, #0f1728);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  font-weight: 500;
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ic { width: 1.25em; height: 1.25em; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---- 画面の枠（PC では縦長を中央に） ---- */
.phone {
  position: relative;
  width: 100%;
  max-width: 430px;
  /* 上端から下端まで使う。高さは実際の画面の高さ（main.js が入れる）。入るまでは 100% */
  height: var(--app-h, 100%);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  margin: 0 auto;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  /* 列の最小幅を 0 に。既定（auto）だと、入力欄の本来の幅で列が画面より広がる（iPhone で実際に切れた） */
  grid-template-columns: minmax(0, 1fr);
  isolation: isolate;
}
@media (min-width: 520px) {
  /* PC でも、上から下まで使う。幅だけスマホの幅にして真ん中に置く */
  body { display: grid; justify-items: center; }
}
#bg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; opacity: 0; transition: opacity .4s ease-out; }
.is-in #bg { opacity: 1; }
/* 手前の物（机）。アバターより上、文字や操作より下 */
#fg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: 0; transition: opacity .4s ease-out; }
/* ホーム画面から開いたとき: 絵の上端を、上の帯（--edge-top）の色からつなぐ。境目の段を消すためで、飾りではない */
html.is-standalone .phone::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 64px; z-index: -1; pointer-events: none;
  background: linear-gradient(var(--edge-top, #0f1728), rgba(0, 0, 0, 0));
  background: linear-gradient(var(--edge-top, #0f1728), color-mix(in srgb, var(--edge-top, #0f1728) 0%, transparent));
}
.is-in #fg { opacity: 1; }

/* ---- 上の帯 ---- */
.top {
  grid-row: 1;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 12px 0;
  z-index: 30;  /* 板が上がっても、AI 表示は隠れない */
}
.brand { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; min-width: 0; margin-right: 10px; }
/* ロゴは紺の地ごと1枚の絵。右上の丸ボタン（44px）と高さをそろえ、同じ墨の縁と下の影を付ける */
.logo { display: block; width: 100%; max-width: 211px; height: auto; aspect-ratio: 633 / 132; border: 2.5px solid var(--ink); border-radius: 10px; box-shadow: 0 4px 0 var(--ink); }   /* 幅 211px で高さ 44px（丸ボタンと同じ）。狭い画面では残りの幅に合わせて縮む */
.ai-label {
  margin: 0; padding: 7px 14px;
  font-size: 13px; font-weight: 700; letter-spacing: .04em; line-height: 1;
  color: var(--on-veil); background: var(--veil);
  border: 1px solid var(--veil-line); border-radius: var(--r-2);
}
.top-tools { display: flex; gap: 10px; }
/* 右上の丸ボタン（BGMと会話の設定・AI目安箱について）も、下の札と同じ白地・墨の縁・下の影にそろえる（2026-11-06） */
.tool {
  width: 44px; height: 44px; display: grid; place-items: center;
  color: var(--ink); background: var(--paper);
  border: 2.5px solid var(--ink); border-radius: var(--r-2); box-shadow: 0 4px 0 var(--ink);
  transition: transform .12s var(--ease), box-shadow .12s;
}
.tool:active { transform: translateY(3px) scale(.95); box-shadow: 0 1px 0 var(--ink); }
.tool .ic { width: 20px; height: 20px; }
.tool .off { display: none; }
.tool[aria-pressed="true"] .on { display: none; }
.tool[aria-pressed="true"] .off { display: block; }
.tool span { display: grid; }

/* ---- 場所を替える（町へ出かける／部屋へ戻る） ---- */
/* 右上に縦に並べる（ゲームの画面の、横の小さなボタンの列） */
.side { position: absolute; right: 12px; top: calc(66px + var(--safe-t)); z-index: 6; display: grid; gap: 10px; justify-items: end; }
/* 左右の札（○日目・着せ替え・へやへ・おしらせ・これまでの話）は、同じ幅と高さにそろえる（2026-11-06・友康の指示）。
   いちばん長い「これまでの話」が入る幅。絵は左に寄せ、縦に並んだときに頭がそろうようにする */
.go, .steps { width: var(--pill-w); }
@media (max-width: 359px) { :root { --pill-w: 124px; } .go, .steps { padding: 0 10px; font-size: 12px; letter-spacing: 0; } }   /* 小さい画面では顔にかからないよう細く */
.go {
  position: relative;
  height: 44px; padding: 0 12px;
  display: flex; align-items: center; justify-content: flex-start;
  font-size: 13px; font-weight: 700; letter-spacing: .04em; white-space: nowrap;
  color: var(--ink); background: var(--accent);
  border: 2.5px solid var(--ink); border-radius: var(--r-2); box-shadow: 0 4px 0 var(--ink);
  opacity: 0; transition: transform .12s var(--ease), box-shadow .12s, opacity .35s ease-out .5s;
}
.is-in .go { opacity: 1; }
.go:active { transform: translateY(3px) scale(.95); box-shadow: 0 1px 0 var(--ink); }
.go > span { display: inline-flex; align-items: center; gap: 6px; }
.go-plain { background: var(--paper); }
.go-badge {
  position: absolute; right: -6px; top: -8px; min-width: 22px; height: 22px; padding: 0 5px;
  display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 900; font-variant-numeric: tabular-nums;
  color: #fff; background: var(--danger); border: 2px solid var(--ink); border-radius: var(--r-2);
}
.go-badge[hidden] { display: none; }
/* 開いたときのロゴの動画。横長の動画を切らずに幅いっぱいに置き、上下は動画の上端・下端と同じ色で埋める（縦の画面でロゴが切れない） */
.intro {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: linear-gradient(#0e223d 0 50%, #191f28 50% 100%);
  transition: opacity .5s ease-out;
}
@media (orientation: portrait) {
  .intro { background: linear-gradient(#00051e 0 50%, #00080c 50% 100%); }   /* 縦の動画の上端・下端の色 */
}
.intro.is-done { opacity: 0; pointer-events: none; }
.intro[hidden] { display: none; }
.intro-video { display: block; width: 100%; height: 100%; object-fit: contain; }   /* 縦の動画は 9:16。画面の比が違っても切らずに収め、余りは地の色 */
.intro-skip {
  position: absolute; right: 16px; bottom: calc(20px + var(--safe-b)); min-width: 88px; height: 44px; padding: 0 18px;
  font: inherit; font-size: 14px; font-weight: 700; color: #fff; background: rgba(255, 255, 255, .14);
  border: 1.5px solid rgba(255, 255, 255, .5); border-radius: var(--r-2);
}
.intro-skip:active { transform: scale(.94); }
@media (prefers-reduced-motion: reduce) { .intro { transition: none; } }
.tool { position: relative; }
.tool-dot { position: absolute; right: -3px; top: -3px; width: 14px; height: 14px; background: var(--danger); border: 2px solid var(--ink); border-radius: var(--r-2); }
.update[hidden] { display: none; }
.tool-dot { display: none; }
#reload.is-fresh .tool-dot { display: block; }   /* 新しい版が出ている */
.update {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; margin: 0 0 16px; padding: 0 16px;
  font: inherit; font-size: 15px; font-weight: 900; color: var(--ink); background: var(--accent);
  border: 2.5px solid var(--ink); border-radius: var(--r-2); box-shadow: 0 3px 0 var(--ink);
}
.update .ic { width: 20px; height: 20px; }
.update:active { transform: translateY(2px) scale(.98); box-shadow: 0 1px 0 var(--ink); }
/* 友だちにすすめる（≡ の板の頭） */
.share {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; margin: 0 0 16px; padding: 0 16px;
  font: inherit; font-size: 15px; font-weight: 900; color: var(--ink); background: #fff;
  border: 2.5px solid var(--ink); border-radius: var(--r-2); box-shadow: 0 3px 0 var(--ink);
}
.share .ic { width: 20px; height: 20px; }
.share:active { transform: translateY(2px) scale(.98); box-shadow: 0 1px 0 var(--ink); }
.share-alt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: -8px 0 16px; }
.share-alt[hidden] { display: none; }
.share-line, .share-copy {
  display: grid; place-items: center; min-height: 44px; padding: 0 12px; font: inherit; font-size: 14px; font-weight: 700;
  color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: var(--r-2); text-decoration: none;
}
.share-line { color: #fff; background: #06c755; border-color: #06c755; }   /* LINE の色（相手のアプリの決まりの色） */
.go .go-room { display: none; }
.in-town .go .go-town { display: none; }
.in-town .go .go-room { display: inline-flex; }
/* 場所を替える間は、絵をいったん消す */
.is-moving #bg, .is-moving #fg, .is-moving .avatar-hit { opacity: 0 !important; transition: opacity .22s ease-in !important; }

/* ---- アバター ---- */
.avatar-zone { grid-row: 2; grid-column: 1; position: relative; min-height: 0; z-index: -1; }   /* 列も指定する。「声を届ける」と同じ升に重ねる（指定しないと 2 列目に押し出される） */
.avatar-hit {
  position: absolute; left: 50%; bottom: 0;
  /* 動画の枠は 1848:1380。猫は枠の高さの 87% を占めるので、枠は画面より広く取ってはみ出させる */
  height: min(106%, 400px); aspect-ratio: 1848 / 1380;   /* 比は、アバターごとに JS が入れ直す */
  transform: translateX(calc(-50% + var(--ax, 0px)));
  padding: 0; border: 0; background: none;
  opacity: 0; transition: opacity .6s ease-out;
}
.is-in .avatar-hit { opacity: 1; }
/* 部屋では少し小さく。部屋そのものが見え、端まで動いてもはみ出さない */
.in-room .avatar-hit { height: min(88%, 310px); bottom: 8px; }
.in-room .avatar-shadow { display: none; }
/* 町では小さめ。通りと建物が見え、歩いている感じが出る */
.in-town .avatar-hit { height: min(70%, 240px); bottom: 36px; }
.in-town .avatar-shadow { width: 120px; height: 18px; bottom: 31px; }
/* 歩く: 体を左右に揺らしながら進む（歩きの絵は無いので、揺れで見せる） */
.is-walking .avatar-move { animation: waddle .44s ease-in-out infinite; }
.is-flipped .avatar-poster, .is-flipped .avatar-gl { transform: scaleX(-1); }
@keyframes waddle {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  25% { transform: rotate(0deg) translateY(-7px); }
  50% { transform: rotate(4deg) translateY(0); }
  75% { transform: rotate(0deg) translateY(-7px); }
}
.avatar-move { position: absolute; inset: 0; transform-origin: 50% 96%; will-change: transform; filter: var(--avatar-light, drop-shadow(0 8px 9px rgba(16, 24, 40, .22))); transition: filter 1.2s ease; }
.avatar-poster, .avatar-gl { position: absolute; inset: 0; width: 100%; height: 100%; }
.avatar-poster { object-fit: contain; animation: breathe 3.6s ease-in-out infinite; transform-origin: 50% 96%; }
.avatar-live .avatar-poster { visibility: hidden; animation: none; }
.avatar-gl { display: block; }
.avatar-shadow {
  position: absolute; left: 50%; bottom: -6px; width: 190px; height: 26px;
  transform: translateX(calc(-50% + var(--ax, 0px)));
  background: radial-gradient(closest-side, rgba(10, 16, 30, .38), transparent);
}
.is-asleep:not(.has-sleep-clip) .avatar-move { animation: doze 4.8s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.012, .99); } }
@keyframes doze { 0%, 100% { transform: rotate(-3deg) translateY(4px); } 50% { transform: rotate(-4.2deg) translateY(7px) scale(1.01, .985); } }

/* ---- 吹き出しと操作 ---- */
.talk { grid-row: 3; padding: 14px 14px calc(14px + var(--safe-b)); display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; z-index: 5; opacity: 0; transform: translateY(8px); transition: opacity .35s ease-out .5s, transform .35s var(--ease) .5s; }
.is-in .talk { opacity: 1; transform: none; }
.bubble {
  position: relative;
  min-height: 86px; padding: 20px 18px 16px;
  background: var(--paper); color: var(--ink);
  border: 2.5px solid var(--ink); border-radius: var(--r-1);
  box-shadow: 0 5px 0 var(--ink);
}
.bubble.is-empty { visibility: hidden; }
/* 吹き出しが空でも、名札（「AIやすとし」）だけは出しておく。AI であることが、いつも見えるように（不変ルール1。左上の「AIです」は 11-04 に外した） */
.bubble.is-empty .bubble-name { visibility: visible; }
.sheet h2:focus { outline: none; }
.bubble::before {  /* しっぽ */
  content: ""; position: absolute; left: 50%; top: -11px; width: 18px; height: 18px;
  background: var(--paper); border-left: 2.5px solid var(--ink); border-top: 2.5px solid var(--ink);
  transform: translateX(-50%) rotate(45deg); border-top-left-radius: 4px;
}
.bubble-ai { margin-left: 6px; padding: 1px 6px; font-style: normal; font-size: 11px; font-weight: 900; letter-spacing: .04em; color: var(--paper); background: var(--ink); border-radius: var(--r-2); vertical-align: 1px; }
.bubble-name {
  position: absolute; left: 14px; top: -14px;
  padding: 4px 12px 5px; font-size: 13px; font-weight: 900; letter-spacing: .08em; line-height: 1;
  color: var(--ink); background: var(--accent); border: 2.5px solid var(--ink); border-radius: var(--r-2);
}
.bubble-text { margin: 0; word-break: auto-phrase; line-break: strict; text-wrap: pretty; font-size: 18px; font-weight: 700; line-height: 1.6; letter-spacing: .02em; min-height: 1.6em; }
.bubble-text .ph { display: inline-block; max-width: 100%; }
.bubble-text .ch { opacity: 0; }
.bubble-text .ch.on { opacity: 1; }
.bubble-src { overflow-wrap: anywhere; margin: 8px 0 0; font-size: 11px; line-height: 1.5; color: var(--ink-soft); }
.bubble-next {
  position: absolute; right: 14px; bottom: 9px; width: 0; height: 0; opacity: 0;
  border: 6px solid transparent; border-top: 8px solid var(--ink); border-bottom: 0;
}
.bubble.has-next .bubble-next { opacity: 1; animation: bob .9s ease-in-out infinite; }
.bubble-nav { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin: 4px -8px -10px 0; }
.bubble-nav[hidden] { display: none; }
.bubble-pg { width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink); background: none; border: 0; border-radius: var(--r-2); }
.bubble-pg .ic { width: 20px; height: 20px; }
.bubble-pg:disabled { opacity: .3; }
.bubble-pg:active:not(:disabled) { transform: scale(.94); }
.bubble-pg-n { min-width: 2.6em; text-align: center; font-size: 12px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.bubble.is-thinking .bubble-text::after {
  content: ""; display: inline-block; width: 34px; height: 8px; vertical-align: middle;
  background: radial-gradient(circle, var(--ink) 3.2px, transparent 3.6px) 0 50% / 12px 8px repeat-x;
  animation: think 1s steps(4) infinite;
}
@keyframes bob { 50% { transform: translateY(4px); } }
@keyframes think { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 -34% 0 0); } }

/* 話題のボタンの下に、入力欄（マイク・入力・送る）をいつも出しておく */
.reply { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.chips { display: contents; }
.chip {
  flex: none; height: 44px; padding: 0 13px;
  font-size: 13px; font-weight: 700; white-space: nowrap;
  color: var(--on-veil); background: var(--veil);
  border: 1.5px solid var(--veil-line); border-radius: var(--r-2);
  transition: transform .12s var(--ease), background .15s;
  animation: chip-in .3s var(--ease) both;
}
.chip:nth-child(2) { animation-delay: .05s; }
.chip:nth-child(3) { animation-delay: .1s; }
.chip:hover { background: rgba(18, 28, 48, .92); }
.chip:active { transform: scale(.94); }
/* 書き込める話題。押すと、その場で書ける欄になる（2026-11-08） */
.chip-free { display: inline-flex; align-items: center; gap: 6px; }
.chip-free .ic { width: 14px; height: 14px; opacity: .75; }
.chip-write {
  flex: 1 1 100%; min-width: 0; display: flex; align-items: center; gap: 4px; height: 44px; padding: 0 4px 0 14px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r-2); animation: chip-in .2s var(--ease) both;
}
.chip-input { flex: 1; min-width: 0; height: 100%; padding: 0; font: inherit; font-size: 16px; font-weight: 700; color: var(--ink); background: none; border: 0; outline: none; }
.chip-send, .chip-cancel { flex: none; width: 36px; height: 36px; display: grid; place-items: center; color: var(--ink); background: none; border: 0; border-radius: var(--r-2); }
.chip-send { background: var(--accent); border: 2px solid var(--ink); }
.chip-send .ic, .chip-cancel .ic { width: 18px; height: 18px; }
.chip-send:active, .chip-cancel:active { transform: scale(.94); }

/* キーボードが出ている間（main.js の fitKeyboard）。会話欄と板を、隠れているぶん（--kb）だけ上げる。
   横のボタンは、上がってきた吹き出しに重なるので、その間だけ引っこめる */
.is-typing .talk { transform: translateY(calc(-1 * var(--kb, 0px))); padding-bottom: 10px; transition: transform .16s ease-out; }
.is-typing .side, .is-typing .steps, .is-typing .koe { opacity: 0 !important; pointer-events: none; }
.is-typing .sheet { bottom: var(--kb, 0px); max-height: calc(100% - var(--kb, 0px) - 16px - var(--safe-t)); }

/* これまでの話 */
.log { display: grid; gap: 10px; margin-bottom: 14px; }
.log-line { max-width: 86%; padding: 10px 14px; font-size: 15px; line-height: 1.7; border: 2px solid var(--ink); border-radius: 16px; background: #fff; overflow-wrap: anywhere; }
.log-line.is-you { justify-self: end; background: var(--ink); color: var(--paper); border-bottom-right-radius: 4px; }
.log-line.is-ai { justify-self: start; border-bottom-left-radius: 4px; }
.log-line time { display: block; margin-top: 2px; font-size: 11px; opacity: .6; font-variant-numeric: tabular-nums; }

@keyframes chip-in { from { opacity: 0; transform: translateY(6px); } }

/* 前は畳んであり、「こたえる」「自分で書く」を押さないと出なかった。いつも出しておく（2026-10-12・友康の指示） */
.say { display: flex; flex: 1 1 100%; min-width: 0; gap: 6px; }
.say input {
  flex: 1 1 0; width: 0; min-width: 0; height: 44px; padding: 0 14px;
  font-size: 16px; font-weight: 500;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: var(--r-2);
}
.say input::placeholder { color: var(--ink-soft); opacity: 1; }
.say-mic {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  color: var(--ink); background: var(--paper);
  border: 2.5px solid var(--ink); border-radius: var(--r-2);
  transition: transform .12s var(--ease), background .15s;
}
.say-mic:active { transform: scale(.92); }
.say-mic[aria-pressed="true"] { background: var(--danger); color: #fff; animation: listening 1.1s ease-in-out infinite; }
@keyframes listening { 50% { box-shadow: 0 0 0 6px rgba(194, 65, 45, .3); } }
.say-send {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  color: var(--ink); background: var(--accent);
  border: 2.5px solid var(--ink); border-radius: var(--r-2);
  transition: transform .12s var(--ease);
}
.say-send:active { transform: scale(.92); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 54px; padding: 0 14px;
  font-size: 16px; font-weight: 900; letter-spacing: .04em; white-space: nowrap; text-decoration: none;
  color: var(--ink); background: var(--paper);
  border: 2.5px solid var(--ink); border-radius: var(--r-2); box-shadow: 0 5px 0 var(--ink);
  transition: transform .12s var(--ease), box-shadow .12s, background .15s;
}
.btn:hover { background: #fff; }
.btn:active { transform: translateY(4px) scale(.94); box-shadow: 0 1px 0 var(--ink); }
.btn-main { background: var(--accent); }
.btn-main:hover { background: #ffdb5c; }
.btn-wide { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---- 下のナビ ---- */
.nav {
  grid-row: 4; z-index: 30;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  padding: 6px 8px calc(6px + var(--safe-b));
  background: var(--veil); border-top: 1px solid var(--veil-line);
}
.nav-item {
  position: relative; height: 56px; display: grid; place-content: center; justify-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  color: var(--on-veil-soft); background: none; border: 0; border-radius: 14px;
  transition: color .15s, transform .12s var(--ease);
}
.nav-item .ic { width: 24px; height: 24px; }
.nav-item:active { transform: scale(.92); }
.nav-item.is-here { color: var(--accent); }
.nav-item.is-here::before { content: ""; position: absolute; top: -6px; left: 50%; width: 22px; height: 3px; margin-left: -11px; background: var(--accent); border-radius: 0 0 3px 3px; }

/* ---- 板（下からせり上がる） ---- */
.scrim { position: absolute; inset: 0; z-index: 10; background: rgba(8, 12, 24, .5); opacity: 0; transition: opacity .26s ease; }
.scrim.is-open { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 20;
  max-height: calc(100% - var(--nav-h) - var(--safe-b) - 64px - var(--safe-t));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 18px 24px;
  background: var(--paper); color: var(--ink);
  border: 2.5px solid var(--ink); border-bottom: 0; border-radius: var(--r-1) var(--r-1) 0 0;
  transform: translateY(104%); transition: transform .26s var(--ease);
}
.sheet.is-open { transform: none; }
.sheet h2 { margin: 0 0 16px; font-size: 20px; font-weight: 900; letter-spacing: .04em; }
.sheet h3.sheet-sub { margin: 22px 0 12px; padding-top: 16px; border-top: 1.5px dashed rgba(22, 35, 58, .25); font-size: 14px; color: var(--ink-soft); }
.sheet h3 { margin: 0 0 4px; font-size: 16px; font-weight: 900; }
/* 閉じるボタンは、板を下まで読んでも右上に残す（2026-11-08・友康の指示。前は中身と一緒に流れて消えた） */
.sheet-close { position: sticky; top: 0; float: right; z-index: 3; margin: -12px -8px 0 8px; width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r-2); }
.sheet-close:active { transform: scale(.9); }
.sheet { word-break: auto-phrase; line-break: strict; -webkit-user-select: text; user-select: text; touch-action: pan-y; }
input, textarea { -webkit-user-select: text; user-select: text; }
.sheet-empty, .about { margin: 0 0 12px; font-size: 15px; line-height: 1.8; }
.sheet-lead { margin: -8px 0 16px; font-size: 14px; line-height: 1.7; color: var(--ink-soft); }
.sheet-note { margin: -6px 0 18px; }
.note { padding: 14px 0; border-top: 1.5px dashed rgba(22, 35, 58, .25); }
.note:first-of-type { border-top: 0; padding-top: 0; }
.note time { font-size: 12px; font-weight: 900; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.note p { margin: 4px 0 0; font-size: 15px; line-height: 1.8; }
.note .note-by, .fine { font-size: 13px; color: var(--ink-soft); line-height: 1.6; }
.about-link { margin-right: 16px; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-size: 13px; font-weight: 700; color: var(--ink-soft); }

.push { display: grid; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1.5px dashed rgba(22, 35, 58, .25); }
.push .fine { margin: 0; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 700; }
.field textarea, .field input, .field select {
  width: 100%; padding: 12px 14px; font-size: 16px; font-weight: 500; line-height: 1.6;
  background: #fff; border: 2px solid var(--ink); border-radius: 12px;
}
.field input, .field select { height: 48px; padding-block: 0; }
.field textarea { resize: none; }
.who { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; padding: 0; border: 0; }
.who-3 { grid-template-columns: 1fr 1fr 1fr; margin-bottom: 20px; }
.who legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.who label { position: relative; }
.who input { position: absolute; opacity: 0; inset: 0; }
.who span { display: grid; place-items: center; height: 46px; font-size: 14px; font-weight: 700; border: 2px solid var(--ink); border-radius: var(--r-2); background: #fff; transition: background .15s; }
.who input:checked + span { background: var(--ink); color: var(--paper); }
.who input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
/* オン・オフのスイッチ（設定。項目名の右に並ぶ）。色は .who の選ばれた形（墨の地）に合わせる */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 6px 0; border-bottom: 2px solid rgba(22, 35, 58, .12); font-size: 15px; font-weight: 700; cursor: pointer; }
.switch-row + .sheet-note { margin-top: 8px; }
/* iPhone の設定画面と同じ見え方（2026-11-08・友康の指示）: オン＝緑の地に白い丸が右、オフ＝灰の地に白い丸が左 */
.switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 51px; height: 31px; margin: 0; border: 0; border-radius: 999px; background: #e3e3e8; cursor: pointer; transition: background .2s; }
.switch::before { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .22), 0 0 1px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch:checked { background: #34c759; }
.switch:checked::before { transform: translateX(20px); }
.switch:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .switch, .switch::before { transition: none; } }
.form-error { margin: 0 0 12px; font-size: 13px; font-weight: 700; color: var(--danger); }
/* トーク文章の表示スピード */
.speed { display: grid; gap: 8px; margin: 4px 0 6px; }
.speed label { font-size: 13px; font-weight: 700; }
.speed-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.speed input[type="range"] { width: 100%; height: 44px; margin: 0; accent-color: var(--ink); }

/* ---- 声が飛んでいく ---- */
/* ---- はじめのタップ（触られるまでは、町とアバターだけ。ブラウザは、触られるまで声を出させない） ---- */
.start {
  position: absolute; inset: 0; z-index: 8; display: grid; align-items: end; justify-items: center;
  padding: 0 16px calc(19vh + var(--safe-b)); background: none; border: 0; -webkit-tap-highlight-color: transparent;
}
.start[hidden] { display: none; }
.start span {
  padding: 13px 24px; font-size: 16px; font-weight: 900; letter-spacing: .06em; line-height: 1;
  color: var(--ink); background: var(--accent); border: 2.5px solid var(--ink); border-radius: var(--r-2); box-shadow: 0 4px 0 var(--ink);
  opacity: 0; animation: start-in .4s ease-out .7s forwards, start-bob 1.8s ease-in-out 1.1s infinite;
}
.start:active span { transform: translateY(3px) scale(.95); box-shadow: 0 1px 0 var(--ink); animation-play-state: paused; }
.start:focus-visible { outline: none; }
.start:focus-visible span { outline: 3px solid var(--paper); outline-offset: 3px; }
@keyframes start-in { to { opacity: 1; } }
@keyframes start-bob { 50% { transform: translateY(-5px); } }
.side { transition: opacity .3s ease-out; }
.is-waiting .talk, .is-waiting .side, .is-waiting .steps { opacity: 0 !important; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .start span { animation: start-in .3s ease-out .3s forwards; } }

/* ---- あしあと（通った日数と、増えた物） ---- */
.steps {
  position: absolute; left: 12px; top: calc(66px + var(--safe-t)); z-index: 6;
  height: 44px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: flex-start; gap: 6px;
  font-size: 13px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--paper);
  border: 2.5px solid var(--ink); border-radius: var(--r-2); box-shadow: 0 4px 0 var(--ink);
  opacity: 0; transition: transform .12s var(--ease), box-shadow .12s, opacity .35s ease-out .5s;
}
.steps[hidden] { display: none; }
.is-in .steps { opacity: 1; }
.steps:active { transform: translateY(3px) scale(.95); box-shadow: 0 1px 0 var(--ink); }
.steps .ic { width: 18px; height: 18px; color: var(--accent-deep); }
/* ---- 着せ替え（選べる姿がある議員だけ。「○日め」の下に置く） ---- */
.wear { top: calc(120px + var(--safe-t)); }
.wear .ic { color: var(--ink); }
/* ---- 声を届ける（部屋でだけ。机の前の真ん中に、いちばん大きく置く・2026-11-03） ---- */
.koe {
  grid-row: 2; grid-column: 1; align-self: end; justify-self: center; z-index: 6;   /* 列を指定しないと、画面の外に2列目ができて全体が狭くなる */
  margin-bottom: 10px; height: 54px; padding: 0 22px;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 900; letter-spacing: .04em; white-space: nowrap;
  color: var(--ink); background: var(--accent);
  border: 2.5px solid var(--ink); border-radius: var(--r-2); box-shadow: 0 5px 0 var(--ink);
  opacity: 0; transition: transform .12s var(--ease), box-shadow .12s, opacity .35s ease-out .5s;
}
.koe .ic { width: 22px; height: 22px; }
.is-in .koe { opacity: 1; }
.koe:hover { background: #ffdb5c; }
.koe:active { transform: translateY(4px) scale(.95); box-shadow: 0 1px 0 var(--ink); }
.in-town .koe { display: none; }   /* 町では、通りの目安箱を押す */
/* ---- ボイスボタン（本人の声のテナントだけ。吹き出しの右上）。声のオン／オフ。オンは黄色、オフは紙色に斜線の印 ---- */
.bubble-hear {
  position: absolute; right: 12px; top: -22px; width: 44px; height: 44px; display: grid; place-items: center;
  color: var(--ink); background: var(--accent);
  border: 2.5px solid var(--ink); border-radius: var(--r-2); box-shadow: 0 3px 0 var(--ink);
  transition: transform .12s var(--ease), box-shadow .12s, background .2s;
}
.bubble-hear .ic { width: 22px; height: 22px; }
.bubble-hear .on, .bubble-hear .off { display: grid; place-items: center; }
.bubble-hear .off, .bubble-hear.is-off .on { display: none; }
.bubble-hear.is-off { background: var(--paper); color: var(--ink-soft); }
.bubble-hear.is-off .off { display: grid; }
.bubble-hear:active { transform: translateY(2px) scale(.94); box-shadow: 0 1px 0 var(--ink); }
.is-changing .avatar-hit, .is-changing .avatar-shadow { opacity: 0 !important; transition: opacity .22s ease-in !important; }
.wear-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wear-item {
  display: grid; justify-items: center; gap: 6px; padding: 12px 8px 10px;
  font-size: 14px; font-weight: 700; color: var(--ink); background: #fff;
  border: 2px solid var(--ink); border-radius: var(--r-1);
  transition: transform .12s var(--ease), background .15s;
}
.wear-item img { width: auto; height: 132px; object-fit: contain; }
.wear-item:active { transform: scale(.96); }
/* 通った日が届くまでの姿。絵の代わりに「？」、名前は「？？？」、下に「○日目から」 */
.wear-q { display: none; height: 132px; align-items: center; font-size: 72px; font-weight: 900; line-height: 1; color: rgba(22, 35, 58, .3); }
.wear-item.is-locked { background: #f2efe6; color: var(--ink-soft); }
.wear-item.is-locked img { display: none; }
.wear-item.is-locked .wear-q { display: grid; }
.wear-item.is-locked:active { transform: none; }
.wear-when { font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.wear-item[aria-pressed="true"] { background: var(--accent); box-shadow: 0 4px 0 var(--ink); }
.wear-item:focus-visible { outline: 3px solid var(--accent-deep); outline-offset: 2px; }
.tally { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tally dt { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.tally dd { margin: 0; font-size: 14px; font-weight: 700; }
.tally b { margin-right: 3px; font-size: 34px; font-weight: 900; line-height: 1.2; font-variant-numeric: tabular-nums; }
/* ログインボーナスアイテム。着せ替えの板と同じカードに絵を載せ、まだの物は色を抜いて薄く見せる（2026-11-11） */
.kept { margin: 0 0 14px; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kept li { display: grid; justify-items: center; gap: 4px; padding: 10px 8px 12px; text-align: center; background: #fff; border: 2px solid var(--ink); border-radius: var(--r-1); }
.kept-pic { display: block; width: 100%; height: 96px; object-fit: contain; }
.kept li:not(.is-got) img.kept-pic { filter: grayscale(1) brightness(1.6); opacity: .35; }   /* 着せ替えの姿。物の絵は canvas の中で薄くする（scene.js の drawGift） */
.kept-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.kept li:not(.is-got) .kept-name { color: rgba(22, 35, 58, .4); letter-spacing: .1em; }
.kept small { font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.gain {
  position: absolute; z-index: 4; width: 56px; height: 56px; margin: -28px 0 0 -28px; pointer-events: none;
  border: 4px solid var(--accent); border-radius: 50%; box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--ink);
  animation: gain 1.3s ease-out 2 both;
}
@keyframes gain { from { transform: scale(.35); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .gain { animation: none; opacity: .9; } }

.plane { position: absolute; z-index: 40; width: 34px; height: 34px; color: var(--accent); pointer-events: none; filter: drop-shadow(0 2px 0 var(--ink)); }
.plane .ic { width: 100%; height: 100%; }

/* ---- JS なしの礼の画面 ---- */
.plain { display: grid; place-content: center; justify-items: center; gap: 20px; padding: 24px; color: var(--on-veil); text-align: center; }
.plain-line { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.7; }

@media (max-height: 640px) {
  .bubble { min-height: 72px; padding: 16px 16px 12px; }
  .bubble-text { font-size: 16px; }
  .btn { height: 48px; font-size: 15px; }
  .talk { gap: 8px; padding-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  #bg, #fg, .talk { transition: opacity .3s ease !important; transform: none; }
  .avatar-hit { transition: opacity .3s ease !important; }
}

/* 音の不具合を実機で調べるときの記録（?debug=audio のときだけ出る） */
.dbg { position: fixed; left: 0; right: 0; top: 0; z-index: 99; max-height: 46%; margin: 0; padding: 6px 8px; overflow: auto; pointer-events: none;
  font: 10px/1.35 ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-all; color: #d8ffd8; background: rgba(0, 0, 0, .78); }

/* 「AI目安箱について」の中のボタン（覚えていることを消す）。見た目はほかの案内と同じ */
button.about-link[hidden] { display: none; }
button.about-link { display: flex; margin: -4px 0 6px; padding: 0; font-family: inherit; color: var(--ink); background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---- おしらせのリンクと「○○さんを知る」の板（services/profile.py） ---- */
.links { margin: 0 0 18px; padding: 0; list-style: none; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.links li + li { border-top: 1.5px dashed rgba(22, 35, 58, .25); }
.link-row {
  width: 100%; min-height: 56px; padding: 8px 2px;
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto 16px; align-items: center; gap: 12px;
  font: inherit; font-size: 15px; font-weight: 700; text-align: left; text-decoration: none;
  color: var(--ink); background: none; border: 0; cursor: pointer;
  transition: transform .12s var(--ease);
}
.link-row:active { transform: scale(.98); }
.link-row .ic { width: 22px; height: 22px; }
.link-row .ic:last-child { width: 16px; height: 16px; color: var(--ink-soft); }
.link-main { overflow-wrap: anywhere; }
.link-where { font-size: 12px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.links-menu { margin: 6px 0 14px; }

.pf-head { display: flex; align-items: center; gap: 14px; margin: 4px 0 14px; }
.pf-face { width: 64px; height: 64px; flex: none; border: 2.5px solid var(--ink); border-radius: var(--r-2); background: #fff; object-fit: cover; }
.pf-name { margin: 0; font-size: 24px; font-weight: 900; line-height: 1.3; letter-spacing: .04em; }
.pf-kana { margin: 2px 0 0; font-size: 12px; font-weight: 700; color: var(--ink-soft); letter-spacing: .08em; }
.pf-roles { margin: 0 0 20px; padding: 0; list-style: none; }
.pf-roles li { padding: 7px 0; font-size: 14px; font-weight: 700; line-height: 1.5; border-top: 1.5px dashed rgba(22, 35, 58, .25); }
.pf-roles li:last-child { border-bottom: 1.5px dashed rgba(22, 35, 58, .25); }
.pf-quote { margin: 0 0 26px; }
.pf-quote blockquote { margin: 0; font-size: 18px; font-weight: 900; line-height: 1.6; }
.pf-quote blockquote::before { content: "「"; }
.pf-quote blockquote::after { content: "」"; }
.pf-quote figcaption { margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.pf-sec { margin: 0 0 32px; scroll-margin-top: 66px; }
/* 目次。板を流しても上に残る。右の × とは重ねない */
.pf-nav {
  position: sticky; top: -22px; z-index: 2;   /* 板の上の余白（22px）ごと隠す */
  margin: 0 -18px 18px; padding: 14px 0 10px 18px; background: var(--paper); border-bottom: 1.5px solid rgba(22, 35, 58, .18);
}
.pf-nav-in { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-right: 64px; }
.pf-nav-in::-webkit-scrollbar { display: none; }
.pf-jump {
  flex: none; height: 40px; padding: 0 14px; font: inherit; font-size: 14px; font-weight: 900; color: var(--ink);
  background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r-2);
}
.pf-jump:active { transform: scale(.94); background: var(--accent); }
.sheet h3.pf-title { margin: 0 0 4px; padding-bottom: 8px; font-size: 18px; border-bottom: 2px solid var(--ink); }
.pf-list { margin: 0; padding: 0; list-style: none; }
.pf-list li { padding: 16px 0; border-bottom: 1.5px dashed rgba(22, 35, 58, .25); }
.pf-list h4 { margin: 0; font-size: 17px; font-weight: 900; line-height: 1.5; }
.pf-list p { margin: 4px 0 0; font-size: 15px; line-height: 1.8; }
.pf-list details { margin-top: 2px; }
.pf-list summary { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; font-weight: 700; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.pf-list details p { margin: 0 0 4px; color: var(--ink-soft); }
.pf-rows { margin: 0; }
.pf-rows > div { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1.5px dashed rgba(22, 35, 58, .25); }
.pf-rows dt { font-size: 13px; font-weight: 900; line-height: 1.8; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.pf-rows dd { margin: 0; font-size: 15px; line-height: 1.8; }
.pf-tel { font-weight: 900; color: var(--ink); text-underline-offset: 3px; font-variant-numeric: tabular-nums; }
.pf-links { margin-top: -8px; }
.pf-nw { white-space: nowrap; }
