/* =========================================================
   ねこと暮らす手帳 v2 ― スマホファースト＆ポップUI
   基準幅 420px のアプリ風レイアウト。PCでは中央に表示。
   ========================================================= */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: #5b3a29;
  height: 100vh; height: 100dvh; overflow: hidden;
  background:
    radial-gradient(circle at 12% 20%, #ffd9e8 0 60px, transparent 61px),
    radial-gradient(circle at 88% 12%, #d9f4ff 0 80px, transparent 81px),
    radial-gradient(circle at 82% 82%, #fff3b0 0 70px, transparent 71px),
    radial-gradient(circle at 8% 88%, #d8ffd9 0 55px, transparent 56px),
    linear-gradient(160deg, #ffeef6, #e8f7ff 55%, #fff8e1);
  background-attachment: fixed;
}
#app {
  max-width: 420px; margin: 0 auto; padding: 10px 12px 0;
  height: 100vh; height: 100dvh; position: relative;
  display: flex; flex-direction: column;
  background: rgba(255, 255, 255, .45);
}
.hidden { display: none !important; }
.center { text-align: center; }
.small { font-size: .8rem; color: #a07a5f; line-height: 1.6; }
.footnote { font-size: .7rem; color: #b39477; line-height: 1.6; margin-top: 20px; }

/* ---------- ボタン共通（押し感のある立体ボタン） ---------- */
button {
  font-family: inherit; border: none; cursor: pointer; color: #5b3a29;
  border-radius: 999px; background: #fff; font-size: .95rem; font-weight: bold;
  box-shadow: 0 4px 0 rgba(180, 120, 60, .35);
  transition: transform .07s, box-shadow .07s, filter .15s;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(180, 120, 60, .35); }
button:disabled { opacity: .45; box-shadow: none; }
button.wide { display: block; width: 100%; margin: 8px 0; padding: 13px; border-radius: 16px; background: #ffe9f3; box-shadow: 0 4px 0 #f3b8cf; }
button.danger { background: #ffd9d9 !important; box-shadow: 0 4px 0 #e5a3a3 !important; color: #8c3434; }
.file-label {
  display: block; text-align: center; margin: 8px 0; padding: 13px; border-radius: 16px;
  background: #e6f4ff; box-shadow: 0 4px 0 #a9cdec; cursor: pointer; font-weight: bold; font-size: .95rem;
}
/* 外部リンクを wide ボタン風に見せる（設定内の NEKO MATCH リンク用） */
a.wide-link {
  display: block; text-align: center; margin: 8px 0; padding: 13px; border-radius: 16px;
  background: #e6f4ff; box-shadow: 0 4px 0 #a9cdec; font-weight: bold; font-size: .95rem;
  color: #2f6ea5; text-decoration: none; box-sizing: border-box;
}
a.wide-link:active { transform: translateY(3px); box-shadow: 0 1px 0 #a9cdec; }
.text-danger { background: transparent; box-shadow: none; color: #c0564f; font-size: .82rem; margin-top: 6px; }

/* ---------- 画面遷移 ---------- */
.screen { animation: screen-in .32s cubic-bezier(.2, 1.4, .4, 1); flex: 1 1 auto; min-height: 0; }
/* スタート画面は画面の中でだけスクロール可 */
#screen-start { overflow-y: auto; padding-bottom: 24px; }
/* メイン画面（おうち）は絶対にスクロールさせない固定レイアウト：
   HUD／アラート／お部屋（可変）／パラメータ／お世話ボタン を縦フレックスで1画面に収める */
#screen-main {
  display: flex; flex-direction: column; gap: 6px; overflow: hidden;
  padding-bottom: calc(66px + env(safe-area-inset-bottom)); /* 下部タブバーの分 */
}
@keyframes screen-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

/* ---------- スタート画面 ---------- */
.title-wrap { text-align: center; margin: 14px 0 4px; }
.title-paw { font-size: 2.6rem; display: inline-block; animation: paw-bounce 1.6s ease-in-out infinite; }
@keyframes paw-bounce { 0%, 100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-9px) rotate(8deg); } }
h1.title {
  margin: 2px 0; font-size: 1.85rem; letter-spacing: .02em;
  background: linear-gradient(90deg, #ff6b9d, #ff9f43, #ff6b9d);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: none; filter: drop-shadow(0 2px 0 rgba(255, 255, 255, .9));
}
.subtitle { margin: 0; font-size: .85rem; color: #e2719b; font-weight: bold; }
.lead {
  text-align: center; line-height: 1.75; font-size: .9rem; margin: 12px 2px;
  background: rgba(255, 255, 255, .75); border-radius: 16px; padding: 10px 12px;
  border: 2px dashed #ffc7da;
}
/* NEKO MATCH連携バナー（?breed= があるときだけ表示） */
.nekomatch-banner {
  position: relative; display: flex; flex-direction: column; gap: 8px; align-items: stretch;
  margin: 10px 2px; padding: 12px 14px; border-radius: 16px;
  background: linear-gradient(135deg, #e8f6ff, #fdf3ff); border: 2px solid #a9d4ec;
  box-shadow: 0 4px 0 #a9d4ec; font-size: .88rem; line-height: 1.6; text-align: center;
}
.nm-banner-btn { background: #7cc4ff; color: #fff; box-shadow: 0 4px 0 #4a9fd8; padding: 11px; font-size: .95rem; }
.nm-banner-btn:active { box-shadow: 0 1px 0 #4a9fd8; }
.nm-banner-close {
  position: absolute; top: 4px; right: 6px; background: transparent; box-shadow: none;
  color: #8aa5b5; font-size: .8rem; padding: 4px 7px;
}
.nm-banner-close:active { transform: none; box-shadow: none; }
.sec-title { font-size: 1.05rem; margin: 20px 0 10px; text-align: center; color: #d3547f; }
.mini-title { font-size: .95rem; margin: 16px 0 8px; color: #d3547f; }

/* 出会い方カード */
.encounter-list { display: flex; flex-direction: column; gap: 10px; }
.encounter-card {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  padding: 14px; border-radius: 20px; border: 3px solid transparent;
}
.enc-shop { background: #fff4d6; box-shadow: 0 4px 0 #ecd28a; }
.enc-cafe { background: #ffe3ee; box-shadow: 0 4px 0 #f0aec6; }
.enc-sato { background: #dcf5e3; box-shadow: 0 4px 0 #a5dcb4; }
/* 出会い方2段階化：血統書の選択カード＋第2段階のルートカード */
.enc-ped-yes { background: #fdf3d0; box-shadow: 0 4px 0 #e8cf8a; }
.enc-ped-no { background: #e8f7ff; box-shadow: 0 4px 0 #a9d4ec; }
.enc-breeder { background: #ece7ff; box-shadow: 0 4px 0 #c3bcf0; }
.enc-jouto { background: #dcf5e3; box-shadow: 0 4px 0 #a5dcb4; }
.text-link {
  display: block; margin: 12px auto 0; background: transparent; box-shadow: none;
  color: #b3855e; font-size: .85rem; text-decoration: underline; padding: 6px 10px;
}
.text-link:active { transform: none; box-shadow: none; }
.encounter-card.selected { border-color: #ff6b9d; transform: scale(1.02); }
.enc-icon { font-size: 1.9rem; flex: 0 0 auto; }
.enc-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.enc-name { font-size: 1.05rem; }
.enc-desc { font-size: .78rem; font-weight: normal; color: #8a6a52; line-height: 1.5; }
.enc-arrow { font-size: 1.5rem; color: #d89a76; font-weight: bold; }

/* 候補猫 */
.candidate-list { display: flex; flex-direction: column; gap: 10px; }
.candidate {
  border-radius: 20px; padding: 10px; display: flex; gap: 10px; align-items: center;
  text-align: left; width: 100%; background: #fff; border: 3px solid #ffe1ec;
  box-shadow: 0 4px 0 #f6cfdd; font-weight: normal;
}
.candidate.selected { border-color: #ff6b9d; background: #fff5f9; transform: scale(1.02); }
.candidate .cand-svg { flex: 0 0 104px; }
.candidate .cand-svg svg { width: 100%; height: auto; display: block; }
/* 候補カードの見た目（2026-11-26〜：柄カテゴリのリアルタイプ画像。SVGは読み込み失敗時のみ） */
.candidate .cand-visual { flex: 0 0 104px; }
.candidate .cand-coat { width: 104px; height: 104px; object-fit: cover; border-radius: 14px; border: 2px solid #ffe1ec; display: block; }
.candidate .cand-visual .cand-photo { width: 104px; height: 104px; }
.candidate .cand-info { font-size: .82rem; line-height: 1.55; }
.candidate .cand-info b { font-size: .98rem; }
.candidate .cand-tag {
  display: inline-block; background: #ffeef5; color: #d3547f; border-radius: 999px;
  padding: 1px 8px; font-size: .72rem; font-weight: bold; margin: 2px 2px 0 0;
}
/* 出会いイベント：会場移動・日を改めるボタン */
.visit-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 4px 0 12px; }
.visit-bar button { padding: 9px 14px; font-size: .82rem; background: #fff; box-shadow: 0 3px 0 #e8cfae; }
/* 価格タグ（相場の目安） */
.candidate .cand-tag.price-tag { background: #e9f9e4; color: #2e7d32; }
/* 実在の子（CAT HOME GARDEN）関連 */
.candidate .cand-tag.real-tag { background: #ff8fab; color: #fff; }
.candidate .cand-tag.status-tag { background: #fff3cd; color: #8a6d00; }
.candidate .cand-tag.sample-tag { background: #e3f2fd; color: #1565c0; }
.candidate .cand-photo { flex: 0 0 84px; width: 84px; height: 84px; object-fit: cover; border-radius: 14px; border: 2px solid #ffe1ec; }
/* 品種イメージ画像（リアルタイプ3D CG、2026-11-26 追加）。読み込み失敗時は JS 側 onerror で要素が消える */
.candidate .cand-breed-photo { flex: 0 0 84px; width: 84px; height: 84px; object-fit: cover; border-radius: 14px; border: 2px solid #ffe1ec; }
.candidate .breed-img { flex: 0 0 96px; width: 96px; height: 96px; object-fit: cover; border-radius: 16px; border: 2px solid #ffe1ec; }
.title-hero { width: min(78%, 300px); height: auto; border-radius: 24px; border: 3px solid #ffe1ec; box-shadow: 0 6px 0 #f6cfdd; margin-top: 10px; }
/* 譲渡会のケージ表示：縦格子の overlay とケージ番号 */
.candidate.cage {
  position: relative; overflow: hidden;
  background: linear-gradient(#fdfdfd, #eef4f2); border-color: #b9cdd2; box-shadow: 0 4px 0 #a9bfc6;
}
.candidate.cage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 15px, rgba(110, 135, 145, .20) 15px 18px);
}
.cage-no {
  position: absolute; top: 6px; left: 8px; z-index: 2;
  background: #5b7a86; color: #fff; font-size: .66rem; font-weight: bold;
  padding: 2px 9px; border-radius: 999px;
}
/* ブリーダーの品種カードと全品種カタログ */
.breed-card .cand-info { flex: 1; }
.breed-catalog {
  background: rgba(255, 255, 255, .85); border: 2px dashed #c3bcf0; border-radius: 16px;
  padding: 6px 14px 10px;
}
.breed-row {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: .76rem; padding: 4px 0; border-bottom: 1px dashed #e6ddf5; color: #7d5f4a;
}
.breed-row:last-child { border-bottom: none; }

.name-row { margin-top: 10px; }
.name-row input {
  width: 100%; font-size: 1.05rem; padding: 13px; border-radius: 16px; text-align: center;
  border: 3px solid #ffc7da; font-family: inherit; background: #fff; color: #5b3a29;
}
.name-row input:focus { outline: none; border-color: #ff6b9d; }
#chosen-cat-preview {
  background: #fff; border-radius: 16px; padding: 8px 12px; font-size: .9rem;
  border: 2px dashed #ffc7da; text-align: center;
}
.big-cta {
  display: block; width: 100%; margin-top: 12px; padding: 16px; font-size: 1.12rem; color: #fff;
  background: linear-gradient(90deg, #ff6b9d, #ff8fab); box-shadow: 0 6px 0 #d84f7e;
  animation: cta-pulse 1.8s ease-in-out infinite;
}
.big-cta:active { box-shadow: 0 2px 0 #d84f7e; }
@keyframes cta-pulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.09); } }
#resume-area { margin-top: 22px; text-align: center; }

/* ---------- HUD ---------- */
.hud {
  background: rgba(255, 255, 255, .92); border-radius: 18px; padding: 9px 12px;
  box-shadow: 0 3px 10px rgba(200, 110, 140, .18); border: 2px solid #ffe1ec;
  flex: 0 0 auto;
}
.hud-row { display: flex; align-items: center; gap: 8px; }
.hud-cat { margin-top: 5px; justify-content: space-between; }
.lv-badge {
  background: linear-gradient(135deg, #ffa940, #ff7a59); color: #fff; font-weight: bold;
  border-radius: 999px; padding: 4px 11px; font-size: .9rem; box-shadow: 0 2px 0 #d96f33;
  flex: 0 0 auto;
}
.xp-wrap { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.xp-bar { flex: 1; height: 13px; background: #fdeef3; border-radius: 999px; overflow: hidden; border: 1.5px solid #ffc7da; }
.xp-fill { height: 100%; background: linear-gradient(90deg, #ffb84d, #ff7a59); border-radius: 999px; transition: width .5s cubic-bezier(.2, 1.2, .4, 1); }
.xp-text { font-size: .68rem; color: #b3855e; white-space: nowrap; }
.niboshi-badge {
  background: #e8f7ff; border: 2px solid #b8e2f7; border-radius: 999px; padding: 3px 10px;
  font-weight: bold; font-size: .9rem; flex: 0 0 auto;
}
.cat-name { font-weight: bold; font-size: 1.12rem; }
.cat-meta { font-size: .72rem; color: #a07a5f; display: block; line-height: 1.45; }
.clock { font-size: .72rem; color: #b39477; flex: 0 0 auto; }
.mood-meter { display: flex; align-items: center; gap: 7px; margin-top: 7px; }
.mood-label { font-size: .78rem; font-weight: bold; color: #d3547f; flex: 0 0 auto; }
.mood-bar { flex: 1; height: 15px; background: #fdeef3; border-radius: 999px; overflow: hidden; border: 1.5px solid #ffc7da; }
.mood-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ff8fab, #ff6b9d); transition: width .5s cubic-bezier(.2, 1.2, .4, 1); }
.mood-fill.mid { background: linear-gradient(90deg, #ffc94d, #ff9f43); }
.mood-fill.low { background: linear-gradient(90deg, #b8c4ce, #8fa3b3); }
.mood-face { font-size: 1.15rem; }

/* ---------- 健康アラート ---------- */
.health-alert {
  flex: 0 0 auto; background: #fff0f0; border: 3px solid #ff9d9d; border-radius: 18px;
  padding: 11px 13px; font-size: .87rem; line-height: 1.65; animation: alert-pop .3s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes alert-pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.health-alert button { margin: 8px 6px 0 0; padding: 10px 14px; }
.health-alert .btn-watch { background: #e8f7ff; box-shadow: 0 4px 0 #a9cdec; }
.health-alert .btn-vet { background: linear-gradient(90deg, #ff8f8f, #ff6b6b); color: #fff; box-shadow: 0 4px 0 #d84f4f; }
.health-alert .btn-later { background: #fff; box-shadow: 0 4px 0 #d8c9b8; }
/* ケアアラート（ワクチン・避妊去勢など週齢連動の提案）は水色基調で体調不良と区別 */
.care-alert { background: #eef7ff; border-color: #9fd0ec; }
.care-alert .btn-vet { background: linear-gradient(90deg, #6fc3ff, #3d9bdc); box-shadow: 0 4px 0 #2f7cb5; }
/* 病院アラート（定期検診・検診所見）は緑基調で、不調アラートと区別する */
.cafe-alert { background: #fff0f6; border-color: #f3a8c8; }
.cafe-visit-item { margin: 6px 0; padding: 8px 10px; background: rgba(255,255,255,.65); border-radius: 10px; }
.cand-tag.rare-tag { background: #fff3bf; border: 1px solid #e8c93d; color: #7a5c00; font-weight: 700; }
.dm-badge { display: inline-block; min-width: 18px; margin-left: 4px; padding: 1px 5px; border-radius: 999px; background: #ff5d8f; color: #fff; font-size: .68rem; font-weight: 700; vertical-align: top; }
.dm-unread { border-left: 4px solid #ff5d8f; background: #fff5f9; }
.vet-alert { background: #ecfaf1; border-color: #8fd3ab; }
.vet-alert .btn-vet { background: linear-gradient(90deg, #5fce8e, #34b06c); box-shadow: 0 4px 0 #278a54; }

/* ---------- 入院パネル・お別れ画面（v12） ---------- */
.hospital-panel, .farewell-panel { text-align: center; padding: 20px 12px; }
.hospital-emoji, .farewell-rainbow { font-size: 46px; margin-bottom: 8px; }
.hospital-advice { background: #fff; border: 2px dashed #8fd3ab; border-radius: 14px; padding: 10px 12px; font-size: .88rem; line-height: 1.65; }
.hospital-panel button, .farewell-panel button { margin: 8px 5px 0; padding: 11px 16px; }
.farewell-name { font-size: 1.3rem; font-weight: 800; margin: 4px 0; }
.farewell-thanks { color: #b06a4f; font-weight: 700; }
.farewell-panel .btn-watch { background: #e8f7ff; box-shadow: 0 4px 0 #a9cdec; }
.farewell-panel .btn-vet { background: linear-gradient(90deg, #6fc3ff, #3d9bdc); color: #fff; box-shadow: 0 4px 0 #2f7cb5; }

/* ---------- 速度設定ボタン（v12） ---------- */
.speed-btns { display: grid; gap: 8px; margin: 6px 0 4px; }
.speed-btn.active { background: linear-gradient(90deg, #ffd76a, #ffb347); box-shadow: 0 4px 0 #e09a2f; font-weight: 800; }

/* ---------- お部屋と猫 ---------- */
.room {
  position: relative; flex: 1 1 auto; min-height: 96px; border-radius: 24px;
  background:
    radial-gradient(circle at 85% 18%, #fff6c9 0 26px, transparent 27px),
    linear-gradient(#bdeaff 0 58%, #ffe3b3 58% 100%);
  border: 3px solid #fff; box-shadow: 0 4px 14px rgba(120, 160, 200, .25);
  overflow: hidden;
}
.room::after { /* 床の境目 */
  content: ""; position: absolute; left: 0; right: 0; top: 58%; height: 5px;
  background: rgba(255, 255, 255, .65);
}
.room-deco { position: absolute; font-size: 1.5rem; opacity: .85; z-index: 1; }
.deco-1 { top: 10px; left: 12px; animation: drift 5s ease-in-out infinite; }
.deco-2 { bottom: 12px; right: 14px; }
@keyframes drift { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(12px); } }
#cat-stage {
  position: absolute; left: 50%; top: 2px; bottom: 2px; transform: translateX(-50%);
  width: min(88%, 330px); z-index: 2;
}
#cat-stage svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pet-zone { cursor: pointer; }
/* メイン画面の猫（2026-11-26〜：柄カテゴリのリアルタイプ画像＋透明タップゾーン） */
.main-cat-wrap { position: absolute; inset: 0; transform-origin: 50% 100%; }
.main-cat-img {
  width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 18px;
  transform-origin: 50% 92%; animation: cat-breathe 3.2s ease-in-out infinite;
}
.main-cat-zones { position: absolute; inset: 0; }
.pet-zone-img { position: absolute; cursor: pointer; }
.cat-anim { transform-box: fill-box; transform-origin: 50% 92%; animation: cat-breathe 3.2s ease-in-out infinite; }
@keyframes cat-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, .982); } }
.cat-tail {
  transform-box: fill-box; transform-origin: 4% 88%;
  animation: tail-wag 2.6s ease-in-out infinite;
}
@keyframes tail-wag { 0%, 100% { transform: rotate(0deg); } 30% { transform: rotate(-7deg); } 65% { transform: rotate(5deg); } }
.cat-eyes { transform-box: fill-box; transform-origin: center; animation: blink 4.4s infinite; }
@keyframes blink { 0%, 91%, 100% { transform: scaleY(1); } 94%, 96% { transform: scaleY(.08); } }
.cat-hop { animation: cat-hop .55s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes cat-hop { 0% { transform: translateX(-50%) translateY(0); } 35% { transform: translateX(-50%) translateY(-17px) scale(1.03, .97); } 70% { transform: translateX(-50%) translateY(0) scale(.97, 1.04); } 100% { transform: translateX(-50%) translateY(0); } }
.cat-squish { animation: cat-squish .45s ease; }
@keyframes cat-squish { 0% { transform: translateX(-50%) scale(1, 1); } 40% { transform: translateX(-50%) scale(1.07, .9); } 100% { transform: translateX(-50%) scale(1, 1); } }
.cat-sulk { filter: saturate(.55) brightness(.96); }
/* 成長ステージでアニメーション速度が変わる（子猫は素早く、シニアはゆっくり） */
.cat-svg.speed-fast .cat-anim { animation-duration: 1.7s; }
.cat-svg.speed-fast .cat-tail { animation-duration: 1.3s; }
.cat-svg.speed-fast .cat-eyes { animation-duration: 2.8s; }
.cat-svg.speed-slow .cat-anim { animation-duration: 5.4s; }
.cat-svg.speed-slow .cat-tail { animation-duration: 4.8s; }
.cat-svg.speed-slow .cat-eyes { animation-duration: 6.8s; }
.speech {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  background: #fff; border-radius: 16px; padding: 8px 14px; font-size: .9rem; font-weight: bold;
  box-shadow: 0 3px 10px rgba(120, 70, 30, .2); max-width: 88%; text-align: center; z-index: 4;
  border: 2px solid #ffe1ec; animation: speech-pop .25s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes speech-pop { from { transform: translateX(-50%) scale(.8); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
.speech::after {
  content: ""; position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%);
  border: 9px solid transparent; border-top-color: #fff; border-bottom: 0;
}
#fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.fx-item {
  position: absolute; font-size: 1.45rem; animation: fx-float 1.15s ease-out forwards;
  text-shadow: 0 2px 4px rgba(255, 255, 255, .8);
}
@keyframes fx-float {
  0% { opacity: 0; transform: translateY(6px) scale(.5) rotate(0deg); }
  18% { opacity: 1; transform: translateY(-8px) scale(1.25) rotate(-8deg); }
  100% { opacity: 0; transform: translateY(-72px) scale(1) rotate(10deg); }
}
.fx-pop {
  position: absolute; font-weight: bold; font-size: 1rem; color: #ff5c8a;
  animation: fx-float 1.1s ease-out forwards; text-shadow: 0 1px 0 #fff, 0 2px 5px rgba(255, 255, 255, .9);
  white-space: nowrap;
}
.fx-pop.blue { color: #3d9bdc; } .fx-pop.green { color: #3faf6e; } .fx-pop.orange { color: #f08c1e; }
.hint { text-align: center; font-size: .74rem; color: #b39477; margin: 0; flex: 0 0 auto; }

/* ---------- お部屋のトイレ（砂入りトレイ・清潔度で見た目が変わる） ---------- */
.litter-box {
  position: absolute; left: 10px; bottom: 8px; width: 92px; z-index: 3;
  cursor: pointer; filter: drop-shadow(0 2px 3px rgba(90, 120, 140, .3));
  transition: transform .15s;
}
.litter-box:active { transform: scale(.94); }
.litter-box svg { width: 100%; height: auto; display: block; }
.litter-cap {
  position: absolute; left: 50%; bottom: 7px; transform: translateX(-50%);
  font-size: .56rem; font-weight: bold; color: #fff; letter-spacing: .14em;
  text-shadow: 0 1px 2px rgba(40, 90, 120, .55); pointer-events: none;
}
.litter-box.litter-dirty { animation: litter-warn 1.6s ease-in-out infinite; }
@keyframes litter-warn { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-1.6deg); } }
/* 猫がトイレに行く演出（ステージごと左下のトイレへ移動） */
.cat-visit { animation: cat-visit 2.7s ease-in-out; }
@keyframes cat-visit {
  0% { transform: translateX(-50%) translateY(0); }
  30%, 58% { transform: translateX(-88%) translateY(3px) scale(.94); }
  100% { transform: translateX(-50%) translateY(0); }
}

/* ---------- おもちゃ棚チップ（メイン画面・1行） ---------- */
#toy-area { flex: 0 0 auto; }
.toy-chip {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 7px 13px; border-radius: 999px; font-size: .8rem;
  background: #fff3e0; border: 2.5px solid #ffd9a8; box-shadow: 0 3px 0 #ecc27f;
  white-space: nowrap; overflow: hidden;
}
.toy-chip #ui-toy-name { font-weight: bold; color: #d3547f; overflow: hidden; text-overflow: ellipsis; }
.toy-chip-arrow { margin-left: auto; color: #d89a76; font-size: 1.05rem; font-weight: bold; }

/* ---------- おもちゃ棚モーダル ---------- */
.toy-list { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }
.toy-item {
  display: flex; align-items: center; gap: 10px; background: #fff; border: 2.5px solid #ffe1ec;
  border-radius: 18px; padding: 10px 12px;
}
.toy-item .t-icon { font-size: 1.9rem; flex: 0 0 auto; }
.toy-item .t-body { flex: 1; min-width: 0; }
.toy-item .t-name { font-weight: bold; font-size: .95rem; display: block; }
.toy-item .t-desc { font-size: .75rem; color: #a07a5f; line-height: 1.5; display: block; }
.toy-item .t-pick {
  flex: 0 0 auto; padding: 10px 12px; font-size: .82rem; color: #fff;
  background: linear-gradient(90deg, #ffb84d, #ff7a59); box-shadow: 0 3px 0 #d96f33;
}
.toy-item .t-state { flex: 0 0 auto; font-size: .78rem; font-weight: bold; color: #3faf6e; }
.toy-item .t-state.lock { color: #a08b7a; }
.toy-item.selected { border-color: #ff6b9d; background: #fff5f9; }
.toy-item.locked { opacity: .62; filter: grayscale(.5); }

/* ---------- パラメータ（2列グリッドで高さを節約） ---------- */
.params { flex: 0 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; }
.param { display: flex; align-items: center; gap: 6px; font-size: .8rem; min-width: 0; }
.param .p-label { flex: 0 0 62px; font-weight: bold; white-space: nowrap; }
.param .p-bar { flex: 1; height: 13px; background: #fdf0e4; border-radius: 999px; overflow: hidden; border: 1.5px solid #f3ddc4; }
.param .p-fill { height: 100%; border-radius: 999px; transition: width .45s cubic-bezier(.2, 1.2, .4, 1); }
.param .p-fill.flash { animation: bar-flash .5s ease; }
@keyframes bar-flash { 0% { filter: brightness(1.7); } 100% { filter: brightness(1); } }
.param .p-val { flex: 0 0 30px; text-align: right; font-variant-numeric: tabular-nums; font-weight: bold; }
.p-fill.ok { background: linear-gradient(90deg, #7ed67e, #4cb944); }
.p-fill.mid { background: linear-gradient(90deg, #ffd34d, #f2a93b); }
.p-fill.low { background: linear-gradient(90deg, #ff9d8a, #f2604c); }

/* ---------- お世話ボタン（画面下部・親指の届く範囲に固定） ---------- */
.actions { flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.act {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 9px 2px 7px; font-size: .8rem; border-radius: 18px; border: 2.5px solid #fff;
}
.act-icon { font-size: 1.42rem; line-height: 1.15; }
.act-feed { background: #ffe9c9; box-shadow: 0 4px 0 #ecc27f; }
.act-snack { background: #d9f2ff; box-shadow: 0 4px 0 #9fd0ec; }
.act-water { background: #d6f4ff; box-shadow: 0 4px 0 #93d3ef; }
.act-play { background: #ffe0ec; box-shadow: 0 4px 0 #f0a8c4; }
.act-clean { background: #e4f9e0; box-shadow: 0 4px 0 #a9dda0; }
.act-sleep { background: #e6e2ff; box-shadow: 0 4px 0 #b3aef0; }
.act-talk { background: #fff3bf; box-shadow: 0 4px 0 #ecd27e; }
.act-pet { background: #ffdcd2; box-shadow: 0 4px 0 #f0aa97; }
.act:active { box-shadow: 0 1px 0 rgba(0, 0, 0, .12); }
/* クールダウン中：グレーアウト＋残り時間を小さく表示 */
.act:disabled, .act.on-cd { filter: grayscale(.75); opacity: .55; box-shadow: 0 2px 0 rgba(0, 0, 0, .12); cursor: not-allowed; }
.act-cd { display: block; font-size: .6rem; line-height: 1.1; color: #6b5a54; font-weight: 700; }

/* ---------- もちもの（1行の横スクロールチップ） ---------- */
#inventory-area { flex: 0 0 auto; }
.inventory { display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 4px; }
.inv-item {
  flex: 0 0 auto; display: flex; flex-direction: row; align-items: center; gap: 6px;
  padding: 8px 11px; border-radius: 999px; background: #fff8e6; border: 2.5px solid #ffe1a8;
  box-shadow: 0 3px 0 #ecd28a; font-size: .78rem; white-space: nowrap;
}
.inv-item .inv-icon { font-size: 1.3rem; }
.inv-item .inv-count { font-size: .72rem; color: #b3855e; font-weight: bold; }

/* ---------- 会話（下からせり上がるボトムシート） ---------- */
.talk-area {
  position: fixed; left: 0; right: 0; margin: 0 auto; width: min(420px, calc(100% - 16px));
  bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 18;
  max-height: 48vh; max-height: 48dvh; overflow-y: auto;
  background: #fff; border: 3px solid #ffe9a8; border-radius: 20px; padding: 12px;
  font-size: .92rem; line-height: 1.65; box-shadow: 0 12px 32px rgba(91, 58, 41, .35);
  animation: sheet-up .28s cubic-bezier(.2, 1.2, .4, 1);
}
.talk-area .choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.talk-area .choices button { padding: 9px 14px; background: #fff3bf; box-shadow: 0 3px 0 #ecd27e; }
.talk-area input[type="text"] {
  width: 100%; font-size: 1rem; padding: 10px; border-radius: 12px; border: 2.5px solid #ffe9a8;
  font-family: inherit; margin-top: 8px; color: #5b3a29;
}

/* ---------- ミッション ---------- */
.missions { display: flex; flex-direction: column; gap: 8px; }
.mission {
  display: flex; align-items: center; gap: 9px; background: rgba(255, 255, 255, .92);
  border-radius: 16px; padding: 9px 12px; border: 2px solid #e3f2d9;
}
.mission .m-icon { font-size: 1.3rem; flex: 0 0 auto; }
.mission .m-body { flex: 1; min-width: 0; }
.mission .m-label { font-size: .86rem; font-weight: bold; }
.mission .m-bar { height: 9px; background: #eef7e8; border-radius: 999px; overflow: hidden; margin-top: 4px; }
.mission .m-fill { height: 100%; background: linear-gradient(90deg, #8ede7e, #4cb944); border-radius: 999px; transition: width .4s; }
.mission .m-count { font-size: .74rem; color: #8aa583; font-weight: bold; flex: 0 0 auto; }
.mission .m-claim {
  flex: 0 0 auto; padding: 9px 12px; font-size: .8rem; color: #fff;
  background: linear-gradient(90deg, #ffb84d, #ff7a59); box-shadow: 0 3px 0 #d96f33;
  animation: cta-pulse 1.2s ease-in-out infinite;
}
.mission.done { opacity: .62; border-color: #e8e8e8; }
.mission.done .m-label { text-decoration: line-through; }

/* ---------- ログ ---------- */
.log {
  background: rgba(255, 255, 255, .8); border-radius: 16px; padding: 9px 12px;
  font-size: .78rem; line-height: 1.75; color: #7d5f4a;
  border: 2px solid #fdeeda;
}
.log .log-time { color: #c2a184; margin-right: 6px; font-size: .7rem; }

/* ---------- 下部タブバー ---------- */
#bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(420px, 100%); z-index: 8;
  display: flex; background: rgba(255, 255, 255, .97);
  border-top: 2.5px solid #ffe1ec; box-shadow: 0 -3px 14px rgba(200, 110, 140, .15);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0;
  background: transparent; box-shadow: none; border-radius: 14px; padding: 5px 0 3px;
  font-size: .72rem; color: #b39477;
}
.nav-btn .nav-icon { font-size: 1.35rem; line-height: 1.2; }
.nav-btn.active { background: #fff0f6; color: #d3547f; }
.nav-btn:active { transform: none; box-shadow: none; }

/* ---------- モーダル ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(91, 58, 41, .5); z-index: 20;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-box {
  background: #fffaf4; border-radius: 24px 24px 0 0; padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
  width: min(420px, 100%); max-height: 88vh; max-height: 88dvh; overflow-y: auto;
  animation: sheet-up .3s cubic-bezier(.2, 1.2, .4, 1);
}
@keyframes sheet-up { from { transform: translateY(46px); opacity: .4; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font-size: 1.12rem; }
.modal-close { background: #ffe9f3; box-shadow: 0 3px 0 #f3b8cf; font-size: 1rem; padding: 6px 12px; }
.tabs { display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap; }
.tab { padding: 8px 12px; font-size: .82rem; background: #fdf0e4; box-shadow: 0 3px 0 #ecd9bd; }
.tab.active { background: linear-gradient(90deg, #ff8fab, #ff6b9d); color: #fff; box-shadow: 0 3px 0 #d84f7e; }
.tab-page { font-size: .88rem; line-height: 1.75; }
.tab-page table { width: 100%; border-collapse: collapse; }
.tab-page th, .tab-page td { text-align: left; padding: 5px 6px; border-bottom: 1.5px dashed #f3ddc4; vertical-align: top; }
.tab-page th { color: #b3855e; font-weight: bold; width: 32%; font-size: .82rem; }
.tab-page .entry { border-bottom: 1.5px dashed #f3ddc4; padding: 7px 2px; }
.tab-page .entry .when { color: #c2a184; font-size: .74rem; }
.tab-page h3 { font-size: .95rem; color: #d3547f; margin: 14px 0 4px; }

/* ---------- ショップ ---------- */
.shop-balance { font-size: .95rem; background: #e8f7ff; border-radius: 12px; padding: 8px 12px; text-align: center; }
.shop-list { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }
.shop-item {
  display: flex; align-items: center; gap: 10px; background: #fff; border: 2.5px solid #ffe1ec;
  border-radius: 18px; padding: 10px 12px;
}
.shop-item .s-icon { font-size: 1.9rem; flex: 0 0 auto; }
.shop-item .s-body { flex: 1; min-width: 0; }
.shop-item .s-name { font-weight: bold; font-size: .95rem; }
.shop-item .s-desc { font-size: .75rem; color: #a07a5f; line-height: 1.5; }
.shop-item .s-own { font-size: .72rem; color: #d3547f; font-weight: bold; }
.shop-item .s-buy {
  flex: 0 0 auto; padding: 10px 12px; font-size: .82rem; color: #fff;
  background: linear-gradient(90deg, #ffb84d, #ff7a59); box-shadow: 0 3px 0 #d96f33;
}

/* ---------- トースト ---------- */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 30;
  background: #5b3a29; color: #fff; font-weight: bold; font-size: .9rem;
  padding: 11px 18px; border-radius: 999px; box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
  animation: toast-in .3s cubic-bezier(.2, 1.6, .4, 1); max-width: 88vw; text-align: center;
}
@keyframes toast-in { from { transform: translateX(-50%) translateY(16px) scale(.9); opacity: 0; } to { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; } }
.levelup-fx {
  position: fixed; inset: 0; pointer-events: none; z-index: 25; overflow: hidden;
}

/* ---------- 出会い動画オーバーレイ ---------- */
.video-overlay {
  position: fixed; inset: 0; z-index: 40; background: #2b1a12;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; animation: video-overlay-in .35s ease;
}
@keyframes video-overlay-in { from { opacity: 0; } to { opacity: 1; } }
.video-overlay-player {
  width: 100%; height: 100%; object-fit: contain; background: #2b1a12;
}
.video-overlay-caption {
  position: absolute; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom));
  text-align: center; color: #fff; font-weight: bold; font-size: 1.02rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .65); padding: 0 16px; pointer-events: none;
}
.video-overlay-skip {
  position: absolute; right: 14px; bottom: calc(18px + env(safe-area-inset-bottom));
  color: rgba(255, 255, 255, .85); font-size: .8rem; font-weight: bold;
  background: rgba(0, 0, 0, .35); padding: 7px 13px; border-radius: 999px; pointer-events: none;
}
.levelup-fx .fx-item { font-size: 1.8rem; }

/* ---------- 背の低いスマホ向けの圧縮（iPhone SE級でも1画面に収める） ---------- */
@media (max-height: 740px) {
  #screen-main { gap: 4px; }
  .hud { padding: 7px 10px; }
  .toy-chip { padding: 5px 11px; font-size: .76rem; }
  .litter-box { width: 78px; }
  .room { min-height: 84px; }
  .hint { display: none; }
  .param .p-bar { height: 11px; }
  .act { padding: 7px 2px 6px; }
  .act-icon { font-size: 1.28rem; }
  .health-alert { padding: 9px 11px; font-size: .84rem; }
  .health-alert button { margin-top: 6px; padding: 8px 12px; }
}
@media (max-height: 620px) {
  .clock { display: none; }
  .xp-text { display: none; }
  .cat-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 230px; }
  .mood-meter { margin-top: 4px; }
  .room { min-height: 68px; }
  .params { gap: 4px 10px; }
  .act { font-size: .72rem; padding: 6px 1px 5px; border-radius: 15px; }
  .act-icon { font-size: 1.12rem; }
  .health-alert { font-size: .8rem; line-height: 1.55; }
}
