:root {
  --bg: #14121c;
  --panel: rgba(20, 18, 30, 0.88);
  --edge: #3b3550;
  --edge-hi: #6e63a0;
  --text: #f1eefc;
  --muted: #a49cc4;
  --accent: #ffcf4a;
  --hp: #e5484d;
  --mp: #3e8bff;
  --xp: #b46bff;
  --font: "Kanit", "Noto Sans Thai", "Leelawadee UI", "Hiragino Sans", "Malgun Gothic", "Microsoft YaHei", system-ui, sans-serif;
  --font-pixel: "Pixelify Sans", "Kanit", system-ui, sans-serif; /* the logo only */
  /* the height really visible (set from visualViewport by client/js/fullscreen.js). Not 100vh:
     on phones that is the height without the browser's bars, and windows ran under them */
  --app-h: 100vh;
}
@supports (height: 100dvh) { :root { --app-h: 100dvh; } }

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font-family: var(--font);
  -webkit-user-select: none; user-select: none;
  touch-action: none;
}
canvas#game { position: fixed; inset: 0; display: block; image-rendering: pixelated; touch-action: none; /* pinch = game zoom, not page zoom */ }
[hidden] { display: none !important; }

.panel, .box {
  background: var(--panel);
  border: 2px solid var(--edge);
  box-shadow: 0 0 0 2px #000, inset 0 0 0 1px rgba(255,255,255,0.04);
}

/* ---------- login ---------- */
.sub { margin: 10px 0 18px; color: var(--muted); font-size: 14px; }

