/* 百鬼迷宮：墨・朱・金の3色で組む。スマホ縦持ちが基準 */
:root {
  --ink: #0c0b10;
  --ink-2: #16141c;
  --ink-3: #221f2b;
  --line: #3a3546;
  --paper: #efe6d2;
  --dim: #b0a795;
  --shu: #d2452c;
  --shu-dark: #7d2414;
  --kin: #e0b652;
  --kin-dark: #8a6d2a;
  --ai: #6fb3b5;
  --ok: #7fc37a;
  --panel: #141219;
  --mincho: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --gothic: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #050507;
  color: var(--paper);
  font-family: var(--gothic);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { cursor: default; }
button:focus-visible { outline: 2px solid var(--kin); outline-offset: 1px; }

/* スマホ：上から 帯／場面／隊／情報／操作。情報欄が伸び縮みし、操作欄は入りきらなければ中でスクロール */
#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--ink);
  overflow: hidden;
}
#top, #scene, #party { flex: none; }

/* ---- 上の帯 ---- */
#top {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(#1d1924, #121017);
}
.top-name { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.top-name b { font-family: var(--mincho); font-size: 17px; letter-spacing: 0.08em; white-space: nowrap; color: #f6ecd6; }
.top-name span { color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
#top-gold { color: var(--kin); font-size: 13px; font-variant-numeric: tabular-nums; }
.top-tools button {
  position: relative;
  min-height: 32px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--ink-3);
  color: #c9bfab;
  font-size: 12px;
}
/* 見た目は小さく、押せる範囲は44px */
.top-tools button::after { content: ""; position: absolute; inset: -6px -3px; }

/* ---- 場面 ---- */
#scene {
  grid-area: scene;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 36dvh;
  overflow: hidden;
  background: #000;
  border-bottom: 1px solid var(--line);
}
#view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  display: none;
}
.scene-dungeon #view { display: block; }
#scene-art, #scene-layer { position: absolute; inset: 0; z-index: 2; }
#scene-layer { pointer-events: none; }
#scene-layer .map-overlay { pointer-events: auto; }
.scene-dungeon #scene-art { display: none; }
#scene-banner {
  position: absolute;
  z-index: 3;
  left: 8px;
  top: 6px;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--paper);
  font-size: 12px;
  pointer-events: none;
}
#scene-banner:empty { display: none; }

/* 迷宮の視界：周りの暗がりと松明のゆらぎ（層ごとに色を変える） */
.scene-dungeon::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse 78% 74% at 50% 56%, transparent 52%, var(--vig, rgba(0, 0, 0, 0.6)) 100%);
  animation: torch 4.6s linear infinite;
}
#scene[data-floor="1"] { --vig: rgba(16, 6, 0, 0.62); }
#scene[data-floor="2"] { --vig: rgba(0, 12, 18, 0.66); }
#scene[data-floor="3"] { --vig: rgba(6, 4, 0, 0.74); }
#scene[data-floor="4"] { --vig: rgba(40, 6, 0, 0.62); }
#scene[data-floor="5"] { --vig: rgba(8, 4, 26, 0.72); }
#scene[data-floor="6"] { --vig: rgba(14, 0, 4, 0.66); }
@keyframes torch {
  0% { opacity: 0.9; }
  11% { opacity: 0.76; }
  19% { opacity: 0.95; }
  33% { opacity: 0.82; }
  46% { opacity: 1; }
  58% { opacity: 0.84; }
  71% { opacity: 0.97; }
  86% { opacity: 0.78; }
  100% { opacity: 0.9; }
}

