* { box-sizing: border-box; }
:root {
  --wood: #1c140d; --wood2: #261b12; --leather: #2e2217; --iron: #4a4038; --bronze: #8a6a3a; --gold: #d8b060;
  --text: #e6dcc8; --dim: #a08e74; --blood: #8a1a1a;
  --serif: 'Alegreya', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  --title: 'Cinzel', 'Trajan Pro', 'Palatino Linotype', Georgia, serif;
}
html, body { margin: 0; height: 100%; overflow: hidden; background: #060403; color: var(--text); font-family: var(--serif); user-select: none; }
canvas#game { position: fixed; inset: 0; display: block; cursor: crosshair; filter: saturate(0.78) contrast(1.08) sepia(0.12); }
.hidden { display: none !important; }
.dim { color: var(--dim); }
.small { font-size: 12px; margin-top: 12px; }
button { font: inherit; font-weight: 600; background: linear-gradient(#3a2a1c, #2a1e14); color: var(--text); border: 1px solid var(--bronze); border-radius: 3px; padding: 6px 12px; cursor: pointer; box-shadow: inset 0 1px 0 #ffffff14, 0 2px 3px #0008; }
button:hover { background: linear-gradient(#4a3624, #36281a); border-color: var(--gold); }
button.primary { background: linear-gradient(#6a4a1e, #4a3212); border-color: var(--gold); color: #fff2d0; }
button.primary:hover { background: linear-gradient(#80581f, #5a3c14); }
button.danger { background: linear-gradient(#5a1a14, #3a100c); border-color: #9a3a2a; }
input { font: inherit; background: #120c08; color: #fff2d8; border: 1px solid var(--iron); border-radius: 3px; padding: 6px 8px; width: 100%; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hpbox { position: absolute; left: 14px; top: 14px; width: 270px; }
#hpbar { position: relative; height: 22px; background: #200808; border: 2px solid #0a0404; outline: 1px solid var(--bronze); border-radius: 2px; overflow: hidden; box-shadow: 0 2px 6px #000a; }
#hpfill { height: 100%; background: linear-gradient(#c83838, #6a0e0e); transition: width .15s; }
#hptext { position: absolute; inset: 0; text-align: center; font-size: 13px; font-weight: bold; line-height: 18px; text-shadow: 0 1px 2px #000; }
#stbar { margin-top: 4px; height: 8px; background: #1a1406; border: 1px solid #0a0804; outline: 1px solid #5a4a2a; overflow: hidden; }
#stfill { height: 100%; background: linear-gradient(#e8c050, #9a7418); transition: width .08s; }
#stbar.low #stfill { background: linear-gradient(#e87030, #8a3010); }
#foods { display: flex; gap: 5px; margin-top: 6px; }
.food { position: relative; width: 40px; height: 44px; background: #120c08e0; border: 1px solid var(--bronze); border-radius: 2px; display: flex; flex-direction: column; align-items: center; }
.food img { width: 26px; height: 26px; image-rendering: pixelated; margin-top: 2px; }
.food .fbar { width: 34px; height: 3px; background: #000; margin-top: 1px; }
.food .fbar div { height: 100%; background: #d8b060; }
.food span { font-size: 10px; color: var(--dim); line-height: 11px; }
.food.low { border-color: #c05a2a; animation: foodblink 1s infinite; }
.food.empty { border-style: dashed; border-color: #4a3a28; background: #0a0706a0; }
@keyframes foodblink { 50% { box-shadow: 0 0 8px #e06a2a; } }
#stats { margin-top: 6px; font-size: 14px; text-shadow: 0 1px 2px #000; font-weight: 700; }
#buffs { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.buff { font-size: 11px; padding: 2px 6px; background: #000a; border: 1px solid; border-radius: 2px; }
#mapbox { position: absolute; right: 14px; top: 14px; text-align: right; }
#minimap { border: 3px double var(--bronze); border-radius: 50%; background: #050302; box-shadow: 0 2px 10px #000c; display: block; }
#info { font-size: 13px; margin-top: 4px; text-shadow: 0 1px 2px #000; line-height: 1.4; }
#info .tier { color: var(--gold); font-weight: bold; font-family: var(--title); font-size: 12px; letter-spacing: 1px; }
#info .tier.hard { color: #e04040; }
#bossbar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: min(560px, 50vw); text-align: center; }
#bossname { font-family: var(--title); font-weight: bold; font-size: 17px; color: #e8c890; text-shadow: 0 2px 3px #000, 0 0 10px #a02010; margin-bottom: 3px; letter-spacing: 2px; }
#bossbarbg { height: 14px; background: #180404; border: 2px solid #000; outline: 1px solid var(--bronze); overflow: hidden; }
#bossfill { height: 100%; background: linear-gradient(#b82020, #500808); transition: width .15s; }
#log { position: absolute; left: 14px; bottom: 110px; width: 480px; font-size: 14px; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.logline { margin-top: 3px; transition: opacity 1s; }
.logline.fade { opacity: 0; }
#bottom { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); text-align: center; }
#hint { font-size: 13px; min-height: 17px; color: #e0d4b8; text-shadow: 0 1px 2px #000; font-style: italic; }
#helditem { font-family: var(--title); font-size: 13px; font-weight: bold; min-height: 18px; text-shadow: 0 1px 2px #000; color: var(--gold); letter-spacing: 1px; }
#hotbar { display: flex; gap: 4px; pointer-events: auto; background: linear-gradient(#2a1e14e8, #16100ae8); padding: 5px; border: 1px solid var(--bronze); border-radius: 3px; box-shadow: 0 3px 10px #000c; }

/* ---------- slots ---------- */
.slot { position: relative; width: 44px; height: 44px; background: radial-gradient(#221810, #140e08); border: 1px solid #4a3a28; border-radius: 2px; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: inset 0 0 6px #000; }
.slot:hover { border-color: var(--gold); }
.slot.sel { border: 2px solid var(--gold); background: radial-gradient(#3a2a16, #1a120a); box-shadow: 0 0 8px #d8b06066, inset 0 0 6px #000; }
.slot.hb { background: radial-gradient(#2a1e14, #16100a); }
.slot img { width: 32px; height: 32px; image-rendering: pixelated; pointer-events: none; }
.slot .n { position: absolute; right: 3px; bottom: 1px; font-size: 12px; font-weight: bold; text-shadow: 0 1px 2px #000, 0 0 2px #000; pointer-events: none; }
.slot .k { position: absolute; left: 3px; top: 0; font-size: 10px; color: var(--dim); pointer-events: none; }
.slot.eq { background: radial-gradient(#26221c, #121008); }
.slot.trash { background: radial-gradient(#2a1410, #140806); }

/* ---------- panel ---------- */
#panel { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -52%); display: flex; gap: 14px; background: linear-gradient(#20170fF4, #140e09F4); border: 2px solid var(--bronze); outline: 1px solid #000; border-radius: 3px; padding: 14px; box-shadow: 0 10px 40px #000e, inset 0 0 30px #000a; max-height: 86vh; }
#invside { width: 490px; }
.ptitle { font-family: var(--title); font-weight: bold; font-size: 16px; margin-bottom: 8px; color: var(--gold); letter-spacing: 2px; }
#equip { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 10px; }
.accrow { flex-basis: 100%; display: flex; gap: 6px; align-items: center; }
.setline { flex-basis: 100%; font-size: 12px; color: #ffd24a; margin-top: 4px; }
.acclbl { font-family: var(--title); font-size: 12px; color: var(--gold); letter-spacing: 1px; margin-right: 6px; }
.slot.acc { background: radial-gradient(#2a2418, #120e08); border-color: #6a5430; }
.eqwrap { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--dim); gap: 2px; }
.defline { margin-left: auto; font-size: 13px; text-align: right; line-height: 1.5; }
.defline button { padding: 2px 10px; font-size: 12px; margin-top: 2px; }
.grid { display: grid; grid-template-columns: repeat(10, 44px); gap: 4px; }
#invgrid .slot:nth-child(10) { margin-bottom: 6px; }
#invgrid { grid-template-rows: 50px repeat(3, 44px); }
.hintsm { font-size: 12px; color: var(--dim); margin: 6px 0; font-style: italic; }
#rightside { width: 430px; display: flex; flex-direction: column; min-height: 0; }
#tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.tab { padding: 5px 12px; font-size: 13px; font-family: var(--title); }
.tab.on { background: linear-gradient(#6a4a1e, #4a3212); border-color: var(--gold); }
.tab.close { margin-left: auto; }
#rightbody { overflow-y: auto; flex: 1; min-height: 0; max-height: calc(86vh - 70px); padding-right: 4px; }
.sub { font-size: 13px; margin-bottom: 6px; color: #d8c8a8; }
.filters { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 4px; }
.fbtn { padding: 2px 8px; font-size: 12px; }
.fbtn.on { background: linear-gradient(#6a4a1e, #4a3212); border-color: var(--gold); }
.rlist { display: flex; flex-direction: column; gap: 4px; }
.recipe { display: flex; gap: 8px; align-items: center; padding: 5px 8px; border: 1px solid #3a2c1e; border-radius: 2px; background: #140e09; opacity: 0.5; cursor: pointer; }
.recipe.ok { opacity: 1; border-color: #5a4a2a; background: #1e160e; }
.recipe:hover { border-color: var(--gold); }
.recipe .ri { width: 32px; height: 32px; image-rendering: pixelated; }
.rn { font-weight: bold; font-size: 14px; }
.canmake { float: right; font-size: 11px; font-weight: normal; color: #90d080; border: 1px solid #4a6a3a; border-radius: 2px; padding: 0 4px; }
.rings { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; margin-top: 2px; }
.ing { display: inline-flex; align-items: center; gap: 2px; }
.ing img { width: 18px; height: 18px; image-rendering: pixelated; }
.ing small { color: var(--dim); margin-left: 1px; }
.ing.miss { color: #e07060; }
.btnrow { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.chestgrid { grid-template-columns: repeat(8, 44px); }
.guide { font-size: 14px; line-height: 1.45; }
.guide h3 { margin: 12px 0 4px; font-size: 15px; color: var(--gold); font-family: var(--title); letter-spacing: 1px; }
.guide ul { margin: 0; padding-left: 4px; list-style: none; }
.guide li { margin: 4px 0; }
.guide li.done { color: #90c080; }
.guide p { margin: 4px 0; }

/* ---------- misc ---------- */
#tooltip { position: fixed; z-index: 50; pointer-events: none; background: linear-gradient(#20170ff8, #120c07f8); border: 1px solid var(--bronze); border-radius: 2px; padding: 7px 10px; font-size: 13px; line-height: 1.45; max-width: 290px; box-shadow: 0 4px 12px #000c; }
#tooltip .tn { font-weight: bold; font-size: 15px; font-family: var(--title); }
#cursorItem { position: fixed; z-index: 60; pointer-events: none; }
#cursorItem img { width: 32px; height: 32px; image-rendering: pixelated; }
#cursorItem .n { position: absolute; right: -4px; bottom: -2px; font-weight: bold; font-size: 12px; text-shadow: 0 1px 2px #000; }
#dialog { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); width: min(540px, 90vw); background: linear-gradient(#20170ff6, #120c07f6); border: 2px solid var(--bronze); outline: 1px solid #000; border-radius: 3px; padding: 14px 18px; box-shadow: 0 8px 30px #000e; z-index: 30; }
#dialog.lore { bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(620px, 92vw); padding: 22px 28px; background: radial-gradient(ellipse at top, #3a2c1cf8, #140e08f8); border-color: var(--gold); }
#dialog.lore .dline { font-size: 16px; line-height: 1.6; font-style: italic; }
#dialog.hoard { width: min(680px, 94vw); max-height: 92vh; overflow-y: auto; box-shadow: 0 0 40px #f2c94c44, 0 8px 30px #000e; }
.hoardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; margin-top: 14px; }
.hitem { display: flex; align-items: center; gap: 8px; min-width: 0; background: #2a1e12; border: 1px solid #5a4428; border-radius: 3px; padding: 4px 8px; font-size: 13px; color: #e8dcc0; animation: hpop 0.35s ease-out both; }
.hitem img { width: 28px; height: 28px; flex: none; image-rendering: pixelated; }
.hitem b { color: #f2c94c; }
.hitem.gold { grid-column: 1 / -1; justify-content: center; border-color: var(--gold); background: radial-gradient(ellipse at center, #4a3818, #2a1e12); box-shadow: 0 0 14px #f2c94c66 inset; color: #ffe8a0; font-weight: bold; font-size: 15px; }
.hitem.gold img { width: 40px; height: 40px; }
@keyframes hpop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
#dialog.bounty { bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(760px, 94vw); border-color: var(--gold); }.bcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }@media (max-width: 640px) { .bcards { grid-template-columns: 1fr; } }.bcard { background: #2a1e12; border: 1px solid #5a4428; border-radius: 3px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }.bcard.done { border-color: var(--gold); box-shadow: 0 0 10px #f2c94c55 inset; }.btitle { color: #f0d8a0; font-weight: bold; display: flex; align-items: center; gap: 4px; }.bdesc { font-size: 13px; color: #d8c8a8; flex: 1; }.bbar { position: relative; height: 14px; background: #120c07; border: 1px solid #000; border-radius: 2px; overflow: hidden; }.bbar > div { height: 100%; background: linear-gradient(#c8a040, #8a6a20); }.bbar > span { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 14px; color: #fff; text-shadow: 0 1px 1px #000; }.brew { font-size: 12px; color: #f2c94c; display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }.bico { width: 18px; height: 18px; image-rendering: pixelated; vertical-align: middle; }.bcard button[disabled] { opacity: 0.5; cursor: default; }
.dname { font-family: var(--title); font-weight: bold; color: var(--gold); margin-bottom: 8px; letter-spacing: 2px; font-size: 17px; text-align: center; }
.dline { font-size: 15px; line-height: 1.5; }
.dfoot { margin-top: 10px; font-size: 13px; color: #90c0e0; text-align: center; }
#banner { position: fixed; top: 22%; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; animation: bannerIn 4.5s ease forwards; }
#banner .bt { font-family: var(--title); font-size: 46px; font-weight: 900; letter-spacing: 6px; color: #f0d8a0; text-shadow: 0 0 20px #c04010, 0 3px 4px #000; }
#banner .bs { font-size: 18px; color: #e8dcc0; text-shadow: 0 2px 3px #000; margin-top: 4px; font-style: italic; }
@keyframes bannerIn { 0% { opacity: 0; transform: translate(-50%, 20px); } 12% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; } }
#bigmap { position: fixed; inset: 0; background: #000d; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-size: 13px; }
#bigmapc { border: 3px double var(--bronze); border-radius: 3px; image-rendering: pixelated; }

.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, #1e150cee, #040302ee); z-index: 40; }
#menu { background: radial-gradient(ellipse at center, #2a1c10, #050302); }
.mbox { width: min(620px, 94vw); max-height: 92vh; overflow-y: auto; background: linear-gradient(#20170ff4, #120c07f4); border: 2px solid var(--bronze); outline: 1px solid #000; border-radius: 3px; padding: 24px 28px; box-shadow: 0 10px 50px #000, inset 0 0 40px #000a; }
.mbox.small { width: 300px; display: flex; flex-direction: column; gap: 8px; }
.mbox.help { width: min(900px, 94vw); }
.mbox h3 { margin: 16px 0 8px; color: var(--gold); font-family: var(--title); letter-spacing: 1px; }
.mbox.help p { font-size: 15px; line-height: 1.55; margin: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.emblem { display: block; width: 112px; height: 112px; margin: 0 auto 6px; filter: drop-shadow(0 0 18px #60e0ff55) drop-shadow(0 4px 6px #000); }
.title { font-family: var(--title); font-size: 54px; font-weight: 900; letter-spacing: 8px; text-align: center; color: #e8d0a0; text-shadow: 0 0 24px #a04010, 0 4px 4px #000; }
.title span { color: #c86a28; }
.title.sm { font-size: 30px; letter-spacing: 4px; margin-bottom: 8px; }
.subtitle { text-align: center; color: var(--dim); margin-bottom: 10px; font-style: italic; font-size: 17px; }
.newworld label { display: block; margin: 8px 0; font-size: 14px; color: var(--dim); }
.saves { display: flex; flex-direction: column; gap: 6px; }
.save { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; background: #16100a; border: 1px solid #4a3a28; border-radius: 2px; }
.save .dim { font-size: 12px; }
.save button { margin-left: 4px; }
::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-thumb { background: #5a4428; border-radius: 2px; }
.npcrow { border: 1px solid #3a2c1e; background: #140e09; padding: 6px 8px; margin-bottom: 6px; border-radius: 2px; }
.npcrow .filters { margin: 4px 0 2px; }
.npcstat { font-size: 12px; font-style: italic; }
.storgrid { grid-template-columns: repeat(8, 44px); max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.bookbar { display: flex; gap: 6px; margin: 4px 0 6px; }
.bookbar input { flex: 1; }
.recipe.far { opacity: 0.45; }
.recipe.far:hover { opacity: 0.8; }
.needs { float: right; font-size: 11px; font-weight: normal; color: #e0a070; border: 1px solid #6a4a2a; border-radius: 2px; padding: 0 4px; }
.where { float: right; font-size: 11px; font-weight: normal; color: var(--dim); }

/* Bounty Board: tabs and the Quartermaster */
.btabs { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.bmarks { margin-left: auto; font-size: 13px; color: #f2c94c; display: flex; align-items: center; gap: 4px; }
.bshopgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; max-height: 52vh; overflow-y: auto; }
@media (max-width: 640px) { .bshopgrid { grid-template-columns: repeat(2, 1fr); } }
.bshop { background: #2a1e12; border: 1px solid #5a4428; border-radius: 3px; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.bshop.locked { opacity: 0.5; }
.bshop button[disabled] { opacity: 0.5; cursor: default; }
.bsico { width: 32px; height: 32px; image-rendering: pixelated; }
.bsname { font-size: 13px; font-weight: bold; min-height: 32px; }
.bscost { font-size: 12px; color: #f2c94c; display: flex; align-items: center; gap: 3px; }
/* the board never runs off a short window: it scrolls instead */
#dialog.bounty { max-height: 94vh; overflow-y: auto; }
/* ---------- bug board ---------- */
#bugs { z-index: 45; }
.mbox.bugs { width: min(680px, 94vw); user-select: text; }
.bugintro { margin: 0 0 10px; text-align: center; }
.bugnote { background: #2a1e12; border: 1px solid var(--bronze); border-radius: 3px; padding: 10px 12px; font-size: 14px; text-align: center; }
.bugform { display: flex; flex-direction: column; gap: 8px; }
.bugform label { display: block; font-size: 14px; color: var(--dim); }
.bugrow { display: flex; gap: 10px; flex-wrap: wrap; }
.bugrow label.grow { flex: 1; min-width: 160px; }
.bugform select, .bugform textarea { font: inherit; background: #120c08; color: #fff2d8; border: 1px solid var(--iron); border-radius: 3px; padding: 6px 8px; width: 100%; }
.bugform select { width: auto; min-width: 120px; display: block; }
.bugform textarea { resize: vertical; min-height: 84px; line-height: 1.4; }
.bugform input:focus, .bugform textarea:focus, .bugform select:focus { outline: none; border-color: var(--gold); }
.bugform .bugcheck { display: flex; align-items: baseline; gap: 6px; font-size: 13px; }
.bugform .bugcheck input { width: auto; }
.bughp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
#bugStatus { margin: 0; align-self: center; }
.bughead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 6px; }
.bughead button { font-size: 13px; padding: 3px 10px; }
.buglist { display: flex; flex-direction: column; gap: 8px; max-height: 42vh; overflow-y: auto; padding-right: 4px; }
.bugcard { background: #1a120b; border: 1px solid #4a3622; border-radius: 3px; padding: 8px 10px; }
.bugtop { display: flex; align-items: baseline; gap: 8px; }
.bugcat { flex: none; font-size: 11px; font-weight: bold; letter-spacing: 1px; text-transform: uppercase; color: var(--c); border: 1px solid var(--c); border-radius: 2px; padding: 0 5px; }
.bugtitle { color: #f0d8a0; min-width: 0; overflow-wrap: anywhere; }
.bugtext { font-size: 14px; line-height: 1.45; margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bugmeta { margin: 0; overflow-wrap: anywhere; }
.bugerr { color: #ff9090; }
