[hidden] { display: none !important; }
:root {
  --bg: #0c0a0d; --panel: rgba(18, 14, 16, 0.94); --edge: #4a3a2a; --gold: #d8b04a; --text: #e6dccb; --dim: #9a8f80;
  --magic: #6f8cff; --rare: #ffe14d; --set: #3fe05a; --unique: #d8a656; --red: #c83030; --blue: #3050c8;
  font-family: Georgia, 'Times New Roman', serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; user-select: none; }
button, input, select { font: inherit; }
button { background: linear-gradient(#3a2c1e, #241a12); color: var(--text); border: 1px solid var(--edge); padding: 6px 12px; cursor: pointer; border-radius: 3px; }
button:hover { border-color: var(--gold); color: #fff; }
button:disabled { opacity: .45; cursor: default; }
button.alt { background: linear-gradient(#262a34, #16181e); }
button.link { background: none; border: none; color: var(--dim); text-decoration: underline; padding: 0; }
button.on { border-color: var(--gold); color: var(--gold); }
input, select { background: #15110f; color: var(--text); border: 1px solid var(--edge); padding: 6px 8px; border-radius: 3px; }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.err { color: #ff6a5a; min-height: 1.2em; }
a[data-act] { color: var(--gold); cursor: pointer; text-decoration: none; }
a[data-act]:hover { text-decoration: underline; }

/* ---------- Screens ---------- */
#screens { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 16px;
  background: radial-gradient(ellipse at 50% 30%, #2a1a14 0%, #0c0a0d 70%); overflow: auto; }
.brand { text-align: center; }
.brand h1 { font-size: 56px; letter-spacing: 14px; margin: 0; color: #c8402c; text-shadow: 0 0 24px #7a1a10, 0 2px 0 #000; }
.brand p { margin: 4px 0 0; color: var(--dim); letter-spacing: 4px; }
.card { background: var(--panel); border: 1px solid var(--edge); padding: 20px 24px; width: min(520px, 100%); border-radius: 4px; box-shadow: 0 10px 40px #000; }
.card.wide { width: min(820px, 100%); }
.card h2 { margin: 0 0 12px; color: var(--gold); font-weight: normal; }
.cardhead { display: flex; align-items: baseline; gap: 12px; }
.cardhead h2 { flex: 1; }
.card label { display: block; margin: 8px 0; }
.card label input { width: 100%; margin-top: 4px; }
.row2 { display: flex; gap: 10px; margin-top: 12px; }
.classes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.cls { border: 1px solid var(--edge); padding: 8px; border-radius: 3px; cursor: pointer; font-size: 13px; }
.cls input { width: auto; margin: 0 6px 0 0; }
.cls span { display: block; color: var(--dim); margin-top: 4px; }
.cls:has(input:checked) { border-color: var(--gold); background: #2a2018; }
.check input { width: auto; }
.charrow { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid #2a221a; margin-bottom: 6px; border-radius: 3px; }
.charrow .who { flex: 1; }
.charrow .who b { color: var(--gold); font-size: 18px; }
.charrow.dead { opacity: .5; }
.hc { color: #ff5a4a; font-style: normal; }
details summary { cursor: pointer; color: var(--gold); margin-top: 10px; }
table.games { width: 100%; border-collapse: collapse; margin: 8px 0 14px; }
table.games th, table.games td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #2a221a; }
table.games th { color: var(--dim); font-weight: normal; font-size: 13px; }
form.inline { display: flex; gap: 8px; flex-wrap: wrap; }
form.inline input { flex: 1; min-width: 120px; }

/* ---------- In-game ---------- */
#gl, #overlay { position: fixed; inset: 0; width: 100%; height: 100%; }
#overlay { pointer-events: none; }
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
#hud #banner, #hud #msgs, #hud #chat-log, #hud #tooltip, #hud #held { pointer-events: none; }
#banner { position: absolute; top: 18%; left: 0; right: 0; text-align: center; font-size: 30px; text-shadow: 0 2px 8px #000, 0 0 20px #000; letter-spacing: 2px; }
#banner div { animation: fadeban 3.2s forwards; }
@keyframes fadeban { 0% { opacity: 0; transform: translateY(8px); } 10% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
#msgs { position: absolute; bottom: 150px; left: 50%; transform: translateX(-50%); text-align: center; font-size: 15px; text-shadow: 0 1px 3px #000; }
#msgs div { animation: fadeban 4s forwards; }
#party { position: absolute; top: 10px; left: 10px; width: 190px; }
.pm { background: var(--panel); border: 1px solid var(--edge); padding: 4px 6px; margin-bottom: 4px; font-size: 13px; }
.bar { height: 5px; background: #300; margin-top: 3px; } .bar i { display: block; height: 100%; background: #c83030; }
#minimap-wrap { position: absolute; top: 10px; right: 10px; text-align: right; }
#minimap { background: rgba(0, 0, 0, .55); border: 1px solid var(--edge); border-radius: 50%; }
#floor-name { color: var(--gold); margin-top: 4px; }
#buffs { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; margin-top: 6px; }
.buff { background: rgba(40, 30, 10, .85); border: 1px solid #6a5020; padding: 1px 6px; font-size: 12px; color: #ffd870; }
#chat { position: absolute; left: 10px; bottom: 160px; width: 380px; }
#chat-log div { font-size: 13px; text-shadow: 0 1px 2px #000; background: rgba(0, 0, 0, .35); padding: 1px 6px; margin-top: 1px; }
#chat-log .sys { color: #b8a878; font-style: italic; }
#chat-input { width: 100%; margin-top: 4px; }
#bottom { position: absolute; bottom: 0; left: 0; right: 0; height: 130px; display: flex; align-items: flex-end; justify-content: center; gap: 14px; padding-bottom: 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .75)); pointer-events: none; }
#bottom > * { pointer-events: auto; }
.orb { width: 116px; height: 116px; border-radius: 50%; border: 3px solid #5a4630; position: relative; overflow: hidden; background: #140808; box-shadow: 0 0 20px #000, inset 0 0 20px #000; }
.orb .fill { position: absolute; bottom: 0; left: 0; right: 0; transition: height .15s; }
.orb.life .fill { background: radial-gradient(circle at 40% 30%, #ff5a4a, #8a1010 70%); }
.orb.res-mana .fill { background: radial-gradient(circle at 40% 30%, #6a8aff, #102a8a 70%); }
.orb.res-fury .fill { background: radial-gradient(circle at 40% 30%, #ffa040, #8a3a00 70%); }
.orb.res-energy .fill { background: radial-gradient(circle at 40% 30%, #ffe060, #8a7000 70%); }
.orb span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; text-shadow: 0 1px 3px #000; }
#center-bar { width: 560px; }
#bar-top { display: flex; align-items: flex-end; gap: 10px; }
#belt { display: grid; grid-template-columns: repeat(4, 28px); gap: 2px; }
.bcell { width: 28px; height: 28px; background: rgba(20, 16, 14, .9); border: 1px solid #3a2e22; position: relative; }
.bcell.off { opacity: .25; }
.bcell i { position: absolute; right: 1px; bottom: -1px; font-size: 10px; color: var(--dim); font-style: normal; z-index: 2; }
#skillbar { display: flex; gap: 4px; }
.sk { width: 52px; height: 52px; background: #140f0c; border: 2px solid #3a2e22; position: relative; cursor: pointer; }
.sk.sel { border-color: var(--gold); }
.sk img { width: 100%; height: 100%; display: block; }
.sk i { position: absolute; left: 2px; top: 0; font-style: normal; font-size: 12px; color: #fff; text-shadow: 0 1px 2px #000; }
.sk .cd { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, .7); }
.sk.nores img { filter: grayscale(1) brightness(.5); }
#bar-btns { display: flex; gap: 3px; margin-left: auto; }
#bar-btns button { padding: 4px 8px; font-size: 13px; }
#xp { height: 8px; background: #1a140c; border: 1px solid #3a2e22; margin-top: 6px; }
#xp-fill { height: 100%; background: linear-gradient(90deg, #8a6a20, #e0c050); width: 0; }
#points-hint { color: #ffd23f; font-size: 13px; text-align: center; margin-top: 3px; text-shadow: 0 1px 2px #000; }

.panel { position: absolute; top: 60px; background: var(--panel); border: 1px solid var(--edge); padding: 10px 12px; box-shadow: 0 8px 30px #000; border-radius: 3px; max-height: calc(100% - 210px); overflow: auto; }
.panel.right { right: 14px; width: 330px; }
.panel.left { left: 14px; width: 360px; }
.panel.center { left: 50%; transform: translateX(-50%); width: 420px; }
.ph { display: flex; align-items: center; margin-bottom: 8px; }
.ph h3 { flex: 1; margin: 0; color: var(--gold); font-weight: normal; }
.ph button { padding: 0 8px; }
#doll { position: relative; width: 270px; height: 240px; margin: 0 auto 8px; }
.slot { position: absolute; background: rgba(0, 0, 0, .5); border: 1px solid #3a2e22; }
.slot span { position: absolute; bottom: 1px; left: 0; right: 0; text-align: center; font-size: 9px; color: #5a4e40; }
.grid { position: relative; background-color: rgba(0, 0, 0, .45); background-image: linear-gradient(#2a221a 1px, transparent 1px), linear-gradient(90deg, #2a221a 1px, transparent 1px); background-size: 30px 30px; border: 1px solid #3a2e22; margin: 0 auto; }
.item { position: absolute; background-repeat: no-repeat; background-position: center; background-size: contain; border: 1px solid; cursor: pointer; }
.item.r-magic { background-color: rgba(40, 60, 140, .35); }
.item.r-rare { background-color: rgba(140, 120, 20, .3); }
.item.r-set { background-color: rgba(20, 120, 40, .3); }
.item.r-unique { background-color: rgba(140, 90, 30, .35); }
.item.unid { box-shadow: inset 0 0 0 2px rgba(200, 40, 40, .6); }
.item.broken { filter: sepia(1) hue-rotate(-40deg) saturate(3) brightness(.7); }
.item .qty { position: absolute; right: 2px; bottom: 0; font-size: 11px; color: #fff; text-shadow: 0 1px 2px #000; }
.bcell .item { border: none; }
#held { position: fixed; background-repeat: no-repeat; background-position: center; background-size: contain; z-index: 50; pointer-events: none; opacity: .9; }
.goldline { margin-top: 8px; font-size: 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.goldline b { color: var(--gold); }
.goldline input { width: 90px; padding: 3px 6px; }
.goldline button { padding: 3px 8px; }
.tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.tabs button { padding: 3px 10px; font-size: 13px; }
#npc-text p { line-height: 1.5; margin: 0 0 8px; }
.kws { font-size: 13px; margin-bottom: 8px; }
#npc-say { width: 100%; margin-bottom: 8px; }
#npc-svc { display: flex; gap: 6px; margin-bottom: 8px; }
#shop-grid { margin-top: 6px; }
#wp-body { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.row span { flex: 1; }
.row b { color: #fff; }
.row button { padding: 0 8px; }
.row.small { font-size: 13px; padding: 1px 0; }
.row.small span { color: var(--dim); }
.charhead b { font-size: 20px; color: var(--gold); display: block; }
.pts { color: #ffd23f; margin: 6px 0; }
.sheet { margin-top: 8px; border-top: 1px solid #2a221a; padding-top: 6px; }
.skill { display: flex; gap: 8px; align-items: flex-start; padding: 6px; border: 1px solid #2a221a; margin-bottom: 6px; }
.skill img { width: 44px; height: 44px; }
.skill > div { flex: 1; }
.skill.locked img { filter: grayscale(1) brightness(.6); }
.binds { display: flex; gap: 3px; margin-top: 4px; }
.binds button { padding: 0 6px; font-size: 12px; }
.quest { padding: 6px 0; border-bottom: 1px solid #2a221a; }
.quest b { color: var(--gold); }
.quest .ready { color: #ffd23f; }
.quest .done { color: #6fcf6f; }
.quest.isdone { opacity: .6; }
.help div { margin: 6px 0; font-size: 14px; }
#tooltip { position: fixed; z-index: 60; display: flex; gap: 8px; align-items: flex-start; }
.tip-card { background: rgba(8, 6, 8, .96); border: 1px solid #5a4a36; padding: 8px 10px; min-width: 200px; max-width: 320px; box-shadow: 0 4px 20px #000; }
.tt { font-size: 16px; margin-bottom: 4px; }
.tl { font-size: 13px; line-height: 1.35; }
#death { position: absolute; inset: 0; background: radial-gradient(transparent, rgba(80, 0, 0, .7)); display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-shadow: 0 2px 8px #000; }
#death h2 { color: #d03030; font-size: 46px; margin: 0; font-weight: normal; letter-spacing: 4px; }
#automap-wrap { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center; justify-content: center; }
#automap { opacity: .85; }
#toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--edge); padding: 8px 16px; z-index: 100; }
body.idmode, body.idmode * { cursor: help !important; }