/* 題字と町の絵 */
.town-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.6) saturate(0.92) contrast(1.05);
  transform-origin: 50% 40%;
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: scale(1.03); }
  to { transform: scale(1.1) translate(-1.5%, 1%); }
}
#scene-art::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 30% at 20% 100%, rgba(200, 190, 170, 0.12), transparent 70%),
    radial-gradient(ellipse 50% 26% at 80% 104%, rgba(200, 190, 170, 0.1), transparent 70%);
}
.town-title {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  background:
    linear-gradient(to bottom, rgba(12, 11, 16, 0) 55%, rgba(12, 11, 16, 0.85) 100%),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.72));
  text-shadow: 0 2px 10px #000, 0 0 2px #000;
}
.town-title b {
  font-family: var(--mincho);
  font-size: clamp(28px, 8.5vw, 46px);
  letter-spacing: 0.24em;
  padding-left: 0.24em;
  color: #f6ecd6;
}
.town-title small { color: var(--kin); font-size: 12px; letter-spacing: 0.24em; padding-left: 0.24em; }
.town-title small:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}
.town-title small:first-child::before,
.town-title small:first-child::after {
  content: "";
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--kin));
}
.town-title small:first-child::after { background: linear-gradient(90deg, var(--kin), transparent); }
.town-title.big b {
  position: relative;
  font-size: clamp(38px, 12vw, 64px);
  background: linear-gradient(#fff8e6 30%, #e8cf8e 62%, #b98d3a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.9));
  text-shadow: none;
}
.town-title.big small:last-child { margin-top: 4px; color: #f0dcae; font-size: 12px; }
/* 朱の落款 */
.town-title.big::after {
  content: "百鬼";
  position: absolute;
  right: 9%;
  top: 14%;
  padding: 4px 3px;
  writing-mode: vertical-rl;
  border: 2px solid var(--shu);
  border-radius: 3px;
  background: rgba(125, 36, 20, 0.35);
  color: #ff9a82;
  font-family: var(--mincho);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-shadow: none;
  transform: rotate(5deg);
  opacity: 0.9;
}

#scene.shake { animation: shake 0.28s; }
@keyframes shake {
  20% { transform: translate(-5px, 2px); }
  40% { transform: translate(5px, -2px); }
  60% { transform: translate(-3px, -1px); }
  80% { transform: translate(3px, 1px); }
}
#scene::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; }
#scene.flash-red::after { background: radial-gradient(ellipse at center, rgba(194, 32, 26, 0.35), #c2201a); animation: flash 0.3s; }
#scene.flash-white::after { background: #fff; animation: flash 0.35s; }
@keyframes flash { from { opacity: 0.55; } to { opacity: 0; } }

/* ---- 妖怪 ---- */
.mons {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1.5%;
  padding: 0 2% 2.5%;
  background: radial-gradient(ellipse 80% 70% at 50% 72%, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.66));
}
.mons.has-boss { background: radial-gradient(ellipse 70% 70% at 50% 70%, rgba(120, 20, 10, 0.18), rgba(10, 0, 0, 0.76)); }
.mon {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex: 0 1 31%;
  min-width: 0;
  height: 95%;
  container-type: size;
  isolation: isolate;
}
.mons.count-1 .mon { flex-basis: 52%; }
.mons.count-4 .mon { flex-basis: 24.5%; }
.mon.big { flex-grow: 1.25; }
.mons .mon.boss { flex: 0 1 50%; }
.mons.count-1 .mon.boss { flex-basis: 64%; }
/* 足もとの影 */
.mon::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 14px;
  height: 12%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.75), transparent);
  pointer-events: none;
}
.mon-art {
  position: relative;
  width: calc(min(100cqw, (100cqh - 24px) * var(--ar, 0.71)) * var(--sk, 1));
  aspect-ratio: var(--ar, 0.71);
  background-image: url("../assets/yokai.webp");
  background-repeat: no-repeat;
  transform-origin: 50% 100%;
  filter: var(--f, none);
  /* 楕円でぼかし、さらに上下左右の端で必ず消えるようにして、切り出しの四角を見せない */
  -webkit-mask-image: radial-gradient(ellipse 66% 64% at 50% 48%, #000 58%, transparent 100%), linear-gradient(to bottom, transparent, #000 13%, #000 90%, transparent), linear-gradient(to right, transparent, #000 9%, #000 91%, transparent);
  -webkit-mask-composite: source-in, source-in;
  mask-image: radial-gradient(ellipse 66% 64% at 50% 48%, #000 58%, transparent 100%), linear-gradient(to bottom, transparent, #000 13%, #000 90%, transparent), linear-gradient(to right, transparent, #000 9%, #000 91%, transparent);
  mask-composite: intersect;
  animation: bob 2.8s ease-in-out infinite;
}
.mon:nth-child(2) .mon-art { animation-delay: -0.8s; }
.mon:nth-child(3) .mon-art { animation-delay: -1.5s; }
.mon:nth-child(4) .mon-art { animation-delay: -2.1s; }
@keyframes bob { 50% { transform: translateY(-2.5%) scaleY(1.01); } }
/* 正体不明：青黒い影にして、形だけ見せる */
.mon.unknown .mon-art { animation-duration: 3.6s; }
.mon.unknown::after {
  content: "？";
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translateX(-50%);
  color: rgba(200, 190, 255, 0.55);
  font-family: var(--mincho);
  font-size: clamp(18px, 22cqw, 44px);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(120, 100, 255, 0.7);
  pointer-events: none;
}
.mon-name {
  position: relative;
  margin-top: 2px;
  padding: 1px 7px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.78);
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mon-name b { margin-left: 4px; color: var(--kin); }
.mon-name i { margin-left: 4px; color: var(--ai); font-style: normal; }
.mon.unknown .mon-name { color: #cfc6ff; font-style: italic; }
/* 主（ボス） */
.mon.boss::after {
  content: "";
  position: absolute;
  inset: 4% 0 18px;
  z-index: -1;
  background: radial-gradient(ellipse 50% 50% at 50% 60%, rgba(210, 69, 44, 0.45), rgba(224, 182, 82, 0.12) 55%, transparent 72%);
  animation: aura 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes aura {
  50% { opacity: 0.55; transform: scale(1.06); }
}
.mon.boss .mon-art { animation: bossBreath 3.4s ease-in-out infinite; }
@keyframes bossBreath { 50% { transform: scale(1.025) translateY(-1%); } }
.mon.boss .mon-name {
  padding: 1px 10px;
  border: 1px solid var(--kin);
  background: linear-gradient(#7d2414, #3a0f08);
  color: #ffe6d6;
  font-family: var(--mincho);
  font-weight: 700;
  letter-spacing: 0.08em;
}
/* 当たった／倒れた */
.mon.hit .mon-art { animation: monHit 0.36s ease-out; }
@keyframes monHit {
  0% { transform: translateX(0); filter: var(--f, none) brightness(2.6) saturate(0.2); }
  25% { transform: translateX(-5%) rotate(-2deg); }
  50% { transform: translateX(4%) rotate(1.5deg); filter: var(--f, none) brightness(1.4); }
  100% { transform: none; filter: var(--f, none); }
}
.mon.hit::before { background: radial-gradient(closest-side, rgba(255, 90, 60, 0.6), transparent); }
.mon.dying .mon-art { animation: monDie 0.62s ease-in forwards; }
@keyframes monDie {
  0% { filter: var(--f, none) brightness(3) saturate(0); opacity: 1; }
  30% { transform: translateY(0) scale(1.04, 0.96); opacity: 1; }
  100% { transform: translateY(8%) scale(0.9, 0.2); filter: var(--f, none) brightness(0.2); opacity: 0; }
}
.mon.dying .mon-name { opacity: 0.4; text-decoration: line-through; }

/* ---- 宝箱 ---- */
.chest-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 9%;
  overflow: hidden;
  background:
    radial-gradient(ellipse 45% 35% at 50% 80%, rgba(224, 182, 82, 0.22), transparent 70%),
    radial-gradient(ellipse 90% 80% at 50% 60%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.72));
}
/* 上から差す光の筋と舞う塵 */
.chest-wrap::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -10%;
  width: 70%;
  height: 100%;
  transform: translateX(-50%);
  background:
    radial-gradient(1.5px 1.5px at 30% 40%, rgba(255, 240, 200, 0.9), transparent),
    radial-gradient(1.5px 1.5px at 62% 58%, rgba(255, 240, 200, 0.8), transparent),
    radial-gradient(1px 1px at 48% 30%, rgba(255, 240, 200, 0.9), transparent),
    radial-gradient(1px 1px at 70% 76%, rgba(255, 240, 200, 0.7), transparent),
    linear-gradient(to bottom, rgba(255, 222, 150, 0.2), rgba(255, 222, 150, 0.04) 85%, transparent);
  clip-path: polygon(40% 0, 60% 0, 88% 100%, 12% 100%);
  animation: beamFlicker 5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes beamFlicker {
  0%, 100% { opacity: 0.85; background-position: 0 0; }
  50% { opacity: 1; background-position: 0 -12px; }
}
.chest {
  position: relative;
  width: 36%;
  max-width: 300px;
  aspect-ratio: 5 / 4;
  perspective: 420px;
  animation: chestIdle 3.8s ease-in-out infinite;
}
/* 中で何かが動いた気がする、小さな揺れ */
@keyframes chestIdle {
  0%, 68%, 80%, 100% { transform: none; }
  70% { transform: translateX(-1px) rotate(-0.8deg); }
  72% { transform: translateX(1px) rotate(0.8deg); }
  74% { transform: translateX(-1px) rotate(-0.4deg); }
  76% { transform: none; }
}
.chest::before {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -8%;
  height: 18%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.8), transparent);
}
.chest .box, .chest .lid {
  --wood: linear-gradient(#94602f, #5e3818 72%, #3f2510);
  --strap: #c9a04a;
  --rim: #1e130a;
  --straps: linear-gradient(90deg,
    transparent 13%, var(--rim) 13% 14.5%, var(--strap) 14.5% 20%, var(--rim) 20% 21.5%, transparent 21.5% 78.5%,
    var(--rim) 78.5% 80%, var(--strap) 80% 85.5%, var(--rim) 85.5% 87%, transparent 87%);
}
.chest .box {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  height: 58%;
  border: 3px solid var(--rim);
  border-radius: 3px 3px 6px 6px;
  background: var(--straps), repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.3) 0 1px, transparent 1px 12.5%), var(--wood);
  box-shadow: inset 0 3px 0 rgba(255, 220, 150, 0.22), inset 0 -10px 14px rgba(0, 0, 0, 0.5), 0 2px 0 #0e0804;
}
/* 錠前の板と鍵穴 */
.chest .box::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -12%;
  width: 17%;
  aspect-ratio: 4 / 5;
  transform: translateX(-50%);
  border: 2px solid var(--rim);
  border-radius: 4px 4px 7px 7px;
  background:
    radial-gradient(circle at 50% 36%, #120b05 0 13%, transparent 14%),
    linear-gradient(#120b05, #120b05) 50% 66% / 13% 32% no-repeat,
    linear-gradient(#f6da86, #c08f32 60%, #8a6320);
  box-shadow: 0 0 10px rgba(255, 210, 110, 0.45);
}
/* 表面を横切るきらめき */
.chest .box::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 244, 210, 0.32) 50%, transparent 58%) no-repeat;
  background-size: 260% 100%;
  background-position: 120% 0;
  animation: glint 4.2s ease-in-out infinite 0.8s;
  pointer-events: none;
}
@keyframes glint {
  0%, 60% { background-position: 120% 0; }
  85%, 100% { background-position: -20% 0; }
}
.chest .lid {
  position: absolute;
  z-index: 2;
  left: -2%;
  right: -2%;
  top: 2%;
  height: 46%;
  border: 3px solid var(--rim);
  border-radius: 46% 46% 4px 4px / 72% 72% 4px 4px;
  background: var(--straps), repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.26) 0 1px, transparent 1px 22%), linear-gradient(#b07638, #6e431c);
  box-shadow: inset 0 5px 0 rgba(255, 225, 160, 0.28), inset 0 -8px 10px rgba(0, 0, 0, 0.42);
  transform-origin: 50% 100%;
  transition: transform 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}
