:root{
  color-scheme:light;
  --paper:#f7f4e8;--ink:#253924;--muted:#486040;--edge:#cdcdb3;
  font-family:system-ui,-apple-system,"PingFang SC","Microsoft YaHei",sans-serif;
  background:var(--paper);color:var(--ink)
}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{overscroll-behavior:none}
button,input{font:inherit}
button{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
button:focus-visible,input:focus-visible{outline:3px solid #315a2e;outline-offset:3px}
.farm{
  height:100%;height:100dvh;min-height:252px;max-width:1800px;margin-inline:auto;
  padding:max(10px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));
  display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:10px;
  background:radial-gradient(ellipse at 51% 4%,#fff8dc 0,transparent 64%)
}
.top,.brand,.audio,.audio label,.feeding{display:flex;align-items:center}
.top{justify-content:space-between;gap:10px;min-width:0}
.brand{gap:8px;white-space:nowrap}
.brand-mark{display:grid;place-items:center;width:35px;height:35px;background:#e4ecd0;color:#42603a;border-radius:50%}
h1{font-size:clamp(1.1rem,2.3vw,1.65rem);letter-spacing:.045em;margin:0;line-height:1.08}
.audio{gap:8px;min-width:0}
.audio button{
  padding:.3rem .55rem;min-height:40px;border:1px solid var(--edge);
  border-radius:10px;background:#fcfaed;color:var(--muted);cursor:pointer;
  font-weight:650;font-size:.78rem;white-space:nowrap
}
.audio button[aria-pressed="false"]{background:#eeede0;color:#50584a}
.audio label{gap:5px;color:var(--muted);font-size:.75rem;white-space:nowrap}
#volume{width:clamp(44px,11vw,110px);height:36px;margin:0;accent-color:#597841;cursor:pointer}
.farm-view{
  position:relative;min-width:0;min-height:0;overflow:hidden;border:1px solid #b8caab;
  border-radius:clamp(12px,2vw,24px);
  background:linear-gradient(#bce2eb,#f0f2c9 62%,#a7c87a);
  box-shadow:0 7px 20px #50603d19
}
#scene{display:block;position:absolute;inset:0;width:100%;height:100%}
.farm-view noscript p{position:relative;text-align:center;padding:1em}
.feeding{flex-direction:column;justify-content:center;gap:8px;padding-bottom:4px}
.farm-actions{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;
  width:min(100%,510px);min-width:0
}
.farm-actions:empty{display:none}
#feed{
  display:inline-flex;align-items:center;justify-content:center;gap:.5em;
  color:#3c2a16;background:#ffd181;border:1px solid #ae803b;border-radius:16px;
  width:clamp(165px,63vw,280px);min-height:61px;padding:.46rem 1.4rem;
  font-size:clamp(1.21rem,3.4vw,1.64rem);font-weight:780;letter-spacing:.07em;
  box-shadow:0 3px 0 #ba8747,0 6px 16px #805a3223;cursor:pointer
}
#feed:hover{background:#ffdc9a}
#feed:active{transform:translateY(2px);box-shadow:0 1px 0 #ba8747}
@media(max-width:360px){
  .farm{gap:7px}
  .top,.brand,.audio{gap:5px}
  .brand-mark{width:28px;height:28px}.brand-mark svg{width:22px;height:22px}
  .audio label{gap:2px}.audio button{padding-inline:.34rem}
}
@media(orientation:landscape) and (max-height:500px){
  .farm{gap:5px;padding-top:max(5px,env(safe-area-inset-top));padding-bottom:max(6px,env(safe-area-inset-bottom))}
  .brand-mark{width:30px;height:30px}.audio button{min-height:33px}#volume{height:32px}
  #feed{min-height:46px;padding-block:.25rem;font-size:1.18rem}
}
@media(min-width:1000px) and (min-height:600px){
  .farm{gap:14px;padding-inline:max(22px,env(safe-area-inset-left)) max(22px,env(safe-area-inset-right))}
}
@media(prefers-reduced-motion:reduce){#feed:active{transform:none}}

/* Keep secondary actions in the dock, never across the scene. */
.farm-hotspot{
  --hot-bg:#fff8e4;--hot-ink:#3f3526;--hot-border:#836843;--hot-active:#ffdea4;
  display:inline-flex;align-items:center;justify-content:center;gap:.28em;
  width:100%;min-width:44px;min-height:44px;margin:0;padding:.35em .45em;
  border:1px solid var(--hot-border);border-radius:12px;
  color:var(--hot-ink);background:var(--hot-bg);box-shadow:0 2px 5px #35281238;
  font-size:clamp(.78rem,2.7vw,.91rem);font-weight:750;line-height:1.1;
  cursor:pointer;user-select:none;-webkit-user-select:none
}
.farm-hotspot[hidden]{display:none}
.farm-hotspot[data-action="pet"]{--hot-bg:#fff1eb;--hot-ink:#68372e;--hot-border:#9c695a;--hot-active:#ffd5c4}
.farm-hotspot[data-action="mud"]{--hot-bg:#fff1d8;--hot-ink:#634521;--hot-border:#8f683b;--hot-active:#f9d490}
.farm-hotspot[data-action="bell"]{--hot-bg:#fff7cb;--hot-ink:#5f461d;--hot-border:#977234;--hot-active:#ffdf81}
.farm-hotspot[data-action="pump"]{--hot-bg:#eaf7f7;--hot-ink:#20545a;--hot-border:#528187;--hot-active:#bce5ef}
.farm-hotspot :is(svg,[aria-hidden="true"]){flex:none;pointer-events:none}
.farm-hotspot-icon{font-size:1.03em;line-height:1}
.farm-hotspot-label{white-space:nowrap}
.farm-hotspot svg{width:1.12em;height:1.12em}
@media(hover:hover){.farm-hotspot:hover{background:var(--hot-active)}}
.farm-hotspot:active,.farm-hotspot[data-active="true"]{
  background:var(--hot-active);box-shadow:inset 0 1px 3px #3528123e
}
.farm-hotspot:focus-visible{
  z-index:1;outline:2px solid #fff;outline-offset:2px;box-shadow:0 0 0 5px #315a2e
}
@media(max-width:390px){
  .farm-actions{gap:5px}
  .farm-hotspot{flex-direction:column;gap:2px;padding-inline:2px}
}
@media(min-width:760px),(orientation:landscape) and (min-width:440px) and (max-height:500px){
  .feeding{flex-direction:row;align-items:stretch;gap:10px}
  .farm-actions{width:min(62%,510px)}
  .feeding #feed{width:clamp(111px,24vw,225px);flex:none}
}
@media(orientation:landscape) and (min-width:440px) and (max-width:535px) and (max-height:500px){
  .farm-hotspot{flex-direction:column;gap:2px;padding-inline:2px}
}

/* A quiet visual cue for hungry pigs also works with sound off. */
#feed[data-hungry="true"]{
  background:#ffe3a8;
  border-color:#9a671d;
  box-shadow:0 3px 0 #ba8747,0 0 0 3px #d69b3b,0 6px 16px #805a3223;
}
