/* =========================================================
   ゆーすけと、ふたりぐらし。 — hand-drawn paper theme
   ========================================================= */
:root {
  --paper: #f6eedf;
  --paper-2: #fffaf0;
  --paper-3: #efe3cd;
  --ink: #4a4038;
  --ink-soft: #7d6c5d;
  --ink-faint: #b3a38f;
  --pink: #e58fa2;
  --pink-deep: #c25d75;
  --pink-soft: #f6d7de;
  --mustard: #dfae57;
  --mustard-soft: #f3e0b8;
  --sage: #8fae94;
  --sage-soft: #dce8d8;
  --sky: #a9c8d9;
  --coral: #dd7a6d;
  --wood: #d9b98d;
  --wood-dark: #b8916a;
  --shadow: rgba(74, 64, 56, 0.18);
  --font-body: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  --font-hand: "Klee One", "Yomogi", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}
/* 紙のざらつき */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4000;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}
button { font-family: inherit; color: inherit; border: none; background: none; cursor: pointer; }
img { -webkit-user-drag: none; }
.hidden { display: none !important; }

#app { position: fixed; inset: 0; overflow: hidden; }
.screen { position: absolute; inset: 0; }

/* ================= タイトル ================= */
.title-screen {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 80% at 70% 10%, #fff8ea 0%, rgba(255, 248, 234, 0) 60%),
    var(--paper);
}
.t-room {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #f3e6cf 0%, #f7eddc 70%, #f2e5cd 100%);
}
.t-room-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 32%;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.t-room-img.ready { opacity: 1; }
.t-light {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 50% at 26% 30%, rgba(255, 236, 190, 0.5), rgba(255, 236, 190, 0) 70%),
    linear-gradient(180deg, rgba(255, 250, 240, 0.12) 0%, rgba(255, 250, 240, 0) 40%, rgba(246, 238, 223, 0.9) 96%);
  pointer-events: none;
}
.t-char {
  position: absolute;
  right: -5%;
  bottom: -4%;
  height: 82%;
  max-width: 78%;
  display: flex;
  align-items: flex-end;
  filter: drop-shadow(0 10px 14px rgba(74, 64, 56, 0.16));
  animation: titleFloat 6s ease-in-out infinite;
}
.t-char img { height: 100%; width: 100%; object-fit: cover; object-position: 50% 0%; }
@keyframes titleFloat {
  0%, 100% { transform: translateY(0) rotate(0.2deg); }
  50% { transform: translateY(-6px) rotate(-0.3deg); }
}
.t-logo {
  position: absolute;
  left: 12px;
  top: calc(var(--safe-top) + 16px);
  transform: rotate(-2.2deg);
  max-width: 80%;
  pointer-events: none;
  padding: 8px 26px 10px 10px;
  background: linear-gradient(100deg, rgba(255, 250, 240, 0.95) 0%, rgba(255, 250, 240, 0.8) 58%, rgba(255, 250, 240, 0) 100%);
  border-radius: 6px 16px 10px 4px;
}
.t-kicker {
  margin: 0 0 6px;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  background: rgba(255, 250, 240, 0.86);
  display: inline-block;
  padding: 3px 9px;
  border-radius: 3px 8px 4px 7px;
  border: 1.4px solid rgba(74, 64, 56, 0.5);
}
.t-title {
  margin: 0;
  font-family: var(--font-hand);
  font-size: clamp(30px, 9.4vw, 38px);
  line-height: 1.22;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-shadow: 2px 2px 0 rgba(255, 250, 240, 0.9);
}
.t-title span { color: var(--pink-deep); }
.t-underline { width: 88%; height: 12px; margin-top: 2px; color: var(--pink); overflow: visible; }

.t-sheet {
  position: relative;
  flex: 0 0 auto;
  margin: -30px 10px calc(8px + var(--safe-bottom));
  padding: 16px 15px 11px;
  background: linear-gradient(180deg, #fffdf6 0%, #fffaf0 100%);
  border: 2.4px solid var(--ink);
  border-radius: 16px 12px 18px 11px / 12px 17px 11px 16px;
  box-shadow: 0 6px 0 rgba(74, 64, 56, 0.12), 0 14px 26px rgba(74, 64, 56, 0.12);
  transform: rotate(-0.5deg);
  z-index: 3;
}
.tape {
  position: absolute;
  width: 64px;
  height: 20px;
  background: rgba(240, 208, 154, 0.62);
  border-left: 1px dashed rgba(255, 255, 255, 0.7);
  border-right: 1px dashed rgba(255, 255, 255, 0.7);
  box-shadow: 0 1px 2px rgba(74, 64, 56, 0.12);
}
.tape-a { left: 18px; top: -11px; transform: rotate(-5deg); }
.tape-b { right: 22px; top: -10px; transform: rotate(4deg); width: 48px; }
.t-story {
  margin: 4px 0 8px;
  font-size: 12.3px;
  line-height: 1.72;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.t-story p { margin: 0 0 2px; }
.t-gender { margin-top: 6px; }
.t-gender-lead {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  text-align: center;
}
.gender-row { display: flex; gap: 10px; justify-content: center; }
.gender-btn {
  position: relative;
  flex: 1 1 0;
  max-width: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 8px;
  background: var(--paper-2);
  border: 2.2px solid var(--ink);
  border-radius: 11px 8px 12px 7px / 8px 12px 7px 11px;
  box-shadow: 2px 3px 0 rgba(74, 64, 56, 0.14);
  transition: transform 0.12s ease, background 0.2s ease;
}
.gender-btn:nth-child(1) { transform: rotate(-1.6deg); }
.gender-btn:nth-child(2) { transform: rotate(1.4deg); }
.gender-btn:active { transform: scale(0.96) rotate(0deg); }
.g-stamp {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  border: 1.8px dashed var(--ink-faint);
  border-radius: 50%;
  transition: all 0.2s ease;
}
.g-label { font-size: 14px; font-weight: 700; letter-spacing: 0.04em; }
.gender-btn[aria-pressed="true"] { background: var(--pink-soft); box-shadow: 2px 3px 0 rgba(194, 93, 117, 0.28); }
.gender-btn[data-gender="father"][aria-pressed="true"] { background: var(--sage-soft); box-shadow: 2px 3px 0 rgba(110, 140, 115, 0.3); }
.gender-btn[aria-pressed="true"] .g-stamp {
  color: #fff;
  background: var(--pink-deep);
  border: 1.8px solid var(--pink-deep);
  transform: rotate(-8deg) scale(1.05);
}
.gender-btn[data-gender="father"][aria-pressed="true"] .g-stamp { background: #6f8f77; border-color: #6f8f77; }
.gender-btn[aria-pressed="true"] .g-label { color: var(--pink-deep); }
.gender-btn[data-gender="father"][aria-pressed="true"] .g-label { color: #5c7a63; }

.start-btn {
  width: 100%;
  margin-top: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: var(--mustard-soft);
  border: 2.4px solid var(--ink);
  border-radius: 14px 10px 15px 9px / 10px 15px 9px 14px;
  box-shadow: 3px 4px 0 rgba(74, 64, 56, 0.18);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.start-btn:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 rgba(74, 64, 56, 0.18); }
.start-btn[disabled] { opacity: 0.55; background: var(--paper-3); }
.sb-main { font-size: 16px; font-weight: 800; letter-spacing: 0.16em; }
.sb-sub { font-size: 9.5px; color: var(--ink-soft); letter-spacing: 0.04em; }
.start-btn:not([disabled]) .sb-main::after { content: " →"; }
.t-note { margin: 8px 0 0; text-align: center; font-size: 9.5px; color: var(--ink-faint); letter-spacing: 0.03em; }

.sound-fab {
  position: absolute;
  right: 12px;
  top: calc(var(--safe-top) + 12px);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: rgba(255, 250, 240, 0.9);
  border: 2px solid var(--ink);
  border-radius: 50% 46% 50% 44% / 46% 50% 44% 50%;
  box-shadow: 1px 2px 0 rgba(74, 64, 56, 0.16);
  z-index: 5;
}
.sound-fab .sf-icon { font-size: 17px; font-weight: 700; }
.sound-fab.muted .sf-icon { opacity: 0.35; text-decoration: line-through; }

/* ================= ゲーム画面 ================= */
.game-screen { display: flex; flex-direction: column; background: var(--paper); }

/* 最上部バー */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: calc(var(--safe-top) + 5px) 7px 4px;
  background: linear-gradient(180deg, rgba(255, 252, 244, 0.92), rgba(255, 252, 244, 0));
  z-index: 30;
}
.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 6px 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--paper-2);
  border: 1.9px solid var(--ink);
  border-radius: 9px 7px 10px 6px / 7px 10px 6px 9px;
  box-shadow: 1.5px 2px 0 rgba(74, 64, 56, 0.14);
  white-space: nowrap;
}
.tb-btn:active { transform: translate(1px, 2px); box-shadow: 0 0 0 rgba(74, 64, 56, 0.14); }
.tb-ico { width: 14px; height: 14px; }
.tb-profile { padding-left: 6px; }
.clock-wrap { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.clock {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-family: var(--font-hand);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(255, 250, 240, 0.86);
  border: 1.6px dashed rgba(74, 64, 56, 0.45);
  border-radius: 7px 10px 6px 9px;
  padding: 1px 9px;
}
#dayLabel { font-size: 10px; color: var(--ink-soft); }
.pause-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--ink-soft);
  background: rgba(255, 250, 240, 0.7);
  border: 1.4px solid rgba(74, 64, 56, 0.45);
  border-radius: 999px;
}
.pause-btn[aria-pressed="true"] { background: var(--mustard-soft); color: var(--ink); border-style: solid; }
.save-load { display: flex; gap: 4px; }
.save-load .tb-btn { padding: 6px 7px; font-size: 10px; }
.sound-mini {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 250, 240, 0.85);
  border: 1.6px solid rgba(74, 64, 56, 0.55);
  border-radius: 50% 44% 50% 46%;
}
.sound-mini.muted { opacity: 0.5; }
.sound-mini.muted .sm-icon { text-decoration: line-through; }

