/* Secure Sheep Farm V3 */
:root{
  --accent:#8bd0ff;--accent-ink:#102238;--panel:rgba(9,18,35,.975);--line:rgba(255,255,255,.14);
  --sky-top:#0f1831;--sky-bottom:#29486d;--pasture-back:#365f55;--pasture-front:#21493e;--mountain:rgba(35,61,82,.72)
}
*{box-sizing:border-box}html,body{margin:0;min-height:100%}body{min-height:100vh;overflow:hidden;background:#0f1831;color:#f7fbff;font-family:Arial,Helvetica,sans-serif}
button,input,select,textarea{font:inherit}button{cursor:pointer}.hidden{display:none!important}
.scene{position:relative;min-height:100vh;overflow:hidden;background:radial-gradient(circle at 50% 10%,rgba(255,255,255,.1),transparent 30%),linear-gradient(180deg,var(--sky-top),var(--sky-bottom));transition:background 1.2s,color 1.2s}
.scene.day{--sky-top:#60b9f0;--sky-bottom:#d9f1ff;--mountain:rgba(85,116,119,.48);color:#17324b}
.scene.sunset{--sky-top:#df765f;--sky-bottom:#f4bf85;--mountain:rgba(93,89,88,.48)}
.scene.season-summer{--pasture-back:#6fa64c;--pasture-front:#3f7b38}.scene.season-fall{--pasture-back:#9b7946;--pasture-front:#6b5033}.scene.season-winter{--pasture-back:#c8d6d9;--pasture-front:#a8bec4}
.scene.accent-blue{--accent:#8bd0ff;--accent-ink:#102238}.scene.accent-green{--accent:#9fe09d;--accent-ink:#17331c}.scene.accent-gold{--accent:#ffd77b;--accent-ink:#3b2a08}.scene.accent-pink{--accent:#ffb4d5;--accent-ink:#3f1730}
.topbar{position:absolute;z-index:45;top:18px;left:20px;right:20px;display:flex;justify-content:space-between;gap:16px;align-items:flex-start}
.brand-chip,.clock-card,.admin-trigger{border:1px solid rgba(255,255,255,.3);background:rgba(6,17,37,.58);color:#fff;backdrop-filter:blur(9px);box-shadow:0 8px 25px rgba(0,0,0,.16)}
.brand-chip{display:flex;align-items:center;gap:10px;max-width:390px;padding:10px 13px;border-radius:17px}.brand-chip span:last-child{min-width:0}.brand-chip strong,.brand-chip small{display:block}.brand-chip small{margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;opacity:.78}.brand-mark{font-size:26px}
.top-actions{display:flex;align-items:flex-start;gap:10px}.clock-card{min-width:185px;padding:10px 14px;border-radius:17px}.clock-card strong,.clock-card span{display:block}.clock-card strong{font-size:20px}.clock-card span{margin-top:2px;font-size:12px;opacity:.82}.admin-trigger{border-radius:999px;padding:10px 16px;font-weight:700}
.hero{position:absolute;z-index:24;top:145px;left:clamp(20px,6vw,86px);width:min(610px,calc(100% - 40px));text-shadow:0 3px 16px rgba(0,0,0,.24)}
.hero-label{display:inline-block;margin-bottom:12px;padding:6px 10px;border:1px solid rgba(255,255,255,.3);border-radius:999px;background:rgba(7,19,38,.28);font-size:12px;font-weight:700;letter-spacing:.09em;text-transform:uppercase}
.hero h1{margin:0;font-size:clamp(42px,7vw,78px);line-height:.98}.hero>p{max-width:590px;margin:17px 0 0;font-size:clamp(16px,2.1vw,21px);line-height:1.5}
.status-grid{display:grid;grid-template-columns:repeat(4,minmax(90px,1fr));gap:10px;margin-top:22px}.status-card{padding:11px 12px;border:1px solid rgba(255,255,255,.25);border-radius:15px;background:rgba(8,21,38,.38);color:#fff;backdrop-filter:blur(7px)}.status-card span,.status-card strong{display:block}.status-card span{font-size:11px;text-transform:uppercase;letter-spacing:.08em;opacity:.72}.status-card strong{margin-top:4px;font-size:18px}
.sun,.moon{position:absolute;z-index:5;top:82px;right:11%;width:102px;height:102px;border-radius:50%;transition:opacity 1.1s,transform 1.1s}.sun{opacity:0;transform:scale(.75);background:#ffd354;box-shadow:0 0 35px rgba(255,211,84,.9),0 0 100px rgba(255,179,54,.56)}.moon{background:#fff1b8;box-shadow:0 0 32px rgba(255,241,184,.75),0 0 90px rgba(255,241,184,.32)}.moon:after{content:"";position:absolute;top:-9px;left:28px;width:102px;height:102px;border-radius:50%;background:var(--sky-top)}.scene.day .sun,.scene.sunset .sun{opacity:1;transform:scale(1)}.scene.day .moon,.scene.sunset .moon{opacity:0;transform:scale(.75)}
.stars,.clouds,.weather-layer,.sheep-layer{position:absolute;inset:0}.stars{z-index:2;transition:opacity .8s}.scene.day .stars{opacity:0}.star{position:absolute;width:var(--size);height:var(--size);border-radius:50%;background:#fff;box-shadow:0 0 8px #fff;animation:twinkle var(--speed) ease-in-out infinite alternate}
.clouds{z-index:6;pointer-events:none}.cloud{position:absolute;left:-230px;width:var(--width);height:calc(var(--width)*.25);border-radius:999px;background:rgba(255,255,255,.19);animation:cloudMove var(--duration) linear infinite;animation-delay:var(--delay)}.scene.day .cloud{background:rgba(255,255,255,.78)}.cloud:before,.cloud:after{content:"";position:absolute;bottom:8%;border-radius:50%;background:inherit}.cloud:before{left:20%;width:42%;height:155%}.cloud:after{right:12%;width:50%;height:180%}
.weather-layer{z-index:21;pointer-events:none;overflow:hidden}.weather-drop{position:absolute;top:-8%;animation:weatherFall var(--fall) linear infinite;animation-delay:var(--delay)}.weather-drop.rain{width:2px;height:28px;background:rgba(188,224,255,.68);transform:rotate(10deg)}.weather-drop.snow{width:8px;height:8px;border-radius:50%;background:rgba(255,255,255,.92);box-shadow:0 0 7px rgba(255,255,255,.75)}.weather-breeze{position:absolute;width:130px;height:2px;background:linear-gradient(90deg,transparent,rgba(255,255,255,.58),transparent);animation:breeze 5s linear infinite}
.mountain{position:absolute;z-index:7;bottom:26%;width:52%;height:33%;background:var(--mountain);clip-path:polygon(50% 0,100% 100%,0 100%)}.mountain-one{left:-8%}.mountain-two{right:-12%;transform:scale(1.22)}
.pasture{position:absolute;left:-10%;width:120%;border-radius:50% 50% 0 0}.pasture-back{z-index:8;bottom:3%;height:38%;background:var(--pasture-back);transform:rotate(-2deg)}.pasture-front{z-index:9;bottom:-13%;height:41%;background:var(--pasture-front);transform:rotate(2deg)}
.barn{position:absolute;z-index:13;right:8%;bottom:17%;width:175px;height:128px;border:5px solid #6f3028;background:#a84337;transition:opacity .4s}.barn:before{content:"";position:absolute;top:-68px;left:-20px;width:205px;height:83px;background:#60382f;clip-path:polygon(50% 0,100% 100%,0 100%)}.barn-window{position:absolute;top:15px;left:68px;width:35px;height:29px;border:4px solid #f1d0a6;background:#ffd56f}.barn-door{position:absolute;bottom:0;left:55px;width:62px;height:82px;border:4px solid #f1d0a6;background:linear-gradient(34deg,transparent 46%,#f1d0a6 47%,#f1d0a6 52%,transparent 53%),linear-gradient(-34deg,transparent 46%,#f1d0a6 47%,#f1d0a6 52%,transparent 53%),#713027}.barn-sign{position:absolute;z-index:2;top:-48px;left:24px;width:118px;padding:5px;border-radius:5px;background:#f1d0a6;color:#5b2c25;text-align:center;font-size:11px;font-weight:700}
.windmill{position:absolute;z-index:12;right:27%;bottom:19%;width:120px;height:190px;opacity:.85;transition:opacity .4s}.windmill-wheel{position:absolute;top:0;left:13px;width:94px;height:94px;animation:spin 15s linear infinite}.windmill-wheel:before{content:"";position:absolute;top:40px;left:40px;width:15px;height:15px;border-radius:50%;background:#77553b}.windmill-wheel span{position:absolute;top:44px;left:44px;width:46px;height:7px;transform-origin:0 50%;background:#e0c59a}.windmill-wheel span:nth-child(2){transform:rotate(90deg)}.windmill-wheel span:nth-child(3){transform:rotate(180deg)}.windmill-wheel span:nth-child(4){transform:rotate(270deg)}.windmill-tower{position:absolute;bottom:0;left:45px;width:32px;height:115px;background:#815b3d;clip-path:polygon(35% 0,65% 0,100% 100%,0 100%)}
.pond{position:absolute;z-index:11;right:31%;bottom:10%;width:180px;height:48px;border-radius:50%;background:rgba(91,176,211,.55);box-shadow:inset 0 8px 18px rgba(255,255,255,.18)}.pond span{position:absolute;left:42px;top:12px;width:74px;height:3px;border-radius:50%;background:rgba(255,255,255,.42);animation:pondRipple 3s ease-in-out infinite}
.fence{position:absolute;z-index:14;right:0;bottom:12%;left:0;height:72px;opacity:.68;background:linear-gradient(to bottom,transparent 12px,#d0aa73 13px,#d0aa73 22px,transparent 23px),linear-gradient(to bottom,transparent 46px,#d0aa73 47px,#d0aa73 56px,transparent 57px),repeating-linear-gradient(to right,transparent 0 95px,#b4854f 96px 109px)}
.shepherd{position:absolute;z-index:18;bottom:16%;left:10%;width:110px;height:225px;opacity:0;transform:translateX(-35px);transition:opacity 1s,transform 1s}.scene.day .shepherd{opacity:1;transform:translateX(0)}.shepherd-head{position:absolute;top:18px;left:38px;width:42px;height:47px;border-radius:50%;background:#d9a375}.shepherd-hat{position:absolute;z-index:2;top:7px;left:28px;width:67px;height:18px;border-radius:50%;background:#7b5533}.shepherd-body{position:absolute;top:62px;left:32px;width:58px;height:91px;border-radius:22px 22px 8px 8px;background:#426c54}.shepherd-leg{position:absolute;top:145px;width:17px;height:70px;border-radius:9px;background:#433b34}.shepherd-leg.left{left:40px}.shepherd-leg.right{left:68px}.staff{position:absolute;top:47px;left:94px;width:8px;height:174px;border-radius:8px;background:#8b5b32}.staff:before{content:"";position:absolute;top:-10px;left:-18px;width:29px;height:30px;border:7px solid #8b5b32;border-right-color:transparent;border-bottom-color:transparent;border-radius:50%}
.dream-bubble{position:absolute;z-index:24;bottom:39%;left:50%;width:min(280px,78vw);padding:17px 21px;border:3px solid rgba(255,255,255,.82);border-radius:40px;background:rgba(255,255,255,.94);color:#34425d;text-align:center;box-shadow:0 13px 30px rgba(0,0,0,.2);transform:translateX(-50%);animation:bubbleFloat 4s ease-in-out infinite}.dream-bubble span,.dream-bubble strong{display:block}.bubble-emoji{margin-bottom:3px;font-size:25px}.dream-bubble strong{font-size:17px}.dream-bubble span:last-child{margin-top:3px;color:#657296;font-size:14px}
.sheep-layer{z-index:17;pointer-events:none}.sheep{position:absolute;left:var(--x);bottom:var(--y);width:145px;height:105px;transform:scale(var(--scale));transform-origin:bottom center;animation:sheepBreathe var(--breath) ease-in-out infinite}.sheep-shadow{position:absolute;bottom:0;left:23px;width:105px;height:20px;border-radius:50%;background:rgba(0,0,0,.23);filter:blur(5px)}.sheep-body{position:absolute;top:26px;left:39px;width:99px;height:66px;border-radius:50%;background:radial-gradient(circle at 16% 25%,#fff 0 20%,transparent 21%),radial-gradient(circle at 41% 13%,#fff 0 22%,transparent 23%),radial-gradient(circle at 67% 18%,#fff 0 23%,transparent 24%),radial-gradient(circle at 85% 42%,#fff 0 22%,transparent 23%),radial-gradient(circle at 47% 62%,#fff 0 29%,transparent 30%),#eee9dc;box-shadow:inset -7px -8px rgba(190,186,174,.44)}.sheep-head{position:absolute;top:47px;left:12px;width:55px;height:48px;border-radius:48%;background:#6d625b;transform:rotate(-7deg)}.sheep-head:before,.sheep-head:after{content:"";position:absolute;top:5px;width:27px;height:13px;border-radius:50%;background:#7c7068}.sheep-head:before{left:-13px;transform:rotate(-24deg)}.sheep-head:after{right:-13px;transform:rotate(24deg)}.sheep-eye{position:absolute;top:19px;width:12px;height:7px;border-bottom:3px solid #1d1917;border-radius:50%}.sheep-eye.left{left:9px}.sheep-eye.right{right:9px}.sheep-leg{position:absolute;top:78px;width:35px;height:15px;border-radius:12px;background:#62564f}.sheep-leg.front{left:41px;transform:rotate(-7deg)}.sheep-leg.back{left:96px;transform:rotate(8deg)}.name-tag{position:absolute;top:-8px;left:10px;max-width:132px;overflow:hidden;padding:5px 9px;border-radius:999px;background:rgba(255,255,255,.94);color:#2b3e55;font-size:12px;font-weight:700;text-overflow:ellipsis;white-space:nowrap}
.scene-footer{position:absolute;z-index:23;right:18px;bottom:15px;left:18px;text-align:center;color:rgba(255,255,255,.72);font-size:12px}
.admin-panel{position:fixed;z-index:100;top:0;right:0;width:min(430px,100%);height:100vh;overflow-y:auto;padding:21px;border-left:1px solid var(--line);background:var(--panel);color:#fff;box-shadow:-15px 0 35px rgba(0,0,0,.35);transform:translateX(102%);transition:transform .28s}.admin-panel.open{transform:translateX(0)}.admin-heading{display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:18px}.admin-heading h2{margin:2px 0 0}.admin-kicker{color:rgba(255,255,255,.65);font-size:11px;letter-spacing:.11em;text-transform:uppercase}.icon-button{width:38px;height:38px;border:1px solid var(--line);border-radius:50%;background:transparent;color:#fff;font-size:22px}
.summary-row{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:12px}.summary-row div{padding:10px;border:1px solid var(--line);border-radius:12px;background:rgba(255,255,255,.055)}.summary-row strong,.summary-row span{display:block}.summary-row strong{font-size:18px}.summary-row span{margin-top:3px;color:rgba(255,255,255,.62);font-size:11px}
.admin-tabs{display:grid;grid-template-columns:repeat(4,1fr);gap:7px;margin-bottom:12px}.tab-button{border:1px solid var(--line);border-radius:10px;padding:9px 5px;background:transparent;color:#fff}.tab-button.active{background:var(--accent);color:var(--accent-ink);font-weight:700}
.admin-card{margin-bottom:13px;padding:16px;border:1px solid var(--line);border-radius:16px;background:rgba(255,255,255,.055)}.admin-card h3{margin:0 0 13px}.admin-card label{display:block;margin-bottom:12px}.admin-card label>span{display:block;margin-bottom:6px;color:rgba(255,255,255,.67);font-size:13px}.admin-card input,.admin-card select,.admin-card textarea{width:100%;border:1px solid rgba(255,255,255,.22);border-radius:11px;padding:10px 11px;background:rgba(0,0,0,.24);color:#fff;outline:none}.admin-card textarea{resize:vertical}.admin-card input:focus,.admin-card select:focus,.admin-card textarea:focus{border-color:var(--accent)}.add-row{display:grid;grid-template-columns:1fr auto;gap:8px}
.primary-button,.secondary-button,.danger-button,.remove-button,.rename-button{border:0;border-radius:10px;padding:10px 13px;font-weight:700}.primary-button{background:var(--accent);color:var(--accent-ink)}.secondary-button{background:rgba(255,255,255,.13);color:#fff}.danger-button{background:#b84f49;color:#fff}.remove-button{padding:7px 9px;background:rgba(190,73,67,.22);color:#ffbeb9}.rename-button{padding:7px 9px;background:rgba(139,208,255,.18);color:#bfe7ff}
.sheep-list{display:grid;gap:8px;margin-top:13px}.sheep-row{display:grid;grid-template-columns:1fr auto auto;gap:7px;align-items:center;padding:9px 10px;border-radius:10px;background:rgba(255,255,255,.07)}.sheep-row input{margin:0}.toggle-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:12px 0}.check-row{display:flex!important;align-items:center;gap:8px;margin:0!important;padding:9px;border:1px solid var(--line);border-radius:10px}.check-row input{width:auto!important;margin:0}.helper-text,.message{color:rgba(255,255,255,.66);font-size:13px;line-height:1.45}.message{min-height:19px}
@keyframes twinkle{from{opacity:.3;transform:scale(.7)}to{opacity:1;transform:scale(1.35)}}@keyframes cloudMove{from{transform:translateX(0)}to{transform:translateX(calc(100vw + 500px))}}@keyframes sheepBreathe{0%,100%{translate:0 0}50%{translate:0 -4px}}@keyframes bubbleFloat{0%,100%{transform:translateX(-50%) translateY(0) rotate(-1deg)}50%{transform:translateX(-50%) translateY(-8px) rotate(1deg)}}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pondRipple{0%,100%{transform:scaleX(.8);opacity:.4}50%{transform:scaleX(1.25);opacity:.85}}@keyframes weatherFall{to{transform:translateY(120vh)}}@keyframes breeze{from{transform:translateX(-180px)}to{transform:translateX(calc(100vw + 180px))}}
@media(max-width:850px){.brand-chip{max-width:290px}.status-grid{grid-template-columns:repeat(2,minmax(100px,1fr))}.windmill{right:21%}}
@media(max-width:700px){body{overflow:auto}.scene{min-height:760px}.topbar{top:12px;left:12px;right:12px}.brand-chip{display:none}.top-actions{width:100%;justify-content:space-between}.clock-card{min-width:155px}.clock-card strong{font-size:18px}.hero{top:125px;left:18px;width:calc(100% - 36px)}.hero h1{font-size:clamp(38px,12vw,58px)}.hero>p{max-width:92%}.sun,.moon{top:105px;right:6%;width:72px;height:72px}.moon:after{width:72px;height:72px}.dream-bubble{bottom:42%}.barn{right:-14px;transform:scale(.76);transform-origin:bottom right}.windmill,.pond{display:none}.shepherd{left:1%;transform:scale(.74) translateX(-35px);transform-origin:bottom left}.scene.day .shepherd{transform:scale(.74) translateX(0)}.sheep{transform:scale(calc(var(--scale)*.74))}.admin-tabs{grid-template-columns:repeat(2,1fr)}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.001ms!important;animation-iteration-count:1!important}}


/* V5 native meadow additions. These preserve the original V3 scene. */
.meadow-road {
  position: absolute;
  z-index: 10;
  right: -4%;
  bottom: 4%;
  width: 54%;
  height: 25%;
  border-radius: 65% 0 0 0;
  background:
    linear-gradient(160deg, transparent 0 28%, rgba(173, 137, 89, 0.95) 29% 44%, rgba(118, 91, 60, 0.95) 45% 50%, transparent 51%);
  transform: rotate(-3deg);
  opacity: 0.9;
}

.old-bridge {
  position: absolute;
  z-index: 19;
  right: 8%;
  bottom: 7%;
  width: 260px;
  height: 112px;
  transform: rotate(-2deg);
}

.bridge-deck {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 22px;
  height: 34px;
  border: 4px solid #4e3527;
  border-radius: 12px;
  background:
    repeating-linear-gradient(90deg, #8a6241 0 14px, #6f4b33 15px 18px);
  box-shadow: 0 7px 0 rgba(0,0,0,.2);
}

.bridge-arch {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 0;
  height: 54px;
  border: 10px solid #6b4a35;
  border-top: 0;
  border-radius: 0 0 120px 120px;
}

.bridge-rail {
  position: absolute;
  z-index: 2;
  top: 22px;
  width: 104px;
  height: 8px;
  border-radius: 8px;
  background: #7c573b;
  box-shadow:
    0 23px 0 #7c573b,
    13px 7px 0 -1px #7c573b,
    38px 7px 0 -1px #7c573b,
    63px 7px 0 -1px #7c573b,
    88px 7px 0 -1px #7c573b;
}

.rail-left { left: 4px; transform: rotate(5deg); }
.rail-right { right: 4px; transform: rotate(-5deg); }

.tavern-cluster {
  position: absolute;
  z-index: 16;
  right: 1.5%;
  bottom: 18%;
  width: 190px;
  height: 170px;
}

.tavern-house {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 150px;
  height: 96px;
  border: 4px solid #4a3021;
  background: #7e4d2f;
  box-shadow: 0 12px 22px rgba(0,0,0,.25);
}

.tavern-roof {
  position: absolute;
  left: -13px;
  top: -50px;
  width: 170px;
  height: 58px;
  background: #3e2b25;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.tavern-house strong {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 12px;
  padding: 4px;
  border-radius: 4px;
  background: #c79b59;
  color: #342214;
  font-family: Georgia, serif;
  font-size: 11px;
  text-align: center;
}

.tavern-window {
  position: absolute;
  top: 48px;
  width: 24px;
  height: 22px;
  border: 3px solid #d8bb81;
  background: #ffd76f;
}

.tavern-window.one { left: 16px; }
.tavern-window.two { right: 16px; }

.tavern-door {
  position: absolute;
  left: 59px;
  bottom: 0;
  width: 32px;
  height: 45px;
  border: 3px solid #d8bb81;
  background: #4d2e22;
}

.rope-post {
  position: absolute;
  left: 0;
  top: 0;
  width: 60px;
  height: 154px;
  border-left: 8px solid #6f4e31;
  border-right: 8px solid #6f4e31;
}

.rope-post::before {
  content: "";
  position: absolute;
  top: 0;
  left: -11px;
  width: 66px;
  height: 9px;
  border-radius: 9px;
  background: #6f4e31;
}

.rope-post span {
  position: absolute;
  top: 4px;
  width: 10px;
  height: 48px;
  border: 5px solid #aa8454;
  border-top: 0;
  border-radius: 0 0 50% 50%;
}

.rope-post span:nth-child(1) { left: 4px; }
.rope-post span:nth-child(2) { left: 22px; height: 62px; }
.rope-post span:nth-child(3) { left: 40px; }

.farm-entry-sign {
  position: absolute;
  z-index: 25;
  top: 145px;
  right: 4%;
  width: 250px;
  padding: 16px 20px;
  border: 5px solid #5f3b22;
  border-radius: 8px;
  background:
    linear-gradient(rgba(255,255,255,.08), rgba(0,0,0,.08)),
    repeating-linear-gradient(0deg, #b87b42 0 22px, #aa6e38 23px 25px);
  color: #2c1b10;
  text-align: center;
  box-shadow: 0 12px 28px rgba(0,0,0,.28);
  transform: rotate(1deg);
}

.farm-entry-sign small,
.farm-entry-sign strong,
.farm-entry-sign span,
.farm-entry-sign em {
  display: block;
}

.farm-entry-sign strong {
  margin: 3px 0;
  font: 700 29px Georgia, serif;
}

.farm-entry-sign span {
  font: 700 17px Georgia, serif;
}

.farm-entry-sign em {
  margin-top: 6px;
  font-size: 12px;
}

.cow-scene {
  position: absolute;
  z-index: 20;
  left: 5%;
  bottom: 8%;
  width: 190px;
  height: 130px;
  transform-origin: bottom left;
  animation: cowBreathe 3.7s ease-in-out infinite;
}

.cow-body {
  position: absolute;
  left: 42px;
  top: 33px;
  width: 120px;
  height: 74px;
  border-radius: 48% 52% 42% 45%;
  background: #f1eee8;
  box-shadow: inset -8px -8px rgba(145,137,127,.2);
}

.cow-patch {
  position: absolute;
  z-index: 2;
  border-radius: 50%;
  background: #262422;
}

.patch-one { left: 63px; top: 45px; width: 39px; height: 30px; transform: rotate(18deg); }
.patch-two { left: 116px; top: 67px; width: 32px; height: 26px; transform: rotate(-14deg); }

.cow-head {
  position: absolute;
  z-index: 3;
  left: 6px;
  top: 54px;
  width: 66px;
  height: 58px;
  border-radius: 48%;
  background: #232221;
  box-shadow: inset 0 -15px #f1eee8;
}

.cow-ear {
  position: absolute;
  z-index: 2;
  top: 55px;
  width: 28px;
  height: 17px;
  border-radius: 50%;
  background: #2c2927;
}

.cow-ear.left { left: 0; transform: rotate(-25deg); }
.cow-ear.right { left: 48px; transform: rotate(25deg); }

.cow-leg {
  position: absolute;
  top: 96px;
  width: 18px;
  height: 32px;
  border-radius: 0 0 7px 7px;
  background: #e8e2da;
  border-bottom: 8px solid #302c29;
}

.leg-one { left: 64px; }
.leg-two { left: 135px; }

.cow-label {
  position: absolute;
  z-index: 4;
  left: 46px;
  top: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  color: #2b3e55;
  font-size: 12px;
  font-weight: 700;
}

.farmer-scene {
  position: absolute;
  z-index: 21;
  left: 1.5%;
  bottom: 7%;
  width: 105px;
  height: 205px;
  transform-origin: bottom center;
}

.farmer-head {
  position: absolute;
  top: 51px;
  left: 36px;
  width: 38px;
  height: 42px;
  border-radius: 50%;
  background: #d9a375;
}

.farmer-body {
  position: absolute;
  top: 88px;
  left: 27px;
  width: 55px;
  height: 78px;
  border-radius: 20px 20px 8px 8px;
  background:
    linear-gradient(90deg, transparent 0 17px, #2e5f77 18px 37px, transparent 38px),
    #8d3f32;
}

.farmer-arm {
  position: absolute;
  top: 100px;
  left: 72px;
  width: 16px;
  height: 60px;
  border-radius: 10px;
  background: #d9a375;
  transform: rotate(22deg);
}

.farmer-leg {
  position: absolute;
  top: 157px;
  width: 16px;
  height: 47px;
  border-radius: 8px;
  background: #2e3b44;
}

.farmer-leg.left { left: 36px; }
.farmer-leg.right { left: 61px; }

.farmer-hat {
  position: absolute;
  z-index: 5;
  top: 22px;
  left: 10px;
  width: 92px;
  height: 30px;
  border-radius: 50%;
  background: #c29a61;
  box-shadow: inset 0 -6px #9f7645;
}

.farmer-hat::before {
  content: "";
  position: absolute;
  left: 28px;
  top: -14px;
  width: 38px;
  height: 30px;
  border-radius: 50% 50% 20% 20%;
  background: #b98c55;
}

.hat-flower {
  position: absolute;
  z-index: 6;
  top: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #d84646;
  box-shadow:
    5px 0 #d84646,
    -5px 0 #d84646,
    0 5px #d84646,
    0 -5px #d84646;
}

.flower-one { left: 20px; }
.flower-two { left: 46px; background: #f1ca4b; box-shadow: 5px 0 #f1ca4b,-5px 0 #f1ca4b,0 5px #f1ca4b,0 -5px #f1ca4b; }
.flower-three { left: 68px; background: #d85e98; box-shadow: 5px 0 #d85e98,-5px 0 #d85e98,0 5px #d85e98,0 -5px #d85e98; }

@keyframes cowBreathe {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@media (max-width: 900px) {
  .farm-entry-sign { right: 2%; transform: scale(.78); transform-origin: top right; }
  .old-bridge { right: 1%; transform: scale(.78) rotate(-2deg); transform-origin: bottom right; }
  .tavern-cluster { display: none; }
  .cow-scene { transform: scale(.78); }
  .farmer-scene { transform: scale(.78); left: -1%; }
}

@media (max-width: 650px) {
  .farm-entry-sign { top: 285px; }
  .cow-scene { left: 3%; bottom: 7%; }
  .farmer-scene { left: -4%; bottom: 6%; }
  .old-bridge { right: -8%; bottom: 8%; }
  .meadow-road { width: 76%; }
}


/* Bri Rose Garden Farm idea box */
.idea-box {
  position: absolute;
  z-index: 70;
  right: 18px;
  bottom: 48px;
}

.idea-toggle {
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  padding: 11px 15px;
  background: rgba(41, 73, 47, .9);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 9px 24px rgba(0,0,0,.25);
  backdrop-filter: blur(8px);
}

.idea-panel {
  position: absolute;
  right: 0;
  bottom: 51px;
  width: min(340px, calc(100vw - 36px));
  padding: 17px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 18px;
  background: rgba(8, 23, 30, .97);
  color: #fff;
  box-shadow: 0 18px 42px rgba(0,0,0,.38);
}

.idea-panel strong {
  display: block;
  padding-right: 26px;
  font-size: 17px;
}

.idea-panel p,
.idea-panel small {
  color: rgba(255,255,255,.72);
  font-size: 12px;
  line-height: 1.5;
}

.idea-panel label {
  display: block;
  margin: 11px 0;
}

.idea-panel label span {
  display: block;
  margin-bottom: 5px;
  color: rgba(255,255,255,.72);
  font-size: 12px;
}

.idea-panel input,
.idea-panel textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 10px;
  padding: 9px 10px;
  background: rgba(0,0,0,.25);
  color: #fff;
  resize: vertical;
}

.idea-email-button {
  display: block;
  margin: 12px 0 9px;
  border-radius: 10px;
  padding: 10px 13px;
  background: #9ad18d;
  color: #17311d;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.idea-close {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 29px;
  height: 29px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 18px;
}

@media (max-width: 700px) {
  .idea-box {
    right: 12px;
    bottom: 43px;
  }

  .idea-toggle {
    padding: 9px 12px;
    font-size: 12px;
  }
}


/* V7 left-side, Safari, overlap, and drag fixes */
html,
body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

.scene {
  min-width: 320px;
  isolation: isolate;
  touch-action: manipulation;
}

.site-header {
  max-width: calc(100vw - 24px);
}

.hero-copy {
  pointer-events: none;
}

.hero-copy > * {
  pointer-events: auto;
}

.discreet-admin {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border-radius: 50%;
  opacity: .42;
  font-size: 15px;
  transition: opacity .2s ease, transform .2s ease;
}

.discreet-admin:hover,
.discreet-admin:focus-visible {
  opacity: 1;
  transform: rotate(20deg);
}

.movable-item {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  will-change: left, top, transform;
}

.movable-item.dragging {
  z-index: 90 !important;
  cursor: grabbing;
  filter: drop-shadow(0 14px 18px rgba(0,0,0,.28));
}

.movable-item.drag-disabled {
  cursor: default;
}

.drag-hint {
  position: absolute;
  z-index: 32;
  left: 50%;
  bottom: 44px;
  max-width: calc(100vw - 32px);
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(7,18,29,.46);
  color: rgba(255,255,255,.72);
  font-size: 11px;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.drag-hint.hidden {
  display: none;
}

.cow-scene,
.farmer-scene {
  left: max(8px, env(safe-area-inset-left));
}

.site-header {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.admin-panel {
  padding-right: max(21px, env(safe-area-inset-right));
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.admin-card input,
.admin-card select,
.admin-card textarea {
  font-size: 16px;
}

@supports (-webkit-touch-callout: none) {
  .clock-card,
  .admin-trigger,
  .farm-stats div,
  .admin-panel {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .movable-item {
    transform: translateZ(0);
  }
}

@media (max-width: 760px) {
  .site-header {
    max-width: none;
  }

  .hero-copy {
    top: 118px;
    z-index: 26;
  }

  .hero-copy h1 {
    max-width: 78%;
  }

  .farm-entry-sign {
    top: 250px;
    right: -18px;
    max-width: 230px;
  }

  .cow-scene {
    left: 2%;
    bottom: 5%;
  }

  .farmer-scene {
    left: -3%;
    bottom: 5%;
  }

  .drag-hint {
    bottom: 50px;
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .clock-card {
    min-width: 145px;
    max-width: calc(100vw - 72px);
  }

  .clock-card span {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .farm-entry-sign {
    transform: scale(.68);
    transform-origin: top right;
  }

  .cow-scene {
    transform: scale(.65);
    transform-origin: bottom left;
  }

  .farmer-scene {
    transform: scale(.65);
    transform-origin: bottom left;
  }

  .old-bridge {
    transform: scale(.64) rotate(-2deg);
    transform-origin: bottom right;
  }
}


/* V8 fixed lower-left Ideas panel */
.idea-box {
  position: fixed !important;
  z-index: 120;
  left: max(12px, env(safe-area-inset-left)) !important;
  right: auto !important;
  bottom: max(12px, env(safe-area-inset-bottom)) !important;
  top: auto !important;
  width: auto;
  max-width: calc(100vw - 24px);
}

.idea-toggle {
  min-height: 42px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(41,73,47,.96);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 9px 24px rgba(0,0,0,.28);
  -webkit-tap-highlight-color: transparent;
}

.idea-panel {
  position: absolute !important;
  left: 0 !important;
  right: auto !important;
  bottom: 52px !important;
  top: auto !important;
  width: min(350px, calc(100vw - 24px));
  max-height: min(560px, calc(100vh - 96px));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 18px;
  background: rgba(8,23,30,.985);
  color: #fff;
  box-shadow: 0 18px 42px rgba(0,0,0,.42);
  transform: none !important;
}

.idea-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.idea-panel-head strong {
  padding: 0;
}

.idea-close {
  position: static !important;
  flex: 0 0 auto;
}

.idea-panel input,
.idea-panel textarea {
  font-size: 16px;
}

.animal-list-safe {
  max-height: min(360px, 42vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 3px;
}

.admin-panel {
  max-width: 100vw;
  overflow-x: hidden;
}

.admin-card {
  min-width: 0;
}

.sheep-row {
  min-width: 0;
}

.sheep-row input {
  min-width: 0;
}

@media (max-width: 480px) {
  .idea-box {
    left: max(8px, env(safe-area-inset-left)) !important;
    bottom: max(8px, env(safe-area-inset-bottom)) !important;
    max-width: calc(100vw - 16px);
  }

  .idea-panel {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 76px);
    bottom: 48px !important;
  }

  .idea-toggle {
    min-height: 40px;
    padding: 9px 12px;
    font-size: 12px;
  }

  .sheep-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .sheep-row button {
    width: 100%;
  }
}


/* V9 movable structures, independent hat, and printable picture frame */
.structure-layer {
  position: absolute;
  inset: 0;
  z-index: 18;
  pointer-events: none;
}

.generated-barn {
  position: absolute;
  width: 150px;
  height: 128px;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}

.generated-barn-body {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 82px;
  border: 4px solid #4c3427;
  border-radius: 5px;
  background: #a94b42;
}

.generated-barn-roof {
  position: absolute;
  left: 3px;
  top: 8px;
  width: 144px;
  height: 58px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: #53352e;
}

.generated-barn-door {
  position: absolute;
  z-index: 2;
  left: 58px;
  bottom: 0;
  width: 36px;
  height: 57px;
  border: 3px solid #ead8b4;
  background: #633c30;
}

.generated-barn-window {
  position: absolute;
  z-index: 2;
  bottom: 41px;
  width: 24px;
  height: 22px;
  border: 3px solid #ead8b4;
  background: #ffdc77;
}

.generated-barn-window.left { left: 31px; }
.generated-barn-window.right { right: 31px; }

.barn-style-white .generated-barn-body { background: #e8e4d8; }
.barn-style-white .generated-barn-roof { background: #6c756f; }
.barn-style-wood .generated-barn-body {
  background: repeating-linear-gradient(90deg, #9a6d45 0 15px, #805738 16px 19px);
}
.barn-style-wood .generated-barn-roof { background: #4b3429; }

.structure-name {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: -25px;
  max-width: 145px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  color: #25394e;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateX(-50%);
}

.structure-list-safe {
  max-height: min(340px, 40vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.structure-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 7px;
  margin-top: 8px;
}

.structure-row input {
  min-width: 0;
}

.farmer-hat.movable-item {
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}

.farmer-hat.movable-item.dragging {
  position: fixed;
  z-index: 150 !important;
}

.frame-preview .scene {
  margin: 22px auto;
  width: min(94vw, 1200px);
  min-height: 70vw;
  max-height: 82vh;
  border: 18px solid #5d412c;
  outline: 5px solid #d4b47f;
  box-shadow: inset 0 0 0 4px #37261c;
}

.frame-preview .admin-trigger,
.frame-preview .idea-box,
.frame-preview .drag-hint {
  display: none !important;
}

.print-without-names .name-tag,
.print-without-names .cow-label,
.print-without-names .structure-name {
  display: none !important;
}

@media (max-width: 560px) {
  .structure-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .structure-row button {
    width: 100%;
  }

  .generated-barn {
    transform: translate(-50%, -50%) scale(.76);
  }
}

@media print {
  @page {
    margin: 0;
    size: landscape;
  }

  html,
  body {
    width: 100%;
    height: 100%;
    overflow: visible !important;
    background: #fff !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body[data-print-format="portrait"] {
    --print-ratio: 8.5 / 11;
  }

  body[data-print-format="square"] {
    --print-ratio: 1 / 1;
  }

  body[data-print-format="landscape"] {
    --print-ratio: 11 / 8.5;
  }

  .scene {
    width: 100vw !important;
    height: 100vh !important;
    min-height: 0 !important;
    aspect-ratio: var(--print-ratio, 11 / 8.5);
    overflow: hidden !important;
    page-break-inside: avoid;
  }

  .site-header,
  .admin-panel,
  .admin-trigger,
  .idea-box,
  .drag-hint,
  .scene-footer {
    display: none !important;
  }

  .movable-item {
    cursor: default !important;
  }
}


/* V10 multi-user sandboxes and numbered animals */
.account-status {
  display: block;
  margin-top: 4px;
  color: rgba(255,255,255,.7);
  font-size: 11px;
}

.animal-count-grid,
.user-create-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.animal-count-grid input {
  width: 100%;
}

.animal-name-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.animal-sequence {
  font-size: 12px;
  text-transform: capitalize;
}

.simple-animal {
  position: absolute;
  z-index: 21;
  display: grid;
  place-items: center;
  min-width: 58px;
  transform: translate(-50%, 0);
  pointer-events: none;
}

.simple-animal-icon {
  font-size: clamp(34px, 4vw, 58px);
  filter: drop-shadow(0 6px 5px rgba(0,0,0,.2));
}

.simple-animal .name-tag {
  position: static;
  margin-top: -3px;
}

.user-list-safe {
  max-height: min(390px, 46vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(150px, 1fr) auto auto auto;
  gap: 7px;
  align-items: center;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.user-info strong,
.user-info span {
  display: block;
}

.user-info span {
  color: rgba(255,255,255,.62);
  font-size: 11px;
}

@media (max-width: 680px) {
  .animal-count-grid,
  .user-create-grid {
    grid-template-columns: 1fr;
  }

  .animal-name-row,
  .user-row {
    grid-template-columns: 1fr;
  }

  .animal-name-row button,
  .user-row button {
    width: 100%;
  }
}


/* V11 farm-themed admin and guided animal controls */
.farm-admin-shell {
  background:
    radial-gradient(circle at top right, rgba(255,255,255,.08), transparent 32%),
    linear-gradient(180deg, rgba(36,71,49,.98), rgba(17,37,31,.99));
}

.admin-farm-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0 14px;
  padding: 12px;
  border: 1px solid rgba(231,210,160,.22);
  border-radius: 16px;
  background: rgba(255,255,255,.06);
}

.admin-farm-summary strong,
.admin-farm-summary span {
  display: block;
}

.admin-farm-summary span {
  margin-top: 2px;
  color: rgba(255,255,255,.66);
  font-size: 12px;
}

.admin-farm-badge {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: 14px;
  background: rgba(235,207,143,.18);
  font-size: 22px;
}

.admin-tabs {
  padding: 5px;
  border: 1px solid rgba(231,210,160,.17);
  border-radius: 14px;
  background: rgba(6,20,16,.32);
}

.tab-button {
  border-radius: 10px;
}

.tab-button.active {
  background: rgba(231,210,160,.2);
  color: #fff9e8;
}

.admin-card {
  border: 1px solid rgba(231,210,160,.17);
  background: rgba(255,255,255,.055);
}

.admin-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.admin-section-heading h3 {
  margin: 2px 0 0;
}

.section-kicker {
  color: rgba(235,207,143,.82);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.animal-total-badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid rgba(235,207,143,.23);
  border-radius: 999px;
  background: rgba(235,207,143,.12);
  color: #fff4cf;
  font-size: 11px;
}

.animal-quick-add {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  padding: 13px;
  border: 1px solid rgba(231,210,160,.18);
  border-radius: 16px;
  background: rgba(5,19,15,.26);
}

.animal-quick-actions {
  display: flex;
  gap: 8px;
  grid-column: 1 / -1;
}

.animal-quick-actions button {
  flex: 1;
}

.animal-sound-toggle {
  align-self: end;
}

.advanced-animal-counts {
  margin-top: 13px;
  border: 1px solid rgba(231,210,160,.15);
  border-radius: 14px;
  background: rgba(0,0,0,.1);
}

.advanced-animal-counts summary {
  cursor: pointer;
  padding: 11px 13px;
  color: #fff3d0;
  font-weight: 700;
}

.advanced-animal-counts[open] {
  padding: 0 12px 12px;
}

.advanced-animal-counts[open] summary {
  margin: 0 -12px 8px;
}

.animal-name-row {
  grid-template-columns: 96px minmax(0, 1fr) auto auto auto;
  padding: 9px;
  border: 1px solid rgba(231,210,160,.12);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
}

.animal-row-sound {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}

.admin-panel input,
.admin-panel select,
.admin-panel textarea {
  border-color: rgba(231,210,160,.18);
  background: rgba(3,15,12,.32);
}

.admin-panel input:focus,
.admin-panel select:focus,
.admin-panel textarea:focus {
  border-color: rgba(235,207,143,.65);
  box-shadow: 0 0 0 3px rgba(235,207,143,.11);
}

@media (max-width: 680px) {
  .animal-quick-add,
  .animal-count-grid {
    grid-template-columns: 1fr;
  }

  .animal-name-row {
    grid-template-columns: 1fr;
  }

  .animal-quick-actions {
    flex-direction: column;
  }
}


/* V12 reliability fixes */
.idea-panel[hidden] { display: none !important; }
.idea-panel:not([hidden]) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}
.idea-box,
.idea-toggle { pointer-events: auto !important; }
.idea-panel-open .idea-box { z-index: 220; }

.admin-panel {
  width: min(460px, 100vw);
  max-width: 100vw;
}
.admin-panel.open {
  visibility: visible;
  pointer-events: auto;
}
.admin-panel:not(.open) { pointer-events: none; }

#loginSection label {
  display: block;
  margin-top: 10px;
}
#loginSection input {
  width: 100%;
  box-sizing: border-box;
}

.structure-layer {
  position: absolute;
  inset: 0;
  z-index: 18;
  pointer-events: none;
}


/* V13 overlay safety and Ideas delivery */
.scene,
.scene * {
  isolation: auto;
}

.movable-item,
.generated-barn,
.sheep-layer,
.structure-layer,
.dream-bubble {
  z-index: 30 !important;
}

.idea-box {
  position: fixed !important;
  z-index: 9000 !important;
}

.idea-panel {
  z-index: 9001 !important;
}

.admin-panel {
  z-index: 10000 !important;
}

.admin-panel.open,
.idea-panel-open .idea-box {
  isolation: isolate;
}

body.admin-open .movable-item,
body.admin-open .generated-barn,
body.idea-panel-open .movable-item,
body.idea-panel-open .generated-barn {
  pointer-events: none !important;
}

body.admin-open .scene,
body.idea-panel-open .scene {
  user-select: none;
}

.idea-status {
  min-height: 20px;
  margin: 8px 0 0;
  color: #fff3cf;
  font-size: 12px;
}

#ideaSubmitButton[disabled] {
  opacity: .65;
  cursor: wait;
}


/* V14 enforced loading and overlay hierarchy */
.boot-status {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #203d2c, #10251b);
  color: #fff6dc;
  font: 700 16px/1.4 system-ui, sans-serif;
  text-align: center;
  transition: opacity .25s ease, visibility .25s ease;
}

.boot-status.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-status.fatal {
  color: #ffe2e2;
}

.fatal-notice {
  padding: 16px;
  background: #fff1f1;
  color: #811;
  font-family: system-ui, sans-serif;
}

body.app-loading {
  overflow: hidden;
}

body.app-ready {
  overflow-x: hidden;
}

.scene,
.scene-footer,
.hero,
.site-header {
  position: relative;
  z-index: 1;
}

.structure-layer,
.sheep-layer,
.movable-item,
.generated-barn,
.dream-bubble {
  z-index: 30 !important;
}

.idea-box {
  z-index: 9000 !important;
}

.idea-panel {
  z-index: 9001 !important;
}

.admin-panel {
  z-index: 10000 !important;
}

body.admin-open .scene,
body.idea-panel-open .scene {
  pointer-events: none;
}

body.admin-open .admin-panel,
body.idea-panel-open .idea-box,
body.idea-panel-open .idea-panel {
  pointer-events: auto !important;
}


/* V15 direct body-level controls and click enforcement */
#openAdmin {
  position: relative !important;
  z-index: 8500 !important;
  pointer-events: auto !important;
  touch-action: manipulation;
}

.site-header,
.top-actions {
  position: relative;
  z-index: 8400 !important;
  pointer-events: auto;
}

#ideaBox {
  position: fixed !important;
  left: 16px !important;
  bottom: 16px !important;
  z-index: 9000 !important;
  pointer-events: auto !important;
  isolation: isolate;
}

#ideaToggle {
  position: relative !important;
  z-index: 9002 !important;
  pointer-events: auto !important;
  touch-action: manipulation;
}

#ideaPanel {
  position: absolute !important;
  left: 0 !important;
  bottom: calc(100% + 10px) !important;
  z-index: 9001 !important;
  pointer-events: auto !important;
}

#ideaPanel[hidden] {
  display: none !important;
}

#adminPanel {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 10000 !important;
  pointer-events: none !important;
  visibility: hidden;
}

#adminPanel.open {
  pointer-events: auto !important;
  visibility: visible !important;
}

#adminPanel *,
#ideaBox * {
  pointer-events: auto;
}

body.admin-open .scene,
body.idea-panel-open .scene {
  pointer-events: none !important;
}

body.admin-open #adminPanel,
body.idea-panel-open #ideaBox {
  pointer-events: auto !important;
}

.boot-status.hidden,
.boot-status[aria-hidden="true"] {
  pointer-events: none !important;
}

@media (max-width: 600px) {
  #ideaBox {
    left: 8px !important;
    bottom: 8px !important;
  }

  #ideaPanel {
    width: min(360px, calc(100vw - 16px)) !important;
    max-height: min(70vh, 540px);
    overflow: auto;
  }
}


/* V16 restore original top-right Admin placement */
.site-header {
  position: relative !important;
  z-index: 8400 !important;
}

.top-actions.original-admin-position {
  position: relative !important;
  z-index: 8500 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 12px !important;
  pointer-events: auto !important;
}

#openAdmin {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  z-index: 8501 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 auto !important;
  pointer-events: auto !important;
  touch-action: manipulation;
}

@media (min-width: 701px) {
  .site-header {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
  }

  .top-actions.original-admin-position {
    margin-left: auto !important;
  }
}

@media (max-width: 700px) {
  .site-header {
    position: relative !important;
  }

  .top-actions.original-admin-position {
    width: 100% !important;
    justify-content: flex-end !important;
  }

  #openAdmin {
    margin-left: auto !important;
  }
}

/* Panel still opens from the right above all farm content */
#adminPanel {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: auto !important;
  transform: translateX(105%);
  transition: transform .24s ease, visibility .24s ease;
  z-index: 10000 !important;
}

#adminPanel.open {
  transform: translateX(0) !important;
  visibility: visible !important;
  pointer-events: auto !important;
}


/* V17 modernized old-farm landscape only */
.scene {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 16%, rgba(255, 245, 190, .92) 0 5%, rgba(255, 245, 190, 0) 14%),
    linear-gradient(180deg, #8fc7dc 0%, #b9dce5 34%, #dfe8cf 35%, #8fb66d 63%, #567a42 100%);
}

.scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(168deg, transparent 0 57%, rgba(255,255,255,.12) 57.2% 57.8%, transparent 58%),
    repeating-linear-gradient(
      102deg,
      rgba(255,255,255,.035) 0 2px,
      transparent 2px 18px
    );
  mix-blend-mode: soft-light;
}

.scene::after {
  content: "";
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: 0;
  height: 42%;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 100%, rgba(54, 92, 50, .86) 0 30%, transparent 31%),
    radial-gradient(ellipse at 48% 110%, rgba(72, 111, 56, .9) 0 34%, transparent 35%),
    radial-gradient(ellipse at 82% 105%, rgba(43, 79, 43, .9) 0 33%, transparent 34%);
}

.hill,
.field,
.ground,
.pasture {
  filter: saturate(.9) contrast(1.03);
}

.barn,
.generated-barn {
  filter: saturate(.88) contrast(1.04);
}

.fence,
.farm-fence {
  filter: sepia(.16) saturate(.85);
}

.tree,
.bush,
.flower-patch {
  filter: saturate(.88);
}

.cloud {
  opacity: .88;
  filter: blur(.1px);
}

.sun,
.moon {
  filter: drop-shadow(0 0 18px rgba(255, 238, 168, .32));
}

.scene .farm-title,
.scene .farm-subtitle {
  text-shadow: 0 2px 14px rgba(28, 48, 34, .22);
}

@media (max-width: 700px) {
  .scene {
    background:
      radial-gradient(circle at 75% 13%, rgba(255, 245, 190, .9) 0 4%, rgba(255, 245, 190, 0) 12%),
      linear-gradient(180deg, #91c8dc 0%, #c4dfe5 34%, #dce6cd 35%, #87ad69 63%, #52733e 100%);
  }

  .scene::after {
    height: 38%;
  }
}


/* V19 farmer and sleeping sheep visual improvements only */
.farmer-modern {
  position: absolute;
  width: 58px;
  height: 92px;
  transform-origin: 50% 100%;
  animation: farmer-idle-v19 3.8s ease-in-out infinite;
  filter: drop-shadow(0 8px 7px rgba(47, 57, 38, .22));
}

.farmer-modern::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 4px;
  width: 36px;
  height: 19px;
  border-radius: 52% 52% 35% 35%;
  background:
    linear-gradient(180deg, #d9b262 0 28%, #a77532 29% 100%);
  box-shadow:
    0 4px 0 #7f5627,
    -7px 9px 0 -4px #bd8c45,
    7px 9px 0 -4px #bd8c45;
  z-index: 4;
}

.farmer-modern::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 25px;
  width: 31px;
  height: 58px;
  border-radius: 14px 14px 10px 10px;
  background:
    linear-gradient(90deg, transparent 0 17%, #426489 18% 35%, #d3e0e8 36% 64%, #426489 65% 82%, transparent 83%),
    linear-gradient(180deg, #b86444 0 26%, #476b92 27% 72%, #5b4635 73% 100%);
  box-shadow:
    -10px 15px 0 -5px #b86444,
    10px 15px 0 -5px #b86444,
    -6px 52px 0 -3px #5a4432,
    6px 52px 0 -3px #5a4432;
  z-index: 2;
}

.farmer-face {
  position: absolute;
  left: 19px;
  top: 22px;
  width: 22px;
  height: 20px;
  border-radius: 48% 48% 46% 46%;
  background: #d9a16f;
  z-index: 5;
}

.farmer-face::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 7px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #3e302a;
  box-shadow: 9px 0 0 #3e302a;
  animation: farmer-blink-v19 5.2s infinite;
}

.farmer-face::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 13px;
  width: 7px;
  height: 3px;
  border-bottom: 2px solid #7c4b3d;
  border-radius: 0 0 50% 50%;
}

.farmer-shadow {
  position: absolute;
  left: 8px;
  bottom: -2px;
  width: 44px;
  height: 11px;
  border-radius: 50%;
  background: rgba(41, 65, 36, .26);
  filter: blur(2px);
  z-index: -1;
}

@keyframes farmer-idle-v19 {
  0%, 100% { transform: translateY(0) rotate(-.4deg); }
  50% { transform: translateY(-2px) rotate(.4deg); }
}

@keyframes farmer-blink-v19 {
  0%, 45%, 47%, 100% { transform: scaleY(1); }
  46% { transform: scaleY(.12); }
}

.sheep-enhanced {
  position: absolute;
  transform-origin: 50% 90%;
  filter: drop-shadow(0 5px 5px rgba(48, 61, 38, .18));
}

.sheep-enhanced::before {
  content: "";
  position: absolute;
  inset: 4px 2px 8px;
  border-radius: 48% 52% 44% 50%;
  background:
    radial-gradient(circle at 25% 28%, rgba(255,255,255,.96) 0 16%, transparent 17%),
    radial-gradient(circle at 50% 18%, rgba(248,248,242,.95) 0 18%, transparent 19%),
    radial-gradient(circle at 74% 31%, rgba(255,255,255,.94) 0 17%, transparent 18%),
    radial-gradient(circle at 33% 64%, rgba(241,241,233,.95) 0 20%, transparent 21%),
    radial-gradient(circle at 67% 62%, rgba(249,249,243,.96) 0 21%, transparent 22%);
  opacity: .9;
  pointer-events: none;
}

.sheep-variant-1 { transform: scale(.96) rotate(-1deg); }
.sheep-variant-2 { transform: scale(1.04) rotate(1deg); }
.sheep-variant-3 { transform: scaleX(-1) scale(.98); }

.sheep-sleeping {
  transform: rotate(-6deg) scale(.96);
  animation: sheep-breathe-v19 3.5s ease-in-out infinite;
}

.sheep-sleeping::before {
  inset: 11px 1px 4px;
  border-radius: 54% 48% 56% 44%;
}

.sheep-sleeping::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 19px;
  width: 16px;
  height: 13px;
  border-radius: 55% 48% 50% 45%;
  background: #4d463f;
  box-shadow:
    -4px -3px 0 -2px #74685e,
    5px 2px 0 -3px #2e2a27;
  transform: rotate(10deg);
}

.sleep-zzz {
  position: absolute;
  right: -11px;
  top: -7px;
  z-index: 6;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  color: rgba(54, 72, 86, .8);
  text-shadow: 0 1px 0 rgba(255,255,255,.65);
  animation: sleep-zzz-v19 2.7s ease-in-out infinite;
  pointer-events: none;
}

.sleep-shadow {
  position: absolute;
  left: 6px;
  right: 4px;
  bottom: -3px;
  height: 9px;
  border-radius: 50%;
  background: rgba(43, 64, 39, .22);
  filter: blur(2px);
  z-index: -1;
}

@keyframes sheep-breathe-v19 {
  0%, 100% { transform: rotate(-6deg) scale(.96, .96); }
  50% { transform: rotate(-6deg) scale(.985, 1.015); }
}

@keyframes sleep-zzz-v19 {
  0% { transform: translate(0, 4px) scale(.84); opacity: 0; }
  28% { opacity: .9; }
  100% { transform: translate(7px, -15px) scale(1.05); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .farmer-modern,
  .farmer-face::before,
  .sheep-sleeping,
  .sleep-zzz {
    animation: none !important;
  }
}

@media (max-width: 700px) {
  .farmer-modern {
    transform: scale(.9);
  }

  .sleep-zzz {
    font-size: 12px;
  }
}


/* V20 secure login refinements */
.password-field{display:flex;align-items:center;gap:8px}.password-field input{min-width:0;flex:1}
.password-toggle{flex:0 0 auto;min-width:58px;padding:9px 10px;border:1px solid rgba(255,255,255,.18);border-radius:10px;background:rgba(255,255,255,.08);color:#fff;font-size:12px;font-weight:700}
.password-toggle:hover,.password-toggle:focus-visible{background:rgba(255,255,255,.14)}
.caps-lock{display:block;margin:-5px 0 10px;color:#ffd77b;font-weight:700}
#loginButton:disabled{cursor:wait;opacity:.68}
