/* AREA-CODEX-01: area objectives (area map window + world map) and villager speech bubbles.
   Theme: dark grey panels, cream and espresso, slanted tags and diamonds, no outlines; PC text 18px or more. */
.window.wide:has(.cx-wrap){width:min(calc(var(--u) * 1420),100%)}
.cx-wrap{display:grid;grid-template-columns:minmax(300px,calc(var(--u) * 400)) minmax(0,1fr);gap:calc(var(--u) * 14);min-height:0;align-items:start}
.cx-wrap:has(.cx-panel[hidden]){grid-template-columns:minmax(0,1fr)}
.cx-panel{display:flex;flex-direction:column;gap:calc(var(--u) * 8);max-height:max(320px,calc(100vh - var(--u) * 210));overflow:auto;font-family:Kanit,'Noto Sans Thai Looped',sans-serif;font-size:max(18px,calc(var(--u) * 18));color:#f6e7c8;line-height:1.4}
.cx-panel[hidden]{display:none}
.cx-lv{align-self:flex-start;margin:0;padding:2px 22px 3px 16px;background:#f6e7c8;color:#33210f;font-weight:500;clip-path:polygon(0 0,100% 0,calc(100% - 12px) 100%,0 100%)}
.cx-lv b{font-weight:700}
.cx-head{display:flex;justify-content:space-between;align-items:baseline;margin:0;font-weight:600}
.cx-head b{color:#ffd36b}
.cx-bar{flex:none;display:block;height:8px;border-radius:99px;background:#33394a;overflow:hidden}
.cx-bar i{display:block;height:100%;background:#ffd36b}
.cx-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:calc(var(--u) * 7)}
.cx-row{display:grid;grid-template-columns:calc(var(--u) * 34) minmax(0,1fr) auto;column-gap:calc(var(--u) * 10);row-gap:calc(var(--u) * 3);align-items:center;width:100%;text-align:left;padding:calc(var(--u) * 7) calc(var(--u) * 10);border:0;border-radius:calc(var(--u) * 12);background:rgba(255,255,255,.07);color:inherit;font:inherit;cursor:pointer}
.cx-row:hover{background:rgba(255,255,255,.13)}
.cx-row:focus-visible{outline:none;box-shadow:0 0 0 3px #ffd36b}
.cx-num{grid-row:1 / span 2;display:grid;place-items:center;width:calc(var(--u) * 34);height:calc(var(--u) * 34);min-width:26px;min-height:26px;background:#f6e7c8;color:#33210f;font-weight:700;clip-path:polygon(50% 0,100% 50%,50% 100%,0 50%)}
.cx-text{font-weight:500}
.cx-count{font-weight:700;color:#e9d3a8}
.cx-reward{grid-column:2 / -1;display:flex;flex-wrap:wrap;gap:calc(var(--u) * 12);align-items:center;color:#e9d3a8}
.cx-reward>span{display:flex;align-items:center;gap:4px}
.cx-reward .item-img{width:max(28px,calc(var(--u) * 30));height:max(28px,calc(var(--u) * 30));object-fit:contain}
.cx-coin{width:14px;height:14px;background:#f2c94c;transform:rotate(45deg);border-radius:3px;margin:0 3px}
.cx-hint{grid-column:2 / -1;font-size:max(18px,calc(var(--u) * 18));color:#c9ccd4}
.cx-row.cx-done{background:rgba(47,174,150,.2)}
.cx-row.cx-done .cx-num{background:#2fae96;color:#effffb}
.cx-row.cx-done .cx-count{color:#8ff0dc}
.cx-row.cx-done .cx-reward{opacity:.6}
.cx-bonus{display:flex;flex-direction:column;gap:4px;padding:calc(var(--u) * 8) calc(var(--u) * 10);border-radius:calc(var(--u) * 12);background:#2a1c0e}
.cx-bonus p{margin:0;font-weight:600;color:#ffd36b}
.cx-bonus small{font-size:max(18px,calc(var(--u) * 18));color:#e9d3a8}
.cx-wrap .am-canvas{max-height:min(68vh,calc(100vh - var(--u) * 290))}

/* world map: completion on each tile and the list in the zone panel */
.wm .pin .tagname .cx-pct{font-size:calc(var(--u) * 18);color:#33210f;background:#e9d3a8;padding:0 calc(var(--u) * 9) 0 calc(var(--u) * 7);margin-right:calc(var(--u) * -6);clip-path:polygon(5px 0,100% 0,calc(100% - 5px) 100%,0 100%)}
.wm .pin .tagname .cx-pct.cx-full{background:#2fae96;color:#06231d}
.wm .cx-wm{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:calc(var(--u) * 5);font-size:max(18px,calc(var(--u) * 18))}
.wm .cx-wm li{display:grid;grid-template-columns:calc(var(--u) * 18) minmax(0,1fr) auto;gap:calc(var(--u) * 8);align-items:center}
.wm .cx-wm i{display:grid;place-items:center;width:calc(var(--u) * 18);height:calc(var(--u) * 18);background:#3a445a;font-style:normal;font-size:calc(var(--u) * 13);clip-path:polygon(50% 0,100% 50%,50% 100%,0 50%)}
.wm .cx-wm li.cx-done i{background:#2fae96;color:#06231d}
.wm .cx-wm li.cx-done span{color:#8ff0dc}
.wm .cx-wmnote{margin:0;font-size:max(18px,calc(var(--u) * 18));color:#d9c9a6}

/* villager speech bubbles: light, rounded, a small slanted name tag, no outline. They live in #worldfx, under the HUD */
.npcb{position:absolute;left:0;top:0;display:flex;flex-direction:column;align-items:center;width:max-content;max-width:min(calc(var(--u) * 340),70vw);opacity:0;transition:opacity .28s ease;font-family:Kanit,'Noto Sans Thai Looped',sans-serif}
.npcb.npcb-on{opacity:1}
.npcb b{position:relative;z-index:1;margin-bottom:-6px;padding:0 16px 1px;font-size:max(18px,calc(var(--u) * 18));font-weight:600;line-height:1.35;background:#4e3620;color:#f6e7c8;clip-path:polygon(8px 0,100% 0,calc(100% - 8px) 100%,0 100%)}
.npcb p{position:relative;margin:0 0 9px;padding:calc(var(--u) * 10) calc(var(--u) * 18) calc(var(--u) * 8);border-radius:calc(var(--u) * 20);background:rgba(255,249,236,.96);color:#33210f;font-size:max(18px,calc(var(--u) * 19));line-height:1.45;text-align:center;text-wrap:balance;box-shadow:0 4px 12px rgba(20,12,10,.28)}
.npcb p::after{content:'';position:absolute;left:50%;bottom:-8px;width:18px;height:9px;margin-left:-9px;background:rgba(255,249,236,.96);clip-path:polygon(0 0,100% 0,50% 100%)}
body.calm .npcb{transition:none}

@media (max-height:520px){
  .cx-wrap{grid-template-columns:minmax(0,240px) minmax(0,1fr);gap:8px}
  .cx-panel{font-size:13px;max-height:calc(100vh - 176px);min-height:150px;gap:5px;padding-right:8px}
  .cx-hint,.cx-bonus small{font-size:13px}
  .cx-row{grid-template-columns:26px minmax(0,1fr) auto;padding:4px 6px;column-gap:6px;min-height:44px}
  .cx-reward .item-img{width:22px;height:22px}
  .cx-wrap .am-canvas{max-height:calc(100vh - 242px);min-height:130px}
  .window.wide:has(.cx-wrap) .body{gap:6px;padding-top:8px;padding-bottom:8px}
  .npcb b,.npcb p{font-size:14px}
}

/* NPC-TALK-01: the talk box. The world stays visible (no dark scrim); a see-through dark grey panel (popup colour) along
   the bottom, the speaker's name on the slanted cream/espresso tag like the bubbles, answers as soft rows. No outlines */
.scrim.talk-scrim{background:linear-gradient(to top,rgba(6,9,16,.55),rgba(6,9,16,0) 42%);place-items:end center;padding:0 calc(12px + var(--sl,0px)) calc(18px + env(safe-area-inset-bottom)) calc(12px + var(--sr,0px))}
.talk{position:relative;width:min(calc(var(--u) * 760),94vw);padding:calc(var(--u) * 26) calc(var(--u) * 28) calc(var(--u) * 18);border-radius:calc(var(--u) * 22);background:var(--hd-panel);color:var(--hd-cream);box-shadow:0 calc(var(--u) * 10) calc(var(--u) * 28) rgba(0,0,0,.35);backdrop-filter:blur(6px);font-family:Kanit,'Noto Sans Thai Looped',sans-serif;outline:none;animation:fadein .16s ease}
.talk-name{position:absolute;left:calc(var(--u) * 24);top:0;transform:translateY(-55%);padding:2px 20px 3px;font-size:max(18px,calc(var(--u) * 19));font-weight:600;background:var(--hd-cream);color:var(--hd-cocoa);clip-path:polygon(9px 0,100% 0,calc(100% - 9px) 100%,0 100%)}
.talk-text{margin:0;min-height:2.9em;font-size:max(18px,calc(var(--u) * 21));line-height:1.45;cursor:pointer}
.talk-opts{display:grid;gap:calc(var(--u) * 6);margin-top:calc(var(--u) * 12)}
.talk-opts:has(> :nth-child(5)){grid-template-columns:1fr 1fr}      /* NPC-KEEP-01: a keeper can have 6 answers; two columns keep the face in view */
.talk-opt{display:flex;align-items:center;gap:12px;width:100%;min-height:44px;padding:6px 14px;border:none;border-radius:calc(var(--u) * 12);background:rgba(246,231,200,.08);color:var(--hd-cream);font:inherit;font-size:max(18px,calc(var(--u) * 18));text-align:left;cursor:pointer}
.talk-opt i{flex:none;display:grid;place-items:center;width:24px;height:24px;font-style:normal;font-size:14px;font-weight:600;background:var(--hd-cream);color:var(--hd-cocoa);clip-path:polygon(50% 0,100% 50%,50% 100%,0 50%)}
.talk-opt:hover{background:rgba(246,231,200,.16)}
.talk-opt:focus-visible{background:var(--hd-cream);color:var(--hd-cocoa);outline:none}
.talk-opt:focus-visible i{background:var(--hd-cocoa);color:var(--hd-cream)}
.talk-opt.bye{color:var(--hd-cream2);opacity:.85}
body.calm .talk{animation:none}
body.windowed:has(.talk-scrim) #hud,body.windowed:has(.talk-scrim) #touch{opacity:0;transition:opacity .2s}      /* the HUD steps aside while talking */
@media (max-height:520px){      /* phones on their side: a low box, answers in two columns, so the face stays in view */
  .talk{width:min(720px,92vw);padding:18px 18px 10px}
  .talk-text{min-height:0;font-size:17px;line-height:1.35}
  .talk-opts{grid-template-columns:1fr 1fr;gap:6px;margin-top:8px}
  .talk-opt{min-height:40px;padding:4px 10px;font-size:16px}
}
/* NPC-KEEP-01: a keeper's job under its name, and its service as the first, brighter answer */
.talk-job{position:absolute;left:calc(var(--u) * 24 + 8px);top:0;transform:translate(0,-55%) translateX(var(--jobx,0));display:none}
.talk-name + .talk-job:not(:empty){position:static;display:block;transform:none;margin:-4px 0 4px;font-size:max(14px,calc(var(--u) * 14));color:var(--hd-cream2);opacity:.8}
.talk-opt.service{background:rgba(246,231,200,.2);font-weight:600}
/* the focused answer is always the solid cream row: the service and goodbye rules above must not take that away */
.talk-opt.service:focus-visible,.talk-opt.bye:focus-visible{background:var(--hd-cream);color:var(--hd-cocoa);opacity:1}
