/* V160: original wallet artwork + matching XP artwork. All values and actions remain live. */
#fermaHeaderV3 > .v34-status.v41-status.v42-43-status:not([hidden]) {
 display:block!important; height:auto!important; min-height:0!important; max-height:none!important;
 aspect-ratio:5.36; margin:0!important; padding:0!important; background:none!important;
 container-type:inline-size;
}
#fermaHeaderV3 > .v34-status.v41-status.v42-43-status #v41ExperienceBar.v42-43-xp {
 position:relative!important; display:flex!important; justify-content:flex-start!important; align-items:center!important;
 width:100%!important; height:100%!important; min-height:0!important; max-height:none!important;
 padding:0!important; margin:0!important; border:0!important; gap:0!important; box-shadow:none!important;
 background:transparent url('v160/experience.webp') center / 100% 100% no-repeat!important;
}
#fermaHeaderV3 > .v34-status.v41-status.v42-43-status #v41ExperienceBar .v42-ref32-level {
 left:calc(10.7% - 25px)!important; top:4%!important; margin:0!important; padding:0!important; background:none!important; border:0!important;
}
#fermaHeaderV3 #v41ExperienceBar .v42-ref32-level svg {visibility:hidden!important;}
#fermaHeaderV3 > .v34-status.v41-status.v42-43-status #v41ExperienceBar #v42HeaderLevel {
 font-size:clamp(12px,4cqw,26px)!important; color:#442000!important; text-shadow:0 1px 1px #fff3a2!important;
}
#fermaHeaderV3 > .v34-status.v41-status.v42-43-status #v41ExperienceBar .v42-ref32-track {
 position:absolute!important; left:17.65%!important; top:35.8%!important; width:74.15%!important; height:41.5%!important;
 min-height:0!important; max-height:none!important; margin:0!important; padding:0!important;
 border:0!important; border-radius:999px!important; background:transparent!important; box-shadow:none!important; overflow:hidden!important;
}
#fermaHeaderV3 > .v34-status.v41-status.v42-43-status #v41ExperienceBar .v42-ref32-track #v41ExperienceFill {
 background:linear-gradient(180deg,#f3ff88 0%,#aeea0d 18%,#62bd00 65%,#318607 100%)!important;
 border-radius:999px!important; box-shadow:inset 0 1px 2px #efffa6,inset 0 -2px 3px #2c6500!important;
}
#fermaHeaderV3 > .v34-status.v41-status.v42-43-status #v41ExperienceBar .v42-ref32-track strong {
 font-size:clamp(9px,3.8cqw,24px)!important; color:#fff9dd!important; font-weight:900!important; text-shadow:0 1px 2px #071e03,1px 0 #071e03,-1px 0 #071e03!important;
}
#fermaHeaderV3 > .v42-42-currency.v42-43-currency:not([hidden]) {
 display:block!important; height:auto!important; min-height:0!important; max-height:none!important; aspect-ratio:6.296;
 padding:0!important; margin:0 0 3px!important; background:none!important; border:0!important; box-shadow:none!important;
 container-type:inline-size;
}
#fermaHeaderV3 > .v42-42-currency.v42-43-currency #v160Wallet.v41-inline-wallet {
 position:relative!important; display:block!important; width:100%!important; height:100%!important;
 min-height:0!important; max-height:none!important; margin:0!important; padding:0!important;
 border:0!important; border-radius:0!important; box-shadow:none!important; overflow:visible!important;
 background:transparent url('v160/wallet.webp') center / 100% 100% no-repeat!important;
}
#fermaHeaderV3 > .v42-42-currency.v42-43-currency #v160Wallet > div {
 position:absolute!important; inset:0!important; width:100%!important; height:100%!important; max-width:none!important;
 min-height:0!important; max-height:none!important; background:none!important; border:0!important; box-shadow:none!important;
 padding:0!important; margin:0!important; overflow:visible!important; pointer-events:none;
}
#fermaHeaderV3 #v160Wallet img.v42-wallet-currency-icon {visibility:hidden!important; position:absolute!important;}
#fermaHeaderV3 > .v42-42-currency.v42-43-currency #v160Wallet > div > b {
 position:absolute!important; left:18%!important; top:51%!important; width:22%!important; max-width:none!important;
 transform:translateY(-50%)!important; margin:0!important; padding:0!important; text-align:center!important;
 font-size:clamp(10px,4.35cqw,29px)!important; font-weight:950!important; font-variant-numeric:tabular-nums;
 color:#fff7dd!important; text-shadow:0 2px 1px #181707,1px 0 #181707,-1px 0 #181707!important; line-height:1!important; pointer-events:auto;
}
#fermaHeaderV3 > .v42-42-currency.v42-43-currency #v160Wallet > #diamonds-balance > b {left:63%!important; width:23.1%!important;}
/* The original plus signs are part of the picture; transparent real buttons cover them. */
html body:not(#v160-a):not(#v160-b):not(#v160-c):not(#v160-d):not(#v160-e) #fermaHeaderV3 #v160Wallet button.v42-ref-plus {
 position:absolute!important; left:40.1%!important; top:23%!important; width:8.6%!important; height:57%!important;
 min-width:0!important; max-width:none!important; min-height:0!important; max-height:none!important;
 background:transparent!important; border:0!important; border-image:none!important; box-shadow:none!important; border-radius:15%!important;
 color:transparent!important; text-shadow:none!important; padding:0!important; margin:0!important; pointer-events:auto; cursor:pointer;
}
html body:not(#v160-a):not(#v160-b):not(#v160-c):not(#v160-d):not(#v160-e) #fermaHeaderV3 #v160Wallet #diamonds-balance button.v42-ref-plus {left:86.25%!important;}
#fermaHeaderV3 #v160Wallet .v42-ref-plus:focus-visible {outline:2px solid white!important;outline-offset:0!important;}
/* Keep both panels compact on desktop without changing the existing game width. */
@media (min-width:721px){
 #fermaHeaderV3 > .v34-status.v41-status.v42-43-status:not([hidden]), #fermaHeaderV3 > .v42-42-currency.v42-43-currency:not([hidden]){max-width:640px!important; margin-left:auto!important;margin-right:auto!important;}
}

/* The old rows remain in the DOM for compatibility, but no longer occupy space. */
html body header.top.v42-ref32-header.ferma-v3-header {
 position:sticky!important;top:0!important;z-index:90!important;
 display:block!important;width:100%!important;max-width:none!important;
 height:auto!important;min-height:0!important;max-height:none!important;
 margin:0!important;padding:2px 3px 3px!important;gap:0!important;
 background:transparent!important;background-image:none!important;
 border:0!important;box-shadow:none!important;border-radius:0!important;overflow:visible!important;
}
html body header.top.ferma-v3-header::before,html body header.top.ferma-v3-header::after{display:none!important;content:none!important}
html body header.top.ferma-v3-header>.v69-header-row,html body header.top.ferma-v3-header>.v42-ref-brand,html body header.top.ferma-v3-header>.v31-head-actions{display:none!important}
#fermaHeaderV3{display:grid!important;grid-template-columns:68px minmax(0,1fr) 36px 32px;grid-template-rows:30px 34px 30px;grid-template-areas:'title title mail full' 'avatar xp xp xp' 'avatar wallet wallet wallet';align-items:center;gap:2px 3px;box-sizing:border-box;width:100%;max-width:760px;margin:0 auto;padding:0;min-width:0;background:transparent!important;}
html body header.top.ferma-v3-header #fermaHeaderV3>.v42-ref-title{grid-area:title!important;position:relative!important;inset:auto!important;transform:none!important;width:100%!important;min-width:0!important;max-width:none!important;height:30px!important;min-height:30px!important;max-height:30px!important;margin:0!important;padding:1px 3px!important;box-sizing:border-box!important;}
#fermaHeaderV3>.v42-ref-title strong{font-size:clamp(13px,3.8vw,20px)!important;}
#fermaHeaderPortrait{grid-area:avatar;display:flex;align-items:center;justify-content:center;min-width:0;width:100%;height:100%;background:transparent!important;box-shadow:none!important;border:0!important;}
html body header.top.ferma-v3-header #fermaHeaderPortrait #v128PersistentAvatar{position:relative!important;inset:auto!important;transform:none!important;width:64px!important;min-width:64px!important;max-width:64px!important;height:64px!important;min-height:64px!important;max-height:64px!important;flex:0 0 64px!important;background:transparent!important;background-image:none!important;border:0!important;border-radius:0!important;box-shadow:none!important;padding:0!important;margin:0!important;}
#fermaHeaderV3>#v41MailboxButton,#fermaHeaderV3>#fullscreenToggle{position:relative!important;inset:auto!important;transform:none!important;display:grid!important;place-items:center!important;box-sizing:border-box!important;width:100%!important;min-width:0!important;max-width:none!important;height:30px!important;min-height:30px!important;max-height:30px!important;padding:0!important;margin:0!important;background:linear-gradient(#8fc82b,#397a15)!important;border:2px solid #e8ba47!important;border-radius:8px!important;box-shadow:inset 0 0 0 1px #fff3a477!important;color:white!important;font:700 21px/1 system-ui!important;}
#fermaHeaderV3>#v41MailboxButton{grid-area:mail!important;}#fermaHeaderV3>#fullscreenToggle{grid-area:full!important;}#fermaHeaderV3>#fullscreenToggle span{display:none!important;}
#fermaHeaderV3>#v41MailboxButton[hidden]{display:none!important;}
#fermaHeaderV3 > .v34-status.v41-status.v42-43-status:not([hidden]),#fermaHeaderV3 > .v42-42-currency.v42-43-currency:not([hidden]){position:relative!important;display:block!important;box-sizing:border-box!important;width:100%!important;min-width:0!important;max-width:none!important;height:100%!important;min-height:0!important;max-height:none!important;aspect-ratio:auto!important;margin:0!important;padding:0!important;overflow:visible!important;container-type:inline-size;}
#fermaHeaderV3 > .v34-status{grid-area:xp;}#fermaHeaderV3 > .v42-42-currency{grid-area:wallet;}
#fermaHeaderV3 > .v34-status #v41ExperienceBar,#fermaHeaderV3 > .v42-42-currency #v160Wallet{box-sizing:border-box!important;width:100%!important;min-width:0!important;max-width:none!important;height:100%!important;min-height:0!important;max-height:none!important;overflow:visible!important;}
#fermaHeaderV3 #v41ExperienceBar .v42-ref32-level{position:absolute!important;left:10.7%!important;top:55%!important;width:12%!important;min-width:0!important;max-width:none!important;height:74%!important;min-height:0!important;max-height:none!important;transform:translate(-50%,-50%)!important;display:grid!important;place-items:center!important;}
#fermaHeaderV3 #v42HeaderLevel{position:absolute!important;left:50%!important;top:50%!important;transform:translate(-50%,-50%)!important;line-height:1!important;white-space:nowrap!important;font-size:clamp(9px,3.8cqw,17px)!important;text-align:center!important;}
#fermaHeaderV3 #v41ExperienceBar .v42-ref32-track strong{font-size:clamp(9px,3.6cqw,17px)!important;white-space:nowrap!important;}
#fermaHeaderV3 > .v42-42-currency #v160Wallet > div > b{font-size:clamp(8px,3.45cqw,17px)!important;white-space:nowrap!important;}
#fermaHeaderV3 > .v34-status[hidden],#fermaHeaderV3 > .v42-42-currency[hidden]{display:none!important;}
html body header.top.ferma-v3-header:not(.ferma-v3-active) #fermaHeaderV3{grid-template-columns:minmax(0,1fr);grid-template-rows:30px;grid-template-areas:'title';}
header.ferma-v3-header:not(.ferma-v3-active) #fermaHeaderV3>:not(.v42-ref-title){display:none!important;}
#fermaLogoutV3{display:flex;justify-content:center;padding:8px 8px 12px;margin:0;}
#fermaLogoutV3[hidden]{display:none!important;}
html body #fermaLogoutV3 #logout{position:static!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;transform:none!important;width:min(240px,100%)!important;min-width:0!important;max-width:none!important;min-height:36px!important;height:auto!important;max-height:none!important;padding:6px 12px!important;background:linear-gradient(#658d32,#315823)!important;color:#fff4d8!important;border:1px solid #d6ae5d!important;border-radius:8px!important;font:700 14px/1.2 system-ui!important;}
@media(max-width:350px){#fermaHeaderV3{grid-template-columns:60px minmax(0,1fr) 34px 30px;}html body header.top.ferma-v3-header #fermaHeaderPortrait #v128PersistentAvatar{width:58px!important;height:58px!important;min-width:58px!important;max-width:58px!important;min-height:58px!important;max-height:58px!important;flex-basis:58px!important;}}
@media(min-width:721px){#fermaHeaderV3{grid-template-columns:76px minmax(0,1fr) 38px 34px;grid-template-rows:32px 38px 34px;}html body header.top.ferma-v3-header #fermaHeaderPortrait #v128PersistentAvatar{width:72px!important;height:72px!important;min-width:72px!important;max-width:72px!important;min-height:72px!important;max-height:72px!important;flex-basis:72px!important;}}
/* Match the artwork coordinates, overriding the old full-width panel rules. */
#fermaHeaderV3 > .v34-status.v41-status.v42-43-status #v41ExperienceBar .v42-ref32-level{position:absolute!important;left:10.7%!important;top:55%!important;width:12%!important;height:74%!important;transform:translate(-50%,-50%)!important;display:grid!important;place-items:center!important;}
#fermaHeaderV3 > .v34-status.v41-status.v42-43-status #v41ExperienceBar #v42HeaderLevel{position:absolute!important;left:50%!important;top:50%!important;right:auto!important;bottom:auto!important;transform:translate(-50%,-50%)!important;margin:0!important;padding:0!important;font-size:clamp(9px,3.8cqw,17px)!important;font-weight:900!important;line-height:1!important;}
#fermaHeaderV3 > .v34-status.v41-status.v42-43-status #v41ExperienceBar .v42-ref32-track{display:block!important;position:absolute!important;left:17.65%!important;top:35.8%!important;width:74.15%!important;height:41.5%!important;}
#fermaHeaderV3 > .v34-status.v41-status.v42-43-status #v41ExperienceBar .v42-ref32-track strong{position:absolute!important;inset:0!important;transform:none!important;display:flex!important;align-items:center!important;justify-content:center!important;margin:0!important;padding:0!important;line-height:1!important;font-size:clamp(9px,3.6cqw,17px)!important;}
#fermaHeaderV3 > .v34-status.v41-status.v42-43-status #v41ExperienceFill{position:absolute!important;left:0!important;top:0!important;height:100%!important;max-width:100%!important;}
#fermaHeaderV3 > .v42-42-currency.v42-43-currency #v160Wallet > div > b{font-size:clamp(8px,3.45cqw,17px)!important;}
html body.v128-main-toolbar:has(header.ferma-v3-active){padding-top:0!important;}
html body.v128-main-toolbar:has(header.ferma-v3-active) > .shell{padding-top:0!important;}


/* V5: remove the obsolete toolbar from flow, not just its contents. */
html body header.top.v31-top.v42-ref32-header.v42-43-header.ferma-v3-header > .v69-header-row,
html body header.top.v31-top.v42-ref32-header.v42-43-header.ferma-v3-header > .v42-ref-brand,
html body header.top.v31-top.v42-ref32-header.v42-43-header.ferma-v3-header > .v31-head-actions {display:none!important;height:0!important;min-height:0!important;margin:0!important;padding:0!important;}
html body header.top.ferma-v3-header #fermaHeaderV3 {margin:0 auto!important;position:relative!important;z-index:1!important;}
html body:has(header.ferma-v3-active) {padding-top:0!important;margin-top:0!important;}
html body:has(header.ferma-v3-active) > .shell {padding-top:0!important;margin-top:0!important;}
html body #game:not([hidden]) > #screen .v161-farm-menu>h2{display:none!important;}
html body #game:not([hidden]) > #screen .v161-farm-menu{padding-top:0!important;margin-top:0!important;}
/* Bring the original upper foliage in front of the decorative top edge, without blocking taps. */
@media (max-width:720px){
 #fermaHeaderV3::before,#fermaHeaderV3::after{content:'';position:absolute;top:0;width:clamp(20px,7vw,40px);height:12px;z-index:8;pointer-events:none;background: url('v40-green-background.webp') center center / 100vw 100dvh no-repeat fixed;}
 #fermaHeaderV3::before{left:0;clip-path:polygon(0 0,100% 0,83% 30%,62% 35%,52% 85%,38% 52%,17% 100%,0 60%);}
 #fermaHeaderV3::after{right:0;clip-path:polygon(0 0,100% 0,100% 60%,83% 100%,62% 52%,48% 85%,38% 35%,17% 30%);}
}

/* V6: exclude the header portrait from the shared nine-slice button artwork.
   The default portraits and personal decorative frames retain their original alpha. */
html body:not(#v159-sentinel-a):not(#v159-sentinel-b):not(#v159-sentinel-c):not(#v159-sentinel-d):not(#v159-sentinel-e) header.ferma-v3-header #fermaHeaderPortrait #v128PersistentAvatar {
 background:transparent!important; background-image:none!important; border:0!important;
 border-image:none!important; border-image-source:none!important; box-shadow:none!important;
}
html body header.ferma-v3-header #fermaHeaderPortrait #v128PersistentAvatar::before,
html body header.ferma-v3-header #fermaHeaderPortrait #v128PersistentAvatar::after {
 content:none!important; display:none!important;
}
