* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #10140f; font-family: "Trebuchet MS", "Segoe UI", sans-serif; color: #f3ead8; user-select: none; }
#gl, #overlay { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#gl { image-rendering: pixelated; }
#overlay { cursor: crosshair; }
button { font-family: inherit; cursor: pointer; }

.box { background: rgba(28, 22, 30, .92); border: 3px solid #5a3e4e; box-shadow: 0 0 0 3px #1a1218, 0 10px 40px rgba(0,0,0,.6); padding: 26px 32px; border-radius: 4px; }
#title, #menu, #death { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 50; }
#title { background: linear-gradient(rgba(10,14,12,.25), rgba(10,14,12,.65)); }
#title .box { width: 460px; text-align: center; }
#title h1 { font-size: 64px; margin: 0 0 8px; letter-spacing: 8px; color: #ff8fa8; text-shadow: 4px 4px 0 #6a2440, 8px 8px 0 #1a1218; }
.lore { font-size: 14px; line-height: 1.5; color: #e5d6c0; }
#title input { width: 100%; padding: 10px; font-size: 16px; background: #1a1218; color: #fff; border: 2px solid #5a3e4e; margin: 10px 0; font-family: inherit; text-align: center; }
#title button, #menu button { display: block; width: 100%; padding: 11px; margin: 8px 0; font-size: 16px; background: #c94d6a; color: #fff; border: none; border-bottom: 4px solid #7a2440; }
#title button:hover, #menu button:hover { filter: brightness(1.15); }
#btnContinue { background: #4f8a3a !important; border-bottom-color: #2a5a20 !important; }
.small { font-size: 12px; opacity: .65; }
#menu { display: none; background: rgba(0,0,0,.45); }
#menu .box { width: 340px; text-align: center; }
#menu label { display: block; margin: 10px 0; }
#menu select { font-family: inherit; padding: 4px; }
#death { display: none; background: rgba(40, 10, 40, .55); flex-direction: column; text-align: center; }
#death h1 { font-size: 54px; color: #d9a0ff; margin: 0; text-shadow: 4px 4px 0 #2a0a30; }
#death p { max-width: 520px; font-size: 17px; }

#status { position: fixed; left: 14px; top: 14px; width: 280px; background: rgba(20,16,22,.75); padding: 10px; border: 2px solid #5a3e4e; }
.who { font-size: 15px; margin-bottom: 6px; } .who em { color: #ffd24a; font-size: 12px; }
.hb { position: relative; height: 16px; background: #2a1f26; margin: 4px 0; border: 1px solid #000; }
.hb > div { height: 100%; transition: width .1s; }
.hb span { position: absolute; inset: 0; font-size: 11px; text-align: center; line-height: 16px; text-shadow: 1px 1px 0 #000; }
.hb.thin { height: 7px; } .hb.thin span { line-height: 7px; font-size: 9px; }
#bHp > div { background: linear-gradient(#ff7272, #c23a3a); } #bMp > div { background: linear-gradient(#7aa8ff, #3a5fc2); }
#bSt > div { background: #e0c048; } #bXp > div { background: #c9a0ff; }

#mapbox { position: fixed; right: 14px; top: 14px; border: 3px solid #5a3e4e; background: #000; }
#minimap { display: block; image-rendering: pixelated; }
#regionName { font-size: 11px; text-align: center; padding: 3px; background: rgba(20,16,22,.9); max-width: 168px; }

#bottom { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); text-align: center; }
#weapon { font-size: 12px; margin-bottom: 4px; text-shadow: 1px 1px 0 #000; }
#spells { display: flex; gap: 6px; justify-content: center; }
.sp { position: relative; width: 64px; height: 64px; background: rgba(20,16,22,.85); border: 3px solid var(--c, #444); overflow: hidden; }
.sp small { position: absolute; left: 3px; top: 1px; font-size: 11px; color: #fff; z-index: 2; }
.sp span { position: absolute; left: 2px; right: 2px; bottom: 3px; font-size: 9.5px; line-height: 1.05; z-index: 2; text-shadow: 1px 1px 0 #000; }
.sp::before { content: ''; position: absolute; inset: 8px 16px 22px; background: var(--c); opacity: .8; transform: rotate(45deg); }
.sp.empty { border-color: #333; } .sp.empty::before { display: none; }
.sp.pot { width: 56px; border-width: 2px; } .sp.pot::before { border-radius: 50%; transform: none; inset: 10px 16px 24px; }
.sp b { position: absolute; right: 3px; top: 2px; font-size: 12px; z-index: 3; }
.cdo { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.65); z-index: 1; }
.nomana { position: absolute; inset: 0; background: rgba(40,40,120,.45); z-index: 1; }
#menuBtns { margin-top: 6px; } #menuBtns button { font-size: 11px; background: rgba(20,16,22,.85); color: #e5d6c0; border: 1px solid #5a3e4e; padding: 4px 8px; }
#hint { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); background: rgba(0,0,0,.7); padding: 6px 14px; font-size: 14px; display: none; border: 1px solid #ffd24a; color: #ffd24a; }
#help { position: fixed; left: 14px; bottom: 10px; font-size: 11px; opacity: .65; max-width: 260px; text-shadow: 1px 1px 0 #000; }

#toasts { position: fixed; right: 14px; top: 220px; width: 330px; z-index: 40; pointer-events: none; }
.toast { background: rgba(20,16,22,.9); border-left: 4px solid #c9a0ff; padding: 7px 10px; margin-bottom: 6px; font-size: 13px; transition: opacity .6s, transform .6s; }
.toast.good { border-color: #7dd36f; } .toast.bad { border-color: #e05a4a; } .toast.quest { border-color: #ffd24a; } .toast.title { border-color: #ff7ce0; background: rgba(60,20,50,.92); }
.toast.out { opacity: 0; transform: translateX(30px); }
#banner { position: fixed; top: 18%; left: 0; right: 0; text-align: center; font-size: 30px; letter-spacing: 3px; color: #fff3d0; text-shadow: 3px 3px 0 #000; opacity: 0; pointer-events: none; }
#banner.show { animation: ban 3.2s ease; }
@keyframes ban { 0% { opacity: 0; transform: translateY(10px); } 15%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; } }

#panel { display: none; position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(920px, 94vw); max-height: 84vh; overflow: auto; z-index: 30;
  background: rgba(28,22,30,.96); border: 3px solid #5a3e4e; box-shadow: 0 0 0 3px #1a1218; }
.ph { position: sticky; top: 0; background: #3a2834; padding: 10px 14px; font-size: 18px; display: flex; justify-content: space-between; z-index: 2; }
.ph button { background: none; border: none; color: #fff; font-size: 18px; }
#panelBody { padding: 14px 18px; font-size: 13px; }
#panelBody h4 { margin: 14px 0 6px; color: #ff9fb4; letter-spacing: 1px; }
.hint { opacity: .7; font-size: 12px; }
.ess { display: flex; flex-wrap: wrap; gap: 12px; } .ess i { display: inline-block; width: 10px; height: 10px; background: var(--c); margin-right: 4px; border-radius: 50%; }
.dna { display: flex; gap: 8px; margin: 12px 0 6px; }
.slot { flex: 1; padding: 8px; border: 2px solid var(--c); background: rgba(0,0,0,.3); font-weight: bold; color: var(--c); }
.slot small { color: #fff; margin-right: 6px; } .slot em { display: block; font-weight: normal; font-size: 11px; color: #ddd; }
.slot.empty { border: 2px dashed #555; color: #777; }
.syn { padding: 6px 10px; background: rgba(0,0,0,.3); } .syn.good, .good { color: #9fe88f; } .syn.bad, .bad { color: #ff8a7a; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.card { border: 2px solid var(--c); background: rgba(0,0,0,.25); padding: 8px; display: flex; flex-direction: column; gap: 3px; }
.card.owned { background: rgba(255,255,255,.07); }
.cn { color: var(--c); font-weight: bold; font-size: 15px; } .cd { font-size: 11.5px; opacity: .85; } .cs { font-size: 11.5px; color: #ffe9b0; }
.cf { font-size: 10.5px; opacity: .6; } .cc { font-size: 12px; } .cc .miss { text-decoration: line-through; opacity: .55; }
.cp { font-size: 10.5px; color: #9fe88f; } .cp.bad { color: #ff8a7a; }
.card button { margin-top: auto; padding: 5px; background: var(--c); color: #111; border: none; font-weight: bold; }
.card button:disabled { background: #444; color: #999; cursor: default; font-weight: normal; font-size: 11px; }
.tag { margin-top: auto; text-align: center; color: var(--c); font-weight: bold; font-size: 11px; }
.equip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.eslot { border: 2px solid #5a3e4e; padding: 6px; background: rgba(0,0,0,.3); cursor: pointer; min-height: 52px; }
.eslot small { display: block; opacity: .6; font-size: 10px; }
.inv { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 5px; }
.islot { position: relative; height: 66px; border: 2px solid #4a3a44; background: rgba(0,0,0,.3); cursor: pointer; padding: 4px; font-size: 10.5px; }
.islot i { display: block; width: 22px; height: 22px; background: var(--c); margin: 2px auto 4px; transform: rotate(45deg) scale(.8); }
.islot span { display: block; text-align: center; line-height: 1.1; } .islot b { position: absolute; right: 4px; top: 2px; }
.islot em { position: absolute; left: 0; right: 0; bottom: 0; background: #a02020; text-align: center; font-size: 9px; font-style: normal; }
.islot.empty { cursor: default; opacity: .4; } .islot:not(.empty):hover, .eslot:hover, .shopi:hover { border-color: #ffd24a; }
.bar { height: 5px; background: #222; margin-top: 3px; } .bar > div { height: 100%; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.st { width: 100%; border-collapse: collapse; } .st td { padding: 3px 4px; border-bottom: 1px solid #3a2834; } .st td:last-child { text-align: right; font-weight: bold; }
.prof { display: grid; grid-template-columns: 80px 26px 1fr; align-items: center; gap: 6px; margin: 3px 0; }
.title { border: 2px solid #5a3e4e; padding: 6px; margin: 5px 0; cursor: pointer; } .title.on { border-color: #ff7ce0; background: rgba(255,124,224,.08); }
.title small { display: block; opacity: .75; } .excl { margin-left: 6px; background: #ff7ce0; color: #111; font-size: 9px; padding: 1px 4px; font-weight: bold; }
.quest { border-left: 3px solid #ffd24a; padding: 4px 10px; margin: 8px 0; } .quest p { margin: 4px 0; } .dim { opacity: .5; }
.shopi { display: flex; justify-content: space-between; border: 2px solid #4a3a44; padding: 6px 8px; margin: 4px 0; cursor: pointer; background: rgba(0,0,0,.25); }

#dialog { display: none; position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); width: min(720px, 92vw); z-index: 35;
  background: rgba(28,22,30,.96); border: 3px solid #5a3e4e; box-shadow: 0 0 0 3px #1a1218; padding: 14px 18px; }
#dlgName { color: #bfffd0; font-weight: bold; margin-bottom: 6px; }
#dlgText { font-size: 15px; line-height: 1.45; margin-bottom: 10px; }
#dlgOpts button { display: block; width: 100%; text-align: left; margin: 4px 0; padding: 7px 10px; background: rgba(0,0,0,.35); color: #ffe9b0; border: 1px solid #5a3e4e; font-size: 14px; }
#dlgOpts button:hover { border-color: #ffd24a; background: rgba(255,210,74,.08); }

#bigmapWrap { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 25; flex-direction: column; align-items: center; justify-content: center; }
#bigmap { width: min(80vh, 90vw); height: min(80vh, 90vw); image-rendering: pixelated; border: 3px solid #5a3e4e; }
