*{box-sizing:border-box} :root{font-family:"Nunito","Microsoft YaHei",system-ui,sans-serif;color:#233e31;background:#e7e8ca}
body{margin:0;height:100vh;height:100dvh;overflow:hidden;background:center 42% / cover var(--scene, url("./art/pasture.webp"));-webkit-tap-highlight-color:transparent}
button,a{touch-action:manipulation;font:inherit;color:inherit}button{cursor:pointer}button:focus-visible,a:focus-visible{outline:3px solid #f88f49;outline-offset:3px}
.symbols{position:absolute;width:0;height:0;overflow:hidden}svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8}
.screen{height:100%;max-width:550px;margin:auto;display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;align-items:center;gap:clamp(4px,1.3vh,14px);padding:max(12px,env(safe-area-inset-top)) max(15px,env(safe-area-inset-right)) max(15px,env(safe-area-inset-bottom)) max(15px,env(safe-area-inset-left))}
nav,.tools,.actions,.score,.level{display:flex;align-items:center}nav,.score{justify-content:space-between}.tools{gap:8px}.round{display:grid;place-items:center;width:44px;height:44px;border:1px solid #58614766;border-radius:50%;background:#fff9e4ed;box-shadow:0 2px 0 #45563345}.round[aria-pressed=false]:after{content:"";width:23px;height:2px;background:currentColor;position:absolute;transform:rotate(-50deg);box-shadow:0 -1px #fff9e4}
header{text-align:center;color:#203e31;text-shadow:0 1px 6px #fff8db,0 0 20px #fff7d9}.level{justify-content:center;gap:8px;font-size:13px;font-weight:850;letter-spacing:.12em}.level i{display:block;width:23px;height:1px;background:currentColor}h1{margin:3px 0 0;font-family:"Songti SC","SimSun",Georgia,serif;font-size:clamp(35px,6.5vh,64px);line-height:1.1;letter-spacing:.05em;font-weight:900}
#pasture{container-type:size;width:100%;height:100%;display:grid;place-items:center;min-height:0}
#board{position:relative;isolation:isolate;width:min(100cqw,100cqh,490px);aspect-ratio:1;border:3px solid #ecdeb0;border-radius:18px;outline:2px solid #6b7041;box-shadow:0 5px 0 #67704888,0 11px 24px #2d452538,inset 0 0 28px #73834433;background-color:#bdcf83;background-image:linear-gradient(to right,#f7f1bb70 1px,transparent 1px),linear-gradient(to bottom,#f7f1bb70 1px,transparent 1px),linear-gradient(#cadc9463,#b5cd8173),var(--scene, url("./art/pasture.webp"));background-size:var(--cell) var(--cell),var(--cell) var(--cell),cover,190% auto;background-position:0 0,0 0,center,50% 56%;overflow:hidden}
.sheep{position:absolute;width:20%;height:20%;background:none;border:0;padding:0;display:grid;place-items:center;user-select:none}.sheep{
  --gutter:clamp(9px,2.4vmin,13px);
  --art-inset:5%;
  --west:var(--art-inset);--east:var(--art-inset);
  --north:var(--art-inset);--south:var(--art-inset);
}
.sheep[data-dir=east]{--west:var(--gutter)}
.sheep[data-dir=west]{--east:var(--gutter)}
.sheep[data-dir=south]{--north:var(--gutter)}
.sheep[data-dir=north]{--south:var(--gutter)}
.animal-art{position:absolute;inset:var(--north) var(--east) var(--south) var(--west);pointer-events:none}
.animal-art img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 1px 1px #55481f50)}
.arrow{position:absolute;width:var(--gutter);height:var(--gutter);display:grid;place-items:center;color:#476239ba}
.arrow svg{width:90%;height:90%;stroke-width:1.9;filter:drop-shadow(0 1px 0 #f2ecc49e)}
[data-dir=east] .arrow{left:0;translate:0 -50%}
[data-dir=west] .arrow{right:0;translate:0 -50%}
[data-dir=south] .arrow{top:0;translate:-50% 0}
[data-dir=north] .arrow{bottom:0;translate:-50% 0}
.hinted .arrow,.sheep:focus-visible .arrow{color:#304d29}
.sheep.hinted{background:#fff8b686;border-radius:22%;outline:3px dashed #506a38;outline-offset:-3px}
.sheep:disabled{pointer-events:none;z-index:2}
footer{width:min(100%,490px);justify-self:center;background:#fff8e7f5;border:1px solid #95885d;border-radius:19px;box-shadow:0 3px 0 #5f694e65,0 8px 25px #32442d25;padding:13px 18px 12px}.score{font-weight:800;font-size:15px}.score strong{font-family:Georgia,serif;font-size:23px;font-variant-numeric:tabular-nums;color:#456343}.track{height:5px;background:#e1dec6;border-radius:4px;margin:5px 0;overflow:hidden}#progress{background:#79915a;height:100%;transition:width .25s}#note{font-size:13px;line-height:1.4;min-height:1.4em;margin:8px 0 12px;color:#494f3b}.actions{gap:9px}.actions button,dialog button{border-radius:11px;border:1px solid #abb08c;background:#f4f1df;min-height:41px;font-weight:750}.actions button{flex:1;display:flex;align-items:center;justify-content:center;gap:7px}.actions svg{height:18px;width:18px}.actions button:disabled{opacity:.45;cursor:default}button:active:not(:disabled){filter:brightness(.94)}
dialog{width:min(calc(100vw - 40px),345px);text-align:center;color:#253e30;background:#fff7df;border:2px solid #c1ad77;border-radius:23px;padding:23px;box-shadow:0 12px 48px #243b2e55}dialog::backdrop{background:#23372872;backdrop-filter:blur(3px)}dialog img{width:88px;height:82px;object-fit:contain}dialog h2{font:800 29px/1.2 Georgia,"SimSun",serif;margin:9px 0}dialog p{line-height:1.6;font-size:15px;margin:12px 0 18px}dialog button{display:block;width:100%;margin-top:8px}dialog button:first-of-type{background:#345741;color:#fff8df}button[hidden]{display:none}
@media(min-width:680px){body{background-position:center 15%}.screen{padding-bottom:24px}header{background:radial-gradient(ellipse,#fff3c99c,transparent 70%)}}
@media(max-height:660px) and (orientation:portrait){.screen{gap:3px;padding-top:max(6px,env(safe-area-inset-top))}header h1{font-size:32px}footer{padding:7px 13px}.round{width:40px;height:40px}#note{margin:4px 0 6px}}
@media(orientation:landscape) and (max-height:590px){.screen{max-width:880px;grid-template-columns:minmax(190px,.8fr) 1.2fr;grid-template-rows:auto 1fr auto;gap:6px 18px}.screen nav{grid-column:1}.screen header{grid-column:1}.screen footer{grid-column:1}.screen #pasture{grid-column:2;grid-row:1 / 4}header h1{font-size:34px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{transition-duration:.001s!important;animation-duration:.001s!important}}

.sheep[data-kind=snake]{--art-inset:8%}.footprint{position:absolute;inset:1px;background:#f9edb32f;border-radius:12px;border:1px solid #65744365;pointer-events:none}.sheep[data-kind=snake] .footprint{inset:0;border-radius:0;background:#e5eea14d}
