

:root{--ink:#24221f;--muted:#80796d;--paper:#f5f1e7;--panel:#fffdf8;--line:#ded9cd;--lime:#d9ec9a;--orange:#f0b483;--shadow:#25231f}*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font-family:Arial,Helvetica,sans-serif}button,input{font:inherit}button{cursor:pointer}header{background:#25251f;color:#fff; padding:18px max(24px,calc((100vw - 1160px)/2));display:flex;align-items:center;justify-content:space-between;gap:16px}.brand{font-family:'Courier New',monospace;font-weight:700;font-size:22px;letter-spacing:-1px}.brand b{color:#d6ee94}.topright{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.pill{border:1px solid #68675c;border-radius:30px;padding:9px 15px;font-size:12px;font-weight:700}.profile{background:#4b4a41;border-radius:100%;width:35px;height:35px;display:grid;place-items:center;font-size:17px}.layout{max-width:1160px;margin:35px auto;padding:0 22px}.eyebrow{font:700 11px 'Courier New',monospace;letter-spacing:2px;text-transform:uppercase;color:#80796d}.heading{display:flex;justify-content:space-between;align-items:end;gap:18px;margin-bottom:24px}h1{font-size:clamp(32px,4vw,47px);line-height:1.08;letter-spacing:-2px;margin:9px 0}p{line-height:1.6}.sub{margin:0;color:var(--muted);font-size:14px}.columns{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(300px,1fr);gap:21px}.card{background:var(--panel);border:1.5px solid var(--line);border-radius:13px;padding:22px;box-shadow:0 3px 0 #e7e1d6}.card h2{font-size:16px;letter-spacing:-.4px;margin:0}.cardhead{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.tiny{font:700 11px 'Courier New',monospace;color:var(--muted)}.scene{height:255px;background:#e9eddc;border:1.5px solid #d9dfc8;border-radius:8px;position:relative;overflow:hidden;display:flex;align-items:center;justify-content:center;gap:44px}.scene:after{content:'';position:absolute;bottom:30px;left:8%;width:84%;height:2px;background:#cbd3b6}.ground{position:absolute;bottom:17px;font:12px 'Courier New',monospace;color:#a2ae91;letter-spacing:7px}.sun{position:absolute;right:32px;top:24px;width:40px;height:40px;border:2px solid #d0d7b9;border-radius:50%}.sprite{image-rendering:pixelated;flex-shrink:0}.scene .sprite{width:126px;height:126px;position:relative;z-index:1;filter:drop-shadow(0 9px 0 rgba(76,84,58,.12))}.scene .sprite.second{width:104px;height:104px}.versus{font:700 13px 'Courier New',monospace;color:#918f7b;position:relative;z-index:2}.eventTitle{font-size:23px;letter-spacing:-.6px;font-weight:800;margin:20px 0 3px}.eventDesc{color:#777268;font-size:14px;margin:0 0 17px;min-height:45px}.btn{border:2px solid var(--ink);border-radius:8px;background:var(--lime);color:var(--ink);font-weight:800;padding:13px 20px;box-shadow:3px 3px 0 var(--ink);transition:transform .1s,box-shadow .1s}.btn:hover:not(:disabled){transform:translate(2px,2px);box-shadow:1px 1px 0 var(--ink)}.btn:disabled{opacity:.5;cursor:not-allowed}.btn.secondary{background:#fffdf8}.btn.warm{background:#f6d0af}.actionrow{display:flex;gap:10px;flex-wrap:wrap;align-items:center}.progress{display:flex;gap:7px;margin-bottom:20px}.dot{height:11px;flex:1;border:1.5px solid #48463e;background:#dcecad;border-radius:3px}.dot.empty{background:#ebe6dc;border-color:#d6cfc2}.statgrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:19px}.stat{background:#f4f1e8;border-radius:9px;padding:15px}.stat b{font:700 26px 'Courier New',monospace;display:block}.stat span{font-size:11px;font-weight:700;color:#888174;text-transform:uppercase;letter-spacing:1px}.sectionlabel{font:700 12px 'Courier New',monospace;display:flex;align-items:center;justify-content:space-between;margin:18px 0 12px}.collection{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}.creature{border:1.5px solid #e1d9cd;background:#faf8f1;border-radius:9px;min-width:0;padding:12px 3px 9px;text-align:center;position:relative}.creature.active{border:2px solid #34342d;background:#edf1dd}.creature img{width:100%;height:64px;image-rendering:pixelated}.creature strong{font-size:10px;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:5px}.creature small{font:9px 'Courier New',monospace;color:#8b857b}.creature.empty{display:grid;place-items:center;color:#b7b0a5;font-size:22px;min-height:110px;border-style:dashed}.collectionHint{color:var(--muted);font-size:11px;margin:13px 0 0}.bottom{margin-top:20px;display:grid;grid-template-columns:1fr 1fr;gap:20px}.log{list-style:none;padding:0;margin:0}.log li{padding:12px 0;border-bottom:1px solid var(--line);font-size:13px;color:#6f695f}.log li:first-child{padding-top:0}.log li:last-child{border:0}.log b{color:var(--ink)}.note{font-size:13px;color:#797267}.badge{display:inline-block;font:700 10px 'Courier New',monospace;padding:6px 9px;border-radius:4px;background:#f1ddb8}.modalShade{position:fixed;inset:0;background:#24221f9f;z-index:5;display:none;place-items:center;padding:20px}.modalShade.visible{display:grid}.modal{background:var(--panel);border:2px solid var(--ink);box-shadow:7px 7px 0 var(--ink);border-radius:12px;max-width:440px;width:100%;padding:26px}.modal h2{font-size:25px;margin:8px 0}.modal p{font-size:14px;color:#777268}.modal input{width:100%;padding:13px;border:2px solid #d6d0c5;border-radius:6px;margin:9px 0 15px}.modalActions{display:flex;gap:10px;flex-wrap:wrap}.collection .creature:not(.empty){cursor:pointer}.collection .creature:hover{outline:2px solid #9aaf70}.tag{font:700 10px 'Courier New',monospace;color:#7d7568}.footer{margin:25px 0 45px;color:#9d9589;font-size:11px;text-align:center}.detailSprite{display:flex;justify-content:center;background:#edf1df;border-radius:8px;margin:16px 0;padding:12px}.detailSprite img{height:110px;width:110px;image-rendering:pixelated}.mobileHint{display:none}@media(max-width:850px){.columns,.bottom{grid-template-columns:1fr}.heading{align-items:start;flex-direction:column}.layout{margin-top:26px}.collection{gap:7px}.scene{height:235px}.mobileHint{display:block}}@media(max-width:410px){header{padding:14px}.brand{font-size:18px}.pill{padding:7px 8px}.card{padding:16px}.collection{gap:4px}.creature img{height:49px}.creature strong{font-size:8px}}

button:focus-visible,input:focus-visible,.creature:focus-visible{outline:3px solid #58793b;outline-offset:3px}
.creature{cursor:pointer}.creature.empty{cursor:default}

/* Animated world and battle additions */
.sprite,.scene-player .sprite{animation:idleBounce 1.9s ease-in-out infinite;transform-origin:bottom center}@keyframes idleBounce{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}.collection .sprite{animation-duration:2.2s}.collection .creature:nth-child(2) .sprite{animation-delay:-.5s}.collection .creature:nth-child(3) .sprite{animation-delay:-1s}.scene-figures{display:flex;align-items:center;justify-content:center;gap:26px;position:relative;z-index:2;width:100%;height:100%}.scene-player{display:flex;align-items:center;justify-content:center;width:40%}.scenery{position:relative;z-index:1;image-rendering:pixelated;height:128px;width:128px;object-fit:contain}.scenery-tree{height:144px;width:144px}.scenery-merchant{height:140px;width:140px}.scenery-chest,.scenery-spring{height:96px;width:96px}.market-offer{position:absolute;right:14px;bottom:18px;display:flex;align-items:center;flex-direction:column;z-index:3;background:#ffffffad;padding:6px;border-radius:5px}.market-offer .sprite{width:52px;height:52px}.market-offer span{font:700 10px 'Courier New',monospace}.stars{color:#a87929;letter-spacing:1px}.collection small .stars{font-size:9px}.battle-scene{height:290px}.fighter{display:flex;flex-direction:column;align-items:center;justify-content:flex-end;position:relative;min-width:0;flex:1;height:245px;padding-top:6px}.fighter .sprite-wrap{height:132px;display:grid;place-items:center}.fighter .sprite{width:118px;height:118px}.fighter.enemy .sprite{width:108px;height:108px}.fighter-meta{text-align:center;font:11px 'Courier New',monospace}.fighter-meta strong{display:block;font:700 14px Arial,sans-serif;overflow:hidden;text-overflow:ellipsis;max-width:145px}.fighter-meta span{white-space:nowrap}.hp-track{height:9px;background:#b5b8a7;width:90%;border:1px solid #424337;border-radius:3px;overflow:hidden;margin:7px 0 4px}.hp-track>div{height:100%;background:#7fb858;transition:width .38s ease}.fighter small{font:10px 'Courier New',monospace}.fighter .damage-layer{position:absolute;top:75px;left:50%;pointer-events:none;z-index:9}.floating-number{position:absolute;left:-28px;top:0;color:#ad4338;font:900 26px 'Courier New',monospace;text-shadow:2px 2px #fff;animation:damageFloat .85s ease-out forwards;white-space:nowrap}.floating-number.healing{color:#4d8a39}@keyframes damageFloat{0%{opacity:0;transform:translateY(13px) scale(.7)}20%{opacity:1;transform:translateY(-3px) scale(1.2)}100%{opacity:0;transform:translateY(-55px) scale(1)}}.sprite-wrap.impact{animation:hitShake .33s linear}@keyframes hitShake{25%{transform:translateX(-7px)}60%{transform:translateX(7px)}100%{transform:translateX(0)}}.battle-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;width:100%}.battle-actions .btn{padding:11px 9px}.battle-actions small{display:block;font-size:10px;font-weight:500;margin-top:4px}.reorder-bar{display:flex;align-items:center;gap:8px;margin:0 0 16px;font-size:12px}.reorder-bar .btn{padding:8px 12px}.fighter .sprite{animation-duration:1.7s}.fighter.enemy .sprite{animation-delay:-.8s}@media(max-width:500px){.scene-figures{gap:4px}.fighter .sprite{width:90px;height:90px}.fighter .sprite-wrap{height:108px}.fighter-meta strong{font-size:12px}.scene-player .sprite{width:105px;height:105px}.scenery{width:125px}.market-offer{right:2px;bottom:3px}.battle-scene{height:275px}}@media(prefers-reduced-motion:reduce){.sprite,.scene-player .sprite{animation:none}.floating-number{animation:none}}

.header-note{}

.sun,.ground{display:none}.scene:after{display:none}.scene{height:265px;gap:16px;background:#eef1e3}.scene-figures{gap:16px}.scene-player{width:32%}.scene-player .sprite{width:118px;height:118px}.scenery{position:relative;z-index:1;image-rendering:pixelated;height:150px;width:250px;object-fit:contain}.scenery-tree,.scenery-chest,.scenery-merchant,.scenery-spring,.scenery-river,.scenery-wagon,.scenery-berries{height:150px;width:250px}.market-offer{right:10px;bottom:10px;background:#ffffffe0}.battle-scene{height:290px}@media(max-width:500px){.scene{height:245px}.scene-player{width:26%}.scene-player .sprite{width:92px;height:92px}.scenery{width:180px;height:120px}.market-offer{right:0;bottom:0}}

/* V5 scene system */
.scene{height:300px;background:#eef1e3}
#sceneSprites{width:100%;height:100%}
.scene-composite,.battle-composite{position:relative;width:100%;height:100%}
.scene-composite .scenery,.battle-composite .scenery{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;z-index:1;image-rendering:pixelated}
.scene-player.centered{position:absolute;left:50%;bottom:28px;transform:translateX(-50%);z-index:3;width:auto}
.scene-player.centered .sprite{width:120px;height:120px;filter:drop-shadow(0 9px 0 rgba(76,84,58,.12))}
.market-offer{right:14px;bottom:14px;z-index:4}
.battle-overlay{position:absolute;inset:0;z-index:3;display:flex;align-items:center;justify-content:center;gap:12px;padding:8px 20px}
.battle-composite .scenery{opacity:.35}
.scenery-forest,.scenery-mountains,.scenery-desert,.scenery-beach,.scenery-chest,.scenery-merchant,.scenery-spring,.scenery-river,.scenery-wagon,.scenery-berries,.scenery-weather-rain,.scenery-weather-heat,.scenery-weather-wind,.scenery-weather-fog{width:100%;height:100%}
.fighter{background:#ffffffe6;border-radius:10px;padding:4px 8px 10px;max-width:200px}
.fighter .sprite-wrap{height:120px}
.battle-scene{height:320px}
@media(max-width:700px){
  .scene{height:270px}
  .scene-player.centered .sprite{width:96px;height:96px}
  .battle-overlay{padding:6px;gap:6px}
  .fighter{max-width:150px;padding:4px 4px 8px}
  .fighter .sprite{width:86px;height:86px}
  .fighter.enemy .sprite{width:82px;height:82px}
}

/* V6: animated weather, mutation displays, camp supplies */
.scene-meta{position:absolute;left:10px;right:10px;top:10px;z-index:9;display:flex;justify-content:space-between;font:700 10px 'Courier New',monospace;pointer-events:none;color:#444}
.weather-overlay{position:absolute;inset:0;overflow:hidden;z-index:5;pointer-events:none;opacity:0;transition:opacity .25s}
.weather-overlay.weather-rain{opacity:1;background-image:repeating-linear-gradient(110deg,transparent 0 15px,rgba(30,30,30,.38) 15px 17px, transparent 17px 29px);background-size:31px 65px;animation:pixelRain .45s linear infinite}
@keyframes pixelRain{to{background-position:-31px 65px}}
.weather-overlay.weather-fog{opacity:1;background:repeating-linear-gradient(0deg,transparent 0 22px,rgba(255,255,255,.75) 22px 39px,transparent 39px 70px);background-size:160px 150px;animation:hazeMove 6s linear infinite}
@keyframes hazeMove{to{background-position:160px -30px}}
.weather-overlay.weather-heat{opacity:1;background:repeating-linear-gradient(90deg,transparent 0 22px,rgba(255,255,255,.25) 22px 35px,transparent 35px 66px);background-size:90px 100px;animation:heatRise 4s ease-in-out infinite}
@keyframes heatRise{50%{background-position:12px -70px;transform:skewX(2deg)}100%{background-position:0 -140px}}
.weather-overlay.weather-wind{opacity:1;background:repeating-linear-gradient(0deg,transparent 0 22px,rgba(20,20,20,.18) 22px 24px,transparent 24px 50px);background-size:180px 80px;animation:windGust 1.3s linear infinite}
@keyframes windGust{to{background-position:180px -20px}}
.mutation-glyph{position:absolute;right:-9px;top:15px;color:#000;font:900 26px 'Courier New',monospace;text-shadow:2px 1px #fff;z-index:8;pointer-events:none}
.scene-player,.sprite-wrap{position:relative}.sprite-wrap .mutation-glyph{right:2px;top:18px}
.inventory-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}.item{border:1px solid var(--line);background:#f7f4e9;padding:9px;text-align:left;border-radius:6px;font:700 11px 'Courier New',monospace}.item b{float:right}.item small{display:block;font-size:9px;color:#777;margin-top:5px}.item:hover{border-color:#333}
.collection .creature small{display:block;line-height:1.45}.creature{padding-bottom:8px}
@media(prefers-reduced-motion:reduce){.weather-overlay{animation:none!important}}

.scene.night-scene{background:#d8dce0}.scene.night-scene .scenery{filter:contrast(1.05)}.scene.night-scene:before{content:'✦  ·  ✦';position:absolute;top:33px;right:23%;font:700 15px monospace;color:#7d8697;z-index:4;pointer-events:none}

.weather-overlay.weather-rain{background-image:url('assets/world/rain-pixels.svg');background-size:80px 96px;animation:rainfallPixels .55s steps(6,end) infinite}
@keyframes rainfallPixels{to{background-position:0 96px}}

/* V7 procedural canvas sprites and snow */
canvas.procedural{image-rendering:pixelated;image-rendering:crisp-edges;object-fit:contain;aspect-ratio:1/1;background:transparent}
.collection canvas.procedural{height:64px;width:100%}
.detailSprite canvas.procedural{height:110px;width:110px}
.scene-player canvas.procedural{width:132px;height:132px}
.fighter canvas.procedural{width:118px;height:118px}
.market-offer canvas.procedural{height:54px;width:54px}
#activeDetail canvas.procedural{height:63px;width:63px}
.weather-overlay.weather-snow{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:5}
.weather-snow .snowflake{position:absolute;display:block;width:5px;height:5px;top:-12px;background:#24221f;animation:snowFall linear infinite}
@keyframes snowFall{0%{transform:translate(0,-10px)}100%{transform:translate(35px,320px)}}
@media(prefers-reduced-motion:reduce){.weather-snow .snowflake{animation:none;top:25%}}
/* V8 immersive adventure layout */
.v8-layout{display:flex;flex-direction:column;gap:22px}
.v8-layout > .card{width:100%}
.v8-layout > aside.card{max-width:none}
.v8-layout .scene{height:clamp(430px,50vw,570px);background:#f3f3ed;border:2px solid #24221f;isolation:isolate}
.v8-layout .scene-composite .scenery,.v8-layout .battle-composite .scenery{width:100%;height:82%;top:2%;object-fit:fill}
.v8-layout .scene-player.centered{bottom:145px}
.v8-layout .scene-player.centered canvas.sprite{width:128px;height:128px}
.v8-layout .scene-meta{z-index:5;top:16px}
.v8-layout .weather-overlay{z-index:4;pointer-events:none}
.v8-layout .canvas-controls{position:absolute;bottom:0;left:0;right:0;padding:13px 22px 15px;background:#fffffff0;border-top:2px solid #24221f;z-index:8;display:flex;flex-direction:column;gap:6px}
.v8-layout .canvas-controls .eventTitle{margin:0;font-size:19px}
.v8-layout .canvas-controls .eventDesc{margin:0;min-height:0;font-size:13px}
.v8-layout .canvas-controls .actionrow{padding-top:5px}
.v8-layout .game-hud{display:flex;align-items:start;justify-content:space-between;flex-wrap:wrap;gap:14px;margin-bottom:12px}
.v8-layout .hud-stats{display:flex;gap:9px;margin:0;flex-wrap:wrap}
.v8-layout .hud-stats .stat{min-width:102px;padding:9px 11px;border:1px solid #ddd7cc}
.v8-layout .hud-stats .stat b{font-size:20px}
.v8-layout .hud-inventory{flex:1;max-width:560px;min-width:280px}
.v8-layout .inventory-grid{margin:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px}
.v8-layout .inventory-grid .item{min-width:0;padding:8px 4px;font-size:11px}
.v8-layout .adventure-tools{margin-left:auto;display:flex;gap:9px;flex-wrap:wrap}
.v8-layout .adventure-tools .btn{padding:7px 10px;box-shadow:2px 2px 0 var(--ink);font-size:12px}
.v8-layout .battle-scene{height:clamp(460px,52vw,590px)}
.v8-layout .battle-overlay{bottom:145px;top:30px}
.v8-layout .market-offer{bottom:135px}
.v8-layout .collection{grid-template-columns:repeat(5,minmax(0,1fr));max-width:900px}
.v8-layout .creature{touch-action:pan-y}
.v8-layout .creature.drag-over{outline:3px dashed #292920;outline-offset:3px}
.v8-layout .creature.dragging{opacity:.45}
.v8-layout .bottom{display:block}
.journal-modal{max-height:330px;overflow-y:auto;margin:16px 0}
#journal[hidden]{display:none}
canvas.procedural[data-motion="floater"],canvas.procedural[data-motion="cyclops"]{animation:floatIdle 2.6s ease-in-out infinite!important}
canvas.procedural[data-motion="hopper"]{animation:hopIdle 1.2s steps(3) infinite!important}
canvas.procedural[data-motion="wiggler"]{animation:wiggleIdle 1.3s ease-in-out infinite!important}
canvas.procedural[data-motion="walker"]{animation:walkIdle 2.3s steps(5) infinite!important}
@keyframes floatIdle{0%,100%{transform:translateY(0)}50%{transform:translateY(-10px)}}
@keyframes hopIdle{0%,100%{transform:translateY(0) scaleY(1)}40%{transform:translateY(-13px) scaleY(1.07)}80%{transform:translateY(0) scaleY(.93)}}
@keyframes wiggleIdle{0%,100%{transform:rotate(-5deg)}50%{transform:rotate(5deg)}}
@keyframes walkIdle{0%,100%{transform:translateX(-3px)}50%{transform:translateX(3px)}}
@media(max-width:700px){.v8-layout .game-hud{flex-direction:column}.v8-layout .hud-inventory{width:100%;min-width:0}.v8-layout .scene{height:480px}.v8-layout .canvas-controls{padding:12px}.v8-layout .scene-player.centered{bottom:165px}.v8-layout .scene-player.centered canvas.sprite{width:95px;height:95px}.v8-layout .battle-overlay{bottom:175px}.v8-layout .adventure-tools .btn{font-size:10px}.v8-layout .collection{grid-template-columns:repeat(5,minmax(0,1fr))}}
@media(prefers-reduced-motion:reduce){canvas.procedural[data-motion]{animation:none!important}}

/* V9 compact scene action dock */
.v8-layout .canvas-controls{padding:8px 12px 10px;gap:3px;max-height:168px;overflow-y:auto}
.v8-layout .canvas-controls .eventTitle{font-size:15px;line-height:1.15}
.v8-layout .canvas-controls .eventDesc{font-size:11px;line-height:1.3}
.v8-layout .canvas-controls .actionrow{padding-top:2px;gap:5px;align-items:center}
.v8-layout .canvas-controls .btn{padding:5px 8px;font-size:11px;box-shadow:1px 1px 0 var(--ink);border-width:1px;border-radius:4px}
.v8-layout .canvas-controls .battle-actions{display:flex;flex-wrap:wrap;gap:5px;width:auto}
.v8-layout .canvas-controls .battle-actions .btn{padding:5px 8px;min-width:0;white-space:nowrap}
.v8-layout .canvas-controls .battle-actions small{display:inline;font-size:9px;margin-left:4px}
.v8-layout .battle-overlay{bottom:98px}
.v8-layout .scene-player.centered{bottom:122px}
.v8-layout .scene{min-height:470px}
.v8-layout .collectionHint{font-size:12px}
@media(max-width:700px){.v8-layout .canvas-controls{max-height:190px}.v8-layout .scene-player.centered{bottom:155px}.v8-layout .battle-overlay{bottom:150px}}

/* V9.1: battlers belong to the environment, without white cards */
.v8-layout .battle-overlay .fighter,
.v8-layout .battle-composite .fighter{
 background:transparent!important;
 border:0!important;
 border-radius:0!important;
 box-shadow:none!important;
 overflow:visible;
}
.v8-layout .battle-composite .scenery{opacity:1}
.v8-layout .battle-overlay{gap:clamp(10px,4vw,50px)}
.v8-layout .fighter .fighter-meta,.v8-layout .fighter small{
 text-shadow:1px 1px 0 #fff,-1px -1px 0 #fff,0 0 4px #fff;
}
.v8-layout .fighter .hp-track{box-shadow:0 0 0 2px #f6f4ed}
.v8-layout .fighter .sprite-wrap{position:relative;z-index:3;will-change:transform}
.v8-layout .fighter .sprite-wrap.lunge-right{animation:contactForward .45s cubic-bezier(.15,.8,.3,1)!important}
.v8-layout .fighter .sprite-wrap.lunge-left{animation:contactBack .45s cubic-bezier(.15,.8,.3,1)!important}
@keyframes contactForward{0%,100%{transform:translateX(0)}45%{transform:translateX(clamp(45px,8vw,105px)) scale(1.08)}70%{transform:translateX(clamp(35px,7vw,90px))}}
@keyframes contactBack{0%,100%{transform:translateX(0)}45%{transform:translateX(clamp(-105px,-8vw,-45px)) scale(1.08)}70%{transform:translateX(-40px)}}
.v8-layout .fighter .sprite-wrap.target-hit{filter:drop-shadow(3px 0 0 #222);animation:hitShake .28s steps(3)!important}
.pixel-beam{position:absolute;z-index:7;height:7px;pointer-events:none;transform-origin:left center;background:repeating-linear-gradient(90deg,#111 0 12px,#fff 12px 17px,#111 17px 23px);outline:2px solid #fff;animation:beamShoot .42s steps(5) forwards}
@keyframes beamShoot{0%{clip-path:inset(0 100% 0 0);opacity:1}50%{clip-path:inset(0 0 0 0);opacity:1}100%{clip-path:inset(0 0 0 0);opacity:0}}
@media(prefers-reduced-motion:reduce){.pixel-beam{animation:none}.v8-layout .fighter .sprite-wrap.lunge-right,.v8-layout .fighter .sprite-wrap.lunge-left{animation:none!important}}

/* V9.2 - scenery recedes and merchants idle */
.v8-layout .scene-composite .scenery,.v8-layout .battle-composite .scenery{opacity:.5!important;z-index:0;transform:scale(.94);transform-origin:center center}
.v8-layout .scene-composite .scene-player,.v8-layout .battle-overlay{z-index:3}
.v8-layout .scenery-merchant{animation:merchantFloat 1.7s ease-in-out infinite;transform-origin:center center}
@keyframes merchantFloat{0%,100%{transform:translateY(0) scale(.94)}50%{transform:translateY(-5px) scale(.94)}}
@media(prefers-reduced-motion:reduce){.v8-layout .scenery-merchant{animation:none}}

/* V9.3 mutation growth and event / combat effects */
.scene-fx{position:absolute;inset:0;pointer-events:none;z-index:2}
.scene-fx.enemy-side{left:auto;right:16%;top:48%;width:100px;height:72px;inset:auto 16% 18% auto}
.scene-player canvas.procedural[data-growth="1"], .fighter canvas.procedural[data-growth="1"]{transform:scale(1.05)}
.scene-player canvas.procedural[data-growth="2"], .fighter canvas.procedural[data-growth="2"]{transform:scale(1.12)}
.scene-player canvas.procedural[data-growth="3"], .fighter canvas.procedural[data-growth="3"]{transform:scale(1.22)}
.scene-player canvas.procedural[data-growth="4"], .fighter canvas.procedural[data-growth="4"]{transform:scale(1.34)}
.cave-shelter{display:flex;align-items:flex-end;justify-content:center}
.cave-shelter .cave-mouth{position:absolute;bottom:120px;left:50%;transform:translateX(-50%);width:132px;height:78px;background:#171714;clip-path:polygon(0 100%,12% 48%,27% 18%,50% 0,73% 18%,88% 48%,100% 100%);opacity:.88}
.cave-shelter .campfire{position:absolute;bottom:135px;left:50%;transform:translateX(-50%);display:flex;gap:3px;align-items:flex-end}
.campfire span{display:block;width:8px;height:12px;background:#171714;animation:fireFlicker 1s steps(2) infinite}
.campfire span:nth-child(2){height:16px;animation-delay:.15s}.campfire span:nth-child(3){height:10px;animation-delay:.3s}
@keyframes fireFlicker{0%,100%{transform:translateY(0) scaleY(1)}50%{transform:translateY(-3px) scaleY(1.2)}}
.push-trail span{position:absolute;bottom:170px;left:50%;width:90px;height:2px;background:#171714;opacity:.5;animation:trailPush 1.2s linear infinite}
.push-trail span:nth-child(1){margin-left:-130px;animation-delay:0s}.push-trail span:nth-child(2){margin-left:-30px;animation-delay:.25s}.push-trail span:nth-child(3){margin-left:70px;animation-delay:.5s}
@keyframes trailPush{0%{transform:translateX(-18px);opacity:0}25%,75%{opacity:.5}100%{transform:translateX(28px);opacity:0}}
.coin-pop .coin{position:absolute;bottom:168px;left:50%;width:10px;height:10px;background:#171714;animation:coinPop .85s steps(3) infinite}
.coin-pop .coin-a{margin-left:-48px}.coin-pop .coin-b{margin-left:-7px;animation-delay:.15s}.coin-pop .coin-c{margin-left:34px;animation-delay:.3s}
@keyframes coinPop{0%{transform:translateY(0)}50%{transform:translateY(-22px)}100%{transform:translateY(0)}}
.artifact-glow span{position:absolute;bottom:165px;left:50%;width:12px;height:12px;border:2px solid #171714;animation:artifactPulse 1.25s linear infinite}
.artifact-glow span:nth-child(1){margin-left:-6px}.artifact-glow span:nth-child(2){margin-left:-24px;animation-delay:.2s}.artifact-glow span:nth-child(3){margin-left:12px;animation-delay:.4s}
@keyframes artifactPulse{0%{transform:scale(.5);opacity:.8}100%{transform:scale(2.2);opacity:0}}
.bones-remains{position:absolute;bottom:135px;display:flex;gap:8px;align-items:center;justify-content:center;width:90px;height:48px}
.bones-remains span{display:block;background:#171714}.bones-remains span:nth-child(1){width:26px;height:4px;box-shadow:-4px -4px 0 #171714,4px 4px 0 #171714}.bones-remains span:nth-child(2){width:18px;height:18px;border-radius:50%}.bones-remains span:nth-child(3){width:20px;height:4px;box-shadow:-4px 4px 0 #171714,4px -4px 0 #171714}
.transient-bones{animation:bonesAppear .7s ease-out forwards}@keyframes bonesAppear{0%{opacity:0;transform:scale(.7)}100%{opacity:1;transform:scale(1)}}
.loot-fly{position:absolute;left:var(--sx);top:var(--sy);width:8px;height:8px;z-index:12;pointer-events:none;animation:lootFly .72s cubic-bezier(.2,.75,.25,1) forwards}
.loot-fly.chunk{background:#171714;box-shadow:4px 0 0 #171714,0 4px 0 #171714}.loot-fly.gold{background:#171714;border-radius:50%}
@keyframes lootFly{0%{transform:translate(0,0) scale(1);opacity:1}100%{transform:translate(calc(var(--tx) - var(--sx)), calc(var(--ty) - var(--sy))) scale(.4);opacity:0}}
.attack-slash,.attack-bite,.attack-spike,.attack-bash,.attack-ring,.attack-heal,.attack-kick-arc{position:absolute;z-index:8;pointer-events:none}
.attack-slash{width:36px;height:24px}.attack-slash:before,.attack-slash:after{content:"";position:absolute;width:26px;height:3px;background:#171714}.attack-slash:before{transform:rotate(28deg);top:6px;left:4px}.attack-slash:after{transform:rotate(-28deg);top:14px;left:8px}
.attack-spike{width:24px;height:12px}.attack-spike:before{content:"";position:absolute;inset:0;background:linear-gradient(90deg,#171714 0 75%,transparent 75%)}
.attack-bite{width:32px;height:32px}.attack-bite:before,.attack-bite:after{content:"";position:absolute;width:18px;height:18px;border:4px solid #171714;border-right:0;border-bottom:0}.attack-bite:before{left:0;top:3px;transform:rotate(-45deg)}.attack-bite:after{right:0;bottom:3px;transform:rotate(135deg)}
.attack-bash{width:36px;height:36px;border:4px solid #171714;border-radius:50%;animation:bashFlash .45s ease-out forwards}@keyframes bashFlash{0%{transform:scale(.5);opacity:.9}100%{transform:scale(1.2);opacity:0}}
.attack-ring{width:24px;height:24px;border:3px solid #171714;border-radius:50%;animation:ringPulse .45s ease-out forwards}@keyframes ringPulse{0%{transform:scale(.5);opacity:1}100%{transform:scale(2.6);opacity:0}}
.attack-heal{width:24px;height:24px}.attack-heal:before,.attack-heal:after{content:"";position:absolute;background:#171714}.attack-heal:before{left:10px;top:2px;width:4px;height:20px}.attack-heal:after{left:2px;top:10px;width:20px;height:4px}
.attack-kick-arc{height:8px;border-top:3px dashed #171714;animation:kickArc .5s linear forwards}@keyframes kickArc{0%{opacity:0}20%,80%{opacity:1}100%{opacity:0}}
.pixel-beam.ruin-beam{height:11px;outline-width:3px;background:repeating-linear-gradient(90deg,#111 0 8px,#fff 8px 11px,#111 11px 20px)}
.to-left{transform:scaleX(-1)}
.prey-eaten{animation:preyFade .62s ease-in forwards}@keyframes preyFade{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.35)}}
@media(prefers-reduced-motion:reduce){.scene-fx *, .loot-fly, .attack-slash, .attack-bite, .attack-spike, .attack-bash, .attack-ring, .attack-heal, .attack-kick-arc{animation:none!important}}

/* V9.4 clouds, deeper scenery, devour animation, stronger monster growth */
.v8-layout .scene-composite .scenery,.v8-layout .battle-composite .scenery{opacity:.62!important;transform:scale(.98);image-rendering:pixelated}
.cloud-layer{position:absolute;inset:0;z-index:1;pointer-events:none;overflow:hidden}
.cloud{position:absolute;top:14px;width:42px;height:10px;background:#171714;opacity:.17;box-shadow:8px -4px 0 #171714,18px -2px 0 #171714,30px 0 0 #171714,10px 4px 0 #171714,22px 4px 0 #171714;animation:cloudDrift linear infinite}
.cloud-1{left:-70px;top:12px;animation-duration:21s}
.cloud-2{left:-110px;top:28px;transform:scale(1.25);animation-duration:27s;animation-delay:-8s}
.cloud-3{left:-85px;top:20px;transform:scale(.88);animation-duration:18s;animation-delay:-13s}
@keyframes cloudDrift{0%{transform:translateX(0)}100%{transform:translateX(520px)}}
@media(prefers-reduced-motion:reduce){.cloud{animation:none}}
.v8-layout .fighter .sprite-wrap.devour-right{animation:devourRight .95s cubic-bezier(.2,.7,.25,1) forwards!important}
@keyframes devourRight{0%{transform:translateX(0)}50%{transform:translateX(clamp(60px,10vw,125px)) scale(1.1)}100%{transform:translateX(clamp(95px,14vw,165px)) scale(1.08)}}
.scene-player canvas.procedural[data-growth="3"], .fighter canvas.procedural[data-growth="3"]{transform:scale(1.28)}
.scene-player canvas.procedural[data-growth="4"], .fighter canvas.procedural[data-growth="4"]{transform:scale(1.5);filter:drop-shadow(0 0 2px rgba(0,0,0,.2))}
.battle-composite.eating-scene .enemy{opacity:1}
.battle-composite.eating-scene .bones-remains{z-index:9}

/* V9.5 — clearer scenery, richer events, and monster escalation */
.v8-layout .scene-composite .scenery,
.v8-layout .battle-composite .scenery{
  opacity:.38 !important;
  z-index:0;
  transform:scale(.97);
  transform-origin:center center;
}
.v8-layout .scene-composite .scene-player,
.v8-layout .battle-overlay{z-index:3}
.v8-layout .fighter .fighter-meta,
.v8-layout .fighter small{
  text-shadow:1px 1px 0 #fff,-1px -1px 0 #fff,0 0 6px #fff,0 0 12px rgba(255,255,255,.75);
}
.v8-layout .fighter .hp-track{background:#d2d6c3;box-shadow:0 0 0 2px rgba(255,255,255,.9)}
.v8-layout .battle-overlay{padding:8px 14px 0;align-items:flex-end}
.v8-layout .fighter .sprite-wrap{height:128px}
.scene-player canvas.procedural[data-growth="4"], .fighter canvas.procedural[data-growth="4"]{transform:scale(1.62);filter:drop-shadow(0 0 2px rgba(0,0,0,.18))}
.scene-player canvas.procedural[data-growth="5"], .fighter canvas.procedural[data-growth="5"]{transform:scale(1.84);filter:drop-shadow(0 0 3px rgba(0,0,0,.22))}

.wave-ripples span{position:absolute;bottom:136px;left:50%;height:2px;background:#171714;opacity:.45;animation:waveSlide 2.6s linear infinite}
.wave-ripples span:nth-child(1){width:44px;margin-left:8px;animation-delay:0s}
.wave-ripples span:nth-child(2){width:28px;margin-left:36px;bottom:142px;animation-delay:-.8s}
.wave-ripples span:nth-child(3){width:38px;margin-left:56px;bottom:148px;animation-delay:-1.4s}
@keyframes waveSlide{0%{transform:translateX(-4px)}50%{transform:translateX(8px)}100%{transform:translateX(-4px)}}

.spore-drift span{position:absolute;bottom:156px;left:50%;width:4px;height:4px;background:#171714;opacity:.35;animation:sporeFloat 3.2s linear infinite}
.spore-drift span:nth-child(1){margin-left:-46px}
.spore-drift span:nth-child(2){margin-left:-18px;animation-delay:-.8s}
.spore-drift span:nth-child(3){margin-left:12px;animation-delay:-1.4s}
.spore-drift span:nth-child(4){margin-left:38px;animation-delay:-2s}
@keyframes sporeFloat{0%{transform:translateY(0) scale(1);opacity:0}20%{opacity:.35}100%{transform:translateY(-30px) scale(.8);opacity:0}}

.cave-echo span{position:absolute;bottom:150px;left:50%;width:20px;height:20px;border:2px solid rgba(23,23,20,.55);border-radius:50%;animation:echoPulse 2s linear infinite}
.cave-echo span:nth-child(1){margin-left:-12px}
.cave-echo span:nth-child(2){margin-left:8px;animation-delay:.45s}
.cave-echo span:nth-child(3){margin-left:28px;animation-delay:.9s}
@keyframes echoPulse{0%{transform:scale(.2);opacity:.4}100%{transform:scale(1.5);opacity:0}}

.wagon-dust span{position:absolute;bottom:142px;left:50%;width:8px;height:4px;background:#171714;opacity:.25;animation:dustSkip 1.4s linear infinite}
.wagon-dust span:nth-child(1){margin-left:-34px}
.wagon-dust span:nth-child(2){margin-left:-12px;animation-delay:.3s}
.wagon-dust span:nth-child(3){margin-left:14px;animation-delay:.6s}
@keyframes dustSkip{0%{transform:translate(0,0) scale(1);opacity:0}20%{opacity:.25}100%{transform:translate(14px,-10px) scale(.6);opacity:0}}

.bones-remains{position:absolute;bottom:133px;display:block;width:78px;height:48px}
.bones-remains .skull{position:absolute;left:28px;top:2px;width:18px;height:14px;background:#171714;border-radius:9px 9px 7px 7px}
.bones-remains .skull:before,.bones-remains .skull:after{content:"";position:absolute;top:4px;width:3px;height:3px;background:#eef1e3}
.bones-remains .skull:before{left:4px}.bones-remains .skull:after{right:4px}
.bones-remains .spine{position:absolute;left:35px;top:15px;width:4px;height:20px;background:#171714;box-shadow:0 5px 0 #171714,0 10px 0 #171714}
.bones-remains .rib{position:absolute;top:19px;width:18px;height:4px;background:#171714}
.bones-remains .rib.left{left:14px;transform:rotate(24deg);box-shadow:0 8px 0 #171714}
.bones-remains .rib.right{right:14px;transform:rotate(-24deg);box-shadow:0 8px 0 #171714}

.attack-tentacle{position:absolute;z-index:7;height:6px;pointer-events:none;transform-origin:left center;background:repeating-linear-gradient(90deg,#171714 0 10px,transparent 10px 14px,#171714 14px 24px);clip-path:polygon(0 45%,18% 0,34% 80%,53% 18%,70% 95%,86% 30%,100% 50%,100% 65%,0 65%);animation:tentacleWhip .48s ease-out forwards}
@keyframes tentacleWhip{0%{opacity:0;transform:scaleX(.15)}35%{opacity:1;transform:scaleX(1.08)}100%{opacity:0;transform:scaleX(.92)}}
.bone-bolt{position:absolute;z-index:7;height:5px;pointer-events:none;transform-origin:left center;background:repeating-linear-gradient(90deg,#171714 0 8px,#fff 8px 10px,#171714 10px 18px);outline:1px solid #171714;animation:beamShoot .46s steps(5) forwards}

.market-offer{background:rgba(255,255,255,.82)}
.scenery-merchant{animation:merchantFloat 1.5s ease-in-out infinite;transform-origin:center center}

@media(max-width:700px){
  .scene-player canvas.procedural[data-growth="4"], .fighter canvas.procedural[data-growth="4"]{transform:scale(1.46)}
  .scene-player canvas.procedural[data-growth="5"], .fighter canvas.procedural[data-growth="5"]{transform:scale(1.6)}
}

/* V9.6 blood moon / hp / type polish */
.sun{display:block !important;position:absolute;right:24px;top:18px;width:52px;height:52px;border:0 !important;background:none !important;z-index:5;pointer-events:none}
.sun .core,.sun .moon-core{position:absolute;inset:10px;border-radius:50%;background:#171714;opacity:.92}
.day-sun .rays{position:absolute;inset:0;border-radius:50%;background:conic-gradient(from 0deg,#171714 0 10deg,transparent 10deg 30deg,#171714 30deg 40deg,transparent 40deg 60deg,#171714 60deg 70deg,transparent 70deg 90deg,#171714 90deg 100deg,transparent 100deg 120deg,#171714 120deg 130deg,transparent 130deg 150deg,#171714 150deg 160deg,transparent 160deg 180deg,#171714 180deg 190deg,transparent 190deg 210deg,#171714 210deg 220deg,transparent 220deg 240deg,#171714 240deg 250deg,transparent 250deg 270deg,#171714 270deg 280deg,transparent 280deg 300deg,#171714 300deg 310deg,transparent 310deg 330deg,#171714 330deg 340deg,transparent 340deg 360deg);animation:sunSpin 10s linear infinite;opacity:.55}
@keyframes sunSpin{from{transform:rotate(0)}to{transform:rotate(360deg)}}
.night-moon .moon-core,.blood-moon .moon-core{inset:11px 12px 11px 11px;border-radius:50%;box-shadow:12px 0 0 0 #171714;background:transparent;border:2px solid #171714}
.blood-moon .moon-core{box-shadow:12px 0 0 0 #8f2d2d;border-color:#8f2d2d}
.sun .star{position:absolute;width:4px;height:4px;background:#171714;animation:starTwinkle 2.2s steps(2) infinite}
.sun .star-a{left:6px;top:8px}.sun .star-b{right:2px;top:16px;animation-delay:-.9s}.sun .star-c{right:12px;bottom:5px;animation-delay:-1.5s}
@keyframes starTwinkle{0%,100%{opacity:.25;transform:scale(1)}50%{opacity:1;transform:scale(1.35)}}
.scene.blood-moon-scene{background:#ead7d7}
.scene.blood-moon-scene:before{content:'';position:absolute;inset:0;background:rgba(165,32,32,.08);pointer-events:none;z-index:1}
.scene.night-scene{background:#dce2e5}
.hp-track.high>div{background:#7fb858 !important}.hp-track.mid>div{background:#e0a149 !important}.hp-track.low>div{background:#cb5249 !important}
.type-badge{display:inline-block;padding:2px 7px;border:1px solid #cfc8b9;border-radius:999px;background:#f4f1e8;font:700 10px 'Courier New',monospace;color:#5a5449}
.compact-actions{grid-template-columns:repeat(5,minmax(0,1fr)) !important;gap:7px}.compact-actions .btn{padding:9px 6px;font-size:12px}.compact-actions .btn small{font-size:9px}.compact-actions .flee-btn{background:#fffdf8}
.scenery-mountains-cave,.scenery-tundra-icecave{width:285px !important;height:170px !important;opacity:.24 !important}
.scenery-mountains-cave,.scenery-tundra-icecave,.scenery-weather-fog,.scenery-weather-snow{filter:opacity(.72)}
.bones-remains{bottom:126px;width:90px;height:58px}.bones-remains .skull{left:26px;top:0;width:24px;height:18px;border-radius:10px 10px 8px 8px}.bones-remains .skull:before,.bones-remains .skull:after{top:5px;width:5px;height:5px}.bones-remains .spine{left:37px;top:20px;width:4px;height:24px;box-shadow:0 6px 0 #171714,0 12px 0 #171714}.bones-remains .rib.left{left:10px;top:26px;width:28px;height:5px;transform:rotate(18deg);box-shadow:0 10px 0 #171714}.bones-remains .rib.right{right:10px;top:25px;width:28px;height:5px;transform:rotate(-18deg);box-shadow:0 10px 0 #171714}
.market-offer{background:rgba(255,255,255,.88)}
.weather-overlay.weather-snow .snowflake{opacity:.66}
@media(max-width:700px){.compact-actions{grid-template-columns:repeat(2,minmax(0,1fr)) !important}.sun{right:12px;top:12px;transform:scale(.85)}}

/* ===== V9.7 visual refinements ===== */
.v8-layout .scene-composite .scenery,
.v8-layout .battle-composite .scenery{opacity:.27 !important;transform:scale(.84) translateY(6px) !important;transform-origin:center center}
.scene-player,.battle-overlay{z-index:4}
.sun{right:14px;top:8px;width:92px;height:92px;z-index:4}
.day-sun .core{background:#181814}
.day-sun.sunrise .core,.day-sun.sunset .core{background:#8d5d29;opacity:.75}
.day-sun.sunrise .rays,.day-sun.sunset .rays{opacity:.35}
.night-moon .moon-core,.blood-moon .moon-core{inset:16px 18px 16px 16px;border-width:3px;box-shadow:18px 0 0 0 #171714}
.blood-moon .moon-core{box-shadow:18px 0 0 0 #8f2d2d}
.scene.sunrise-scene{background:linear-gradient(#f3e1c2,#eef1e3)}
.scene.sunset-scene{background:linear-gradient(#efd5c9,#eef1e3)}
.scene.sunrise-scene:before,.scene.sunset-scene:before{content:'';position:absolute;inset:0;pointer-events:none;z-index:0;background:linear-gradient(transparent,rgba(223,163,95,.07))}
.scene.night-scene{background:#dbe0e4}
.scene.blood-moon-scene{background:#ead7d7}
.scene.night-scene:after,.scene.blood-moon-scene:after{content:'';position:absolute;top:24px;right:26%;width:64px;height:20px;background:radial-gradient(circle at 10% 50%,#6f7788 0 1px,transparent 1px),radial-gradient(circle at 36% 70%,#6f7788 0 1px,transparent 1px),radial-gradient(circle at 58% 30%,#6f7788 0 1.5px,transparent 1.5px),radial-gradient(circle at 82% 60%,#6f7788 0 1px,transparent 1px);opacity:.75;z-index:2;pointer-events:none}
.coin-pop .coin,.loot-fly.gold{background:#c89b3c !important;box-shadow:0 0 0 1px rgba(120,87,14,.15),4px 0 0 #dfb755 !important}
.loot-fly.gold{border-radius:50%}.loot-fly.chunk{background:#8f5740 !important;box-shadow:4px 0 0 #b06c50,0 4px 0 #7a4732 !important}
.pixel-beam.poison-fx,.attack-spike.poison-fx:before{background:linear-gradient(90deg,#517d38 0 70%,transparent 70%) !important}
.attack-bite.blood-fx:before,.attack-bite.blood-fx:after{border-color:#9f3d3d !important;border-right:0;border-bottom:0}
.attack-heal.sun-fx:before,.attack-heal.sun-fx:after{background:#b57f2b !important}
.attack-slash.leaf-fx:before,.attack-slash.leaf-fx:after{background:#567f49 !important}
.boss-glow span{position:absolute;bottom:140px;left:50%;width:16px;height:16px;border:2px solid rgba(143,45,45,.4);animation:artifactPulse 1.3s linear infinite}
.boss-glow span:nth-child(1){margin-left:-8px}.boss-glow span:nth-child(2){margin-left:-28px;animation-delay:.25s}.boss-glow span:nth-child(3){margin-left:12px;animation-delay:.55s}
canvas.procedural[data-idle="float"]{animation:idleFloat 2.1s ease-in-out infinite}
canvas.procedural[data-idle="hop"]{animation:idleHop 1.45s steps(2) infinite}
canvas.procedural[data-idle="wiggle"]{animation:idleWiggle 1.7s ease-in-out infinite}
canvas.procedural[data-idle="dance"]{animation:idleDance 1.8s ease-in-out infinite}
canvas.procedural[data-idle="twirl"]{animation:idleTwirl 2.6s ease-in-out infinite}
canvas.procedural[data-idle="squash"]{animation:idleSquash 1.8s ease-in-out infinite}
canvas.procedural[data-idle="bounce"]{animation:idleBounce 1.9s ease-in-out infinite}
@keyframes idleFloat{0%,100%{transform:translateY(-1px)}50%{transform:translateY(-8px)}}
@keyframes idleHop{0%,100%{transform:translateY(0)}40%{transform:translateY(-10px)}60%{transform:translateY(-2px)}}
@keyframes idleWiggle{0%,100%{transform:translateX(0)}25%{transform:translateX(-3px)}75%{transform:translateX(3px)}}
@keyframes idleDance{0%,100%{transform:translateY(0) rotate(0)}25%{transform:translateY(-4px) rotate(-4deg)}75%{transform:translateY(-4px) rotate(4deg)}}
@keyframes idleTwirl{0%,100%{transform:rotate(0)}50%{transform:rotate(8deg) translateY(-3px)}}
@keyframes idleSquash{0%,100%{transform:scale(1,1)}50%{transform:scale(1.12,.88) translateY(2px)}}
@media(prefers-reduced-motion:reduce){canvas.procedural[data-idle]{animation:none!important}}
.compact-actions .btn{font-size:11px}

/* ===== V9.7.1 combat guide, icons, and lunar polish ===== */
.type-icon{display:inline-grid;place-items:center;width:1.3em;height:1.3em;border-radius:999px;margin-right:4px;font-size:1.08em;line-height:1;font-weight:900;vertical-align:-0.18em;border:1px solid rgba(0,0,0,.08);box-shadow:inset 0 -1px 0 rgba(0,0,0,.08)}
.type-moss{background:#d7e8c0;color:#4f7f3d}.type-spore{background:#efe3bc;color:#8c6b28}.type-crag{background:#ddd9d5;color:#64605d}.type-echo{background:#ddd5f1;color:#6a5da4}.type-dust{background:#ead9c8;color:#9b7244}.type-shell{background:#d9edf0;color:#4b7a87}.type-salt{background:#ececec;color:#7b7b7b}
.type-badge{display:inline-flex !important;align-items:center;gap:4px;padding:3px 8px;font-size:11px}
.fighter-meta strong .type-icon,.tag .type-icon,.market-offer .type-icon,.collection small .type-icon{font-size:1.12em}
.combat-guide-block{margin-top:16px;padding-top:14px;border-top:1px solid var(--line)}
.combat-guide-block h3{margin:0 0 8px;font-size:14px}.combat-guide-block p{font-size:12px;margin:0 0 10px;color:#756e63}
.type-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:8px;margin:8px 0 10px}.type-card{border:1px solid #e1d9cd;border-radius:10px;background:#faf8f1;padding:8px 10px;font-size:11px}.type-card b{display:block;margin-bottom:4px}.type-card small{display:block;color:#7c7569;line-height:1.45}
.battle-hint{grid-column:1/-1;font-size:11px;color:#6b6458;background:#f7f4ec;border:1px solid #e2dacb;border-radius:8px;padding:7px 9px;line-height:1.45}
.compact-actions{grid-template-columns:repeat(6,minmax(0,1fr)) !important}
.compact-actions .wide{grid-column:span 2}
.switch-choice{display:flex;justify-content:space-between;align-items:center;gap:12px;width:100%}
.switch-choice small{display:block;color:#7a7469;font-size:10px}
.sun{overflow:visible}.day-sun .rays{z-index:0 !important}.day-sun .core,.day-sun .moon-core,.night-moon .moon-shape,.blood-moon .moon-shape{position:absolute;z-index:1}
.sun .core{inset:14px;border-radius:50%}.day-sun.sunrise .core,.day-sun.sunset .core{background:#b17d35}
.night-moon .moon-shape,.blood-moon .moon-shape{position:absolute;inset:14px;border-radius:50%;background:#171714;overflow:hidden}
.night-moon .moon-shape:after,.blood-moon .moon-shape:after{content:'';position:absolute;top:-2px;bottom:-2px;width:100%;background:#dbe0e4;border-radius:50%}
.blood-moon .moon-shape{background:#8f2d2d}.blood-moon .moon-shape:after{background:#ead7d7}
.night-moon.phase-0 .moon-shape:after,.blood-moon.phase-0 .moon-shape:after{display:none}
.night-moon.phase-1 .moon-shape:after,.blood-moon.phase-1 .moon-shape:after{left:38%}
.night-moon.phase-2 .moon-shape:after,.blood-moon.phase-2 .moon-shape:after{left:8%}
.night-moon.phase-3 .moon-shape:after,.blood-moon.phase-3 .moon-shape:after{left:-18%}
.night-moon.phase-4 .moon-shape:after,.blood-moon.phase-4 .moon-shape:after{left:-35%}
.night-moon.phase-5 .moon-shape:after,.blood-moon.phase-5 .moon-shape:after{left:-18%}
.night-moon.phase-6 .moon-shape:after,.blood-moon.phase-6 .moon-shape:after{left:8%}
.night-moon.phase-7 .moon-shape:after,.blood-moon.phase-7 .moon-shape:after{left:38%}
.night-moon .star,.blood-moon .star{background:#171714}.blood-moon .star{background:#8f2d2d}
.v8-layout .scene-composite .scenery,.v8-layout .battle-composite .scenery{transform:scale(.74) translateY(8px) !important;opacity:.2 !important}
@media(max-width:760px){.compact-actions{grid-template-columns:repeat(3,minmax(0,1fr)) !important}.compact-actions .wide{grid-column:span 3}.type-grid{grid-template-columns:1fr}}

/* V9.7.2 — readable type matrix and integrated switching */
.type-chart-scroll{overflow-x:auto;margin:10px 0 8px;border:1px solid #dfd8ca;border-radius:8px}
.type-chart{border-collapse:collapse;width:100%;min-width:650px;font:700 11px 'Courier New',monospace}
.type-chart caption{position:absolute;clip:rect(0,0,0,0);width:1px;height:1px;overflow:hidden}
.type-chart th,.type-chart td{border:1px solid #e5dfd4;padding:9px 4px;text-align:center}
.type-chart thead th{background:#f0ece3}
.type-chart thead th span{display:block;margin-top:3px;font-size:10px}
.type-chart tbody th{white-space:nowrap;text-align:left;background:#f7f3ea;padding-left:10px}
.type-chart .match-cell{font-size:17px}
.type-chart .favored{background:#dcebcf;color:#446e38}
.type-chart .unfavored{background:#f4dfd5;color:#ad654b}
.type-chart .neutral{background:#f5f2eb;color:#aaa296}
.chart-key{display:flex;flex-wrap:wrap;gap:10px;font-size:11px;margin:10px 0 15px}.chart-key span{padding:5px 9px;border-radius:5px;background:#f1eee7}.chart-key .key-good{color:#446e38;background:#e5f0dc}.chart-key .key-bad{color:#a35d4d;background:#f8e8e1}
.canvas-switch-picker{width:100%;max-width:100%;display:flex;gap:5px;align-items:center;flex-wrap:wrap;padding:5px}
.canvas-switch-picker>b{font-size:12px}.canvas-switch-picker>span{font-size:10px;color:#746d62}
.swap-options{display:flex;gap:5px;flex-wrap:wrap;width:100%}
.v8-layout .canvas-switch-picker .swap-target{display:flex;align-items:center;gap:4px;font-size:10px;padding:5px 6px}
.v8-layout .canvas-switch-picker .swap-target small{display:inline;color:#746d62;font-size:9px}
.battle-hint{display:block;line-height:1.4;padding:5px 8px}
.battle-hint span{display:inline-block;margin-left:7px}.battle-hint .enemy-telegraph{color:#795a49}
.v8-layout .canvas-controls:has(.canvas-switch-picker){max-height:240px}
.move-button{display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:69px;padding:7px 5px!important;white-space:normal!important;text-align:center}
.move-button strong{font-size:12px}.move-family{display:flex;align-items:center;justify-content:center;font-size:11px;gap:2px}.move-family .type-icon{font-size:13px}.move-effect{font-size:9px!important;font-weight:700;line-height:1.3}.move-effect.effective{color:#42733c}.move-effect.ineffective{color:#ac6350}.move-effect.neutral{color:#79756d}
