/* パンダたんてい — ADVスタイル（自作・販売可能ライセンス方針: 全アセット自作） */
:root {
  --ink: #33302e;
  --bamboo: #7bc47f;
  --deep: #2a6b46;
  --cream: #fff6e3;
  --yellow: #ffd45e;
  --pink: #ff9db0;
  --sky: #bde3ff;
  --paper: #fffdf6;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: #1d3a2a; min-height: 100%; }
body { font-family: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', sans-serif; color: var(--ink); }
.panda-app { max-width: 760px; margin: 0 auto; padding: 8px; }
.p-loading { color: #fff; text-align: center; padding: 40px 0; font-size: 18px; }

/* ── ステージ ── */
.stage { position: relative; width: 100%; aspect-ratio: 5 / 3; min-height: 400px; border-radius: 18px; overflow: hidden; background: var(--deep); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); user-select: none; }
.stage, .stage * { touch-action: manipulation; }
.stage.shake { animation: st-shake .38s; }
@keyframes st-shake { 0%,100%{transform:translate(0,0)} 20%{transform:translate(-7px,3px)} 40%{transform:translate(6px,-4px)} 60%{transform:translate(-5px,2px)} 80%{transform:translate(4px,-2px)} }
.world { position: absolute; }
.bg-layer { position: absolute; inset: 0; }
.bg-layer img { width: 100%; height: 100%; display: block; }
.hs-layer { position: absolute; inset: 0; z-index: 25; pointer-events: none; }
.hs-layer .hotspot { pointer-events: auto; }
.flash-layer { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 40; }
.flash-layer.on { animation: fl .34s; }
@keyframes fl { 0%{opacity:.95} 100%{opacity:0} }

/* ── 立ち絵 ── */
.portrait { position: absolute; left: 50%; bottom: 27%; transform: translateX(-50%); width: 38%; max-width: 250px; z-index: 5; transition: opacity .18s; }
.portrait svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 6px 10px rgba(0,0,0,.25)); }
.portrait.zoom { animation: pz .34s; }
@keyframes pz { 0%{transform:translateX(-50%) scale(1)} 50%{transform:translateX(-50%) scale(1.12)} 100%{transform:translateX(-50%) scale(1)} }
.portrait.bounce { animation: pb .3s; }
@keyframes pb { 0%,100%{transform:translateX(-50%)} 50%{transform:translateX(-50%) translateY(-12px)} }
.portrait.hidden { opacity: 0; }