/* ふたの合わせ目から漏れる光 */
.chest .lid::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -4px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #ffe08a 30%, #fff3c4 50%, #ffe08a 70%, transparent);
  box-shadow: 0 0 10px 2px rgba(255, 200, 90, 0.55);
  animation: seam 2.2s ease-in-out infinite;
}
@keyframes seam { 50% { opacity: 0.35; } }
.chest .glow {
  position: absolute;
  z-index: 3;
  left: 4%;
  right: 4%;
  top: 22%;
  height: 42%;
  border-radius: 50%;
  background: radial-gradient(closest-side, #fffbe6, rgba(255, 214, 110, 0.85) 42%, rgba(255, 190, 60, 0) 100%);
  opacity: 0;
  pointer-events: none;
}

/* 開いた瞬間 */
.chest-wrap.open { animation: goldWash 0.9s ease-out; }
@keyframes goldWash {
  0% { box-shadow: inset 0 0 0 999px rgba(255, 226, 150, 0.55); }
  100% { box-shadow: inset 0 0 0 999px rgba(255, 226, 150, 0); }
}
.chest-wrap.open .chest { animation: chestPop 0.5s ease-out; }
@keyframes chestPop {
  0% { transform: scale(1); }
  30% { transform: scale(1.07, 0.95); }
  60% { transform: scale(0.98, 1.03); }
  100% { transform: none; }
}
/* ふたは跳ね上がって奥へ傾き、内側（暗い面）が見える */
.chest-wrap.open .lid { animation: lidOpen 0.6s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
@keyframes lidOpen {
  0% { transform: none; filter: none; }
  18% { transform: translateY(-8%) rotateX(0deg); }
  100% { transform: translateY(-66%) rotateX(38deg) scaleY(0.92); filter: brightness(0.62) saturate(0.9); }
}
.chest-wrap.open .lid::after { display: none; }
.chest-wrap.open .glow { opacity: 1; animation: bloom 0.8s ease-out, shimmer 2.6s ease-in-out infinite 0.8s; }
@keyframes bloom {
  0% { transform: scale(0.3); opacity: 0; }
  40% { transform: scale(1.35); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes shimmer { 50% { opacity: 0.8; transform: scale(0.95); } }
/* 立ちのぼる光の柱 */
.chest-wrap.open .glow::before {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 50%;
  height: 300%;
  background: linear-gradient(to top, rgba(255, 232, 160, 0.8), rgba(255, 232, 160, 0));
  transform-origin: 50% 100%;
  animation: rise 0.7s ease-out both;
  filter: blur(2px);
}
@keyframes rise {
  from { transform: scaleY(0); opacity: 0; }
  to { transform: scaleY(1); opacity: 1; }
}
/* 舞い上がる金の粒 */
.chest-wrap.open .glow::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 40%;
  height: 260%;
  background:
    radial-gradient(2px 2px at 20% 80%, #fff3c0, transparent),
    radial-gradient(2px 2px at 40% 60%, #ffe08a, transparent),
    radial-gradient(3px 3px at 62% 72%, #fff8d8, transparent),
    radial-gradient(2px 2px at 78% 50%, #ffe08a, transparent),
    radial-gradient(2px 2px at 30% 35%, #fff3c0, transparent),
    radial-gradient(3px 3px at 55% 22%, #ffe08a, transparent),
    radial-gradient(2px 2px at 85% 18%, #fff3c0, transparent);
  animation: sparks 1.8s ease-out infinite;
}
@keyframes sparks {
  from { transform: translateY(20%); opacity: 1; }
  to { transform: translateY(-25%); opacity: 0; }
}
/* 背後に回る光の筋 */
.chest-wrap.open::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 64%;
  width: 150%;
  aspect-ratio: 1;
  background: repeating-conic-gradient(from 0deg, rgba(255, 214, 120, 0.2) 0 6deg, transparent 6deg 20deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 10%, transparent 72%);
  mask-image: radial-gradient(closest-side, #000 10%, transparent 72%);
  transform: translate(-50%, -50%);
  animation: raysIn 0.7s ease-out both, raysSpin 22s linear infinite 0.7s;
  pointer-events: none;
}
@keyframes raysIn {
  from { transform: translate(-50%, -50%) scale(0.2) rotate(-30deg); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
}
@keyframes raysSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
.chest-wrap.open .chest { z-index: 1; }

/* 罠が発動した瞬間 */
.chest-wrap.trap { animation: trapPulse 0.4s ease-in-out 3 alternate; }
@keyframes trapPulse {
  from { box-shadow: inset 0 0 0 999px rgba(200, 20, 10, 0.05); }
  to { box-shadow: inset 0 0 60px 30px rgba(200, 20, 10, 0.75); }
}
.chest-wrap.trap::before { background: linear-gradient(to bottom, rgba(255, 80, 50, 0.22), transparent 85%); }
.chest-wrap.trap .chest { animation: trapShake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
@keyframes trapShake {
  10%, 90% { transform: translateX(-2%) rotate(-1deg); }
  20%, 80% { transform: translateX(3%) rotate(2deg); }
  30%, 50%, 70% { transform: translateX(-5%) rotate(-3deg); }
  40%, 60% { transform: translateX(5%) rotate(3deg); }
}
.chest-wrap.trap .box, .chest-wrap.trap .lid {
  --wood: linear-gradient(#a3342a, #5a1610 72%, #340a06);
  --strap: #5a4a40;
}
.chest-wrap.trap .lid { animation: lidSnap 0.6s ease-out both; }
@keyframes lidSnap {
  0% { transform: none; }
  22% { transform: translateY(-30%) rotateX(38deg); }
  48% { transform: none; }
  64% { transform: translateY(-8%) rotateX(10deg); }
  100% { transform: none; }
}
.chest-wrap.trap .lid::after { background: linear-gradient(90deg, transparent, #ff5a3c 30%, #ffd0c0 50%, #ff5a3c 70%, transparent); box-shadow: 0 0 12px 3px rgba(255, 60, 30, 0.7); }
.chest-wrap.trap .box::after { box-shadow: 0 0 12px rgba(255, 60, 30, 0.7); }
/* 赤い煙が噴き出す */
.chest-wrap.trap .glow {
  opacity: 1;
  top: -10%;
  height: 90%;
  left: -20%;
  right: -20%;
  background: radial-gradient(closest-side, rgba(255, 120, 80, 0.9), rgba(160, 20, 10, 0.6) 45%, rgba(40, 0, 0, 0) 100%);
  animation: burst 0.9s ease-out forwards;
}
@keyframes burst {
  0% { transform: scale(0.2); opacity: 1; }
  60% { opacity: 0.8; }
  100% { transform: scale(1.8); opacity: 0; }
}
/* 「罠」の印 */
.chest-wrap.trap .chest::after {
  content: "罠";
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 8%;
  padding: 0.05em 0.18em;
  border: 3px solid var(--shu);
  border-radius: 4px;
  background: rgba(20, 4, 2, 0.72);
  color: #ffdcd2;
  font-family: var(--mincho);
  font-size: clamp(26px, 9vw, 56px);
  font-weight: 700;
  line-height: 1.1;
  text-shadow: 0 0 12px rgba(255, 60, 30, 0.9);
  transform: translate(-50%, 0) rotate(-10deg);
  animation: stamp 0.38s cubic-bezier(0.2, 1.6, 0.4, 1) 0.12s both;
}
@keyframes stamp {
  from { transform: translate(-50%, 0) rotate(-24deg) scale(2.4); opacity: 0; }
  to { transform: translate(-50%, 0) rotate(-10deg) scale(1); opacity: 1; }
}
.chest-wrap.trap::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: 90%;
  aspect-ratio: 2 / 1;
  border-radius: 50%;
  background:
    radial-gradient(closest-side at 30% 60%, rgba(90, 10, 8, 0.8), transparent),
    radial-gradient(closest-side at 70% 50%, rgba(60, 6, 6, 0.75), transparent),
    radial-gradient(closest-side at 50% 30%, rgba(120, 20, 12, 0.6), transparent);
  transform: translateX(-50%);
  animation: smoke 1.4s ease-out both;
  pointer-events: none;
}
@keyframes smoke {
  0% { transform: translateX(-50%) scale(0.3); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translateX(-50%) translateY(-30%) scale(1.5); opacity: 0.25; }
}

/* 主の大宝箱：黒漆に金 */
.chest-wrap.boss {
  background:
    radial-gradient(ellipse 50% 38% at 50% 78%, rgba(224, 182, 82, 0.34), transparent 70%),
    radial-gradient(ellipse 90% 80% at 50% 60%, rgba(40, 0, 0, 0.1), rgba(10, 0, 0, 0.78));
}
.chest-wrap.boss .chest { width: 46%; }
.chest-wrap.boss .box, .chest-wrap.boss .lid {
  --wood: linear-gradient(#3a2a26, #17100e 70%, #0a0706);
  --strap: #e0b652;
  --rim: #6e4c16;
}
.chest-wrap.boss .box { box-shadow: inset 0 3px 0 rgba(255, 220, 150, 0.3), inset 0 -10px 14px rgba(0, 0, 0, 0.6), 0 0 18px rgba(224, 182, 82, 0.35); }
.chest-wrap.boss .box::after {
  width: 20%;
  background:
    radial-gradient(circle at 50% 36%, #120b05 0 12%, transparent 13%),
    linear-gradient(#120b05, #120b05) 50% 66% / 12% 30% no-repeat,
    radial-gradient(circle at 50% 50%, #b8321f 0 34%, transparent 35%),
    linear-gradient(#fff0b0, #d9a53c 55%, #9a6d1c);
}
.chest-wrap.boss.trap .box, .chest-wrap.boss.trap .lid { --wood: linear-gradient(#8a2418, #3a0c06 72%, #200402); }
.chest-wrap.boss.open::after { background: repeating-conic-gradient(from 0deg, rgba(255, 214, 120, 0.3) 0 5deg, transparent 5deg 15deg); }

/* ---- 地図 ---- */
.map-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: radial-gradient(ellipse at center, rgba(22, 18, 14, 0.94), rgba(5, 5, 8, 0.97));
  cursor: pointer;
}
.map-overlay canvas {
  height: 86%;
  max-width: 96%;
  aspect-ratio: 1;
  image-rendering: pixelated;
  border: 1px solid #4a3f2c;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.6), 0 0 18px rgba(224, 182, 82, 0.12);
}
.map-overlay p { margin: 0; color: #cfc4ad; font-size: 12px; }

/* ---- 隊 ---- */
#party {
  grid-area: party;
  display: grid;
  grid-template-rows: repeat(3, auto);
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}
#party.empty { display: none; }
.pc {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 44px;
  padding: 3px 7px;
  border: 0;
  border-left: 3px solid transparent;
  background: var(--ink-2);
  text-align: left;
}
.pc.front { border-left-color: var(--shu-dark); }
.pc.back { border-left-color: #2f4a57; }
.pc.active { background: #33270f; box-shadow: inset 0 0 0 1px var(--kin); }
.pc-face { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; background: #f4efe4; }
.pc-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; display: block; }
.pc-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pc-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-name i { color: var(--kin); font-style: normal; margin-right: 2px; }
.pc-sub { color: var(--dim); font-size: 11px; line-height: 1.35; white-space: nowrap; }
.pc-bar { height: 4px; border-radius: 2px; background: #000; overflow: hidden; }
.pc-bar i { display: block; height: 100%; background: var(--ok); transition: width 0.25s; }
.pc-hp { display: flex; flex-direction: column; align-items: flex-end; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc-hp small { color: var(--dim); font-size: 11px; }
.pc-hp b { padding: 0 4px; border-radius: 2px; background: var(--shu-dark); color: #ffd9cf; font-size: 11px; }
.pc.danger .pc-bar i { background: var(--shu); }
.pc.danger .pc-hp span { color: #ff8f7a; }
.pc.bad .pc-bar i { background: var(--kin); }
.pc.down { background: #120d0d; color: #8a7c76; }
.pc.down .pc-face { filter: grayscale(1) brightness(0.45); }
.pc.down .pc-bar i { background: #3b2a2a; }
/* 攻撃を受けた・倒れた */
.pc.hit { animation: pcHit 0.42s ease-out; }
@keyframes pcHit {
  0% { background: #6a1a10; transform: translateX(0); }
  25% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  100% { background: var(--ink-2); transform: none; }
}
.pc.fell { animation: pcFell 0.9s ease-out; }
@keyframes pcFell {
  0% { background: #b0301c; }
  40% { background: #4a0c06; }
  100% { background: #120d0d; }
}
.pc.hit .pc-face, .pc.fell .pc-face { box-shadow: 0 0 0 2px var(--shu); }

/* ---- 情報欄 ---- */
#info {
  grid-area: info;
  flex: 1 1 0;
  min-height: 44px;
  overflow-y: auto;
  padding: 8px 10px;
  background: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}
.note { padding: 8px 10px; border-left: 3px solid var(--kin); background: var(--ink-2); }
.note.pre { white-space: pre-line; }
.note b { color: var(--kin); }
.note.danger { border-left-color: var(--shu); }
.log p { margin: 0 0 3px; padding-left: 8px; border-left: 2px solid var(--line); color: #d8cfbd; }
.log p:nth-last-child(-n + 4) { color: var(--paper); }
.log .log-hit { border-left-color: var(--kin); }
.log .log-kill { border-left-color: var(--kin); color: var(--kin) !important; }
.log .log-crit { border-left-color: #fff; color: #fff !important; font-weight: 700; }
.log .log-hurt { border-left-color: var(--shu); color: #ffb3a3 !important; }
.log .log-die { border-left-color: var(--shu); color: #ff7a66 !important; font-weight: 700; }
.log .log-bad { border-left-color: var(--shu); color: #ffb3a3 !important; }
.log .log-heal { border-left-color: var(--ok); color: #b8e6b3 !important; }
.log .log-spell { border-left-color: var(--ai); color: #bfe4e6 !important; }
.log .log-miss { color: var(--dim) !important; }

.sheet-head { display: flex; gap: 10px; align-items: center; }
.sheet-head img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; object-position: 50% 15%; background: #f4efe4; flex-shrink: 0; }
.sheet-head h3 { margin: 0; font-family: var(--mincho); font-size: 17px; color: var(--kin); }
.sheet-head p { margin: 0; font-size: 13px; color: var(--paper); }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 8px 0; }
.stats span { display: flex; flex-direction: column; align-items: center; padding: 3px 0; border: 1px solid var(--line); border-radius: 4px; background: var(--ink-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.stats small { color: var(--dim); font-size: 11px; font-weight: 400; }
.slots { font-size: 13px; font-variant-numeric: tabular-nums; letter-spacing: 0.06em; }
.slots small { display: inline-block; width: 3em; color: var(--ai); font-size: 12px; }
.items { list-style: none; margin: 8px 0 0; padding: 0; }
.items li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; padding: 4px 0; border-bottom: 1px dotted var(--line); font-size: 14px; }
.items li i { display: inline-block; width: 1.3em; color: var(--kin); font-style: normal; font-size: 12px; }
.items li small { flex-basis: 100%; padding-left: 1.6em; color: var(--dim); font-size: 12px; }
.items li.cursed { color: #ff8f7a; }
.items li.cursed i { color: var(--shu); }
.items li.none { color: var(--dim); }

/* ---- 操作欄 ---- */
/* 入りきらないときは中でスクロール。上下の影でまだ続きがあることを示す */
#panel {
  grid-area: panel;
  flex: 0 1 auto;
  min-height: 0;
  max-height: 58dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(var(--panel) 30%, rgba(20, 18, 25, 0)) center top / 100% 28px no-repeat local,
    linear-gradient(rgba(20, 18, 25, 0), var(--panel) 70%) center bottom / 100% 28px no-repeat local,
    radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, 0.7), transparent) center top / 100% 12px no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, rgba(224, 182, 82, 0.45), transparent) center bottom / 100% 12px no-repeat scroll,
    var(--panel);
}
.menu h2, .msg h2 { margin: 0 0 6px; font-family: var(--mincho); font-size: 16px; font-weight: 700; color: var(--kin); letter-spacing: 0.06em; }
.menu h2 b { font-size: 20px; color: var(--paper); }
.menu-list { display: grid; gap: 6px; }
.menu-list.cols-2 { grid-template-columns: 1fr 1fr; }
.opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--ink-3);
  text-align: left;
}
.opt:hover:not(:disabled), .opt:focus-visible { border-color: var(--kin); background: #2c2838; outline: none; }
.opt:active:not(:disabled) { transform: translateY(1px); background: #332d40; }
.opt:disabled { opacity: 0.4; }
.opt-key { flex: 0 0 auto; min-width: 20px; padding: 0 4px; border: 1px solid var(--line); border-radius: 3px; color: var(--dim); font-size: 11px; text-align: center; }
.opt-key:empty { display: none; }
.opt-body { display: flex; flex-direction: column; min-width: 0; }
.opt-body b { font-size: 15px; }
.opt-body small { color: var(--dim); font-size: 12px; line-height: 1.35; }
.opt.go { border-color: var(--kin-dark); background: #2e2612; }
.opt.go b { color: var(--kin); }
.opt.danger { border-color: #7a2e20; }
.opt.danger b { color: #ff9f8b; }
.opt.dim b { color: var(--dim); }
.opt.back { margin-top: 6px; background: transparent; }
.opt.back b { color: var(--dim); font-weight: 400; }
/* 案内（チュートリアル）：つぎに押す所を光らせる */
.opt.guide { position: relative; border-color: var(--kin); background: #2e2612; animation: actGlow 1.8s ease-in-out infinite; }
.opt.guide b { color: var(--kin); }
/* 札は枠の右上に重ねる（中の文字の折り返しを変えない） */
.opt.guide::after {
  content: "つぎ";
  position: absolute;
  top: -6px;
  right: 8px;
  padding: 0 6px;
  border: 1px solid var(--kin);
  border-radius: 3px;
  background: var(--panel);
  color: var(--kin);
  font-size: 11px;
  line-height: 1.5;
  white-space: nowrap;
}
.opt.next { margin-top: 8px; justify-content: center; border-color: var(--kin-dark); }
.opt.next b { color: var(--kin); }

.msg p { margin: 0 0 4px; font-size: 15px; line-height: 1.6; }
.msg.danger p { color: #ffb3a3; }
.msg.danger h2 { color: #ff8f7a; }
.msg .hint { color: var(--dim); font-size: 12px; text-align: center; }
.msg.playing { padding: 12px 0; }

#text-input {
  width: 100%;
  margin-bottom: 8px;
  padding: 10px;
  border: 1px solid var(--kin);
  border-radius: 6px;
  background: #000;
  color: var(--paper);
  font: inherit;
  font-size: 16px;
}

.alloc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-bottom: 8px; }
.alloc-row { display: grid; grid-template-columns: 1fr 44px 28px 44px; align-items: center; gap: 4px; }
.alloc-row span { font-size: 14px; }
.alloc-row b { text-align: center; font-size: 16px; font-variant-numeric: tabular-nums; }
.alloc-row button { height: 44px; border: 1px solid var(--line); border-radius: 6px; background: var(--ink-3); font-size: 18px; }
.alloc-row button:disabled { opacity: 0.3; }
.alloc .menu-list { margin-bottom: 6px; }

/* 探索の操作盤 */
.pad { display: flex; flex-direction: column; gap: 6px; }
.pad-act {
  min-height: 48px;
  border: 1px solid var(--kin-dark);
  border-radius: 6px;
  background: linear-gradient(#3a2f14, #2a2210);
  color: var(--kin);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  animation: actGlow 2.4s ease-in-out infinite;
}
@keyframes actGlow { 50% { box-shadow: 0 0 12px rgba(224, 182, 82, 0.35); border-color: var(--kin); } }
.pad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pad-grid button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink-3);
}
.pad-grid button b { font-size: 20px; line-height: 1.1; }
.pad-grid button small { color: var(--dim); font-size: 11px; }
.pad-grid .pad-main { border-color: var(--shu); background: #3a1a13; }
.pad-grid .pad-main b { color: #ffb3a3; }
.pad-grid button:active { transform: translateY(1px); background: #2c2838; }

/* ---- 背の低いスマホ（SE・640px級）：隊を3列2段にして、操作欄と情報欄に高さを回す ---- */
@media (max-height: 740px) and (max-width: 899px) {
  #top { min-height: 40px; padding: 3px 8px; }
  .top-name b { font-size: 16px; }
  #scene { max-height: 28dvh; }
  #party { grid-template-rows: none; grid-template-columns: repeat(3, 1fr); grid-auto-flow: row; }
  .pc {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    grid-template-areas: "face name" "face hp" "bar bar";
    align-items: center;
    column-gap: 5px;
    row-gap: 1px;
    min-height: 44px;
    padding: 3px 5px 4px 5px;
  }
  .pc-main { display: contents; }
  .pc-face { grid-area: face; width: 22px; height: 22px; }
  .pc-name { grid-area: name; font-size: 12px; line-height: 1.25; }
  .pc-sub { display: none; }
  .pc-bar { grid-area: bar; }
  .pc-hp { grid-area: hp; flex-direction: row; align-items: baseline; justify-content: flex-start; gap: 4px; font-size: 12px; line-height: 1.25; }
  .pc-hp small { font-size: 10px; }
  .pc-hp b { font-size: 10px; }
  #info { min-height: 50px; padding: 4px 8px; font-size: 13px; line-height: 1.5; }
  .note { padding: 4px 8px; }
  #panel { padding: 6px 8px 8px; max-height: none; }
  .menu h2, .msg h2 { margin-bottom: 4px; font-size: 15px; }
  .menu-list { gap: 5px; }
  .opt { padding: 4px 9px; }
  /* 見出しと説明を横に並べて1行に収める */
  .opt-body { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 8px; }
  .opt.back { margin-top: 5px; }
  .msg p { font-size: 14px; line-height: 1.5; }
  .pad-grid button { min-height: 46px; }
  .pad-act { min-height: 44px; }
}

/* ---- 広い画面（PC）：左に大きな視界、右に隊と操作 ---- */
@media (min-width: 900px) and (min-height: 560px) {
  body {
    background:
      radial-gradient(ellipse 60% 50% at 50% 0%, rgba(125, 36, 20, 0.18), transparent 70%),
      #050507;
  }
  #app {
    display: grid;
    max-width: 1560px;
    grid-template-columns: minmax(0, 1.75fr) minmax(360px, 1fr);
    grid-template-areas: "top top" "scene party" "scene panel" "info panel";
    grid-template-rows: auto auto auto minmax(0, 1fr);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
  }
  #scene { max-height: 70dvh; }
  #panel { max-height: none; border-left: 1px solid var(--line); border-top: 0; padding: 10px 12px; }
  #party { border-left: 1px solid var(--line); }
  #info { min-height: 0; font-size: 15px; padding: 10px 14px; }
  .pc { padding: 5px 9px; }
  .pc-face { flex-basis: 36px; width: 36px; height: 36px; }
  .pc-name { font-size: 14px; }
  .pc-sub { font-size: 12px; }
  .pad-grid button { min-height: 60px; }
  .pad-grid button small { font-size: 12px; }
  .mon-name { font-size: 14px; line-height: 22px; }
  #scene-banner { font-size: 13px; }
  .town-title small { font-size: 14px; }
}
@media (min-width: 1700px) and (min-height: 900px) {
  #app { max-width: 1760px; }
  html, body { font-size: 16px; }
}

/* ---- 動きを減らす設定：揺れ・点滅・ゆらぎを止める ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .scene-dungeon::before, .town-art, .place-img, .mon-art, .mon.boss::after, .chest, .chest-wrap::before, .chest .box::before, .chest .lid::after, .pad-act { animation: none !important; }
  #scene.shake, #scene.flash-red::after, #scene.flash-white::after, .pc.hit, .pc.fell, .chest-wrap.trap, .chest-wrap.open { animation: none !important; }
}

/* 題字と町の背景：公式の絵8体を並べる */
.town-faces { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, 1fr); gap: 2%; padding: 3% 4%; background: radial-gradient(ellipse at 50% 40%, #2a2233, #0c0b10 75%); }
.town-faces span { display: flex; align-items: center; justify-content: center; min-height: 0; border-radius: 10px; background: #f4efe4; overflow: hidden; filter: brightness(0.6) saturate(0.9); }
.town-faces img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; display: block; }

/* 題字と町の背景：白一色（公式の絵は使わない・2026-10-02本人指定） */
.town-white { position: absolute; inset: 0; background: #fff; }
.town-white ~ .town-title { background: none; text-shadow: none; }
.town-white ~ .town-title b,
.town-white ~ .town-title.big b { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: #1b1822; filter: none; }
.town-white ~ .town-title small,
.town-white ~ .town-title.big small:last-child { color: #6a5320; }
.town-white ~ .town-title small:first-child::before { background: linear-gradient(90deg, transparent, #8a6d2a); }
.town-white ~ .town-title small:first-child::after { background: linear-gradient(90deg, #8a6d2a, transparent); }
.town-white ~ .town-title.big::after { background: rgba(210, 69, 44, 0.08); color: #b8321b; }

/* 場所の絵（白地のSVG）と、下に置く場所名 */
.place-svg { position: absolute; inset: 0; width: 100%; height: 100%; padding-bottom: 46px; box-sizing: border-box; }
.town-title.cap { justify-content: flex-end; padding-bottom: 6px; gap: 0; }
.town-title.cap b, .town-title.big.cap b { font-size: clamp(22px, 6.4vw, 32px); }
.town-title.cap::after { display: none; }

/* 場所の絵：真っ黒な地に、建物が闇からうっすら浮かぶ（よく見ると分かる程度） */
#scene-art:has(.place-img) { background: #000; }
.place-img { position: absolute; inset: 0; width: 100%; height: 100%; padding-bottom: 30px; box-sizing: border-box; object-fit: contain; mix-blend-mode: screen; opacity: 0.92; animation: lurk 9s ease-in-out infinite alternate; }
@keyframes lurk { from { opacity: 0.72; } to { opacity: 1; } }
.place-img ~ .town-title { background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.85) 100%); }
.place-img ~ .town-title.big { background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.1) 70%); }
