/* Approved compact HUD, 2026-11-05. Native controls; existing illustrated icons preserved. */
:root { --compact-edge:12px; }
/* Weight warning takes no extra HUD row; bag details remain readable at every size. */
#hud-weight { position:absolute; right:-34px; top:6px; width:28px; height:28px; padding:5px; border:1px solid #d5af67; border-radius:9px; background:#fff2cf; color:#956a21; pointer-events:auto; cursor:pointer; }
#hud-weight[hidden] { display:none!important; }
#hud-weight svg { width:100%; height:100%; }
#hud-weight[data-stage="heavy"],#hud-weight[data-stage="over"] { color:#a3454c; background:#f9dcda; border-color:#d18a8c; }
.bag-weight { margin:0 0 10px; font-size:12px; }
.bag-weight-label { display:flex; justify-content:space-between; gap:8px; flex-wrap:wrap; }
.bag-weight-track { position:relative; height:5px; margin:7px 0; border-radius:4px; background:#e8e4d8; }
.bag-weight-track i { display:block; height:100%; border-radius:4px; background:#68b6a2; }
.bag-weight-track em { position:absolute; top:-2px; width:1px; height:9px; background:#666579; }
.bag-weight small { display:block; font-size:11px; line-height:1.5; color:#707284; }
.bag-weight[data-stage="warning"] i { background:#d3ab5b; }
.bag-weight[data-stage="heavy"] i,.bag-weight[data-stage="over"] i { background:#d58186; }
.bag-weight[data-stage="heavy"] small,.bag-weight[data-stage="over"] small { color:#a3454c; }
#hud-status { --status-card-width:220px; left:calc(12px + var(--safe-l)); top:calc(8px + env(safe-area-inset-top,0px)); gap:6px; }
#hud-status .status-card { width:var(--status-card-width); padding:6px 9px 6px 6px; gap:7px; border-radius:16px; }
#hud-status .portrait-ring { width:43px; height:43px; }
#hud-status .status-body { gap:3px; }
#hud-status .name-plate #hud-name { font-size:13px; }
#hud-status .name-plate .lv { font-size:9px; }
#hud-status .bar { height:10px; min-height:10px; }
#hud-status .bar span { line-height:10px; font-size:8px; }
#hud-quick { gap:6px; }
html:not([data-ui="mobile"]) #hud-menu { top:calc(126px + env(safe-area-inset-top,0px)); gap:6px; }
html:not([data-ui="mobile"]) #hud-menu .menu-btn { width:44px; height:44px; min-height:44px; padding:0; justify-content:center; }
html:not([data-ui="mobile"]) #hud-menu .menu-btn span { display:none!important; }
html:not([data-ui="mobile"]) #hud-menu .menu-btn img { width:26px; height:26px; }
html:not([data-ui="mobile"]) #hud-minimap { width:137.8px; border-width:4px; }
html:not([data-ui="mobile"]) #hud-bar { position:fixed; left:50%; right:auto; top:auto; bottom:calc(18px + var(--safe-b)); transform:translateX(-50%); display:flex; flex-wrap:nowrap; gap:7px; max-width:calc(100vw - 24px); overflow:visible; padding:7px; }
html:not([data-ui="mobile"]) #hud-bar .slot { width:44px; height:44px; flex:none; border-radius:10px; }
html:not([data-ui="mobile"]) #hud-bar .sep { display:none; }
html:not([data-ui="mobile"]) #hud-actions { position:fixed; left:var(--compact-actions-left,calc(50% + 160px)); right:auto; bottom:var(--compact-actions-bottom,24px); width:max-content; height:46px; display:flex; align-items:center; gap:7px; }
html:not([data-ui="mobile"]) #hud-actions .act { position:relative; inset:auto; width:44px; height:44px; flex:none; }
html:not([data-ui="mobile"]) #hud-actions .hidden { display:none; }
html:not([data-ui="mobile"]) #btn-skpage { display:none; }
html:not([data-ui="mobile"]) #hud-actions #btn-dodge { width:46px; height:46px; }
#hud { --atk-ico:url('../assets/ui/mobile/attack-greatsword.png'); }
#hud[data-cls="mage"] { --atk-ico:url('../assets/ui/mobile/attack-mage.png'); }
#hud[data-cls="summoner"] { --atk-ico:url('../assets/ui/mobile/attack-summoner.png'); }
#hud[data-cls="crossbows"] { --atk-ico:url('../assets/ui/mobile/attack-crossbows.png'); }
#hud[data-cls="daggers"] { --atk-ico:url('../assets/ui/mobile/attack-daggers.png'); }
#hud[data-cls="naga"] { --atk-ico:url('../assets/ui/mobile/attack-naga.png'); }
html:not([data-ui="mobile"]) #btn-attack { background:var(--atk-ico) center/60% no-repeat,var(--cream); border-radius:50%; }
html:not([data-ui="mobile"]) #btn-attack span { display:none; }
#hud-actions #btn-auto, #hud-actions #btn-target { width:44px; height:44px; background:none; border-radius:50%; box-shadow:none; font-size:0!important; color:transparent; }
#hud-actions #btn-auto::before, #hud-actions #btn-target::before { content:''; position:absolute; inset:2px; border-radius:50%; background-color:rgba(255,248,232,.96); background-repeat:no-repeat; pointer-events:none; }
#hud-actions #btn-auto::before { background-image:url('../assets/ui/mobile/auto.png'); background-size:24px; background-position:center 3px; }
#hud-actions #btn-auto::after { content:'auto'; position:absolute; bottom:5px; left:0; right:0; color:var(--ink); font:500 8px/10px var(--font); text-align:center; pointer-events:none; }
#hud-actions #btn-target::before { background-image:url('../assets/ui/mobile/target.png'); background-size:26px; background-position:center; }
#hud-actions #btn-auto.on::before { background-color:#bdded0; background-image:url('../assets/ui/mobile/auto-on.png'); }
#hud-actions #btn-target.on::before { background-color:var(--rose); background-image:url('../assets/ui/mobile/target-on.png'); }
#hud-exp { position:fixed; left:0; right:0; bottom:var(--safe-b); height:4px; display:block; padding:0; gap:0; }
#hud-exp .exp-track { width:100%; height:4px; border-radius:0; }
#hud-exp .fill { border-radius:0; }
#hud-exp .exp-chip { position:absolute; left:calc(10px + var(--safe-l)); bottom:9px; line-height:14px; font-size:9px; }

/* Passive chat: no clickable tray, no text selection, no focusable children, newest lines remain visible. */
html:not([data-ui="mobile"]) #hud.menu-folded #hud-menu > :not(#btn-menu-fold) { display:none!important; }
#hud #btn-menu-fold { font-size:24px; line-height:1; }
#hud #btn-boardroom b { font-size:24px; font-weight:500; color:#527f70; }
html[data-ui="mobile"] #hud.menu-open #btn-menu-fold { grid-column:1/-1; min-height:44px; height:44px; }
html[data-ui="mobile"] #hud.menu-open #btn-menu-fold::after { content:'เก็บเมนู'; font-size:13px; margin-left:6px; }
html[data-ui="mobile"] #hud.menu-open #hud-chat.chat-passive { visibility:hidden; }
.board-room-dialog { width:min(680px,calc(100vw - 20px)); max-width:none; max-height:calc(100dvh - 20px); box-sizing:border-box; border:1px solid #e6ddc9; border-radius:18px; padding:16px; color:#53576c; background:#fff8e8; font:14px KanitArc,sans-serif; box-shadow:0 8px 40px #35334433; overflow:hidden; }
.board-room-dialog[open] { display:flex; flex-direction:column; gap:10px; }
.board-room-dialog:has(.room-content:not([hidden])) { height:min(560px,90dvh); }
.board-room-dialog::backdrop { background:#35334455; }
.board-room-dialog [hidden] { display:none!important; }
.board-room-dialog header { display:flex; align-items:flex-start; gap:12px; flex:none; }
.board-room-dialog h2 { margin:0; font-size:18px; flex:1; min-width:0; overflow-wrap:anywhere; }
.board-room-dialog button { border:1px solid #e6ddc9; border-radius:10px; min-height:44px; padding:8px 12px; font:inherit; color:#53576c; background:#fffcf3; cursor:pointer; flex:none; }
.board-room-dialog button[type="submit"] { background:#40bfb7; color:#fff; border-color:#40bfb7; }
.board-room-dialog input { font:inherit; padding:10px; border-radius:10px; border:1px solid #e6ddc9; background:#fffcf3; color:#53576c; min-width:0; box-sizing:border-box; }
.board-room-dialog .room-hint { margin:0; font-size:12px; color:#747487; flex:none; }
.board-room-dialog .room-create { display:flex; flex-direction:column; gap:12px; }
.board-room-dialog .room-create label { display:flex; flex-direction:column; gap:6px; }
.board-room-dialog .room-content { display:grid; grid-template-columns:minmax(86px,28%) minmax(0,1fr); border:1px solid #e6ddc9; border-radius:12px; background:#fffcf3; flex:1; min-height:80px; overflow:hidden; }
.board-room-dialog aside { border-right:1px solid #e6ddc9; padding:10px; overflow:auto; }
.board-room-dialog h3 { margin:0 0 8px; font-size:13px; }
.board-room-dialog ul { list-style:none; padding:0; margin:0; font-size:12px; }
.board-room-dialog li { padding:5px 0; overflow-wrap:anywhere; }
.board-room-dialog .room-messages { overflow:auto; min-width:0; padding:10px; overscroll-behavior:contain; }
.board-room-dialog .room-messages p { margin:0 0 8px; overflow-wrap:anywhere; white-space:pre-wrap; }
.board-room-dialog .room-send { display:flex; gap:8px; flex:none; }
.board-room-dialog .room-send input { flex:1; }
@media(max-width:480px) { .board-room-dialog { padding:12px; font-size:13px; } .board-room-dialog h2 { font-size:16px; } }
#hud #hud-chat { position:fixed; top:auto; left:calc(10px + var(--safe-l)); right:auto; width:min(300px,36vw); bottom:calc(82px + var(--safe-b)); display:block; z-index:12; }
#hud #hud-chat.chat-passive, #hud #hud-chat.chat-passive * { pointer-events:none!important; user-select:none!important; -webkit-user-select:none!important; }
#hud #hud-chat.chat-passive { opacity:1; background:transparent; border:0; box-shadow:none; backdrop-filter:none; -webkit-backdrop-filter:none; border-radius:0; }
#hud #hud-chat.chat-passive .chat-tabs, #hud #hud-chat.chat-passive .chat-form, #hud #hud-chat.chat-passive #chat-resize { display:none!important; }
#hud #hud-chat.chat-passive .chat-log { height:calc(var(--passive-chat-lines, 8) * 1.5em + 6px); overflow:hidden; padding:3px 5px; font-size:12px; line-height:1.5em; font-weight:500; color:#fff8e8; background:transparent; text-shadow:-1px 0 1px #353344,1px 0 1px #353344,0 -1px 1px #353344,0 1px 1px #353344,0 1px 3px #353344; }
#hud #hud-chat.chat-passive .local { color:#fff8e8; }
#hud #hud-chat.chat-passive .world { color:#a9dcff; }
#hud #hud-chat.chat-passive .party { color:#a9edb6; }
#hud #hud-chat.chat-passive .guild { color:#ffe092; }
#hud #hud-chat.chat-passive .whisper { color:#ffb9e9; }
#hud #hud-chat.chat-passive .notice, #hud #hud-chat.chat-passive .war { color:#ff9b9f; }
#hud #hud-chat.chat-passive .sys { color:#ffc098; }
#hud #hud-chat.open { background:rgba(255,248,232,.96); opacity:1; pointer-events:auto; box-shadow:var(--shadow); border-radius:14px; }
#hud #hud-chat.open .chat-form { display:flex; }
.chat-sticker-toggle { flex:0 0 32px; min-height:32px; display:grid; place-items:center; padding:0; border:1px solid var(--line); border-radius:9px; background:var(--paper); cursor:pointer; }
.chat-sticker-toggle img { width:24px; height:24px; }
.chat-sticker-toggle[aria-expanded="true"] { background:var(--sel); }
#chat-sticker-picker { order:-1; flex:1 0 100%; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:2px; border:1px solid var(--line); border-radius:9px; }
#chat-sticker-picker[hidden] { display:none; }
#chat-sticker-picker button { display:grid; place-items:center; min-width:0; min-height:32px; padding:0; border:0; border-radius:8px; background:transparent; cursor:pointer; }
#chat-sticker-picker button:hover, #chat-sticker-picker button:focus-visible { background:var(--sel); }
#chat-sticker-picker img { width:28px; max-width:100%; height:auto; }
#hud #hud-chat.open:has(#chat-sticker-picker:not([hidden])) { display:flex; flex-direction:column; }
#hud-chat:has(#chat-sticker-picker:not([hidden])) .chat-log { min-height:0; }
#hud-chat:has(#chat-sticker-picker:not([hidden])) .chat-form { flex-shrink:0; }
html[data-ui="mobile"] .chat-sticker-toggle { flex-basis:36px; min-height:36px; }
html[data-ui="mobile"] #chat-sticker-picker button { min-height:40px; }
#hud #hud-chat.open .chat-log { font-size:10.5px; }
#hud #hud-chat.open.chat-large-text .chat-log { font-size:15px; }
#btn-chat.on { box-shadow:inset 0 0 0 2px var(--teal); }

/* Mobile: exact compact control positions approved in review/compact-hud-v2. Fixed 44px minimum targets. */
html[data-ui="mobile"] #hud-status { --status-card-width:200px; }
html[data-ui="mobile"][data-form][data-orient="portrait"] #hud-status { --status-card-width:200px; }
html[data-ui="mobile"] #hud-quick > .sq-btn, html[data-ui="mobile"] #hud-quick .slot { min-width:0; }
html[data-ui="mobile"] #hud-party { grid-template-columns:repeat(2,calc((var(--status-card-width) - 4px)/2)); }
html[data-ui="mobile"][data-orient] #hud-actions { position:fixed; inset:0; width:auto; height:auto; pointer-events:none; }
html[data-ui="mobile"][data-orient] #hud-actions .act { pointer-events:auto; }
html[data-ui="mobile"][data-orient] #btn-attack { width:68px; height:68px; right:calc(18px + var(--safe-r)); bottom:calc(23px + var(--safe-b)); }
html[data-ui="mobile"][data-orient] #btn-dodge { width:46px; height:46px; right:calc(102px + var(--safe-r)); bottom:calc(20px + var(--safe-b)); }
html[data-ui="mobile"][data-orient] #hud-bar .slot.skill { width:48px; height:48px; }
html[data-ui="mobile"][data-orient] #hud-bar .slot.skill:is([data-k="0"],[data-k="4"]) { right:calc(110px + var(--safe-r)); bottom:calc(74px + var(--safe-b)); }
html[data-ui="mobile"][data-orient] #hud-bar .slot.skill:is([data-k="1"],[data-k="5"]) { right:calc(56px + var(--safe-r)); bottom:calc(103px + var(--safe-b)); }
html[data-ui="mobile"][data-orient] #hud-bar .slot.skill:is([data-k="2"],[data-k="6"]) { right:calc(2px + var(--safe-r)); bottom:calc(102px + var(--safe-b)); }
html[data-ui="mobile"][data-orient] #hud-bar .slot.skill:is([data-k="3"],[data-k="7"]) { right:calc(3px + var(--safe-r)); bottom:calc(157px + var(--safe-b)); }
html[data-ui="mobile"][data-orient] #btn-auto { right:calc(176px + var(--safe-r)); bottom:calc(16px + var(--safe-b)); }
html[data-ui="mobile"][data-orient] #btn-target { right:calc(176px + var(--safe-r)); bottom:calc(70px + var(--safe-b)); }
html[data-ui="mobile"][data-orient] #btn-skpage { width:44px; height:44px; right:calc(176px + var(--safe-r)); bottom:calc(124px + var(--safe-b)); }
html[data-ui="mobile"][data-orient] #btn-interact { width:44px; height:44px; right:calc(176px + var(--safe-r)); bottom:calc(178px + var(--safe-b)); font-size:11px; }
html[data-ui="mobile"][data-orient] #joy-ghost { width:96px; height:96px; left:calc(82px + var(--safe-l)); bottom:calc(76px + var(--safe-b)); margin:0 0 -48px -48px; opacity:.4; }
html[data-ui="mobile"][data-orient="portrait"] #joy-ghost { left:calc(76px + var(--safe-l)); bottom:calc(90px + var(--safe-b)); }
html[data-ui="mobile"] #joy-ghost i, html[data-ui="mobile"] #joy-knob { width:40px; height:40px; left:28px; top:28px; }
html[data-ui="mobile"] #joy { width:96px; height:96px; margin:-48px 0 0 -48px; }
html[data-ui="mobile"] #hud-topright { display:grid; grid-template-columns:auto 111.8px; grid-template-rows:auto auto; right:calc(10px + var(--safe-r)); top:calc(8px + env(safe-area-inset-top,0px)); gap:6px; align-items:start; justify-items:end; }
html[data-ui="mobile"] #hud-topright .top-row { grid-column:1; grid-row:1; gap:6px; }
html[data-ui="mobile"] #hud-topright .mm-row { grid-column:2; grid-row:1; }
html[data-ui="mobile"] #hud-minimap { width:111.8px; border-width:4px; }
html[data-ui="mobile"] #hud-topright .sq-btn { width:44px; height:44px; min-width:44px; min-height:44px; }
html[data-ui="mobile"] #hud-topright .gold-line { display:none; }
html[data-ui="mobile"][data-orient] #hud-quest { grid-column:1; grid-row:2; }
html[data-ui="mobile"][data-orient] #hud-daily { grid-column:2; grid-row:2; }
html[data-ui="mobile"][data-orient] #hud-quest:not(.is-folded), html[data-ui="mobile"][data-orient] #hud-daily:not(.is-folded) { grid-column:1 / -1; width:min(260px,80vw); max-height:28dvh; overflow:auto; z-index:5; }
html[data-ui="mobile"][data-orient] #hud-daily:not(.is-folded) { grid-row:3; }
html[data-ui="mobile"][data-orient="portrait"] #hud-topright { grid-template-columns:44px 98.8px; }
html[data-ui="mobile"][data-orient="portrait"] #hud-topright .top-row { flex-direction:column; }
html[data-ui="mobile"][data-orient="portrait"] #hud-topright .top-row [data-panel] { display:none; }
html[data-ui="mobile"][data-form][data-orient="portrait"] #btn-full { display:inline-flex; }
html[data-ui="mobile"][data-orient="portrait"] #hud-minimap { width:98.8px; }
html[data-ui="mobile"] #hud.menu-open #hud-menu .m-only { display:flex; }
html[data-ui="mobile"] #hud #hud-chat.chat-passive { display:block; bottom:calc(140px + var(--safe-b)); width:min(280px,36vw); }
html[data-ui="mobile"][data-orient="portrait"] #hud #hud-chat.chat-passive { bottom:calc(155px + var(--safe-b)); width:min(260px,66vw); }
html[data-ui="mobile"][data-orient="landscape"] #hud #hud-chat.chat-passive { --passive-chat-lines:6; }
@media (max-height:340px) {
  html[data-ui="mobile"][data-orient="landscape"] #hud #hud-chat.chat-passive { --passive-chat-lines:5; }
}
html[data-ui="mobile"] #hud #hud-chat.open { bottom:calc(var(--kb,0px) + var(--safe-b) + 6px); width:min(330px,48vw); max-height:calc(var(--vvh,100dvh) - 12px); }
html[data-ui="mobile"][data-orient="portrait"] #hud #hud-chat.open { width:min(330px,calc(100vw - 20px - var(--safe-l) - var(--safe-r))); }
html[data-ui="mobile"] #hud #hud-chat.open .chat-tabs button { min-height:36px; }
html[data-ui="mobile"] #hud #hud-chat.open .chat-log { font-size:9.8px; height:min(var(--chat-height,90px),max(36px,calc(var(--vvh,100dvh) - 140px))); }
html[data-ui="mobile"] #hud #hud-chat.open.chat-large-text .chat-log { font-size:14px; }
html[data-ui="mobile"] #hud-exp { bottom:var(--safe-b); }
@media (orientation:landscape) and (max-height:360px) {
  html[data-ui="mobile"][data-orient="landscape"] #hud-quest.is-folded, html[data-ui="mobile"][data-orient="landscape"] #hud-daily.is-folded { position:absolute; grid-column:auto; grid-row:auto; top:50px; right:184px; left:auto; bottom:auto; }
  html[data-ui="mobile"][data-orient="landscape"] #hud-daily.is-folded { right:134px; }
  html[data-ui="mobile"][data-orient="landscape"] #btn-interact { right:calc(230px + var(--safe-r)); }
}
@media (max-width:359px) and (orientation:portrait) {
  html[data-ui="mobile"][data-form][data-orient="portrait"] #hud-status { --status-card-width:194px; }
  html[data-ui="mobile"][data-orient="portrait"] #hud-topright .top-row { grid-row:2; margin-top:26px; }
  html[data-ui="mobile"][data-orient="portrait"] #hud-quest, html[data-ui="mobile"][data-orient="portrait"] #hud-daily { grid-row:3; }
}
@media (prefers-reduced-motion:no-preference) { #hud #hud-chat { transition:opacity .15s,background-color .15s; } }

/* Level badge lives below the enlarged map, never over its canvas. */
.mm-map-stack { display:flex; flex-direction:column; align-items:flex-end; gap:3px; }
.mm-row .mm-chip { position:static; display:block; padding:1px 5px; font-size:9px; line-height:12px; border-radius:5px; background:rgba(255,248,232,.94); white-space:nowrap; }
.mm-row .mm-chip:empty { display:none; }
.world-map-glyph { display:grid; place-items:center; width:26px; height:26px; border:1px solid #b9ddce; border-radius:8px; color:#55978f; font-size:16px; font-weight:500; }
#hud-minimap[role="button"] { cursor:pointer; }
#hud-minimap[role="button"]:focus-visible { outline:3px solid var(--teal); outline-offset:3px; }
#panel-layer .panel.world-atlas-panel { width:min(1280px,calc(100vw - 24px - var(--safe-l) - var(--safe-r))); height:calc(100dvh - 24px - var(--safe-b)); max-height:none; }
#panel-layer .world-atlas-panel > header { padding:8px 12px; font-size:16px; flex:none; }
#panel-layer .world-atlas-panel > .body { padding:0; min-height:0; overflow:hidden; display:flex; }
.world-atlas-frame { border:0; display:block; width:100%; height:100%; min-height:0; background:#2f3b37; }
#panel-layer:has(> .world-atlas-panel) { z-index:50; }
html[data-ui="mobile"] #panel-layer .panel.world-atlas-panel { width:calc(100vw - var(--safe-l) - var(--safe-r)); height:calc(100dvh - var(--safe-b)); border-radius:12px; }

/* hotbar of 20 (2026-11-06): PC = two rows of ten, row 1 (keys 1-0) at the bottom, row 2 (Shift + 1-0) above it;
   phone = sets of four on the arc, the page button (with its "2/5" count) walks through them */
html:not([data-ui="mobile"]) #hud-bar { flex-wrap:wrap-reverse; justify-content:center; max-width:min(calc(100vw - 24px), calc(10 * 44px + 9 * 7px + 14px)); row-gap:6px; }
html:not([data-ui="mobile"]) #hud-bar .slot .key { white-space:nowrap; }
html[data-ui="mobile"] #hud-bar .slot.skill.pg-off { display:none !important; }
html[data-ui="mobile"] #btn-skpage { position:fixed; }
html[data-ui="mobile"] #btn-skpage[data-pg]:not([data-pg=""])::after { content:attr(data-pg); position:absolute; right:-6px; top:-8px; min-width:22px; padding:1px 4px; border-radius:9px; background:#3f7464; color:#fff; font-size:10px; line-height:14px; text-align:center; }

/* Compact menu: two columns on PC; two rows in the mobile sheet. */
html:not([data-ui="mobile"]) #hud-menu { display:grid; grid-template-columns:repeat(2,44px); grid-auto-flow:row; align-content:start; max-height:calc(100dvh - 146px - var(--safe-b)); overflow-y:auto; overflow-x:hidden; padding:4px; margin:-4px; }
html:not([data-ui="mobile"]) #hud.menu-folded #hud-menu { grid-template-columns:44px; }
/* owner 2026-11-15: the slide-up menu on phones was too small to hit (a player could not tap the bag): 5 bigger buttons a row */
html[data-ui="mobile"] #hud.menu-open #hud-menu { grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; width:min(560px,100vw); }
html[data-ui="mobile"] #hud.menu-open .menu-btn { min-width:0; min-height:74px; padding:8px 2px; }
html[data-ui="mobile"] #hud.menu-open .menu-btn img { width:36px; height:36px; }
html[data-ui="mobile"] #hud.menu-open .menu-btn span { font-size:12px; overflow-wrap:anywhere; }
html[data-ui="mobile"] #hud.menu-open #btn-menu-fold { grid-column:auto; min-height:58px; height:auto; }
html[data-ui="mobile"] #hud.menu-open #btn-menu-fold::after { content:none; }
@media(max-width:360px) { html[data-ui="mobile"] #hud.menu-open #hud-menu { grid-template-columns:repeat(4,minmax(0,1fr)); } }
@media(orientation:landscape) and (max-height:520px) { html[data-ui="mobile"] #hud.menu-open #hud-menu { grid-template-columns:repeat(7,minmax(0,1fr)); width:min(720px,100vw); gap:6px; } html[data-ui="mobile"] #hud.menu-open .menu-btn { min-height:66px; padding:6px 2px; } html[data-ui="mobile"] #hud.menu-open .menu-btn img { width:32px; height:32px; } }

/* Owner follow-up 2026-11-07: currency beside location, readable on both phone orientations. */
.world-summary { display:flex; align-items:center; gap:6px; min-width:0; }
#hud-topright .world-summary .gold-line { display:flex; flex-wrap:wrap; justify-content:center; white-space:nowrap; min-height:40px; box-sizing:border-box; }
#hud-topright .world-summary .map-pill { flex-shrink:1; }
html[data-ui="mobile"] #hud-topright .world-summary { position:fixed; top:calc(8px + env(safe-area-inset-top,0px)); right:calc(334px + var(--safe-r)); max-width:calc(100vw - 574px - var(--safe-l) - var(--safe-r)); flex-wrap:wrap; justify-content:flex-end; }
html[data-ui="mobile"] #hud-topright .world-summary .gold-line { display:flex; font-size:12px; gap:4px; padding:4px 7px; min-height:32px; }
html[data-ui="mobile"] #hud-topright .world-summary .map-pill { display:flex; font-size:11px; gap:4px; padding:4px 7px; min-height:32px; max-width:100%; }
html[data-ui="mobile"] .world-summary #hud-mapname { overflow:hidden; text-overflow:ellipsis; }
html[data-ui="mobile"][data-orient="portrait"] #hud-topright .world-summary { top:calc(122px + env(safe-area-inset-top,0px)); left:calc(10px + var(--safe-l)); right:calc(120px + var(--safe-r)); max-width:none; flex-wrap:nowrap; justify-content:flex-start; }
html[data-ui="mobile"][data-orient="portrait"] .world-summary .gold-line { flex-shrink:0; flex-direction:column; gap:0; }
.board-room-dialog { position:fixed; margin:0; z-index:30; inset:auto; }
.board-room-dialog header { cursor:grab; touch-action:none; user-select:none; align-items:center; }
.board-room-dialog header:active { cursor:grabbing; }
.board-room-dialog header button { cursor:pointer; }
.board-room-dialog h2 { max-height:48px; overflow:auto; }
#hud-chat:focus-within { z-index:31; }
.character-actions { margin:12px 0; }
.char-slot.selected { border-color:#40bfb7; box-shadow:0 0 0 2px #40bfb7; }
.character-delete-dialog { width:min(420px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); overflow:auto; box-sizing:border-box; padding:20px; background:#fff8e8; color:#53576c; border:1px solid #e6ddc9; border-radius:18px; font:14px KanitArc,sans-serif; }
.character-delete-dialog label { display:flex; flex-direction:column; gap:6px; }
.character-delete-dialog label[hidden] { display:none; }
.character-delete-dialog input { min-width:0; width:100%; box-sizing:border-box; }
.shop-tabs { margin-bottom:12px; position:sticky; top:0; background:#fff8e8; z-index:2; padding:4px 0; }
#hud:has(.shop-tabs) #hud-chat.chat-passive { visibility:hidden; }

.currency-item { display:inline-flex; align-items:center; gap:4px; white-space:nowrap; }
html[data-ui="mobile"][data-orient="portrait"] #hud-topright .world-summary .gold-line { align-items:flex-start; gap:2px; min-height:44px; padding:4px 7px; }
html[data-ui="mobile"][data-orient="portrait"] #hud-topright .world-summary .map-pill { min-width:0; }
html[data-ui="mobile"][data-orient="portrait"] .world-summary .safe { display:none; }

html[data-ui="mobile"] #hud-topright .world-summary .map-pill .safe { display:none; }

html[data-ui="mobile"] .board-room-dialog { width:min(560px,calc(100vw - 16px)); }
html[data-ui="mobile"] .board-room-dialog:has(.room-content:not([hidden])) { height:min(440px,75dvh); }

/* Compact movable windows — owner 2026-11-07. A floating child cannot escape a low stacking context. */
#panel-layer:has(> .panel, > .item-popup-overlay) { z-index:80; }
#hud:has(#panel-layer > .panel, #panel-layer > .item-popup-overlay) #hud-chat.chat-passive { visibility:hidden; }
.window-handle { cursor:grab; touch-action:none; user-select:none; }
html[data-ui="mobile"] #hud.menu-open #hud-menu { z-index:90; }
.window-handle:active { cursor:grabbing; }
.window-handle button { cursor:pointer; }
.panel { width:min(560px,calc(100vw - 16px)); max-height:min(560px,88dvh); border-radius:16px; }
html[data-ui="mobile"] #panel-layer .panel:not(.world-atlas-panel) { height:auto; width:min(560px,calc(100vw - 16px)); border-radius:16px; max-height:min(560px,calc(100dvh - 12px)); }
.panel > header { padding:8px 12px; font-size:16px; flex-shrink:0; }
.panel > header .x { width:44px; height:44px; }
.panel > .body { min-height:0; padding:6px 12px 12px; font-size:13px; }
.panel .body h4 { margin:10px 0 6px; }
.item-popup-overlay { padding:8px; }
.item-popup-dialog, .item-popup-dialog.has-comparison { width:min(640px,calc(100vw - 16px)); max-height:min(560px,calc(100dvh - 16px)); border-radius:16px; }
.item-popup-dialog:not(.has-comparison) { width:min(420px,calc(100vw - 16px)); }
.item-popup-dialog > header { padding:6px 10px; }
.item-popup-dialog > header b { font-size:15px; }
.item-popup-content { padding:0 10px 8px; }
.item-popup-cards { gap:8px; }
.item-popup-cards > article { padding:8px; border-radius:10px; }
.item-popup-label { min-height:30px; font-size:12px; }
.item-popup-label img { width:32px; height:32px; }
.item-popup-dialog .itemcard { margin:4px 0 0; }
.item-popup-dialog .itemcard h4 { font-size:14px!important; margin:3px 0; }
.item-popup-dialog .itemcard .stats { font-size:12px; line-height:1.5; }
.item-popup-actions { padding:8px 10px; max-height:40dvh; overflow:auto; }
.item-popup-actions .itemcard-actions { gap:6px; }
.item-popup-actions .btn { padding:6px 10px; min-height:44px; font-size:12px; }
.item-popup-delta h4 { margin:8px 0 4px; font-size:13px; }
.gear-deltas > div { padding:3px 0; }
@media(max-width:480px) { .item-popup-cards.paired { grid-template-columns:1fr; } .item-popup-cards .item-popup-current { padding:6px 8px; } }
.trade-card { width:min(600px,calc(100vw - 16px)); max-height:calc(100dvh - 16px); overflow:auto; }
.trade-card > header { position:sticky; top:0; background:#fff8e8; z-index:2; padding:6px 0; }
.story-inner { max-height:calc(100dvh - 16px); overflow:auto; padding:14px 16px; }

/* Owner: floating individual hotbar buttons, no large tray obscuring the world. */
#hud #hud-bar { background:none; border:0; box-shadow:none; backdrop-filter:none; -webkit-backdrop-filter:none; padding:0; }
#hud #hud-bar .slot { box-shadow:0 1px 4px #53576c22; }
#hud #hud-chat.open { z-index:40; }
#hud .board-room-dialog { z-index:60; }
#hud:has(.board-room-dialog[open]) #hud-chat.open { z-index:80; }

.board-quest-card { border:1px solid #e6ddc9; border-radius:12px; padding:10px; margin:8px 0; background:#fffcf3; }
.board-quest-card p { margin:6px 0!important; }
.board-quest-card small { display:block; color:#747487; margin:6px 0; }
@media(max-height:520px),(max-width:800px) {
  html:not([data-ui="mobile"]) #hud #hud-chat { left:120px; }
  html:not([data-ui="mobile"]) #hud #hud-quest, html:not([data-ui="mobile"]) #hud #hud-daily { position:relative; inset:auto; transform:none; flex:none; }
}
@media(max-width:900px) {
  html:not([data-ui="mobile"]) #hud-topright .world-summary { max-width:calc(100vw - 380px); gap:4px; }
  html:not([data-ui="mobile"]) #hud-topright .world-summary .map-pill { display:flex; min-width:0; font-size:11px; padding:6px; }
  html:not([data-ui="mobile"]) .world-summary .map-pill .safe { display:none; }
  html:not([data-ui="mobile"]) .world-summary #hud-mapname { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
}
/* Spirit inspection: a separate native dialog, with responsive art requested only on opening. */
.item-popup-label .spirit-inspect{margin-left:auto;flex:none}
.spirit-inspect{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:1px solid #e6ddc9;border-radius:12px;background:#fffcf3;color:#53576c;cursor:pointer}
.spirit-inspect:hover,.spirit-inspect:focus-visible{background:#e3f4ee;outline:2px solid #40bfb7;outline-offset:1px}
dialog.spirit-viewer{width:min(600px,calc(100vw - 24px));max-height:calc(100dvh - 12px);padding:12px;border:1px solid #e6ddc9;border-radius:18px;background:#fff8e8;color:#53576c;box-sizing:border-box;overflow:hidden}
.spirit-viewer::backdrop{background:#272a3938}
.spirit-viewer>header{display:flex;gap:12px;align-items:center;justify-content:space-between;min-height:44px;margin-bottom:8px}
.spirit-viewer>header b{font-size:15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.spirit-viewer>header .x{flex:none;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:#eee7d7;color:#53576c;font:24px/1 sans-serif;cursor:pointer}
.spirit-viewer>header .x:focus-visible{outline:2px solid #40bfb7;outline-offset:2px}
.spirit-viewer-art{position:relative;display:flex;align-items:center;justify-content:center;max-height:calc(100dvh - 100px);min-height:100px;overflow:hidden;border-radius:12px;background:#fffcf3}
.spirit-viewer-art img{display:block;width:100%;height:auto;max-height:min(66dvh,480px);object-fit:contain;border-radius:10px}
.spirit-viewer-status{position:absolute;inset:0;display:grid;place-content:center;text-align:center;padding:16px;background:#fffcf3dd;font-size:13px}
@media(max-height:480px){dialog.spirit-viewer{width:min(480px,calc(100vw - 24px));padding:8px}.spirit-viewer-art img{max-height:calc(100dvh - 90px)}}

/* Keep quest/daily together instead of placing them in separate minimap grid columns. */
#hud-topright #hud-trackers{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:flex-start;gap:6px;width:94px;max-width:calc(100vw - 20px);pointer-events:auto}
#hud-topright #hud-trackers:has(> :not(.is-folded):not(.hidden)){width:min(260px,calc(100vw - 20px))}
#hud-topright #hud-trackers > :is(#hud-quest,#hud-daily){position:relative;inset:auto;transform:none;margin:0;grid-column:auto;grid-row:auto;flex:0 0 auto}
#hud-topright #hud-trackers > :is(#hud-quest,#hud-daily).is-folded{width:44px;max-width:44px;height:44px;min-height:44px;padding:0}
#hud-topright #hud-trackers > :is(#hud-quest,#hud-daily):not(.is-folded){width:100%;max-width:100%;min-height:44px;max-height:28dvh;overflow-x:hidden;overflow-y:auto;box-sizing:border-box}
html[data-ui="mobile"][data-orient] #hud-topright #hud-trackers{grid-column:1 / -1;grid-row:2}
html[data-ui="mobile"][data-orient="landscape"] #hud-topright #hud-trackers{position:absolute;top:50px;right:117.8px;grid-column:auto;grid-row:auto;z-index:5}
html[data-ui="mobile"][data-orient="portrait"] #hud-topright #hud-trackers:has(> :not(.is-folded):not(.hidden)){margin-top:50px}
@media(max-height:520px){html:not([data-ui="mobile"]) #hud-topright #hud-trackers{position:absolute;top:52px;right:193.8px;z-index:5}}
@media(max-width:359px) and (orientation:portrait){
 html[data-ui="mobile"][data-orient="portrait"] #hud-topright #hud-trackers{position:absolute;top:121.8px;right:0;grid-column:auto;grid-row:auto}
 html[data-ui="mobile"][data-orient="portrait"] #hud-topright #hud-trackers:has(> :not(.is-folded):not(.hidden)){margin-top:124px}
}

/* Gold staff lines also remain distinct in the passive, transparent chat HUD. */
#hud #hud-chat.chat-passive .world.admin-world { color:#ffd181; }
/* 2026-11-09: talk button floating over the nearest NPC's head (Client/js/main.js placeTalkButton) */
.npc-talk{position:fixed;z-index:5;transform:translate(-50%,-100%);min-width:58px;height:34px;padding:0 14px;border-radius:17px;border:2px solid #f2b23a;background:#fff8e8;color:#5a4a3a;font:600 15px var(--font,Kanit),sans-serif;box-shadow:0 3px 10px rgba(60,40,20,.25);cursor:pointer;touch-action:manipulation;pointer-events:auto}
.npc-talk::after{content:'';position:absolute;left:50%;bottom:-7px;width:10px;height:10px;background:#fff8e8;border-right:2px solid #f2b23a;border-bottom:2px solid #f2b23a;transform:translateX(-50%) rotate(45deg)}
.npc-talk:hover{background:#ffefc4}
.npc-talk.hidden{display:none}
html[data-ui="mobile"] .npc-talk{min-width:72px;height:44px;border-radius:22px;font-size:18px}
/* field quest NPC window (owner 2026-11-13; Client/js/hud.js p_fq) */
.fq-say{margin:2px 0 10px;padding:10px 12px;border-radius:12px;background:#fff3d6;color:#5a4030;font-style:italic;line-height:1.5}
.fq-card{margin:0 0 10px;padding:10px 12px;border-radius:12px;border:1.5px solid #ead9b8;background:#fffaf0;display:flex;flex-direction:column;gap:6px}
.fq-card p{margin:0;line-height:1.55;color:#4a3a2a}
.fq-card small{color:#7a6650}
.fq-card .btn{align-self:flex-start}
.fq-card.done{opacity:.6}
.fq-card.ready{border-color:#7cc78f;background:#f2fbf3}
.fq-card.open{border-color:#f2b23a}
/* quest "นำทาง" (navigate) button on the story tracker and in quest lists (owner 2026-11-13) */
.quest-nav{align-self:flex-start;margin:4px 0 0 8px;padding:3px 12px;border-radius:12px;border:1.5px solid #3f8fd0;background:#e8f4ff;color:#1f5d8f;font:600 13px var(--font,Kanit),sans-serif;cursor:pointer;pointer-events:auto}
.quest-nav:hover{background:#d6ecff}
.is-folded .quest-nav{display:none}
.btn.nav{border-color:#3f8fd0;color:#1f5d8f;background:#e8f4ff}
.fq-step{display:block;color:#8a7a66}
.fq-step.cur{color:#4a3a2a;font-weight:600}
.fq-step.ok{color:#5a9a6a;text-decoration:line-through}
/* secret journal: ticked parts of a trial (owner 2026-11-13) */
.sq-check{display:block;color:#7a6650}
.sq-check.ok{color:#4f8f5f}
.sq-hint0{display:block;margin-top:3px;color:#5a6f8a}
.sq-reward{display:block;margin-top:3px;color:#8a6a2a}
.tt-bonus{display:block;font-size:11px;opacity:.75}

/* owner 2026-11-16: "the chat is very hard to read - make it 25% bigger". Every chat size +25% (PC open 10.5 -> 13px,
   phone open 9.8 -> 12.3px, the passive strip 12 -> 15px, the large-text option 15 / 14 -> 18.8 / 17.5px), the Medium
   weight for every line, darker plain text and a little more line spacing. */
#hud #hud-chat .chat-log { font-weight: 500; color: #3a2a1c; letter-spacing: .01em; }
#hud #hud-chat.open .chat-log { font-size: 13px; line-height: 1.55em; }
#hud #hud-chat.open.chat-large-text .chat-log { font-size: 18.75px; }
#hud #hud-chat.chat-passive .chat-log { font-size: 15px; color: #fff8e8; }
html[data-ui="mobile"] #hud #hud-chat.open .chat-log { font-size: 12.25px; }
html[data-ui="mobile"] #hud #hud-chat.open.chat-large-text .chat-log { font-size: 17.5px; }
html[data-ui="mobile"] #hud #hud-chat.chat-passive .chat-log { font-size: 15px; }

/* owner 2026-11-16: world-map warp bar outside the atlas frame (iPhone players could not reach the in-frame button) */
#panel-layer .world-atlas-panel > .body { position: relative; }
.atlas-warpbar { position: absolute; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b, 0px)); z-index: 2; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-radius: 14px; background: #fffaf0; border: 1px solid #e6ddc9; box-shadow: 0 6px 24px #263f4840; font-size: 14px; color: #53576c; }
.atlas-warpbar[hidden] { display: none; }
.atlas-warpbar span { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atlas-warpbar em { font-style: normal; font-size: 12px; color: #8a8070; }
.atlas-warpbar .btn { flex: none; }
