/* Independent terrain layers; creatures retain free-standing hit areas. */
.world[data-view=prep]::before{background:linear-gradient(#d7e8e3,#e4e5cf 30%,#c4cbb0);filter:none}
.world[data-view=prep]::after{background:none}
.prep-scene{grid-template-columns:minmax(0,2fr) minmax(0,1fr);grid-template-rows:minmax(170px,1fr) minmax(300px,1.6fr) auto;gap:18px 24px}
.team-pasture{grid-column:1/-1;grid-row:1}.bench-pasture{grid-column:1;grid-row:2}.shop-pasture{grid-column:2;grid-row:2}.scene-footer{grid-column:1/-1;grid-row:3}
.pasture{padding:38px 15px 12px;isolation:isolate}
.pasture::before{content:"";position:absolute;inset:24px 0 0;z-index:-1;border-radius:45% 35% 18% 20% / 12% 13% 9% 8%;background:radial-gradient(ellipse at 20% 0,#e5eacb 0,transparent 60%),linear-gradient(#b3c49a,#a1b58b);box-shadow:0 8px 0 #7e9473,0 13px 0 #a3ad91}
.team-pasture::before{background:radial-gradient(ellipse at 70% 0,#dce5cb,transparent 65%),linear-gradient(#adc29a,#91ad83);border-radius:50% 40% 18% 20% / 20% 15% 12% 13%}
.shop-pasture::before{background:radial-gradient(ellipse at 30% 0,#f0e5b9,transparent 70%),linear-gradient(#c4ca9c,#afb78d);box-shadow:0 8px 0 #939b72,0 13px 0 #b8b496}
.pasture-title{padding:0 8px}.pasture-title h2{background:transparent;font-size:18px}.shop-controls{display:flex;gap:5px}.shop-controls button{padding:5px 9px}
.bench-pasture .bench-row{grid-template-columns:repeat(4,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(0,1fr));max-width:none;width:100%;height:100%;gap:15px 12px!important}
.shop-pasture .shop-row{grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(0,1fr));height:100%;width:100%;gap:15px 12px!important}
.bench-row .slot,.shop-row .slot{height:100%!important;min-height:100px;padding-top:25px;padding-bottom:15px}.bench-row .pet-motion,.shop-row .pet-motion{max-height:none;height:auto;flex:1}
.team-pasture .slot{padding-top:27px;height:clamp(130px,22vh,220px)}
.slot .pet-level{position:absolute;top:0;left:50%;transform:translateX(-50%);z-index:7;margin:0;padding:0;background:none;border:0;box-shadow:none;color:#fffcec;font-size:16px;line-height:23px;font-weight:900;text-shadow:0 2px 2px #314733,1px 0 #314733,-1px 0 #314733;white-space:nowrap}
.slot .unit-hud,.bench-row .unit-hud,.shop-row .unit-hud{height:34px}
.slot .stats{margin:0 auto;gap:8px;max-width:130px}
.slot .stat,.slot .stat.hp,.slot .stat.atk,.slot .stat.spd,.slot .merge-count{background:none;border:0;box-shadow:none;border-radius:0;padding:0;color:#fffbea;font-size:27px;line-height:31px;text-shadow:0 2px 1px #34452c,1px 0 #34452c,-1px 0 #34452c,0 -1px #34452c}
.slot .stat{flex:initial;gap:3px}.slot .stat i{position:static;font-size:17px;line-height:inherit}.slot .stat.hp i{color:#fb857c}.slot .stat.atk i{color:#ffdf6e}
.slot .stat.spd{top:2px;right:0;min-width:0;font-size:14px;line-height:21px}.slot .stat.spd i{font-size:11px;color:#c5e7ff}.slot .merge-count{top:2px;left:0;min-width:0;height:21px;font-size:15px!important;line-height:21px}.slot .merge-count::before{content:'◆';font-size:10px;color:#ffdfa0;margin-right:2px}.slot .merge-count{display:flex}
.slot:after,.slot .ground-mark,.bench-row .slot:after,.shop-row .slot:after{bottom:33px}.shop-row .slot:after,.bench-row .slot:after{bottom:48px}.price{bottom:0;font-size:12px;line-height:13px;padding:1px 8px}
.bench-row .item-visual{height:auto;flex:1}.bench-row .item-name{font-size:14px;background:none;line-height:24px}.item-name{background:none!important}
.selection-copy{color:#314934;text-shadow:none}
.pasture::after{content:"";position:absolute;inset:40px 8px 12px;z-index:-1;pointer-events:none;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='110' viewBox='0 0 240 110'%3E%3Cpath d='M18 80l-4-7m4 7 2-10m-2 10 6-5M180 30l-4-6m4 6 1-9m-1 9 5-5' fill='none' stroke='%235d7956' stroke-opacity='.24' stroke-width='2' stroke-linecap='round'/%3E%3Cellipse cx='210' cy='85' rx='6' ry='2' fill='%23e8e9c7' fill-opacity='.4'/%3E%3C/svg%3E") repeat}
.combat-unit .unit-hud{height:43px}.combat-unit{padding-top:27px}.combat-unit .stat{font-size:22px;line-height:27px}.combat-unit .stat.spd{font-size:12px;line-height:21px}.combat-unit:after{bottom:40px}
/* Long idle loops include a short character performance and a quiet recovery. */
.pet-visual,.combat-unit.active .pet-visual{animation:idle-peek 7.7s ease-in-out infinite!important;animation-delay:var(--phase,-1s)!important;transform-origin:50% 96%}
.pet-visual[data-idle=bounce]{animation-name:idle-bounce!important;animation-duration:6.7s!important}.pet-visual[data-idle=stretch]{animation-name:idle-stretch!important;animation-duration:8.9s!important}
@keyframes idle-bounce{0%,100%{transform:scale(1,.98)}18%{transform:translateY(-4px) scale(.97,1.04)}36%{transform:scale(1.03,.97)}48%{transform:scale(1.14,.84)}54%{transform:translateY(-20px) rotate(-7deg) scale(.94,1.07)}60%{transform:translateY(-25px) rotate(6deg)}67%{transform:scale(1.16,.82)}73%{transform:translateY(-7px) scale(.95,1.07)}82%{transform:scale(1,1)}}
@keyframes idle-peek{0%,100%{transform:scale(1,.98)}18%{transform:translateY(-5px) scale(.97,1.05)}35%{transform:scale(1.02,.98)}48%{transform:translateX(-5px) rotate(-9deg) scale(1.02,1.03)}58%{transform:translateX(-5px) rotate(-9deg)}70%{transform:translateX(5px) rotate(8deg) translateY(-5px)}80%{transform:translateX(5px) rotate(8deg)}90%{transform:scale(1.07,.94)}}
@keyframes idle-stretch{0%,100%{transform:scale(1,.98)}20%{transform:translateY(-4px) scale(.97,1.04)}40%{transform:scale(1.04,.95)}52%{transform:scale(1.12,.84) rotate(-3deg)}62%{transform:translateY(-9px) scale(.92,1.15) rotate(3deg)}72%{transform:translateY(-9px) scale(.92,1.15) rotate(-3deg)}84%{transform:scale(1.08,.93)}}
.drag-ghost .pet-visual,.transaction-ghost .pet-visual,.combat-unit.dead .pet-visual{animation:none!important}
@media(max-width:900px){
 .prep-scene{grid-template-columns:minmax(0,2fr) minmax(0,1fr);grid-template-rows:minmax(160px,1fr) minmax(340px,1.8fr) auto;gap:15px 8px}.pasture{padding:52px 4px 10px}.team-pasture{padding-top:30px}.pasture-title{padding:0;gap:1px}.pasture-title h2{font-size:13px;padding:0 2px}.shop-pasture .pasture-title{flex-wrap:wrap}.shop-controls{width:100%;gap:3px}.shop-controls button{font-size:10px;padding:3px 4px;flex:1;white-space:nowrap}.bench-row,.shop-row{gap:16px 3px!important}.slot .pet-level{font-size:12px;line-height:18px}.slot .stat,.combat-unit .stat{font-size:19px;line-height:26px}.slot .stat i{font-size:11px}.slot .stats{gap:4px;max-width:none}.slot .stat.spd{top:20px;font-size:10px;line-height:16px}.slot .stat.spd i{font-size:8px}.slot .merge-count{top:20px;font-size:11px!important;line-height:16px;height:16px}.slot .merge-count::before{font-size:7px}.bench-row .slot,.shop-row .slot{padding-top:36px;min-height:105px}.bench-row .pet-motion{max-height:none}.slot .unit-hud,.bench-row .unit-hud,.shop-row .unit-hud{height:28px}.bench-row .item-name{font-size:10px;line-height:18px}.team-pasture .slot{padding-top:36px}.combat-unit .unit-hud{height:37px}.combat-unit{padding-top:36px}.combat-unit:after{bottom:34px}.shop-row .slot:after,.bench-row .slot:after{bottom:43px}
}
@media(orientation:landscape) and (min-width:650px) and (max-height:500px){
 .world[data-view=prep]{min-height:550px;height:auto}.world[data-view=prep] .main{min-height:490px}.prep-scene{grid-template-rows:135px 260px 60px;gap:10px 20px}.pasture{padding-top:30px}.shop-pasture .pasture-title{flex-wrap:nowrap}.shop-controls{width:auto}.bench-row .slot,.shop-row .slot{min-height:90px;padding-top:23px}.slot .stat.spd,.slot .merge-count{top:1px}.bench-row .pet-motion,.shop-row .pet-motion{max-height:none}.team-pasture .slot{height:105px!important;padding-top:23px}.slot .pet-level{font-size:13px}.slot .unit-hud,.bench-row .unit-hud,.shop-row .unit-hud{height:26px}
}
@media(prefers-reduced-motion:reduce){.pet-visual,.pet-visual[data-idle],.combat-unit.active .pet-visual{animation:none!important}}
@media(max-width:900px){.slot .stat.hp,.slot .stat.atk{font-size:19px;line-height:26px}.slot .stats{gap:3px}.slot .stat.hp i,.slot .stat.atk i{font-size:10px}.combat-unit .stat.hp,.combat-unit .stat.atk{font-size:17px}}
@media(orientation:landscape) and (min-width:650px) and (max-height:500px){
 .world[data-view=prep]{height:100svh;min-height:380px}.world[data-view=prep] .main{min-height:0;padding:2px 12px 6px}.prep-scene{grid-template-rows:minmax(82px,.75fr) minmax(173px,1.6fr) 43px;gap:6px 18px}.pasture{padding:22px 8px 3px}.pasture::before{inset:18px 0 0;box-shadow:0 3px #809570}.pasture::after{inset:23px 5px 4px}.pasture-title h2{font-size:11px}.shop-controls button{font-size:10px;padding:0 5px}.bench-pasture .bench-row,.shop-pasture .shop-row{gap:4px 8px!important}.bench-row .slot,.shop-row .slot{min-height:0;height:100%!important;padding:17px 0 9px}.team-pasture .slot{height:65px!important;padding:17px 0 0}.slot .pet-level{font-size:11px;line-height:15px}.slot .stat.hp,.slot .stat.atk{font-size:17px;line-height:20px}.slot .stat.spd,.slot .merge-count{font-size:10px!important;line-height:15px;height:15px}.slot .unit-hud,.bench-row .unit-hud,.shop-row .unit-hud{height:21px}.price{font-size:9px;line-height:9px;bottom:-1px;padding:0 5px}.bench-row .item-name,.shop-row .item-name{font-size:10px;line-height:16px}.slot:after,.bench-row .slot:after,.shop-row .slot:after{bottom:24px}.scene-footer{padding:0;min-height:43px}.combat-unit .stat.hp,.combat-unit .stat.atk{font-size:17px;line-height:23px}
}
