:root {
  --panel: rgba(22, 18, 14, 0.92);
  --panel2: rgba(40, 32, 24, 0.95);
  --edge: #8a6d3b;
  --gold: #e8c46a;
  --text: #eadfc8;
  --dim: #9c8f78;
  --hp: #b8312f;
  --mp: #2f5fb8;
  --exp: #c9a227;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--text);
  font: 14px/1.35 Georgia, "Palatino Linotype", serif; user-select: none; }
canvas#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }
button { font: inherit; color: var(--text); background: linear-gradient(#5a4528, #3b2c18); border: 1px solid var(--edge);
  border-radius: 4px; padding: 5px 12px; cursor: pointer; }
button:hover { background: linear-gradient(#6d5531, #4a3820); }
button.secondary { background: linear-gradient(#3a3530, #26221e); }
button:disabled, button.off { opacity: 0.45; cursor: default; }
input { font: inherit; background: #1b1610; color: var(--text); border: 1px solid var(--edge); border-radius: 3px; padding: 5px 7px; }
.small { font-size: 12px; color: var(--dim); }

/* login */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1d2a22 0%, #070a08 75%); }
.login-box { width: 440px; max-width: calc(100vw - 32px); background: var(--panel); border: 1px solid var(--edge); border-radius: 8px;
  padding: 24px 26px; box-shadow: 0 0 40px rgba(0,0,0,.8); }
.login-box h1 { margin: 0; font-size: 40px; letter-spacing: 3px; color: var(--gold); text-align: center; font-weight: normal; }
.login-box .tag { text-align: center; color: var(--dim); font-style: italic; margin-top: 4px; }
.login-box label { display: block; margin: 10px 0; }
.login-box label input { display: block; width: 100%; margin-top: 3px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.row.buttons { justify-content: space-between; margin-top: 16px; }
.pill { display: inline-flex !important; gap: 4px; align-items: center; margin: 0 !important; }
.pill input { display: inline !important; width: auto !important; }
#login-err { color: #ff8a7a; min-height: 20px; margin-top: 8px; }

/* hud */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
#mapname { position: absolute; left: 12px; top: 10px; font-size: 18px; color: var(--gold); text-shadow: 0 0 4px #000, 0 0 2px #000; pointer-events: none !important; }
#quests { position: absolute; left: 12px; top: 40px; width: 330px; pointer-events: none !important; }
.quest { background: rgba(10,8,6,.6); border-left: 3px solid var(--gold); padding: 5px 9px; margin-bottom: 6px; border-radius: 0 4px 4px 0; }
.quest b { color: var(--gold); }
.quest .where { font-size: 12px; color: var(--dim); }
#banner { position: absolute; top: 18%; left: 0; right: 0; text-align: center; pointer-events: none !important; opacity: 0; transition: opacity .6s; }
#banner.show { opacity: 1; }
#banner-name { font-size: 38px; color: var(--gold); text-shadow: 0 0 10px #000, 0 0 3px #000; letter-spacing: 2px; }
#banner-lv { font-size: 16px; color: var(--text); text-shadow: 0 0 6px #000; }
#mmwrap { position: absolute; right: 10px; top: 10px; }
#minimap { display: block; width: 200px; height: 200px; border: 1px solid var(--edge); border-radius: 6px;
  background: rgba(0,0,0,.55); pointer-events: none !important; }
#targetframe { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--edge);
  border-radius: 5px; padding: 5px 10px; min-width: 220px; text-align: center; pointer-events: none !important; }
#targetframe .bar { height: 10px; background: #300; border-radius: 3px; overflow: hidden; margin-top: 3px; }
#tf-hp { height: 100%; background: var(--hp); width: 100%; }
#groupframe { position: absolute; right: 10px; top: 220px; transition: top .2s; width: 200px; pointer-events: none !important; }
.gm { background: var(--panel); border: 1px solid var(--edge); border-radius: 4px; padding: 3px 6px; margin-bottom: 4px; font-size: 12px; }
.gm .bar { width: 100%; height: 5px; margin-top: 2px; background: #300; border: none; }
.gm .bar div { height: 100%; }

#chat { position: absolute; left: 10px; bottom: 10px; width: 420px; max-width: 40vw; }
#chatlog { height: 150px; overflow-y: auto; background: rgba(0,0,0,.45); border-radius: 4px; padding: 4px 7px; font-size: 13px; }
#chatlog .sys { color: #d8cdb5; } #chatlog .say { color: #fff; } #chatlog .whisper { color: #e59cff; } #chatlog .group { color: #7fd7ff; }
#chatlog .loot { color: #9fe07a; } #chatlog .level { color: var(--gold); font-weight: bold; } #chatlog .death { color: #ff7a6a; }
#chatlog .quest { color: #ffd77a; } #chatlog .world { color: #ffb36b; } #chatlog .info { color: #8fd3ff; }
#chatin { width: 100%; margin-top: 4px; background: rgba(0,0,0,.6); }

#bottom { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bars { display: flex; gap: 8px; }
.bar { position: relative; width: 230px; height: 18px; background: #1a1410; border: 1px solid var(--edge); border-radius: 4px; overflow: hidden; }
.bar > div { height: 100%; transition: width .2s; }
.bar span { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 17px; text-shadow: 0 0 3px #000; }
#hpfill { background: linear-gradient(#d84b45, #8e1f1d); } #mpfill { background: linear-gradient(#4a7ee0, #1f3f8e); }
.expbar { width: 468px; height: 10px; } .expbar span { line-height: 9px; font-size: 10px; }
#expfill { background: linear-gradient(#e8c46a, #9c7a1f); }
#hotbar { display: flex; gap: 4px; }
.slot { position: relative; width: 46px; height: 46px; background: rgba(20,16,12,.9); border: 1px solid var(--edge); border-radius: 4px; overflow: hidden; }
.slot .ic { position: absolute; left: -1px; top: -1px; width: 48px; height: 48px; background-image: url(../assets/icons.png); }
.slot .key { position: absolute; left: 2px; top: 0; font-size: 11px; color: var(--gold); text-shadow: 0 0 2px #000; }
.slot .qty { position: absolute; right: 3px; bottom: 1px; font-size: 11px; text-shadow: 0 0 2px #000, 0 0 2px #000; }
.slot .cdv { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.65); }
.slot.hl { box-shadow: 0 0 6px var(--gold) inset; }
#menubtns { display: flex; gap: 4px; } #menubtns button { padding: 2px 9px; font-size: 12px; }

.win { position: absolute; background: var(--panel); border: 1px solid var(--edge); border-radius: 6px; padding: 8px 10px 10px;
  box-shadow: 0 6px 30px rgba(0,0,0,.6); max-height: calc(100vh - 140px); overflow-y: auto; }
.win .title { font-size: 16px; color: var(--gold); margin-bottom: 6px; cursor: move; display: flex; justify-content: space-between; }
.x { cursor: pointer; color: var(--dim); padding: 0 4px; } .x:hover { color: #fff; }
#win-inv { right: 220px; top: 60px; width: 312px; }
#win-char { left: 360px; top: 60px; width: 300px; }
#win-abil { left: 360px; top: 60px; width: 380px; }
#win-group { right: 220px; top: 60px; width: 260px; }
#win-help { left: 50%; top: 80px; transform: translateX(-50%); width: 560px; max-width: calc(100vw - 32px); }
.inv-grid { display: grid; grid-template-columns: repeat(6, 46px); gap: 4px; margin: 6px 0; }
.equip-grid { display: grid; grid-template-columns: repeat(5, 54px); gap: 4px; }
.eq { text-align: center; font-size: 10px; color: var(--dim); }
.eq .slot { margin: 0 auto; }
.gold { margin: 6px 0 2px; font-size: 13px; }
.statrow { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; border-bottom: 1px solid rgba(138,109,59,.25); }
.statrow button { padding: 0 7px; }
.abrow { display: flex; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid rgba(138,109,59,.25); }
.abrow .slot { flex: none; }
.abrow .desc { flex: 1; font-size: 12px; color: var(--dim); } .abrow .desc b { color: var(--text); font-size: 14px; }

#dialog { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -60%); width: 560px; max-width: calc(100vw - 32px);
  background: var(--panel2); border: 1px solid var(--edge); border-radius: 8px; padding: 12px 16px; box-shadow: 0 6px 40px rgba(0,0,0,.8); }
.dlg-head { display: flex; gap: 12px; align-items: center; }
#dlg-face { background: radial-gradient(#3d3222, #1a140c); border: 1px solid var(--edge); border-radius: 5px; }
#dlg-name { font-size: 20px; color: var(--gold); } #dlg-title { color: var(--dim); font-style: italic; }
#dlg-text { margin: 10px 0; white-space: pre-wrap; }
#dialog { max-height: calc(100vh - 150px); overflow-y: auto; }
#dlg-opts button { display: block; width: 100%; text-align: left; margin: 4px 0; }
#dlg-opts .note { float: right; color: #ff9f8a; font-size: 12px; }
#shop { left: 50%; top: 70px; transform: translateX(-50%); width: 460px; }
.tabs { display: flex; gap: 4px; margin: 6px 0; } .tabs button.on { border-color: var(--gold); color: var(--gold); }
.shoprow { display: flex; gap: 8px; align-items: center; padding: 3px 0; border-bottom: 1px solid rgba(138,109,59,.25); }
.shoprow .nm { flex: 1; } .shoprow .nm .small { display: block; }
.shoprow .pr { color: var(--gold); width: 70px; text-align: right; }
#worldmap { position: absolute; inset: 40px; max-width: 980px; margin: 0 auto; background: var(--panel); border: 1px solid var(--edge); border-radius: 8px; padding: 10px; }
.wm-title { font-size: 20px; color: var(--gold); display: flex; justify-content: space-between; }
#wm-board { position: relative; width: 100%; height: calc(100% - 60px); background: url(../assets/worldmap.png) center/100% 100%; border-radius: 6px; margin: 6px 0; }
.wm-node { position: absolute; transform: translate(-50%, -50%); padding: 4px 10px; font-size: 14px; }
.wm-node .lv { display: block; font-size: 11px; color: var(--dim); }
#prompt { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--edge); border-radius: 6px; padding: 12px; text-align: center; }
#prompt-text { margin-bottom: 8px; }
#playermenu { position: absolute; background: var(--panel2); border: 1px solid var(--edge); border-radius: 5px; padding: 6px; }
#playermenu button { display: block; width: 100%; margin: 3px 0; }
#tooltip { position: absolute; z-index: 50; background: rgba(12,10,8,.96); border: 1px solid var(--edge); border-radius: 4px; padding: 6px 9px;
  max-width: 260px; font-size: 13px; pointer-events: none !important; }
#tooltip .tn { color: var(--gold); font-weight: bold; } #tooltip .rare { color: #c78bff; }
#welcome { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 520px; max-width: calc(100vw - 32px);
  background: var(--panel2); border: 1px solid var(--edge); border-radius: 8px; padding: 16px 22px; text-align: center; }
#welcome h2 { color: var(--gold); font-weight: normal; margin: 4px 0 10px; }
#loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--gold); background: rgba(0,0,0,.7); }
.helpbody p { margin: 6px 0; }

#win-admin { right: 220px; top: 60px; width: 470px; border-color: #b4513c; }
#win-admin .title { color: #ff9b7a; }
.adm-row { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 7px 0; }
.adm-row button { padding: 3px 8px; font-size: 12px; }
.adm-row button.on { border-color: #ffd25a; color: #ffd25a; }
select { font: inherit; font-size: 12px; background: #1b1610; color: var(--text); border: 1px solid var(--edge); border-radius: 3px; padding: 3px; max-width: 220px; }

#win-menu { left: 50%; top: 90px; transform: translateX(-50%); width: 340px; }
.menu-sec { color: var(--gold); margin: 10px 0 4px; border-bottom: 1px solid rgba(138,109,59,.35); }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 0; }
.set-row input[type=range] { flex: 1; max-width: 170px; accent-color: #c9a227; }
.menu-btns { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 8px; }
button.danger { background: linear-gradient(#6a2a20, #43180f); }

/* buffs light blue, debuffs pink */
#buffbar { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; min-height: 18px; max-width: 640px; }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 9px; border: 1px solid; text-shadow: 0 0 2px #000; }
.chip.good { background: rgba(80, 170, 230, .28); border-color: #8fd3ff; color: #d6f0ff; }
.chip.bad { background: rgba(230, 90, 160, .28); border-color: #ff8fcf; color: #ffd6ec; }
#tf-debuffs { display: flex; gap: 4px; justify-content: center; margin-top: 3px; }
.hotrow { display: flex; gap: 10px; align-items: flex-end; }
#passivebar { display: flex; gap: 3px; flex-wrap: wrap-reverse; max-width: 110px; justify-content: flex-end; }
.pslot { position: relative; width: 26px; height: 26px; border: 1px solid #5d7f9c; border-radius: 4px; overflow: hidden; opacity: .9; }
.pslot.chain { border-color: #c9a227; }
.pslot .ic { position: absolute; left: 0; top: 0; width: 48px; height: 48px; transform: scale(.54); transform-origin: 0 0; background-image: url(../assets/icons.png); }
#castbar { position: absolute; left: 50%; bottom: 190px; transform: translateX(-50%); width: 260px; height: 16px; background: #1a1410;
  border: 1px solid var(--gold); border-radius: 4px; overflow: hidden; pointer-events: none !important; }
#cast-fill { height: 100%; background: linear-gradient(#c8a8ff, #6a46c0); width: 0; }
#cast-name { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 15px; text-shadow: 0 0 3px #000; }

#dlg-opts button.ok { background: linear-gradient(#3f6d2e, #26461a); border-color: #8fd36a; color: #e6ffd8; }
#dlg-opts button.danger.short { width: auto; display: block; margin: 8px 0 4px auto; text-align: center; font-size: 12px; padding: 3px 12px;
  background: linear-gradient(#6a2a20, #43180f); border-color: #b4513c; color: #ffd6c8; }
#dlg-opts button.danger.short.off { opacity: .4; }
#confirm { position: absolute; left: 50%; top: 35%; transform: translateX(-50%); z-index: 40; width: 380px; max-width: calc(100vw - 32px);
  background: var(--panel2); border: 1px solid #b4513c; border-radius: 8px; padding: 14px 16px; box-shadow: 0 6px 40px rgba(0,0,0,.8); }
#confirm .buttons { justify-content: flex-end; margin-top: 12px; }


#tooltip .cmp { margin-top: 5px; padding-top: 4px; border-top: 1px solid rgba(138,109,59,.4); font-size: 12px; color: var(--dim); }
#tooltip .up { color: #8fe07a; } #tooltip .down { color: #ff7a6a; } #tooltip .warn { color: #ffb36b; }
.slot.worn { box-shadow: 0 0 0 2px #c98a2a inset; } .slot.broken { box-shadow: 0 0 0 2px #c0392b inset; } .slot.broken .ic { filter: grayscale(1) brightness(.6); }

#mmbtns { position: absolute; left: 4px; top: 4px; display: flex; flex-direction: column; gap: 3px; }
#mmbtns button { width: 24px; height: 24px; padding: 0; line-height: 20px; font-size: 16px; font-weight: bold; opacity: .85; }
#mmbtns button:disabled { opacity: .3; cursor: default; }

#win-who { right: 220px; top: 60px; width: 300px; }
.whorow { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px; border-bottom: 1px solid rgba(138,109,59,.25); cursor: pointer; border-radius: 3px; }
.whorow:hover { background: rgba(232,196,106,.12); }
.whorow .wn { color: var(--gold); } .whorow.me { cursor: default; opacity: .7; } .whorow.me:hover { background: none; }
.whorow .grp { color: #7fd7ff; font-size: 11px; margin-left: 4px; }
/* Elhaym's prayer prompt and her group frame */
#prompt.holy { border-color: #e8cf7a; box-shadow: 0 0 24px rgba(255, 225, 140, .35); }
#prompt.holy #prompt-yes { background: linear-gradient(#f3dc8a, #c9a44a); color: #2a1e08; }
.gm.allyframe { border-left: 3px solid #e8cf7a; }

#ap-badge { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 40; pointer-events: none;
  background: rgba(20, 40, 70, .82); color: #bfe3ff; border: 1px solid #5aa0e0; border-radius: 6px; padding: 4px 12px;
  font-size: 13px; letter-spacing: .5px; box-shadow: 0 0 12px rgba(90,160,224,.45); }

/* character creation */
.create-grid { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: center; }
#create-preview { background: radial-gradient(ellipse at 50% 70%, rgba(255,220,150,.12), rgba(0,0,0,.35) 70%);
  border: 1px solid var(--edge); border-radius: 6px; cursor: pointer; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); padding: 0; cursor: pointer; }
.swatch.on { border-color: var(--gold); box-shadow: 0 0 6px var(--gold); }
@media (max-width: 420px) { .create-grid { grid-template-columns: 1fr; justify-items: center; } }
