/* the shop sheet's close row sits inside #p4shopB: stuck to the bottom like part 1's (owner, 2026-10-17) */
#p4shopB>.row:last-child{position:sticky;bottom:-16px;margin:12px -18px -16px;padding:10px 18px 14px;background:var(--diep);border-top:2px solid rgba(29,25,21,.25);z-index:2}
/* the Mời khách tab of the house and of an eating house (khachquen.js p4Tabs), like part 1's stalls */
#p4home.tab-moi #p4homeB>:not(.treat):not(.uptabs),#p4shop.tab-moi #p4shopB>:not(.treat):not(.uptabs):not(.row:last-child){display:none!important}
.p4sheet:not(.tab-moi) .uptabs~.treat{display:none}
/* Chương IV phần 2 · Phố Huyện (js/ch4b/): its own top bar and the hands holding a flower lantern; the sheets use .c4sheet/.card4 */
#p4hud{position:fixed;left:0;right:0;top:0;display:flex;justify-content:space-between;align-items:flex-start;gap:8px;padding:calc(12px + env(safe-area-inset-top,0px)) 16px 0;z-index:4;pointer-events:none}
#p4hud .tag{font-family:var(--display);font-weight:900;font-size:14px;color:var(--ink);white-space:nowrap}
#p4hud button.tag{pointer-events:auto;cursor:pointer}
#p4hud .right{display:flex;flex-direction:column;align-items:flex-end;gap:6px}
#p4hud .mid{position:absolute;left:50%;transform:translateX(-50%);top:calc(12px + env(safe-area-inset-top,0px))}
#p4hud .bar{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(14px + env(safe-area-inset-bottom,0px));display:flex;gap:8px;pointer-events:auto}
#p4hud .bar .tag{font-size:16px;padding:8px 14px;box-shadow:3px 3px 0 rgba(29,25,21,.3)}
@media (max-width:520px){#p4hud{flex-wrap:wrap}#p4hud .mid{position:static;transform:none;order:3;width:100%;display:flex;justify-content:center}}
/* the hands holding a lantern: they follow the pointer; on a phone they wait over the river */
#p4hands{position:fixed;z-index:5;pointer-events:none;width:clamp(130px,11vw,200px);aspect-ratio:1;transform:translate(-50%,-70%);filter:drop-shadow(0 0 10px rgba(255,200,110,.6))}
#p4hands.touch{left:50%;top:auto;bottom:24%;width:118px;transform:translateX(-50%);animation:p4bob 2.4s ease-in-out infinite}
@keyframes p4bob{50%{transform:translate(-50%,-6px)}}
body.p4holding #cv{cursor:none}
#p4hoaW{width:100%;box-sizing:border-box;font:16px var(--body);padding:8px 10px;border:2.5px solid var(--ink);background:#fff8e6;resize:none}
/* part 1's button to go up to the town */
#c4hud .bar .tag.pho{background:#a3332a;color:var(--diep)}

/* the hired hands on the house sheet (nguoilam.js), like part 1's */
.p4sheet .hands .hand{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:6px 0;text-align:left}
.p4sheet .hands .hand .btn{padding:4px 12px;font-size:14px}
.p4sheet .hands h4{margin:12px 0 4px}

/* the house is not ours yet: "Mua nhà" waits in the bar, greyed while the purse is short */
#p4hud .bar .tag.buy{background:#a3332a;color:var(--diep)}
#p4hud .bar .tag.buy.off{background:#b9b0a4;color:#5a5048}
.p4sheet .btn:disabled{opacity:.45;cursor:default}

/* naming the shop */
#p4nameIn{width:100%;box-sizing:border-box;font:700 20px var(--display);text-transform:uppercase;text-align:center;padding:8px 10px;border:2.5px solid var(--ink);background:#fff8e6;margin:6px 0 10px}
.p4sheet .p4name .btn{padding:3px 10px;font-size:13px;margin-left:6px}


/* reading a lantern's wish (hoadang-net.js): a letter of the lantern festival over the night river */
#p4wish{background:radial-gradient(ellipse at 50% 60%,rgba(40,30,70,.35),rgba(8,10,30,.7))}
#p4wish .card4.wishcard{position:relative;max-width:360px;padding:54px 26px 16px;border:3px solid #a3332a;border-radius:6px;
  background:radial-gradient(ellipse at 50% 0%,#fffaf0 0%,#f8ecd0 55%,#efdcb2 100%);
  box-shadow:0 0 0 5px #f3e2bd,0 0 0 8px #a3332a,0 0 46px 6px rgba(255,190,90,.55);animation:p4card .45s ease-out}
#p4wish .card4.wishcard::before{content:'';position:absolute;inset:8px;border:1.5px solid rgba(163,51,42,.55);border-radius:3px;pointer-events:none}
@keyframes p4card{from{opacity:0;transform:translateY(16px) scale(.97)}to{opacity:1;transform:none}}
#p4wish .lotus{position:absolute;left:50%;top:-58px;transform:translateX(-50%);width:120px;height:90px;border-radius:50%;
  background:radial-gradient(circle at 50% 55%,rgba(255,236,170,.95),rgba(255,190,90,.45) 45%,rgba(255,170,60,0) 70%);animation:p4lotus 3s ease-in-out infinite}
#p4wish .lotus img{width:120px;height:90px;filter:drop-shadow(0 0 8px rgba(255,210,120,.9))}
@keyframes p4lotus{50%{transform:translate(-50%,-5px)}}
#p4wish .kicker{font:700 12px var(--body);letter-spacing:.14em;text-transform:uppercase;color:#a3332a}
#p4wish .p4rule{display:flex;align-items:center;gap:8px;margin:6px 24px 4px;color:#c4473a}
#p4wish .p4rule span{flex:1;height:1px;background:linear-gradient(90deg,transparent,#c4473a,transparent);border:0}
#p4wish .p4rule em{font-style:normal;font-size:14px}
#p4wish .wish{font:600 27px/1.35 'Dancing Script',var(--display),cursive;color:#2a1d16;margin:12px 4px 14px;word-wrap:break-word}
#p4wish .from{font:700 14px var(--display);color:#7a2a22;margin:0;letter-spacing:.04em}
#p4wish .from::before{content:'— '}
#p4wish .when{font:italic 12px var(--body);color:#8a6a4a;margin:2px 0 12px}
#p4wish .foot{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:4px}
#p4wish .foot .link{background:none;border:0;padding:4px 0;font:12px var(--body);color:#8a6a4a;text-decoration:underline;cursor:pointer}
#p4wish .foot .link[hidden]{display:none}
#p4wish .foot .btn{margin-left:auto}

/* têm trầu by hand (temtrau.js): the shift's clock, takings, the way out */
#p4temHud{position:fixed;left:0;right:0;top:0;display:flex;justify-content:center;gap:10px;flex-wrap:wrap;padding:calc(10px + env(safe-area-inset-top,0px)) 12px 0;z-index:4;pointer-events:none}
#p4temHud .tag{font-family:var(--display);font-weight:900;font-size:15px;color:var(--ink)}
#p4temHud button.tag{pointer-events:auto;cursor:pointer;background:#a3332a;color:var(--diep)}
.p4sheet .btn.tem{font-size:18px;padding:10px 26px;background:#2f6a4c}
#p4temHud button.tag.more{background:#2f6a4c;flex-basis:100%;max-width:520px;white-space:normal}
#p4temHud button.tag.more:disabled{background:#6f665c;cursor:default}
/* phones: the bottom bar wraps onto two rows instead of running off both edges (a Hồ sơ button joined it, js/ch4/hoso.js) */
@media (max-width:520px){#p4hud .bar{flex-wrap:wrap;justify-content:center;width:calc(100% - 24px)}#p4hud .bar .tag{font-size:14px;padding:7px 10px}}
/* the town's bar is the village's (owner, 2026-10-17): 📖 Sổ tay, ⬆️ Nâng cấp, the red way back; greyed until the house is bought */
#p4hud .bar .tag.ic{font-size:24px;padding:6px 14px;line-height:1.2}
#p4hud .bar .tag .ic4{width:28px;height:28px;vertical-align:middle}
#p4hud .bar .tag.up{background:#f2ecde;color:var(--ink)}
#p4hud .bar .tag.pho{background:#a3332a;color:var(--diep)}
#p4hud .bar .tag.off,#p4hud .bar .tag:disabled{opacity:.4;cursor:default;box-shadow:none}
#p4hud .bar .tag.buy.off{opacity:1}
/* and on a phone the top reads like the village's: the clock under the name, money and betel in a column at the right */
@media (max-width:520px){
  #p4hud{flex-wrap:nowrap}
  #p4hud .right{width:auto;align-items:flex-end}
  #p4hud .mid,body.touch #p4hud .mid{position:absolute;left:16px;top:calc(56px + env(safe-area-inset-top,0px));transform:none;width:auto;order:0;display:block}
  #p4hud .bar .tag.ic{padding:6px 12px}
}
/* notch (owner, 2026-10-17): the town HUD keeps clear of the side safe areas too */
#p4hud{padding-left:calc(16px + env(safe-area-inset-left,0px));padding-right:calc(16px + env(safe-area-inset-right,0px))}
/* the village closed while the player was in the town: "Về chợ quê" blinks red (owner, 2026-10-18: the only notice) */
@keyframes p4blink{0%,100%{background:#a3332a;box-shadow:3px 3px 0 rgba(29,25,21,.3)}50%{background:#e2483a;box-shadow:0 0 0 4px rgba(226,72,58,.45)}}
#p4hud .bar .tag.pho.blink{animation:p4blink 1s ease-in-out infinite}
/* every shop's stock on the HUD (cuahang.js p4StockHud): one line a shop, red when out, ochre when low */
#p4hud #p4Stock{white-space:normal;max-width:min(460px,calc(100vw - 32px));text-align:right;line-height:1.45;display:flex;flex-direction:column;align-items:flex-end}
#p4hud #p4Stock .w{white-space:nowrap}
#p4hud #p4Stock .w b{margin-right:.3em}
#p4hud #p4Stock i{font-style:normal}
#p4hud #p4Stock i.low{color:#b06a12}
#p4hud #p4Stock i.out{color:#a3332a}
#p4hud #p4Stock .w.shut{opacity:.5}
@media (max-width:520px){#p4hud #p4Stock{font-size:12px}#p4hud #p4Stock .w{white-space:normal}}
#p4hud #p4Stock .fold{pointer-events:auto;cursor:pointer;font:inherit;font-size:12px;color:#5a5048;background:none;border:0;padding:2px 0 0;text-decoration:underline}
#p4hud #p4Stock{max-height:calc(100vh - 170px);overflow-y:auto;pointer-events:auto}
#p4hud #p4Stock i{white-space:nowrap}
@media (max-width:520px){#p4hud #p4Stock{margin-top:42px;font-size:11.5px;line-height:1.35;max-width:calc(100vw - 32px);max-height:calc(100vh - 260px)}}
