* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #07080b; color: #e6e6e6;
  font: 12px/1.35 Menlo, Monaco, "Courier New", monospace; user-select: none;
}
canvas { position: fixed; inset: 0; display: block; }
#game { cursor: none; }
#overlay { pointer-events: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui.title-mode > * { display: none !important; }
.hidden { display: none !important; }
.dim { color: #8a8a8a; }
.small { font-size: 11px; margin: 4px 0; }
.good { color: #40ff60; }
.bad { color: #ff4040; }

.panel {
  position: absolute; background: rgba(4, 5, 8, 0.78); border: 1px solid #8c8c8c;
  padding: 5px 7px; pointer-events: auto;
}

/* unit frame */
.party { left: 10px; top: 10px; width: 240px; }
.pname { display: flex; justify-content: space-between; font-weight: bold; margin-bottom: 3px; }
.pname .lv { color: #a8a8a8; font-weight: normal; }
.bar { position: relative; height: 12px; border: 1px solid #6c6c6c; margin: 3px 0; background: #111; }
.bar .fill { position: absolute; inset: 0 auto 0 0; transition: width 0.08s linear; }
.bar span { position: absolute; left: 4px; top: -1px; font-size: 10px; text-shadow: 1px 1px 0 #000; }
.bar.hp .fill { background: repeating-linear-gradient(90deg, #c8c8c8 0 3px, #9a9a9a 3px 4px); }
.party .bar.hp .fill { background: repeating-linear-gradient(90deg, #b83228 0 3px, #8a221c 3px 4px); }
.bar.res.mana .fill { background: repeating-linear-gradient(90deg, #3a62c8 0 3px, #2a4a9a 3px 4px); }
.bar.res.rage .fill { background: repeating-linear-gradient(90deg, #c8402a 0 3px, #9a2a1a 3px 4px); }
.bar.sta { height: 7px; }
.bar.sta .fill { background: #4a9a4a; }
.bar.sta span { display: none; }
.meta { color: #c8c8c8; margin-top: 2px; }
.buffs { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.buff, .debuff { font-size: 10px; padding: 0 3px; border: 1px solid #555; }
.buff { color: #ffd060; }
.debuff { color: #ff7050; }

.target { left: 50%; top: 10px; transform: translateX(-50%); width: 260px; text-align: center; }
.target .bar .fill { background: repeating-linear-gradient(90deg, #d8d8d8 0 3px, #a0a0a0 3px 4px); }
.bossbar { left: 262px; right: 236px; top: 10px; max-width: 640px; margin: 0 auto; text-align: left; border-color: #6a6a6a; }
.bossbar .bname { font-size: 13px; letter-spacing: 1px; color: #e8dcc8; }
.bossbar .bar { height: 10px; }
.bossbar .bar .fill { background: #8a1a14; z-index: 2; }
.bossbar .bar .lag { position: absolute; inset: 0 auto 0 0; background: #d0a040; z-index: 1; }
.bossbar .bar span { z-index: 3; left: auto; right: 4px; }

.perf { position: absolute; right: 10px; top: 10px; color: #c8c8c8; background: rgba(0,0,0,0.6); border: 1px solid #555; padding: 2px 6px; }
.zone { position: absolute; right: 10px; top: 32px; color: #c8b070; font-size: 11px; text-shadow: 1px 1px 0 #000; }

/* action bar */
.actionbar { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 4px; pointer-events: auto; }
.slot { position: relative; width: 44px; height: 44px; background: rgba(0, 0, 0, 0.8); border: 1px solid #8c8c8c; }
.slot .art { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 15px; }
.slot .cd { position: absolute; inset: 0; }
.slot .key { position: absolute; left: 2px; top: 0; font-size: 9px; color: #c8c8c8; }
.slot .cost { position: absolute; right: 2px; bottom: 0; font-size: 10px; color: #fff; text-shadow: 1px 1px 0 #000; }
.slot.unusable .art { opacity: 0.35; filter: grayscale(1); }
.xpbar { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); width: min(470px, 80vw); height: 8px; border: 1px solid #555; background: #0a0a0a; }
.xpbar .fill { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(90deg, #8a4ad8 0 6px, #6a2ab0 6px 7px); }
.xpbar span { position: absolute; width: 100%; text-align: center; top: -2px; font-size: 9px; color: #fff; text-shadow: 1px 1px 0 #000; }

.log { position: absolute; left: 10px; bottom: 84px; width: 380px; display: flex; flex-direction: column; gap: 1px; text-shadow: 1px 1px 0 #000; }
.log .line { transition: opacity 2s; font-size: 11px; }
.log .line.fade { opacity: 0; }
.tracker { position: absolute; right: 12px; top: 64px; width: 240px; text-shadow: 1px 1px 0 #000; }
.tracker .th { color: #ffd030; font-weight: bold; margin-bottom: 3px; }
.tracker .qt { color: #ffd030; }
.tracker .qo { color: #d8d8d8; margin-left: 6px; font-size: 11px; }
.tracker .qo.ready { color: #40ff60; }
.tracker .q { margin-bottom: 4px; }

.prompt { position: absolute; left: 50%; bottom: 31%; transform: translateX(-50%); background: rgba(0,0,0,0.75); border: 1px solid #8c8c8c; padding: 4px 10px; color: #f0e0c0; }
.error { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); color: #ff2a1a; font-size: 14px; text-shadow: 1px 1px 0 #000; opacity: 0; }
.error.show { animation: err 1.8s ease-out forwards; }
@keyframes err { 0% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }

.banner { position: absolute; left: 0; right: 0; top: 40%; text-align: center; animation: bannerIn 0.9s ease-out; }
.banner .stripe { position: absolute; left: 0; right: 0; top: -14px; height: 80px; background: linear-gradient(90deg, transparent, rgba(0,0,0,0.75) 25%, rgba(0,0,0,0.75) 75%, transparent); }
.banner .txt { position: relative; font-family: "Times New Roman", Georgia, serif; font-size: 52px; letter-spacing: 6px; }
.banner.gold .txt { color: #e8c870; text-shadow: 0 0 18px rgba(255, 190, 80, 0.5); }
.banner.death .txt { color: #a01810; font-size: 72px; text-shadow: 0 0 24px rgba(160, 20, 10, 0.6); }
.banner.zone .stripe { display: none; }
.banner.zone { top: 22%; }
.banner.zone .txt { font-size: 30px; color: #e8dcc0; text-shadow: 2px 2px 0 #000; }
@keyframes bannerIn { from { opacity: 0; transform: scale(1.08); } to { opacity: 1; transform: none; } }

/* windows */
.windows { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center; justify-content: center; }
.window { pointer-events: auto; background: rgba(2, 3, 5, 0.94); border: 1px solid #b0b0b0; min-width: 320px; max-width: 92vw; max-height: 92vh; display: flex; flex-direction: column; }
.whead { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-bottom: 1px solid #555; letter-spacing: 2px; }
.whead .close { background: none; border: 1px solid #b0b0b0; color: #e6e6e6; font: inherit; font-size: 11px; cursor: pointer; padding: 1px 6px; letter-spacing: 0; }
.wbody { padding: 10px; overflow: auto; }
.btn { background: #0c0d10; color: #e6e6e6; border: 1px solid #9a9a9a; font: inherit; padding: 6px 14px; cursor: pointer; margin: 3px; }
.btn:hover { background: #1c1e24; border-color: #fff; }
.btn.wide { display: block; width: 100%; margin: 4px 0; text-align: left; }
.sep { height: 1px; background: #333; margin: 8px 0; }
.dialog { width: 460px; }
.dtext { margin-bottom: 12px; color: #e8dcc8; line-height: 1.5; }
.buttons { display: flex; justify-content: flex-end; }
.menu { width: 360px; }

.inv { width: 470px; }
.doll { display: grid; grid-template-columns: 74px 34px 74px 34px 74px; grid-template-rows: 40px 40px 40px 40px 40px 40px; gap: 6px 10px; justify-content: center; padding: 6px 0 10px; }
.eslot { border: 1px solid #8c8c8c; display: flex; align-items: center; justify-content: center; position: relative; cursor: pointer; }
.eslot label { position: absolute; left: 3px; top: 1px; font-size: 9px; color: #7a7a7a; }
.eslot img { max-width: 90%; max-height: 90%; image-rendering: auto; }
.eslot.small { border-style: dashed; }
.eslot.c1 { grid-column: 1; } .eslot.c2 { grid-column: 2; } .eslot.c3 { grid-column: 3; } .eslot.c4 { grid-column: 4; } .eslot.c5 { grid-column: 5; }
.eslot.tall { grid-row: span 3; }
.eslot.c1.tall, .eslot.c5.tall { grid-row: 1 / span 3; }
.eslot.c3.small { grid-row: 1; }
.eslot.c3.tall.r2 { grid-row: 2 / span 3; }
.eslot.c3.r4 { grid-row: 5 / span 2; }
.eslot.c1.r3, .eslot.c5.r3 { grid-row: 4 / span 2; }
.eslot.c2.small { grid-row: 1; }
.eslot.c2.small.r2 { grid-row: 3; }
.eslot.c4.small { grid-row: 1; }
.stats { border-top: 1px solid #555; border-bottom: 1px solid #555; padding: 6px 2px; font-size: 11px; }
.srow { margin: 2px 0; }
.xpmini { display: inline-block; width: 70px; height: 8px; border: 1px solid #aaa; vertical-align: middle; position: relative; }
.xpmini span { position: absolute; inset: 0 auto 0 0; background: #e6e6e6; }
.baghead { display: flex; justify-content: space-between; font-size: 11px; padding: 6px 2px; }
.bag { display: grid; grid-template-columns: repeat(10, 42px); gap: 3px; max-height: 230px; overflow-y: auto; padding-right: 4px; }
.bslot { width: 42px; height: 42px; border: 1px solid #333; background: #050608; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.bslot:hover, .eslot:hover { border-color: #fff !important; }
.bslot img { width: 38px; height: 38px; }

.qlog { width: 520px; }
.qentry { margin-bottom: 10px; }
.qentry .qt { color: #ffd030; }
.qentry.done .qt { color: #8a8a8a; }
.qentry .qd { color: #c8c0b0; font-size: 11px; margin-top: 2px; }

.tooltip { position: fixed; z-index: 50; background: rgba(4, 6, 14, 0.96); border: 1px solid #9a9a9a; padding: 6px 9px; max-width: 280px; pointer-events: none; font-size: 11px; }
.tooltip .row { display: flex; justify-content: space-between; gap: 18px; }
.tooltip .stat { color: #fff; }

/* title */
#title { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(0,0,0,0.15), rgba(0,0,0,0.75)); }
#title .logo { color: #d8c8a0; font-size: 12px; line-height: 1.1; text-shadow: 0 0 12px rgba(255, 180, 80, 0.35); margin: 0 0 6px; }
#title .sub { color: #9a9a9a; letter-spacing: 3px; margin-bottom: 26px; }
#title .menu { width: 420px; }
#title .newgame { width: 520px; display: flex; flex-direction: column; gap: 8px; }
#title input { background: #050608; color: #fff; border: 1px solid #9a9a9a; font: inherit; font-size: 14px; padding: 6px 8px; outline: none; }
#title .classes { display: flex; gap: 8px; }
#title .cls { flex: 1; border: 1px solid #555; padding: 8px; cursor: pointer; background: rgba(0,0,0,0.7); }
#title .cls.sel { border-color: #e8c870; }
#title .cls .cn { font-weight: bold; color: #e8c870; margin-bottom: 4px; }
#title .cls .cd { color: #b8b8b8; font-size: 11px; }
#title .hint { position: absolute; bottom: 18px; color: #7a7a7a; font-size: 11px; text-align: center; padding: 0 20px; }

/* v2: cast bar, weather, potions, professions */
.castbar { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); width: 230px; height: 14px; border: 1px solid #b0b0b0; background: rgba(0, 0, 0, 0.8); }
.castbar .fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#e8c050, #a07820); }
.castbar span { position: absolute; width: 100%; text-align: center; top: 0; font-size: 10px; line-height: 14px; color: #fff; text-shadow: 1px 1px 0 #000; }
.weather { position: absolute; right: 10px; top: 46px; color: #8fa6c0; font-size: 10px; text-shadow: 1px 1px 0 #000; }
.tracker { top: 72px; }
.slot.potion { width: 36px; border-color: #6a6a6a; }
.slot .lock { position: absolute; inset: auto 0 2px 0; text-align: center; font-size: 9px; color: #ff6050; text-shadow: 1px 1px 0 #000; }
.slot.locked .art { opacity: 0.2; filter: grayscale(1); }
.reagents { font-size: 11px; padding: 4px 2px 8px; line-height: 1.6; }
.prof { width: 560px; }
.psec { margin-bottom: 12px; }
.pskill { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.pskill > span { width: 80px; color: #ffd030; }
.pbar { position: relative; flex: 1; height: 12px; border: 1px solid #666; background: #08090c; }
.pbar div { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#3a7ad0, #1a4a90); }
.pbar b { position: absolute; width: 100%; text-align: center; font-size: 9px; line-height: 12px; font-weight: normal; }
.prow { display: grid; grid-template-columns: 1fr 60px 90px 40px; font-size: 11px; padding: 2px 0; border-bottom: 1px solid #15171c; }
.recipe { border: 1px solid #22252c; padding: 5px 7px; margin: 4px 0; }
.recipe .rmats { font-size: 11px; margin: 2px 0; }
.recipe .rdesc { font-size: 10px; }
.recipe .buttons .btn { padding: 2px 10px; font-size: 11px; }
.btn:disabled { opacity: 0.35; cursor: default; }
.small { font-size: 10px; margin-bottom: 4px; }
