
*{margin: 0px; padding: 0px; box-sizing: border-box;}
:root{--red: #ff6b6b; --orange: #ffa94d; --yellow: #ffd43b; --cream: #fef9ef; --ink: #495057; --sub: #868e96; --line: #e9ecef; --ok: #4ade80; --ng: #ef4444;}
html, body{height: 100%;}
body{font-family: "Zen Maru Gothic", sans-serif; background: linear-gradient(rgb(255, 245, 230) 0%, rgb(254, 249, 239) 100%); color: var(--ink); text-size-adjust: 100%; display: flex; justify-content: center; min-height: 100vh;}
#app{width: 100%; max-width: 480px; min-height: 100vh; background: var(--cream); position: relative; overflow: hidden; box-shadow: rgba(255, 107, 107, 0.12) 0px 0px 40px;}
.screen{display: none; padding: 18px 16px 28px; animation: 0.3s ease 0s 1 normal none running fadeIn;}
.screen.active{display: block;}
.scene{position: relative; border-radius: 22px; overflow: hidden; box-shadow: rgba(255, 255, 255, 0.35) 0px 0px 0px 4px inset, rgba(0, 0, 0, 0.1) 0px 6px 18px; background-size: cover; background-position: center center;}
.battle-top{display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px;}
.battle-top .stage-label{font-size: 0.82rem; color: var(--sub); font-weight: 700;}
.battle-top .stage-label b{color: var(--ink); font-size: 0.95rem;}
.battle-top-right{display: flex; flex-direction: column; align-items: flex-end; gap: 3px; margin-right: 48px;}
.hp{font-size: 1.4rem; letter-spacing: 2px; line-height: 1;}
.hp:empty{display: none;}
.battle-coins{font-weight: 900; font-size: 0.78rem; color: rgb(124, 74, 3); background: rgb(255, 251, 230); border: 2px solid var(--yellow); border-radius: 50px; padding: 2px 9px; white-space: nowrap; line-height: 1.3;}
.scene.battle{height: 240px; display: flex; align-items: center; justify-content: center;}
@media (min-width: 420px){.scene.battle{height: 280px;}}
#screen-battle.tate{background-size: auto 145%; background-position: right 32%; position: relative; height: 100vh; box-sizing: border-box; overflow: hidden;}
#screen-battle.tate .scene.battle{background: transparent; box-shadow: none; border-radius: 0px; overflow: visible; height: calc(-560px + 100vh); min-height: 180px; align-items: flex-start; justify-content: flex-end; padding-top: 30px; padding-right: 4%;}
#screen-battle.tate .party-row{position: absolute; left: 0px; right: 0px; bottom: 404px; justify-content: flex-start; align-items: flex-end; padding-left: 118px; padding-right: 6px; gap: clamp(4px, 2vw, 14px); flex-wrap: nowrap;}
#screen-battle.tate .msg{position: absolute; left: 14px; right: 14px; bottom: 296px; min-height: 96px; margin: 0px; background: rgba(255, 255, 255, 0.93); z-index: 6;}
#screen-battle.tate .options{position: absolute; left: 14px; right: 14px; bottom: 8px; height: 280px; justify-content: flex-start;}
@media (max-height: 760px){#screen-battle.tate .options{height: 230px;}
#screen-battle.tate .opt{min-height: 48px; font-size: 1.2rem;}
#screen-battle.tate .msg{bottom: 246px; min-height: 78px;}
#screen-battle.tate .party-row{bottom: 326px;}
#screen-battle.tate .scene.battle{height: calc(-430px + 100vh); min-height: 150px; padding-top: 16px;}
#screen-battle.tate .hero-back img{height: 250px;}}
#screen-battle.tate .opt{background: rgba(255, 255, 255, 0.93);}
#screen-battle.tate .battle-top{position: relative; z-index: 3;}
#screen-battle.tate .battle-top .stage-label{background: rgba(255, 255, 255, 0.8); border-radius: 10px; padding: 2px 8px;}
#screen-battle.tate .battle-coins{background: rgba(255, 251, 230, 0.94);}
.hero-back{display: none;}
#screen-battle.tate .hero-back{display: block; position: absolute; left: -15px; bottom: -128px; margin: 0px;}
#screen-battle.tate .hero-back img{height: 320px; display: block; filter: drop-shadow(rgba(0, 0, 0, 0.25) 0px 6px 8px); transform-origin: center bottom;}
.enemy-wrap{position: relative; display: inline-block; animation: 3s ease-in-out 0s infinite normal none running efloat;}
.enemy-info{position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none;}
#screen-battle.tate .enemy-info{left: 44%;}
.enemy-hp{font-size: 1rem; letter-spacing: 1px; filter: drop-shadow(rgba(0, 0, 0, 0.35) 0px 1px 2px); max-width: 4.5em; text-align: center; overflow-wrap: anywhere; line-height: 1.12;}
.msg{background: rgb(255, 255, 255); border-radius: 18px; padding: 14px 16px; margin: 14px 0px; text-align: center; font-size: 1.15rem; font-weight: 700; color: var(--ink); min-height: 62px; display: flex; align-items: center; justify-content: center; line-height: 1.5; box-shadow: rgba(0, 0, 0, 0.06) 0px 4px 14px;}
.options{display: flex; flex-direction: column; gap: 12px;}
.opt{font-family: inherit; font-weight: 900; font-size: 1.4rem; color: var(--ink); background: rgb(255, 255, 255); border: 3px solid var(--line); border-radius: 16px; padding: 0px 16px; min-height: 60px; cursor: pointer; transition: transform 0.12s, border-color 0.15s, background 0.15s; box-shadow: 0 4px 0 var(--line); -webkit-tap-highlight-color: transparent;}
.opt:not(:disabled):hover{border-color: var(--orange); background: rgb(255, 249, 240);}
.opt:not(:disabled):active{transform: translateY(3px); box-shadow: 0 1px 0 var(--line);}
.battle-exit{flex: 0 0 auto; background: rgb(255, 255, 255); border: 2px solid var(--line); border-radius: 50px; font-family: inherit; font-weight: 900; font-size: 0.8rem; color: var(--sub); padding: 6px 12px; cursor: pointer; box-shadow: 0 3px 0 var(--line);}
.battle-exit:active{transform: translateY(2px); box-shadow: 0 1px 0 var(--line);}
.party-row{display: flex; gap: 10px; justify-content: flex-start; margin: 6px 0px 12px; flex-wrap: wrap;}
.pbtn{position: relative; width: 66px; height: 66px; border-radius: 16px; border: 4px solid rgb(255, 255, 255); background: rgb(255, 255, 255); font-family: inherit; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: rgba(0, 0, 0, 0.12) 0px 4px 0px; transition: transform 0.12s; -webkit-tap-highlight-color: transparent;}
.pbtn:active{transform: translateY(2px);}
.pbtn.sel{background: rgb(255, 251, 230); box-shadow: 0 0 0 3px var(--yellow),0 4px 0 rgba(0,0,0,.12);}
.pbtn .pc{font-size: 1.8rem; font-weight: 900; line-height: 1;}
.pbtn.pfield{width: auto; height: auto; min-width: 44px; border-width: medium; border-style: none; border-color: currentcolor; border-image: none; background: transparent; box-shadow: none; border-radius: 0px; flex-direction: column; justify-content: flex-end; gap: 2px; padding: 0px;}
.pbtn.pfield:active{transform: translateY(1px);}
.pbtn.pfield .pc{position: relative; font-size: clamp(2rem, 12vw, 3.9rem);}
.pbtn.pfield .sel-ring{position: absolute; left: 50%; bottom: -0.08em; transform: translateX(-50%) scale(0.9); width: 2.3em; height: 0.7em; border-radius: 50%; pointer-events: none; opacity: 0; background: radial-gradient(rgba(255, 224, 102, 0.9) 0%, rgba(255, 199, 64, 0.5) 45%, rgba(255, 224, 102, 0) 78%);}
.pbtn.pfield.sel{transform: translateY(-14px) scale(1.14);}
.pbtn.pfield.sel:active{transform: translateY(-11px) scale(1.08);}
.pbtn.pfield.sel .sel-ring{opacity: 1; animation: 1.4s ease-in-out 0s infinite normal none running pfieldRing;}
.pbtn.pfield .pfuda{position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; background: rgba(255, 255, 255, 0.94); border-radius: 9px; padding: 3px clamp(4px, 1.6vw, 8px) 4px; box-shadow: rgba(0, 0, 0, 0.2) 0px 2px 5px; min-width: 30px;}
.pbtn.pfield.sel .pfuda{box-shadow: rgb(229, 57, 53) 0px 0px 0px 3px, rgba(0, 0, 0, 0.2) 0px 2px 5px;}
.pbtn.pfield .pfuda-lv{font-size: 0.7rem; font-weight: 900; color: rgb(124, 74, 3); line-height: 1.25; white-space: nowrap;}
@media (max-width: 340px){.pbtn.pfield{min-width: 34px;}
.pbtn.pfield .pc{font-size: 1.55rem;}
#screen-battle.tate .party-row{gap: 3px;}
#screen-battle.tate .msg{font-size: 0.95rem; line-height: 1.4; padding: 8px;}}
#screen-battle{background-repeat:no-repeat}#hearts{color:#d83450;background:#fffd;border-radius:10px;padding:2px 8px}#listen{position:absolute;z-index:5;right:8px;top:8px;width:44px;height:44px;background:#fffd;border-radius:50%;border:2px solid #ddd;font-size:21px;cursor:pointer}#enemyType{background:#fffe;padding:2px 8px;border-radius:15px;font-weight:800}#monster{width:clamp(128px,36vw,174px);aspect-ratio:600/420;transform-origin:50% 84%}.body,.pc img,.pc canvas,.body>*{position:absolute;inset:0;width:100%;height:100%}.body{transform-origin:center 83%;animation:jelly 2s ease-in-out infinite}.pc img,.body img{object-fit:contain}.pbtn.pfield{width:calc((100% - 3 * clamp(4px,2vw,14px))/4);min-width:0;max-width:73px}.pfield .pc{display:block;width:100%;aspect-ratio:1.28}.pfield .pc img,.pfield .pc canvas{height:auto;top:auto;bottom:0}.pfield .pfuda{width:100%;border-top:4px solid;font-size:clamp(10px,2.7vw,13px);padding:2px 0!important;line-height:1.12}.pfuda small{font-size:9px}.pbtn:disabled{cursor:default}.party-row .hero-back{pointer-events:none}.msg{flex-direction:column}.msg span{font-size:.82em}.msg span:empty{display:none}.opt:disabled{opacity:.6}#impact{position:absolute;inset:5% 0 auto;text-align:center;color:#462100;text-shadow:0 1px 4px white;font-weight:900;font-size:24px;opacity:0;pointer-events:none}
.arrive{animation:arrive .72s both}.body.hit,.hurt{animation:hit .38s}.pc.strike{animation:strike .56s}#impact.pop{animation:pop .65s}
@keyframes arrive{0%{transform:translate(20%,-35%) scale(.55)}55%{transform:scale(1.14,.78)}74%{transform:translateY(-10%) scale(.95,1.08)}100%{transform:none}}@keyframes jelly{50%{transform:scale(1.03,.96)}}@keyframes strike{45%{transform:translate(8px,-18px) scale(1.1)}}@keyframes hit{40%{transform:translateX(6px)}}@keyframes pop{20%,70%{opacity:1}100%{transform:translateY(-20px)}}
dialog{position:fixed;inset:0;margin:auto;border:0;border-radius:18px;width:min(460px,94vw);max-height:85vh;padding:16px;background:#fffcf4;color:#343d37}dialog::backdrop{background:#182c2499}.dhead,.entry{display:flex;align-items:center;gap:6px}.dhead{justify-content:space-between}.entry{flex-wrap:wrap;padding:5px;border-bottom:1px solid #ddd;font-size:13px}.entry strong{margin-right:auto}.entry img{width:48px}.entry button,.dhead button{border:1px solid #bec8bb;border-radius:9px;padding:6px;min-height:44px;background:white;font:inherit;cursor:pointer}#swapHint{font-weight:bold}button:focus-visible{outline:3px solid #00679a}
@media(max-height:620px){.msg span{font-size:12px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}
@media(max-width:360px){.battle-top{gap:3px}.battle-top-right{margin-right:38px}.battle-top .stage-label{white-space:nowrap;font-size:10px}.battle-top .stage-label b{font-size:12px}#hearts{font-size:16px;letter-spacing:0}#listen{width:38px;height:38px;right:3px}}
@media(max-height:620px){#monster{width:119px}}


body:has(#screen-battle.active.battle-responsive) #app{height:100dvh;overflow-y:auto}
#screen-battle.tate.battle-responsive[id="screen-battle"]{height:100dvh;min-height:488px;padding-top:8px;padding-left:var(--battle-screen-padding,16px);padding-right:var(--battle-screen-padding,16px)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .scene.battle{padding-top:var(--battle-scene-padding,16px)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .enemy-wrap:not(.boss) .enemy-char{font-size:var(--battle-normal-font,124.8px)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .enemy-wrap{zoom:var(--battle-enemy-scale,1)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .options{bottom:calc(12px + env(safe-area-inset-bottom,0px));height:auto;gap:12px}
#screen-battle.tate.battle-responsive[id="screen-battle"] .opt{min-height:48px;font-size:1.2rem;background:rgba(255,255,255,.40)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .opt:not(:disabled):hover{background:rgba(255,249,240,.40)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .opt.correct{background:rgba(240,253,244,.40)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .opt.wrong{background:rgba(254,242,242,.40)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .msg{bottom:var(--battle-message-bottom,188px);min-height:78px;background:rgba(255,255,255,.40)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .battle-hakase{bottom:var(--battle-message-bottom,188px);background:rgba(0,0,0,.20)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .party-row{bottom:var(--battle-party-bottom,274px);padding-left:var(--battle-party-left,142px);padding-right:var(--battle-party-right,14px);gap:var(--battle-party-gap,14px);margin:0;transform:none}
#screen-battle.tate.battle-responsive[id="screen-battle"] .pbtn.pfield{flex:0 0 var(--battle-card-width,48px);min-width:var(--battle-card-width,48px);min-height:44px}
#screen-battle.tate.battle-responsive[id="screen-battle"] .pbtn.pfield .pc{font-size:var(--battle-party-font,42.24px)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .pbtn.pfield .pfuda{padding-left:3px;padding-right:3px}
#screen-battle.tate.battle-responsive[id="screen-battle"] .pbtn.pfield .pfuda.pfuda-wide{padding-left:var(--battle-label-padding,3px);padding-right:var(--battle-label-padding,3px)}
#screen-battle.tate.battle-responsive[id="screen-battle"]:has(.hero-back.victory-pop) .pbtn.pfield .pfuda{padding-left:var(--battle-label-padding,3px);padding-right:var(--battle-label-padding,3px)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .hero-back{left:-15px;bottom:auto;top:var(--battle-hero-top,0px);pointer-events:none}
#screen-battle.tate.battle-responsive[id="screen-battle"] .hero-back img{height:var(--battle-hero-height,288px);transform-origin:bottom left}
#screen-battle.tate.battle-responsive[id="screen-battle"] .genki-item-btn{position:absolute;left:8px;bottom:0;min-width:44px;min-height:44px}
#screen-battle.battle-responsive .ink-run{padding:2px 3px;margin:0 -3px;-webkit-box-decoration-break:clone;box-decoration-break:clone}
#screen-battle.battle-responsive #bMsg .ink-run{background:rgba(255,255,255,.8833333333333333);border-radius:4px}
#screen-battle.battle-responsive #bOptions .ink-run{display:inline-block;box-sizing:border-box;max-width:100%;text-align:center;background:white;border-radius:4px;margin:0}
#screen-battle.battle-responsive #bOptions .ink-run.ink-wrap{line-height:1;padding-top:1px;padding-bottom:1px;vertical-align:top}
#screen-battle.battle-responsive #bOptions .opt:not(:disabled):hover .ink-run{background:#fff9f0}
#screen-battle.battle-responsive #bOptions .opt.correct .ink-run{background:#f0fdf4}
#screen-battle.battle-responsive #bOptions .opt.wrong .ink-run{background:#fef2f2}
#screen-battle.battle-responsive #battleHakase .ink-run{background:rgba(0,0,0,.775);border-radius:4px}
.battle-hero-reference{position:absolute;left:0;top:0;visibility:hidden;pointer-events:none;font-weight:900;line-height:1}
#screen-battle.tate.battle-responsive[id="screen-battle"] .msg{min-height:var(--battle-window-min,78px);max-height:var(--battle-window-cap,220px);overflow-y:auto;font-size:var(--battle-message-font,1.15rem);line-height:var(--battle-message-line,1.5);padding:var(--battle-msg-pady,14px) var(--battle-msg-padx,16px)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .battle-hakase{max-height:var(--battle-window-cap,220px);overflow-y:auto;padding:var(--battle-doctor-pady,8px) var(--battle-doctor-padx,14px) var(--battle-doctor-pady,8px) 8px}
#screen-battle.tate.battle-responsive.battle-compact .battle-hakase{align-items:flex-start}
#screen-battle.tate.battle-responsive[id="screen-battle"] .battle-hakase-face{width:var(--battle-doctor-face,56px);height:var(--battle-doctor-face,56px)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .battle-hakase-text{font-size:var(--battle-doctor-font,.92rem)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .enemy-wrap.twin .enemy-char{font-size:var(--battle-twin-font,51.2px)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .twin-hp{font-size:var(--battle-star-font,16px)}
#screen-battle.tate.battle-responsive[id="screen-battle"] #enemyInfo{left:var(--battle-info-left,44%);top:var(--battle-info-top,10px);transform:translateX(var(--battle-info-shift,-50%));zoom:var(--battle-info-scale,1)}
#screen-battle.tate.battle-responsive[id="screen-battle"] .cry-bubble{left:var(--battle-cry-left,60%);top:var(--battle-cry-top,12%);font-size:var(--battle-cry-font,1.25rem);padding:var(--battle-cry-pady,8px) var(--battle-cry-padx,18px);border-width:var(--battle-cry-border,3px)}
@media(max-width:340px){
 #screen-battle.tate.battle-responsive[id="screen-battle"]:has(.enemy-wrap.twin) .battle-top{display:flex;gap:4px}
 #screen-battle.tate.battle-responsive[id="screen-battle"]:has(.enemy-wrap.twin) .battle-top-right{flex-direction:column;gap:4px}
 #screen-battle.tate.battle-responsive[id="screen-battle"]:has(.enemy-wrap.twin) .stage-label{min-width:96px;padding:2px 4px;font-size:.82rem;line-height:1.2}
 #screen-battle.tate.battle-responsive[id="screen-battle"]:has(.enemy-wrap.twin) .hp{font-size:1.05rem}
 #screen-battle.tate.battle-responsive[id="screen-battle"] .pbtn.pfield .pfuda{padding-left:3px;padding-right:3px}
}

#bMsg>strong,#bMsg>span{display:block}#bMsg>span:empty{display:none}#bMsg .ink-run{font-size:inherit} .pbtn.pfield .pc{width:var(--battle-card-width)}
.aff-help{position:absolute;top:10px;left:10px;z-index:60;width:38px;height:38px;border-radius:50%;
    border:2px solid #fff;background:rgba(0,0,0,.3);color:#fff;font-weight:900;font-size:1.05rem;cursor:pointer;
    -webkit-tap-highlight-color:transparent}
#guide p{margin-top:12px;line-height:1.7}