/* シーン */
.scene {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(90% 60% at 70% 8%, rgba(255, 247, 228, 0.9), rgba(255, 247, 228, 0) 70%),
    linear-gradient(180deg, #f7ecd6 0%, #f8f0e0 55%, #f3e8d4 100%);
  transition: background 1.2s ease;
}
.room-bg {
  position: absolute;
  inset: 0 0 auto;
  height: 100%;
  background-position: center 42%;
  background-size: cover;
  opacity: 0.30;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 72%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 72%, transparent 100%);
  filter: saturate(0.85);
  pointer-events: none;
}
.wall { position: absolute; inset: 0; pointer-events: none; }
.doodle { position: absolute; color: rgba(194, 93, 117, 0.22); font-size: 18px; transform: rotate(-8deg); }
.d1 { left: 7%; top: 18%; }
.d2 { right: 12%; top: 34%; transform: rotate(10deg); color: rgba(223, 174, 87, 0.28); }
.d3 { left: 12%; top: 52%; transform: rotate(6deg); color: rgba(110, 140, 115, 0.26); }
.d4 { right: 6%; top: 58%; transform: rotate(-12deg); }
.sky-orb {
  position: absolute;
  right: 12%;
  top: 6%;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0.9;
}
.orb-core {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3c4, #f4cf7d 70%, rgba(244, 207, 125, 0));
  animation: orbPulse 7s ease-in-out infinite;
}
@keyframes orbPulse { 0%,100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.08); opacity: 1; } }
.scene[data-sky="evening"] .orb-core { background: radial-gradient(circle at 35% 35%, #ffd9a8, #e9a15f 70%, rgba(233, 161, 95, 0)); }
.scene[data-sky="night"] .orb-core { background: radial-gradient(circle at 35% 35%, #e8ecff, #aeb8e8 70%, rgba(174, 184, 232, 0)); }
.scene[data-sky="night"] { background: linear-gradient(180deg, #e2dfea 0%, #efe9de 60%, #efe6d6 100%); }
.scene[data-sky="evening"] { background: linear-gradient(180deg, #f8e6cf 0%, #f8eedd 60%, #f3e7d3 100%); }

/* キャラクター */
.char-stage {
  position: absolute;
  left: 0;
  right: 0;
  top: 4px;
  bottom: 0;
  z-index: 2;
  pointer-events: none;
}
.char-pos {
  position: absolute;
  left: 50%;
  bottom: -12px;
  height: 103%;
  width: 92%;
  max-width: 400px;
  transform: translateX(-50%) translateY(var(--pose-y, 0px)) rotate(var(--pose-r, 0deg)) scale(var(--pose-s, 1));
  transform-origin: 50% 100%;
  transition: transform 0.55s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.char-breathe {
  position: absolute;
  inset: 0;
  transform-origin: 50% 100%;
  animation: breathe 4.2s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(-2.5px) scaleY(1.006); }
}
.char-glow {
  position: absolute;
  bottom: 2%;
  left: 50%;
  width: 74%;
  height: 62%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.85) 0%, rgba(255, 247, 236, 0.45) 55%, rgba(255, 247, 236, 0) 72%);
}
.char-img {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: bottom center;
  opacity: 0;
  transition: opacity 0.3s ease;
  filter: none;
  -webkit-user-drag: none;
}
.char-img.show { opacity: 1; }
.char-fx {
  position: absolute;
  left: 50%;
  bottom: 0;
  height: 100%;
  aspect-ratio: 3 / 4;
  max-height: 100%;
  transform: translateX(-50%);
  pointer-events: none;
}
/* 頬染め */
.char-fx.blush::before, .char-fx.blush::after {
  content: "";
  position: absolute;
  top: 30.5%;
  width: 7%;
  height: 2.6%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 120, 150, 0.6), rgba(240, 120, 150, 0));
  animation: blushIn 0.4s ease both;
}
.char-fx.blush::before { left: 39.5%; }
.char-fx.blush::after { right: 39.5%; }
@keyframes blushIn { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
.char-fx.sweat::before {
  content: "";
  position: absolute;
  top: 21%;
  right: 25%;
  width: 9px;
  height: 13px;
  border-radius: 60% 40% 55% 45%;
  background: #bfe6f7;
  border: 1.4px solid #7fb8d4;
  transform: rotate(12deg);
  animation: sweatDrop 1.2s ease-in-out infinite;
}
@keyframes sweatDrop {
  0%, 100% { transform: translateY(0) rotate(12deg); opacity: 0.9; }
  50% { transform: translateY(6px) rotate(12deg); opacity: 1; }
}
.char-fx.tears::before, .char-fx.tears::after {
  content: "";
  position: absolute;
  top: 27%;
  width: 8px;
  height: 17px;
  border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%;
  background: linear-gradient(180deg, #cfeaf9, #9fd2ee);
  animation: tearFall 1.5s linear infinite;
}
.char-fx.tears::before { left: 41.5%; }
.char-fx.tears::after { right: 41.5%; animation-delay: 0.5s; }
@keyframes tearFall {
  0% { transform: translateY(0); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(26px); opacity: 0; }
}
.char-stage.tremble .char-pos { animation: tremble 0.36s linear; }
@keyframes tremble {
  0%, 100% { transform: translateX(-50%) translateY(var(--pose-y, 0px)) rotate(var(--pose-r, 0deg)) scale(var(--pose-s, 1)); }
  20% { transform: translateX(calc(-50% - 4px)) translateY(var(--pose-y, 0px)) rotate(var(--pose-r, 0deg)) scale(var(--pose-s, 1)); }
  40% { transform: translateX(calc(-50% + 4px)) translateY(var(--pose-y, 0px)) rotate(var(--pose-r, 0deg)) scale(var(--pose-s, 1)); }
  60% { transform: translateX(calc(-50% - 3px)) translateY(var(--pose-y, 0px)) rotate(var(--pose-r, 0deg)) scale(var(--pose-s, 1)); }
  80% { transform: translateX(calc(-50% + 2px)) translateY(var(--pose-y, 0px)) rotate(var(--pose-r, 0deg)) scale(var(--pose-s, 1)); }
}
.char-stage.hop .char-pos { animation: hop 0.6s ease; }
@keyframes hop {
  0%, 100% { transform: translateX(-50%) translateY(var(--pose-y, 0px)) rotate(var(--pose-r, 0deg)) scale(var(--pose-s, 1)); }
  30% { transform: translateX(-50%) translateY(calc(var(--pose-y, 0px) - 12px)) rotate(var(--pose-r, 0deg)) scale(var(--pose-s, 1)); }
  60% { transform: translateX(-50%) translateY(var(--pose-y, 0px)) rotate(var(--pose-r, 0deg)) scale(var(--pose-s, 1)); }
  76% { transform: translateX(-50%) translateY(calc(var(--pose-y, 0px) - 4px)) rotate(var(--pose-r, 0deg)) scale(var(--pose-s, 1)); }
}
/* ポーズ */
.char-stage[data-pose="down"] .char-pos { --pose-y: 12px; --pose-s: 0.982; --pose-r: -0.6deg; }
.char-stage[data-pose="shrink"] .char-pos { --pose-y: 7px; --pose-s: 0.958; }
.char-stage[data-pose="lean"] .char-pos { --pose-y: -7px; --pose-s: 1.045; }
.char-stage[data-pose="fidget"] .char-pos { --pose-r: -1.3deg; --pose-y: 2px; }
.char-stage[data-pose="sleep"] .char-pos { --pose-y: 6px; --pose-s: 0.99; }

/* Zzz */
.zzz {
  position: absolute;
  top: 12%;
  right: 22%;
  display: none;
  flex-direction: column;
  align-items: flex-start;
  font-weight: 800;
  color: #6a6f9b;
}
.zzz.on { display: flex; }
.zzz span { font-size: 13px; animation: zfloat 2.4s ease-in-out infinite; opacity: 0; }
.zzz span:nth-child(2) { margin-left: 8px; font-size: 16px; animation-delay: 0.6s; }
.zzz span:nth-child(3) { margin-left: 18px; font-size: 20px; animation-delay: 1.2s; }
@keyframes zfloat {
  0% { transform: translate(0, 6px) rotate(-8deg); opacity: 0; }
  30% { opacity: 0.9; }
  100% { transform: translate(8px, -22px) rotate(8deg); opacity: 0; }
}

/* ---------- 食事パネル ---------- */
.meal-panel {
  position: absolute;
  left: 7px;
  top: 7px;
  width: 114px;
  padding: 9px 8px 8px;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 10px 7px 11px 6px / 7px 11px 6px 10px;
  box-shadow: 2px 3px 0 rgba(74, 64, 56, 0.13);
  transform: rotate(-1.6deg);
  z-index: 6;
}
.tape-meal { left: 24px; top: -10px; width: 52px; height: 17px; transform: rotate(-3deg); }
.meal-title {
  font-family: var(--font-hand);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  letter-spacing: 0.04em;
}
.meal-sub {
  margin: 5px 0 0;
  padding-top: 5px;
  border-top: 1.4px dashed rgba(74, 64, 56, 0.35);
  font-size: 9.5px;
  line-height: 1.45;
  color: var(--ink-soft);
  text-align: center;
}
.meal-choices { display: none; flex-direction: column; gap: 5px; margin-top: 7px; }
.meal-panel.active { width: 126px; background: #fffdf5; }
.meal-panel.active .meal-choices { display: flex; }
.meal-panel.active .meal-sub { display: none; }
.meal-panel.active .meal-title { font-size: 11.5px; color: var(--pink-deep); }
.meal-btn {
  padding: 6px 4px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--paper);
  border: 1.8px solid var(--ink);
  border-radius: 8px 6px 9px 5px / 6px 9px 5px 8px;
  box-shadow: 1px 2px 0 rgba(74, 64, 56, 0.14);
}
.meal-btn:active { transform: translate(1px, 2px); box-shadow: none; }
.meal-btn[data-meal="feed"] { background: var(--pink-soft); }
.meal-btn[data-meal="auto"] { background: var(--mustard-soft); }
.meal-panel.locked .meal-choices { display: none; }
.meal-panel.pulse { animation: mealPulse 1.2s ease-in-out infinite; }
@keyframes mealPulse {
  0%, 100% { box-shadow: 2px 3px 0 rgba(74, 64, 56, 0.13); }
  50% { box-shadow: 2px 3px 0 rgba(74, 64, 56, 0.13), 0 0 0 5px rgba(229, 143, 162, 0.28); }
}

/* ---------- ゲージ ---------- */
.gauges {
  position: absolute;
  right: 7px;
  top: 7px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 6;
}
.gauge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 4px;
  background: rgba(255, 250, 240, 0.92);
  border: 1.8px solid var(--ink);
  border-radius: 999px;
  box-shadow: 1px 2px 0 rgba(74, 64, 56, 0.1);
}
.g-ico { width: 17px; height: 17px; display: grid; place-items: center; }
.g-ico svg { width: 17px; height: 17px; }
.g-track {
  position: relative;
  width: 92px;
  height: 9px;
  background: #eadfcc;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(74, 64, 56, 0.18);
}
.g-fill, .g-ghost {
  position: absolute;
  z-index: 1;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: 999px;
  transform-origin: left center;
  transition: width 0.4s ease;
}
.g-ghost { background: rgba(255, 255, 255, 0.65); z-index: 0; transition: width 0.7s ease 0.15s; }
.hp .g-fill { background: linear-gradient(180deg, #f0917f, #dd7a6d); }
.aff .g-fill { background: linear-gradient(180deg, #f2a9bd, #e58fa2); }
.hun .g-fill { background: linear-gradient(180deg, #ecc57a, #dfae57); }
.g-fill::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 1.5px;
  height: 2px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.5);
}
.g-val {
  width: 24px;
  font-size: 9.5px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.gauge.flash { animation: gaugeFlash 0.5s ease; }
@keyframes gaugeFlash {
  0% { transform: scale(1); }
  40% { transform: scale(1.06); background: #fff; }
  100% { transform: scale(1); }
}
.gauge.low .g-val { color: var(--coral); }
.gauge.low { animation: lowBlink 1.6s ease-in-out infinite; }
@keyframes lowBlink { 0%,100% { border-color: var(--ink); } 50% { border-color: var(--coral); } }

/* ---------- セリフ ---------- */
.speech {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 34px;
  min-height: 80px;
  padding: 15px 28px 10px 14px;
  background: rgba(255, 253, 247, 0.97);
  border: 2.4px solid var(--ink);
  border-radius: 13px 9px 14px 8px / 9px 14px 8px 13px;
  box-shadow: 2px 3px 0 rgba(74, 64, 56, 0.14);
  z-index: 8;
}
.speech::after {
  content: "";
  position: absolute;
  right: 20px;
  bottom: -9px;
  width: 18px;
  height: 14px;
  background: rgba(255, 253, 247, 0.97);
  border-right: 2.4px solid var(--ink);
  border-bottom: 2.4px solid var(--ink);
  transform: skewX(-24deg) rotate(18deg);
  border-radius: 0 0 6px 0;
}
.speech-name {
  position: absolute;
  top: -12px;
  left: 12px;
  padding: 1px 11px;
  background: var(--pink);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  border: 2px solid var(--ink);
  border-radius: 999px 999px 999px 2px;
  letter-spacing: 0.08em;
  box-shadow: 1px 1px 0 rgba(74, 64, 56, 0.18);
}
.speech-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  min-height: 42px;
  white-space: pre-wrap;
  word-break: break-word;
}
.speech-next {
  position: absolute;
  right: 10px;
  bottom: 6px;
  font-size: 9px;
  color: var(--pink-deep);
  opacity: 0;
  animation: nextBlink 1.2s ease-in-out infinite;
}
.speech-next.on { opacity: 1; }
@keyframes nextBlink { 0%, 100% { transform: translateY(0); opacity: 0.4; } 50% { transform: translateY(2px); opacity: 1; } }
.speech.pop { animation: speechPop 0.28s ease; }
@keyframes speechPop { 0% { transform: scale(0.98); } 60% { transform: scale(1.008); } 100% { transform: scale(1); } }

/* ポーズ */
.pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  background: rgba(246, 238, 223, 0.55);
  backdrop-filter: blur(2px);
}
.pause-card {
  padding: 18px 30px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-align: center;
  background: var(--paper-2);
  border: 2.4px solid var(--ink);
  border-radius: 16px 12px 18px 11px;
  box-shadow: 3px 4px 0 rgba(74, 64, 56, 0.16);
  transform: rotate(-1.5deg);
}
.pause-card span { display: block; margin-top: 4px; font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; color: var(--ink-soft); }
.sleep-tint { position: absolute; inset: 0; z-index: 7; pointer-events: none; background: linear-gradient(180deg, rgba(90, 100, 150, 0.35), rgba(70, 80, 120, 0.22)); }

/* ---------- テーブル（前景の机：キャラはこの机の後ろに立つ） ---------- */
.table-area {
  position: relative;
  flex: 0 0 auto;
  height: 112px;
  margin-top: -40px;
  overflow: hidden;
  background: #d9b98d;
  border-top: 2.4px solid var(--ink);
  box-shadow: 0 -10px 18px rgba(74, 56, 40, 0.18);
}
.table-wood {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(120, 90, 60, 0.06) 0 2px, rgba(120, 90, 60, 0) 2px 34px),
    linear-gradient(180deg, #dcbd93 0%, #cfa87a 100%);
}
.table-edge { position: absolute; left: 0; right: 0; top: 0; height: 9px; background: linear-gradient(180deg, #c9a276, #b8916a); box-shadow: inset 0 2px 0 rgba(255, 246, 226, 0.45); }
.tabletop { position: absolute; inset: 8px 0 0; }
.plate { position: absolute; left: 50%; bottom: 8px; width: 128px; height: 56px; transform: translateX(-50%); }
.plate-rim {
  position: absolute;
  inset: 0;
  background: #fffdf7;
  border: 2.6px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 3px 0 rgba(74, 64, 56, 0.14), inset 0 -6px 0 rgba(74, 64, 56, 0.06);
}
.food-wrap { position: absolute; left: 50%; bottom: 12px; width: 104px; height: 64px; transform: translateX(-50%); opacity: 0; }
.food-wrap.eaten { opacity: 1; }
.food-svg { width: 100%; height: 100%; display: block; }
.bread { position: absolute; left: calc(50% + 40px); bottom: 16px; width: 54px; height: 38px; opacity: 0; }
.bread.eaten { opacity: 1; }
.rice { position: absolute; left: calc(50% - 104px); bottom: 18px; width: 48px; height: 38px; opacity: 0; }
.rice.eaten { opacity: 1; }
.cup { position: absolute; right: 14px; bottom: 14px; width: 42px; height: 42px; opacity: 0.9; }
.plant { position: absolute; left: 10px; bottom: 4px; width: 46px; height: 56px; }
.eat-spark {
  position: absolute;
  left: 50%;
  bottom: 74px;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 700;
  color: var(--pink-deep);
  opacity: 0;
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
}
.eat-spark.on { animation: sparkUp 1.3s ease forwards; }
@keyframes sparkUp {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.8); }
  25% { opacity: 1; transform: translate(-50%, -2px) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -10px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -18px) scale(1); }
}
.table-area.eating .plate { animation: plateBounce 0.6s ease; }
@keyframes plateBounce { 0%,100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.04); } }

/* ---------- お世話アクション ---------- */
.care-row {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 9px;
  padding: 3px 8px 2px;
  background: linear-gradient(180deg, #f1e4cd, #f4ead8);
}
.care-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px 5px 8px;
  background: var(--paper-2);
  border: 1.9px solid var(--ink);
  border-radius: 999px 999px 999px 8px;
  box-shadow: 1.5px 2px 0 rgba(74, 64, 56, 0.13);
  font-size: 11px;
  font-weight: 700;
  transition: transform 0.1s ease;
}
.care-chip:nth-child(1) { transform: rotate(-1.2deg); }
.care-chip:nth-child(2) { transform: rotate(0.6deg); }
.care-chip:nth-child(3) { transform: rotate(-0.5deg); }
.care-chip:active { transform: scale(0.94); }
.care-chip.cool { opacity: 0.45; }
.care-ico { width: 18px; height: 18px; display: grid; place-items: center; }
.care-ico svg { width: 18px; height: 18px; }
.care-label { letter-spacing: 0.04em; }
.care-chip[data-care="talk"] { background: #eef4f6; }
.care-chip[data-care="praise"] { background: #fdf2d8; }
.care-chip[data-care="snack"] { background: #fbe9e6; }

/* ---------- コマンド ---------- */
.commands {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 4px;
  padding: 5px 9px calc(5px + var(--safe-bottom));
  background: linear-gradient(180deg, #f4ead8 0%, #f7efe1 100%);
  border-top: 1.6px dashed rgba(74, 64, 56, 0.25);
}
.cmd {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  max-width: 74px;
  transition: transform 0.1s ease;
}
.cmd:active { transform: scale(0.93); }
.cmd-circle {
  position: relative;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  background: var(--paper-2);
  border: 2.3px solid var(--ink);
  border-radius: 48% 52% 50% 50% / 52% 48% 52% 48%;
  box-shadow: 2px 3px 0 rgba(74, 64, 56, 0.16);
}
.cmd-circle::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1.2px dashed rgba(74, 64, 56, 0.22);
  pointer-events: none;
}
.cmd-circle svg { width: 32px; height: 32px; }
.c-hit { background: #fbe6e1; }
.c-nade { background: #fdf3d9; }
.c-game { background: #e8f2f5; }
.c-dress { background: #eef0dd; }
.c-maid { background: #f3e6ef; }
.cmd-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0 4px;
  background: rgba(255, 250, 240, 0.7);
  border-radius: 4px;
}
.cmd:disabled { opacity: 0.45; }
.commands.locked .cmd { pointer-events: none; opacity: 0.4; filter: grayscale(0.5); }
#gameScreen.locked .care-row { opacity: 0.3; filter: grayscale(0.6); pointer-events: none; }
.cmd .cmd-circle .lock-dot { display: none; }

/* スキップ */
.skip-btn {
  position: fixed;
  right: 12px;
  bottom: calc(188px + var(--safe-bottom));
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 15px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: #fff7e0;
  border: 2.2px solid var(--ink);
  border-radius: 12px 9px 13px 8px;
  box-shadow: 2px 3px 0 rgba(74, 64, 56, 0.18);
  animation: skipFloat 2.6s ease-in-out infinite;
}
.skip-arrow { color: var(--pink-deep); letter-spacing: -0.05em; }
@keyframes skipFloat { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-3px) rotate(0.5deg); } }

/* メイドロック */
.lock-badge {
  position: fixed;
  left: 50%;
  bottom: calc(134px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 25;
  padding: 5px 12px;
  font-size: 10.5px;
  font-weight: 700;
  background: var(--pink-soft);
  border: 1.8px solid var(--ink);
  border-radius: 999px;
}
.lock-badge b { color: var(--pink-deep); font-size: 12px; }

/* トースト */
.toast {
  position: fixed;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%) rotate(-1deg);
  z-index: 60;
  max-width: 80%;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 10px 8px 11px 7px;
  box-shadow: 2px 3px 0 rgba(74, 64, 56, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.toast.show { opacity: 1; }

/* ---------- バッドエンド ---------- */
.badend {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(90% 70% at 50% 40%, #3a302c 0%, #241d1a 70%, #1a1513 100%);
  color: #f6e9da;
}
.badend-inner { width: 100%; max-width: 360px; padding: 20px; text-align: center; }
.badend-label { font-size: 10px; letter-spacing: 0.5em; color: #d99a8f; }
.badend-title { margin: 2px 0 8px; font-family: var(--font-hand); font-size: 40px; letter-spacing: 0.18em; color: #f2b3a4; text-shadow: 0 0 18px rgba(242, 179, 164, 0.35); }
.badend-char { height: 210px; display: flex; justify-content: center; }
.badend-char img { height: 100%; filter: grayscale(0.7) brightness(0.85); }
.badend-text { font-size: 13px; line-height: 1.8; white-space: pre-line; color: #efe2d3; }
.badend-note { margin-top: 8px; font-size: 9.5px; color: #a08e7f; }

/* ボタン共通 */
.primary-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 26px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: #f2c0a8;
  color: #3a2c26;
  border: 2.2px solid #f6e9da;
  border-radius: 12px 9px 13px 8px;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.35);
}
.primary-btn:active { transform: translate(1px, 2px); box-shadow: none; }

/* ---------- モーダル ---------- */
.modal-root { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(58, 48, 42, 0.38); backdrop-filter: blur(2px); }
.modal-panel {
  position: relative;
  width: 100%;
  max-width: 360px;
  max-height: 82vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px 14px;
  background: var(--paper-2);
  border: 2.4px solid var(--ink);
  border-radius: 16px 12px 18px 11px / 12px 17px 11px 16px;
  box-shadow: 4px 6px 0 rgba(74, 64, 56, 0.18), 0 18px 30px rgba(74, 64, 56, 0.18);
  transform: rotate(-0.4deg);
  animation: modalIn 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) rotate(-0.4deg) scale(0.97); } to { opacity: 1; transform: translateY(0) rotate(-0.4deg) scale(1); } }
.modal-title {
  margin: 0 0 4px;
  font-family: var(--font-hand);
  font-size: 19px;
  letter-spacing: 0.06em;
  text-align: center;
}
.modal-sub { margin: 0 0 10px; font-size: 10.5px; color: var(--ink-soft); text-align: center; letter-spacing: 0.03em; }
.modal-close {
  position: absolute;
  right: 8px;
  top: 6px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1.6px solid var(--ink-faint);
  border-radius: 50%;
}
.modal-actions { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.btn {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 10px 8px 11px 7px;
  box-shadow: 1.5px 2px 0 rgba(74, 64, 56, 0.15);
}
.btn:active { transform: translate(1px, 2px); box-shadow: none; }
.btn.primary { background: var(--pink-soft); }
.btn.gold { background: var(--mustard-soft); }
.btn.wide { flex: 1; text-align: center; }

/* プロフィール */
.profile-top { display: flex; gap: 12px; align-items: center; }
.profile-face {
  width: 84px;
  height: 84px;
  flex: 0 0 auto;
  overflow: hidden;
  background: var(--pink-soft);
  border: 2.2px solid var(--ink);
  border-radius: 50% 48% 52% 50%;
}
.profile-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; transform: scale(1.15); }
.profile-name { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: 0.05em; }
.profile-kana { margin: 0 0 4px; font-size: 9.5px; color: var(--ink-faint); letter-spacing: 0.2em; }
.profile-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.p-tag { padding: 1px 8px; font-size: 10px; font-weight: 700; background: var(--paper); border: 1.4px solid var(--ink-faint); border-radius: 999px; }
.profile-table { width: 100%; margin: 10px 0 6px; border-collapse: collapse; font-size: 11.5px; }
.profile-table th, .profile-table td { padding: 4px 6px; border-bottom: 1.2px dashed rgba(74, 64, 56, 0.25); text-align: left; }
.profile-table th { width: 34%; color: var(--ink-soft); font-weight: 700; }
.profile-bio { margin: 8px 0 0; font-size: 11.5px; line-height: 1.75; color: var(--ink); }
.profile-bio::before { content: "「"; color: var(--pink); }
.profile-bio::after { content: "」"; color: var(--pink); }
.profile-heart { margin-top: 8px; font-size: 10.5px; color: var(--pink-deep); text-align: center; }

/* セーブ/ロード */
.slot-list { display: flex; flex-direction: column; gap: 8px; }
.slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 11px 8px 12px 7px;
  box-shadow: 1.5px 2px 0 rgba(74, 64, 56, 0.12);
  text-align: left;
}
.slot:active { transform: translate(1px, 2px); }
.slot-no { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; font-size: 15px; font-weight: 800; background: var(--mustard-soft); border: 1.8px solid var(--ink); border-radius: 50%; }
.slot-body { flex: 1 1 auto; min-width: 0; }
.slot-title { font-size: 11.5px; font-weight: 700; }
.slot-meta { font-size: 9.5px; color: var(--ink-soft); }
.slot-empty { color: var(--ink-faint); font-size: 11px; }
.slot-del { padding: 4px 8px; font-size: 9.5px; color: var(--ink-soft); border: 1.4px solid var(--ink-faint); border-radius: 999px; }

/* きがえ */
.outfit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.outfit-card {
  position: relative;
  padding: 6px 6px 8px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px 9px 13px 8px;
  box-shadow: 1.5px 2px 0 rgba(74, 64, 56, 0.13);
  text-align: center;
}
.outfit-card:active { transform: scale(0.97); }
.outfit-card.current { background: var(--pink-soft); }
.outfit-card.current::after { content: "きている"; position: absolute; right: 5px; top: 5px; font-size: 8px; font-weight: 700; color: #fff; background: var(--pink-deep); padding: 1px 6px; border-radius: 99px; }
.outfit-thumb { height: 96px; display: flex; justify-content: center; overflow: hidden; }
.outfit-thumb img { height: 100%; width: auto; object-fit: contain; }
.outfit-name { font-size: 11.5px; font-weight: 700; }

/* はなす */
.talk-list { display: flex; flex-direction: column; gap: 8px; }
.talk-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px 9px 13px 8px;
  box-shadow: 1.5px 2px 0 rgba(74, 64, 56, 0.13);
}
.talk-btn:active { transform: translate(1px, 2px); }
.talk-btn .tb-mark { font-size: 15px; color: var(--pink-deep); }

/* 確認 */
.confirm-text { margin: 6px 0; font-size: 12.5px; line-height: 1.7; text-align: center; white-space: pre-line; }

/* ---------- ミニゲーム ---------- */
.ag-panel { text-align: center; }
.ag-badge { display: inline-block; padding: 1px 10px; font-size: 9px; font-weight: 700; letter-spacing: 0.16em; color: var(--pink-deep); border: 1.4px solid var(--pink-deep); border-radius: 999px; }
.ag-sub { margin: 4px 0 6px; font-size: 10.5px; line-height: 1.55; color: var(--ink-soft); }
.ag-score { display: flex; justify-content: center; gap: 10px; font-size: 10px; color: var(--ink-soft); margin-bottom: 6px; }
.ag-score b { color: var(--ink); }
.ag-stage {
  position: relative;
  height: 128px;
  margin: 4px 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: radial-gradient(60% 70% at 50% 45%, #fffdf6, rgba(255, 253, 246, 0) 75%);
}
.ag-hand {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  font-size: 40px;
  background: var(--paper);
  border: 2.2px solid var(--ink);
  border-radius: 50%;
  box-shadow: 2px 3px 0 rgba(74, 64, 56, 0.14);
  transition: transform 0.3s ease;
}
.ag-hand.pop { animation: handPop 0.45s cubic-bezier(0.34, 1.6, 0.64, 1); }
@keyframes handPop { 0% { transform: scale(0.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.ag-vs { font-size: 20px; font-weight: 800; color: var(--ink-faint); font-family: var(--font-hand); }
.ag-cpu {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  font-size: 40px;
  background: var(--pink-soft);
  border: 2.2px dashed rgba(74, 64, 56, 0.4);
  border-radius: 50%;
  color: var(--ink-soft);
  transition: transform 0.3s ease;
}
.ag-cpu.show { border-style: solid; background: #fff; animation: handPop 0.45s cubic-bezier(0.34, 1.6, 0.64, 1); }
.ag-cpu .ag-q { font-size: 26px; color: var(--ink-faint); }
.ag-dirs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 2px 0 4px; }
.ag-dir {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px 6px;
  font-size: 10px;
  font-weight: 700;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 11px 8px 12px 7px;
  box-shadow: 1.5px 2px 0 rgba(74, 64, 56, 0.14);
}
.ag-dir:active { transform: translate(1px, 2px); box-shadow: none; }
.ag-dir span { font-size: 22px; line-height: 1; }
.ag-dir:disabled { opacity: 0.4; }
.ag-dir.picked { background: var(--mustard-soft); border-width: 2.6px; }
.ag-result { min-height: 56px; margin: 6px 0 2px; display: flex; align-items: center; justify-content: center; }
.ag-stamp {
  display: inline-block;
  padding: 6px 18px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.12em;
  transform: rotate(-4deg);
  border: 3px solid currentColor;
  border-radius: 8px 5px 9px 4px;
  animation: stampIn 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.ag-stamp.win { color: var(--pink-deep); background: rgba(246, 215, 222, 0.6); }
.ag-stamp.lose { color: #5c7a63; background: rgba(220, 232, 216, 0.7); }
.ag-stamp.draw { color: var(--mustard); background: rgba(243, 224, 184, 0.7); }
@keyframes stampIn { 0% { transform: rotate(-4deg) scale(1.6); opacity: 0; } 70% { transform: rotate(-4deg) scale(0.96); opacity: 1; } 100% { transform: rotate(-4deg) scale(1); } }
.ag-line { min-height: 36px; margin: 4px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--ink); }
.ag-actions { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.ag-actions .btn { min-width: 96px; }

/* 小さめ画面 */
@media (max-height: 740px) {
  .cmd-circle { width: 56px; height: 56px; }
  .cmd-circle svg { width: 28px; height: 28px; }
  .cmd-label { font-size: 9.5px; }
  .table-area { height: 108px; }
  .care-row { padding: 2px 6px; }
  .care-chip { padding: 4px 10px 4px 6px; font-size: 10px; }
  .t-story { font-size: 11.4px; line-height: 1.6; }
  .t-sheet { padding: 13px 13px 9px; }
  .t-char { height: 82%; }
  .speech { min-height: 72px; padding: 13px 26px 8px 12px; }
  .speech-text { font-size: 12px; min-height: 38px; }
  .gauges { gap: 3px; }
  .g-track { width: 84px; }
}
@media (max-width: 350px) {
  .tb-profile span { display: none; }
  .save-load .tb-btn { padding: 6px 5px; }
  .g-track { width: 74px; }
  .cmd-circle { width: 54px; height: 54px; }
  .cmd-circle svg { width: 26px; height: 26px; }
}

/* ---------- 追加演出 ---------- */
.g-pop {
  position: absolute;
  right: 4px;
  top: -12px;
  font-size: 9.5px;
  font-weight: 800;
  pointer-events: none;
  animation: gPop 0.9s ease forwards;
}
.g-pop.up { color: #4f8f6a; }
.g-pop.down { color: var(--coral); }
@keyframes gPop {
  0% { opacity: 0; transform: translateY(4px) scale(0.8); }
  25% { opacity: 1; transform: translateY(-2px) scale(1); }
  100% { opacity: 0; transform: translateY(-14px) scale(1); }
}
.cmd.cool { pointer-events: none; }
.cmd.cool .cmd-circle { filter: grayscale(0.6); opacity: 0.6; }
.scene.shake { animation: sceneShake 0.4s ease; }
@keyframes sceneShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
.char-fx.hearts::before, .char-fx.hearts::after {
  content: "♥";
  position: absolute;
  top: 28%;
  font-size: 15px;
  color: #e58fa2;
  text-shadow: 0 0 6px rgba(229, 143, 162, 0.5);
  animation: heartFloat 1.9s ease-out infinite;
}
.char-fx.hearts::before { left: 26%; }
.char-fx.hearts::after { right: 26%; animation-delay: 0.5s; }
@keyframes heartFloat {
  0% { opacity: 0; transform: translateY(6px) scale(0.7); }
  25% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-26px) scale(1.1); }
}
.ag-face { position: absolute; left: 4px; top: 4px; width: 40px; height: 40px; overflow: hidden; border-radius: 50%; border: 1.8px solid var(--ink); background: var(--paper); }
.ag-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; transform: scale(1.2); }
.ag-panel { position: relative; }
.btn[disabled] { opacity: 0.45; }
.meal-panel.locked { opacity: 0.75; }


/* ================= フェーズ3: 紙の質感・揺れ・仕草・タップ ================= */
/* 紙の繊維をうっすら重ねる（既存ノイズと併用） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 3999;
  pointer-events: none;
  background-image: url("../assets/ui/paper.png");
  background-size: 160px 160px;
  opacity: 0.045;
  mix-blend-mode: multiply;
}

/* 常時のかすかな左右揺れ（呼吸とは別レイヤー） */
.char-sway {
  position: absolute;
  inset: 0;
  transform-origin: 50% 100%;
  animation: sway 9s ease-in-out infinite;
}
@keyframes sway {
  0%, 100% { transform: rotate(0deg) translateX(0); }
  25% { transform: rotate(-0.5deg) translateX(-1.5px); }
  50% { transform: rotate(0.2deg) translateX(0.5px); }
  75% { transform: rotate(0.55deg) translateX(1.5px); }
}

/* 喋っている間は小さく上下 */
.char-stage.talking .char-sway { animation: talkbob 0.9s ease-in-out infinite; }
@keyframes talkbob {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  30% { transform: rotate(-0.35deg) translateY(-1px); }
  60% { transform: rotate(0.3deg) translateY(0.5px); }
}
.char-stage.talking .char-breathe { animation-duration: 2.4s; }

/* 仕草 g1: 首をかしげる */
.char-stage.g1 .char-sway { animation: g1 1.7s ease-in-out; }
@keyframes g1 {
  0%, 100% { transform: rotate(0deg); }
  30% { transform: rotate(-2.2deg); }
  55% { transform: rotate(-1.4deg); }
  80% { transform: rotate(0.8deg); }
}
/* 仕草 g2: メガネを押さえるように少し沈む */
.char-stage.g2 .char-breathe { animation: g2 1.7s ease-in-out; }
@keyframes g2 {
  0%, 100% { transform: translateY(0) scaleY(1); }
  25% { transform: translateY(3px) scaleY(0.994); }
  50% { transform: translateY(1px) scaleY(1.002); }
  70% { transform: translateY(3.5px) scaleY(0.992); }
}
/* 仕草 g3: ふっと息を吐く */
.char-stage.g3 .char-sway { animation: g3 1.7s ease-in-out; }
@keyframes g3 {
  0%, 100% { transform: scaleY(1) translateY(0); }
  35% { transform: scaleY(1.012) translateY(-3px); }
  60% { transform: scaleY(0.996) translateY(1px); }
  80% { transform: scaleY(1.006) translateY(-1px); }
}

/* キャラをつつく透明なタップ領域（セリフ窓より下） */
.char-tap {
  position: absolute;
  left: 50%;
  bottom: 17%;
  width: min(62%, 250px);
  height: 42%;
  transform: translateX(-50%);
  background: transparent;
  border: 0;
  padding: 0;
  pointer-events: auto;
  z-index: 4;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.char-tap:active {
  background: radial-gradient(circle at 50% 40%, rgba(255, 236, 220, 0.22), transparent 70%);
}

/* 舞う光の粒 */
.motes { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.motes span {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 245, 214, 0.95);
  box-shadow: 0 0 6px 2px rgba(255, 240, 200, 0.4);
  opacity: 0;
  animation: moteFloat 13s linear infinite;
}
.motes span:nth-child(1) { left: 10%; top: 34%; animation-delay: 0s; }
.motes span:nth-child(2) { left: 26%; top: 56%; animation-delay: 2.1s; width: 3px; height: 3px; }
.motes span:nth-child(3) { left: 44%; top: 26%; animation-delay: 4.4s; }
.motes span:nth-child(4) { left: 62%; top: 48%; animation-delay: 6.3s; width: 3px; height: 3px; }
.motes span:nth-child(5) { left: 78%; top: 30%; animation-delay: 8.8s; }
.motes span:nth-child(6) { left: 88%; top: 60%; animation-delay: 10.9s; width: 3px; height: 3px; }
@keyframes moteFloat {
  0% { opacity: 0; transform: translate(0, 0) scale(0.7); }
  15% { opacity: 0.75; }
  70% { opacity: 0.45; }
  100% { opacity: 0; transform: translate(18px, -110px) scale(1.1); }
}
.scene[data-sky="night"] .motes span { background: rgba(210, 222, 255, 0.95); box-shadow: 0 0 6px 2px rgba(200, 214, 255, 0.4); }

/* 食事イベント中のやわらかなスポットライト（食事枠を目立たせる） */
.meal-spot {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
  background: radial-gradient(circle at 20% 14%, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0) 16%, rgba(58, 47, 38, 0.22) 62%, rgba(58, 47, 38, 0.3) 100%);
}
.meal-spot.on { opacity: 1; animation: spotBreathe 3.4s ease-in-out infinite; }
@keyframes spotBreathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.82; }
}
.meal-panel.pulse { animation: mealNudge 1.2s ease; }
@keyframes mealNudge {
  0%, 100% { transform: rotate(-1.6deg) scale(1); }
  20% { transform: rotate(-2.4deg) scale(1.02); }
  45% { transform: rotate(-0.8deg) scale(1.03); }
  70% { transform: rotate(-2deg) scale(1.01); }
}

/* 声ボタン */
.voice-mini .vm-icon { font-size: 10px; font-weight: 700; letter-spacing: 0; }
.voice-mini.off { opacity: 0.45; }
.voice-mini.off .vm-icon { text-decoration: line-through; }

/* コマンドボタンに薄い鉛筆ハッチ */
.cmd-circle { position: relative; overflow: hidden; }
.cmd-circle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(74, 64, 56, 0.045) 0 1px, transparent 1px 4px);
}
.cmd-circle > * { position: relative; z-index: 1; }

/* 狭い画面ではトップバーを詰める */
@media (max-width: 400px) {
  .topbar { gap: 4px; padding-left: 5px; padding-right: 5px; }
  .tb-btn { padding: 5px 6px; font-size: 10px; }
  .tb-ico { width: 13px; height: 13px; }
  .save-load { gap: 3px; }
  .save-load .tb-btn { padding: 5px 6px; }
  .sound-mini { width: 24px; height: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .char-sway, .char-breathe, .motes span, .meal-spot.on { animation: none; }
}

/* フェーズ3: 手描き感の微調整 */
.sound-mini { position: relative; }
.sound-mini::before { content: ""; position: absolute; inset: -8px -1px; border-radius: 50%; }
.gauge:nth-child(1) { transform: rotate(-0.4deg); }
.gauge:nth-child(2) { transform: rotate(0.5deg); }
.gauge:nth-child(3) { transform: rotate(-0.25deg); }
.g-track {
  background-image: repeating-linear-gradient(135deg, rgba(74, 64, 56, 0.05) 0 1px, transparent 1px 5px);
}
.tb-btn {
  background-image: repeating-linear-gradient(135deg, rgba(74, 64, 56, 0.03) 0 1px, transparent 1px 5px);
}

/* ================= パーツ分けキャラクター（SVG） ================= */
.char-mount { position: absolute; inset: 0; }
.char-mount .ys-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ys-svg {
  --skin: #fbe7d6; --skin-shade: #f2c8ae; --ink: #5b463c;
  --fabric: #fbf3e2; --fabric-shade: #efe1c6; --trim: #d9cbb0;
  --gx: 0px; --gy: 0px; --blush: .16;
  --lsh: 9deg; --lel: -7deg; --rsh: 9deg; --rel: -7deg;
}
.ys-svg[data-outfit="pajama"] { --fabric: #dfe6f5; --fabric-shade: #ccd6ee; --trim: #b9c6e6; }
.ys-svg[data-outfit="china"] { --fabric: #b9483f; --fabric-shade: #a03a33; --trim: #e8c46a; }
.ys-svg[data-outfit="swim"] { --fabric: #35496e; --fabric-shade: #2b3c5c; --trim: #e9eef6; }
.ys-svg[data-outfit="maid"] { --fabric: #3e3a44; --fabric-shade: #322e37; --trim: #d9536a; }
.ys-svg[data-outfit="hoodie"] { --fabric: #b9cfd6; --fabric-shade: #a3bcc5; --trim: #f4f1e8; }
.ys-svg[data-outfit="knit"] { --fabric: #d9a94e; --fabric-shade: #c7963f; --trim: #b8862f; }
.ys-svg[data-outfit="yukata"] { --fabric: #4a5f8a; --fabric-shade: #3d5075; --trim: #f2ecdc; }

.ys-svg .neck, .ys-svg .face, .ys-svg .ear, .ys-svg .hand-skin,
.ys-svg .upper-skin, .ys-svg .elbow, .ys-svg .forearm { fill: var(--skin); }
.ys-svg .neck-shade { fill: var(--skin-shade); opacity: .5; }
.ys-svg .face-shade { fill: var(--skin-shade); opacity: .35; }
.ys-svg .shirt { fill: var(--fabric); }
.ys-svg .shirt-shade { fill: var(--fabric-shade); opacity: .55; }
.ys-svg .shirt-hatch { fill: url(#ysHatch); }
.ys-svg .neck-hole { fill: var(--skin); }
.ys-svg .sleeve, .ys-svg .fore-sleeve { fill: var(--fabric); }
.ys-svg .fore-sleeve { display: none; }
.ys-svg[data-sleeve="long"] .fore-sleeve { display: inline; }
.ys-svg[data-sleeve="long"] .forearm { fill: var(--fabric); }

.ys-svg .shirt, .ys-svg .neck, .ys-svg .face, .ys-svg .ear,
.ys-svg .sleeve, .ys-svg .fore-sleeve, .ys-svg .forearm, .ys-svg .hand-skin,
.ys-svg .upper-skin, .ys-svg .elbow {
  stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round;
}
.ys-svg .sleeve-hem, .ys-svg .cuff, .ys-svg .seam { fill: none; stroke: var(--trim); stroke-width: 3; stroke-linecap: round; }
.ys-svg .sleeve-in { fill: none; stroke: var(--fabric-shade); stroke-width: 3; stroke-linecap: round; opacity: .8; }
.ys-svg .collar { fill: none; stroke: var(--trim); stroke-width: 13; stroke-linecap: round; stroke-linejoin: round; }
.ys-svg .hand-line, .ys-svg .thumb { fill: none; stroke: #c99a7e; stroke-width: 2.4; stroke-linecap: round; }
.ys-svg .lid-line { fill: none; stroke: rgba(91, 70, 60, .28); stroke-width: 2.2; stroke-linecap: round; }
.ys-svg .elbow { stroke-width: 2.4; }

/* 髪 */
.ys-svg .hair-back, .ys-svg .hair-front { fill: url(#ysHair); stroke: #4a3a30; stroke-width: 3; stroke-linejoin: round; }
.ys-svg .hair-shine { fill: #9b8070; opacity: .35; }
.ys-svg .ahoge-line { fill: none; stroke: #5d463a; stroke-width: 7; stroke-linecap: round; }
.ys-svg .ahoge { transform-box: view-box; transform-origin: 298px 112px; animation: ysAhoge 3.8s ease-in-out infinite; }
@keyframes ysAhoge {
  0%, 100% { transform: rotate(0deg); }
  35% { transform: rotate(-7deg); }
  60% { transform: rotate(3deg); }
  80% { transform: rotate(-2deg); }
}

/* 目 */
.ys-svg .eye { display: none; }
.ys-svg[data-eye="open"] .eye-open,
.ys-svg[data-eye="half"] .eye-open { display: inline; }
.ys-svg[data-eye="closed"] .eye-closed { display: inline; }
.ys-svg[data-eye="happy"] .eye-happy { display: inline; }
.ys-svg .eye-white { fill: #fffdf8; }
.ys-svg .lash { fill: none; stroke: #43332a; stroke-width: 6; stroke-linecap: round; }
.ys-svg .lash.thin { stroke-width: 3.5; }
.ys-svg .pupil { fill: #38251a; }
.ys-svg .hi { fill: #fffdf8; }
.ys-svg .hi2 { fill: #fffdf8; opacity: .8; }
.ys-svg .pupils { transform: translate(var(--gx), var(--gy)); transition: transform .28s ease; }
.ys-svg .lid { display: none; fill: var(--skin); }
.ys-svg[data-eye="half"] .lid { display: inline; }
.ys-svg[data-eye="half"] .lid-line { display: none; }

/* 眉 */
.ys-svg .brow { display: none; fill: none; stroke: #5a453a; stroke-width: 5; stroke-linecap: round; }
.ys-svg[data-brow="soft"] .brow-soft,
.ys-svg[data-brow="worry"] .brow-worry,
.ys-svg[data-brow="up"] .brow-up { display: inline; }

/* 口 */
.ys-svg .mouth { display: none; fill: #b0574f; stroke: #6e3a35; stroke-width: 2.2; stroke-linejoin: round; }
.ys-svg .mouth-line, .ys-svg .mouth-smile, .ys-svg .mouth-small,
.ys-svg .mouth-frown, .ys-svg .mouth-pout { fill: none; stroke: #8a4a44; stroke-width: 4; stroke-linecap: round; }
.ys-svg[data-mouth="line"] .mouth-line,
.ys-svg[data-mouth="smile"] .mouth-smile,
.ys-svg[data-mouth="small"] .mouth-small,
.ys-svg[data-mouth="o"] .mouth-o,
.ys-svg[data-mouth="open"] .mouth-open,
.ys-svg[data-mouth="frown"] .mouth-frown,
.ys-svg[data-mouth="cry"] .mouth-cry,
.ys-svg[data-mouth="pout"] .mouth-pout { display: inline; }
.ys-svg[data-talking] .mouth { display: none !important; }
.ys-svg[data-talking][data-mouth="o"] .mouth-o { display: inline !important; }
.ys-svg[data-talking][data-mouth="open"] .mouth-open { display: inline !important; }

/* 頬・涙・汗・メガネ */
.ys-svg .blush { fill: #f19aa8; opacity: var(--blush); transition: opacity .5s ease; }
.ys-svg .blush-line { fill: none; stroke: #e58c9c; stroke-width: 2; stroke-linecap: round; opacity: calc(var(--blush) * .9); }
.ys-svg .tear { display: none; fill: #bfe0f2; stroke: #7fb3cf; stroke-width: 2; }
.ys-svg.has-tears .tear { display: inline; animation: ysTear 2.4s ease-in-out infinite; }
@keyframes ysTear { 0%, 100% { opacity: .75; transform: translateY(0); } 50% { opacity: 1; transform: translateY(3px); } }
.ys-svg .sweat { display: none; fill: #cfe8f2; stroke: #8cb8c9; stroke-width: 2; }
.ys-svg.has-sweat .sweat { display: inline; animation: ysSweat 1.6s ease-in-out infinite; }
@keyframes ysSweat { 0%, 100% { transform: translateY(0); opacity: .85; } 50% { transform: translateY(5px); opacity: 1; } }
.ys-svg .glasses circle { fill: rgba(255, 255, 255, .05); stroke: #9c7650; stroke-width: 4.2; }
.ys-svg .glasses-bridge, .ys-svg .glasses-temple { fill: none; stroke: #9c7650; stroke-width: 4.2; stroke-linecap: round; }
.ys-svg .glasses-glare { stroke: rgba(255, 255, 255, .55); stroke-width: 3; stroke-linecap: round; }
.ys-svg .nose { fill: none; stroke: #c99a7e; stroke-width: 2.6; stroke-linecap: round; }

/* 服の飾り */
.ys-svg .o { display: none; }
.ys-svg[data-outfit="usual"] .o-usual,
.ys-svg[data-outfit="pajama"] .o-pajama,
.ys-svg[data-outfit="china"] .o-china,
.ys-svg[data-outfit="swim"] .o-swim,
.ys-svg[data-outfit="maid"] .o-maid,
.ys-svg[data-outfit="hoodie"] .o-hoodie,
.ys-svg[data-outfit="knit"] .o-knit,
.ys-svg[data-outfit="yukata"] .o-yukata { display: inline; }
.ys-svg .o-maid-head { display: none; }
.ys-svg[data-outfit="maid"] .o-maid-head { display: inline; }
.ys-svg .usual-stripe { fill: #cfd8b8; opacity: .85; }
.ys-svg .seam { stroke: #e6d7bb; }
.ys-svg .pj-star { fill: #fff6d8; stroke: #aebede; stroke-width: 1.4; }
.ys-svg .pj-btn { fill: #8fa3cf; stroke: #5f74a3; stroke-width: 1.6; }
.ys-svg .pj-pipe { fill: none; stroke: #b9c6e6; stroke-width: 3; }
.ys-svg .china-collar { fill: #a03a33; stroke: #e8c46a; stroke-width: 3; }
.ys-svg .china-trim { fill: none; stroke: #e8c46a; stroke-width: 4; }
.ys-svg .china-trim2 { fill: none; stroke: #e8c46a; stroke-width: 3; opacity: .85; }
.ys-svg .china-knot circle { fill: #e8c46a; stroke: #8a5a2a; stroke-width: 1.6; }
.ys-svg .china-knot path { fill: none; stroke: #e8c46a; stroke-width: 3; stroke-linecap: round; }
.ys-svg .china-hem { fill: #e8c46a; opacity: .85; }
.ys-svg .swim-zip { fill: none; stroke: #e9eef6; stroke-width: 3.4; }
.ys-svg .swim-zipper { fill: #dfe7f2; stroke: #8c9ab3; stroke-width: 1.6; }
.ys-svg .swim-line { fill: none; stroke: #dfe7f2; stroke-width: 2.6; opacity: .7; }
.ys-svg .maid-apron { fill: #fbf7ee; stroke: #5b463c; stroke-width: 3; }
.ys-svg .maid-apron-top { fill: #fbf7ee; stroke: #5b463c; stroke-width: 2.6; }
.ys-svg .maid-ribbon { fill: #d9536a; stroke: #8f2f42; stroke-width: 2; }
.ys-svg .maid-frill { fill: none; stroke: #fbf7ee; stroke-width: 5; stroke-linecap: round; }
.ys-svg .hood { fill: var(--fabric-shade); stroke: var(--ink); stroke-width: 3; }
.ys-svg .hoodie-pocket { fill: var(--fabric-shade); stroke: var(--ink); stroke-width: 2.6; opacity: .85; }
.ys-svg .string { fill: none; stroke: #f4f1e8; stroke-width: 3.4; stroke-linecap: round; }
.ys-svg .string-tip { fill: #f4f1e8; stroke: var(--ink); stroke-width: 1.6; }
.ys-svg .knit-rib { fill: var(--fabric-shade); stroke: var(--ink); stroke-width: 2.6; }
.ys-svg .knit-line { fill: none; stroke: var(--fabric-shade); stroke-width: 3; opacity: .8; }
.ys-svg .yukata-collar { fill: #f2ecdc; stroke: var(--ink); stroke-width: 2.6; }
.ys-svg .yukata-obi { fill: #d9a94e; stroke: var(--ink); stroke-width: 2.6; }
.ys-svg .yukata-wave { fill: none; stroke: #f2ecdc; stroke-width: 3; opacity: .6; }
.ys-svg .maid-band { fill: #fbf7ee; stroke: #5b463c; stroke-width: 2.4; }
.ys-svg .maid-frill2 { fill: #fbf7ee; stroke: #5b463c; stroke-width: 2; }

/* 腕（肩・肘の関節） */
.ys-svg .arm .sh { transform: rotate(var(--lsh)); transform-origin: 0 0; transition: transform .5s cubic-bezier(.34, 1.3, .64, 1); }
.ys-svg .arm-r .sh { transform: rotate(var(--rsh)); }
.ys-svg .arm .el { transform: rotate(var(--lel)); transform-origin: 0 0; transition: transform .5s cubic-bezier(.34, 1.3, .64, 1); }
.ys-svg .arm-r .el { transform: rotate(var(--rel)); }
.ys-svg[data-arm="eat"] .arm-r .sh { animation: ysEatSh 1.3s ease-in-out infinite; }
@keyframes ysEatSh {
  0%, 100% { transform: rotate(-62deg); }
  45% { transform: rotate(-30deg); }
  70% { transform: rotate(-55deg); }
}
.ys-svg[data-arm="eat"] .arm-r .el { animation: ysEatEl 1.3s ease-in-out infinite; }
@keyframes ysEatEl {
  0%, 100% { transform: rotate(-127deg); }
  45% { transform: rotate(-55deg); }
  70% { transform: rotate(-115deg); }
}
.ys-svg[data-arm="play"] .arm-l .sh, .ys-svg[data-arm="play"] .arm-r .sh { animation: ysPlay 1.1s ease-in-out infinite; }
@keyframes ysPlay {
  0%, 100% { transform: rotate(-80deg); }
  50% { transform: rotate(-105deg); }
}

/* 頭の向き・ポーズ */
.ys-svg .head { transform-box: view-box; transform-origin: 300px 380px; transition: transform .6s cubic-bezier(.34, 1.3, .64, 1); }
.ys-svg[data-pose="down"] .head { transform: translateY(10px) rotate(-2.5deg); }
.ys-svg[data-pose="shrink"] .head { transform: translateY(7px); }
.ys-svg[data-pose="lean"] .head { transform: translateY(-3px) rotate(1.5deg); }
.ys-svg[data-pose="fidget"] .head { transform: rotate(3.2deg); }
.ys-svg[data-pose="sleep"] .head { transform: translateY(8px) rotate(7deg); }
.ys-svg[data-pose="sleep"] .ahoge { animation: none; transform: rotate(18deg); }
.ys-svg[data-pose="sleep"] .eye-open { display: none; }
.ys-svg[data-pose="sleep"] .eye-closed { display: inline; }

@media (prefers-reduced-motion: reduce) {
  .ys-svg .ahoge, .ys-svg .arm .sh, .ys-svg .arm .el { animation: none !important; }
}

/* 髪の束 */
.ys-svg .hair-tuft, .ys-svg .bang { fill: url(#ysHair); stroke: #4a3a30; stroke-width: 3; stroke-linejoin: round; }
.ys-svg .hair-tuft { stroke-width: 2.6; }

/* 腕の自然な輪郭（関節の玉をなくす） */
.ys-svg .upper-skin, .ys-svg .forearm { stroke: none; }
.ys-svg .upper-line, .ys-svg .fore-line { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.ys-svg .elbow-crease { fill: none; stroke: rgba(120, 82, 60, 0.28); stroke-width: 2; stroke-linecap: round; }

/* ================= フェーズ4：クエスト・おみせ・サイン ================= */
.quest-note {
  position: absolute;
  left: 7px;
  top: 112px;
  width: 120px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 6px 8px 7px;
  text-align: left;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 9px 7px 10px 6px / 7px 10px 6px 9px;
  box-shadow: 2px 3px 0 rgba(74, 64, 56, 0.13);
  transform: rotate(-0.8deg);
}
.quest-note .q-label {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .12em;
  color: #8a6a3a;
  background: #f3e2b8;
  border: 1.4px solid rgba(74, 64, 56, .5);
  border-radius: 99px;
  padding: 0 7px;
}
.quest-note .q-text { font-size: 10px; line-height: 1.35; font-weight: 700; }
.quest-note .q-bar {
  display: block;
  width: 100%;
  height: 5px;
  background: #efe4cd;
  border: 1.2px solid rgba(74, 64, 56, .4);
  border-radius: 99px;
  overflow: hidden;
}
.quest-note .q-bar i { display: block; height: 100%; width: 0; background: #e2b45e; transition: width .4s ease; }
.quest-note .q-reward { font-size: 8.5px; color: #8a6a3a; font-weight: 700; }
.quest-note.done { background: #f6f1d8; }
.quest-note.done .q-bar i { background: #8fbf8a; }
.quest-note.empty { opacity: .75; }

.coin-pill {
  position: absolute;
  right: 8px;
  top: 112px;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 9px 4px 7px;
  background: #fff8e2;
  border: 2px solid var(--ink);
  border-radius: 99px 99px 99px 7px;
  box-shadow: 2px 3px 0 rgba(74, 64, 56, .14);
  font-size: 11px;
  font-weight: 800;
  color: #6b5128;
  transform: rotate(1deg);
}
.coin-pill .coin-ico { font-size: 12px; }
.coin-pill .coin-label { font-size: 8.5px; font-weight: 700; color: #a07c40; border-left: 1px dashed rgba(107, 81, 40, .4); padding-left: 5px; }
.coin-pill.bump { animation: coinBump .45s ease; }
@keyframes coinBump { 0%,100% { transform: rotate(1deg) scale(1); } 40% { transform: rotate(1deg) scale(1.16); } }

.sign-bubble {
  position: absolute;
  left: 59%;
  top: 84px;
  z-index: 9;
  width: 52px;
  height: 46px;
  display: grid;
  place-items: center;
  background: #fffdf5;
  border: 2.4px solid var(--ink);
  border-radius: 50% 46% 52% 48% / 48% 52% 46% 54%;
  box-shadow: 2px 3px 0 rgba(74, 64, 56, .16);
  font-weight: 900;
  font-size: 17px;
  color: #b4546f;
  transform-origin: 30% 90%;
}
.sign-bubble::after {
  content: "";
  position: absolute;
  left: 4px;
  bottom: -7px;
  width: 13px;
  height: 13px;
  background: #fffdf5;
  border-left: 2.4px solid var(--ink);
  border-bottom: 2.4px solid var(--ink);
  transform: rotate(-18deg) skewX(-12deg);
  border-radius: 0 0 0 5px;
}
.sign-bubble[data-sign="!"] { color: #c96a3a; background: #fff3e0; }
.sign-bubble[data-sign="♪"] { color: #5c86b8; background: #eef5fb; }
.sign-bubble[data-sign="moya"] { color: #7b7f95; background: #f0eef6; font-size: 12px; letter-spacing: -.04em; }
.sign-bubble.pop { animation: signPop .5s cubic-bezier(.34,1.5,.64,1), signWobble 2.6s ease-in-out .5s infinite; }
@keyframes signPop { 0% { transform: scale(.3) rotate(-12deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes signWobble { 0%,100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg) translateY(-2px); } }

/* タイトルのストーリーボタン */
.story-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 100%;
  margin-top: 7px;
  padding: 8px 10px;
  background: #f7efdd;
  border: 2px dashed rgba(74, 64, 56, .6);
  border-radius: 10px 8px 11px 7px;
  box-shadow: 1.5px 2px 0 rgba(74, 64, 56, .1);
}
.story-btn .stb-main { font-size: 13px; font-weight: 800; color: #6b5a86; letter-spacing: .06em; }
.story-btn .stb-sub { font-size: 9px; color: var(--ink-soft); }

/* ================= おみせ ================= */
.shop-panel { padding: 2px 2px 4px; }
.shop-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 4px; }
.shop-sign {
  font-size: 18px; font-weight: 800; letter-spacing: .1em; color: #7a5a2e;
  border-bottom: 3px double rgba(122, 90, 46, .55); padding-bottom: 2px;
}
.shop-wallet { font-size: 13px; font-weight: 800; background: #fff8e2; border: 2px solid var(--ink); border-radius: 99px; padding: 3px 10px; }
.shop-sub { margin: 0 0 8px; font-size: 10.5px; color: var(--ink-soft); }
.shop-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.shop-tab {
  flex: 1; padding: 7px 2px; font-size: 10.5px; font-weight: 700;
  background: #f4ead6; border: 1.8px solid rgba(74, 64, 56, .45);
  border-radius: 8px 7px 9px 6px; color: var(--ink-soft);
}
.shop-tab.on { background: #fffdf5; border-color: var(--ink); color: var(--ink); box-shadow: 1.5px 2px 0 rgba(74, 64, 56, .13); }
.shop-list { display: flex; flex-direction: column; gap: 6px; }
.shop-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px;
  background: #fffdf5; border: 1.8px solid rgba(74, 64, 56, .5);
  border-radius: 9px 7px 10px 6px; box-shadow: 1px 2px 0 rgba(74, 64, 56, .08);
}
.shop-item.owned { background: #f6f3e6; }
.si-icon { font-size: 22px; width: 30px; text-align: center; }
.si-body { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.si-name { font-size: 12.5px; font-weight: 800; }
.si-desc { font-size: 9.5px; color: var(--ink-soft); line-height: 1.35; }
.si-count { font-size: 9px; color: #8a6a3a; font-weight: 700; }
.si-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.si-price { font-size: 10.5px; font-weight: 800; color: #7a5a2e; }
.shop-buy {
  padding: 5px 12px; font-size: 11px; font-weight: 800;
  background: #fbe9c8; border: 2px solid var(--ink); border-radius: 8px 7px 9px 6px;
  box-shadow: 1px 1.5px 0 rgba(74, 64, 56, .16);
}
.shop-buy.give { background: #e7f0dd; }
.shop-owned { font-size: 9.5px; font-weight: 700; color: #6f8a5f; }
.shop-empty { font-size: 11px; color: var(--ink-soft); text-align: center; padding: 20px 6px; }
.shop-note { margin: 9px 0 0; font-size: 9px; color: var(--ink-soft); text-align: center; }

/* ================= イベント ================= */
.event-panel { padding: 4px 2px; }
.event-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.event-sign-big {
  width: 46px; height: 42px; display: grid; place-items: center;
  font-size: 20px; font-weight: 900; color: #b4546f;
  background: #fffdf5; border: 2.4px solid var(--ink); border-radius: 50% 46% 52% 48%;
  transform: rotate(-3deg);
}
.sign-moya .event-sign-big { font-size: 11px; color: #7b7f95; background: #f0eef6; }
.sign-happy .event-sign-big, .sign-♪ .event-sign-big { color: #5c86b8; background: #eef5fb; }
.event-title { font-size: 13px; font-weight: 800; letter-spacing: .04em; }
.event-text {
  margin: 0 0 12px; padding: 10px 12px; font-size: 12.5px; line-height: 1.7;
  background: #fffdf5; border: 2px solid rgba(74, 64, 56, .55); border-radius: 10px 8px 11px 7px;
}
.event-choices { display: flex; flex-direction: column; gap: 7px; }
.event-choice {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px; text-align: left;
  font-size: 12px; font-weight: 700; background: #f9f1e0;
  border: 1.8px solid rgba(74, 64, 56, .55); border-radius: 9px 7px 10px 6px;
  box-shadow: 1.5px 2px 0 rgba(74, 64, 56, .1);
}
.event-choice:active { transform: translateY(1px); box-shadow: none; }
.ec-no {
  width: 18px; height: 18px; flex: 0 0 18px; display: grid; place-items: center;
  font-size: 10px; background: #fff; border: 1.4px solid var(--ink); border-radius: 50%;
}
.story-choice-panel .sc-q { font-size: 12.5px; font-weight: 700; line-height: 1.6; margin: 2px 0 10px; }

/* ================= ストーリー ================= */
.chapter-list { display: flex; flex-direction: column; gap: 8px; }
.chapter-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 9px 12px; text-align: left; background: #fffdf5;
  border: 2px solid rgba(74, 64, 56, .55); border-radius: 10px 8px 11px 7px;
  box-shadow: 1.5px 2px 0 rgba(74, 64, 56, .1);
}
.chapter-card .ch-no { font-size: 9px; font-weight: 800; letter-spacing: .12em; color: #8a6a3a; }
.chapter-card .ch-title { font-size: 13.5px; font-weight: 800; }
.chapter-card .ch-sub { font-size: 9.5px; line-height: 1.45; color: var(--ink-soft); }
.chapter-card .ch-mark { font-size: 9.5px; font-weight: 700; color: #5f7f57; margin-top: 2px; }
.chapter-card.locked { opacity: .5; background: #f2ede1; }
.chapter-card.clear { background: #f4f7ea; }
.story-end { text-align: center; padding: 6px 2px; }
.se-mark {
  width: 52px; height: 52px; margin: 0 auto 6px; display: grid; place-items: center;
  font-size: 24px; color: #fff; background: #8fbf8a; border: 2.4px solid var(--ink); border-radius: 50%;
  transform: rotate(-4deg);
}
.se-reward { font-size: 13px; font-weight: 800; color: #7a5a2e; margin: 6px 0 10px; }
.speech-name.narr { background: #8a86a8; }

/* ================= ミニゲーム ================= */
.mg-panel { padding: 2px 1px 4px; }
.mg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; padding-right: 32px; }
.mg-badge { font-size: 9px; font-weight: 800; letter-spacing: .1em; color: #fff; background: #b98b9e; padding: 2px 9px; border-radius: 99px 99px 99px 2px; }
.mg-wallet { font-size: 12px; font-weight: 800; background: #fff8e2; border: 2px solid var(--ink); border-radius: 99px; padding: 2px 9px; }
.mg-sub { margin: 0 0 10px; font-size: 10.5px; color: var(--ink-soft); }
.mg-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mg-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 6px 9px; background: #fffdf5;
  border: 2px solid rgba(74, 64, 56, .55); border-radius: 12px 9px 13px 8px;
  box-shadow: 2px 3px 0 rgba(74, 64, 56, .11);
}
.mg-card:active { transform: translateY(2px); box-shadow: none; }
.mg-ico { font-size: 26px; }
.mg-name { font-size: 12px; font-weight: 800; }
.mg-desc { font-size: 9px; color: var(--ink-soft); text-align: center; line-height: 1.35; }
.mg-rew { font-size: 9px; font-weight: 800; color: #7a5a2e; margin-top: 2px; }
.mg-note { margin: 10px 0 0; font-size: 9px; color: var(--ink-soft); text-align: center; }
.mg-back {
  position: absolute; left: 12px; top: 12px; padding: 4px 8px; font-size: 10px; font-weight: 700;
  background: #f6ecd8; border: 1.6px solid rgba(74, 64, 56, .5); border-radius: 99px;
}
.mg-actions { display: flex; gap: 8px; margin-top: 10px; }
.mg-actions .btn { flex: 1; }

/* あっち向いてホイ */
.ag-stage { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 4px 0 8px; }
.ag-hand {
  width: 76px; height: 76px; display: grid; place-items: center; font-size: 38px;
  background: #fdf3df; border: 2.4px solid var(--ink); border-radius: 50% 46% 52% 48%;
  box-shadow: 2px 3px 0 rgba(74, 64, 56, .12);
}
.ag-hand.pop { animation: agPop .45s ease; }
@keyframes agPop { 0% { transform: scale(.7) rotate(-10deg); } 60% { transform: scale(1.12) rotate(4deg); } 100% { transform: scale(1); } }
.ag-vs { font-size: 11px; font-weight: 800; color: var(--ink-soft); letter-spacing: .08em; }
.ag-cpu {
  width: 76px; height: 76px; display: grid; place-items: center; font-size: 34px;
  background: #eef3f7; border: 2.4px solid var(--ink); border-radius: 48% 52% 46% 54%;
  box-shadow: 2px 3px 0 rgba(74, 64, 56, .12);
}
.ag-cpu.show { animation: agPop .45s ease; }
.ag-q { font-size: 26px; color: #9aa7b5; }
.ag-dirs { display: flex; gap: 5px; justify-content: center; }
.ag-dir {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 2px; font-size: 9.5px; font-weight: 700;
  background: #fffdf5; border: 1.8px solid rgba(74, 64, 56, .5); border-radius: 9px 7px 10px 6px;
}
.ag-dir span { font-size: 22px; }
.ag-dir.picked { background: #fbe9c8; border-color: var(--ink); }
.ag-dir:disabled { opacity: .55; }
.ag-result { min-height: 26px; margin-top: 8px; text-align: center; }
.ag-stamp {
  display: inline-block; padding: 3px 12px; font-size: 12px; font-weight: 800;
  border: 2px solid currentColor; border-radius: 8px 6px 9px 5px; transform: rotate(-2deg);
}
.ag-stamp.win { color: #5f8a55; background: #f0f6e8; }
.ag-stamp.lose { color: #a8635f; background: #fbeeea; }
.ag-stamp.draw { color: #8a7a4a; background: #faf5e2; }

/* ジャンケン */
.jk-stage { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 6px 0 10px; }
.jk-side { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.jk-label { font-size: 9px; font-weight: 700; color: var(--ink-soft); }
.jk-big {
  width: 74px; height: 74px; display: grid; place-items: center; font-size: 36px;
  background: #fdf3df; border: 2.4px solid var(--ink); border-radius: 50% 46% 52% 48%;
  box-shadow: 2px 3px 0 rgba(74, 64, 56, .12);
}
.jk-big.pop { animation: agPop .45s ease; }
.jk-vs { font-size: 11px; font-weight: 800; color: var(--ink-soft); }
.jk-hands { display: flex; gap: 6px; }
.jk-hand {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 2px; font-size: 10px; font-weight: 700;
  background: #fffdf5; border: 1.8px solid rgba(74, 64, 56, .5); border-radius: 9px 7px 10px 6px;
}
.jk-hand span { font-size: 24px; }
.jk-hand.picked { background: #fbe9c8; border-color: var(--ink); }
.jk-hand:disabled { opacity: .55; }

/* タイミング */
.tm-bar {
  position: relative; height: 34px; margin: 8px 2px 4px;
  background: #f4ead6; border: 2.2px solid var(--ink); border-radius: 8px;
  overflow: hidden;
}
.tm-zone { position: absolute; top: 0; bottom: 0; }
.tm-zone.good { left: 33%; width: 34%; background: #e8f0dc; }
.tm-zone.perfect { left: 43%; width: 14%; background: #d9eccb; }
.tm-center { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: rgba(74, 64, 56, .4); }
.tm-marker {
  position: absolute; top: -3px; bottom: -3px; left: 0; width: 9px;
  background: #c96a6a; border: 1.6px solid #7a3a3a; border-radius: 4px;
  animation: tmSweep 1.35s ease-in-out infinite alternate;
}
@keyframes tmSweep { from { left: 0; } to { left: calc(100% - 9px); } }
.tm-scale { display: flex; justify-content: space-between; font-size: 8.5px; color: var(--ink-soft); padding: 0 2px; }
.btn.big { padding: 12px 10px; font-size: 15px; }

/* スロット */
.sl-machine {
  position: relative; margin: 6px auto 8px; padding: 10px 8px;
  width: 92%; background: #fdf3df; border: 2.4px solid var(--ink);
  border-radius: 12px 10px 13px 9px; box-shadow: 2px 3px 0 rgba(74, 64, 56, .14);
}
.sl-window { display: flex; gap: 6px; justify-content: center; }
.sl-reel {
  width: 64px; height: 64px; display: grid; place-items: center; font-size: 34px;
  background: #fffdf5; border: 2px solid rgba(74, 64, 56, .55); border-radius: 8px;
}
.sl-reel.spin { animation: reelBlur .18s linear infinite; }
@keyframes reelBlur { 0% { transform: translateY(-2px); } 50% { transform: translateY(2px); } 100% { transform: translateY(-2px); } }
.sl-line { position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; background: rgba(201, 106, 106, .5); }
.sl-bets { display: flex; gap: 6px; justify-content: center; margin-bottom: 2px; }
.sl-bet {
  padding: 6px 14px; font-size: 11px; font-weight: 800;
  background: #fffdf5; border: 1.8px solid rgba(74, 64, 56, .5); border-radius: 99px;
}
.sl-bet.on { background: #fbe9c8; border-color: var(--ink); box-shadow: 1px 1.5px 0 rgba(74, 64, 56, .15); }

/* ================= こえ設定 ================= */
.voice-toggle-row { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 10px; }
.vt-label { font-size: 12.5px; font-weight: 800; }
.vt-switch {
  display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 5px;
  background: #e9e2d2; border: 2px solid var(--ink); border-radius: 99px;
}
.vt-switch i { width: 22px; height: 22px; background: #fffdf5; border: 1.8px solid var(--ink); border-radius: 50%; transition: transform .2s ease; }
.vt-switch b { font-size: 10px; letter-spacing: .08em; color: var(--ink-soft); }
.vt-switch.on { background: #dcebd3; }
.vt-switch.on i { transform: translateX(4px); background: #8fbf8a; }
.vt-switch.on b { color: #4f6f48; }
.voice-slider, .voice-select { display: flex; flex-direction: column; gap: 3px; margin: 8px 0; }
.voice-slider span, .voice-select span { font-size: 10.5px; font-weight: 700; color: var(--ink-soft); display: flex; justify-content: space-between; }
.voice-slider b { color: var(--ink); }
.voice-slider input[type="range"] { width: 100%; accent-color: #b98b9e; }
.voice-select select {
  width: 100%; padding: 7px 8px; font-size: 11px; background: #fffdf5;
  border: 2px solid rgba(74, 64, 56, .55); border-radius: 8px;
}
.voice-tip { font-size: 9px; color: var(--ink-soft); line-height: 1.5; margin: 6px 0 0; }

/* きがえ：未購入・スウォッチ */
.outfit-card.locked { opacity: .55; }
.outfit-card .oc-lock { font-size: 9px; color: #8a6a3a; font-weight: 700; }
.outfit-swatch { display: block; width: 100%; height: 100%; border-radius: 8px; border: 2px solid rgba(74, 64, 56, .45); }
.sw-hoodie { background: #b9cfd6; }
.sw-knit { background: #d9a94e; }
.sw-yukata { background: #4a5f8a; }

/* 小さい画面（高さ700px以下）はキャラを少し小さく */
@media (max-height: 700px) {
  .char-pos { height: 95%; bottom: -8px; }
  .sign-bubble { top: 66px; width: 46px; height: 41px; }
  .quest-note { transform: scale(.86); transform-origin: top left; }
}

/* =========================================================
   画像ベース立ち絵（VTuber風レイヤー）
   ========================================================= */
.yc-stage {
  position: absolute;
  inset: 0;
  --gaze-x: 0px;
  --gaze-y: 0px;
  pointer-events: none;
}
.yc-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.26s ease;
}
.yc-layer.on { opacity: 1; }
.yc-body, .yc-head-img, .yc-mouth-img, .yc-blink-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 100%;
  -webkit-user-drag: none;
  user-select: none;
}
/* 首から上だけをゆっくり傾ける（境目はマスクでぼかす） */
.yc-head {
  position: absolute;
  inset: 0;
  transform-origin: 50% 26%;
  animation: ycNeck 6.8s ease-in-out infinite;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 21%, rgba(0,0,0,0) 26%);
  mask-image: linear-gradient(180deg, #000 0%, #000 21%, rgba(0,0,0,0) 26%);
  will-change: transform;
}
.yc-head-img {
  transform: translate(var(--gaze-x, 0px), var(--gaze-y, 0px));
  transition: transform 0.45s ease;
}
@keyframes ycNeck {
  0%, 100% { transform: rotate(-0.55deg) translateX(-0.5px); }
  50% { transform: rotate(0.7deg) translateX(0.6px); }
}
/* 口パク（口まわりだけ柔らかく切り替え） */
.yc-mouth {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.07s linear;
  -webkit-mask-image: radial-gradient(ellipse 3.8% 2.6% at 52.6% 20.2%, #000 52%, rgba(0,0,0,0) 100%);
  mask-image: radial-gradient(ellipse 3.8% 2.6% at 52.6% 20.2%, #000 52%, rgba(0,0,0,0) 100%);
}
.yc-mouth.on { opacity: 1; }
.yc-mouth-img { object-position: 50% 100%; }
/* まばたき */
.yc-blink {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.06s linear;
}
.yc-blink.on { opacity: 1; }
/* しゃべっている間の小さな上下 */
.yc-stage[data-talking="1"] .yc-layer.on .yc-body {
  animation: ycTalk 0.42s ease-in-out infinite;
}
@keyframes ycTalk {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1.6px); }
}
/* 表情の代替表現（その服に表情差分がない場合の色味） */
.yc-stage.fallback-expr[data-mood="shy"] .yc-body { filter: saturate(1.06) brightness(1.01); }
.yc-stage.fallback-expr[data-mood="scared"] .yc-body { filter: saturate(0.9) brightness(0.98); }