.hint { font-size: 12px; color: var(--muted); margin: 4px 0 12px; }
button {
  font: inherit; color: var(--text); cursor: pointer;
  background: #2b2540; border: 2px solid var(--edge-hi);
}
.err { min-height: 1.2em; color: #ff8a8a; font-size: 14px; margin: 10px 0 0; }
.controls { font-size: 11px; color: var(--muted); margin: 14px 0 0; line-height: 1.5; }

/* ---------- HUD ---------- */
#stats { position: fixed; left: 12px; top: 12px; width: 220px; padding: 8px 10px; font-size: 13px; }
@keyframes buffend { from { opacity: 1; } to { opacity: 0.4; } }
#pname { font-weight: 700; margin-bottom: 6px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { position: relative; height: 14px; background: #0a0910; border: 1px solid #000; margin-bottom: 4px; }
.bar i { position: absolute; inset: 0 auto 0 0; display: block; transition: width 0.12s linear; }
.bar span { position: relative; display: block; text-align: center; font-size: 11px; line-height: 14px; text-shadow: 1px 1px 0 #000; }
.bar.hp i { background: linear-gradient(#ff6b6f, var(--hp)); }
.bar.mp i { background: linear-gradient(#6aa8ff, var(--mp)); }
.bar.xp { height: 8px; }
.bar.xp i { background: var(--xp); }
.bar.xp span { font-size: 9px; line-height: 8px; }
#gold { color: #fbbf24; font-size: 12px; margin-top: 2px; }

#topright { position: fixed; right: 12px; top: 12px; padding: 6px; width: 144px; font-size: 11px; color: var(--muted); }
#minimap { display: block; width: 128px; height: 128px; image-rendering: pixelated; border: 1px solid #000; }
#zoombar { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin: 3px 0; }
#zoombar button { width: 30px; height: 22px; padding: 0; font-size: 16px; line-height: 1; }
#zoombar span { font-size: 11px; color: var(--muted); }
body.touch #zoombar button { width: 34px; height: 30px; font-size: 18px; }
/* phones: a small column left of the minimap (under it the fan's target / BM buttons overlap) */
body.touch #zoombar { position: absolute; right: calc(100% + 6px); top: 4px; flex-direction: column; gap: 4px; margin: 0; }
body.touch #zoombar span { font-size: 9px; padding: 1px 3px; border-radius: 4px; background: rgba(0, 0, 0, 0.6); color: #e5e7eb; }
#netinfo { margin: 4px 0; }
#chsel { width: 100%; font: inherit; font-size: 12px; background: #0c0b12; color: var(--text); border: 1px solid var(--edge); }

#bossbar { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); width: clamp(240px, calc(100vw - 520px), 560px); font-weight: 700; color: #ffd0b0; text-shadow: 2px 2px 0 #000; z-index: 5; }
.bb-top { display: flex; align-items: baseline; gap: 8px; font-size: 15px; }
#bossname { flex: 1; text-align: left; color: #ffb38a; letter-spacing: 0.5px; }
#bosspct { color: #fff; }
@media (max-width: 900px) { .bb-top { font-size: 12px; } }
#bossrage { font-style: normal; font-size: 11px; color: #fff; background: #b91c1c; padding: 0 6px; border-radius: 3px; animation: rage 0.6s infinite alternate; }
@keyframes rage { to { background: #ef4444; box-shadow: 0 0 10px #ef4444; } }
.bar.boss { height: 16px; margin-top: 3px; border: 2px solid #1a0a08; box-shadow: 0 0 0 1px #8a5a2a, 0 0 14px rgba(255,80,40,0.35); background: #1a0606; }
.bar.boss i#bossfill { background: linear-gradient(#ff8a4a, #d0301e 55%, #8a1a10); transition: width 0.1s linear; }
.bar.boss i#bosstrail { background: #fff3c4; transition: width 0.9s ease-in 0.3s; }
.bar.boss span { font-size: 11px; line-height: 16px; }
#mapcard { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); text-align: center; pointer-events: none; z-index: 6; animation: mapcard 4.2s ease forwards; }
#mapcard b { display: block; font-size: 40px; letter-spacing: 2px; color: #fff3c4; text-shadow: 0 0 12px rgba(255,190,80,0.8), 3px 3px 0 #000; }
#mapcard small { display: block; font-size: 15px; color: #e5d3a8; text-shadow: 2px 2px 0 #000; letter-spacing: 3px; }
#mapcard i { display: block; height: 2px; margin: 6px auto 0; width: 70%; background: linear-gradient(90deg, transparent, #ffd27a, transparent); }
@keyframes mapcard { 0% { opacity: 0; transform: translate(-50%, 12px); } 15% { opacity: 1; transform: translate(-50%, 0); } 75% { opacity: 1; } 100% { opacity: 0; } }
@media (max-width: 700px) { #mapcard b { font-size: 28px; } }

#dead {
  position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%);
  font-size: 26px; font-weight: 700; color: #ff6b6b; text-shadow: 3px 3px 0 #000; white-space: nowrap;
}

#skills { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 8px; }
#skills button {
  --cd: 0; position: relative; width: 64px; height: 56px; padding: 0; overflow: hidden;
  background: var(--panel); border: 2px solid var(--edge-hi); box-shadow: 0 0 0 2px #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
#skills button::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--cd) * 100%);
  background: rgba(0, 0, 0, 0.65); pointer-events: none;
}
#skills button.nomp { border-color: #3e4a7a; filter: saturate(0.3); }
#skills b { font-size: 11px; color: var(--accent); }
#skills .nm { font-size: 12px; }
/* skill icons: the button is the icon; the key in a corner, the name on a dark strip */
#skills button .skic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
#skills button.hasic, #skills button.atk:has(.skic) { justify-content: space-between; }
#skills button .skic ~ b { position: absolute; left: 3px; top: 1px; z-index: 1; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; }
#skills button .skic ~ .nm { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 1px 2px; font-size: 10px; background: rgba(0, 0, 0, 0.62);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
#skills button::after { z-index: 2; }
/* the SP a skill costs (both screens) and its slot number (phones) */
#skills button .spc { position: absolute; right: 2px; top: 1px; z-index: 1; font-style: normal; font-size: 9px; font-weight: 700; color: #93c5fd; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; }
#skills button .sln { display: none; }
body.touch #skills button .sln { display: flex; position: absolute; left: -2px; top: -2px; z-index: 3; width: 17px; height: 17px; align-items: center; justify-content: center;
  font-style: normal; font-size: 10px; font-weight: 700; color: #2a1804; border-radius: 50%; background: linear-gradient(#fde68a, #e0a526); box-shadow: 0 0 0 1.5px #05060c; }
body.touch #skills button .spc { right: auto; left: 50%; top: auto; bottom: 3px; transform: translateX(-50%); font-size: 8.5px; padding: 0 3px; border-radius: 6px; background: rgba(5, 8, 20, 0.75); }
body.touch #skills button { overflow: visible; }
/* potions left on the Q / E buttons */
#quick button .potn { position: absolute; right: 2px; bottom: 1px; font-style: normal; font-size: 10px; font-weight: 700; color: #fff; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; }
#quick button .potn.none { color: #f87171; }
#qHp, #qMp { position: relative; }
.sk-head .skic.big { width: 36px; height: 36px; flex: none; border-radius: 6px; }
.jobskills { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.jobskills span { display: flex; flex-direction: column; align-items: center; width: 62px; text-align: center; }
.jobskills .skic { width: 34px; height: 34px; }
.jobskills small { font-size: 9px; color: var(--muted); line-height: 1.1; margin-top: 2px; }

#chat { position: fixed; left: 12px; bottom: 12px; width: min(380px, calc(100vw - 24px)); padding: 6px; font-size: 13px; transition: background 0.3s, border-color 0.3s, box-shadow 0.3s; }
/* VR-001.3: idle chat = faded 4-line strip, no tabs, see-through; hover / Enter / new message brings it back */
#chat.idle { background: rgba(10, 8, 20, 0.28); border-color: transparent; box-shadow: none; }
#chat.idle #chattabs { display: none; }
#chat.idle #chatlog { height: 74px; overflow: hidden; -webkit-mask-image: linear-gradient(transparent, #000 40%); mask-image: linear-gradient(transparent, #000 40%); text-shadow: 1px 1px 0 #000; }
#chat.idle .chatrow { opacity: 0.45; }
@media (max-width: 1000px) { body:not(.touch) #chat { bottom: 72px; width: min(330px, 40vw); } } /* never cover the skill bar */
#chatlog { height: 140px; overflow-y: auto; padding-right: 4px; line-height: 1.35; -webkit-user-select: text; user-select: text; }
#chatlog div { word-break: break-word; }
#chatlog .global b { color: #9ecbff; }
#chatlog .local b { color: #a7f3a0; }
#chatlog .sys { color: var(--muted); font-style: italic; }
#chatlog .sys.lv { color: var(--accent); font-style: normal; font-weight: 700; }
#chatlog .sys.bad { color: #ff8a8a; font-style: normal; }
.chatrow { display: flex; gap: 4px; margin-top: 4px; }
#chatch { min-width: 52px; font-size: 12px; padding: 0 6px; }
#chatin {
  flex: 1; min-width: 0; padding: 6px 8px; font: inherit; font-size: 14px; color: var(--text);
  background: #0c0b12; border: 1px solid var(--edge); outline: none;
  -webkit-user-select: text; user-select: text;
}
#chatin:focus { border-color: var(--edge-hi); }

#disc { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 24px 32px; text-align: center; }
#disc button { padding: 10px 20px; font-size: 16px; }

/* ---------- RPG systems ---------- */
.bar.bmg { height: 10px; margin-top: 2px; }
.bar.bmg i { background: linear-gradient(#ffcf6a, #e07a10); }
.bar.bmg span { font-size: 9px; line-height: 10px; }
#bmwrap.ready { box-shadow: 0 0 6px 1px #ffb020; animation: pulse 0.8s infinite alternate; }
#bmwrap.on i { background: linear-gradient(#fff3a0, #ff9a10); }
@keyframes pulse { from { box-shadow: 0 0 2px #ffb020; } to { box-shadow: 0 0 10px 2px #ffb020; } }
#menu { display: flex; gap: 4px; margin-top: 6px; }
#menu button { flex: 1; padding: 3px 0; font-size: 12px; }

#targetbar { position: fixed; left: 50%; top: 56px; transform: translateX(-50%); width: min(260px, 50vw); text-align: center; font-size: 13px; text-shadow: 1px 1px 0 #000; }
.bar.tg { height: 8px; }
.bar.tg i { background: #ef4444; }

#toasts { position: fixed; left: 50%; top: 92px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; z-index: 20; width: min(560px, 92vw); }
.toast { background: rgba(10, 8, 16, 0.85); border: 1px solid var(--edge-hi); padding: 4px 12px; font-size: 14px; text-align: center; animation: toastIn 0.15s ease-out; }
.toast.bad { color: #ff9a9a; border-color: #7a2a2a; }
.toast.ok { color: #a7f3a0; border-color: #2a6a3a; }
.toast.ann { color: #ffe066; border: 2px solid #ffb020; font-size: 17px; font-weight: 700; padding: 8px 16px; box-shadow: 0 0 16px rgba(255, 176, 32, 0.5); }
.toast.loot { color: #e9d5ff; }
/* (ev1) the announcements' running line: thin, at the top edge, never over the hero */
#ev1Ticker { position: fixed; left: 0; right: 0; top: env(safe-area-inset-top, 0px); height: 28px; overflow: hidden; pointer-events: none; z-index: 45; background: linear-gradient(90deg, rgba(10, 8, 16, 0.6), rgba(10, 8, 16, 0.85) 10%, rgba(10, 8, 16, 0.85) 90%, rgba(10, 8, 16, 0.6)); border-bottom: 1px solid rgba(255, 210, 63, 0.45); }
#ev1Ticker span { display: inline-block; white-space: nowrap; color: #ffe066; font-size: 14px; font-weight: 700; line-height: 28px; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.ev1row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0; } .ev1row b { flex: 1 1 140px; } .ev1row small { flex: 1 1 160px; }
.ev1list { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; } .ev1tab { width: 100%; border-collapse: collapse; } .ev1tab td, .ev1tab th { padding: 2px 4px; } .ev1pct { width: 64px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } }

#hint { position: fixed; left: 50%; bottom: 140px; transform: translateX(-50%); background: rgba(10, 8, 16, 0.8); border: 1px solid var(--edge-hi); padding: 4px 12px; font-size: 14px; color: var(--accent); }

#combo { position: fixed; left: 50%; bottom: 82px; transform: translateX(-50%); width: 220px; text-align: center; font-weight: 700; font-size: 13px; color: #ffd23f; text-shadow: 1px 1px 0 #000; pointer-events: none; }
#combo .cbar { position: relative; height: 6px; background: #0a0910; border: 1px solid #000; margin-bottom: 2px; overflow: hidden; }
#combo .zone { position: absolute; top: 0; bottom: 0; left: 30%; right: 0; background: rgba(74, 222, 128, 0.35); }
#combo i { position: absolute; left: 0; top: 0; bottom: 0; background: #ffd23f; }
#combo.open .zone { background: rgba(74, 222, 128, 0.7); }

#skills button.combo { border-color: #4ade80; box-shadow: 0 0 0 2px #000, 0 0 10px #4ade80; }
#skills button.atk { border-color: #a49cc4; }
#quick { position: fixed; right: 12px; bottom: 14px; display: flex; gap: 4px; }
#quick button { width: 44px; height: 44px; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
#quick span { font-size: 9px; color: var(--muted); margin-top: 2px; }
#quick #qAuto { width: 54px; font-size: 11px; letter-spacing: 0.5px; }
#quick #qAuto.on { color: #0b1020; background: linear-gradient(#ffe27a, #f59e0b); box-shadow: 0 0 12px rgba(255,200,60,0.8); animation: autoglow 1.2s infinite alternate; }
#quick #qAuto.on span { color: #3a2a00; }
@keyframes autoglow { to { box-shadow: 0 0 20px rgba(255,220,90,1); } }
#lootfeed { position: fixed; right: 12px; top: 46%; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; pointer-events: none; z-index: 4; }
#lootfeed div { display: flex; align-items: center; gap: 6px; padding: 2px 10px 2px 4px; font-size: 13px; color: #fff; background: linear-gradient(90deg, rgba(10,8,20,0), rgba(10,8,20,0.75) 30%); text-shadow: 1px 1px 0 #000; animation: lootin 3.2s ease forwards; }
#lootfeed img { width: 22px; height: 22px; image-rendering: pixelated; }
#lootfeed .rare { color: #ffd65a; } #lootfeed .card { color: #c4b5fd; } #lootfeed .gold { color: #fbbf24; }
@keyframes lootin { 0% { opacity: 0; transform: translateX(20px); } 8% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }

#panels {
  position: fixed; top: 64px; left: 240px; right: 168px; z-index: 10;
  display: flex; gap: 8px; justify-content: center; align-items: flex-start; pointer-events: none;
}
#panels .win {
  position: relative; flex: 0 1 330px; min-width: 0; max-height: calc(var(--app-h) - 170px); overflow-y: auto; pointer-events: auto;
  background: var(--panel); border: 2px solid var(--edge-hi); box-shadow: 0 0 0 2px #000, 0 8px 24px rgba(0,0,0,0.5);
  padding: 0 10px 10px; font-size: 13px; -webkit-user-select: none; user-select: none;
}
.win header { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 8px 0 6px; margin-bottom: 6px; background: var(--panel); border-bottom: 1px solid var(--edge); font-weight: 700; color: var(--accent); }
.win .x { width: 26px; height: 26px; padding: 0; font-size: 16px; line-height: 1; }
.win button { padding: 4px 8px; font-size: 12px; }
.win button:disabled { opacity: 0.35; cursor: default; }
/* ===== ui1: one look for every window - navy and gold, the look of the status card and of the item card (v2).
   These are the BASE rules (the frame, the header with its close button, a plain button): every rule further down
   the sheet that styles one window's own pieces still wins over them, as it did over the old base. ===== */
:root { --u-rim: #b8923f; --u-gold: #e9c46a; --u-gold-hi: #fde68a; --u-ink: #05060c; --u-text: #eef1ff; --u-dim: #a9b6da; --u-line: rgba(150, 170, 255, 0.16); --u-card: rgba(6, 9, 20, 0.5);
  --u-btn: linear-gradient(180deg, #36457f 0%, #252f5e 100%); --u-btn-edge: #5466b3; --u-primary: linear-gradient(180deg, #fde68a 0%, #f0b429 55%, #d98c0a 100%);
  --u-frame: linear-gradient(180deg, rgba(23, 32, 61, 0.97) 0%, rgba(16, 22, 43, 0.97) 45%, rgba(12, 15, 29, 0.98) 100%); --u-frame-solid: linear-gradient(180deg, #17203d 0%, #10162b 45%, #0c0f1d 100%);
  --u-band: linear-gradient(180deg, #2a3a6e 0%, #1a2550 55%, #131b3b 100%); }
#panels .win { padding: 0 10px 10px; border: 2px solid var(--u-rim); border-radius: 14px; background: var(--u-frame); color: var(--u-text);
  box-shadow: inset 0 0 0 1px rgba(255, 220, 140, 0.14), 0 0 0 2px var(--u-ink), 0 18px 44px rgba(0, 0, 0, 0.6); scrollbar-width: thin; scrollbar-color: #7a6532 transparent; }
#panels .win::-webkit-scrollbar, #panels .win *::-webkit-scrollbar { width: 8px; height: 8px; }
#panels .win::-webkit-scrollbar-thumb, #panels .win *::-webkit-scrollbar-thumb { border-radius: 4px; background: #7a6532; }
#panels .win::-webkit-scrollbar-track, #panels .win *::-webkit-scrollbar-track { background: transparent; }
.win header { z-index: 2; min-height: 42px; margin: 0 -10px 10px; padding: 0 6px 0 14px; border-bottom: 2px solid var(--u-rim); border-radius: 12px 12px 0 0; background: var(--u-band);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12); font-size: 15px; letter-spacing: 0.3px; color: #fdf3d0; text-shadow: 0 1px 0 #000, 0 0 10px rgba(233, 196, 106, 0.45); }
.win header > span { min-width: 0; padding: 6px 0; line-height: 1.2; }
.win header > span::before { content: "\25C6"; margin-right: 8px; font-size: 10px; vertical-align: 2px; color: var(--u-gold); text-shadow: 0 0 6px rgba(233, 196, 106, 0.6); }
.win .x { flex: none; width: 30px; height: 30px; font-size: 18px; color: #fff; text-shadow: none; border: 1px solid #fca5a5; border-radius: 8px; background: linear-gradient(#dc2626, #7f1d1d); }
.win button { padding: 5px 11px; font-size: 12.5px; border: 1px solid var(--u-btn-edge); border-radius: 8px; background: var(--u-btn); color: var(--u-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 1px 0 rgba(0, 0, 0, 0.5); transition: filter 0.12s; }
.win button:hover:not(:disabled) { filter: brightness(1.16); }
.win button:active:not(:disabled) { filter: brightness(0.92); }
.win button:focus-visible { outline: 2px solid var(--u-gold-hi); outline-offset: 1px; }
.muted { color: var(--muted); font-size: 12px; }
.warn { color: #ffb36b; font-size: 12px; }
.ok { color: #a7f3a0; font-size: 12px; }
.bad { color: #ff8a8a; }
.jobline { font-size: 16px; font-weight: 700; color: #9ecbff; margin: 2px 0 6px; }
.lvrow { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 6px; margin-bottom: 4px; }
.lvrow .bar { height: 8px; margin: 0; }
.bar.jxp i { background: #22d3ee; }
table.stats { width: 100%; border-collapse: collapse; margin: 6px 0; }
table.stats th { text-align: left; width: 40px; color: var(--accent); }
table.stats td { padding: 2px 4px; }
table.stats .desc { font-size: 11px; color: var(--muted); }
.bonus { color: #4ade80; }
.plus { width: 24px; height: 22px; padding: 0 !important; font-weight: 700; }
.pts { margin: 6px 0; }
.derived { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; border-top: 1px solid var(--edge); padding-top: 6px; }
.derived div { display: flex; justify-content: space-between; }
.derived b { color: #fff; }
.skill { border: 1px solid var(--edge); padding: 6px; margin-bottom: 6px; background: rgba(0,0,0,0.2); }
.skill.locked { opacity: 0.7; }
.sk-head { display: flex; align-items: center; gap: 8px; }
.sk-head b { flex: 1; }
.skill .desc { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
/* hotbar keys of a skill (Skills panel): lit = on that key, solid = pinned there by the player */
.hbset { display: flex; align-items: center; gap: 3px; margin-top: 5px; }
.hbset small { color: var(--muted); font-size: 10px; margin-right: 4px; }
.hbset button { min-width: 22px; padding: 1px 4px; font-size: 11px; opacity: 0.55; }
.hbset button.on { opacity: 1; border-color: var(--accent); }
.hbset button.pin { opacity: 1; background: var(--accent); color: #1a1420; }
#skills button.empty { opacity: 0.35; }
.eqrow { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; }
.eqslot { display: flex; flex-direction: column; align-items: center; font-size: 10px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
.slot { position: relative; aspect-ratio: 1; min-width: 32px; background: #0c0b12; border: 1px solid var(--edge); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.slot.empty { cursor: default; }
.slot.sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.slot.eq { width: 40px; height: 40px; border-color: var(--edge-hi); }
.slot img { width: 75%; height: 75%; image-rendering: pixelated; }
.slot em { position: absolute; right: 1px; bottom: 0; font-style: normal; font-size: 10px; text-shadow: 1px 1px 0 #000; }
.slot em.ref { color: #7dd3fc; left: 1px; top: auto; right: auto; bottom: 0; } /* (next n165: the bottom left - at the top it lay under the stars and the arrow) */
/* friends (inside the party window) */
#p_party .frhead { margin: 10px 0 4px; }
#p_party .frrow { display: flex; align-items: center; gap: 4px; padding: 2px 0; }
#p_party .frrow > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#p_party .frrow .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #6b7280; margin-right: 5px; }
#p_party .frrow.on .dot { background: #4ade80; box-shadow: 0 0 4px #4ade80; }
#p_party .frrow:not(.on) { opacity: 0.7; }
/* crafting (blacksmith, second tab) */
#p_smith .craftlist { max-height: 380px; overflow-y: auto; margin-top: 6px; }
#p_smith .craftrow { display: grid; grid-template-columns: 1fr; gap: 3px; padding: 5px 2px; border-bottom: 1px solid #ffffff12; }
#p_smith .craftrow.locked { opacity: 0.5; }
#p_smith .cout { display: flex; align-items: center; gap: 6px; }
#p_smith .cout img, #p_smith .cin img { width: 22px; height: 22px; image-rendering: pixelated; vertical-align: middle; }
#p_smith .cin { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; }
#p_smith .cin .lack { color: #f87171; }
#p_smith .cin small { margin-left: 2px; opacity: 0.8; }
#p_guild .bar.gxp i { background: linear-gradient(90deg, #a855f7, #f0abfc); }
.blesshot { color: #fde68a; text-shadow: 0 0 6px #f59e0b; }
/* boss timers (warp window) */
#p_warp .bosstable { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
#p_warp .bosstable td { padding: 2px 4px; border-bottom: 1px solid #ffffff12; }
#p_warp .bosstable td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
#p_warp .bosstable .alive { color: #f87171; }
/* game guide */
#p_help .helplist { margin: 8px 0 0; padding-left: 18px; max-height: 360px; overflow-y: auto; }
#p_help .helplist li { margin: 5px 0; line-height: 1.45; }
#p_help .helplist b { color: #fcd34d; margin-right: 4px; }
/* market (banker window, third tab) */
#p_bank .mklist { max-height: 240px; overflow-y: auto; margin: 6px 0; }
#p_bank .mkrow { display: flex; align-items: center; gap: 6px; padding: 4px 2px; border-bottom: 1px solid #ffffff12; }
#p_bank .mkrow img, #p_bank .mkform img { width: 24px; height: 24px; image-rendering: pixelated; }
#p_bank .mkrow > span { flex: 1; min-width: 0; }
#p_bank .mkrow .price { color: #fcd34d; white-space: nowrap; }
#p_bank .mkform { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
#p_bank .mkform input { width: 90px; }
/* mail (banker window, second tab) */
#p_bank .badge { background: #ef4444; color: #fff; border-radius: 8px; padding: 0 5px; font-size: 10px; }
#p_bank .mailbox { max-height: 200px; overflow-y: auto; }
#p_bank .mailrow { border: 1px solid var(--edge); border-radius: 6px; padding: 5px 6px; margin: 4px 0; }
#p_bank .mailrow.unread { border-color: #ffd23f; }
#p_bank .mailrow p { margin: 3px 0; }
#p_bank .mailrow .lrw { display: flex; gap: 6px; flex-wrap: wrap; margin: 3px 0; }
#p_bank .mailrow .lri img { width: 20px; height: 20px; image-rendering: pixelated; vertical-align: middle; }
#p_bank .mailform { display: grid; gap: 4px; }
#p_bank .mailform .tgrid { grid-template-columns: repeat(4, 1fr); }
/* daily login calendar */
#p_login .logindays { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
#p_login .lday { position: relative; border: 1px solid var(--edge); border-radius: 6px; padding: 6px 4px; text-align: center; background: #15121f; }
#p_login .lday.big { grid-column: span 2; background: linear-gradient(135deg, #2a1f0a, #15121f); border-color: #d4af37; }
#p_login .lday.today { border-color: #ffd23f; box-shadow: 0 0 0 1px #ffd23f, 0 0 10px #ffd23f55; }
#p_login .lday.done { opacity: 0.55; }
#p_login .lday .lrw { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; margin: 4px 0; }
#p_login .lday .lri { display: inline-flex; align-items: center; font-size: 11px; }
#p_login .lday .lri img { width: 20px; height: 20px; image-rendering: pixelated; }
#p_login .lday .tick { position: absolute; top: 2px; right: 4px; color: #4ade80; font-style: normal; }
/* rankings */
#p_rank .ranktable { width: 100%; border-collapse: collapse; margin-top: 6px; }
#p_rank .ranktable td { padding: 3px 4px; border-bottom: 1px solid #ffffff12; }
#p_rank .ranktable td.num { text-align: right; font-variant-numeric: tabular-nums; }
#p_rank .ranktable tr.me td { background: #ffd23f22; color: #ffe08a; }
/* trade window: two offer columns side by side, own bag below */
#p_trade .tsides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#p_trade .tside { border: 1px solid var(--edge); border-radius: 6px; padding: 6px; }
#p_trade .tside.locked { border-color: #d4af37; box-shadow: 0 0 0 1px #d4af3755 inset; }
#p_trade .tgrid { grid-template-columns: repeat(4, 1fr); }
#p_trade .tgold { margin-top: 4px; display: flex; gap: 4px; align-items: center; }
#p_trade .tgold input { width: 90px; }
#p_trade .tok { color: #6ee7a0; } #p_trade .tlock { color: #f5d06a; }
#p_trade .tbtns { margin: 8px 0; }
/* storage window: two grids, a small "½" button on stacks */
#p_bank h4 { margin: 8px 0 4px; }
#p_bank .bankgrid { max-height: 230px; overflow-y: auto; }
.slot .half { position: absolute; left: 0; top: 0; padding: 0 3px; font-size: 9px; line-height: 12px; min-width: 0; border-radius: 0 0 4px 0; opacity: 0.85; }
.slot .half.qnum { left: auto; right: 0; border-radius: 0 0 0 4px; } /* (qty1) the typed amount, top right */
.qnumbox { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.45); } /* (qty1) */
.qnumcard { background: var(--panel); border: 1px solid var(--edge-hi); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; min-width: 240px; max-width: calc(100vw - 32px); color: var(--text); }
.qnumrow { display: flex; gap: 6px; align-items: center; } .qnumrow button { min-height: 34px; min-width: 38px; } .qnumrow .primary { flex: 1; }
.qnumrow input { width: 90px; min-height: 34px; font-size: 16px; text-align: center; }
.ic-set.itr { border-color: #6e63a0; } .itr-row { flex-wrap: wrap; } .itr-row.off { opacity: 0.55; } .itr-note { flex-basis: 100%; font-size: 11px; } /* (traits1 install-8) */
.itr-pick { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; } .itr-pick small { flex-basis: 100%; } .itr-pick button { min-height: 30px; font-size: 12px; }
.itr-pvp { font-size: 11px; } .itr-sheet .itr-dv { display: flex; justify-content: space-between; gap: 8px; } .itr-sheet .bad { color: #f87171; } .itr-overrow { font-size: 11px; text-align: right; margin: -2px 0 4px; } /* (traits1 install-8b: the over-the-cap line under its row) */ .itr-ground { color: #fbbf24; }
.shoprow:has(.qbuy) { grid-template-columns: 24px 1fr auto auto auto auto; } .shoprow .qbuy { min-width: 0; padding-left: 7px; padding-right: 7px; } /* (qty1b) the shop row's typed amount: one more column */
.gold { text-align: right; color: #fbbf24; margin: 6px 0; }
.detail h4 { margin: 6px 0 4px; color: #fff; }
.detail .lines { font-size: 12px; color: #d4d0e8; line-height: 1.5; }
.btns { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.pick { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.pick p { margin: 0; font-size: 12px; color: var(--muted); }
.shoprow { display: grid; grid-template-columns: 24px 1fr auto auto auto; gap: 6px; align-items: center; padding: 3px 0; border-bottom: 1px dashed var(--edge); }
.shoprow img, .smithrow img { width: 20px; height: 20px; image-rendering: pixelated; }
.smithlist { display: flex; flex-direction: column; gap: 3px; max-height: 180px; overflow-y: auto; }
.smithrow { display: flex; align-items: center; gap: 6px; text-align: left; }
.smithrow.sel { border-color: var(--accent); }
.refine { margin-top: 8px; border-top: 1px solid var(--edge); padding-top: 6px; line-height: 1.6; }
.refine h4 { margin: 0 0 4px; color: #7dd3fc; }
.chk { display: flex; gap: 6px; align-items: center; font-size: 12px; }
.chk input[data-act="guardtick"] { width: 22px; height: 22px; accent-color: #ffcf4a; flex: none; } /* (hb1) the Guard Charm box: bigger and easy to see */
button.big { width: 100%; margin-top: 8px; padding: 8px !important; font-size: 15px !important; font-weight: 700; background: #d9632b; border-color: #ffb36b; }
.jobcard { border: 1px solid var(--edge); padding: 8px; margin-bottom: 6px; background: rgba(0,0,0,0.2); }
.jobcard b { color: #9ecbff; font-size: 15px; }
.jobcard p { margin: 4px 0; font-size: 12px; }
.ranklines { flex-wrap: wrap; margin-top: 4px; }
.gwar { border: 1px solid #b91c1c; background: rgba(127, 29, 29, 0.25); padding: 6px; margin: 6px 0; }
.gwar b { color: #fca5a5; }
.gwar .gwscore { font-size: 16px; font-weight: bold; margin: 4px 0; }
.ranklines button { font-size: 11px; padding: 2px 6px; }
.jobcard p.role { color: #fbbf24; font-weight: bold; font-size: 11px; } /* role tags: what this job is best at */
#skills { flex-wrap: nowrap; }
#skills button { width: 58px; }
#skills .nm { font-size: 11px; max-width: 54px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Phase 2: party / guild / faction / war ---------- */
#partyframe { margin-top: 6px; border-top: 1px solid var(--edge); padding-top: 4px; }
#partyframe .pm { font-size: 11px; margin-bottom: 3px; color: #86efac; }
#partyframe .bar { height: 5px; margin: 1px 0 0; }
#partyframe .bar i, .memrow .bar i { background: #4ade80; }
.memrow { display: grid; grid-template-columns: 1fr 70px auto; gap: 6px; align-items: center; padding: 4px 0; border-bottom: 1px dashed var(--edge); }
.memrow .bar { height: 6px; margin: 0; }
.invrow { display: flex; gap: 4px; margin: 8px 0; }
.invrow input { flex: 1; min-width: 0; padding: 5px 6px; font: inherit; font-size: 13px; color: var(--text); background: #0c0b12; border: 1px solid var(--edge); -webkit-user-select: text; user-select: text; }
/* online lights in friend / member lists (i.dot only: the class "dot" on a menu button means "something
   to do" — this rule used to shrink those buttons to 7 px, the squashed C / I on phones) */
i.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #555; margin-right: 5px; }
i.dot.on { background: #4ade80; }
#ppop, #invite { position: fixed; left: 50%; transform: translateX(-50%); z-index: 30; padding: 10px 14px; font-size: 14px; text-align: center; min-width: 240px; }
#ppop { top: 120px; }
#invite { top: 180px; border-color: #ffd23f; }
#invite p { margin: 0 0 6px; }
#ppop .btns, #invite .btns { justify-content: center; }
.gtag { color: #fcd34d; }
#warinfo { margin-top: 6px; font-size: 11px; line-height: 1.4; color: var(--muted); }
.warhot { color: #ff9a6a; }
#zonetag { position: fixed; left: 50%; top: 36px; transform: translateX(-50%); color: #ff6b6b; font-weight: 700; font-size: 14px; letter-spacing: 1px; text-shadow: 2px 2px 0 #000; pointer-events: none; animation: pulse2 1.2s infinite alternate; }
@keyframes pulse2 { from { opacity: 0.6; } to { opacity: 1; } }
#chattabs { display: flex; gap: 2px; margin-bottom: 4px; flex-wrap: wrap; }
#chattabs button { padding: 2px 7px; font-size: 11px; background: transparent; border: 1px solid transparent; color: var(--muted); }
#chattabs button.on { color: var(--text); border-color: var(--edge-hi); background: #2b2540; }
#chattabs .sp { flex: 1; }
#chatlog { --chat-fs: 13px; font-size: var(--chat-fs); }
/* whispers stay visible on every tab */
#chatlog[data-filter="g"] > div:not(.global):not(.whisper),
#chatlog[data-filter="l"] > div:not(.local):not(.whisper),
#chatlog[data-filter="p"] > div:not(.party):not(.whisper),
#chatlog[data-filter="gd"] > div:not(.guild):not(.whisper),
#chatlog[data-filter="sys"] > div:not(.sys) { display: none; }
#chatlog[data-filter="w"] > div:not(.whisper) { display: none; } /* (nx32 wsp1) the whisper tab */
#chatlog > div.whisper { cursor: pointer; } /* (nx32 wsp1) a tap answers that person */
#chattabs [data-tab="w"].new::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 4px; border-radius: 50%; background: #f472b6; vertical-align: middle; } /* (nx32 wsp1) a whisper came */
/* (rp1 G5) the players: pickups and effect lines flooded the All tab - they stay in the System tab (and the loot feed) */
#chatlog[data-filter="all"] > div.loot, #chatlog[data-filter="all"] > div.buffl, #chatlog[data-filter="all"] > div.sys:not(.ann) { display: none; } /* (next n198, the owner: All = chat and server announcements) */
#chatlog .party b { color: #86efac; }
#chatlog .guild b { color: #fcd34d; }
#chatlog .whisper, #chatlog .whisper b { color: #f9a8d4; }

/* ---------- quests ---------- */
#qtrack { position: fixed; right: 12px; top: 250px; width: 230px; max-height: calc(var(--app-h) - 340px); overflow-y: auto; padding: 6px 8px; font-size: 12px; background: rgba(20, 18, 30, 0.62); transition: opacity 0.25s, background 0.25s; }
/* VR-001.3: fold on demand, compact while fighting */
#qtrack .qt-h[data-qt-toggle] { cursor: pointer; user-select: none; }
#qtrack .qt-x { float: right; color: var(--muted); }
#qtrack.collapsed > :not(.qt-h):not(.qt-mini) { display: none; }
#qtrack .qt-mini { display: none; font-size: 12px; color: #e8e2ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#qtrack.collapsed .qt-mini { display: block; }
#qtrack.collapsed { width: min(230px, 42vw); }
#qtrack.compact { background: rgba(20, 18, 30, 0.38); opacity: 0.8; }
#qtrack.compact :is(.qt-q, .qt-g) .qt-o:not(.ok):not(.hint) ~ .qt-o, #qtrack.compact .daily ~ .qt-o.muted { display: none; } /* (hb1) in a fight: a quest's / a dungeon group's later steps and the bounties done fold away - the daily / board lines stay */
.qt-h { font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.qt-q { margin-bottom: 6px; }
/* (next n167) a tracker line's Abandon: small, away from the walk-there tap, gone in a fight */
.qt-ab { float: right; margin: 0 0 0 6px; min-width: 22px; min-height: 20px; padding: 0 4px; font-size: 11px; line-height: 18px; border-radius: 5px; background: rgba(0, 0, 0, 0.3); color: #fca5a5; border: 1px solid rgba(252, 165, 165, 0.35); cursor: pointer; }
.qt-ab.no { opacity: 0.45; }
#qtrack.compact .qt-ab { display: none; }
body.touch .qt-ab { min-width: 30px; min-height: 26px; line-height: 24px; font-size: 13px; }
.qt-t { color: #e9e4ff; font-weight: 700; font-size: 12px; }
.qt-t.daily { margin-top: 6px; color: #fcd34d; }
.qt-o { color: #c9c2e4; padding-left: 4px; line-height: 1.45; }
.qt-o.ok { color: #86efac; }
.qt-o.hint { color: #ffd23f; animation: pulse2 1.2s infinite alternate; }
.qt-o.muted { color: var(--muted); }
.qt-q.done .qt-t { color: #86efac; }
#dialog {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 25;
  width: min(640px, calc(100vw - 24px)); display: flex; gap: 12px; padding: 12px 14px;
  border-color: #c9a227; box-shadow: 0 0 0 2px #000, 0 10px 30px rgba(0,0,0,0.6);
  background: linear-gradient(rgba(28, 24, 40, 0.96), rgba(16, 14, 24, 0.96));
}
#dialog { max-height: calc(var(--app-h, 100vh) - 100px); overflow-y: auto; } /* (afp1 G3d) a long dialogue scrolls instead of running off a short screen */
/* (afp1 G3a) Settings > Text size: the windows larger, in their own proportions (the dialogue's width and place are screen lengths:
   not zoomed); on a wide screen a window's height follows the screen's, divided back by the zoom (the second reader M3) */
body.ts2 #panels .win { zoom: 1.12; }
body.ts3 #panels .win { zoom: 1.25; }
@media (pointer: fine) and (min-width: 901px) { body.ts2 #panels .win { max-height: calc((var(--app-h) - 170px) / 1.12); } body.ts3 #panels .win { max-height: calc((var(--app-h) - 170px) / 1.25); } }
.dlg-face { width: 72px; height: 72px; object-fit: contain; image-rendering: pixelated; background: rgba(0,0,0,0.3); border: 1px solid var(--edge); flex: none; }
.dlg-body { flex: 1; min-width: 0; }
.dlg-name { color: #ffd23f; font-weight: 700; margin-bottom: 4px; }
.dlg-text { font-size: 15px; line-height: 1.6; min-height: 3.2em; color: #f5f0e6; }
.dlg-q { margin-top: 8px; color: #c4b5fd; font-size: 13px; }
.dlg-o { font-size: 13px; color: #e5e7eb; padding-left: 6px; }
.dlg-reward { margin-top: 4px; font-size: 13px; color: #fbbf24; }
.dlg-bounty { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px dashed var(--edge); font-size: 13px; }
.dlg-bounty small { color: #fbbf24; }
.dlg-btns { display: flex; gap: 6px; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
.dlg-btns button { padding: 6px 14px; font-size: 13px; }
.dlg-btns button.pri { background: #b7791f; border-color: #fcd34d; font-weight: 700; }
@media (max-width: 900px) { #qtrack { top: auto; bottom: 150px; right: 8px; width: 180px; max-height: 30vh; } }

/* ---------- desktop: fan wrapper is transparent ---------- */
#fan { display: contents; }
#mChat, #quick #mTarget { display: none; }
#qTalk.hide { opacity: 0.35; }

/* ---------- settings panel ---------- */
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--edge); }
.seg { display: flex; gap: 4px; }
.seg button.on { border-color: var(--accent); color: var(--accent); }
/* (next n142b) the market: categories, the job / sort bar, the pager */
.mkcats { flex-wrap: wrap; margin: 6px 0 4px; }
.mkcats button, .mkbar button { padding: 3px 8px; font-size: 12px; }
.mkbar { flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.mkpager { justify-content: center; gap: 10px; align-items: center; margin: 6px 0; }
#bSettings { width: 100%; margin-top: 4px; font-size: 11px; padding: 2px; }

/* ---------- touch (mobile/tablet): thumb-reach layout ----------
   Left thumb: floating joystick (appears where you touch).
   Right thumb: big attack button with skills on an arc around it (fan),
   potions and Battle Mode close by, "Talk" only appears near an NPC. */
#touchArea { position: fixed; left: 0; top: 25%; width: 45%; bottom: 0; touch-action: none; }
#stick {
  position: fixed; left: 28px; bottom: 40px; width: 120px; height: 120px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.07); opacity: 0.45;
  pointer-events: none;
}
#stick.active { opacity: 1; bottom: auto; }
#knob { position: absolute; left: 33px; top: 33px; width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,0.4); box-shadow: 0 0 0 2px rgba(0,0,0,0.3); }

body.touch #fan {
  display: block; position: fixed; right: 0; bottom: 0; width: 290px; height: 290px; z-index: 6;
  transform: scale(var(--ui-scale, 1)); transform-origin: bottom right; pointer-events: none;
}
body.touch #fan button { pointer-events: auto; touch-action: none; -webkit-tap-highlight-color: transparent; }
body.touch #skills, body.touch #quick { position: static; transform: none; display: block; }
body.touch #skills button {
  position: absolute; width: 58px; height: 58px; border-radius: 50%; padding: 0;
  background: rgba(20, 18, 30, 0.82); border: 2px solid var(--edge-hi);
}
body.touch #skills b { display: none; }
body.touch #skills .nm { font-size: 10px; max-width: 52px; white-space: normal; line-height: 1.1; text-align: center; }
body.touch #skills button.hasic .nm, body.touch #skills button.atk .skic ~ .nm { display: none; } /* phones: the round button is the icon */
#skills button.atk .skic { image-rendering: pixelated; padding: 14%; box-sizing: border-box; object-fit: contain; } /* a 12 px weapon icon: crisp, not stretched */
body.touch #skills button .skic { border-radius: 50%; }
body.touch #skills button::after { border-radius: 50%; top: auto; }
/* big attack button + 6 skill slots on two arcs (angles 0°-90° around it) */
body.touch #skills button.atk { right: 18px; bottom: 24px; width: 84px; height: 84px; border-color: #ffb36b; background: rgba(120, 50, 20, 0.85); }
body.touch #skills button.atk .nm { font-size: 13px; font-weight: 700; }
body.touch #skills button:nth-child(2) { right: 131px; bottom: 37px; }
body.touch #skills button:nth-child(3) { right: 118px; bottom: 87px; }
body.touch #skills button:nth-child(4) { right: 81px; bottom: 124px; }
body.touch #skills button:nth-child(5) { right: 31px; bottom: 137px; }
body.touch #skills button:nth-child(6) { right: 190px; bottom: 80px; }
body.touch #skills button:nth-child(7) { right: 74px; bottom: 196px; }
body.touch #skills button.hbpage { right: 150px; bottom: 150px; width: 40px; height: 40px; font-size: 16px; color: #fde68a; border-color: #fbbf24; } /* (next n26) the second page of keys */
body.touch #skills button.hbpage .nm { display: block; position: absolute; bottom: -14px; left: 0; right: 0; font-size: 9px; }
#skills button.hblock { opacity: 0.55; cursor: default; } /* (next n26) the keys the next VIP tier opens */
body.touch #quick button { position: absolute; width: 50px; height: 50px; border-radius: 12px; }
body.touch #qHp { right: 250px; bottom: 8px; }
body.touch #qMp { right: 196px; bottom: 8px; }
body.touch #qBm { right: 10px; bottom: 210px; }
body.touch #qTalk { right: 150px; bottom: 150px; width: 62px !important; height: 62px !important; border-radius: 50% !important; border-color: #4ade80; color: #4ade80; }
body.touch #qTalk.hide { display: none; }
body.touch #qRide { right: 230px; bottom: 150px; border-radius: 50% !important; }
#qRide.on { border-color: #fbbf24; color: #fbbf24; box-shadow: 0 0 8px rgba(251,191,36,0.5); }
body.touch #quick #mTarget { display: flex; position: absolute; right: 14px; bottom: 262px; width: 46px; height: 46px; border-radius: 50%; align-items: center; justify-content: center; font-size: 20px; }

/* left-handed: mirror the fan to the left, joystick to the right */
/* mirror = flip around the fan's own left edge, then shift it back by its width */
body.touch.lefty #fan { right: auto; left: 0; transform-origin: bottom left; transform: scale(var(--ui-scale, 1)) translateX(100%) scaleX(-1); }
/* each button flips back as a whole (the old "button > *" rule missed bare text: AUTO read "OTUA", Q / E mirrored) */
body.touch.lefty #fan button { transform: scaleX(-1); }
body.touch.lefty #fan button > b { display: none; }
body.touch.lefty #mChat { left: auto; right: 12px; }
body.touch.lefty #touchArea { left: auto; right: 0; }
body.touch.lefty #stick { left: auto; right: 28px; }

/* compact HUD on touch: bigger menu buttons, chat collapsed behind a button */
body.touch #menu button { padding: 8px 0; font-size: 14px; }
body.touch #stats { width: 190px; }
body.touch #chat { display: none; }
body.touch.chat-open #chat { display: block; top: 60px; bottom: auto; left: 50%; transform: translateX(-50%); width: min(420px, 92vw); z-index: 20; opacity: 1; }
body.touch #mChat { display: flex; position: fixed; left: 12px; top: 210px; width: 46px; height: 46px; border-radius: 50%; align-items: center; justify-content: center; font-size: 20px; z-index: 7; }
body.touch #combo { bottom: auto; top: 92px; }
body.touch #hint { display: none; }
body.touch #dialog { bottom: 12px; }

/* quest tracker on touch: its empty parts let touches through to the joystick, but the quest lines
   themselves take a tap (walk there by yourself) — and the header folds / unfolds it */
body.touch #qtrack { pointer-events: none; overflow: hidden auto; overscroll-behavior: contain; } /* (hb1: it scrolls by a swipe on its lines) */
body.touch #qtrack > *, body.touch #qtrack .qt-o { pointer-events: auto; touch-action: pan-y; } /* (next n22: every line takes a swipe, not only the tappable ones - a player could not scroll it) */
body.touch #qtrack [data-qgo], body.touch #qtrack [data-qbounty], body.touch #qtrack [data-qnpc], body.touch #qtrack [data-qguide],
body.touch #qtrack [data-qt-toggle] { pointer-events: auto; cursor: pointer; -webkit-tap-highlight-color: rgba(251, 191, 36, 0.25); }
body.touch #qtrack .qt-mini, body.touch #qtrack .qt-h[data-qt-toggle] { padding: 5px 0; } /* (a finger-sized line) */

/* short screens (phones held sideways): compact HUD so nothing overlaps the fan */
@media (max-height: 520px) {
  body.touch #topright { width: 108px; padding: 4px; }
  body.touch #minimap { width: 88px; height: 88px; }
  body.touch #topright { width: 96px; }
  body.touch #netinfo, body.touch #chsel, body.touch #warinfo { display: none; }
  body.touch #bSettings { font-size: 10px; }
  body.touch #stats { width: 170px; padding: 5px 7px; font-size: 11px; }
  body.touch #stats .bar { height: 11px; margin-bottom: 2px; }
  body.touch #stats .bar span { line-height: 11px; font-size: 9px; }
  body.touch #menu button { padding: 5px 0; font-size: 12px; }
  body.touch #qtrack { top: 150px; bottom: auto; left: 10px; right: auto; width: 180px; max-height: 92px; font-size: 10px; opacity: 0.85; }
  body.touch #fan { --short: 0.82; transform: scale(calc(var(--ui-scale, 1) * var(--short))); }
  body.touch.lefty #fan { transform: scale(calc(var(--ui-scale, 1) * var(--short))) translateX(100%) scaleX(-1); }
  body.touch #mChat { top: auto; bottom: 12px; left: 12px; width: 40px; height: 40px; }
  /* (the party box shows on phones too: main.js layoutTopbar puts it under the quest box) */
  body.touch #bSettings { display: none; } /* in the ☰ menu; here the 🎯 button covered it */
  /* left-handed: the fan is now bottom-left, right under the status card, so mirror the top HUD
     too — status card + quest tracker right, minimap left (as left-handed modes in mobile MMOs do) */
  body.touch.lefty #stats { left: auto; right: 12px; }
  body.touch.lefty #qtrack { left: auto; right: 10px; }
  body.touch.lefty #topright { right: auto; left: 12px; }
  body.touch.lefty #zoombar { right: auto; left: calc(100% + 6px); }
}
/* tall phones (portrait): tracker under the stats box (never over the centred
   character), potions stacked on the right edge so the left thumb's joystick
   zone stays free */
@media (min-height: 521px) {
  body.touch #qtrack { top: 178px; bottom: auto; left: 10px; right: auto; width: 175px; max-height: 110px; font-size: 11px; opacity: 0.9; }
  body.touch #mChat { top: 298px; }
  body.touch #qHp { right: 10px; bottom: 316px; }
  body.touch #qMp { right: 10px; bottom: 372px; }
}
/* (pt1, item 4) a phone held upright: the compact HUD - and the hero card folds (client/js/hudfold.js) */
/* (pbf1 G3) the fold button on every screen: the card's top right corner, as on an upright phone (the combat power moves left of it) */
#hudFold { display: block; position: absolute; right: 6px; top: 6px; z-index: 2; width: 22px; height: 22px; min-height: 0; padding: 0; font-size: 12px; line-height: 20px; border-radius: 7px; }
#stats #pcp { right: 34px; }
#hudFold.dot::after { content: ''; position: absolute; right: -3px; top: -3px; width: 9px; height: 9px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px #05060c; }
body.hudfold #bmwrap, body.hudfold #ptsChip, body.hudfold #tmenu, body.hudfold #xprate { display: none !important; }
@media not all and (max-width: 600px) and (min-height: 521px) and (orientation: portrait) { body.hudfold #stats > #gold, body.hudfold #stats > #menu { display: none !important; } } /* (the buffs stay; the upright phone folds as before) */
@media (max-width: 600px) and (min-height: 521px) and (orientation: portrait) {
  body.touch #netinfo, body.touch #warinfo, body.touch #bSettings { display: none; } /* (Settings is in the menu sheet) */
  body.touch #testdayGame { display: none; } /* (next n323, the owner 2026-11-08: an upright phone was full - the test-days note stays on wider screens) */
  body.touch #chsel { font-size: 11px; }
  body.touch #mChat { top: 236px; left: auto; right: 12px; width: 42px; height: 42px; }
  body.touch #qtrack { top: 214px; }
  body.touch #hudFold { display: block; position: absolute; right: 4px; top: 4px; width: 24px; height: 24px; min-height: 0; padding: 0; font-size: 13px; line-height: 22px; border-radius: 7px; }
  #hudFold.dot::after { content: ''; position: absolute; right: -3px; top: -3px; width: 9px; height: 9px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px #05060c; }
  body.touch.hudfold #xprate, body.touch.hudfold #bmwrap, body.touch.hudfold #ptsChip, body.touch.hudfold #tmenu { display: none !important; }
  body.touch.hudfold #qtrack { top: 96px; }
}

@media (pointer: coarse), (max-width: 900px) {
  #panels { left: 8px; right: 8px; top: 56px; flex-direction: column; justify-content: flex-start; align-items: stretch; max-height: calc(var(--app-h) - 120px); overflow-y: auto; pointer-events: auto; }
  #panels .win { flex: none; max-height: none; }
}
@media (max-width: 600px) {
  #topright { width: 96px; }
  #minimap { width: 80px; height: 80px; }
  #netinfo { font-size: 10px; }
  #bossbar { top: auto; bottom: 230px; width: 60vw; }
}

/* ---------- collection: pets / titles / card album ---------- */
.coltabs { display: flex; gap: 4px; margin-bottom: 8px; }
.coltabs button { flex: 1; }
.petcard { border: 1px solid #fb923c66; padding: 8px; margin-bottom: 8px; background: linear-gradient(rgba(251,146,60,0.08), rgba(0,0,0,0.2)); }
.pethead { font-size: 15px; margin-bottom: 4px; }
.tier { font-size: 12px; padding: 0 5px; border-radius: 3px; background: #333; }
.tier.t0 { color: #cbd5e1; } .tier.t1 { color: #86efac; background: #14532d; } .tier.t2 { color: #ffd6e8; background: #9d174d; }
.bar.int i { background: linear-gradient(#ff9ec7, #db2777); }
.bar.hun i { background: linear-gradient(#fde68a, #d97706); }
.bar.hun.low i { background: linear-gradient(#fca5a5, #dc2626); }
.bar .mark { position: absolute; top: -1px; bottom: -1px; width: 2px; background: #fff8; }
.achlist { max-height: 46vh; overflow-y: auto; }
.ach { border: 1px solid var(--edge); padding: 6px 8px; margin-bottom: 5px; background: rgba(0,0,0,0.2); opacity: 0.75; }
.ach.done { opacity: 1; border-color: #fbbf2466; background: linear-gradient(90deg, rgba(251,191,36,0.10), rgba(0,0,0,0.2)); }
.achhead { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.achhead button.on { background: #b45309; }
.ach .desc { font-size: 12px; color: #cbd5e1; margin: 2px 0; }
.bar.ach { height: 12px; margin: 3px 0 0; }
.bar.ach i { background: linear-gradient(#93c5fd, #2563eb); }
.bar.ach span { font-size: 10px; line-height: 12px; }
.album { display: flex; flex-direction: column; gap: 5px; }
.acard { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; border: 1px solid var(--edge); padding: 6px; background: rgba(0,0,0,0.25); }
.acard.empty { opacity: 0.6; filter: grayscale(0.6); }
.acard img { width: 32px; height: 32px; image-rendering: pixelated; }
.acard .desc { font-size: 12px; color: #cbd5e1; }
.acard.page { grid-template-columns: 28px 1fr auto; padding: 4px 6px; }
.acard.page img { width: 26px; height: 26px; }
.acard.page.empty { opacity: 1; filter: none; }
.acard.page.empty img, .acard.page.empty b, .acard.page.empty .stars { opacity: 0.6; filter: grayscale(0.6); }
.pagehead { margin: 10px 0 4px; font-size: 13px; color: #e2e8f0; }
.stars { color: #fbbf24; letter-spacing: 1px; }

/* unspent stat / skill points: red dot on the menu button */
#menu button { position: relative; }
#tmenu button, .mtile { position: relative; }
#tmenu button.dot::after, .mtile.dot::after { content: ''; position: absolute; top: 3px; right: 3px; width: 10px; height: 10px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px #1b1530; animation: ptsdot 1.2s ease-in-out infinite; }
#menu button.dot::after { content: ''; position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px #1b1530; animation: ptsdot 1.2s ease-in-out infinite; }
@keyframes ptsdot { 50% { transform: scale(1.35); } }
#p_char .autostat { margin-left: 8px; padding: 2px 8px; font-size: 12px; background: #b45309; color: #fff; border-color: #f59e0b; }

/* Job Master: stat / skill reset */
#p_job .resetbox { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--edge); }
#p_job .resetbox .row { display: flex; gap: 6px; margin-top: 4px; }
#p_job .resetbox button { flex: 1; }
#p_job .resetbox button.warn { background: #b91c1c; color: #fff; border-color: #f87171; }

/* party finder board (social window) */
.lfgrow { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid var(--edge); }
.lfgrow small { line-height: 1.3; }
.lfgrow button { flex: none; }
.lfgme { flex: 1; color: var(--accent); font-size: 12px; }

/* item window: "if you wear this" comparison */
.detail .cmp { margin: 4px 0; font-size: 12px; line-height: 1.5; }
.detail .cmp .up { color: #4ade80; }
.detail .cmp .down { color: #f87171; }

/* quick emotes next to the chat input */
#emoteBtn { flex: none; padding: 0 6px; font-size: 15px; }
#emotes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; margin-top: 4px; }
#emotes button { font-size: 18px; padding: 2px 0; }
.shoprow .upg { color: #4ade80; font-weight: 700; }

/* Crypt Warden window + dungeon timer */
#p_dungeon .dgnrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--edge); }
#p_dungeon .dgnrow.off { opacity: 0.6; }
#p_dungeon .ok { color: #4ade80; } #p_dungeon .warn { color: #f87171; }
#dgntimer { position: fixed; left: 50%; top: 58px; transform: translateX(-50%); color: #e9d5ff; font-weight: 700; font-size: 16px; text-shadow: 2px 2px 0 #000; pointer-events: none; z-index: 5; }
#dgntimer.low { color: #f87171; animation: pulse2 0.8s infinite alternate; }
#p_dungeon .dgnrec { margin: 4px 0 8px; font-size: 12px; }
#p_dungeon .dgnrec > div { padding-left: 8px; }

/* Settings → Keys */
#p_settings .keygrid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
#p_settings .keyrow { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
#p_settings .keyrow button { min-width: 54px; }
#p_settings .keyrow button.on { background: #b45309; color: #fff; }

/* narrow portrait screens: the stats panel and minimap fill the top, so toasts go below them
   (they covered the C I U P G menu buttons) */
@media (max-width: 900px) and (orientation: portrait) {
  /* the target's name + HP bar sat on top of the stats panel: put it under the panel,
     and the toasts under the target bar */
  #targetbar { top: max(24vh, 172px); width: min(260px, 62vw); }
  #toasts { top: calc(max(24vh, 172px) + 40px); }
}
#p_shop .sellall { display: flex; gap: 6px; margin-top: 8px; }
#p_shop .sellall button { flex: 1; font-size: 12px; }
#p_shop .sellall button.warn { background: #b91c1c; color: #fff; }

/* story journal */
#p_journal .jprog { margin-bottom: 6px; }
#p_journal .jch > button { width: 100%; text-align: left; margin: 2px 0; }
#p_journal .jch.done > button { color: #4ade80; }
#p_journal .jq button { width: 100%; text-align: left; background: transparent; border: none; padding: 2px 10px; font-size: 12px; }
#p_journal .jq.done button { color: var(--muted, #9ca3af); }
#p_journal .jq.active button { color: var(--accent); font-weight: 700; }
#p_journal .jq.locked button { opacity: 0.5; }
#p_journal .jtext { margin: 2px 10px 8px 22px; padding: 6px 8px; border-left: 2px solid var(--edge); font-size: 12px; }
#p_journal .jtext p { margin: 2px 0; }

/* guild ranks + notice board */
#p_guild .memrow { grid-template-columns: 1fr auto; }
#p_guild .membtns { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
#p_guild .membtns button { padding: 2px 6px; font-size: 0.85em; }
.grank.m { color: #fbbf24; }
.grank.o { color: #60a5fa; }
.gnotice { margin: 6px 0 8px; padding: 6px 8px; border: 1px solid var(--edge); border-radius: 6px; background: rgba(251, 191, 36, 0.07); }
.gnotice p { margin: 4px 0 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.gnotice .invrow { margin-top: 6px; }
/* guild emblem */
img.emblem { image-rendering: pixelated; vertical-align: middle; margin-right: 4px; }
.gtag img.emblem { margin-right: 2px; }
.embpick { margin: 4px 0 8px; }
.embpick summary { cursor: pointer; color: var(--muted, #9ca3af); }
.embrow { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.embrow button { padding: 2px; line-height: 0; border: 2px solid transparent; }
.embrow button.sel { border-color: #fcd34d; }
.embrow img.emblem { margin: 0; }
/* bag item that beats what is worn */
.slot .upgmark { position: absolute; left: 2px; top: 1px; font-style: normal; font-size: 14px; font-weight: 900; color: #4ade80; text-shadow: 0 0 2px #000, 0 0 2px #000; pointer-events: none; }
/* Settings → change password */
.passbox { display: grid; gap: 6px; margin: 4px 0 10px; }
.passbox input { width: 100%; box-sizing: border-box; padding: 5px 6px; font: inherit; font-size: 13px; color: var(--text); background: #0c0b12; border: 1px solid var(--edge); -webkit-user-select: text; user-select: text; }
/* What's new */
.newslist { margin: 6px 0 10px; padding-left: 18px; line-height: 1.45; }
.newslist li { margin: 4px 0; }
/* AUTO's current goal, just above its button */
#autoGoal { position: absolute; right: 0; bottom: calc(100% + 6px); max-width: 240px; padding: 3px 8px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fde68a; background: rgba(12, 11, 18, 0.82); border: 1px solid var(--edge); border-radius: 6px; pointer-events: none; }
#quick { position: fixed; }
/* touch: #quick covers the whole fan box, so the potion / target / BM buttons keep their offsets from
   the fan as designed (a plain position:relative made it a 0-height box at the fan's top: the
   buttons floated up the screen, target and BM off its top on landscape phones) and #autoGoal
   still has an anchor */
body.touch #quick { position: absolute; inset: 0; pointer-events: none; }
body.touch #quick > * { pointer-events: auto; }

/* ===== phones (body.touch): world-class mobile layout =====
   four big buttons in the status card (character / skills / bag / ☰ menu), a full menu sheet,
   near-full-screen windows with thumb-sized buttons, a "points to spend" chip */
#tmenu, #mmenu { display: none; }
body.touch #menu { display: none; }
body.touch #tmenu { display: flex; gap: 5px; margin-top: 6px; }
body.touch #tmenu button { flex: 1; height: 44px; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 10px; border-radius: 10px; }
body.touch #tmenu button i { font-style: normal; font-size: 18px; line-height: 1; }
@media (max-height: 520px) {
  body.touch #tmenu button { height: 38px; } body.touch #tmenu button i { font-size: 16px; }
  body.touch #gold { display: none; } /* (the bag and the shop show it) */
  body.touch #ptsChip { min-height: 28px; padding: 3px 6px; font-size: 12px; }
  body.touch #qtrack { max-height: 74px; }
}
#ptsChip { display: block; width: 100%; margin-top: 5px; padding: 5px 6px; font-size: 12px; font-weight: 700; color: #1a1205; background: linear-gradient(#fde68a, #f59e0b); border: 1px solid #fbbf24; border-radius: 8px; animation: ptschip 1.4s ease-in-out infinite alternate; }
#ptsChip[hidden] { display: none; }
@keyframes ptschip { from { box-shadow: 0 0 0 rgba(251, 191, 36, 0); } to { box-shadow: 0 0 12px rgba(251, 191, 36, 0.9); } }
body.touch #ptsChip { min-height: 34px; font-size: 13px; }
@media (max-width: 600px) and (min-height: 521px) and (orientation: portrait) { /* (pt1, item 4) an upright phone: smaller */
  body.touch #ptsChip { min-height: 26px; margin-top: 3px; padding: 2px 6px; font-size: 11px; }
  body.touch #tmenu { gap: 4px; margin-top: 4px; }
  body.touch #tmenu button { height: 36px; font-size: 9px; } body.touch #tmenu button i { font-size: 15px; }
}
body.touch #mmenu:not([hidden]) {
  display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 40; padding: max(12px, env(safe-area-inset-top)) 14px 14px;
  background: rgba(10, 8, 20, 0.94); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
#mmenu header { display: flex; justify-content: space-between; align-items: center; font-size: 18px; font-weight: 700; color: var(--accent); margin-bottom: 10px; }
#mmenu header button { width: 48px; height: 44px; font-size: 22px; padding: 0; }
#mmenu .mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; overflow-y: auto; }
/* (mn1) a tile grows when its label needs two lines (min-height, not height) */
.mtile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 100px; padding: 4px; font-size: 13px; line-height: 1.15; border-radius: 14px; background: var(--panel); border: 2px solid var(--edge-hi); -webkit-touch-callout: none; }
.mtile i { font-style: normal; font-size: 34px; line-height: 1; height: 64px; display: flex; align-items: center; justify-content: center; }
/* a painted icon: 32 art pixels at two screen pixels each; the picture takes no press of its own (no image menu, no drag) */
.mtile i img { display: block; width: 64px; height: 64px; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.6)); pointer-events: none; -webkit-user-drag: none; user-select: none; }
.mtile span { max-width: 100%; text-align: center; }
.mtile.wide { grid-column: 1 / -1; flex-direction: row; gap: 12px; min-height: 64px; } .mtile.wide i { height: 48px; } .mtile.wide i img { width: 48px; height: 48px; }
/* a short screen (a small phone, a low window): the tile as tall as it always was, so the sheet needs no more room than before */
@media (max-height: 700px) { .mtile { min-height: 84px; } .mtile i { font-size: 30px; height: 48px; } .mtile i img { width: 48px; height: 48px; } .mtile.wide { min-height: 56px; } .mtile.wide i { height: 40px; } .mtile.wide i img { width: 40px; height: 40px; image-rendering: auto; } }
@media (max-height: 520px) { .mtile { min-height: 70px; font-size: 12px; } .mtile i { font-size: 24px; height: 32px; } .mtile i img { width: 32px; height: 32px; } .mtile.wide { min-height: 48px; } .mtile.wide i { height: 32px; } .mtile.wide i img { width: 32px; height: 32px; image-rendering: pixelated; } #mmenu .mgrid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); } }
/* windows: almost the whole screen, big close button, thumb-sized controls */
body.touch #panels { top: max(8px, env(safe-area-inset-top)); left: 8px; right: 8px; max-height: calc(var(--app-h) - 16px); }
body.touch #panels .win { font-size: 14px; padding: 0 12px 12px; background: #15111f; } /* opaque: the HUD must not show through the text */
body.touch .win header { padding: 6px 0; font-size: 16px; }
body.touch .win .x { width: 48px; height: 42px; font-size: 24px; }
body.touch .win button { min-height: 36px; padding: 6px 12px; font-size: 13px; }
/* (afp1 G3b) touch targets: the player popup / invite answers and the item card's close at least 40 px; the route chip's close,
   the chat tabs and the party warp a little larger */
body.touch #ppop .btns button, body.touch #invite .btns button { min-height: 40px; padding: 6px 12px; }
body.touch .ic-top .ipx { width: 40px; height: 40px; }
body.touch #navchip .navx { width: 34px; height: 34px; }
body.touch #chattabs button { min-height: 32px; padding: 4px 10px; font-size: 12px; }
body.touch #partyframe .pwbtn { line-height: 26px; padding: 0 10px; }
body.touch .win .plus { min-width: 44px; min-height: 40px; font-size: 20px; font-weight: 700; }
body.touch .win table.stats td, body.touch .win table.stats th { padding: 4px 3px; }
body.touch .win .hbset button { min-width: 36px; min-height: 34px; font-size: 13px; }
body.touch .win .autostat { min-height: 40px; }
body.touch .win .seg button { min-height: 38px; }

/* ===== the bag =====
   left: the character with its four equipment slots; right: category tabs, compact slots, gold / sort.
   A tap on an item opens the item card (#itempop) beside it, with the buttons on the card. */
#panels #p_inv { flex: 0 1 560px; } /* (beats the 330 px of every other window) */
/* (where windows stack in a column, a basis would set the height: none there) */
@media (pointer: coarse), (max-width: 900px) { #panels #p_inv { flex: none; } }
body.touch #panels #p_inv { flex: none; }
.invwrap { display: flex; gap: 10px; align-items: flex-start; }
.invside { flex: none; width: 176px; padding: 8px 6px; border: 1px solid #5b4a24; border-radius: 8px;
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 207, 74, 0.14), rgba(0, 0, 0, 0) 60%), linear-gradient(#1d1830, #100d18); }
.doll { display: flex; align-items: center; justify-content: space-between; gap: 2px; }
.dcol { display: flex; flex-direction: column; gap: 8px; }
.dollpic { width: 80px; height: 100px; image-rendering: pixelated; }
.dslot { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.dslot small { font-size: 9px; color: var(--muted); white-space: nowrap; }
.invside .slot.eq { width: 44px; height: 44px; border: 1px solid #a8872f; box-shadow: inset 0 0 8px rgba(255, 207, 74, 0.18); }
.slot .ghost { font-size: 18px; opacity: 0.22; filter: grayscale(1); }
.dollst { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 6px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.dollst b { color: #fde68a; font-weight: 700; }
.invmain { flex: 1; min-width: 0; }
.invtabs { display: flex; gap: 3px; margin-bottom: 6px; }
.invtabs button { flex: 1; padding: 4px 2px; font-size: 11px; border-radius: 6px 6px 0 0; background: #1a1626; color: var(--muted); white-space: nowrap; }
.invtabs button.on { background: linear-gradient(#fde68a, #d97706); color: #1a1205; font-weight: 700; border-color: #fbbf24; }
.invtabs small { font-size: 9px; opacity: 0.8; }
.invgrid { grid-template-columns: repeat(8, 1fr); gap: 4px; }
#p_inv .slot { border-radius: 5px; background: linear-gradient(#1c1828, #0b0a11); border-color: #3a3150; }
#p_inv .slot:not(.empty):hover { border-color: var(--edge-hi); }
#p_inv .slot.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 10px rgba(255, 207, 74, 0.5); }
.slot.q-boss { border-color: #b45309 !important; box-shadow: inset 0 0 10px rgba(251, 191, 36, 0.35); }
.slot.q-card { border-color: #7c3aed !important; }
.slot.q-ref { border-color: #0369a1 !important; }
.invbar { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.invbar .gold { flex: 1; color: var(--accent); font-weight: 700; }
.invhint { margin: 4px 0 0; font-size: 11px; }
.invnone { padding: 18px 0; text-align: center; grid-column: 1 / -1; }

/* the item card */
#itempop { position: fixed; inset: 0; z-index: 46; pointer-events: none; }
#itempop[hidden] { display: none; }
.ipcard { position: absolute; pointer-events: auto; width: 300px; max-height: calc(var(--app-h) - 12px); overflow-y: auto; padding: 10px;
  font-size: 13px; color: var(--text); border: 2px solid #a8872f; border-radius: 10px;
  background: linear-gradient(#251d38, #120f1b); box-shadow: 0 0 0 2px #000, 0 12px 30px rgba(0, 0, 0, 0.7); animation: ipin 0.12s ease-out; }
@keyframes ipin { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
.iphead { display: flex; align-items: center; gap: 9px; padding-bottom: 8px; border-bottom: 1px solid #3a3150; }
.ipic { flex: none; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; border: 1px solid #a8872f; border-radius: 8px; background: radial-gradient(#2c2440, #0b0a11); }
.ipic img { width: 40px; height: 40px; image-rendering: pixelated; }
.ipname { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ipname b { font-size: 15px; color: #fff; }
.ipname small { font-size: 11px; color: var(--muted); }
.q-boss .ipname b { color: #fbbf24; } .q-card .ipname b { color: #c4b5fd; } .q-ref .ipname b { color: #7dd3fc; } .q-mat .ipname b { color: #cbd5e1; }
.ipx { flex: none; width: 34px; height: 34px; padding: 0; font-size: 20px; line-height: 1; }
.ipbody { padding: 8px 0 2px; }
.ipbody .lines { color: #a7f3d0; line-height: 1.55; }
.ipwarn { margin-top: 6px; color: #f87171; font-weight: 700; }
.ipbody .cmp { margin-top: 6px; padding: 6px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.3); line-height: 1.5; font-size: 12px; }
.ipbody .cmp .up { color: #4ade80; } .ipbody .cmp .down { color: #f87171; }
.ipsrc { margin-top: 6px; font-size: 11px; color: var(--muted); font-style: italic; }
.ipbtns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ipbtns button { flex: 1 1 auto; min-height: 34px; font-size: 12px; }
.ipbtns button.primary { flex: 1 1 100%; min-height: 42px; font-size: 15px; font-weight: 700; color: #1a1205; border-color: #fbbf24;
  background: linear-gradient(#fde68a, #d97706); }
.ipbtns button.primary:disabled { filter: grayscale(1); }
.ipcard .pick { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }

/* phones: thumb-sized slots, big tabs; the card dims the screen a little */
body.touch #itempop:not([hidden]) { background: rgba(0, 0, 0, 0.28); }
body.touch .ipcard { width: min(330px, calc(100vw - 16px)); font-size: 14px; }
body.touch .ipbtns button { min-height: 40px; font-size: 14px; }
body.touch .ipbtns button.primary { min-height: 48px; font-size: 16px; }
body.touch .invtabs button { min-height: 36px; font-size: 13px; }
body.touch .invgrid { grid-template-columns: repeat(auto-fill, 54px); gap: 5px; justify-content: start; }
body.touch #p_inv .slot { width: 54px; height: 54px; }
body.touch .invside .slot.eq { width: 52px; height: 52px; }
body.touch .invbar button { min-height: 38px; padding: 6px 14px; font-size: 13px; }
/* any other item grid on a phone (bank, trade, mail): compact slots, not ten-centimetre tiles */
body.touch .win .grid:not(.invgrid) { grid-template-columns: repeat(auto-fill, minmax(48px, 56px)); gap: 5px; justify-content: start; }
@media (max-aspect-ratio: 1/1) {
  /* portrait: the character on top, the bag under it */
  body.touch .invwrap { flex-direction: column; align-items: stretch; }
  body.touch .invside { width: auto; display: flex; align-items: center; gap: 10px; }
  body.touch .invside .doll { flex: 1; }
  body.touch .dollst { grid-template-columns: 1fr; margin-top: 0; }
}
/* phones: the whole bag fits the screen; only the slots scroll (tabs, gold and Sort stay in view) */
body.touch .invside { width: 214px; }
body.touch .dollpic { width: 72px; height: 90px; }
body.touch .invgrid { max-height: calc(var(--app-h) - 186px); overflow-y: auto; overscroll-behavior: contain; align-content: start; }
@media (max-height: 520px) { body.touch .invhint { display: none; } body.touch .invgrid { max-height: calc(var(--app-h) - 178px); } }
@media (max-aspect-ratio: 1/1) { body.touch .invgrid { max-height: calc(var(--app-h) - 374px); } body.touch .invside { width: auto; } }

/* ===== paper doll with 10 slots, Combat Power, refine in the item card ===== */
#panels #p_inv { flex-basis: 640px; }
.invside { width: 228px; }
.doll { align-items: stretch; }
.dcol { gap: 4px; }
.dmid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-between; min-width: 0; }
.dmid .dollpic { width: 88px; height: 110px; }
.cpbox { display: flex; flex-direction: column; align-items: center; line-height: 1.1; padding: 3px 6px; border-radius: 6px;
  background: linear-gradient(rgba(120, 53, 15, 0.55), rgba(0, 0, 0, 0.3)); border: 1px solid #a8872f; }
.cpbox small { font-size: 9px; color: #fcd34d; }
.cpbox b { font-size: 16px; color: #fff7c2; text-shadow: 0 0 6px rgba(251, 191, 36, 0.8), 1px 1px 0 #000; }
.dmid .dollst { grid-template-columns: 1fr 1fr; font-size: 10px; margin-top: 4px; }
.invside .slot.eq { width: 40px; height: 40px; }
.dslot small { font-size: 8px; }
.slot em.ref { color: #7dd3fc; font-weight: 700; }
#p_inv .slot.ref7, #p_inv .slot.ref10 { animation: refglow 1.6s ease-in-out infinite alternate; }
@keyframes refglow { from { box-shadow: inset 0 0 6px rgba(125, 211, 252, 0.3); } to { box-shadow: inset 0 0 12px rgba(125, 211, 252, 0.8), 0 0 6px rgba(125, 211, 252, 0.6); } }
#p_inv .slot.ref10 { border-color: #f0abfc !important; }
/* Combat Power rising: a gold banner in the middle of the screen */
#cpup { position: fixed; left: 50%; top: 28%; z-index: 60; transform: translateX(-50%); pointer-events: none; white-space: nowrap; padding: 6px 18px;
  border-radius: 999px; background: linear-gradient(90deg, rgba(0, 0, 0, 0), rgba(60, 30, 0, 0.85) 20%, rgba(60, 30, 0, 0.85) 80%, rgba(0, 0, 0, 0)); }
#cpup[hidden] { display: none; }
#cpup small { color: #fcd34d; font-size: 13px; }
#cpup b { font-size: 26px; color: #fff7c2; text-shadow: 0 0 10px rgba(251, 191, 36, 0.9), 2px 2px 0 #000; }
#cpup em { font-style: normal; font-size: 18px; color: #4ade80; text-shadow: 1px 1px 0 #000; }
#cpup.go { animation: cpup 2.2s ease-out forwards; }
@keyframes cpup { 0% { opacity: 0; transform: translate(-50%, 16px) scale(0.8); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1.08); } 20% { transform: translate(-50%, 0) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -24px); } }
/* refine view in the item card */
.ipic { position: relative; }
.ipic em.ref { position: absolute; left: 2px; bottom: 0; font-style: normal; font-size: 11px; font-weight: 700; color: #7dd3fc; text-shadow: 1px 1px 0 #000; }
.rfbox { padding-top: 8px; }
.rfstep { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 22px; font-weight: 900; }
.rfstep span { color: #94a3b8; } .rfstep i { font-style: normal; color: #fcd34d; } .rfstep b { color: #7dd3fc; text-shadow: 0 0 8px rgba(125, 211, 252, 0.8); }
.rfnext { text-align: center; font-size: 12px; color: #a7f3d0; margin: 2px 0 6px; }
.rfrate { text-align: center; margin-bottom: 6px; }
.rfrate b { font-size: 18px; } .rfrate b.ok { color: #4ade80; } .rfrate b.mid { color: #fcd34d; } .rfrate b.bad { color: #f87171; }
.rfbar { position: relative; height: 18px; margin: 6px 0; border-radius: 9px; background: #0b0a11; border: 1px solid #5b4a24; overflow: hidden; }
.rfbar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #b45309, #fbbf24); }
.rfbar.full i { background: linear-gradient(90deg, #16a34a, #4ade80); animation: refglow 1s infinite alternate; }
.rfbar span { position: relative; display: block; text-align: center; font-size: 11px; line-height: 16px; color: #fff; text-shadow: 1px 1px 0 #000; }
.rfcost { font-size: 12px; margin: 4px 0; }
.rfcost img { width: 14px; height: 14px; vertical-align: -3px; image-rendering: pixelated; }
.rfcost .bad, .rfbox .bad { color: #f87171; }
/* phones */
body.touch .invside { width: 236px; }
body.touch #p_inv .invside .slot.eq { width: 44px; height: 44px; } /* (the doll, not the 54 px bag slots) */
@media (max-height: 520px) {
  body.touch .dslot small { display: none; } /* the ghost icon says which slot it is */
  body.touch #p_inv .invside .slot.eq { width: 41px; height: 41px; }
  body.touch .dcol { gap: 4px; }
  body.touch .dmid .dollpic { width: 76px; height: 95px; }
}
/* rarity: slot borders, card name, bonus lines, loot feed */
.slot.q-r1 { border-color: #3b82f6 !important; box-shadow: inset 0 0 8px rgba(96, 165, 250, 0.35); }
.slot.q-r2 { border-color: #a855f7 !important; box-shadow: inset 0 0 9px rgba(192, 132, 252, 0.4); }
.slot.q-r3 { border-color: #f97316 !important; box-shadow: inset 0 0 10px rgba(251, 146, 60, 0.5); }
.slot.q-r4 { border-color: #fbbf24 !important; box-shadow: inset 0 0 12px rgba(251, 191, 36, 0.6); }
/* (summary-1) the owner's summary of the Google sign-ins */
.gstgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 8px 0; } .gstbox { background: rgba(255,255,255,0.05); border: 1px solid #334155; border-radius: 8px; padding: 8px; text-align: center; } .gstbox b { display: block; font-size: 22px; color: #fde68a; } .gstbox small { color: #94a3b8; }
.gsttab { width: 100%; border-collapse: collapse; font-size: 12px; } .gsttab th, .gsttab td { padding: 4px 6px; border-bottom: 1px solid #1e293b; text-align: left; white-space: nowrap; }
/* (next n42) "X is better than what you wear - wear it?" above the keys */
.upgask { position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 8px; max-width: min(92vw, 460px); padding: 8px 10px; background: rgba(15, 23, 42, 0.94); border: 1px solid #4ade80; border-radius: 10px; color: #e5e7eb; font-size: 13px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5); }
.upgask img { width: 32px; height: 32px; image-rendering: pixelated; flex: none; } .upgask span { flex: 1; min-width: 0; }
.upgask button { flex: none; padding: 6px 10px; border-radius: 8px; border: 1px solid #475569; background: #1e293b; color: #e5e7eb; } .upgask button[data-a="wear"] { background: #166534; border-color: #4ade80; }
/* (next n41) a rarity's grade as stars in every item cell (storage, guild storage, sell, market, trade, mail, the bag) */
.slot.q-r1::after, .slot.q-r2::after, .slot.q-r3::after, .slot.q-r4::after { position: absolute; right: 2px; top: 0; font-size: 9px; line-height: 1; letter-spacing: -1px; pointer-events: none; text-shadow: 0 0 2px #000, 0 0 2px #000; z-index: 2; }
.slot.q-r1::after { content: '★'; color: #60a5fa; } .slot.q-r2::after { content: '★★'; color: #c084fc; } .slot.q-r3::after { content: '★★★'; color: #fb923c; } .slot.q-r4::after { content: '★★★★'; color: #fbbf24; }
.q-r1 .ipname b { color: #60a5fa; } .q-r2 .ipname b { color: #c084fc; } .q-r3 .ipname b { color: #fb923c; } .q-r4 .ipname b { color: #fbbf24; }
.ipcard.q-r1 { border-color: #3b82f6; } .ipcard.q-r2 { border-color: #a855f7; } .ipcard.q-r3 { border-color: #f97316; box-shadow: 0 0 0 2px #000, 0 0 18px rgba(251, 146, 60, 0.45); }
.iprar { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.ipopts { margin-top: 5px; padding: 4px 8px; border-left: 2px solid var(--rc); background: rgba(0, 0, 0, 0.25); color: var(--rc); font-size: 12px; line-height: 1.5; }
#lootfeed .q-r1 { color: #60a5fa; } #lootfeed .q-r2 { color: #c084fc; } #lootfeed .q-r3 { color: #fb923c; font-weight: 700; }
.dwing { margin-top: -6px; }
.dwing .dslot small { display: none; }
/* short landscape phones: the 11-slot doll must fit next to the bag (5 slots a column) */
@media (max-height: 520px) {
  body.touch .invside { padding: 5px 4px; }
  body.touch #p_inv .invside .slot.eq { width: 41px; height: 41px; }
  body.touch .dcol { gap: 3px; }
  body.touch .dmid .dollpic { width: 64px; height: 80px; }
  body.touch .cpbox b { font-size: 14px; }
  body.touch .dmid .dollst { display: none; } /* (in the character window) */
}
/* portrait phones: the doll centred across the window, the bag under it fills the rest */
@media (max-aspect-ratio: 1/1) {
  body.touch #p_inv .invside { width: auto; display: block; }
  body.touch #p_inv .doll { justify-content: center; gap: 18px; }
  body.touch #p_inv .dmid { flex: 0 0 120px; }
  body.touch .invgrid { max-height: calc(var(--app-h) - 530px); min-height: 120px; }
}
/* target frame: how the monster behaves */
#tgname small { color: #cbd5e1; font-size: 11px; }
#tgname em.temper { font-style: normal; font-size: 10px; padding: 0 5px; border-radius: 6px; margin-left: 3px; vertical-align: 1px; }
#tgname em.temper.aggressive { background: rgba(239, 68, 68, 0.3); color: #fca5a5; }
#tgname em.temper.passive { background: rgba(74, 222, 128, 0.25); color: #86efac; }
#tgname em.temper.ambush { background: rgba(192, 132, 252, 0.3); color: #d8b4fe; }
/* side by side with the shop / smith / bank on a PC, the bag gives way: those keep 300 px and a
   narrow bag stacks the character above its grid (container query on the window's own width) */
#panels #p_shop, #panels #p_smith, #panels #p_bank, #panels #p_trade { min-width: 300px; }
#p_inv { container-type: inline-size; }
@container (max-width: 540px) {
  .invwrap { flex-direction: column; align-items: stretch; }
  .invside { width: auto !important; }
  .doll { justify-content: center; gap: 16px; }
  .invgrid { grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); }
}

/* ===== phones / tablets: windows inside the visible screen, clear of the notch and home bar ===== */
body.touch #panels {
  top: max(8px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right));
  max-height: calc(var(--app-h) - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
body.touch #panels, body.touch #panels .win, body.touch .ipcard, body.touch #mmenu .mgrid, body.touch #dgnres { touch-action: pan-y; } /* (the page itself is touch-action: none) */
body.touch .ipcard { max-height: calc(var(--app-h) - 12px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
/* full-screen button under the zoom buttons */
#fsBtn { width: 30px; height: 22px; padding: 0; font-size: 15px; line-height: 1; }
body.touch #fsBtn { width: 34px; height: 30px; font-size: 17px; }
#fsBtn.on { color: var(--accent); border-color: var(--accent); }

/* ===== Dungeons (docs/DUNGEONS.md): finder window, Medal Shop, result card, HUD objective ===== */
#panels #p_dungeon { flex-basis: 460px; }
#p_dungeon img.medal, #dgnres img.medal { width: 16px; height: 16px; vertical-align: -3px; image-rendering: pixelated; }
.dgtabs { align-items: center; margin-bottom: 6px; }
.dgmedals { margin-left: auto; font-size: 13px; color: #fde68a; white-space: nowrap; }
.dgmodes { margin: 4px 0 2px; }
.dgmodes button { flex: 1; font-weight: 700; }
.dgmodes button.m1.on { color: #fb923c; border-color: #fb923c; }
.dgmodes button.m2.on { color: #f87171; border-color: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.45); }
.dginfo { font-size: 11px; margin: 4px 0 6px; }
.dglist { display: flex; flex-direction: column; gap: 6px; }
.dgcard { padding: 7px 9px; border: 1px solid #3a3150; border-radius: 8px; background: linear-gradient(#1d1830, #110e19); }
.dgcard.seals { border-color: #5b3b8a; background: linear-gradient(rgba(88, 28, 135, 0.28), #110e19); }
.dgcard.m1 { box-shadow: inset 0 0 0 1px rgba(251, 146, 60, 0.25); }
.dgcard.m2 { box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.35), inset 0 0 18px rgba(127, 29, 29, 0.35); }
.dgcard.lock, .dgcard.low { opacity: 0.62; }
.dgcard.done { opacity: 0.8; }
.dghead { display: flex; align-items: baseline; gap: 6px; }
.dghead b { font-size: 14px; color: #fff; }
.dghead small { margin-left: auto; }
.dgkind { font-size: 10px; padding: 0 6px; border-radius: 6px; background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
.seals .dgkind { background: rgba(192, 132, 252, 0.25); color: #e9d5ff; }
.dgdesc { display: block; font-size: 11px; margin: 2px 0; line-height: 1.35; }
.dgline { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; font-size: 11px; color: #cbd5e1; }
.dgrw { display: flex; flex-wrap: wrap; gap: 3px 8px; margin: 4px 0; font-size: 11px; color: #fde68a; }
.dgit, .dgset { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.dgit img, .dgset img { width: 16px; height: 16px; image-rendering: pixelated; }
.dgset { color: #c4b5fd; }
.dgfoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dgfoot small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dgfoot button { flex: none; }
.dgfirst { color: #fbbf24; font-weight: 700; }
.dgsethead { margin: 10px 0 2px; color: #c4b5fd; }
.dgsetb { font-size: 11px; line-height: 1.4; margin-bottom: 4px; }
#p_dungeon .mrow b img.medal { margin-right: 2px; }
/* HUD: time left on top, the objective (seal / guardian, deaths) under it */
#dgntimer { text-align: center; }
#dgntimer small { display: block; font-size: 12px; font-weight: 600; color: #f0abfc; }
/* the result card */
#dgnres { position: fixed; inset: 0; z-index: 55; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.45); padding: 12px; }
#dgnres[hidden] { display: none; }
.dgrbox { width: min(340px, 100%); max-height: calc(var(--app-h) - 24px); overflow-y: auto; padding: 14px 16px; text-align: center; border-radius: 12px;
  border: 2px solid #a8872f; background: linear-gradient(#2a2040, #120f1b); box-shadow: 0 0 0 2px #000, 0 0 40px rgba(251, 191, 36, 0.25); animation: ipin 0.2s ease-out; }
.dgrbox.m2 { border-color: #ef4444; box-shadow: 0 0 0 2px #000, 0 0 40px rgba(239, 68, 68, 0.35); }
.dgrbox h3 { margin: 0 0 2px; color: #fde68a; font-size: 20px; }
.dgrname { font-size: 13px; color: #cbd5e1; }
.dgrname b.m1 { color: #fb923c; } .dgrname b.m2 { color: #f87171; }
.dgrgrade { font-size: 64px; font-weight: 900; line-height: 1.1; margin: 4px 0; text-shadow: 3px 3px 0 #000; animation: gradein 0.5s cubic-bezier(.2, 1.6, .4, 1); }
.dgrgrade.gS { color: #fbbf24; text-shadow: 0 0 18px rgba(251, 191, 36, 0.9), 3px 3px 0 #000; }
.dgrgrade.gA { color: #c084fc; } .dgrgrade.gB { color: #60a5fa; } .dgrgrade.gC { color: #94a3b8; }
@keyframes gradein { from { transform: scale(2.4); opacity: 0; } to { transform: none; opacity: 1; } }
.dgrstats { display: flex; justify-content: center; gap: 16px; font-size: 13px; color: #cbd5e1; }
.dgrstats b { color: #fff; }
.dgrflag { margin-top: 4px; font-weight: 700; color: #fbbf24; }
.dgrbox h4 { margin: 10px 0 4px; }
.dgrlist { display: flex; flex-direction: column; gap: 3px; text-align: left; }
.dgri { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 2px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.25); }
.dgri img { width: 20px; height: 20px; image-rendering: pixelated; }
.dgri span { flex: 1; min-width: 0; }
.dgrbox > button { margin-top: 12px; min-width: 120px; min-height: 38px; font-weight: 700; }

/* ===== AUTO settings window (bot settings) ===== */
#panels #p_auto { flex-basis: 440px; }
#quick #qAutoCfg { width: 22px; font-size: 13px; padding: 0; color: #fde68a; }
body.touch #quick #qAutoCfg { width: 28px; height: 28px; margin: -12px 0 0 38px; border-radius: 50%; font-size: 15px; z-index: 2; }
.astatus { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.astatus button { min-width: 120px; font-weight: 700; }
.astatus button.on { color: #0b1020; background: linear-gradient(#ffe27a, #f59e0b); border-color: #fbbf24; }
.atabs button { flex: 1; white-space: nowrap; }
.abody { padding: 6px 0 2px; }
.aopt { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; border-bottom: 1px solid rgba(110, 99, 160, 0.18); cursor: pointer; }
.aopt input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: #f59e0b; }
.aopt span { display: flex; flex-direction: column; gap: 1px; }
.aopt small { font-size: 11px; color: var(--muted); }
.aslide { padding: 5px 0; border-bottom: 1px solid rgba(110, 99, 160, 0.18); }
.aslide span { display: block; font-size: 13px; margin-bottom: 3px; }
.aslide b { color: #fde68a; }
.aslide input[type=range] { width: 100%; accent-color: #f59e0b; touch-action: none; height: 24px; }
.acentre { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; font-size: 12px; color: #a7f3d0; border-bottom: 1px solid rgba(110, 99, 160, 0.18); }
.acentre b { color: #4ade80; }
.akinds { display: flex; flex-wrap: wrap; gap: 4px; }
.akinds button { font-size: 12px; padding: 3px 8px; }
.akinds button.on { border-color: #4ade80; color: #bbf7d0; }
.akinds button.off { opacity: 0.6; text-decoration: line-through; }
.akinds small { color: var(--muted); font-size: 10px; }
.askrow { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; margin: 4px 0; }
.askslot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; padding: 3px 2px; border: 1px solid #a8872f; border-radius: 8px; background: radial-gradient(#2c2440, #0b0a11); }
.askslot.empty { color: #fbbf24; font-size: 22px; border-style: dashed; opacity: 0.55; }
.askslot img { width: 30px; height: 30px; image-rendering: pixelated; }
.askslot small { font-size: 9px; line-height: 1.1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #e5e7eb; }
.askadd { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 6px; }
.askadd button { padding: 2px; width: 38px; height: 38px; }
.askadd img { width: 28px; height: 28px; image-rendering: pixelated; }
.asaved { font-size: 11px; text-align: right; }
body.touch .aopt input { width: 24px; height: 24px; }
body.touch .askslot { min-height: 64px; }
/* the Endless Tower's card: two boards side by side, two start buttons */
.dgcard.tower { border-color: #6d28d9; background: linear-gradient(rgba(76, 29, 149, 0.35), #110e19); }
.dgboards { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 4px 0; font-size: 11px; }
.dgboards b { color: #c4b5fd; }
.dgboards > div > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dgfoot2 { justify-content: flex-end; gap: 6px; }
/* Find party: the searching bar, the two buttons on a card, the "party found" notice */
.dgqbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 6px 8px; margin-bottom: 6px; border-radius: 8px; border: 1px solid #0e7490; background: rgba(8, 145, 178, 0.18); color: #a5f3fc; font-size: 12px; }
.dgqbar small { color: var(--muted); }
.dgqbar button { margin-left: auto; }
.dgbtns { display: inline-flex; gap: 5px; flex: none; }
.dgbtns button.on { border-color: #22d3ee; color: #a5f3fc; }
#dgnfound { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); z-index: 56; }
#dgnfound[hidden] { display: none; }
.dgfbox { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 260px; padding: 12px 16px; border-radius: 12px; border: 2px solid #22d3ee; background: linear-gradient(#0f2a3a, #0b1220); box-shadow: 0 0 0 2px #000, 0 0 30px rgba(34, 211, 238, 0.35); animation: ipin 0.2s ease-out; text-align: center; }
.dgfbox b { font-size: 18px; color: #a5f3fc; }
.dgfbox small { color: #fde68a; }
.dgfbox button { margin-top: 4px; min-height: 34px; }
#tgname em.elite { font-style: normal; font-size: 10px; padding: 0 5px; border-radius: 6px; margin-left: 3px; vertical-align: 1px; background: rgba(251, 191, 36, 0.25); color: #fde68a; }
#tgname em.elite.e2 { background: rgba(232, 121, 249, 0.3); color: #f5d0fe; }
/* the bag: how full it is; throw away (item card) */
#p_inv .bagfull { color: #f87171; font-weight: 700; animation: pulse2 0.8s infinite alternate; }
.ipbtns button.dropbtn { flex: 0 1 auto; color: #fca5a5; border-color: #7f1d1d; }
.dropbox { padding-top: 8px; }
.dropbox p { margin: 4px 0; font-size: 12px; }
.dropqty { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 6px 0; }
.dropqty b { min-width: 72px; text-align: center; font-size: 15px; color: #fde68a; }
.dropqty button { min-width: 34px; padding: 4px 6px; }
.ipbtns button.danger { color: #fecaca; border-color: #b91c1c; background: linear-gradient(#3f1010, #1f0808); }
.ipbtns button.warn { animation: pulse2 0.6s infinite alternate; border-color: #fbbf24; color: #fde68a; }
body.touch .dropqty button { min-height: 40px; min-width: 42px; }
/* Dungeons: the gate bar, the entry item, the mission plan; the mission tracker; the result's optional missions */
.dggatebar { margin: 4px 0 6px; padding: 6px 8px; border-radius: 8px; border: 1px solid #a855f7; background: rgba(88, 28, 135, 0.25); color: #e9d5ff; font-size: 12px; }
.dgentry { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 8px; font-size: 11px; margin: 2px 0; }
.dgentry img { width: 16px; height: 16px; vertical-align: -4px; image-rendering: pixelated; margin-right: 2px; }
.dgentry .ok { color: #86efac; } .dgentry .warn { color: #fca5a5; }
.dgplan { font-size: 10px; color: var(--muted); line-height: 1.35; margin: 2px 0 4px; }
#qtrack .qt-o.cur { color: #fde68a; font-weight: 700; }
#qtrack .qt-o.later { color: var(--muted); opacity: 0.75; }
#qtrack .qt-o.fail { color: #f87171; text-decoration: line-through; }
#qtrack .qt-o b { color: #fff; }
#qtrack .qt-h.small { font-size: 11px; margin-top: 6px; opacity: 0.85; }
.dgrbonus { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; margin-top: 6px; font-size: 12px; }
.dgrbonus .ok { color: #fbbf24; }
/* Madame Luna's tarot: cards with a numeral, a glyph and a name; reversed cards turn upside down */
#panels #p_tarot { flex-basis: 420px; }
.trow { display: flex; gap: 12px; align-items: center; }
.ttext { flex: 1; min-width: 0; font-size: 13px; }
.ttext p { margin: 4px 0; }
.tspread { display: flex; gap: 8px; justify-content: center; margin: 6px 0; }
.tcard { position: relative; width: 70px; height: 112px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 5px 3px; border-radius: 8px;
  border: 2px solid #fbbf24; background: linear-gradient(160deg, #3b0764, #1e1b4b 60%, #0f0a1e); box-shadow: 0 0 0 1px #000, 0 0 12px rgba(251, 191, 36, 0.35); text-align: center; animation: tflip 0.5s ease-out; }
.tcard.big { width: 88px; height: 140px; }
.tcard .tnum { font-size: 11px; color: #fde68a; font-weight: 700; }
.tcard .tglyph { font-size: 30px; line-height: 1; color: #fef3c7; text-shadow: 0 0 10px rgba(251, 191, 36, 0.8); }
.tcard.big .tglyph { font-size: 38px; }
.tcard b { font-size: 10px; line-height: 1.15; color: #fff; }
.tcard small { font-size: 9px; color: #c4b5fd; }
.tcard .tori { color: #fca5a5; }
.tcard.rev .tglyph { transform: rotate(180deg); }
.tcard.rev { border-color: #a78bfa; }
.tcard.back { background: repeating-linear-gradient(45deg, #2e1065 0 6px, #3b0764 6px 12px); justify-content: center; }
.tcard.p-love { box-shadow: 0 0 0 1px #000, 0 0 12px rgba(244, 114, 182, 0.5); }
.tcard.p-health { box-shadow: 0 0 0 1px #000, 0 0 12px rgba(74, 222, 128, 0.5); }
.tcard.p-career { box-shadow: 0 0 0 1px #000, 0 0 12px rgba(96, 165, 250, 0.5); }
.tcard.p-wealth { box-shadow: 0 0 0 1px #000, 0 0 12px rgba(251, 191, 36, 0.6); }
.tcard.p-luck { box-shadow: 0 0 0 1px #000, 0 0 12px rgba(52, 211, 153, 0.5); }
@keyframes tflip { from { transform: rotateY(90deg); opacity: 0.3; } to { transform: none; opacity: 1; } }
.tline { font-size: 12px; margin: 2px 0; }
/* the smith's disjoint list */
.djrow .djgets { color: #a7f3d0; font-size: 11px; }
/* (next n157) the Namesake Weapon's tab */
.fgmats { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 4px 0 8px; }
.fgmats span { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.fgmats img, .fgcost img, .fgcard img { width: 20px; height: 20px; image-rendering: pixelated; vertical-align: -5px; }
.fgcard { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; }
.fgcard img { width: 32px; height: 32px; }
.fglines { color: #a7f3d0; }
.fgname, .fgopt { display: flex; flex-direction: column; gap: 2px; flex: 1 1 140px; min-width: 0; margin-top: 6px; }
.fgname input, .fgopt select { width: 100%; box-sizing: border-box; }
.fgopts { display: flex; flex-wrap: wrap; gap: 8px; }
.fgprev { margin: 8px 0; overflow-wrap: anywhere; }
.fgcost { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 6px 0; }
.fgcost .bad { color: var(--bad, #f87171); }
.djrow .djgets img { width: 14px; height: 14px; vertical-align: -3px; image-rendering: pixelated; }
.fgreq { list-style: none; margin: 6px 0; padding: 0; }
.fgreq li { display: flex; gap: 6px; align-items: flex-start; margin: 2px 0; overflow-wrap: anywhere; }
.fgreq li.ok { color: #a7f3d0; }
.fgreq li.bad { color: var(--bad, #f87171); }
.fgreq small { color: var(--muted, #9ca3af); }
.fgtick { flex: 0 0 auto; width: 14px; font-weight: bold; }
.fgfinal { margin: 4px 0; }
.fgbulk { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.fgbulk label { display: inline-flex; align-items: center; gap: 4px; }
.fgconfirm { border: 1px solid var(--accent); border-radius: 4px; padding: 6px 8px; margin: 6px 0; overflow-wrap: anywhere; }
.fgconfirm ul { margin: 4px 0; padding-left: 18px; max-height: 120px; overflow-y: auto; }
/* the quest tracker: tap a quest to walk there */
#qtrack [data-qgo], #qtrack [data-qbounty] { cursor: pointer; }
#qtrack .qt-q.focus { box-shadow: inset 2px 0 0 #fbbf24; }
#qtrack .qt-go { color: #fbbf24; font-weight: 700; }
#qtrack [data-qgo]:hover, #qtrack [data-qbounty]:hover { background: rgba(251, 191, 36, 0.08); }
/* the big map */
#minimap { cursor: zoom-in; }
#bigmap { position: fixed; inset: 0; z-index: 57; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.55); padding: 10px; }
body.touch #bigmap { padding: max(10px, var(--sat)) max(10px, var(--sar)) max(10px, var(--sab)) max(10px, var(--sal)); } /* (afp1 G3d) inside the screen's safe area */
#bigmap[hidden] { display: none; }
.bmbox { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 12px; border: 2px solid var(--edge-hi); background: #15111f; box-shadow: 0 0 0 2px #000, 0 12px 40px rgba(0, 0, 0, 0.7); max-width: 100%; }
.bmbox header { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--accent); }
.bmbox header small { flex: 1; font-weight: 400; color: var(--muted); font-size: 12px; }
.bmbox header button { width: 40px; height: 36px; font-size: 20px; padding: 0; flex: none; }
.bmbox header small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* under the big map: the level zones' legend, where to farm, "Go there" (client/js/huntzones.js) */
#bmHunt { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12.5px; color: var(--text); }
#bmHunt:empty { display: none; }
#bmHunt button { height: 30px; padding: 0 10px; font-size: 13px; }
#bmHunt .bmzt { opacity: 0.65; } #bmHunt .bmzt.on { opacity: 1; border-color: #22c55e; color: #bbf7d0; }
#bmHunt .bmzl { display: flex; flex-wrap: wrap; gap: 4px 8px; }
#bmHunt .bmz { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
#bmHunt .bmz::before { content: ""; width: 11px; height: 11px; border-radius: 3px; background: var(--c); box-shadow: 0 0 0 1px #0008; }
#bmHunt .bmrec { margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#bmHunt .bmgo { border-color: #22c55e; background: linear-gradient(180deg, #166534, #0f3d22); color: #dcfce7; font-weight: 700; }
@media (max-width: 600px) {
  #bmHunt { gap: 4px 8px; }
  #bmHunt .bmzl { flex: 1 1 0; gap: 2px 6px; } #bmHunt .bmz { font-size: 10.5px; }
  #bmHunt .bmrec { margin-left: 0; flex: 1 1 0; white-space: normal; font-size: 12px; }
}
#bmZoom { min-width: 38px; text-align: center; font-size: 13px; color: #fde68a; }
.bmbox { border-color: #b8923f; background: linear-gradient(180deg, #17203d, #0c0f1d); }
#bigmapCv { cursor: grab; } #bigmapCv:active { cursor: grabbing; }
#bigmapCv { image-rendering: pixelated; border-radius: 6px; cursor: crosshair; touch-action: none; }

/* ===== the item card v2 (VR-035, after the owner's reference): navy and gold, the item's rarity
   colour (--rc) on the name, the icon's glow and the stat strip ===== */
.ipcard.v2 { width: 384px; padding: 0 0 8px; border: 2px solid #b8923f; border-radius: 12px;
  background: linear-gradient(180deg, #17203d 0%, #10162b 45%, #0c0f1d 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 220, 140, 0.18), 0 0 0 2px #05060c, 0 18px 44px rgba(0, 0, 0, 0.75); }
.ipcard.v2 > * { margin-left: 10px; margin-right: 10px; }
.ipcard.v2 > .ic-top { margin: 0 0 8px; }
.ic-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 10px; height: 40px; padding: 0 44px;
  border-bottom: 2px solid #b8923f; border-radius: 10px 10px 0 0;
  background: linear-gradient(180deg, #2a3a6e 0%, #1a2550 55%, #131b3b 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.ic-top::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; margin-left: -5px; transform: rotate(45deg);
  background: #e9c46a; border: 1px solid #05060c; }
.ic-title { font-size: 16px; font-weight: 700; letter-spacing: 0.5px; color: #fdf3d0; text-shadow: 0 1px 0 #000, 0 0 10px rgba(233, 196, 106, 0.45); white-space: nowrap; }
.ic-orn { color: #e9c46a; font-size: 14px; text-shadow: 0 0 6px rgba(233, 196, 106, 0.6); }
.ic-top .ipx { position: absolute; right: 6px; top: 5px; width: 30px; height: 30px; font-size: 18px; color: #fff; border: 1px solid #fca5a5;
  border-radius: 6px; background: linear-gradient(#dc2626, #7f1d1d); }
.ic-hero { display: flex; gap: 12px; align-items: center; padding: 6px 0 8px; }
.ic-icon { position: relative; flex: none; width: 68px; height: 68px; display: flex; align-items: center; justify-content: center; border-radius: 10px;
  border: 2px solid var(--rc); background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--rc) 28%, #1b2140) 0%, #0b0e1c 75%);
  box-shadow: 0 0 14px color-mix(in srgb, var(--rc) 45%, transparent), inset 0 0 10px rgba(0, 0, 0, 0.6); }
.ic-icon img { width: 52px; height: 52px; image-rendering: pixelated; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6)); }
.ic-icon em { position: absolute; font-style: normal; font-weight: 700; font-size: 12px; text-shadow: 1px 1px 0 #000, -1px 0 0 #000; }
.ic-icon em.ref { left: 4px; bottom: 1px; color: #7dd3fc; } .ic-icon em.cnt { right: 4px; bottom: 1px; color: #fff; }
.ic-icon.ref7 { animation: icglow 1.6s ease-in-out infinite alternate; } .ic-icon.ref10 { animation: icglow 0.9s ease-in-out infinite alternate; }
@keyframes icglow { to { box-shadow: 0 0 22px color-mix(in srgb, var(--rc) 75%, #fff 10%), inset 0 0 10px rgba(0, 0, 0, 0.6); } }
.ic-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ic-name { font-size: 17px; line-height: 1.2; color: var(--rc); text-shadow: 0 1px 0 #000, 0 0 8px color-mix(in srgb, var(--rc) 40%, transparent); word-break: break-word; }
.ic-name .pips { font-size: 12px; color: #c4b5fd; letter-spacing: 1px; margin-left: 4px; }
.ic-id small { font-size: 12px; color: #a3b1d6; }
.ic-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.ic-tags .tag { font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 9px; color: var(--tc); border: 1px solid color-mix(in srgb, var(--tc) 60%, transparent);
  background: color-mix(in srgb, var(--tc) 14%, transparent); }
.ic-sum { padding: 6px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 700; color: #f8fafc; line-height: 1.45;
  border: 1px solid #3b5bb5; border-left: 4px solid var(--rc); background: linear-gradient(90deg, #1e3a8a, #172554 70%, #111a3d); text-shadow: 0 1px 0 #000; }
.ic-sec { margin-top: 9px; border: 1px solid #2e3a66; border-radius: 8px; overflow: hidden; background: rgba(5, 8, 20, 0.45); }
.ic-sh { padding: 5px 10px; font-size: 13px; font-weight: 700; color: #fdf3d0; background: linear-gradient(90deg, #22336a, #16204a 60%, transparent);
  border-bottom: 1px solid #2e3a66; }
.ic-cols { display: grid; grid-template-columns: 1.1fr 1fr; }
.ic-stats { padding: 6px 9px; border-right: 1px solid #2e3a66; }
.ic-st { display: flex; justify-content: space-between; gap: 6px; padding: 3px 0; font-size: 12.5px; border-bottom: 1px dashed rgba(148, 163, 214, 0.18); }
.ic-st:last-child { border-bottom: 0; }
.ic-st span { color: #f3c6a5; } .ic-st b { color: #fde7d3; font-weight: 700; text-align: right; }
.ic-st i.rf { font-style: normal; color: #4ade80; font-weight: 700; }
.ic-st.rfonly span, .ic-st.rfonly b { color: #4ade80; }
.ic-st.opt span, .ic-st.opt b { color: var(--rc); }
.ic-st.crd span, .ic-st.crd b { color: #c4b5fd; font-size: 11.5px; }
.ic-set { margin-top: 4px; padding-top: 3px; border-top: 1px solid rgba(233, 196, 106, 0.3); }
.ic-seth { font-size: 12px; font-weight: 700; color: #e9c46a; } .ic-seth small { color: #a3b1d6; font-weight: 400; }
.ic-st.on span, .ic-st.on b { color: #fde68a; } .ic-st.off span, .ic-st.off b { color: #6b7499; font-size: 11.5px; }
.ic-note { font-size: 12px; color: #a7f3d0; padding: 2px 0; }
.ic-props { margin: 0; padding: 6px 9px; display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; align-content: start; font-size: 12px; }
.ic-props dt { color: #8d9bc4; white-space: nowrap; } .ic-props dd { margin: 0; text-align: right; color: #e2e8f8; word-break: break-word; }
.ic-props dd.bad { color: #f87171; font-weight: 700; } .ic-props dd .ok { color: #4ade80; } .ic-props dd .lk { color: #93c5fd; }
.ic-props dd.src { font-size: 11px; color: #a3b1d6; font-style: italic; } .ic-props .pips { color: #c4b5fd; letter-spacing: 1px; } .ic-props .stars { color: #fbbf24; }
.ipcard.v2 .ipwarn { margin-top: 8px; }
.ipcard.v2 .cmp { margin-top: 8px; padding: 7px 9px; border-radius: 7px; font-size: 12px; line-height: 1.55; border: 1px solid #2e3a66; background: rgba(5, 8, 20, 0.55); }
.ipcard.v2 .cmp .up { color: #4ade80; } .ipcard.v2 .cmp .down { color: #f87171; }
.cmph { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.cmpcp { font-weight: 700; font-size: 12.5px; padding: 1px 8px; border-radius: 9px; background: rgba(0, 0, 0, 0.35); }
.ic-acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; margin-top: 9px; }
.ic-acts button { min-height: 36px; font-size: 12.5px; font-weight: 600; color: #e2e8f8; border: 1px solid #3b4d8a; border-radius: 7px;
  background: linear-gradient(#26345f, #182246); display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; line-height: 1.15; }
.ic-acts button small { font-size: 10.5px; color: #a3b1d6; font-weight: 400; }
.parapages { display: flex; gap: 4px; margin: 6px 0; } .parapages button { flex: 1; padding: 4px 6px; font-size: 12px; } .parapages button.on { border-color: #c084fc; background: #3b0764; } /* (para2) */
.ic-acts .upmats { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; margin-top: -2px; } /* (up3) an upgrade's materials by name */
.upm { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 3px; border-radius: 12px; background: rgba(6, 9, 20, 0.55); border: 1px solid #3b4d8a; font-size: 11.5px; color: #cbd5f5; cursor: pointer; }
.upm img { width: 20px; height: 20px; image-rendering: pixelated; } .upm.ok { border-color: #166534; color: #86efac; } .upm.short { border-color: #7f1d1d; color: #fca5a5; } .upm:hover { filter: brightness(1.2); }
.ic-acts button.on { border-color: #60a5fa; background: linear-gradient(#1d4ed8, #1e3a8a); }
.ic-acts button.dropbtn { color: #fecaca; border-color: #7f1d1d; background: linear-gradient(#4a1717, #2a0c0c); }
.ic-acts button:disabled { opacity: 0.45; filter: grayscale(0.6); }
.ic-main { display: block; width: calc(100% - 20px); margin-top: 9px; min-height: 46px; font-size: 16px; font-weight: 700; letter-spacing: 0.3px; color: #2a1804;
  border: 2px solid #fde68a; border-radius: 9px; background: linear-gradient(180deg, #fde68a 0%, #f5b83d 45%, #d98a0b 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 3px 0 #7c4a03, 0 0 14px rgba(245, 184, 61, 0.35); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45); }
.ic-main:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 1px 0 #7c4a03; }
.ic-main:disabled { filter: grayscale(1); opacity: 0.6; }
.ic-two { display: flex; gap: 6px; margin-top: 9px; } .ic-two .ic-main { flex: 1; width: auto; margin: 0; font-size: 13px; }
.ipcard.v2 .pick { margin-top: 8px; padding: 6px; border: 1px dashed #4b5a90; border-radius: 7px; }
.ipcard.v2 .pick p { margin: 0 0 4px; width: 100%; font-size: 12px; color: #a3b1d6; }
.ipcard.v2 .pick button { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.ipcard.v2 .pick button img { width: 20px; height: 20px; image-rendering: pixelated; }
.ic-foot { margin-top: 8px; text-align: center; font-size: 9.5px; letter-spacing: 3px; color: rgba(233, 196, 106, 0.55); }
.ipcard.v2 .dropbox, .ipcard.v2 .rfbox { margin-top: 4px; }
.lockmark { position: absolute; right: 1px; top: 0; font-size: 10px; font-style: normal; filter: drop-shadow(0 1px 0 #000); }
.slot .mlkmark { position: absolute; left: -3px; top: -3px; width: 17px; height: 17px; border: 1.5px solid #fde68a; border-radius: 50%; background: #0b1220; overflow: hidden; pointer-events: none; box-shadow: 0 0 4px rgba(0, 0, 0, .8); } /* (next n310) the worn mount look on the mount slot */
.slot .mlkmark img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.ic-note.mlknote { color: #fde68a; }
/* another job's gear in the bag: greyed, a red ✕ in the corner */
.slot.nouse img { filter: grayscale(0.75) brightness(0.75); }
.slot.nouse::before { content: "✕"; position: absolute; left: 2px; bottom: 0; z-index: 2; font-size: 11px; font-weight: 700; color: #f87171; text-shadow: 0 1px 0 #000, 0 0 2px #000; }
/* the card of another job's gear: the piece of the same level for your job */
.ic-foryou { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 6px 8px; border-radius: 7px; border: 1px solid #3b5bb5; background: rgba(30, 58, 138, 0.35); font-size: 12px; color: #dbeafe; }
.ic-foryou img { width: 32px; height: 32px; image-rendering: pixelated; flex: none; }
.ic-foryou b { color: #fde68a; } .ic-foryou small { display: block; color: #a3b1d6; font-size: 11px; }
#chat a.ilink { font-weight: 700; color: #fde68a; text-decoration: none; cursor: pointer; }
#chat a.ilink:hover { text-decoration: underline; }
body.touch .ipcard.v2 { width: min(384px, calc(100vw - 12px)); }
@media (max-width: 400px) {
  .ic-cols { grid-template-columns: 1fr; }
  .ic-stats { border-right: 0; border-bottom: 1px solid #2e3a66; }
}

/* ===== HUD v2 (VR-035, after the owner's reference): the status card with a round portrait, the
   level on it and Combat Power; glossy bars; the top menu bar with labelled pixel icons and badges;
   the line under the minimap ===== */
#stats { display: grid; grid-template-columns: 52px 1fr; column-gap: 8px; width: 252px; padding: 8px 10px 8px 8px;
  border: 2px solid #b8923f; border-radius: 12px; background: linear-gradient(180deg, rgba(26, 36, 72, 0.94), rgba(12, 15, 30, 0.94));
  box-shadow: inset 0 0 0 1px rgba(255, 220, 140, 0.15), 0 0 0 2px #05060c, 0 8px 20px rgba(0, 0, 0, 0.5); }
#stats > * { grid-column: 1 / -1; }
#stats > #pface { grid-column: 1; grid-row: 1 / span 4; align-self: center; }
#stats > #pname, #stats > .bar.hp, #stats > .bar.mp, #stats > .bar.xp { grid-column: 2; }
#pface { position: relative; width: 52px; height: 52px; border-radius: 50%; border: 2px solid #e9c46a; overflow: visible;
  background: radial-gradient(circle at 50% 35%, #3b4f8f, #121a36 70%); box-shadow: 0 0 0 2px #05060c, 0 0 10px rgba(233, 196, 106, 0.35); }
#pfaceCv { display: block; width: 100%; height: 100%; border-radius: 50%; image-rendering: pixelated; }
#plv { position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); padding: 0 6px; font-size: 10px; line-height: 14px; white-space: nowrap;
  color: #2a1804; background: linear-gradient(#fde68a, #e0a526); border: 1px solid #05060c; border-radius: 7px; }
#pname { display: flex; flex-direction: column; margin: 0 0 3px; padding-right: 96px; min-width: 0; color: inherit; }
#pnm { font-size: 14px; color: #fde68a; text-shadow: 0 1px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pjob { font-size: 11px; color: #a3b1d6; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pcp { position: absolute; right: 10px; top: 8px; padding: 1px 7px; font-size: 11px; font-weight: 700; color: #fde68a; border-radius: 9px;
  background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(233, 196, 106, 0.45); white-space: nowrap; }
#pcp:empty { display: none; }
#pcp .cpg { color: #4ade80; } /* (cpbuff1) the own HUD's buff / form gain */
#stats .bar { height: 15px; border-radius: 8px; border: 1px solid #05060c; background: #0a0d1a; overflow: hidden; margin-bottom: 3px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.7); }
#stats .bar i { border-radius: 8px; }
#stats .bar.hp i { background: linear-gradient(180deg, #ff9a9c 0%, #e5484d 45%, #a61b22 100%); }
#stats .bar.mp i { background: linear-gradient(180deg, #9cc6ff 0%, #3e8bff 45%, #1d4fb8 100%); }
#stats .bar.xp { height: 11px; } #stats .bar.xp i { background: linear-gradient(90deg, #7c3aed, #c084fc 60%, #f0abfc); }
#stats .bar span { font-weight: 700; font-size: 10.5px; line-height: 15px; }
#stats .bar.xp span { font-size: 9px; line-height: 11px; }
#stats .bar.hp::before, #stats .bar.mp::before { position: absolute; left: 6px; top: 0; z-index: 1; font-size: 9px; font-weight: 700; line-height: 15px; color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 0 #000; }
#stats .bar.hp::before { content: "HP"; } #stats .bar.mp::before { content: "SP"; }
#stats #bmwrap { margin-top: 4px; }
body.touch #stats { width: 200px; }
@media (max-height: 520px) {
  body.touch #stats { grid-template-columns: 40px 1fr; column-gap: 6px; width: 186px; }
  body.touch #pface { width: 40px; height: 40px; }
  body.touch #pname { padding-right: 30px; } body.touch #pnm { font-size: 12px; } body.touch #pjob { font-size: 10px; }
  body.touch #pcp { display: none; }
  body.touch #stats .bar::before { line-height: 11px; font-size: 8px; }
}
/* (pt1, item 4) a phone held upright: the hero card at about the landscape phone's size */
@media (max-width: 600px) and (min-height: 521px) and (orientation: portrait) {
  body.touch #stats { grid-template-columns: 40px 1fr; column-gap: 6px; width: 178px; padding: 6px 8px 6px 6px; font-size: 11px; }
  body.touch #pface { width: 40px; height: 40px; }
  body.touch #pname { padding-right: 22px; } body.touch #pnm { font-size: 12px; } body.touch #pjob { font-size: 10px; }
  body.touch #pcp { display: none; }
  body.touch #stats .bar { height: 12px; margin-bottom: 2px; }
  body.touch #stats .bar span { line-height: 12px; font-size: 9px; }
  body.touch #stats .bar::before { line-height: 12px; font-size: 8px; }
  body.touch #stats .bar.xp { height: 9px; } body.touch #stats .bar.xp span { line-height: 9px; font-size: 8px; }
  body.touch #xprate { font-size: 10px !important; margin: 0 0 2px !important; }
  body.touch #stats #bmwrap { margin-top: 2px; }
  body.touch #gold { display: none; } /* (the bag and the shop show it) */
}

/* the top menu bar (landscape screens; main.js layoutTopbar places it and turns it on) */
#topbar { display: none; }
body.tb-on #topbar { display: flex; position: fixed; top: 8px; z-index: 6; gap: 2px; padding: 4px 6px;
  border: 2px solid #b8923f; border-radius: 12px; background: linear-gradient(180deg, rgba(26, 36, 72, 0.92), rgba(12, 15, 30, 0.92));
  box-shadow: inset 0 0 0 1px rgba(255, 220, 140, 0.15), 0 0 0 2px #05060c, 0 6px 16px rgba(0, 0, 0, 0.45); }
#topbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  width: 52px; min-height: 48px; padding: 3px 0 2px; border: 0; border-radius: 8px; background: transparent; color: #fdf3d0;
  font-size: 10.5px; font-weight: 700; text-shadow: 0 1px 0 #000; white-space: nowrap; }
#topbar button:hover { background: rgba(255, 255, 255, 0.08); }
#topbar button:active { transform: translateY(1px); }
#topbar img { width: 28px; height: 28px; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.65)); }
#topbar img.vec { width: 32px; height: 32px; image-rendering: auto; filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.6)); }
#topbar.icons img.vec { width: 30px; height: 30px; }
#topbar button.ai img { width: 34px; height: 34px; } /* the painted icons (A-111) */
#topbar.icons button.ai img { width: 32px; height: 32px; }
#topbar.icons span { display: none; } #topbar.icons button { width: 42px; min-height: 40px; }
#topbar.slim .p2 { display: none; } /* (small phones: the rest is in More) */
#topbar .tbb { position: absolute; top: -3px; right: 3px; min-width: 18px; height: 17px; padding: 0 4px; border-radius: 9px; background: #ef4444; color: #fff;
  font-size: 10.5px; font-style: normal; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px #0c0f1e; }
#topbar .tbb[hidden] { display: none; }
#topbar .tbb.pct { background: #14532d; color: #bbf7d0; font-size: 9.5px; }
#topbar .tbb.pct.full { background: #b91c1c; color: #fff; }
#topbar button.dot::after { content: ""; position: absolute; top: 0; left: 6px; width: 8px; height: 8px; border-radius: 50%; background: #ef4444;
  box-shadow: 0 0 0 2px #1b1530; animation: ptsdot 1.2s ease-in-out infinite; }
body.tb-on #menu, body.tb-on.touch #tmenu { display: none; }
/* the ☰ "More" sheet from the bar on a computer: a window under the bar, not the whole screen */
body.tb-on:not(.touch) #mmenu:not([hidden]) { display: flex; flex-direction: column; position: fixed; top: calc(var(--tbh, 56px) + 16px); right: 170px; width: 440px;
  max-height: calc(100vh - var(--tbh, 56px) - 40px); z-index: 40; padding: 12px; border: 2px solid #b8923f; border-radius: 12px; background: rgba(12, 15, 30, 0.97); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7); } /* (mn1: as tall as the window allows - it was 70vh) */
/* with the bar on, the top-centre messages move down under it */
@media (min-width: 601px) {
  body.tb-on #bossbar { top: calc(var(--tbh, 56px) + 16px); }
  body.tb-on #zonetag { top: calc(var(--tbh, 56px) + 40px); }
  body.tb-on #targetbar { top: calc(var(--tbh, 56px) + 60px); }
  body.tb-on #toasts { top: calc(var(--tbh, 56px) + 96px); }
}
@media (max-height: 520px) {
  body.tb-on #toasts { top: calc(var(--tbh, 56px) + 14px); }
  #toasts .toast { font-size: 12px; padding: 3px 10px; }
}

/* over the minimap: the map's name and the named place you stand in */
#mmname { display: flex; flex-direction: column; align-items: center; margin-bottom: 3px; padding: 2px 6px; font-size: 12px; line-height: 1.25; color: #e2e8f0; text-align: center;
  background: linear-gradient(90deg, #3b2a0a, #1c1306); border: 1px solid #a16207; border-radius: 5px; overflow: hidden; }
#mmname b { color: #fde68a; max-width: 100%; white-space: normal; overflow-wrap: anywhere; } /* (a long name wraps rather than being cut) */
#mmname span { font-size: 10px; color: #cbd5e1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (max-width: 600px), (max-height: 520px) { #mmname { font-size: 10px; padding: 1px 4px; } #mmname span { font-size: 9px; } }
/* under the minimap: channel · players · position */
#mminfo { display: flex; justify-content: space-between; gap: 4px; margin-top: 3px; padding: 2px 6px; font-size: 11px; color: #dbeafe; white-space: nowrap;
  background: linear-gradient(90deg, #1e3a8a, #172554); border: 1px solid #3b5bb5; border-radius: 5px; overflow: hidden; }
#mminfo b { color: #fde68a; }
@media (max-height: 520px) { body.touch #mminfo { font-size: 9px; padding: 1px 4px; } body.touch #mminfo .mmp { display: none; } }
@media (max-width: 600px) { #mminfo { font-size: 9px; padding: 1px 4px; } #mminfo .mmp { display: none; } }

/* ===== Arrange the HUD (client/js/hudlayout.js): a clear layer takes the touches, every piece wears a
   gold dashed frame, the one being dragged a green one; the bar in the middle saves or resets ===== */
#hudedit { position: fixed; inset: 0; z-index: 88; background: rgba(5, 8, 20, 0.22); touch-action: none; cursor: move; }
#hudedit[hidden], #hudbar[hidden] { display: none; }
#hudbar { position: fixed; left: 50%; top: 46%; transform: translate(-50%, -50%); z-index: 89; display: flex; flex-wrap: nowrap; align-items: center; justify-content: center;
  gap: 8px; padding: 6px 10px; touch-action: none; cursor: move; white-space: nowrap; border: 2px solid #b8923f; border-radius: 12px; text-align: center; color: #fdf3d0;
  background: linear-gradient(180deg, rgba(26, 36, 72, 0.96), rgba(12, 15, 30, 0.96)); box-shadow: 0 0 0 2px #05060c, 0 12px 30px rgba(0, 0, 0, 0.6); }
#hudbar b { font-size: 14px; color: #fde68a; }
#hudbar .grip { font-style: normal; font-size: 18px; color: #b8923f; }
#hudbar button { min-width: 78px; min-height: 38px; font-size: 14px; font-weight: 700; border-radius: 9px; cursor: pointer; }
#hudbar button.primary { color: #2a1804; border: 2px solid #fde68a; background: linear-gradient(180deg, #fde68a, #f5b83d 45%, #d98a0b); }
body.hud-edit .hudmov { outline: 2px dashed #fbbf24; outline-offset: 2px; }
body.hud-edit .hudmov.hudgrab { outline: 3px solid #4ade80; }
@media (max-height: 520px) { #hudbar { padding: 4px 8px; gap: 6px; } #hudbar b { font-size: 12px; } #hudbar button { min-height: 32px; min-width: 64px; } }

/* ===== the party box (its own HUD piece; main.js places it under the status card / quest box) ===== */
#partyframe { position: fixed; left: 12px; top: 200px; z-index: 5; width: 200px; padding: 5px 8px 6px; font-size: 11px; cursor: pointer;
  border: 2px solid #3b5bb5; border-radius: 10px; background: linear-gradient(180deg, rgba(26, 36, 72, 0.88), rgba(12, 15, 30, 0.88)); box-shadow: 0 0 0 2px #05060c; }
#partyframe[hidden] { display: none; }
#partyframe .ph { font-weight: 700; color: #fde68a; margin-bottom: 3px; } #partyframe .ph small { color: #a3b1d6; font-weight: 400; }
#partyframe .pm { margin-bottom: 3px; color: #bbf7d0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#partyframe .pm.me { color: #e2e8f8; opacity: 0.85; }
#partyframe .pm small { color: #a3b1d6; }
#partyframe .bar { height: 6px; margin: 1px 0 0; border-radius: 3px; overflow: hidden; }
#partyframe .bar i { background: linear-gradient(90deg, #22c55e, #4ade80); } #partyframe .bar i.low { background: linear-gradient(90deg, #dc2626, #f87171); }
#partyframe .palone { font-size: 10.5px; color: #a3b1d6; line-height: 1.3; }
#partyframe .ploot { float: right; font-size: 12px; }
#partyframe .pffold { float: right; margin: -1px 0 0 6px; padding: 0 6px; min-height: 0; font-size: 11px; line-height: 15px; border-radius: 6px; } /* (pbf1 G3) the party box folds */
#partyframe.pf-fold .pm, #partyframe.pf-fold .palone { display: none; }
.pcfgbox { margin: 8px 0; padding: 8px; border: 1px solid #2e3a66; border-radius: 8px; background: rgba(5, 8, 20, 0.45); }
.pcfgbox h4 { margin: 0 0 6px; color: #fde68a; }
.pcfg { display: flex; align-items: center; gap: 8px; margin: 4px 0; flex-wrap: wrap; }
.pcfg > span { min-width: 76px; font-size: 12px; color: #a3b1d6; }
.pcfg .seg { display: flex; flex-wrap: wrap; gap: 4px; }
.pcfg .seg button { min-height: 30px; padding: 2px 10px; font-size: 12px; border-radius: 14px; }
.pcfg .seg button.on { color: #2a1804; border-color: #fde68a; background: linear-gradient(#fde68a, #e0a526); }
.pcfg .seg button:disabled:not(.on) { opacity: 0.5; }
.pcfg .seg button.on:disabled { opacity: 1; }
@media (max-height: 520px) { body.touch #partyframe { width: 168px; padding: 3px 6px 4px; font-size: 10px; } body.touch #partyframe .bar { height: 5px; } }

/* ===== the shop's Sell tab ===== */
.shoptabs { margin-bottom: 6px; }
.sellq { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; } .sellq button { flex: 1 1 auto; min-height: 32px; font-size: 12px; }
.sellgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 4px; max-height: 46vh; overflow-y: auto; padding: 2px; }
.slot.sellpick { cursor: pointer; border-radius: 5px; }
.slot.sellpick img { width: 80%; height: 80%; image-rendering: pixelated; }
.slot.sellpick.picked { border-color: #fbbf24; box-shadow: inset 0 0 0 2px #fbbf24, 0 0 8px rgba(251, 191, 36, 0.45); background: rgba(251, 191, 36, 0.15); }
.slot.sellpick.locked { opacity: 0.45; cursor: not-allowed; }
.pickmark { position: absolute; right: 1px; bottom: 0; font-style: normal; font-size: 13px; font-weight: 700; color: #4ade80; text-shadow: 0 1px 0 #000, 0 0 2px #000; }
.sellgo { display: block; width: 100%; margin-top: 8px; min-height: 44px; font-size: 15px; font-weight: 700; color: #2a1804; border: 2px solid #fde68a; border-radius: 9px;
  background: linear-gradient(180deg, #fde68a 0%, #f5b83d 45%, #d98a0b 100%); }
.sellgo:disabled { filter: grayscale(1); opacity: 0.55; }
.sellgo.warn { animation: pulse2 0.6s infinite alternate; }
body.touch .sellgrid { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); }
.sellcond { margin: 4px 0 6px; padding: 6px 8px; border: 1px solid #2e3a66; border-radius: 8px; background: rgba(5, 8, 20, 0.45); }
.sellcond summary { cursor: pointer; font-weight: 700; color: #fde68a; font-size: 13px; }
.sellcond .chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
.sellcond .chips > span { min-width: 54px; font-size: 11px; color: #a3b1d6; }
.chip { min-height: 28px; padding: 2px 9px; font-size: 12px; border-radius: 14px; border: 1px solid #3b4d8a; background: #141a33; color: #a3b1d6; }
.chip.on { color: #fde68a; border-color: #fbbf24; background: rgba(251, 191, 36, 0.14); }
.sellhint { margin: 6px 0 0; font-size: 12px; color: #93c5fd; }

/* guild skills (shared/guildskills.js) */
.gskills { margin: 8px 0; padding: 8px; border: 1px solid var(--edge); border-radius: 8px; background: rgba(255,255,255,0.03); }
.gskh { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.gskh small.ok { color: #4ade80; }
.gskrow { display: grid; grid-template-columns: 26px 1fr auto; gap: 6px; align-items: center; padding: 4px 0; border-bottom: 1px dashed var(--edge); }
.gskrow:last-of-type { border-bottom: 0; }
.gskrow > i { font-style: normal; font-size: 18px; text-align: center; }
.gskrow button { min-width: 34px; }

/* the Tarot Book (Collection → Tarot Book) */
.tbh { margin: 10px 0 4px; }
.tbook { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.tcard { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 1px solid var(--edge); border-radius: 8px; background: rgba(255,255,255,0.03); opacity: 0.6; text-align: center; font-size: 12px; }
.tcard.on { opacity: 1; border-color: var(--fc, var(--accent)); box-shadow: 0 0 8px color-mix(in srgb, var(--fc, #fff) 35%, transparent); }
.tcard .tg { font-size: 22px; line-height: 1.1; color: var(--fc, #fff); }
.tcard button { font-size: 11px; padding: 2px 6px; }

/* the bag item beside what is worn there now (the owner's reference: worn left, bag right) */
.ipcard.v2.ipworn { border-color: #4ade80; box-shadow: 0 0 0 2px #000, 0 0 14px rgba(74, 222, 128, 0.35); }
.ipcard.v2.ipworn .ic-title { color: #86efac; }
.ipswap { display: block; width: calc(100% - 20px); margin: 8px 10px 0; padding: 6px; font-size: 13px; border-color: #4ade80; color: #86efac; }

/* ---------- character select / creation (client/js/charscreen.js) ---------- */
#charsel, #charnew {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 24px)); max-height: calc(var(--app-h) - 24px); overflow: auto;
  padding: 18px; text-align: center;
}
#charnew { width: min(980px, calc(100vw - 24px)); } /* (next n220: the stage and the paths) */
#charsel { width: min(960px, calc(100vw - 24px)); } /* (next n222: the stage and the cards) */
#p_cash .csic canvas.csprev { width: 72px; height: 72px; image-rendering: pixelated; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.5)); } /* (next n223b: a look's preview in its shop card) */
#p_cash .csic:has(canvas.csprev) { width: 80px; height: 80px; } /* (n223c: the box grows to the preview) */
.cswrap { display: grid; grid-template-columns: minmax(260px, 320px) 1fr; gap: 18px; text-align: left; align-items: start; } .cswrap.cs1col { grid-template-columns: 1fr; }
.cshero { display: flex; flex-direction: column; align-items: stretch; } .csstage { min-height: 300px; }
#csPic { image-rendering: pixelated; position: relative; z-index: 1; filter: drop-shadow(0 6px 8px rgba(0,0,0,0.5)); }
.csmeta { margin: 2px 0 10px; text-align: center; font-size: 13px; color: var(--muted); }
#charsel .csgo { width: 100%; padding: 12px; font-size: 18px; } .cshint { text-align: center; margin: 6px 0 0; font-size: 12px; }
.cscol .cslist { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); max-height: 430px; overflow-y: auto; padding: 2px; }
.cscard .cscp { color: #fca5a5; font-weight: 600; }
.cstier { font-style: normal; font-size: 11px; padding: 0 6px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.25); color: var(--muted); }
.cstier.t2 { border-color: rgba(96,165,250,0.6); color: #93c5fd; } .cstier.t3 { border-color: rgba(192,132,252,0.7); color: #d8b4fe; }
@media (max-width: 760px) { .cswrap { grid-template-columns: 1fr; } #csPic { width: 200px; height: 230px; } .csstage { min-height: 230px; } .cscol .cslist { max-height: none; } }
.cnwrap { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 18px; text-align: left; }
.cnhero { display: flex; flex-direction: column; }
.cnhero .cstitle { text-align: center; font-size: 22px; letter-spacing: 0.5px; }
.cnstage { position: relative; display: flex; justify-content: center; padding: 6px 0 2px;
  background: radial-gradient(ellipse 60% 18% at 50% 88%, rgba(255,207,74,0.45), rgba(255,207,74,0.08) 60%, transparent 72%),
              radial-gradient(ellipse 70% 60% at 50% 55%, rgba(124,58,237,0.22), transparent 70%); }
.cnstage::after { content: ""; position: absolute; left: 50%; bottom: 10px; width: 150px; height: 26px; transform: translateX(-50%); border-radius: 50%;
  border: 2px solid rgba(255,207,74,0.6); box-shadow: 0 0 14px rgba(255,207,74,0.45), inset 0 0 10px rgba(255,207,74,0.35); animation: cnring 3s ease-in-out infinite; pointer-events: none; }
@keyframes cnring { 50% { box-shadow: 0 0 22px rgba(255,207,74,0.7), inset 0 0 14px rgba(255,207,74,0.5); } }
@media (prefers-reduced-motion: reduce) { .cnstage::after { animation: none; } }
#charnew #cnPic { margin: 0; background: none; position: relative; z-index: 1; filter: drop-shadow(0 6px 8px rgba(0,0,0,0.5)); }
.cnwho { margin: 4px 0 0; text-align: center; font-weight: 700; color: #fde68a; }
.cndesc { min-height: 2.6em; margin: 2px 0 8px; text-align: center; font-size: 13px; color: var(--muted); }
.cnrow { display: flex; gap: 6px; margin-top: 4px; } .cnrow input { flex: 1; min-width: 0; margin-top: 0 !important; }
.cndice { padding: 0 12px; font-size: 18px; }
.cngift { margin: 4px 0; padding: 7px 10px; border-radius: 8px; font-size: 13px; color: #fbcfe8; background: rgba(244,114,182,0.1); border: 1px solid rgba(244,114,182,0.35); }
#charnew .cngo { width: auto; flex: 1; min-width: 160px; padding: 10px 18px; font-size: 17px; } #charnew .cngo:disabled { cursor: not-allowed; } /* (n220b: the login's gold button) */
.cnpath h3 { margin: 4px 0 2px; color: var(--accent); font-size: 17px; }
.cntabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.cntabs button { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 78px; padding: 4px 2px; font-size: 12px; border-radius: 10px; }
.cntabs button.on, .cncard.on { border-color: var(--accent); box-shadow: 0 0 10px rgba(255,210,63,0.35); background: rgba(255,210,63,0.08); }
.cnmini { image-rendering: pixelated; }
.cntree { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cncol { display: flex; flex-direction: column; gap: 6px; } .cncol > small { color: var(--muted); font-size: 12px; }
.cncard { display: flex; align-items: center; gap: 6px; padding: 4px 6px; text-align: left; border-radius: 10px; }
.cncard span { display: flex; flex-direction: column; min-width: 0; } .cncard b { font-size: 13px; } .cncard small { font-size: 11px; color: var(--muted); }
.cncard.t2 { border-color: rgba(96,165,250,0.5); } .cncard.t3 { border-color: rgba(192,132,252,0.6); }
@media (max-width: 760px) { .cnwrap { grid-template-columns: 1fr; } #charnew #cnPic { width: 160px; height: 200px; } .cntree { grid-template-columns: 1fr; } .cntabs button { width: 70px; } }
.cstitle { margin: 0 0 6px; font-size: 20px; color: var(--accent); }
.csacct { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
button.link { background: none; border: 0; padding: 0 4px; color: #93c5fd; text-decoration: underline; font-size: 13px; }
.cslist { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin-bottom: 10px; }
.cscard { display: grid; grid-template-columns: 72px 1fr; grid-template-rows: auto auto; gap: 4px 10px; align-items: center; padding: 8px;
  border: 2px solid var(--edge); border-radius: 10px; background: rgba(255,255,255,0.03); cursor: pointer; text-align: left; }
.cscard.sel { border-color: var(--accent); box-shadow: 0 0 10px rgba(255, 210, 63, 0.3); background: rgba(255, 210, 63, 0.06); }
.cscard .cspic { grid-row: 1 / span 2; image-rendering: pixelated; }
.cscard .csinfo { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cscard .csinfo b { font-size: 16px; color: #fde68a; overflow: hidden; text-overflow: ellipsis; }
.cscard .csinfo span { font-size: 13px; }
.cscard .csinfo small { font-size: 12px; color: var(--muted); }
.cscard button { justify-self: start; padding: 4px 16px; }
.csnew { width: 100%; padding: 10px; font-size: 15px; border-style: dashed; }
.csempty { padding: 12px; }
#cnPic { display: block; margin: 4px auto 8px; image-rendering: pixelated; background: radial-gradient(ellipse at 50% 92%, rgba(0,0,0,0.35) 0 18%, transparent 19%); }
.cngender { justify-content: center; margin-bottom: 8px; }
.cnlab { display: block; text-align: left; font-size: 13px; color: var(--muted); }
.cnlab input { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; font: inherit; font-size: 16px; color: var(--text); background: #0c0b12; border: 2px solid var(--edge); outline: none; -webkit-user-select: text; user-select: text; }
.cnstate { min-height: 1.4em; margin: 6px 0; font-size: 13px; text-align: left; }
.cnstate.ok { color: #4ade80; } .cnstate.bad { color: #f87171; }
#charsel .btns, #charnew .btns, #regbox .btns { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
#regbox { margin-top: 10px; padding: 10px; border: 1px dashed var(--edge-hi); border-radius: 8px; text-align: left; }
#regbox .regq { margin: 0 0 4px; color: var(--accent); font-weight: 700; }

/* party members: where they are, and ⇢ to warp to them */
#partyframe .pm { position: relative; }
#partyframe .pm .pmw { display: block; font-size: 10px; color: #93c5fd; margin-top: -1px; }
#partyframe .pwbtn { position: absolute; right: 0; top: -1px; padding: 0 6px; font-size: 12px; line-height: 16px; min-height: 0; border-color: #4ade80; color: #86efac; background: rgba(20, 60, 30, 0.7); }
#partyframe .pm .pmn { display: inline-block; max-width: calc(100% - 30px); overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }

.tcard .tgi { width: 40px; height: 40px; image-rendering: pixelated; }
.tcard:not(.on) .tgi { filter: grayscale(0.7) brightness(0.8); }

/* a member who logged out but is still in the party */
#partyframe .pm.off, .memrow.off { opacity: 0.55; }
#partyframe .pm.off .pmn { max-width: 100%; }

/* the braziers' order in the dungeon mission tracker (the puzzle rooms) */
.pzdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 2px; vertical-align: -1px; opacity: 0.45; box-shadow: 0 0 0 1px rgba(0,0,0,0.5); }
.pzdot.lit { opacity: 1; box-shadow: 0 0 5px currentColor, 0 0 0 1px #fff7; }
/* the guardian's altar: its three forms (the boss-form choice) */
.formpick { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.formbtn { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 7px 10px; border-left: 4px solid; }
.formbtn small { opacity: 0.8; font-size: 11px; }
.formbtn.form-fury { border-left-color: #ef4444; }
.formbtn.form-mend { border-left-color: #4ade80; }
.formbtn.form-hex { border-left-color: #a855f7; }
/* the clear chest's tier on the result card (the boxes) */
.dgrtier { font-weight: 700; margin: 2px 0 6px; letter-spacing: 0.5px; }
.dgrtier.t0 { color: #fbbf24; }
.dgrtier.t1 { color: #7dd3fc; }
.dgrtier.t2 { color: #c4b5fd; }
.dgrtier.t3 { color: #fde047; text-shadow: 0 0 8px rgba(253, 224, 71, 0.7); }

/* the Dungeon of the Day and this week's clears */
.dgcard.dotd { box-shadow: 0 0 0 1px #fbbf24, 0 0 12px rgba(251, 191, 36, 0.35); }
.dgdotd { font-size: 11px; font-weight: 700; color: #fde68a; background: linear-gradient(90deg, rgba(251, 191, 36, 0.25), transparent); padding: 2px 6px; margin: -2px -2px 4px; border-radius: 4px; }
.dgweek { display: block; font-size: 11px; opacity: 0.85; margin: 1px 0 3px; }

/* the Endless Tower's boons: gifts and trades */
.formbtn.boon-gift { border-left-color: #38bdf8; }
.formbtn.boon-trade { border-left-color: #f97316; }

/* the Guild Trial box in the Guild window */
.gtrial { display: flex; flex-direction: column; gap: 3px; margin: 8px 0; padding: 8px; border-radius: 6px; background: rgba(251, 191, 36, 0.07); border: 1px solid rgba(251, 191, 36, 0.25); }
.gtrial.t3 { background: rgba(244, 63, 94, 0.08); border-color: rgba(244, 63, 94, 0.35); }
.gtrial button { align-self: flex-start; margin-top: 4px; }
.pzglyph { display: inline-block; margin: 0 2px; opacity: 0.5; text-shadow: 0 0 2px #000, 0 0 1px #000; }
.pzglyph.lit { opacity: 1; text-shadow: 0 0 6px currentColor, 0 0 1px #000; }
/* the one free look choice on the character screen (characters made before the gender choice) */
.csgender { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.csgender small { opacity: 0.8; }
.csgender button { padding: 2px 8px; font-size: 12px; }

/* ---- the effects bar (client/js/fxbar.js): icon tiles with a ring that empties as time runs out ---- */
#buffs { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
#buffs[hidden] { display: none !important; }
.fx { --p: 1; --c: #60a5fa; position: relative; width: 30px; height: 30px; border-radius: 9px; padding: 2px; cursor: pointer;
  background: conic-gradient(var(--c) calc(var(--p) * 360deg), rgba(255, 255, 255, 0.10) 0); box-shadow: 0 0 6px color-mix(in srgb, var(--c) 45%, transparent); }
.fx .fxi { position: absolute; inset: 2px; border-radius: 7px; display: grid; place-items: center; font-style: normal; font-size: 15px; line-height: 1;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 35%, #1b1828), #120f1c 80%); overflow: hidden; }
.fx .fxi img { width: 22px; height: 22px; image-rendering: pixelated; }
.fx .fxt { position: absolute; left: -2px; right: -2px; bottom: -6px; text-align: center; font-size: 9px; font-weight: 600; line-height: 11px; color: #fff;
  text-shadow: 0 0 2px #000, 0 0 2px #000, 0 1px 1px #000; pointer-events: none; }
.fx-bad { --c: #ef4444; animation: fxbad 1.1s ease-in-out infinite; }
.fx-skill { --c: #60a5fa; } .fx-food { --c: #4ade80; } .fx-arena { --c: #fb923c; } .fx-bless { --c: #c084fc; }
.fx-event { --c: #fbbf24; } .fx-event .fxi { animation: fxglow 2s ease-in-out infinite; }
.fx-all { --c: var(--accent); background: linear-gradient(135deg, #ffcf4a, #b46bff); }
.fx-all .fxi { color: #ffe9a8; font-size: 16px; }
.fx.ending .fxt { color: #fca5a5; }
.fx.ending { animation: fxend 0.5s ease-in-out infinite alternate; }
.fx.fxnew { animation: fxpop 0.35s ease-out; }
@keyframes fxpop { from { transform: scale(0.3); opacity: 0; } 70% { transform: scale(1.15); } to { transform: scale(1); opacity: 1; } }
@keyframes fxend { from { opacity: 1; } to { opacity: 0.45; } }
@keyframes fxbad { 50% { box-shadow: 0 0 10px #ef4444; } }
@keyframes fxglow { 50% { filter: brightness(1.35); } }
body.touch .fx { width: 34px; height: 34px; } body.touch .fx .fxi img { width: 25px; height: 25px; } body.touch .fx .fxi { font-size: 17px; }
/* the card a tile opens (one effect) or the ✦ tile opens (all of them, with the sum) */
#fxcard { position: fixed; z-index: 60; width: min(300px, calc(100vw - 16px)); max-height: min(70vh, calc(var(--app-h) - 16px)); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--edge-hi); border-radius: 12px; padding: 8px 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); }
#fxcard .fxhead { font-weight: 600; color: var(--accent); margin-bottom: 4px; }
#fxcard .fxsec { border-top: 1px solid var(--edge); padding-top: 4px; margin-top: 4px; }
#fxcard h4 { margin: 0 0 3px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
#fxcard .fxrow { --c: #60a5fa; display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; }
#fxcard .fxrow .fxi { flex: none; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-style: normal; font-size: 14px;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 40%, #1b1828), #120f1c 85%); border: 1px solid color-mix(in srgb, var(--c) 70%, transparent); }
#fxcard .fxrow .fxi img { width: 20px; height: 20px; image-rendering: pixelated; }
#fxcard .fxrow.big .fxi { width: 34px; height: 34px; font-size: 18px; } #fxcard .fxrow.big .fxi img { width: 26px; height: 26px; }
#fxcard .fxrow div { display: flex; flex-direction: column; min-width: 0; }
#fxcard .fxrow b { font-size: 13px; } #fxcard .fxrow small { font-size: 11px; color: var(--muted); }
#fxcard .fxrow em { font-style: normal; font-size: 12px; color: #bbf7d0; }
#fxcard .fxrow .warn { color: #fca5a5; }
#fxcard .fxtotal em { font-style: normal; font-size: 12px; color: #fde68a; }
#fxcard .fxrow.fx-bad { --c: #ef4444; } #fxcard .fxrow.fx-bad em { color: #fca5a5; }
#fxcard .fxrow.fx-food { --c: #4ade80; } #fxcard .fxrow.fx-arena { --c: #fb923c; } #fxcard .fxrow.fx-bless { --c: #c084fc; }
#fxcard .fxrow.fx-event { --c: #fbbf24; } #fxcard .fxrow.fx-always { --c: #2dd4bf; }

/* ---- the Wayfinder's navigation chip (client/js/route.js): where to, how far, how long; ✕ stops ---- */
#navchip { --c: #ffd75e; position: fixed; z-index: 40; left: 50%; top: 72px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px;
  padding: 5px 6px 5px 8px; max-width: min(420px, calc(100vw - 24px)); border-radius: 999px; background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--c) 70%, transparent); box-shadow: 0 0 12px color-mix(in srgb, var(--c) 35%, transparent), 0 4px 14px rgba(0,0,0,0.45);
  pointer-events: auto; animation: navin 0.25s ease-out; }
#navchip[data-kind="walk"] { --c: #7dd3fc; } #navchip[data-kind="auto"] { --c: #86efac; }
#navchip .navdir { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 13px; color: #1a1206;
  background: radial-gradient(circle at 40% 35%, #fff8, transparent 60%), var(--c); transition: transform 0.25s ease; }
#navchip .navtxt { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
#navchip .navtxt b { font-size: 13px; color: var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#navchip .navtxt small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#navchip .navx { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--edge-hi); background: rgba(255,255,255,0.06); color: var(--text); cursor: pointer; font-size: 12px; line-height: 1; padding: 0; }
#navchip .navx:hover { background: rgba(239, 68, 68, 0.35); }
@keyframes navin { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }
body.touch #navchip { top: 58px; }

/* ---------- the login and sign-up screens (client/js/loginui.js) ----------
   the capital drifts by on the canvas behind (render.js drawTitle); a dusk veil over it */
#login { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; overflow-y: auto; overflow-x: hidden;
  padding: max(14px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse 30% 62% at 50% 60%, rgba(12,10,22,0.62) 0%, rgba(12,10,22,0.34) 60%, rgba(12,10,22,0) 100%),
              linear-gradient(180deg, rgba(10,8,18,0.62) 0%, rgba(10,8,18,0.16) 30%, rgba(10,8,18,0.08) 62%, rgba(10,8,18,0.5) 100%); }
/* the key art (A-169) behind the login, character select and creation screens: a slow drift; still for reduced motion */
#loginArt { display: none; position: fixed; inset: 0; z-index: 0; background: #14121c center 55% / cover no-repeat; transform-origin: 50% 55%; animation: lartdrift 60s ease-in-out infinite alternate; }
body.lart:has(#login:not([hidden])) #loginArt, body.lart:has(#charsel:not([hidden])) #loginArt, body.lart:has(#charnew:not([hidden])) #loginArt { display: block; }
#loginArt::after { content: ""; position: absolute; inset: 0; background: rgba(10, 8, 18, 0); transition: background 0.3s; }
body.lart:has(#charsel:not([hidden])) #loginArt::after, body.lart:has(#charnew:not([hidden])) #loginArt::after { background: rgba(10, 8, 18, 0.5); } /* (dimmed behind the character screens; a filter did not paint over the drifting layer) */
@keyframes lartdrift { from { transform: scale(1); } to { transform: scale(1.025); } } /* (a breath, not a drift: the heroes stand at the picture's edges) */
/* an upright phone: the whole picture as a band across the top (a cover would cut every hero away); the title and the form stand below it */
@media (max-aspect-ratio: 3/4) { #loginArt { inset: 0 0 auto 0; height: calc(100vw * 941 / 1672); background-size: 100% auto; background-position: center top; animation: none;
    -webkit-mask-image: linear-gradient(180deg, #000 82%, transparent 100%); mask-image: linear-gradient(180deg, #000 82%, transparent 100%); }
  body.lart #login { background: linear-gradient(180deg, rgba(10,8,18,0.35) 0, rgba(10,8,18,0) 14vw, rgba(10,8,18,0) 42vw, #14121c calc(100vw * 941 / 1672), #14121c 100%); }
  body.lart #login .lhero { margin-top: calc(100vw * 941 / 1672 - 70px); } }
@media (prefers-reduced-motion: reduce) { #loginArt { animation: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-iteration-count: 1 !important; } } /* (afp1 G3c) a system asking for reduced motion: no looping CSS motion (a one-time fade still ends as it should) */
#loginTop { align-self: stretch; display: flex; justify-content: flex-end; }
.lsel { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border-radius: 999px; background: rgba(12,10,20,0.75); border: 1px solid var(--edge-hi); font-size: 14px; }
.lsel select { background: transparent; border: 0; color: var(--text); font: inherit; font-size: 14px; outline: none; padding: 2px; }
.lsel select option { background: #14121c; }
.lhero { text-align: center; margin: 4px 0 10px; }
#logoImg { display: block; width: min(440px, 86vw, 42vh); height: auto; margin: 0 auto; filter: drop-shadow(0 5px 10px rgba(0,0,0,0.65)); } /* (a painted logo, 1000 x 411: smooth, not pixelated) */
@media (max-aspect-ratio: 3/4) { #logoImg { width: min(440px, 80vw); } }
.logo { font-family: var(--font-pixel); margin: 6px 0 0; font-size: clamp(30px, 8.4vw, 58px); line-height: 0.96; letter-spacing: 3px; display: flex; flex-direction: column; align-items: center;
  color: #ffd86b; background: linear-gradient(180deg, #fff3b0 0%, #ffd86b 40%, #f0a23a 70%, #c9661f 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(3px 3px 0 #5a2410) drop-shadow(0 0 1px #000) drop-shadow(0 8px 14px rgba(0,0,0,0.65)); animation: logoin 0.8s ease-out; }
.logo span:last-child { font-size: 1.22em; letter-spacing: 0.3em; margin-right: -0.3em; }
@keyframes logoin { from { opacity: 0; transform: translateY(-10px) scale(0.96); } to { opacity: 1; transform: none; } }
.lhero .sub { margin: 8px 0 0; color: #e9ddff; font-size: 14px; text-shadow: 0 1px 3px #000; }
.lcard { width: min(400px, 100%); padding: 18px 18px 12px; border-radius: 16px; background: rgba(20,17,32,0.9); border: 1px solid rgba(255,207,74,0.35);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 18px 40px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.06); backdrop-filter: blur(6px); animation: cardin 0.5s ease-out 0.1s both; }
@keyframes cardin { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.lcard h2 { margin: 0 0 12px; text-align: center; font-size: 20px; font-weight: 600; color: var(--accent); letter-spacing: 0.5px; }
.lcard h2::before, .lcard h2::after { content: '✦'; font-size: 11px; vertical-align: 3px; margin: 0 8px; color: #b48bff; }
#login label { display: block; text-align: left; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
#login input:not([type=checkbox]) { display: block; width: 100%; margin-top: 4px; padding: 11px 12px; font: inherit; font-size: 16px; color: var(--text);
  background: rgba(8,7,14,0.85); border: 1px solid var(--edge); border-radius: 10px; outline: none; -webkit-user-select: text; user-select: text; transition: border-color 0.15s, box-shadow 0.15s; }
#login input:not([type=checkbox]):focus { border-color: #ffcf4a; box-shadow: 0 0 0 3px rgba(255,207,74,0.18); }
#login input.bad { border-color: #f87171; } #login input.good { border-color: #4ade80; }
#login .pw { position: relative; display: block; }
#login .pw input { padding-right: 42px; }
#login .eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); margin-top: 2px; width: 34px; height: 32px; border: 0; background: transparent; font-size: 16px; opacity: 0.6; border-radius: 8px; }
#login .eye.on { opacity: 1; }
#login .lrow { display: flex; justify-content: space-between; align-items: center; margin: -2px 0 10px; }
#login .chk { display: inline-flex; align-items: center; gap: 6px; margin: 0; cursor: pointer; }
#login .chk input { width: 16px; height: 16px; accent-color: #ffcf4a; }
#login .agree { align-items: flex-start; margin: 4px 0 12px; line-height: 1.4; }
#login .agree input { margin-top: 2px; flex: none; }
#login .caps { font-size: 12px; color: #fbbf24; }
#login a { color: #fde68a; }
#login .fieldmsg { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); min-height: 1.1em; }
#login .fieldmsg.ok { color: #86efac; } #login .fieldmsg.bad { color: #fca5a5; }
.pwmeter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 6px; }
.pwmeter i { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.12); transition: background 0.2s; }
.pwmeter[data-s="1"] i:nth-child(-n+1) { background: #f87171; } .pwmeter[data-s="2"] i:nth-child(-n+2) { background: #fbbf24; }
.pwmeter[data-s="3"] i:nth-child(-n+3) { background: #4ade80; } .pwmeter[data-s="4"] i { background: #22d3ee; }
#play, #suBtn { width: 100%; padding: 12px; font-size: 18px; font-weight: 600; letter-spacing: 1px; color: #2a1606; border-radius: 12px;
  background: linear-gradient(180deg, #ffe69a, #f5b941 55%, #e0902b); border: 1px solid #ffeec2; box-shadow: 0 4px 0 #8a4a14, 0 6px 16px rgba(240,160,60,0.35); }
#play:active, #suBtn:active { transform: translateY(2px); box-shadow: 0 2px 0 #8a4a14; }
#play:disabled, #suBtn:disabled { filter: grayscale(0.7); cursor: wait; }
/* Continue with Google (index.html #gBox / #gBox2 / #paneGoogle; shown only when the server offers it — main.js) */
.gbox { margin-top: 10px; }
/* (the pane is 78 px taller with the button: while Google is offered the empty error line takes no room, two margins shrink, and a short / narrow screen drops the keyboard hint — a 1280 x 720 desktop and an upright phone still do not scroll) */
#login.gon #loginErr:empty { display: none; } #login.gon #paneLogin .lswitch { margin-top: 6px; } #login.gon .lserver { margin-top: 4px; }
@media (max-height: 760px), (max-width: 480px) { #login.gon .controls { display: none; } }
@media (max-width: 480px) { #login.gon #gBox .gor { display: none; } #login.gon .lfoot { margin-top: 8px; } #login.gon .lhero { margin-bottom: 4px; } #login.gon #paneLogin h2 { margin-bottom: 8px; } #login.gon #loginForm > label { margin-bottom: 8px; } }
#login a.gbtn, #login a.gbtn:visited { color: #1f1f1f; }
.gor { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.gor::before, .gor::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.14); }
.gbtn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; box-sizing: border-box; padding: 9px 12px; border-radius: 12px; font-size: 16px; font-weight: 600; text-decoration: none; color: #1f1f1f; background: #fff; border: 1px solid #dadce0; }
.gbtn:hover { background: #f1f3f4; } .gbtn:active { transform: translateY(1px); }
.gico { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-weight: 700; font-size: 14px; line-height: 1; color: #fff; background: #4285f4; }
.lbtn { width: 100%; padding: 12px; font-size: 18px; font-weight: 600; letter-spacing: 1px; color: #2a1606; border-radius: 12px;
  background: linear-gradient(180deg, #ffe69a, #f5b941 55%, #e0902b); border: 1px solid #ffeec2; box-shadow: 0 4px 0 #8a4a14, 0 6px 16px rgba(240,160,60,0.35); }
.lbtn:active { transform: translateY(2px); box-shadow: 0 2px 0 #8a4a14; } .lbtn:disabled { filter: grayscale(0.7); cursor: wait; }
#paneGoogle .gwho { margin: 0 0 10px; text-align: center; font-size: 14px; color: var(--muted); } #paneGoogle .gwho b { color: var(--text); font-weight: 500; word-break: break-all; }
#gHave { margin-top: 12px; font-size: 14px; } #gHave summary { cursor: pointer; text-align: center; color: var(--accent); font-weight: 600; } #gHave .ghint { margin: 8px 0; font-size: 13px; color: var(--muted); }
.lswitch { text-align: center; margin: 12px 0 4px; font-size: 14px; color: var(--muted); }
.lswitch a { font-weight: 600; }
.lserver { margin-top: 8px; font-size: 12px; color: var(--muted); text-align: center; }
.lserver summary { cursor: pointer; list-style: none; } .lserver summary::-webkit-details-marker { display: none; }
.lserver summary b { color: #a5f3fc; font-weight: 500; }
.lserver select { margin: 6px auto 0; display: block; width: 100%; }
.lfoot { display: flex; gap: 8px; justify-content: center; margin-top: 14px; font-size: 13px; }
.lfoot a { color: #cbd5e1; text-decoration: none; } .lfoot a:hover { color: var(--accent); }
#login .controls { margin-top: 10px; text-align: center; max-width: 520px; color: rgba(226,232,240,0.92); text-shadow: 0 1px 2px #000, 0 0 6px rgba(0,0,0,0.9); }
.lfoot a, .lfoot span { text-shadow: 0 1px 2px #000, 0 0 6px rgba(0,0,0,0.9); }
body.touch #login .controls { display: none; }
@media (max-height: 640px) { .logo { font-size: 30px; } #logoImg { width: min(300px, 86vw); } .lhero .sub { display: none; } }
/* a phone held sideways: the title on one line, a narrower card — the heroes at both sides stay in view */
@media (max-height: 480px) and (min-aspect-ratio: 4/3) { .logo { flex-direction: row; gap: 0.4em; font-size: 24px; } .logo span:last-child { font-size: 1em; letter-spacing: 3px; margin-right: 0; } .lhero { margin: 0 0 6px; } #logoImg { width: auto; height: 66px; } .lcard { width: min(330px, 100%); padding: 12px 14px 8px; } }
#login .lsel { display: inline-flex; margin: 0; color: var(--text); }
#login .lserver select { padding: 6px 8px; border-radius: 8px; background: rgba(8,7,14,0.85); color: var(--text); border: 1px solid var(--edge); font: inherit; font-size: 13px; }
/* the character screens over the drifting capital: the same dusk veil and card as the login */
body:has(#charsel:not([hidden])) canvas#game, body:has(#charnew:not([hidden])) canvas#game { filter: brightness(0.5) saturate(0.85); }
#charsel.panel, #charnew.panel { border-radius: 16px; border: 1px solid rgba(255,207,74,0.35); background: rgba(20,17,32,0.9);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 18px 40px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.06); backdrop-filter: blur(6px); }

/* the Item Shop (ui.js render_cash, docs/ITEM_SHOP.md): wallet chips, tabs, cards, the PromptPay QR */
#panels #p_cash { flex-basis: 560px; }
#topbar button.tbcash span { color: #a5f3fc; }
#p_cash .cswallet { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
#p_cash .cswallet > span { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--edge); background: #15121f; font-variant-numeric: tabular-nums; }
#p_cash .cscr { border-color: #22d3ee88 !important; color: #a5f3fc; }
#p_cash .cssh { border-color: #facc1588 !important; color: #fde68a; }
#p_cash .csauto { font-size: 12px; color: var(--muted); }
#p_cash .cstop { margin-left: auto; border-color: #22d3ee; color: #a5f3fc; }
#p_cash .cstabs { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 8px; }
#p_cash .cstabs button { flex: 1 1 auto; }
#p_cash .csgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
#p_cash .cswide { grid-column: 1 / -1; margin: 0; }
#p_cash .csclosed { padding: 8px; border: 1px dashed #f59e0b88; border-radius: 6px; color: #fde68a; text-align: center; }
#p_cash .cscard { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 8px 8px; text-align: center;
  border: 1px solid var(--edge); border-radius: 8px; background: linear-gradient(180deg, #1d1830, #13101d); }
#p_cash .cscard:hover { border-color: var(--edge-hi); }
#p_cash .cscard.out { opacity: 0.55; }
#p_cash .cscard.pack { grid-column: span 2; background: linear-gradient(135deg, #2a1f0a, #15121f); border-color: #d4af37; }
#p_cash .csic { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: radial-gradient(circle, #ffffff18, transparent 70%); }
#p_cash .csic img { width: 36px; height: 36px; image-rendering: pixelated; }
#p_cash .csic i { font-style: normal; font-size: 28px; }
#p_cash .csname { font-size: 13.5px; }
#p_cash .csdesc { margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.35; flex: 1; }
#p_cash .cslim { font-size: 11px; color: #93c5fd; } #p_cash .cslim.out { color: #f87171; }
#p_cash .csbonus { color: #4ade80; font-weight: 700; }
#p_cash .cspack { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
#p_cash .cspack img { width: 22px; height: 22px; image-rendering: pixelated; vertical-align: middle; }
/* (next n426b) the growth pack's steps: one line each - level, crystals, items; a claimed step dimmed with its tick */
#p_cash .csgrow { display: flex; flex-direction: column; gap: 3px; width: 100%; margin: 6px 0 2px; font-size: 12px; }
#p_cash .csgr { display: flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); white-space: nowrap; }
#p_cash .csgr b { min-width: 38px; color: #fde68a; }
#p_cash .csgr img { width: 18px; height: 18px; image-rendering: pixelated; vertical-align: middle; }
#p_cash .csgr .lri { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; }
#p_cash .csgr.got { opacity: 0.5; }
#p_cash .csbuy { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; width: 100%; margin-top: 4px; }
#p_cash .csbuy .buy { flex: 1; font-weight: 700; border-color: #22d3ee; background: linear-gradient(180deg, #155e75, #0e3a4a); color: #ecfeff; }
#p_cash .csbuy .buy:disabled { filter: grayscale(0.8); opacity: 0.6; }
#p_cash .csbuy s { opacity: 0.6; font-weight: 400; }
#p_cash .cstag { position: absolute; top: -7px; right: 6px; padding: 0 6px; border-radius: 6px; background: #f97316; color: #fff; font-size: 10.5px; font-style: normal; font-weight: 700; }
#p_cash .cstag.sale { background: #dc2626; } #p_cash .cstag.best { background: #16a34a; }
#p_cash .csgift { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; margin-top: 4px; }
#p_cash .csgift input { flex: 1 1 100%; min-width: 0; }
/* (next n250) ITEM SHOP V2 - the painted window (A-1942 .. A-1948; docs/business/item-shop-v2-design-th.md): the frame and the cards stretch
   (border-image), a card's frame follows its tier, the pictures come from client/assets/ui/shopv2_* */
#panels #p_cash { flex-basis: 680px; border: 26px solid transparent; border-image: url('/assets/ui/shopv2_frame.png') 46 fill / 26px stretch; background: #0d1433; padding: 0 6px 6px; }
#p_cash header { margin: -8px -6px 8px; min-height: 52px; justify-content: center; border: none; background: url('/assets/ui/shopv2_title.png') center / auto 100% no-repeat; box-shadow: none; }
#p_cash header > span { padding: 14px 70px 8px; font-size: 16px; color: #fde68a; } #p_cash header > span::before { content: none; }
#p_cash header .x { position: absolute; right: 0; top: 6px; width: 34px; height: 34px; border: none; border-radius: 50%; background: url('/assets/ui/shopv2_close.png') center / contain no-repeat; color: transparent; }
#p_cash img.cur { width: 18px; height: 18px; object-fit: contain; vertical-align: -4px; }
#p_cash .cswallet > span:not(.csauto) { border: 8px solid transparent !important; border-image: url('/assets/ui/shopv2_wallet.png') 30 fill / 8px stretch; background: none; border-radius: 0; padding: 0 6px; }
#p_cash .cstop { border: none; background: url('/assets/ui/shopv2_topbtn.png') center / 100% 100% no-repeat; color: #fff; font-weight: 700; padding: 6px 16px; text-shadow: 0 1px 0 #075985; }
#p_cash .cstabs { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 4px; } /* (n250b: equal columns, any count) */ #p_cash .cstabs button { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; padding: 5px 2px 4px; border: none; border-radius: 0; background: url('/assets/ui/shopv2_tab.png') center / 100% 100% no-repeat; font-size: 11px; }
#p_cash .cstabs button img { width: 28px; height: 28px; object-fit: contain; } #p_cash .cstabs button.on { background-image: url('/assets/ui/shopv2_tab_on.png'); color: #3b2300; font-weight: 700; text-shadow: 0 1px 0 #fde68a; }
#p_cash .csbanner { position: relative; aspect-ratio: 3 / 1; max-height: 210px; margin: 2px 0 8px; border-radius: 10px; border: 2px solid #b8923f; background: center / cover no-repeat; box-shadow: inset 0 0 0 1px #0007; }
#p_cash .csbplate { position: absolute; left: 3%; top: 27%; width: 36%; height: 34%; /* (n250b: below the plate's gem) */ display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 2px; }
#p_cash .csbplate b { font-size: clamp(13px, 2.6vw, 20px); color: #fde68a; text-shadow: 0 2px 0 #3b0a0a, 0 0 8px #000; } #p_cash .csbplate small { font-size: clamp(9px, 1.5vw, 12px); color: #fff7e0; text-shadow: 0 1px 2px #000; line-height: 1.2; }
#p_cash .cstools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } #p_cash .cstools input { flex: 1 1 160px; min-width: 0; } #p_cash .cstools .seg button { padding: 4px 10px; }
#p_cash .csgrid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 10px; }
#p_cash .cscard[class*=" tier"] { border: 16px solid transparent; border-image-slice: 40 fill; border-image-width: 16px; border-image-repeat: stretch; background: none; padding: 2px 2px 4px; border-radius: 0; }
#p_cash .cscard.tier1 { border-image-source: url('/assets/ui/shopv2_card_1.png'); } #p_cash .cscard.tier2 { border-image-source: url('/assets/ui/shopv2_card_2.png'); }
#p_cash .cscard.tier3 { border-image-source: url('/assets/ui/shopv2_card_3.png'); } #p_cash .cscard.tier4 { border-image-source: url('/assets/ui/shopv2_card_4.png'); }
#p_cash .cscard[hidden] { display: none; } #p_cash .cscard .csrb { position: absolute; left: -14px; top: -14px; width: 42px; pointer-events: none; z-index: 1; }
#p_cash .csic { width: auto; height: 104px; background: none; } #p_cash .csic img.csart { width: 104px; height: 104px; object-fit: contain; image-rendering: auto; }
#p_cash .csped { position: relative; display: block; width: 104px; height: 104px; } #p_cash .csped .ped { position: absolute; left: 0; bottom: 0; width: 104px; image-rendering: auto; }
#p_cash .csped .pi { position: absolute; left: 30px; top: 18px; width: 44px; height: 44px; image-rendering: pixelated; filter: drop-shadow(0 4px 6px #0009); }
#p_cash .csname { color: #fde68a; } #p_cash .csdesc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; flex: 0 0 auto; max-height: 2.8em; } #p_cash .csdesc.full { display: block; max-height: none; } /* (n252: two lines - it no longer grows with the card) */
/* (next n313) the try-on stage: the hero with the look on, a turn and a compare button */
#p_cash .cstry { background: #141a33; border: 1px solid #a78bfa; border-radius: 10px; padding: 10px 12px; margin: 0 0 8px; text-align: center; }
#p_cash .cstry canvas { display: block; margin: 4px auto; width: 280px; max-width: 100%; height: auto; background: radial-gradient(ellipse at 50% 85%, #3b2f6b 0, #141a33 65%); border-radius: 8px; image-rendering: pixelated; }
#p_cash .cstrybtns { display: flex; justify-content: center; gap: 8px; margin: 4px 0; } #p_cash .cstrybtns button { padding: 4px 12px; font-size: 12.5px; }
#p_cash .csodds li .cstryb { padding: 1px 6px; font-size: 12px; margin-right: 4px; }
/* (next n312) a random box: the "contents & odds" button on its card, and the list it opens */
#p_cash .csoddsb { align-self: center; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; margin: 2px 0 4px; padding: 3px 10px; font-size: 11.5px; border-radius: 999px; border: 1px solid #fbbf24; background: #3b2a0a; color: #fde68a; cursor: pointer; }
#p_cash .csodds { background: #141a33; border: 1px solid #fbbf24; border-radius: 10px; padding: 10px 12px; margin: 0 0 8px; }
#p_cash .csodt { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: #fde68a; margin-bottom: 6px; } #p_cash .csodt button { padding: 3px 10px; font-size: 12px; white-space: nowrap; flex: 0 0 auto; }
#p_cash .csodds ul { list-style: none; margin: 0 0 6px; padding: 0; } #p_cash .csodds li { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px solid #ffffff12; font-size: 12.5px; }
#p_cash .csodds li img { width: 24px; height: 24px; image-rendering: pixelated; flex: 0 0 24px; } #p_cash .csodds li span { flex: 1; min-width: 0; } #p_cash .csodds li b { color: #fde68a; white-space: nowrap; }
#p_cash .csodds li.csodh { color: #c4b5fd; font-weight: bold; border-bottom: none; padding-top: 6px; } #p_cash .csodds li.csodn { color: var(--muted); font-size: 11.5px; padding-left: 32px; } #p_cash .csodds p { margin: 2px 0; }
#p_cash .csbuy .buy { border: none; background: url('/assets/ui/shopv2_buy.png') center / 100% 100% no-repeat; color: #3b2300; text-shadow: 0 1px 0 #fde68a; padding: 6px 10px; }
#p_cash .csbuy .buy:disabled { background-image: url('/assets/ui/shopv2_buy_off.png'); color: #e5e7eb; text-shadow: none; filter: none; opacity: 0.85; }
#p_cash .csqr { margin: 0 0 10px; padding: 10px; text-align: center; border: 2px solid #22d3ee; border-radius: 10px; background: #0b1220; }
#p_cash .csqr h4 { margin: 0 0 6px; color: #a5f3fc; }
#p_cash .csqr img { width: 220px; max-width: 100%; image-rendering: pixelated; background: #fff; padding: 6px; border-radius: 6px; }
#p_cash .csmsg { color: #fde68a; }
#p_cash .cshist td { padding: 3px 4px; border-bottom: 1px solid #ffffff12; font-size: 12px; }
#p_cash .cshist td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
#p_cash .cshist .up { color: #4ade80; } #p_cash .cshist .down { color: #fca5a5; }
#p_cash .csrules { margin-top: 10px; }
@media (max-width: 600px) { #p_cash .csgrid { grid-template-columns: repeat(2, 1fr); } #p_cash .cscard.pack { grid-column: 1 / -1; } }
/* the Third Army's orders (ui.js armyBar) */
#armybar { position: fixed; left: 50%; bottom: 128px; transform: translateX(-50%); display: flex; gap: 6px; z-index: 6; }
#armybar button { font: inherit; font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 8px; border: 2px solid #166534; background: rgba(20,83,45,0.85); color: #dcfce7; cursor: pointer; }
#armybar button.on { background: #22c55e; color: #052e16; border-color: #bbf7d0; }
@media (max-width: 700px) { #armybar { bottom: 170px; } #armybar button { font-size: 12px; padding: 5px 9px; } }
/* the Vip Card (ui.js render_vip) */
.vipbadge { margin-left: 6px; font: inherit; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 10px; border: 1px solid #a855f7; background: linear-gradient(90deg, #0c0a14, #3b0764); color: #e9d5ff; cursor: pointer; box-shadow: 0 0 8px rgba(168,85,247,0.6); }
.vipstate { padding: 10px 12px; border-radius: 10px; background: #18121f; border: 1px solid #3f3f46; margin-bottom: 8px; display: flex; flex-direction: column; gap: 4px; }
.vipstate.on { background: linear-gradient(120deg, #0c0a14, #2e1065); border-color: #a855f7; color: #f3e8ff; font-weight: 700; box-shadow: 0 0 14px rgba(147,51,234,0.45) inset; }
.vipstate small { font-weight: 400; color: #c4b5fd; }
.vipperks { margin: 0 0 8px; padding-left: 18px; columns: 2; font-size: 12px; color: #e9d5ff; }
table.viptiers { width: 100%; border-collapse: collapse; margin: 0 0 10px; font-size: 12px; color: #e9d5ff; } /* (next n224: the three tiers side by side) */
table.viptiers th, table.viptiers td { padding: 3px 6px; border-bottom: 1px solid rgba(233,213,255,0.12); text-align: center; }
table.viptiers td:first-child, table.viptiers th:first-child { text-align: left; color: #c4b5fd; }
table.viptiers th small { display: block; font-weight: 400; color: #a5b4fc; }
table.viptiers .on { background: rgba(251,191,36,0.16); color: #fde68a; font-weight: 700; }
.vipopt { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 12px; color: #e9d5ff; cursor: pointer; } /* the quest warp's switch */
.vipremote { display: flex; gap: 8px; margin: 0 0 10px; } .vipremote button { flex: 1; font: inherit; font-size: 13px; padding: 7px 8px; } /* the merchant / the storage from anywhere */
.viptrial, .vipnote { margin: 0 0 8px; font-size: 12px; }
.vipwarp { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 6px; max-height: 210px; overflow-y: auto; }
.vipwarp button { display: flex; flex-direction: column; align-items: flex-start; text-align: left; font: inherit; font-size: 12px; padding: 5px 8px; }
.vipwarp small, .vipmark small { color: #a1a1aa; font-size: 11px; }
.vipmarkadd { display: flex; gap: 6px; margin-bottom: 6px; } .vipmarkadd input { flex: 1; min-width: 0; }
.vipmarks { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.vipmark { display: flex; align-items: center; gap: 6px; } .vipmark span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.vippresets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.vippreset { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px; border-radius: 8px; background: #1c1917; border: 1px solid #44403c; }
.vippreset b { width: 100%; } .vippreset.locked { opacity: 0.55; }

/* ---- Skill Tree window (client/js/treeui.js) — Phase 4C-5C ---- */
#panels #p_tree { flex: 0 1 660px; }
@media (pointer: coarse), (max-width: 900px) { #panels #p_tree { flex: none; } }
body.touch #panels #p_tree { flex: none; }
#p_tree .trpts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0 6px; }
#p_tree .trpts b { color: #fff; }
#p_tree .trpts .main b { color: var(--accent); font-size: 15px; }
#p_tree .trjob { margin: 8px 0 4px; font-weight: 700; color: #9ecbff; }
#p_tree .trjob small { color: var(--muted); font-weight: 400; margin-left: 6px; }
#p_tree .trbranches { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
#p_tree .trbranch { border: 1px solid var(--edge); background: rgba(0,0,0,0.2); padding: 4px; min-width: 0; }
#p_tree .trbranch > h4 { margin: 0 0 4px; font-size: 12px; display: flex; justify-content: space-between; color: var(--accent); }
#p_tree .trbranch > h4 small { color: var(--muted); font-weight: 400; }
#p_tree .trnode { display: flex; align-items: center; gap: 6px; width: 100%; margin: 0 0 3px; padding: 3px 4px; text-align: left; border: 1px solid var(--edge); background: #1b1728; color: inherit; min-height: 40px; }
#p_tree .tric { flex: none; width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--edge-hi); background: #0c0b12; display: flex; align-items: center; justify-content: center; font-size: 15px; overflow: hidden; }
#p_tree .tric img { width: 100%; height: 100%; object-fit: cover; }
#p_tree .trnode .trnm { flex: 1; min-width: 0; font-size: 11px; line-height: 1.2; overflow: hidden; }
#p_tree .trnode .trnm small { display: block; color: var(--muted); font-size: 10px; }
#p_tree .trnode .trrk { flex: none; font-size: 11px; font-weight: 700; }
#p_tree .trnode.locked { opacity: 0.55; }
#p_tree .trnode.avail { border-color: #4ade80; }
#p_tree .trnode.owned { border-color: var(--accent); background: #2a2440; }
#p_tree .trnode.max { border-color: #f59e0b; background: #3a2f18; }
#p_tree .trnode.cap .tric { border-color: #f59e0b; color: #fbbf24; }
#p_tree .trnode.sel { outline: 2px solid #fff; outline-offset: -2px; }
#p_tree .trnode.pending { opacity: 0.6; }
#p_tree .trrow { border-top: 1px dashed var(--edge); margin-top: 3px; padding-top: 3px; }
#p_tree .trrow:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
#p_tree .trutil { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; margin-top: 6px; }
#p_tree .trdetail { position: sticky; bottom: -10px; margin: 8px -10px -10px; padding: 8px 10px 10px; max-height: 44vh; overflow-y: auto; background: #171325; border-top: 2px solid var(--edge-hi); } /* (opaque: the rows under the card must not show through its text) */
#p_tree .trdetail h3 { margin: 0 0 2px; font-size: 14px; color: #fff; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#p_tree .trdetail .tag { font-size: 10px; font-weight: 400; padding: 1px 5px; border: 1px solid var(--edge-hi); border-radius: 8px; color: var(--muted); }
#p_tree .trdetail .tag.avail { color: #4ade80; border-color: #4ade80; } #p_tree .trdetail .tag.owned { color: var(--accent); border-color: var(--accent); } #p_tree .trdetail .tag.max { color: #f59e0b; border-color: #f59e0b; }
#p_tree .trdetail p { margin: 3px 0; font-size: 12px; line-height: 1.4; }
#p_tree .trdetail .lines { color: #ddd6f5; } #p_tree .trdetail .lines b { color: var(--muted); font-weight: 400; }
#p_tree .trdetail .skl { color: var(--muted); font-size: 11px; }
#p_tree .trdetail .buy { margin-top: 4px; padding: 6px 12px; font-size: 13px; }
#p_tree .trreset { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--edge); }
#p_tree .trreset .row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
#p_tree .trreset button.free { background: #166534; border-color: #4ade80; color: #fff; }
#p_tree .trconfirm { position: sticky; top: 44px; z-index: 3; margin: 6px 0; padding: 10px; background: #2b1220; border: 2px solid #f87171; box-shadow: 0 6px 18px rgba(0,0,0,0.6); }
#p_tree .trconfirm .row { display: flex; gap: 8px; margin-top: 8px; } #p_tree .trconfirm button { flex: 1; padding: 8px; font-size: 13px; }
#p_tree .trconfirm button.yes { background: #b91c1c; color: #fff; border-color: #f87171; }
/* narrow screens / touch: the windows scroll as one column (#panels), so the node's card is a sheet above the hotbar and the confirmation sits in the middle of the screen */
@media (pointer: coarse), (max-width: 900px) {
  #p_tree .trdetail.on { position: fixed; left: 8px; right: 8px; bottom: 78px; margin: 0; max-height: 38vh; z-index: 12; border: 2px solid var(--edge-hi); box-shadow: 0 -6px 18px rgba(0,0,0,0.6); }
  #p_tree .trconfirm { position: fixed; left: 12px; right: 12px; top: 22vh; z-index: 13; }
  #p_tree.hasdetail { padding-bottom: 40vh; }
}
body.touch #p_tree .trdetail { background: #15111f; } /* (opaque on phones, as every window there) */
#p_tree .trdetail .trx { margin-left: auto; width: 24px; height: 22px; padding: 0; }
.treeopen { margin: 0 0 6px; width: 100%; }
.skill .fromtree { font-size: 10px; color: #4ade80; }
/* Skill Mastery (TEST, Phase 2D) — appended; nothing above is changed */
.skill .mst { flex: none; padding: 0 6px; border: 1px solid var(--accent); border-radius: 9px; font-size: 10px; font-weight: 700; line-height: 15px; white-space: nowrap; color: var(--accent); background: rgba(255, 207, 74, 0.12); }
.skill .mst.dorm { color: var(--muted); border-color: var(--edge); background: none; opacity: 0.8; }
.bar.mst { height: 12px; margin: 5px 0 0; }
.bar.mst i { background: linear-gradient(var(--accent), #a8731a); opacity: 0.85; }
.bar.mst span { font-size: 10px; line-height: 12px; }
.bar.mst.cap i { background: linear-gradient(#8d8d8d, #555); } /* today's cap reached: the bar rests */
.bar.mst.max i { background: linear-gradient(#ffe9a6, var(--accent)); opacity: 1; }
.skill .mst.max { color: #1a1206; background: var(--accent); }
.skill .mstnote { color: #ffb36b; }
.pts + .msthint { margin: -2px 0 6px; font-size: 11px; line-height: 1.35; color: var(--muted); }
body.touch .win .skill .mst { padding: 1px 8px; border-radius: 11px; font-size: 12px; line-height: 18px; }
body.touch .win .bar.mst { height: 16px; } body.touch .win .bar.mst span { font-size: 11px; line-height: 16px; }
body.touch .win .msthint { font-size: 12px; }

/* ===== ui1: one look for every window (the pieces) + the hero's sheet =====
   The base (frame, header, plain button) is further up, after the old base rules. Here: the pieces that windows
   share - a main button, a group of choices, a row of a list, text fields, cards, tables, item squares - and the
   phone's sizes. A rule written with :where() is a default: a window's own rule for the same piece wins. */
/* phones: a window is opaque (the HUD must not show through the text), its header a hand high */
body.touch #panels .win { background: var(--u-frame-solid); }
body.touch .win header { min-height: 48px; margin: 0 -12px 10px; padding: 0 4px 0 14px; font-size: 16px; } /* (a window's padding is 12 px there) */
body.touch .win .x { width: 46px; height: 40px; font-size: 24px; }
body.touch .win button { min-height: 40px; }
/* (where #panels is what scrolls, ux1 made the header opaque with a flat colour: the band is opaque too, and it is the look) */
html body #panels .win > header:first-child { background: var(--u-band); }
/* headings and quiet text inside a window */
:where(.win) h4 { margin: 14px 0 6px; font-size: 13px; letter-spacing: 0.3px; color: var(--u-gold); }
:where(.win) .muted { color: var(--u-dim); }
:where(.win) p { line-height: 1.45; }
/* the main button of a window, and a button that asks "are you sure?" */
.win button.big, .win button.primary { border: 1px solid #7a4d00; border-radius: 10px; background: var(--u-primary); color: #2a1804; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 0 0 1px var(--u-ink), 0 4px 10px rgba(0, 0, 0, 0.45); }
.win button.warn { border-color: #fca5a5; background: linear-gradient(#b91c1c, #7f1d1d); color: #fff; }
/* three looks of their own that the new base would take away: the Sell tab's main button, AUTO's skill slots, a chip */
.win .sellgo { border: 2px solid #fde68a; border-radius: 9px; background: linear-gradient(180deg, #fde68a 0%, #f5b83d 45%, #d98a0b 100%); color: #2a1804; }
.win .askslot { padding: 3px 2px; border: 1px solid #a8872f; border-radius: 8px; background: radial-gradient(#2c2440, #0b0a11); box-shadow: none; }
.win .chip { padding: 2px 9px; font-size: 12px; border: 1px solid #3b4d8a; border-radius: 14px; background: #141a33; color: #a3b1d6; box-shadow: none; }
.win .chip.on { color: #fde68a; border-color: #fbbf24; background: rgba(251, 191, 36, 0.14); }
#p_char .autostat { margin-left: 8px; padding: 5px 12px; font-size: 12.5px; font-weight: 700; border: 1px solid #7a4d00; background: var(--u-primary); color: #2a1804; }
/* + : spend a point */
.win .plus { width: 28px; height: 28px; border-radius: 50%; font-size: 17px; line-height: 1; border: 1px solid #7a4d00; background: var(--u-primary); color: #2a1804; }
.win .plus:disabled { border-color: #3b4a86; background: #1a2142; color: #6b78a8; opacity: 1; box-shadow: none; }
body.touch .win .plus { min-width: 44px; width: 44px; min-height: 40px; height: 40px; border-radius: 12px; }
/* a group of choices: one track, the chosen one in gold */
.win .seg { flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 11px; background: rgba(5, 8, 18, 0.7); border: 1px solid #2c3766; }
.win .seg button { border: 1px solid transparent; border-radius: 8px; background: transparent; box-shadow: none; color: var(--u-dim); white-space: nowrap; }
.win .seg button.on { border-color: #7a4d00; background: var(--u-primary); color: #2a1804; font-weight: 700; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5); }
/* (the Dungeons window's mode: the chosen one keeps its meaning - Hard orange, Hell red) */
.win .dgmodes button.m1.on { border-color: #9a3412; background: linear-gradient(180deg, #fdba74, #f97316); color: #2a1804; }
.win .dgmodes button.m2.on { border-color: #fca5a5; background: linear-gradient(180deg, #ef4444, #991b1b); color: #fff; box-shadow: 0 0 8px rgba(239, 68, 68, 0.45); }
/* a row of a list: a setting, a thing for sale */
.setrow { flex-wrap: wrap; gap: 6px 10px; padding: 9px 2px; border-bottom: 1px solid rgba(150, 170, 255, 0.1); }
.setrow > span:first-child { flex: 1 1 110px; min-width: 0; line-height: 1.3; }
.setrow .seg { flex: none; max-width: 100%; margin-left: auto; }
#panels #p_settings { flex-basis: 400px; }
@media (pointer: coarse), (max-width: 900px) { #panels #p_settings { flex: none; } }
body.touch #panels #p_settings { flex: none; }
/* (next n166) the volume sliders: as wide as the row gives, a thumb a finger finds; a vertical swipe still scrolls the window */
.volset { flex: 1 1 170px; max-width: 280px; margin-left: auto; display: flex; align-items: center; gap: 8px; }
.volset .volpct { flex: none; width: 40px; text-align: right; font-size: 12px; color: var(--u-gold); font-variant-numeric: tabular-nums; }
input.volr { flex: 1; min-width: 100px; height: 28px; margin: 0; padding: 0; background: transparent; border: 0; touch-action: pan-y; -webkit-appearance: none; appearance: none; cursor: pointer; }
input.volr::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: rgba(150, 170, 255, 0.28); }
input.volr::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(150, 170, 255, 0.28); }
input.volr::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: var(--u-gold); border: 2px solid #1a1420; }
input.volr::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--u-gold); border: 2px solid #1a1420; }
body.touch input.volr { height: 36px; }
body.touch input.volr::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -10px; }
/* (next n168) the element chart: a ring in one line that wraps, a table that fits a phone */
.elchart .elc-ring { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 6px; margin: 6px 0 2px; font-size: 22px; }
.elc-node { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1; }
.elc-node small { font-size: 11px; color: var(--muted); }
.elc-arrow { font-style: normal; font-size: 14px; color: var(--u-gold); }
.elchart > p.muted { text-align: center; margin: 2px 0 8px; }
.elc-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.elc-t th, .elc-t td { padding: 6px 4px; text-align: left; border-bottom: 1px solid rgba(150, 170, 255, 0.14); font-weight: 400; }
.elc-t thead th { font-size: 11.5px; color: var(--muted); }
.elc-t tbody th { font-weight: 700; white-space: nowrap; }
.elc-el { white-space: nowrap; }
.elc-win b { color: #fb923c; } .elc-lose b { color: #94a3b8; }
#bossname.elc-tap { cursor: pointer; }
h4.setgrp { display: flex; align-items: center; gap: 8px; margin: 14px 0 2px; font-size: 11.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--u-gold); }
h4.setgrp:first-of-type { margin-top: 2px; }
h4.setgrp::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(233, 196, 106, 0.5), transparent); }
.shoprow { padding: 5px 2px; border-bottom: 1px solid rgba(150, 170, 255, 0.1); }
/* text fields, sliders, ticks */
:where(.win input:not([type=range]):not([type=checkbox]):not([type=radio]), .win select, .win textarea) { font: inherit; font-size: 13px; color: var(--u-text); min-width: 0;
  padding: 6px 10px; border: 1px solid #3b4a86; border-radius: 8px; background: rgba(5, 8, 18, 0.75); -webkit-user-select: text; user-select: text; }
.win .invrow input, .win .passbox input { padding: 6px 10px; border: 1px solid #3b4a86; border-radius: 8px; background: rgba(5, 8, 18, 0.75); color: var(--u-text); }
.win input:not([type=range]):not([type=checkbox]):not([type=radio]):focus, .win select:focus, .win textarea:focus { outline: none; border-color: var(--u-gold); box-shadow: 0 0 0 2px rgba(233, 196, 106, 0.25); }
.win .mkform input, .win .tgold input { padding-left: 8px; padding-right: 8px; } /* (the 90 px number fields keep room for nine digits) */
.win input::placeholder { color: #7482ad; }
.win input[type=range], .win input[type=checkbox], .win input[type=radio] { accent-color: #f0b429; }
body.touch .win input:not([type=range]):not([type=checkbox]):not([type=radio]), body.touch .win select { min-height: 40px; font-size: 16px; }
/* small words on a button or under a square: readable on the new blue (the old quiet violet read 3.5 : 1 there) */
.win button small, .akinds small { color: #c9d3f0; }
.win button.on small, .win .seg button.on small { color: inherit; }
.akinds button.on small { color: #c9d3f0; }
.dslot small { color: var(--u-dim); }
/* cards: a skill, a job, a letter, a day of the calendar, a side of a trade */
.skill, .jobcard, #p_bank .mailrow, #p_trade .tside, #p_login .lday { border: 1px solid var(--u-line); border-radius: 10px; background: var(--u-card); }
.skill { padding: 9px 10px; margin-bottom: 8px; }
.jobcard { padding: 10px; margin-bottom: 8px; }
#p_bank .mailrow.unread, #p_login .lday.today { border-color: var(--u-gold); }
#p_login .lday.big { background: linear-gradient(135deg, rgba(120, 80, 10, 0.45), var(--u-card)); border-color: var(--u-rim); }
/* the Skill Tree's resting card at the window's foot: the frame's own navy and gold (on phones the window's padding is 12 px: it reaches the edges there too) */
#p_tree .trdetail { background: #131b3b; border-top: 2px solid var(--u-rim); }
body.touch #p_tree .trdetail { bottom: -12px; margin: 8px -12px -12px; padding: 8px 12px 12px; background: #131b3b; }
/* tables: bosses, rankings */
#p_warp .bosstable td, #p_rank .ranktable td { padding: 6px 6px; border-bottom: 1px solid rgba(150, 170, 255, 0.1); }
#p_rank .ranktable tr.me td { background: rgba(233, 196, 106, 0.16); color: var(--u-gold-hi); }
/* item squares outside the bag (the bag has its own) */
:where(.win) .slot { border-radius: 7px; border-color: #36406e; background: linear-gradient(#1a2142, #0b0e1c); }
:where(.win) .slot.sel { border-color: var(--u-gold-hi); box-shadow: 0 0 0 1px var(--u-gold-hi), 0 0 10px rgba(255, 207, 74, 0.5); }
/* the menu sheet (phones): the same navy, a tile with a gold rim under a finger */
body.touch #mmenu:not([hidden]) { background: linear-gradient(180deg, rgba(18, 25, 50, 0.96), rgba(8, 10, 22, 0.97)); }
#mmenu header { padding: 0 0 8px; border-bottom: 1px solid rgba(233, 196, 106, 0.35); color: #fdf3d0; text-shadow: 0 0 10px rgba(233, 196, 106, 0.45); }
#mmenu header button { border: 1px solid #fca5a5; border-radius: 10px; background: linear-gradient(#dc2626, #7f1d1d); color: #fff; }
.mtile { border: 1px solid #4a5a94; background: linear-gradient(180deg, rgba(42, 58, 110, 0.75), rgba(16, 22, 43, 0.85)); color: var(--u-text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 0 rgba(0, 0, 0, 0.45); }
.mtile:active { border-color: var(--u-gold); box-shadow: 0 0 0 1px var(--u-gold), 0 0 12px rgba(233, 196, 106, 0.4); }

/* ---- the hero's sheet (ui.js render_char): the status card's portrait opens it ---- */
#pface[data-open] { cursor: pointer; }
#pface[data-open]:hover { box-shadow: 0 0 0 2px #05060c, 0 0 14px rgba(253, 230, 138, 0.85); }
#panels #p_char { flex: 0 1 700px; }
@media (pointer: coarse), (max-width: 900px) { #panels #p_char { flex: none; } }
body.touch #panels #p_char { flex: none; }
/* one column; two (and the three groups side by side) where the WINDOW itself is wide enough - its own width, not the
   screen's: beside another window, or on a phone held upright, it is narrow on a wide screen too */
.hsw { container-type: inline-size; }
.hs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: start; }
.hs-id { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(233, 196, 106, 0.38);
  background: radial-gradient(ellipse at 0% 0%, rgba(233, 196, 106, 0.18), transparent 62%), linear-gradient(180deg, rgba(42, 58, 110, 0.6), rgba(12, 15, 29, 0.35)); }
.hs-who { display: flex; flex-direction: column; min-width: 0; }
.hs-name { font-size: 20px; line-height: 1.2; color: var(--u-gold-hi); text-shadow: 0 1px 0 #000, 0 0 12px rgba(233, 196, 106, 0.35); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-id .jobline { margin: 1px 0 0; font-size: 13px; }
.hs-id .cpbox { padding: 5px 14px; border-radius: 10px; }
.hs-id .cpbox small { font-size: 10px; } .hs-id .cpbox b { font-size: 20px; }
.hs-lv { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.hs-lv .lvrow { grid-template-columns: auto 1fr; gap: 8px; margin: 0; font-size: 12px; color: var(--u-dim); white-space: nowrap; }
.hs-lv .lvrow .bar { height: 8px; border-radius: 4px; overflow: hidden; background: #0a0d1a; border: 1px solid #05060c; }
.hs-card { min-width: 0; padding: 10px; border-radius: 12px; border: 1px solid var(--u-line); background: var(--u-card); }
.win .hs-card > h4 { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--u-line); font-size: 11.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--u-gold); }
.hs-card > h4 small { font-size: 11px; letter-spacing: 0; color: var(--u-dim); }
.hs-gear .doll { align-items: stretch; justify-content: space-between; gap: 6px; padding-top: 4px; background: radial-gradient(ellipse at 50% 42%, rgba(233, 196, 106, 0.17), transparent 62%); }
.hs-gear .dcol { gap: 6px; }
.hs-gear .slot.eq { width: 46px; height: 46px; border-radius: 9px; border: 1px solid #a8872f; background: linear-gradient(#1c2444, #0b0e1c); box-shadow: inset 0 0 8px rgba(255, 207, 74, 0.16); }
.hs-gear .slot.eq.empty { border-style: dashed; border-color: #4a5686; box-shadow: none; }
.hs-gear .slot.eq:not(.empty):hover { border-color: var(--u-gold-hi); }
.hs-gear .slot.eq.sel { border-color: var(--u-gold-hi); box-shadow: 0 0 0 1px var(--u-gold-hi), 0 0 10px rgba(255, 207, 74, 0.5); }
.hs-gear .dslot small { font-size: 9.5px; color: var(--u-dim); }
.hs-gear .dmid { justify-content: space-between; gap: 6px; }
#p_char .hs-gear .dmid .dollpic { width: min(128px, 100%); height: auto; aspect-ratio: 4 / 5; margin: auto 0; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.55)); }
.hs-gear .dwing { display: flex; gap: 10px; justify-content: center; }
.hs-tip { margin: 8px 0 0; text-align: center; font-size: 11px; }
.hs-st { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto auto; grid-template-areas: "k v c p" "d d c p"; align-items: center; column-gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(150, 170, 255, 0.09); }
.hs-k { grid-area: k; font-size: 13px; letter-spacing: 0.5px; color: var(--u-gold); }
.hs-v { grid-area: v; font-size: 17px; line-height: 1.1; font-weight: 700; color: #fff; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hs-v .bonus { margin-left: 5px; font-size: 11.5px; font-weight: 600; }
.hs-d { grid-area: d; font-size: 11px; line-height: 1.3; color: var(--u-dim); }
.hs-c { grid-area: c; min-width: 14px; font-size: 11px; text-align: right; color: var(--u-dim); }
.hs-st .plus { grid-area: p; }
.hs-attr .pts { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; }
.hs-attr .pts b { margin-right: auto; font-size: 16px; color: var(--u-gold-hi); }
.hs-groups { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: start; }
.hs-dv { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid rgba(150, 170, 255, 0.09); }
.hs-dv:last-child { border-bottom: 0; padding-bottom: 0; }
.hs-dv span { display: flex; flex-direction: column; min-width: 0; }
.hs-dv b { font-size: 12.5px; font-weight: 600; color: var(--u-text); }
.hs-dv small { font-size: 10.5px; line-height: 1.25; color: var(--u-dim); }
.hs-dv em { flex: none; font-style: normal; font-size: 15px; font-weight: 700; color: #fff; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hs-gear .doll { max-width: 380px; margin: 0 auto; }
.hs-gear .dwing { margin-top: 0; } #p_char .hs-gear .dslot small { display: block; } /* (every slot named, on a short phone too: the sheet scrolls) */
/* a piece's rarity on its square, as in the bag: magic blue, rare violet, epic orange, legendary gold; high refines shimmer */
#p_char .slot.q-r1 { border-color: #3b82f6 !important; box-shadow: inset 0 0 8px rgba(96, 165, 250, 0.35); }
#p_char .slot.q-r2 { border-color: #a855f7 !important; box-shadow: inset 0 0 9px rgba(192, 132, 252, 0.4); }
#p_char .slot.q-r3 { border-color: #f97316 !important; box-shadow: inset 0 0 10px rgba(251, 146, 60, 0.5); }
#p_char .slot.q-r4 { border-color: #fbbf24 !important; box-shadow: inset 0 0 12px rgba(251, 191, 36, 0.6); }
#p_char .slot.ref7, #p_char .slot.ref10 { animation: refglow 1.6s ease-in-out infinite alternate; }
@container (max-width: 539.98px) { #p_char .hs-gear .dmid .dollpic { width: min(160px, 100%); } #p_char .hs-gear .slot.eq { width: 52px; height: 52px; } #p_char .hs-gear .dcol { gap: 8px; } }
@container (max-width: 339.98px) { #p_char .hs-gear .slot.eq { width: 46px; height: 46px; } }
@container (min-width: 540px) { .hs { grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); } .hs-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.hs-attr .pts .autostat { white-space: nowrap; }
body.touch .win .seg button, body.touch .win .hbset button { min-height: 40px; }

/* ===== sk1: what kind of skill is it - chips under every skill's name, tabs on the Skills window, the same chip
   on a Skill Tree node that changes or gives a skill, a mark on the hotbar's buttons. One colour a class (--kc):
   attack red, a buff on yourself green, the party's blue, a heal pink, a passive violet. ===== */
.k-atk { --kc: #fca5a5; } .k-buff { --kc: #86efac; } .k-party, .k-psup { --kc: #7dd3fc; } .k-heal, .k-pheal { --kc: #f9a8d4; } .k-passive { --kc: #c4b5fd; }
.skk { display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; border: 1px solid var(--kc); border-radius: 9px; background: color-mix(in srgb, var(--kc) 15%, transparent);
  color: var(--kc); font-size: 10.5px; font-weight: 700; line-height: 16px; letter-spacing: 0.2px; white-space: nowrap; }
.skk i { font-style: normal; font-weight: 500; color: #dbe3ff; }
.skk i::before { content: "\00B7"; margin-right: 5px; color: var(--kc); }
/* what a skill does beside its kind (stun, slow, taunt, poison): a quieter chip after the kind's */
.skx { display: inline-flex; align-items: center; padding: 0 7px; border: 1px solid #a8872f; border-radius: 9px; background: rgba(233, 196, 106, 0.1); color: #fde68a; font-size: 10px; font-weight: 600; line-height: 16px; white-space: nowrap; }
.skks { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
/* the Skills window: the chips under the name, the class's colour on the card's left edge, the tabs */
.sk-head b .skks { display: flex; margin-top: 3px; }
.win .skill[class*=" k-"] { border-left: 3px solid var(--kc); }
.win .sktabs { margin: 8px 0 10px; }
.win .sktabs button { flex: 1 1 auto; }
.win .sktabs button small { margin-left: 4px; font-size: 10px; font-weight: 500; }
/* the Skill Tree: the chip in a node's row and the chips in the card at the foot; the colour on the picture's rim */
#p_tree .trnode .trnm small .skk { margin-right: 5px; padding: 0 6px; font-size: 9.5px; line-height: 14px; vertical-align: 1px; }
#p_tree .tric[class*=" k-"] { border-color: var(--kc); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--kc) 45%, transparent); }
#p_tree .trdetail h3 .skks { font-weight: 400; }
/* the hotbar (the HUD's skill buttons): the class's colour as a line over the button's name strip; on a phone - where
   the round button shows no name - a small dot. Drawn inside the button: no piece of the HUD moves. */
#skills button .skd { display: none; }
#skills button[class*=" k-"] .skic ~ .nm { box-shadow: inset 0 2px 0 var(--kc); }
body.touch #skills button[class*=" k-"] .skd { display: block; position: absolute; right: 3px; top: 3px; z-index: 3; width: 12px; height: 12px; border: 2px solid #05060c; border-radius: 50%; background: var(--kc); pointer-events: none; }

/* ===== sk2: who a skill reaches (a third chip on a buff and a heal) and what the Skill Tree adds to a skill (the
   effect chips of the tree wear a dashed rim and a tree mark) ===== */
.skg { display: inline-flex; align-items: center; gap: 5px; padding: 0 7px; border: 1px solid #55648f; border-radius: 9px; background: rgba(120, 140, 200, 0.12); color: #c9d3f0; font-size: 10px; font-weight: 600; line-height: 16px; white-space: nowrap; }
.skg::before { content: "\2192"; color: #8fa2d8; }
.skg.sh { border-color: #3f7d5a; background: rgba(74, 222, 128, 0.1); color: #86efac; }
.skg.sh::before, .skg.add::before { content: none; }
.skx.tr { border-style: dashed; }
#p_tree .trnode .trnm small .skx, #p_tree .trnode .trnm small .skg { margin-right: 5px; padding: 0 5px; font-size: 9.5px; line-height: 14px; vertical-align: 1px; }
#p_tree .trdetail h3 .skx, #p_tree .trdetail h3 .skg { font-weight: 600; }

/* ===== ux3: see it before you buy it ===== */
/* a market listing's / a shop row's picture and name open the item's card */
.mkrow [data-act="mkview"], .shoprow [data-act="shopview"] { cursor: pointer; }
/* the seconds left of a skill's cooldown, over its button AND over the dark sweep (the button's ::after, z-index 2) */
#skills button[data-cd]:not([data-cd=""])::before { content: attr(data-cd); position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); z-index: 3; text-align: center; font-size: 20px; font-weight: 700; line-height: 1; color: #fff; text-shadow: 0 0 3px #000, 1px 1px 0 #000, -1px -1px 0 #000; pointer-events: none; }

/* ===== ux2: AUTO with conditions - why AUTO stopped by itself, above its button until the next start (two lines when long) ===== */
#autoGoal.stopped { color: #fca5a5; border-color: #7f1d1d; white-space: normal; }
.areset { margin-top: 8px; }

/* ===== the Skill Tree's MAP view (release tree2): the window grows and the job line's nodes sit on the painted First Tree.
   The list view is untouched. The window's CODE says which layout there is room for and marks the window: trmap + trwide (the
   landscape picture) or trtall (the portrait one: a phone, a tablet held upright), + trunder when another window was opened
   after it. No media query picks the layout. A node's place comes in its style (--x / --y, hundredths of the picture); its
   size is a share of the picture's width, so nodes never grow into each other. ===== */
#p_tree { --trmap-css: 1; } /* (read by the window's code: this stylesheet knows the map; with an older one the list shows) */
#p_tree .trview { margin-left: auto; padding: 4px 10px; font-size: 12px; white-space: nowrap; }
#panels #p_tree.trmap { position: fixed; z-index: 11; flex: none; max-height: none; display: flex; flex-direction: column; overflow: hidden; }
#panels #p_tree.trmap.trunder { z-index: -1; } /* (a window opened after the map shows over it) */
#panels:has(#p_trade:not([hidden])) #p_tree.trmap { z-index: -1; } /* (a trade opens without the tree being drawn again: the stylesheet itself puts the map under it) */
#panels #p_tree.trmap.trwide { left: 3vw; right: 3vw; top: max(8px, var(--sat, 0px)); bottom: max(8px, var(--sab, 0px)); padding-bottom: 10px; }
#panels #p_tree.trmap.trtall { left: 0; right: 0; top: 0; bottom: 0; border-radius: 0; padding: var(--sat, 0px) max(8px, var(--sar, 0px)) max(10px, var(--sab, 0px)) max(8px, var(--sal, 0px)); }
#p_tree.trmap > header { flex: none; margin-bottom: 0; }
#p_tree.trmap .trpts { flex: none; align-items: center; margin: 6px 0; }
#p_tree.trmap .trstage { flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; border-radius: 10px; background: #050a18; display: flex; flex-direction: column; }
#p_tree.trmap .trcanvas { position: relative; flex: none; margin: auto; background: #0a1226 center / 100% 100% no-repeat; }
#p_tree.trmap .trstage.wide .trcanvas { width: min(100%, max(650px, calc((var(--app-h) - 190px) * 1.7768))); aspect-ratio: 1672 / 941; background-image: url(/assets/ui/tree_bg.jpg); }
#p_tree.trmap .trstage.wide .trcanvas::before { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 56px 0 46px -30px #050a18, inset -56px 0 46px -30px #050a18; } /* (the picture's sides fade into the dark beside it) */
#p_tree.trmap .trstage.tall .trcanvas { width: min(100%, max(340px, calc((var(--app-h) - 215px) * 0.6667))); aspect-ratio: 1024 / 1536; background-image: url(/assets/ui/tree_bg_tall.jpg); }
#p_tree .trln { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
#p_tree .trln line { stroke: #2b3150; stroke-width: 6px; stroke-linecap: round; vector-effect: non-scaling-stroke; opacity: 0.9; }
#p_tree .trln line.glow { stroke: #ff9a1a; stroke-width: 14px; opacity: 0.3; }
#p_tree .trln line.on { stroke: #ffc04a; stroke-width: 5px; opacity: 1; }
#p_tree .trln line.flow { stroke: #fff3c4; stroke-width: 2px; stroke-dasharray: 8 14; opacity: 1; animation: trflow 1.2s linear infinite; }
@keyframes trflow { to { stroke-dashoffset: -22; } }
#p_tree .trmn { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); transform: translate(-50%, -50%); box-sizing: border-box; aspect-ratio: 1; height: auto; min-width: 0; min-height: 0; padding: 0; border-radius: 50%; border: 3px solid #6b6f85; background: radial-gradient(circle at 35% 30%, #3b4058, #171b2c 70%); color: #9aa0b8; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7); cursor: pointer; }
#p_tree .trstage.wide .trmn { width: clamp(30px, 4.7%, 60px); } #p_tree .trstage.wide .trmn.cap { width: clamp(38px, 6%, 76px); }
#p_tree .trstage.tall .trmn { width: clamp(36px, 13%, 60px); } #p_tree .trstage.tall .trmn.cap { width: clamp(46px, 16.5%, 76px); }
#p_tree .trmn.cap { border-width: 4px; }
#p_tree .trmn .tric { width: 62%; height: 62%; border: 0; border-radius: 0; background: none; box-shadow: none; font-size: 17px; overflow: visible; }
#p_tree .trmn .tric img { object-fit: contain; image-rendering: pixelated; }
#p_tree .trmn.locked .tric img { filter: grayscale(1) brightness(0.6); }
#p_tree .trmn b { position: absolute; right: -7px; bottom: -7px; min-width: 26px; padding: 0 4px; border-radius: 9px; border: 2px solid currentColor; background: #0d1326; font-size: 12px; line-height: 1.35; font-weight: 700; text-align: center; }
#p_tree .trmn.owned, #p_tree .trmn.max { border-color: #ffc04a; background: radial-gradient(circle at 35% 30%, #7a4a12, #2b1a08 70%); color: #ffe9a8; box-shadow: 0 0 0 2px #7a4a12, 0 0 16px #ffb020, 0 0 32px rgba(255, 138, 0, 0.6); }
#p_tree .trmn.max { border-color: #fff1b8; }
#p_tree .trmn.avail { border-color: #5df08a; color: #c9ffd9; }
#p_tree .trmn.avail:not(.owned) { background: radial-gradient(circle at 35% 30%, #1d5a36, #0b2416 70%); box-shadow: 0 0 12px #35d06a; }
#p_tree .trmn.avail::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid #5df08a; opacity: 0; pointer-events: none; animation: trpulse 1.8s ease-out infinite; } /* (a ring that grows and fades: only transform and opacity move) */
@keyframes trpulse { 0% { transform: scale(0.84); opacity: 0.9; } 100% { transform: scale(1.24); opacity: 0; } }
#p_tree .trmn.sel { outline: 3px solid #fff; outline-offset: 3px; }
#p_tree .trmn.pending { opacity: 0.6; }
#p_tree.trmap .trreset { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 6px 0 0; padding-top: 6px; max-height: 22%; overflow: auto; font-size: 11px; } /* (one compact line under the picture) */
#p_tree.trmap .trreset p { margin: 0; } #p_tree.trmap .trreset .row { margin: 0; }
#p_tree.trmap.trtall .trreset { margin-top: 4px; padding-top: 4px; } #p_tree.trmap.trtall .trreset .row { width: 100%; } /* (a phone: the reset buttons three a row, the picture keeps the height; more of them wrap and the box scrolls) */
#p_tree.trmap.trtall .trstage { scrollbar-width: none; } #p_tree.trmap.trtall .trstage::-webkit-scrollbar { display: none; } /* (a scrollbar must not take the picture's width) */
#p_tree.trmap.trtall .trreset .row button { flex: 1 1 30%; min-width: 0; min-height: 40px; padding: 4px 6px; font-size: 10.5px; line-height: 1.25; white-space: normal; }
#p_tree.trmap .trdetail:not(.on) { display: none; }
#p_tree.trmap.trwide .trdetail.on { position: absolute; left: auto; right: 14px; top: 96px; bottom: auto; width: min(330px, 34%); max-height: calc(100% - 190px); margin: 0; border: 2px solid var(--u-rim); border-radius: 12px; z-index: 4; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7); }
#p_tree.trmap.trtall .trdetail.on { position: fixed; left: max(8px, var(--sal, 0px)); right: max(8px, var(--sar, 0px)); top: auto; bottom: max(8px, var(--sab, 0px)); width: auto; max-height: 40vh; margin: 0; border: 2px solid var(--u-rim); border-radius: 12px; z-index: 4; box-shadow: 0 -8px 26px rgba(0, 0, 0, 0.7); }
#p_tree.trmap.trtall.hasdetail .trstage { padding-bottom: 42vh; } /* (room to scroll the picture's foot out from under the card) */
#p_tree.trmap.trwide .trconfirm { position: absolute; left: 50%; right: auto; top: 28%; transform: translateX(-50%); width: min(440px, 92%); margin: 0; z-index: 6; }
#p_tree.trmap.trtall .trconfirm { position: fixed; left: 12px; right: 12px; top: 22vh; width: auto; transform: none; margin: 0; z-index: 6; }
@media (prefers-reduced-motion: reduce) { #p_tree .trln line.flow, #p_tree .trmn.avail::after { animation: none; } }
/* ===== ux1: nothing lost in silence, no dead end ===== */
/* the page never hands a scroll on to the browser: no pull-to-refresh that reloads the game, no rubber band */
html, body { overscroll-behavior: none; }
/* pictures inside the HUD's buttons and item squares take no press of their own and raise no image menu under a held
   finger (a held skill keeps casting; the press goes to the button or the square, as its handler expects) */
#hud button img, #hud .slot img { pointer-events: none; -webkit-touch-callout: none; -webkit-user-drag: none; }
/* touch: the "half" mark of a stack is a corner mark again - the rule for a window's buttons (36 px high, 12 px of
   padding) had made it a button over most of the square: a tap on a stack moved half of it */
body.touch .win .slot .half { min-height: 0; padding: 1px 5px; font-size: 11px; line-height: 15px; }
/* where #panels is what scrolls (phones, a narrow desktop window), a window's header - with the only close button -
   sticks to #panels: it stuck to the window itself, which does not scroll there, and went away with the text. The
   header is opaque there (text passes under it); the Skill Tree's resting hint stays at the window's end, where it was. */
@media (pointer: coarse), (max-width: 900px) {
  #panels .win { overflow: visible; }
  #panels .win header { z-index: 3; background: rgb(20, 18, 30); }
  body.touch #panels .win header { background: #15111f; }
  #p_tree .trdetail:not(.on) { position: static; }
}
/* the phone's chat button: how many lines came while the chat was closed */
#mChatN { position: absolute; right: -3px; top: -3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; pointer-events: none; }
#mChatN[hidden] { display: none; }
/* the login card: the page's own words while the game's code loads / when it cannot; the server's state before the password */
#boot { margin: 0 0 10px; text-align: center; font-size: 14px; color: var(--muted); }
#boot.bad { color: #ff8a8a; }
#boot button { display: block; margin: 8px auto 0; padding: 8px 18px; font-size: 14px; }
#srvNote { margin: 0 0 10px; padding: 8px 10px; border: 1px solid #b45309; border-radius: 6px; background: rgba(180, 83, 9, 0.18); color: #fde68a; font-size: 14px; text-align: center; }
#srvNote[hidden] { display: none; }

/* (next n227) CRAFT2: the artisan window (client/js/craftui.js) */
.c2lines { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; align-items: center; }
.c2line { flex: 1 1 120px; padding: 4px 8px; border-radius: 8px; background: rgba(255,255,255,0.05); font-size: 12px; }
.c2line.on { background: rgba(251,191,36,0.15); }
.c2bar { display: block; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.12); margin-top: 3px; overflow: hidden; }
.c2bar > i { display: block; height: 100%; background: linear-gradient(90deg, #f59e0b, #fde68a); }
.c2medal { font-size: 12px; color: #fde68a; }
.c2list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; }
.c2row { display: grid; grid-template-columns: 36px 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,0.04); }
.c2row.week, .c2row:not(:has(> img)) { grid-template-columns: 1fr auto; }
.c2row:has(> .lri) { grid-template-columns: auto 1fr auto; } /* (n227g: a bring order: its material first) */
.c2row > img { width: 32px; height: 32px; image-rendering: pixelated; }
.c2row img.dim { filter: grayscale(1) brightness(0.4); }
.c2row.off { opacity: 0.6; } .c2row.done { opacity: 0.5; } .c2row.unknown b { color: #94a3b8; }
.c2row small { display: block; color: #a8a29e; font-size: 11px; } .c2row small.bad { color: #f87171; display: inline; }
.c2in { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0; } .c2q { color: #fde68a !important; }
.c2cats { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 3px; }
.c2cats button { font-size: 11px; padding: 2px 6px; display: inline-flex; gap: 3px; align-items: center; } .c2cats button img { width: 16px; height: 16px; }
.c2cats button.on { outline: 2px solid #fbbf24; background: rgba(251,191,36,0.2); }
.c2btns { display: flex; flex-direction: column; gap: 4px; }
/* (next n228) Beyond the cap (client/js/paraui.js) */
.hs-card.para .bar.para > i { background: linear-gradient(90deg, #a855f7, #f0abfc); }
.paranodes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin: 6px 0; }
.paranode { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; }
.paranode small { display: block; color: #c4b5fd; }
.parareset { font-size: 11px; }
/* (next n230b) the book of local goods */
.c2book { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; margin-bottom: 8px; }
.c2good { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px; border-radius: 8px; background: rgba(255,255,255,0.04); text-align: center; }
.c2good.done { background: rgba(74,222,128,0.12); } .c2good img { width: 32px; height: 32px; image-rendering: pixelated; } .c2good img.dim { filter: grayscale(1) brightness(0.45); }
.c2good small { font-size: 10px; color: #d6d3d1; } .c2good em { color: #4ade80; font-style: normal; } .c2cats em { color: #a5f3fc; font-style: normal; font-size: 10px; }
/* (next n266) the Roaring Horn: a line to the whole world (n269, the owner: under the top menu, grand - worth its price) */
.shoutban { position: fixed; left: 50%; top: 9%; transform: translateX(-50%); z-index: 60; min-width: min(86vw, 340px); max-width: min(92vw, 760px); padding: 10px 34px 14px;
  border-radius: 14px; color: #fffaf0; text-align: center; pointer-events: none; overflow: hidden; isolation: isolate;
  background: radial-gradient(120% 140% at 50% 0%, rgba(160, 24, 36, 0.96) 0%, rgba(92, 10, 30, 0.96) 45%, rgba(26, 8, 22, 0.97) 100%);
  border: 2px solid #f6c453; box-shadow: inset 0 0 0 2px rgba(60, 20, 4, 0.9), inset 0 0 0 4px rgba(255, 214, 120, 0.55), inset 0 0 26px rgba(255, 190, 80, 0.28), 0 0 0 1px rgba(80, 30, 0, 0.9), 0 6px 22px rgba(0, 0, 0, 0.55), 0 0 34px rgba(255, 180, 40, 0.6);
  animation: sbIn 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both, sbGlow 1.6s ease-in-out 0.55s infinite alternate; }
.shoutban::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(105deg, transparent 30%, rgba(255, 236, 170, 0.38) 46%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 236, 170, 0.38) 54%, transparent 70%); transform: translateX(-120%); animation: sbSweep 2.4s ease-in-out 0.3s infinite; }
.shoutban::after { content: "\25C6     \25C6"; position: absolute; left: 6px; right: 6px; top: 50%; transform: translateY(-50%); display: flex; justify-content: space-between; color: #ffd76a; font-size: 13px; text-shadow: 0 0 6px #ff9d00; white-space: pre; }
.shoutban .sbh { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 2px; }
.shoutban .sbi { width: 64px; height: auto; margin: -6px 0 -8px; filter: drop-shadow(0 0 6px rgba(255, 190, 60, 0.9)); animation: sbHorn 0.9s ease-in-out infinite alternate; }
.shoutban b { font-size: 16px; font-weight: 800; letter-spacing: 0.02em; background: linear-gradient(180deg, #fff6c8 0%, #ffd24a 45%, #e48a12 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 1px 0 rgba(60, 10, 0, 0.95)) drop-shadow(0 0 6px rgba(255, 170, 40, 0.6)); }
.shoutban .sbm { font-size: 22px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; text-shadow: 0 2px 0 rgba(40, 0, 10, 0.9), 0 0 12px rgba(255, 200, 90, 0.75); }
.shoutban .sbbar { position: absolute; left: 14px; right: 14px; bottom: 5px; height: 3px; border-radius: 2px; background: linear-gradient(90deg, #ffe9a0, #f59e0b); box-shadow: 0 0 6px #ffb020; transform-origin: left; animation: sbBar 6s linear both; }
.shoutban .sbsp { position: absolute; top: calc(12% + var(--k) * 13%); left: calc(4% + var(--k) * 17.5%); width: 10px; height: 10px; background: radial-gradient(circle, #fffbe0 0 18%, transparent 22%), conic-gradient(from 45deg, transparent 0 20%, #ffe48a 25%, transparent 30% 45%, #ffe48a 50%, transparent 55% 70%, #ffe48a 75%, transparent 80% 95%, #ffe48a 100%);
  opacity: 0; animation: sbTw 1.4s ease-in-out calc(var(--k) * 0.23s) infinite; }
.shoutban.out { animation: sbOut 0.6s ease-in both; }
@keyframes sbIn { 0% { opacity: 0; transform: translate(-50%, -26px) scale(0.7); filter: brightness(2.2); } 60% { opacity: 1; filter: brightness(1.6); } 100% { opacity: 1; transform: translate(-50%, 0) scale(1); filter: none; } }
@keyframes sbOut { to { opacity: 0; transform: translate(-50%, -18px) scale(0.96); } }
@keyframes sbGlow { from { box-shadow: inset 0 0 0 2px rgba(60, 20, 4, 0.9), inset 0 0 0 4px rgba(255, 214, 120, 0.55), inset 0 0 26px rgba(255, 190, 80, 0.28), 0 0 0 1px rgba(80, 30, 0, 0.9), 0 6px 22px rgba(0, 0, 0, 0.55), 0 0 22px rgba(255, 180, 40, 0.45); }
  to { box-shadow: inset 0 0 0 2px rgba(60, 20, 4, 0.9), inset 0 0 0 4px rgba(255, 224, 140, 0.8), inset 0 0 34px rgba(255, 200, 90, 0.42), 0 0 0 1px rgba(80, 30, 0, 0.9), 0 6px 22px rgba(0, 0, 0, 0.55), 0 0 46px rgba(255, 190, 50, 0.85); } }
@keyframes sbSweep { 0% { transform: translateX(-120%); } 55%, 100% { transform: translateX(120%); } }
@keyframes sbHorn { from { transform: rotate(-6deg) scale(1); } to { transform: rotate(4deg) scale(1.08); } }
@keyframes sbBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes sbTw { 0%, 100% { opacity: 0; transform: scale(0.4) rotate(0deg); } 50% { opacity: 1; transform: scale(1.3) rotate(45deg); } }
@media (max-width: 640px), (max-height: 480px) { .shoutban { padding: 7px 26px 11px; } .shoutban .sbi { width: 46px; } .shoutban b { font-size: 13px; } .shoutban .sbm { font-size: 16px; } }
@media (prefers-reduced-motion: reduce) { .shoutban, .shoutban::before, .shoutban .sbi, .shoutban .sbsp { animation: none; } .shoutban .sbbar { animation: sbBar 6s linear both; } }
/* (next n325) deleting a character: the card's 🗑, the warning box, the restorable list */
.cscard { position: relative; }
.csdel { position: absolute; right: 4px; bottom: 4px; width: 26px; height: 26px; padding: 0; border-radius: 6px; font-size: 13px; line-height: 24px; opacity: 0.55; background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.15); cursor: pointer; }
.csdel:hover, .csdel:focus-visible { opacity: 1; border-color: #f87171; }
.csmove { position: absolute; right: 34px; bottom: 4px; width: 26px; height: 26px; padding: 0; border-radius: 6px; font-size: 13px; line-height: 24px; opacity: 0.55; background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.15); cursor: pointer; } /* (chmove1) */
.csmove:hover, .csmove:focus-visible { opacity: 1; border-color: #60a5fa; }
.csdelbox { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(5,6,12,0.72); padding: 16px; }
.csdelcard { max-width: 420px; width: 100%; background: #171a2b; border: 1px solid #7f1d1d; border-radius: 12px; padding: 16px 18px; box-shadow: 0 10px 40px rgba(0,0,0,0.6); }
.csdelcard h3 { margin: 0 0 6px; color: #fca5a5; } .csdelwho { margin: 0 0 8px; font-weight: 700; }
.csdelkeep { font-size: 13px; line-height: 1.5; color: #cbd5e1; } .csdelshop { color: #fbbf24; font-size: 13px; font-weight: 600; }
.csdelblock { margin: 4px 0 8px 18px; padding: 0; font-size: 13px; line-height: 1.6; }
.csdelcard .cnlab { display: block; margin: 8px 0; } .csdelcard .cnlab input { width: 100%; box-sizing: border-box; }
.csgone { margin-top: 10px; padding: 8px 10px; border: 1px dashed rgba(255,255,255,0.18); border-radius: 8px; }
.csgone h4 { margin: 0 0 6px; font-size: 13px; color: #cbd5e1; } .csgrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; padding: 3px 0; }
/* (next n354) the faction war field: the join bar, the field's HUD, the result card, the War Hall (client/js/warfield-ui.js) */
#wfbar { position: fixed; left: 50%; top: calc(8px + var(--sat, 0px)); transform: translateX(-50%); z-index: 40; display: flex; gap: 6px; align-items: center; padding: 5px 8px; border-radius: 10px; background: rgba(20, 16, 12, 0.86); border: 1px solid #a8742c; color: #f5e6c8; font-size: 12px; max-width: calc(100vw - 32px); }
#wfbar[hidden], #wfhud[hidden], #wfres[hidden], #wfhall[hidden] { display: none; }
#wfbar button, #wfhud button, .wfcard button { font-size: 12px; padding: 3px 9px; }
#wfbar .wfgo { background: #b45309; color: #fff; border-color: #f59e0b; font-weight: bold; }
/* (wfhide1) the bar's X, and the bar folded to one round war button */
#wfbar .wfx { background: transparent; color: #f5e6c8; border-color: #6b5a3a; padding: 3px 8px; }
#wfbar:has(.wfmini) { padding: 0; background: transparent; border: 0; }
#wfbar .wfmini { width: 42px; height: 42px; padding: 0; border-radius: 50%; font-size: 19px; line-height: 38px; background: rgba(20, 16, 12, 0.86); color: #f5e6c8; border: 2px solid #f59e0b; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
#wfbar .wfmini.on { border-color: #22c55e; }
#wfhud { position: fixed; left: 50%; top: calc(8px + var(--sat, 0px)); transform: translateX(-50%); z-index: 40; padding: 6px 10px; border-radius: 10px; background: rgba(15, 12, 10, 0.84); border: 1px solid #7a5a2c; color: #f5e6c8; font-size: 12px; text-align: center; line-height: 1.5; max-width: calc(100vw - 32px); }
#wfhud .wfpts { display: flex; gap: 6px; justify-content: center; margin-bottom: 2px; }
#wfhud .wfpt { position: relative; min-width: 62px; padding: 1px 6px 4px; border: 2px solid #8b8b8b; border-radius: 6px; font-weight: bold; overflow: hidden; }
#wfhud .wfpt i { position: absolute; left: 0; bottom: 0; height: 3px; }
#wfres, #wfhall { position: fixed; inset: 0; z-index: 57; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.45); padding: 12px; }
.wfcard { max-width: 420px; width: 100%; max-height: calc(100% - 24px); overflow: auto; text-align: center; }
.wfcard .wftier { font-size: 44px; font-weight: 900; line-height: 1.1; margin: 4px 0; }
.wfi { width: 20px; height: 20px; vertical-align: middle; image-rendering: pixelated; } .wfcard .wftier .wfi { width: 44px; height: 44px; margin-right: 6px; } .wftile i .wfi { width: 26px; height: 26px; } /* (next n374) the war's own icons, A-2276 */
.wfcard .wftS { color: #facc15; } .wfcard .wftA { color: #e5e7eb; } .wfcard .wftB { color: #d97706; } .wfcard .wftC { color: #94a3b8; } .wfcard .wftN { color: #6b7280; }
.wfcard .wfbtns { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.wfcard .wfhl { text-align: left; font-size: 12px; }
.wfcard .wfh { padding: 5px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.wfcard .wfhf { padding-left: 10px; }

/* (next n359) the war window's tabs, the season, the merit shop; the war line's link */
.wfcard .wftabs { display: flex; gap: 4px; justify-content: center; margin: 4px 0 6px; flex-wrap: wrap; }
.wfcard .wftabs button.on { background: #b45309; color: #fff; border-color: #f59e0b; }
.wfcard .wfseason { display: flex; gap: 10px; } .wfcard .wfsc { flex: 1; min-width: 0; }
.wfcard .wfshop .wfsr { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 3px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.wfcard .bad { color: #f87171; }
#warinfo .wflink { cursor: pointer; pointer-events: auto; text-decoration: underline; color: #fcd34d; }
/* (next n451) the pet window v2 */
.pet2 { border: 1px solid #fb923c66; padding: 8px; margin-bottom: 8px; background: linear-gradient(rgba(251,146,60,0.08), rgba(0,0,0,0.2)); }
.pet2-top { display: grid; grid-template-columns: 168px 1fr; gap: 10px; align-items: start; }
.pet2-pic { position: relative; width: 168px; height: 168px; border: 1px solid var(--edge); background: radial-gradient(circle at 50% 70%, rgba(251,191,36,0.16), rgba(0,0,0,0.35)); }
.pet2-pic canvas { width: 168px; height: 168px; image-rendering: pixelated; display: block; }
.pet2-turn { position: absolute; right: 4px; bottom: 4px; font-size: 11px; padding: 2px 6px; }
.pet2-info .lvrow { margin: 2px 0; }
.pet2-stars .stars { color: #fbbf24; letter-spacing: 1px; }
.pet2-gear { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; justify-items: center; }
.pet2-gear .dslot { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pet2-sk { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.pet2-sk .psk { display: flex; justify-content: space-between; align-items: center; gap: 4px; padding: 4px 6px; border: 1px solid var(--g, var(--edge)); border-left-width: 4px; background: rgba(0,0,0,0.25); cursor: pointer; }
.pet2-sk .psk b { color: var(--g, inherit); }
.pet2-sk .psk.lock { opacity: 0.55; cursor: default; border-style: dashed; }
.pet2-sk .psk.sealed { box-shadow: inset 0 0 0 1px #fbbf24; background: rgba(251,191,36,0.12); }
.pet2-sk.set .psk { border-color: #fbbf24; box-shadow: 0 0 6px #fbbf2488; }
.pskset { color: #fbbf24; font-weight: bold; }
.pet2-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.pet2-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 1px solid var(--edge); border-top: 3px solid var(--g, var(--edge)); background: rgba(0,0,0,0.22); text-align: center; }
.pet2-card.on { border-color: #fb923c; }
.pet2-card canvas { width: 56px; height: 56px; image-rendering: pixelated; }
.pet2-card .btns { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.pet2-card .btns button { padding: 2px 6px; font-size: 11px; }
@media (max-width: 520px) { .pet2-top { grid-template-columns: 1fr; justify-items: center; } .pet2-sk { grid-template-columns: 1fr; } }
/* (next n457) the faction war: the live board, the battle feed, the end table */
#wfhud .wfbd { margin-top: 4px; padding-top: 4px; border-top: 1px solid rgba(255, 255, 255, 0.12); text-align: left; min-width: 230px; }
#wfhud .wfbdh { display: flex; gap: 6px; align-items: center; justify-content: space-between; }
#wfhud .wfbdh button { padding: 0 6px; font-size: 11px; }
#wfhud .wfbr { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; line-height: 1.35; }
#wfhud .wfbr.me { background: rgba(250, 204, 21, 0.14); border-radius: 4px; }
#wffeed { position: fixed; right: 12px; top: 42%; z-index: 39; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; pointer-events: none; font-size: 12px; }
#wffeed[hidden] { display: none; }
#wffeed > div { padding: 2px 8px; border-radius: 6px; background: rgba(15, 12, 10, 0.78); }
.wfcard .wfend table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; }
.wfcard .wfend th, .wfcard .wfend td { padding: 2px 4px; text-align: center; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.wfcard .wfend td:nth-child(2) { text-align: left; }
.wfcard .wfend tr.me { background: rgba(250, 204, 21, 0.16); }

/* (rune2) the Rune Root board (client/js/rrootui.js) */
.rrhead { margin: 4px 0; } .rrtree { display: flex; gap: 6px; } .rrbr { flex: 1; min-width: 0; border: 1px solid var(--rc); border-radius: 8px; padding: 4px; background: rgba(0, 0, 0, 0.25); }
.rrbh { color: var(--rc); font-weight: bold; text-align: center; font-size: 12px; } .rrsocks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin: 4px 0; }
.rrs { aspect-ratio: 1; min-width: 0; padding: 0; border-radius: 50%; border: 2px dashed #57534e; background: #1c1917; color: #a8a29e; font-size: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; }
.rrs.on { border-style: solid; background: radial-gradient(circle, color-mix(in srgb, var(--rc) 45%, #0c0a09), #0c0a09); color: #fff; } .rrs.sel { outline: 2px solid #fde68a; }
.rrs i { font-style: normal; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; } .rrbon small { display: block; font-size: 10px; color: #78716c; } .rrbon small.on { color: var(--rc); }
.rrsum, .rrpick { margin: 6px 0; padding: 6px; border: 1px solid #44403c; border-radius: 6px; font-size: 12px; } .rrkinds { display: flex; flex-wrap: wrap; gap: 3px; margin: 3px 0; } .rrkinds button.on { border-color: #fde68a; background: #422006; }
.rrootcard { padding: 6px 8px; }
/* (rune2 art A-2663 / A-2664 / A-2665) the crystal root board */
.rrboard { position: relative; width: 100%; max-width: 520px; margin: 6px auto; aspect-ratio: 1 / 1; background: #0b1030 url(/assets/ui/rroot_board.jpg) center / 100% 100% no-repeat; border-radius: 10px; }
#p_rroot .rrs2, body.touch #p_rroot .rrs2 { position: absolute; width: 7.4%; height: auto; aspect-ratio: 1 / 1; min-width: 0; min-height: 0; transform: translate(-50%, -50%); padding: 0; margin: 0; border: 0; border-radius: 50%; background: transparent; display: flex; align-items: center; justify-content: center; box-shadow: none; }
#p_rroot .rrs2.tip, body.touch #p_rroot .rrs2.tip { width: 9.6%; }
#p_rroot .rrs2.on { background: url(/assets/sprites/cd_rroot_socks.png) 33.333% 0 / 400% 100% no-repeat; filter: drop-shadow(0 0 5px var(--rc)); }
#p_rroot .rrs2.oth { background: url(/assets/sprites/cd_rroot_socks.png) 100% 0 / 400% 100% no-repeat; opacity: 0.85; }
#p_rroot .rrs2.sel { background: url(/assets/sprites/cd_rroot_socks.png) 66.667% 0 / 400% 100% no-repeat; filter: drop-shadow(0 0 6px #fde68a); }
#p_rroot .rrs2:hover { filter: brightness(1.3) drop-shadow(0 0 5px var(--rc)); }
#p_rroot .rrs2 img { width: 72%; height: 72%; image-rendering: pixelated; pointer-events: none; }
#p_rroot .rrs2 b { color: #fff; font-size: 11px; }
#p_rroot .rrs2 em { position: absolute; right: -16%; bottom: -16%; font: bold 9px/1 system-ui, sans-serif; font-style: normal; color: #fff; background: rgba(0, 0, 0, 0.75); border-radius: 4px; padding: 1px 3px; pointer-events: none; }
.rrkinds button { display: flex; flex-direction: column; align-items: flex-start; text-align: left; } .rrkinds button small { font-size: 10px; color: #a8a29e; } /* (rune2 v2) */
/* (ux4 B7) the open chat's close button: a phone only (the panel covers its toggle there) - a 44 px circle on the panel's corner */
#chatX { display: none; }
/* (ux4 B8) the open chat above the HUD's chips and buttons (not the windows, 60), its background nearly solid - its lines never read over the HUD */
body.touch.chat-open #chat { z-index: 50; background: rgba(16, 14, 26, 0.97); }
body.touch.chat-open #chatX { display: flex; position: absolute; top: -14px; right: -10px; width: 44px; height: 44px; padding: 0; border-radius: 50%; align-items: center; justify-content: center; font-size: 18px; color: #fff; background: #3b2f5a; border: 2px solid #fbbf24; z-index: 3; }
/* (ux4 B2, the owner 2026-11-21 "ทำข้อ 1 ต่อได้เลย ต้องทำให้ดีที่สุด"): on a touch screen every control a finger presses is at least
   44 x 44 px - measured on a 375 x 812 phone page (docs/balance/ux4/touch-audit.md). Windows, the chat, the big map and the pop-ups
   grow their controls; the HUD keeps its pictures and places and grows only the area a finger hits (an invisible ::after around the
   button, never over a neighbour); a window open on a phone is no longer covered by the journey chip, the war bar or the guest chip. */
body.touch .win button, body.touch .win select, body.touch .win .seg button, body.touch .win .plus { min-height: 44px; min-width: 44px; }
body.touch .win .x { min-width: 48px; min-height: 44px; }
body.touch .win input:not([type=checkbox]):not([type=radio]):not([type=range]) { min-height: 44px; }
body.touch .win input[type=checkbox], body.touch .win input[type=radio], body.touch .aopt input { width: 26px; height: 26px; }
body.touch .aopt { min-height: 44px; align-items: center; padding: 4px 0; }
body.touch input[type=range], body.touch .aslide input[type=range] { height: 44px; }
body.touch .win .hbset button, body.touch #p_dungeon .dgnrow button { min-width: 44px; min-height: 44px; }
/* the chat */
body.touch #chattabs button { min-height: 44px; min-width: 44px; }
body.touch #chatch, body.touch #chatin { min-height: 44px; }
body.touch #emoteBtn { min-width: 44px; min-height: 44px; }
/* the big map */
body.touch .bmbox header button { width: 44px; height: 44px; }
body.touch .bmbox button { min-height: 44px; }
/* the pop-ups: a player's menu, an invite, the item card, the NPC dialogue */
body.touch #ppop .btns button, body.touch #invite .btns button { min-height: 44px; min-width: 64px; }
body.touch .ic-top .ipx { width: 44px; height: 44px; }
body.touch #itempop button, body.touch #dialog button { min-height: 44px; }
/* the login card and the character list */
body.touch #login .lrow label.chk { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; }
body.touch #login .lrow input[type=checkbox] { width: 24px; height: 24px; }
body.touch #login .eye { min-width: 44px; min-height: 44px; }
body.touch .lsel select { min-height: 44px; }
body.touch #paneLogin .gbtn { min-height: 44px; } body.touch #guestBtn { min-height: 44px !important; } /* (its own inline style says 40) */
body.touch #toSignup, body.touch .csacct .link { display: inline-block; padding: 13px 8px; margin: -13px -8px; }
body.touch #guestBox p a { padding: 14px 5px; }
/* the HUD: the hit area grows, the picture and its place stay */
body.touch #wfbar button, body.touch #zoombar button, body.touch .csdel { position: relative; }
body.touch #wfbar button::after, body.touch #zoombar button::after, body.touch #qAutoCfg::after, body.touch #guestChip::after, body.touch #njChip::after,
body.touch #mChat::after, body.touch #navchip .navx::after, body.touch #partyframe .pwbtn::after, body.touch .csdel::after { content: ''; position: absolute; }
body.touch #wfbar button { min-width: 44px; }
body.touch #wfbar button::after { inset: -8px -3px; }
body.touch #zoombar button { height: 38px; }
body.touch #zoombar button::after { inset: -3px -5px; }
body.touch #quick #qAutoCfg { width: 36px; height: 36px; }
body.touch #qAutoCfg::after { inset: -8px -8px 0 0; } /* up and right only: never over the AUTO button it sits on */
body.touch #guestChip::after { inset: -9px 0; }
body.touch #njChip::after { inset: -4px 0; }
body.touch #mChat::after { inset: -1px; }
body.touch #navchip .navx { position: relative; }
body.touch #navchip .navx::after { inset: -5px; }
body.touch #partyframe .pwbtn::after { inset: -8px -2px; }
body.touch .csdel::after { inset: -9px; }
body.touch #chsel { min-height: 40px; font-size: 13px; }
/* (ux4 B2b, the owner 2026-11-21 "แก้ปุ่มซูมที่โดนบังด้วย"): on an upright phone the war's Join bar sat at the top over the status card, the book
   button, the zoom column and the event ticker - it moves to the free band above the AUTO button, on the left, clear of the skill column */
@media (orientation: portrait) { body.touch #wfbar { left: 12px; right: auto; top: auto; bottom: calc(312px + var(--sab, 0px)); transform: none; max-width: calc(100vw - 72px); } }
/* (ux4 B3, the owner 2026-11-21 "ทำข้อต่อไปเลย"): no text under 11 px on a touch screen (measured on the 375 x 812 page: the HUD's bars
   8-9 px, the minimap's lines 9-10, the round buttons' labels 9, and a dozen small labels in the windows) - the EXP bar a little taller to
   hold it. A window's text grows again with the Text size setting (its zoom), as before. */
body.touch #plv, body.touch #pjob, body.touch #hpt, body.touch #mpt, body.touch #xpt, body.touch #buffs .fxt, body.touch #mmname b, body.touch #mmname span,
body.touch #mminfo b, body.touch #mminfo span, body.touch #zoomPct, body.touch #quick span, body.touch #quick .potn, body.touch #autoLeft { font-size: 11px; }
body.touch #stats .bar span, body.touch #zoombar span { font-size: 11px; } /* (the older touch rules for these two are more specific) */
body.touch #p_cash .csbplate small, body.touch #p_cash .cstag { font-size: 11px; }
/* a short (sideways) screen scales the skill fan by 0.82, and the player's HUD size scales it too: its labels are sized back so they still read 11 px */
body.touch #quick span, body.touch #quick .potn, body.touch #autoLeft { font-size: calc(11px / (var(--ui-scale, 1) * var(--short, 1))); }
body.touch #quick > button { font-size: max(12px, calc(11px / (var(--ui-scale, 1) * var(--short, 1)))); } body.touch #quick #qAuto { font-size: calc(11px / (var(--ui-scale, 1) * var(--short, 1))); }
@media (max-height: 520px) { body.touch #qtrack, body.touch #testdayGame { font-size: 11px; } }
body.touch #topbar .tbb { font-size: 11px; }
body.touch #stats .bar.xp { height: 12px; } body.touch #stats .bar.xp span { font-size: 11px; line-height: 12px; } body.touch #stats .bar::before { font-size: 11px; } body.touch #xprate { font-size: 11px !important; }
body.touch .csbplate small, body.touch .cstag, body.touch .cpbox small, body.touch .dslot small, body.touch .dgkind, body.touch .dgline small, body.touch .dgplan,
body.touch .dollst span, body.touch .dollst b, body.touch .invtabs small, body.touch .slot em, body.touch .jch small, body.touch .rrbh small, body.touch .rrbon small,
body.touch .win .seg small, body.touch .skk, body.touch .skg, body.touch .skk i { font-size: 11px; }
/* (ux4 B2c, the owner 2026-11-21 "แก้แถบบอสทับชื่อด้วย"): the event boss's running line lay over the top 28 px of the whole screen - the
   hero's name, the map's name, the menu row. On a phone it runs in a free band instead: upright under the guest / quest column and over
   the Travel button, clear of the chat button; sideways under the menu row, between the status card and the zoom column */
@media (orientation: portrait) { body.touch #ev1Ticker { top: calc(var(--sat, 0px) + 258px); left: 12px; right: 64px; border-radius: 8px; } }
@media (orientation: landscape) { body.touch #ev1Ticker { top: calc(var(--sat, 0px) + 64px); left: 240px; right: 152px; border-radius: 8px; } }
/* (ux4 B2d, the owner 2026-11-21 "แก้ปุ่ม Dodge กับ Travel ด้วย"): a short (sideways) screen - Dodge and Travel sat above the skill fan, half
   off the top of the screen and under the minimap; the target and battle-mode buttons lay on the minimap's lines; the 7th skill slot touched
   its coordinates line and the zoom column (38 px buttons, B2) the second key page. Now: those four in one row left of the potions, the test
   days' note off (as on an upright phone), the 7th slot 14 px lower, the zoom buttons their old 30 px (the finger's area still +3 px) */
@media (max-height: 520px) {
  body.touch #testdayGame { display: none; }
  body.touch #zoombar button { height: 30px; }
  body.touch #fan #quick #qDodge { right: 304px; bottom: 8px; }
  body.touch #fan #quick #qTravel { right: 358px; bottom: 8px; }
  body.touch #fan #quick #qBm { right: 412px; bottom: 8px; }
  body.touch #fan #quick #mTarget { right: 466px; bottom: 10px; }
  body.touch #fan #skills button:nth-child(7) { bottom: 182px; }
}
/* a window open on a phone covers the HUD's floating chips (they sat on top of the window's own buttons) */
body.touch:has(#panels .win:not([hidden])) #njChip, body.touch:has(#panels .win:not([hidden])) #wfbar, body.touch:has(#panels .win:not([hidden])) #guestChip { visibility: hidden; }
/* ===== ux1 (D5): the safe area - a notch, a home indicator, a sideways phone's rounded sides =====
   The page draws under them (viewport-fit=cover). Four variables hold the insets: 0 px on every screen without
   them - nothing moves there. A piece pinned to an edge is pushed in by that edge's inset with a MARGIN: a margin
   adds to whichever of left / right / top / bottom the piece is pinned by - in every layout of the sheet above, for
   left hands too, and under a player's own arrangement (which is a translate). Pieces that the game's code places
   from another piece's measured rectangle (the tracker's top, the party box, the route chip, the dungeon timer)
   get no margin on that side: they follow a piece that is pushed in already. Touch screens only. */
:root { --sat: env(safe-area-inset-top, 0px); --sar: env(safe-area-inset-right, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); }
body.touch #stats, body.touch #topright, body.touch #mChat { margin: var(--sat) var(--sar) var(--sab) var(--sal); }
body.touch #fan { margin: 0 var(--sar) var(--sab) var(--sal); }
body.touch #qtrack, body.touch #lootfeed { margin-left: var(--sal); margin-right: var(--sar); }
body.touch #bossbar { margin-top: var(--sat); margin-bottom: var(--sab); }
body.touch #zonetag, body.touch #targetbar, body.touch #toasts, body.touch #combo, body.touch.chat-open #chat, body.touch.tb-on #topbar { margin-top: var(--sat); }
/* (the dialogue is centred and nearly as wide as the screen: it grows narrower by the larger side inset, on both sides) */
body.touch #dialog { margin-bottom: var(--sab); width: min(640px, calc(100vw - 24px - 2 * max(var(--sal), var(--sar)))); }
/* the joystick's resting ring (under a finger the game's code places it: no margin there, or it would sit beside the finger) */
#stick { left: calc(28px + var(--sal)); bottom: calc(40px + var(--sab)); }
body.touch.lefty #stick { left: auto; right: calc(28px + var(--sar)); }
/* the sheets that cover the screen keep their content inside it */
body.touch #dgnres { padding: calc(12px + var(--sat)) calc(12px + var(--sar)) calc(12px + var(--sab)) calc(12px + var(--sal)); }
body.touch #mmenu:not([hidden]) { padding: max(12px, var(--sat)) calc(14px + var(--sar)) calc(14px + var(--sab)) calc(14px + var(--sal)); }
#login { padding-left: calc(16px + var(--sal)); padding-right: calc(16px + var(--sar)); }
/* (next n264) the top-up tab: what a top-up is before the official opening */
#p_cash .cscbt{margin:6px 0 10px;padding:10px 14px;border:1px solid #f59e0b;border-radius:10px;background:rgba(245,158,11,.10);line-height:1.55}
#p_cash .cscbt p{margin:4px 0}
#p_cash .cscbt ul{margin:4px 0 0;padding-left:18px}