/* ── HUD ── */
.hud { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; align-items: flex-start; z-index: 60; pointer-events: none; }
.hud .hud-group { display: flex; gap: 6px; pointer-events: auto; }
.hud-btn { min-width: 44px; min-height: 44px; border-radius: 12px; border: 3px solid var(--ink); background: var(--paper); font-size: 19px; font-family: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.25); padding: 2px 9px; }
.hud-btn:active { transform: translateY(2px); box-shadow: none; }
.hearts { background: var(--paper); border: 3px solid var(--ink); border-radius: 12px; padding: 7px 10px; font-size: 16px; letter-spacing: 2px; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.hearts .lost { opacity: .22; }

/* ── セリフ枠 ── */
.dialog { position: absolute; left: 3%; right: 3%; bottom: 3%; min-height: 32%; background: var(--paper); border: 4px solid var(--ink); border-radius: 16px; padding: 30px 16px 14px; z-index: 30; cursor: pointer; box-shadow: 0 6px 0 rgba(0,0,0,.28); }
.nameplate { position: absolute; top: -18px; left: 12px; background: var(--deep); color: #fff; font-weight: 900; border: 3px solid var(--ink); border-radius: 10px; padding: 4px 14px; font-size: 15px; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.dtext { font-size: 19px; line-height: 1.85; font-weight: 700; min-height: 64px; word-break: break-word; }
.dtext ruby rt { font-size: 9px; color: var(--deep); }
.dtext .ch { visibility: hidden; }
.dtext .ch.on { visibility: visible; }
.next-arrow { position: absolute; right: 14px; bottom: 8px; font-size: 18px; color: var(--deep); animation: bl 1s infinite; }
@keyframes bl { 0%,100%{opacity:1; transform:translateY(0)} 50%{opacity:.35; transform:translateY(3px)} }
.speak-btn { position: absolute; right: 10px; top: -18px; min-width: 40px; min-height: 36px; border-radius: 10px; border: 3px solid var(--ink); background: var(--yellow); cursor: pointer; font-size: 15px; box-shadow: 0 3px 0 rgba(0,0,0,.25); }

/* ── バナー演出 ── */
.banner { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%) rotate(-6deg) scale(.4); z-index: 70; background: var(--yellow); border: 5px solid var(--ink); border-radius: 14px; padding: 14px 30px; font-family: 'Mochiy Pop One', 'Zen Maru Gothic', sans-serif; font-size: clamp(26px, 6vw, 44px); color: var(--ink); box-shadow: 8px 8px 0 rgba(0,0,0,.3); opacity: 0; pointer-events: none; white-space: nowrap; }
.banner.show { animation: bn 1.15s ease-out; }
@keyframes bn { 0%{opacity:0; transform:translate(-50%,-50%) rotate(-6deg) scale(.4)} 14%{opacity:1; transform:translate(-50%,-50%) rotate(-6deg) scale(1.12)} 24%{transform:translate(-50%,-50%) rotate(-6deg) scale(1)} 82%{opacity:1} 100%{opacity:0} }
.banner.ev { background: var(--sky); font-size: clamp(20px, 4.5vw, 30px); }

/* ── 調査（ホットスポット） ── */
.invest-prompt { position: absolute; top: 58px; left: 8px; background: rgba(51,48,46,.85); color: #fff; border-radius: 999px; padding: 8px 16px; font-size: 13px; font-weight: 700; z-index: 28; white-space: nowrap; max-width: 70%; }
.invest-prompt ruby rt { font-size: 8px; color: var(--yellow); }
.invest-count { position: absolute; top: 98px; left: 12px; color: #fff; font-weight: 900; text-shadow: 0 2px 4px rgba(0,0,0,.6); z-index: 28; font-size: 14px; }
.hotspot { position: absolute; z-index: 25; background: none; border: none; cursor: pointer; padding: 0; }
.hotspot .hs-dot { display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; margin: 0 auto; border-radius: 50%; background: rgba(255,255,255,.88); border: 3px solid var(--ink); font-size: 20px; font-weight: 900; animation: hp 1.6s infinite; box-shadow: 0 3px 8px rgba(0,0,0,.3); }
.hotspot.found .hs-dot { animation: none; background: var(--bamboo); }
@keyframes hp { 0%,100%{transform:scale(1)} 50%{transform:scale(1.14)} }
.invest-next { position: absolute; bottom: 5%; left: 50%; transform: translateX(-50%); z-index: 35; }

/* ── 証言モード ── */
.testi-title { position: absolute; top: 54px; left: 50%; transform: translateX(-50%); background: var(--deep); color: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 7px 22px; font-weight: 900; font-size: 15px; z-index: 20; white-space: nowrap; box-shadow: 0 3px 0 rgba(0,0,0,.3); }
.testi-title ruby rt { font-size: 8px; color: var(--yellow); }
.testi-box { position: absolute; left: 3%; right: 3%; bottom: 3%; background: var(--paper); border: 4px solid var(--ink); border-radius: 16px; padding: 12px 14px 12px; z-index: 30; box-shadow: 0 6px 0 rgba(0,0,0,.28); }
.testi-no { font-size: 12px; font-weight: 900; color: var(--deep); margin-bottom: 2px; }
.testi-text { font-size: 19px; line-height: 1.8; font-weight: 700; min-height: 58px; }
.testi-text ruby rt { font-size: 9px; color: var(--deep); }
.testi-nav { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.t-btn { flex: 1; min-height: 48px; border-radius: 12px; border: 3px solid var(--ink); font-family: inherit; font-weight: 900; font-size: 15px; cursor: pointer; box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.t-btn:active { transform: translateY(2px); box-shadow: none; }
.t-btn.nav { flex: 0 0 52px; background: var(--paper); font-size: 18px; }
.t-btn.press { background: var(--sky); }
.t-btn.present { background: var(--yellow); }
.hint-bubble { margin-top: 8px; background: var(--sky); border: 3px dashed var(--deep); border-radius: 12px; padding: 8px 10px; font-size: 14px; font-weight: 700; }

/* ── モーダル（しょうこ） ── */
.modal-wrap { position: absolute; inset: 0; background: rgba(29,58,42,.72); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--paper); border: 4px solid var(--ink); border-radius: 18px; padding: 14px; width: 100%; max-width: 460px; max-height: 92%; overflow-y: auto; box-shadow: 0 10px 0 rgba(0,0,0,.3); }
.modal h3 { margin: 2px 0 10px; font-size: 17px; color: var(--deep); }
.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.ev-card { border: 3px solid var(--ink); border-radius: 12px; background: #fff; padding: 6px 4px; text-align: center; cursor: pointer; font-family: inherit; }
.ev-card img { width: 52px; height: 52px; display: block; margin: 0 auto; }
.ev-card .ev-name { font-size: 11px; font-weight: 900; line-height: 1.3; }
.ev-card:active { transform: scale(.96); }
.ev-row { display: flex; gap: 10px; align-items: center; border-bottom: 2px dashed #d8cfba; padding: 8px 2px; }
.ev-row img { width: 44px; height: 44px; flex: 0 0 44px; }
.ev-row .ev-name { font-weight: 900; font-size: 14px; }
.ev-row .ev-desc { font-size: 12px; color: #6b6257; line-height: 1.5; }
.modal .close-btn { width: 100%; margin-top: 10px; }

/* ── 汎用ボタン ── */
.p-btn { display: inline-block; min-height: 50px; padding: 12px 26px; border-radius: 14px; border: 4px solid var(--ink); background: var(--yellow); color: var(--ink); font-family: inherit; font-weight: 900; font-size: 17px; cursor: pointer; box-shadow: 0 5px 0 rgba(0,0,0,.3); text-decoration: none; }
.p-btn:active { transform: translateY(3px); box-shadow: none; }
.p-btn.sub { background: var(--paper); font-size: 14px; padding: 9px 18px; min-height: 44px; }

/* ── タイトル画面 ── */
.title-screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; z-index: 10; text-align: center; padding: 12px; }
.title-logo { font-family: 'Mochiy Pop One', 'Zen Maru Gothic', sans-serif; font-size: clamp(34px, 9vw, 58px); color: #fff; text-shadow: 3px 3px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink), 0 8px 0 rgba(0,0,0,.25); line-height: 1.2; margin-top: 4px; }
.title-sub { background: var(--paper); border: 3px solid var(--ink); border-radius: 999px; padding: 6px 18px; font-weight: 900; font-size: 14px; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.title-badge { width: 84px; height: 84px; }
.title-btns { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.ep-tabs { display: flex; gap: 8px; }
.ep-tab.on { background: var(--yellow); }
.title-note { color: #fff; font-size: 11px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }

/* ── エンディング ── */
.end-card { position: absolute; inset: 8% 6%; background: var(--paper); border: 4px solid var(--ink); border-radius: 18px; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 16px; box-shadow: 0 8px 0 rgba(0,0,0,.3); }
.end-card h2 { font-family: 'Mochiy Pop One', sans-serif; color: var(--deep); margin: 0; font-size: 26px; }
.end-stars { font-size: 30px; letter-spacing: 6px; }
.end-note { font-size: 14px; font-weight: 700; line-height: 1.8; }

/* せまい画面 */
@media (max-width: 480px) {
  .stage { aspect-ratio: auto; height: 78vh; }
  .dtext { font-size: 17px; }
  .testi-text { font-size: 17px; }
  .portrait { width: 46%; bottom: 30%; }
}
@media (prefers-reduced-motion: reduce) {
  .stage.shake, .banner.show, .portrait.zoom, .portrait.bounce, .flash-layer.on { animation: none; }
  .banner.show { opacity: 1; transform: translate(-50%, -50%) rotate(-6deg) scale(1); }
  .hotspot .hs-dot { animation: none; }
}
