:root {
  --gold: #e8c26a;
  --gold-dim: #a8873e;
  --gold-dark: #6b5428;
  --panel: rgba(14, 12, 10, 0.92);
  --panel-2: rgba(28, 24, 20, 0.95);
  --border: #7a6234;
  --text: #f1e6cf;
  --muted: #b7a98c;
  --red: #e0412f;
  --blue: #4f8cff;
  --green: #3fdc5a;
  --hp: #27b23a;
  --mana: #2f6bff;
  --rage: #c62828;
  --energy: #e8d33b;
  --font-head: 'Cinzel', 'Georgia', serif;
  --font-body: 'Alegreya Sans', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--text); font-family: var(--font-body); font-size: 14px; user-select: none; -webkit-user-select: none; }
canvas#world { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; image-rendering: auto; }
.hidden { display: none !important; }
button { font-family: var(--font-body); }
input { font-family: var(--font-body); user-select: text; -webkit-user-select: text; }

/* ------------------------------------------------------------- buttons & panels */
.btn {
  background: linear-gradient(#5a1a12, #3a0e0a); color: var(--gold); border: 1px solid var(--gold-dim);
  border-radius: 4px; padding: 7px 14px; font-family: var(--font-head); font-weight: 700; font-size: 13px; cursor: pointer;
  text-shadow: 0 1px 2px #000; box-shadow: inset 0 1px 0 rgba(255,220,150,.15), 0 2px 4px rgba(0,0,0,.6); letter-spacing: .5px;
}
.btn:hover { background: linear-gradient(#7a2418, #4e140e); color: #fff1c4; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: linear-gradient(#8a2a14, #5a160a); }
.btn-large { font-size: 17px; padding: 11px 28px; }
.btn-danger { background: linear-gradient(#3a1414, #220808); }
.btn-subtle { background: linear-gradient(#2c2a26, #1a1916); color: var(--muted); }
.btn-small { padding: 3px 9px; font-size: 11px; }

.panel {
  background: var(--panel); border: 2px solid var(--border); border-radius: 8px;
  box-shadow: 0 0 0 1px #000, inset 0 0 18px rgba(0,0,0,.8), 0 10px 30px rgba(0,0,0,.7); padding: 16px;
}
h1, h2, h3 { font-family: var(--font-head); color: var(--gold); margin: 0 0 10px; text-shadow: 0 2px 3px #000; }
h2 { font-size: 20px; }

/* ------------------------------------------------------------- front-end screens */
.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 10;
  background: radial-gradient(ellipse at 50% 30%, rgba(40,30,60,.55), rgba(0,0,0,.92) 70%), url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4"><rect width="4" height="4" fill="%23050508"/><rect width="1" height="1" fill="%23101018"/></svg>');
}
.title-block { text-align: center; margin-bottom: 26px; }
.logo {
  font-family: var(--font-head); font-weight: 900; font-size: 84px; letter-spacing: 6px; margin: 0;
  background: linear-gradient(#fff4c8, #e8c26a 45%, #8a5a1e); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 6px #000) drop-shadow(0 0 22px rgba(255,170,60,.35));
}
.logo.small { font-size: 54px; }
.tagline { font-family: var(--font-head); color: var(--muted); letter-spacing: 4px; font-size: 15px; margin-top: 4px; }
.login-panel { width: 360px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab { flex: 1; background: #1d1a16; color: var(--muted); border: 1px solid #3c3222; padding: 8px; border-radius: 4px; cursor: pointer; font-family: var(--font-head); font-weight: 700; }
.tab.active { background: #3a2a16; color: var(--gold); border-color: var(--gold-dim); }
.login-panel label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.login-panel input, .create-name-row input {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px; background: #0b0a09; color: var(--text); border: 1px solid #4a3c26;
  border-radius: 4px; font-size: 15px; outline: none;
}
.login-panel input:focus, .create-name-row input:focus { border-color: var(--gold-dim); box-shadow: 0 0 6px rgba(232,194,106,.3); }
.login-panel .btn-primary { width: 100%; margin-top: 6px; }
.form-error { color: #ff6b5b; min-height: 20px; margin-top: 8px; font-size: 13px; text-align: center; }
.hint { color: var(--muted); font-size: 12px; text-align: center; margin-top: 4px; }
.conn-status { position: fixed; bottom: 14px; color: var(--muted); font-size: 12px; }

.chars-layout { display: flex; gap: 40px; align-items: center; }
.chars-panel { width: 340px; max-height: 80vh; display: flex; flex-direction: column; }
.account-name { color: var(--muted); font-size: 12px; margin-top: -6px; margin-bottom: 10px; }
#char-list { flex: 1; overflow-y: auto; min-height: 120px; }
.char-entry { padding: 10px 12px; border: 1px solid #3a2e1c; border-radius: 6px; margin-bottom: 8px; cursor: pointer; background: rgba(40,32,22,.5); }
.char-entry:hover { border-color: var(--gold-dim); }
.char-entry.selected { border-color: var(--gold); background: rgba(90,60,20,.45); box-shadow: inset 0 0 12px rgba(232,194,106,.2); }
.char-entry .ce-name { font-family: var(--font-head); font-weight: 700; color: var(--gold); font-size: 16px; }
.char-entry .ce-info { color: var(--muted); font-size: 12px; }
.chars-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.char-preview-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#char-preview { background: radial-gradient(circle, rgba(232,194,106,.12), transparent 65%); }
.char-preview-name { font-family: var(--font-head); font-size: 26px; color: var(--gold); }
.char-preview-info { color: var(--muted); margin-bottom: 10px; }
.no-chars { color: var(--muted); text-align: center; padding: 30px 10px; }

.create-layout { display: flex; gap: 26px; align-items: stretch; max-height: 92vh; }
.create-left, .create-right { width: 330px; overflow-y: auto; }
.create-center { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; width: 380px; }
#create-preview { background: radial-gradient(circle, rgba(232,194,106,.14), transparent 65%); }
.create-name-row { display: flex; gap: 6px; width: 300px; align-items: center; }
.create-name-row input { margin-top: 0; text-align: center; font-family: var(--font-head); font-size: 18px; }
.create-buttons { display: flex; gap: 10px; }
.faction-label { font-family: var(--font-head); font-size: 13px; letter-spacing: 1px; margin: 8px 0 6px; }
.faction-label.concord { color: var(--blue); }
.faction-label.dominion { color: var(--red); }
.choice-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
#class-grid { grid-template-columns: repeat(4, 1fr); }
.choice { border: 1px solid #3a2e1c; border-radius: 6px; padding: 4px 2px 3px; cursor: pointer; background: rgba(40,32,22,.6); text-align: center; font-size: 11px; color: var(--muted); }
.choice canvas { display: block; margin: 0 auto; }
.choice:hover { border-color: var(--gold-dim); color: var(--text); }
.choice.selected { border-color: var(--gold); background: rgba(100,70,24,.55); color: var(--gold); box-shadow: 0 0 8px rgba(232,194,106,.35); }
.choice-desc { margin-top: 12px; font-size: 13px; line-height: 1.45; color: var(--text); }
.choice-desc h3 { font-size: 17px; margin-bottom: 4px; }
.choice-desc .racial { color: var(--green); margin-top: 6px; }
.choice-desc .role { color: var(--gold-dim); font-size: 12px; margin-bottom: 4px; }

.loading-inner { text-align: center; }
.loading-bar { width: 420px; height: 16px; border: 2px solid var(--border); border-radius: 8px; margin: 24px auto 14px; overflow: hidden; background: #0b0a09; }
.loading-fill { height: 100%; width: 30%; background: linear-gradient(90deg, #8a5a1e, #e8c26a); animation: load 1.2s ease-in-out infinite alternate; }
@keyframes load { from { width: 15%; } to { width: 100%; } }
.loading-tip { color: var(--muted); max-width: 480px; }

/* ------------------------------------------------------------- HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }
#hud #error-text, #hud #zone-text, #hud #center-msg { pointer-events: none; }

.unit-frame {
  position: absolute; top: 12px; left: 12px; width: 268px; height: 74px; display: flex; align-items: center; gap: 6px;
  background: linear-gradient(rgba(20,16,12,.88), rgba(10,8,6,.88)); border: 2px solid var(--border); border-radius: 38px 10px 10px 38px; padding: 4px 8px 4px 4px;
  box-shadow: 0 3px 10px rgba(0,0,0,.6);
}
.unit-frame .portrait { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--gold-dim); background: #111; flex: none; }
.unit-frame.target { left: 296px; cursor: pointer; }
.uf-body { flex: 1; min-width: 0; }
.uf-name { font-family: var(--font-head); font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; text-shadow: 0 1px 2px #000; }
.uf-level { display: inline-block; min-width: 22px; text-align: center; background: #000; border: 1px solid var(--gold-dark); border-radius: 9px; font-size: 11px; margin-right: 5px; padding: 0 4px; }
.uf-sub { font-size: 11px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { position: relative; height: 15px; background: #111; border: 1px solid #000; border-radius: 3px; overflow: hidden; margin-bottom: 3px; box-shadow: inset 0 1px 3px rgba(0,0,0,.8); }
.bar.small { height: 8px; margin: 0; }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: linear-gradient(#3fdc5a, #1d8a2c); transition: width .12s linear; }
.bar.pw .fill { background: linear-gradient(#5a8cff, #2346b0); }
.bar.pw.rage .fill { background: linear-gradient(#e04848, #8a1414); }
.bar.pw.energy .fill { background: linear-gradient(#f5e45a, #b0a01e); }
.bar .bar-text { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 14px; font-weight: 700; text-shadow: 0 0 2px #000, 0 1px 1px #000; }
.combo-points { display: flex; gap: 4px; height: 8px; margin-top: 1px; }
.combo-points .cp { width: 12px; height: 8px; border-radius: 4px; background: #2a2418; border: 1px solid #000; }
.combo-points .cp.on { background: radial-gradient(#ffe36b, #c0392b); box-shadow: 0 0 5px #ff9a3a; }
.combat-icon { position: absolute; left: 50px; bottom: -2px; color: #ff4a3a; font-size: 18px; text-shadow: 0 0 6px #f00; display: none; }
.unit-frame.in-combat .combat-icon { display: block; }
.elite-dragon { position: absolute; right: -14px; top: -10px; font-size: 26px; display: none; filter: drop-shadow(0 2px 2px #000); }
.target-auras { position: absolute; left: 70px; top: 76px; display: flex; flex-wrap: wrap; gap: 2px; width: 220px; }
.target-cast { position: absolute; left: 74px; top: -20px; width: 180px; height: 14px; background: #111; border: 1px solid #000; border-radius: 3px; overflow: hidden; }
.target-cast .fill { height: 100%; background: linear-gradient(#ffcf5a, #b07a14); }
.target-cast span { position: absolute; inset: 0; font-size: 10px; text-align: center; line-height: 13px; font-weight: 700; text-shadow: 0 0 2px #000; }
.mini-frame { position: absolute; width: 130px; background: rgba(10,8,6,.85); border: 1px solid var(--border); border-radius: 6px; padding: 3px 5px; font-size: 11px; cursor: pointer; }
.mini-frame .mf-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
#pet-frame { top: 90px; left: 60px; }
#tot-frame { top: 90px; left: 440px; }
#party-frames { position: absolute; top: 122px; left: 12px; display: flex; flex-direction: column; gap: 6px; }
.party-member { width: 190px; background: rgba(10,8,6,.85); border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; cursor: pointer; position: relative; }
.party-member .pm-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.party-member .pm-name .leader { color: var(--gold); }
.party-member .bar { height: 10px; margin-bottom: 2px; }
.party-member .bar .bar-text { font-size: 9px; line-height: 9px; }
.party-member.dead { opacity: .55; }
.party-member.far { opacity: .7; }
#buffs { position: absolute; top: 12px; right: 196px; display: flex; flex-direction: row-reverse; flex-wrap: wrap; gap: 4px; max-width: 420px; }
.aura { position: relative; width: 30px; height: 30px; border: 1px solid #000; border-radius: 3px; overflow: hidden; cursor: default; box-shadow: 0 1px 3px #000; }
.aura img { width: 100%; height: 100%; display: block; }
.aura.debuff { border-color: #c0392b; }
.aura .aura-time { position: absolute; bottom: -1px; left: 0; right: 0; text-align: center; font-size: 10px; font-weight: 700; text-shadow: 0 0 2px #000, 0 0 2px #000; }
.target-auras .aura { width: 22px; height: 22px; }
.target-auras .aura .aura-time { font-size: 9px; }
.aura.mine { box-shadow: 0 0 0 1px var(--gold); }

#minimap-wrap { position: absolute; top: 8px; right: 10px; width: 178px; display: flex; flex-direction: column; align-items: center; }
#zone-name { font-family: var(--font-head); font-weight: 700; font-size: 13px; color: var(--gold); text-shadow: 0 1px 2px #000; margin-bottom: 3px; white-space: nowrap; }
#zone-name.pvp { color: #ff8a5a; }
#zone-name.sanctuary { color: #8aff9a; }
#minimap { width: 168px; height: 168px; border-radius: 50%; border: 3px solid var(--border); box-shadow: 0 0 0 1px #000, 0 4px 12px rgba(0,0,0,.7); background: #000; cursor: pointer; }
#coords, #clock { font-size: 11px; color: var(--muted); text-shadow: 0 1px 1px #000; }

#quest-tracker { position: absolute; top: 236px; right: 12px; width: 230px; font-size: 12px; text-shadow: 0 1px 2px #000, 0 0 3px #000; pointer-events: none !important; }
#quest-tracker .qt-title { color: var(--gold); font-weight: 700; margin-top: 6px; font-size: 13px; }
#quest-tracker .qt-title.complete { color: var(--green); }
#quest-tracker .qt-obj { color: #ddd; padding-left: 8px; }
#quest-tracker .qt-obj.done { color: #8a8a8a; }
#quest-tracker .qt-head { font-family: var(--font-head); color: var(--gold-dim); font-size: 11px; letter-spacing: 1px; }

#chat { position: absolute; left: 12px; bottom: 14px; width: 440px; height: 236px; display: flex; flex-direction: column; }
#chat-tabs { display: flex; gap: 3px; }
.chat-tab { font-size: 11px; padding: 2px 8px; background: rgba(10,8,6,.7); border: 1px solid #3a2e1c; border-bottom: none; border-radius: 5px 5px 0 0; cursor: pointer; color: var(--muted); }
.chat-tab.active { color: var(--gold); background: rgba(30,24,16,.85); }
#chat-log { flex: 1; overflow-y: auto; background: rgba(0,0,0,.35); border: 1px solid rgba(90,70,40,.5); padding: 4px 6px; font-size: 13px; line-height: 1.32; text-shadow: 0 1px 1px #000; user-select: text; -webkit-user-select: text; }
#chat-log::-webkit-scrollbar { width: 6px; }
#chat-log::-webkit-scrollbar-thumb { background: #5a4628; border-radius: 3px; }
.chat-line { word-wrap: break-word; }
.chat-line .cname { cursor: pointer; }
.chat-line .cname:hover { text-decoration: underline; }
.chat-line .ilink { cursor: pointer; }
.chat-line .ilink:hover { text-decoration: underline; }
#chat-input-wrap { display: none; align-items: center; background: rgba(0,0,0,.8); border: 1px solid var(--gold-dim); padding: 2px 6px; }
#chat-input-wrap.active { display: flex; }
#chat-channel { font-size: 13px; margin-right: 5px; white-space: nowrap; }
#chat-input { flex: 1; background: transparent; border: none; color: #fff; font-size: 13px; outline: none; padding: 3px 0; }

#castbar { position: absolute; left: 50%; bottom: 168px; transform: translateX(-50%); width: 260px; height: 20px; background: #111; border: 2px solid var(--border); border-radius: 4px; overflow: hidden; box-shadow: 0 2px 8px #000; }
#castbar .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(#ffd25a, #c08a1a); }
#castbar.channel .fill { background: linear-gradient(#5ad2ff, #1a7ac0); }
#castbar.failed .fill { background: linear-gradient(#ff5a5a, #a01a1a); width: 100% !important; }
#castbar .cb-text { position: absolute; left: 8px; top: 0; line-height: 18px; font-size: 12px; font-weight: 700; text-shadow: 0 0 2px #000; }
#castbar .cb-time { position: absolute; right: 8px; top: 0; line-height: 18px; font-size: 11px; text-shadow: 0 0 2px #000; }

#bottom { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
#actionbars { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px 4px; background: linear-gradient(rgba(20,16,12,.85), rgba(10,8,6,.92)); border: 2px solid var(--border); border-bottom: none; border-radius: 10px 10px 0 0; }
.actionbar { display: flex; gap: 4px; }
.abtn { position: relative; width: 44px; height: 44px; border: 1px solid #000; border-radius: 4px; background: rgba(0,0,0,.55); box-shadow: inset 0 0 0 1px #3a2e1c; cursor: pointer; overflow: hidden; }
.abtn img { width: 100%; height: 100%; display: block; pointer-events: none; }
.abtn:hover { box-shadow: inset 0 0 0 2px var(--gold); }
.abtn .key { position: absolute; top: 1px; right: 3px; font-size: 10px; font-weight: 700; color: #ddd; text-shadow: 0 0 2px #000, 0 0 2px #000; pointer-events: none; z-index: 3; }
.abtn .count { position: absolute; bottom: 1px; right: 3px; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 0 2px #000, 0 0 2px #000; pointer-events: none; z-index: 3; }
.abtn .cd { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.abtn .cd-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; pointer-events: none; z-index: 3; }
.abtn.nopower img { filter: saturate(.3) brightness(.55) sepia(1) hue-rotate(190deg) saturate(3); }
.abtn.unusable img { filter: grayscale(1) brightness(.5); }
.abtn.oor .key { color: #ff4040; }
.abtn.active { box-shadow: inset 0 0 0 2px #ffe36b, 0 0 8px #ffe36b; }
.abtn.casting { box-shadow: inset 0 0 0 2px #fff; }
.abtn.pressed { transform: scale(.94); }
.abtn.empty { background: rgba(0,0,0,.35); }
.abtn.flash::after { content: ''; position: absolute; inset: 0; background: rgba(255,255,200,.45); animation: flash .25s ease-out forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
#xpbar { position: relative; width: 100%; min-width: 560px; height: 12px; background: #0d0a14; border: 2px solid var(--border); border-radius: 0 0 6px 6px; overflow: hidden; }
#xpbar .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(#b05aff, #5a1aa0); transition: width .3s; }
#xpbar .bar-text { position: absolute; inset: 0; text-align: center; font-size: 10px; line-height: 9px; font-weight: 700; text-shadow: 0 0 2px #000; }
#micro-menu { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 3px; }
#micro-menu button { width: 34px; height: 34px; background: linear-gradient(#3a2a16, #1e150a); border: 1px solid var(--gold-dim); border-radius: 5px; color: var(--gold); font-size: 16px; cursor: pointer; box-shadow: 0 2px 4px #000; }
#micro-menu button:hover { background: linear-gradient(#5a3e1a, #2e200e); }
#micro-menu button.has-alert { animation: pulse 1s infinite alternate; }
@keyframes pulse { to { box-shadow: 0 0 10px var(--gold); } }

#error-text { position: absolute; top: 17%; left: 50%; transform: translateX(-50%); font-size: 17px; color: #ff3c2e; font-weight: 700; text-shadow: 0 1px 2px #000, 0 0 4px #000; text-align: center; white-space: nowrap; }
#error-text div { animation: errfade 2.4s forwards; }
@keyframes errfade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
#zone-text { position: absolute; top: 24%; left: 50%; transform: translateX(-50%); text-align: center; opacity: 0; }
#zone-text.show { animation: zonefade 4.5s forwards; }
@keyframes zonefade { 0% { opacity: 0; } 12% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
#zone-text .zt-name { font-family: var(--font-head); font-weight: 900; font-size: 44px; color: var(--gold); text-shadow: 0 3px 6px #000, 0 0 18px rgba(0,0,0,.8); }
#zone-text .zt-sub { font-family: var(--font-head); font-size: 17px; color: #ddd; text-shadow: 0 2px 4px #000; }
#center-msg { position: absolute; top: 34%; left: 50%; transform: translateX(-50%); font-family: var(--font-head); font-size: 34px; font-weight: 900; color: #ffe36b; text-shadow: 0 3px 6px #000; opacity: 0; white-space: nowrap; }
#center-msg.show { animation: zonefade 3s forwards; }

/* ------------------------------------------------------------- windows */
.window { position: absolute; background: var(--panel); border: 2px solid var(--border); border-radius: 8px; box-shadow: 0 0 0 1px #000, 0 10px 30px rgba(0,0,0,.75); min-width: 220px; }
.window .win-title { font-family: var(--font-head); font-weight: 700; color: var(--gold); padding: 7px 34px 7px 12px; background: linear-gradient(rgba(70,48,20,.8), rgba(30,20,10,.8)); border-bottom: 1px solid var(--border); border-radius: 6px 6px 0 0; cursor: move; text-shadow: 0 1px 2px #000; font-size: 14px; }
.window .win-close { position: absolute; top: 5px; right: 6px; width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--gold-dark); background: #3a1010; color: var(--gold); cursor: pointer; font-size: 13px; line-height: 18px; padding: 0; }
.window .win-close:hover { background: #6a1a1a; }
.window .win-body { padding: 10px 12px; max-height: 74vh; overflow-y: auto; }
.window .win-body::-webkit-scrollbar { width: 7px; }
.window .win-body::-webkit-scrollbar-thumb { background: #5a4628; border-radius: 3px; }

.slot { position: relative; width: 40px; height: 40px; border: 1px solid #000; border-radius: 4px; background: rgba(0,0,0,.55); box-shadow: inset 0 0 0 1px #3a2e1c; cursor: pointer; }
.slot img { width: 100%; height: 100%; display: block; border-radius: 3px; pointer-events: none; }
.slot .count { position: absolute; bottom: 1px; right: 3px; font-size: 11px; font-weight: 700; text-shadow: 0 0 2px #000, 0 0 2px #000; pointer-events: none; }
.slot:hover { box-shadow: inset 0 0 0 2px var(--gold); }
.slot.q0 { box-shadow: inset 0 0 0 1px #6a6a6a; } .slot.q2 { box-shadow: inset 0 0 0 2px #1eff00; } .slot.q3 { box-shadow: inset 0 0 0 2px #0070dd; } .slot.q4 { box-shadow: inset 0 0 0 2px #a335ee; }
.slot.unusable img { filter: sepia(1) hue-rotate(-30deg) saturate(4) brightness(.7); }
.slot.drop-hover { box-shadow: inset 0 0 0 2px #fff !important; }
.slot .slot-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; color: #6a5a40; text-align: center; pointer-events: none; }
.bag-grid { display: grid; grid-template-columns: repeat(6, 40px); gap: 4px; }
.money { font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.money .g { color: #ffd23a; } .money .s { color: #d8d8e8; } .money .c { color: #e08a4a; }
.bag-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

.char-window { display: flex; gap: 14px; }
.paperdoll { display: grid; grid-template-columns: 40px 120px 40px; grid-template-rows: repeat(4, 44px); gap: 4px; align-items: center; justify-items: center; }
.paperdoll canvas { grid-column: 2; grid-row: 1 / span 4; }
.stat-list { min-width: 190px; font-size: 13px; }
.stat-list .st-row { display: flex; justify-content: space-between; padding: 1px 0; border-bottom: 1px solid rgba(90,70,40,.25); }
.stat-list .st-row span:last-child { color: #fff; font-weight: 700; }
.stat-list .st-head { color: var(--gold); font-family: var(--font-head); margin-top: 8px; font-size: 12px; }

.spell-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 560px; }
.spell-entry { display: flex; gap: 8px; align-items: center; padding: 4px; border: 1px solid rgba(90,70,40,.4); border-radius: 5px; background: rgba(30,24,16,.5); }
.spell-entry.locked { opacity: .45; }
.spell-entry .slot { flex: none; }
.spell-entry .sp-name { font-weight: 700; color: var(--text); font-size: 13px; }
.spell-entry .sp-sub { font-size: 11px; color: var(--muted); }

.quest-log { display: flex; gap: 10px; width: 640px; height: 420px; }
.ql-list { width: 230px; overflow-y: auto; border-right: 1px solid rgba(90,70,40,.4); padding-right: 6px; }
.ql-zone { color: var(--gold-dim); font-family: var(--font-head); font-size: 12px; margin-top: 6px; }
.ql-item { padding: 3px 6px; cursor: pointer; border-radius: 4px; font-size: 13px; }
.ql-item:hover { background: rgba(90,70,40,.3); }
.ql-item.selected { background: rgba(120,90,30,.45); }
.ql-detail { flex: 1; overflow-y: auto; font-size: 13px; line-height: 1.45; }
.quest-text { color: #e8dcc0; margin-bottom: 8px; }
.quest-section { color: var(--gold); font-family: var(--font-head); font-size: 13px; margin: 10px 0 4px; }
.quest-objectives div { padding-left: 6px; }
.quest-objectives .done { color: #8a8a8a; text-decoration: line-through; }
.reward-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.qcolor-0 { color: #9d9d9d; } .qcolor-1 { color: #fff; } .qcolor-2 { color: #1eff00; } .qcolor-3 { color: #0070dd; } .qcolor-4 { color: #a335ee; }

.dialog-window { width: 380px; }
.npc-greeting { color: #e8dcc0; margin-bottom: 10px; font-style: italic; }
.gossip-option { display: flex; align-items: center; gap: 8px; padding: 5px 6px; cursor: pointer; border-radius: 4px; color: var(--text); }
.gossip-option:hover { background: rgba(90,70,40,.35); color: #fff; }
.gossip-option .gi { width: 18px; text-align: center; font-weight: 900; font-size: 15px; }
.gi.avail { color: #ffd23a; } .gi.active { color: #9a9a9a; } .gi.complete { color: #ffd23a; } .gi.other { color: var(--muted); }
.dialog-buttons { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; }
.vendor-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 520px; }
.vendor-item { display: flex; gap: 6px; align-items: center; padding: 3px; border: 1px solid rgba(90,70,40,.35); border-radius: 5px; cursor: pointer; background: rgba(30,24,16,.4); }
.vendor-item:hover { border-color: var(--gold-dim); }
.vendor-item .vi-name { font-size: 12px; font-weight: 700; line-height: 1.2; }
.vendor-item .vi-price { font-size: 11px; }
.vendor-item.cant-afford .vi-price { opacity: .5; }
.vendor-hint { font-size: 11px; color: var(--muted); margin-top: 8px; }
.flight-option { display: flex; justify-content: space-between; padding: 6px 8px; border: 1px solid rgba(90,70,40,.35); border-radius: 5px; margin-bottom: 5px; cursor: pointer; }
.flight-option:hover { border-color: var(--gold); background: rgba(90,70,40,.25); }

.loot-window { width: 230px; }
.loot-item { display: flex; align-items: center; gap: 8px; padding: 3px; cursor: pointer; border-radius: 4px; }
.loot-item:hover { background: rgba(90,70,40,.35); }
.loot-item .li-name { font-size: 13px; font-weight: 700; }

.social-list { width: 420px; }
.social-row { display: grid; grid-template-columns: 1fr 40px 120px 60px; gap: 6px; padding: 4px; border-bottom: 1px solid rgba(90,70,40,.25); align-items: center; font-size: 13px; }
.social-row .btn { padding: 2px 6px; font-size: 10px; }

.map-window canvas { display: block; border: 1px solid #000; cursor: crosshair; }
.help-window { width: 560px; font-size: 13px; line-height: 1.5; }
.help-window kbd { display: inline-block; background: #2a241a; border: 1px solid #5a4628; border-radius: 3px; padding: 0 5px; font-family: var(--font-body); font-size: 12px; color: var(--gold); min-width: 18px; text-align: center; }
.help-window table { width: 100%; border-collapse: collapse; }
.help-window td { padding: 2px 4px; vertical-align: top; }
.help-window h3 { font-size: 14px; margin: 10px 0 4px; }
.menu-window { width: 240px; }
.menu-window .btn { display: block; width: 100%; margin-bottom: 6px; }
.menu-option { display: flex; align-items: center; justify-content: space-between; margin: 6px 0; font-size: 13px; }

/* ------------------------------------------------------------- popups */
#popups { position: absolute; top: 28%; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.popup { background: var(--panel); border: 2px solid var(--border); border-radius: 8px; padding: 14px 18px; text-align: center; min-width: 300px; box-shadow: 0 10px 30px rgba(0,0,0,.8); }
.popup p { margin: 0 0 12px; font-size: 15px; }
.popup .popup-buttons { display: flex; gap: 10px; justify-content: center; }
.popup.death p { font-family: var(--font-head); font-size: 20px; color: #ff6b5b; }

/* ------------------------------------------------------------- tooltip & drag */
#tooltip {
  position: fixed; z-index: 100; max-width: 320px; background: rgba(8,8,22,.96); border: 1px solid #8a8aa8; border-radius: 5px; padding: 8px 10px;
  font-size: 13px; line-height: 1.38; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.8);
}
#tooltip .tt-title { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
#tooltip .tt-sub { color: #fff; }
#tooltip .tt-row { display: flex; justify-content: space-between; gap: 18px; }
#tooltip .tt-green { color: #1eff00; } #tooltip .tt-yellow { color: #ffd100; } #tooltip .tt-red { color: #ff2020; } #tooltip .tt-grey { color: #9d9d9d; }
#tooltip .tt-desc { color: #ffd100; margin-top: 4px; }
#tooltip .tt-hint { color: #8a8a8a; font-size: 11px; margin-top: 4px; }
#drag-ghost { position: fixed; z-index: 101; width: 40px; height: 40px; pointer-events: none; opacity: .85; border-radius: 4px; overflow: hidden; }
#drag-ghost img { width: 100%; height: 100%; }
#fade { position: fixed; inset: 0; background: #000; z-index: 50; pointer-events: none; opacity: 0; transition: opacity .35s; }
#fade.on { opacity: 1; }
#disconnected { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; }
#disconnected .panel { text-align: center; width: 340px; }
