* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0e0b10; }
body { font-family: 'Press Start 2P', monospace; color: #f4e4c1; }
canvas#game { position: fixed; left: 0; top: 0; image-rendering: pixelated; image-rendering: crisp-edges; }
.hidden { display: none !important; }

/* ---- overlays / menus ---- */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(14,11,16,0.25), rgba(14,11,16,0.75)); z-index: 10; padding: 16px; }
.panel { width: min(380px, 100%); background: rgba(44,24,16,0.94); border: 4px solid #4a2f1b; box-shadow: 0 0 0 2px #1a0f09, 0 10px 40px rgba(0,0,0,0.6); border-radius: 6px; padding: 22px 22px 16px; display: flex; flex-direction: column; gap: 10px; }
.logo { text-align: center; font-size: 20px; line-height: 1.5; color: #f2cf7a; text-shadow: 3px 3px 0 #3a1d10, 0 0 18px rgba(190,130,255,0.6); margin-bottom: 10px; }
.logo span { font-size: 15px; color: #d6b8ff; }
.title { text-align: center; font-size: 14px; color: #f2cf7a; margin-bottom: 6px; }
button { font-family: inherit; font-size: 12px; color: #f4e4c1; background: #5a3a22; border: 3px solid #2c1810; border-bottom-width: 5px; padding: 11px 10px; cursor: pointer; border-radius: 4px; }
button:hover:not(:disabled), button:focus-visible { background: #7a4f2e; outline: none; color: #fff; }
button:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 3px; }
button:disabled { opacity: 0.4; cursor: default; }
button.ghost { background: transparent; border-color: #4a2f1b; }
button.small { font-size: 9px; padding: 7px 8px; border-bottom-width: 3px; }
label { font-size: 10px; color: #c9b48f; }
input { font-family: inherit; font-size: 13px; padding: 10px; background: #1e1612; color: #f4e4c1; border: 3px solid #4a2f1b; border-radius: 4px; }
input:focus { outline: none; border-color: #d9a441; }
.note { font-size: 9px; line-height: 1.7; color: #c9b48f; text-align: center; min-height: 0; }
.account span { white-space: pre-line; }
.account { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 4px; font-size: 9px; color: #c9b48f; text-align: center; line-height: 1.6; }
.back { font-size: 9px; color: #c9b48f; text-align: center; text-decoration: none; margin-top: 4px; }
.back:hover { color: #f2cf7a; }
.ver { font-size: 8px; color: #8a7a62; text-align: center; }
table.keys { width: 100%; border-collapse: collapse; font-size: 9px; line-height: 1.6; }
table.keys td { padding: 6px 4px; border-bottom: 2px solid #3a2416; }
table.keys td:first-child { color: #f2cf7a; }

/* ---- character creator ---- */
.panel.wide { width: min(620px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; }
.creator { display: flex; gap: 18px; align-items: flex-start; }
.preview { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#preview { width: 192px; height: 192px; image-rendering: pixelated; background: #2f4a28; border: 3px solid #4a2f1b; border-radius: 4px; }
.preview-btns { display: flex; gap: 6px; }
.options { flex: 1; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.opt { display: flex; flex-direction: column; gap: 5px; }
.opt > span { font-size: 9px; color: #c9b48f; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches button { width: 22px; height: 22px; padding: 0; border: 3px solid #2c1810; border-radius: 4px; }
.swatches button[aria-pressed="true"] { border-color: #f2cf7a; box-shadow: 0 0 0 2px #2c1810; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper b { flex: 1; text-align: center; font-size: 10px; font-weight: normal; color: #f4e4c1; }
@media (max-width: 560px) { .creator { flex-direction: column; align-items: center; } .options { width: 100%; } .panel.wide { max-height: 100%; overflow-y: auto; } }

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.hud-card { position: absolute; left: 12px; top: 12px; background: rgba(30,18,12,0.82); border: 3px solid #4a2f1b; border-radius: 4px; padding: 9px 11px; min-width: 190px; }
#hud-name { font-size: 11px; color: #f4e4c1; }
#hud-realm { font-size: 8px; color: #d6b8ff; margin: 5px 0 7px; }
.bar { height: 10px; background: #1a1220; border: 2px solid #120c16; }
#hud-mana { height: 100%; width: 0%; background: linear-gradient(#8fd8ff, #4a8fd8); transition: width 0.2s linear; }
#hud-mana-text { font-size: 7px; color: #a8c8e8; margin-top: 5px; }
.bar.hp #hud-hp { height: 100%; width: 100%; background: linear-gradient(#ff8a7a, #c93a3a); transition: width 0.15s linear; }
#hud-hp-text { font-size: 7px; color: #f0b0a8; margin: 5px 0 7px; }
.bar.energy #hud-energy { height: 100%; width: 100%; background: linear-gradient(#f2e27a, #c9a227); transition: width 0.1s linear; }
.bar.energy #hud-energy.out { background: linear-gradient(#a85a3a, #6a2e1e); animation: tired 0.8s ease-in-out infinite; }
#hud-energy-text { font-size: 7px; color: #e8d890; margin: 5px 0 7px; }
#hud-energy-text.out { color: #ffb04a; }
@keyframes tired { 50% { opacity: 0.45; } }
#hud-clock { position: absolute; right: 12px; top: 12px; font-size: 9px; background: rgba(30,18,12,0.82); border: 3px solid #4a2f1b; border-radius: 4px; padding: 8px 10px; }
#hud-hint { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); font-size: 9px; background: rgba(30,18,12,0.82); border: 3px solid #4a2f1b; border-radius: 4px; padding: 8px 12px; white-space: nowrap; }
#hud-hint:empty { display: none; }
#hud.has-tech #hud-hint { bottom: 74px; }
/* the action bar: techniques on the number keys */
#techbar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 6px; pointer-events: auto; }
.tech { position: relative; width: 44px; height: 44px; background: rgba(30,18,12,0.88); border: 3px solid #4a2f1b; border-radius: 4px; cursor: pointer; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.tech.ready { border-color: var(--c); box-shadow: 0 0 6px var(--c); }
.tech canvas { width: 30px; height: 30px; image-rendering: pixelated; }
.tech-key { position: absolute; left: 2px; top: 1px; font-size: 8px; color: #fff; text-shadow: 1px 1px 0 #000; }
.tech-cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0,0,0,0.62); }
.tech-t { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #fff; text-shadow: 1px 1px 0 #000; }
.tech.low canvas { filter: grayscale(1) brightness(0.6); }
#toast { white-space: pre-line; position: absolute; left: 50%; top: 16%; transform: translateX(-50%); font-size: 11px; color: #f2cf7a; text-shadow: 2px 2px 0 #3a1d10; text-align: center; line-height: 1.6; }
@media (max-width: 600px) { .hud-card { min-width: 150px; } #hud-hint { font-size: 7px; white-space: normal; width: 90%; text-align: center; } }

/* ---- update notice (fantasy scroll) ---- */
#update { position: fixed; left: 50%; top: 10px; transform: translateX(-50%); z-index: 30; width: min(420px, calc(100% - 24px)); }
#update .scroll { animation: unfurl 0.7s ease-out both; transform-origin: top center; filter: drop-shadow(0 8px 18px rgba(0,0,0,0.55)); }
@keyframes unfurl { from { transform: scaleY(0.05); opacity: 0.3; } to { transform: scaleY(1); opacity: 1; } }
#update .rod { height: 12px; margin: 0 -10px; background: linear-gradient(#7a4f2e, #4a2f1b); border: 2px solid #2c1810; border-radius: 6px; position: relative; }
#update .rod::before, #update .rod::after { content: ''; position: absolute; top: -3px; width: 10px; height: 14px; background: #d9a441; border: 2px solid #6b4a12; border-radius: 3px; }
#update .rod::before { left: -8px; } #update .rod::after { right: -8px; }
#update .parch { position: relative; background: #e8d4a8; background-image: radial-gradient(ellipse at 20% 10%, rgba(255,255,255,0.35), transparent 60%), radial-gradient(ellipse at 80% 90%, rgba(139,90,43,0.25), transparent 60%); color: #3a1d10; border-left: 3px solid #b89868; border-right: 3px solid #b89868; padding: 16px 18px 14px; text-align: center; }
#update .u-title { font-size: 12px; color: #7a2e2e; margin-bottom: 10px; }
#update .u-text { font-size: 9px; line-height: 1.8; }
#update .u-text b { font-weight: normal; color: #7a2e2e; }
#update .u-notes { font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-size: 13px; line-height: 1.45; color: #4a2f1b; margin: 10px 0 2px; max-height: 120px; overflow-y: auto; }
#update .u-notes:empty { display: none; }
#update .u-btns { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
#update .u-btns button { font-size: 9px; padding: 9px 10px; }
#update #btn-update { background: #7a2e2e; border-color: #3a1010; color: #f4e4c1; }
#update #btn-update:hover { background: #94403f; }
#update #btn-update-later { color: #4a2f1b; border-color: #8b5a2b; }
#update #btn-update-later:hover { background: rgba(139,90,43,0.15); color: #2c1810; }
#update .seal { position: absolute; right: 12px; top: 10px; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #c94a4a, #7a1f1f 70%); box-shadow: 0 0 0 2px #5a1515, 1px 2px 0 2px rgba(0,0,0,0.2); }
#update .seal::after { content: ''; position: absolute; inset: 6px; border: 2px solid rgba(255,210,170,0.55); border-radius: 50%; }
#update-pill { position: fixed; left: 50%; top: 10px; transform: translateX(-50%); z-index: 30; font-size: 9px; padding: 8px 12px 8px 30px; background: #e8d4a8; color: #3a1d10; border-color: #4a2f1b; animation: pulse 2s ease-in-out infinite; }
#update-pill::before { content: ''; position: absolute; left: 9px; top: 50%; width: 13px; height: 13px; margin-top: -7px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #c94a4a, #7a1f1f 70%); }
#update-pill:hover { background: #f4e4c1; color: #2c1810; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(217,164,65,0.0); } 50% { box-shadow: 0 0 14px 3px rgba(217,164,65,0.6); } }

/* ---- colour picker ---- */
.opt > span em { font-style: normal; color: #8a7a62; margin-left: 6px; }
.swatches { gap: 5px; }
.swatches .rainbow { position: relative; background: conic-gradient(#ff4040, #ffd040, #60e060, #40d0ff, #6060ff, #e040e0, #ff4040) !important; }
.swatches .rainbow.custom::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px #2c1810; }
.picker { background: #1e1612; border: 3px solid #4a2f1b; border-radius: 4px; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.picker .sv { position: relative; height: 96px; border-radius: 3px; cursor: crosshair; touch-action: none;
  background-image: linear-gradient(to top, #000, rgba(0,0,0,0)), linear-gradient(to right, #fff, rgba(255,255,255,0)); }
.picker .hue { position: relative; height: 14px; border-radius: 3px; cursor: pointer; touch-action: none;
  background: linear-gradient(to right, #f00, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00); }
.picker .knob { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #000; pointer-events: none; }
.picker .hue .knob { top: 50%; height: 18px; margin-top: -9px; border-radius: 3px; }
.pk-row { display: flex; gap: 8px; align-items: center; }
.pk-now { width: 26px; height: 26px; border: 3px solid #2c1810; border-radius: 4px; flex: none; }
.pk-row input { flex: 1; min-width: 0; font-size: 10px; padding: 6px; }

/* ---- gold in the HUD ---- */
.hud-gold { font-size: 8px; color: #f2cf7a; margin-top: 7px; padding-left: 14px; position: relative; }
.hud-gold::before { content: ''; position: absolute; left: 0; top: -1px; width: 9px; height: 9px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f2cf7a, #a8781e); }

/* ---- character panel + shop ---- */
.panel.xwide { width: min(860px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; }
.sub { font-size: 9px; color: #f2cf7a; margin-bottom: 8px; }
.sub em { font-style: normal; color: #8a7a62; margin-left: 4px; }
.char-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 280px); gap: 20px; align-items: start; }
.char-left { min-width: 0; display: flex; flex-direction: column; align-items: stretch; }
.char-items { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.char-left .gold-line { margin: 10px 0 8px; }
.equip { display: grid; grid-template-columns: repeat(2, 54px); gap: 6px; }
.bag-slots { display: grid; grid-template-columns: repeat(3, 54px); gap: 6px; }
.slot { position: relative; width: 54px; height: 54px; padding: 0; display: flex; align-items: center; justify-content: center; background: #1e1612; border: 3px solid #4a2f1b; border-bottom-width: 3px; }
.slot.empty { opacity: 0.75; }
.slot.sel { border-color: #f2cf7a; }
.slot:active:not(:disabled) { transform: none; border-bottom-width: 3px; }
.slot .count { position: absolute; right: 2px; bottom: 2px; font-size: 7px; color: #fff; text-shadow: 1px 1px 0 #000; }
.slot .count.gold { color: #f2cf7a; }
.slot .slot-label { position: absolute; left: 0; right: 0; bottom: -1px; font-size: 6px; color: #8a7a62; text-align: center; }
.slot:not(.empty) .slot-label { display: none; }
.gold-line { display: flex; align-items: center; gap: 6px; font-size: 9px; color: #f2cf7a; margin-top: 10px; flex-wrap: wrap; }
.stat { display: grid; grid-template-columns: 90px 40px 1fr; gap: 4px 8px; align-items: center; font-size: 8px; margin-bottom: 9px; }
.stat-name { color: #f4e4c1; } .stat-lv { color: #9affb0; }
.stat-bar { height: 7px; background: #1a1220; border: 2px solid #120c16; }
.stat-bar div { height: 100%; background: linear-gradient(#b8ffc8, #4aa860); }
.stat-eff { grid-column: 1 / -1; color: #8a7a62; font-size: 7px; }
.detail { display: flex; gap: 12px; align-items: center; min-height: 52px; background: #1e1612; border: 3px solid #4a2f1b; border-radius: 4px; padding: 8px 10px; }
.detail-text { flex: 1; font-size: 8px; line-height: 1.7; color: #c9b48f; }
.detail-text b { display: block; font-weight: normal; color: #f4e4c1; font-size: 10px; margin-bottom: 3px; }
.detail-btns { display: flex; flex-direction: column; gap: 6px; }
.shop-quote { font-style: italic; }
.shop-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.shop-list { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; padding-right: 4px; }
.shop-row { display: flex; gap: 8px; align-items: center; background: #1e1612; border: 2px solid #3a2416; border-radius: 4px; padding: 5px 7px; }
.shop-name { flex: 1; min-width: 0; font-size: 7px; line-height: 1.6; color: #8a7a62; }
.shop-name b { display: block; font-weight: normal; color: #f4e4c1; font-size: 9px; }
.shop-row button { flex: none; }
.body-ico { width: 26px; text-align: center; font-size: 18px; color: #c9b48f; font-family: serif; }
@media (max-width: 760px) { .char-grid, .shop-cols { grid-template-columns: 1fr; } }

/* ---- encyclopedia ---- */
.ency-grid { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; }
#ency-list { display: flex; flex-direction: column; gap: 6px; max-height: 62vh; overflow-y: auto; padding-right: 4px; }
#ency-detail { position: sticky; top: 0; }
#ency-list .sub { margin: 6px 0 0; }
.ency-item { display: flex; align-items: center; gap: 8px; text-align: left; font-size: 9px; padding: 8px; background: #1e1612; border: 2px solid #3a2416; border-bottom-width: 2px; }
.ency-item.sel { border-color: #f2cf7a; }
.rank { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; font-size: 9px; border-radius: 3px; background: #3a2416; color: #f4e4c1; flex: none; }
.rank-F { background: #5a5a64; } .rank-E { background: #3f7236; } .rank-D { background: #2e5d8c; } .rank-C { background: #7a3fa0; }
.rank-B { background: #b06a1e; } .rank-A { background: #a02a2a; } .rank-S { background: linear-gradient(135deg, #d9a441, #f2cf7a); color: #3a1d10; }
#ency-detail { background: #1e1612; border: 3px solid #4a2f1b; border-radius: 4px; padding: 12px; min-height: 260px; }
.ency-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.ency-pic { width: 96px; height: 96px; image-rendering: pixelated; border: 3px solid #4a2f1b; border-radius: 4px; flex: none; }
.ency-name { font-size: 13px; color: #f2cf7a; margin-bottom: 8px; }
.ency-rank { display: inline-block; font-size: 8px; padding: 4px 6px; border-radius: 3px; margin-bottom: 7px; }
.ency-rank:not([class*="rank-"]) { color: #c9b48f; padding-left: 0; }
.ency-growth { font-size: 8px; color: #9affb0; line-height: 1.6; }
.ency-row { display: grid; grid-template-columns: 74px 1fr; gap: 8px; font-size: 8px; line-height: 1.7; color: #c9b48f; margin-top: 6px; }
.ency-row b { font-weight: normal; color: #f4e4c1; }
@media (max-width: 760px) { .ency-grid { grid-template-columns: 1fr; } }

/* ---- RuneScape-style choices floating over a body ---- */
#loot { position: absolute; transform: translate(-50%, -100%); pointer-events: auto; display: flex; flex-direction: column; gap: 2px; background: rgba(20,12,8,0.88); border: 2px solid #4a2f1b; border-radius: 4px; padding: 4px; z-index: 6; }
.loot-row { display: flex; align-items: center; gap: 6px; font-size: 8px; color: #f4e4c1; padding: 4px 6px; border-radius: 3px; cursor: pointer; white-space: nowrap; }
.loot-row.sel { background: #5a3a22; color: #fff; }
.loot-row.off { color: #8a7a62; cursor: default; }
.loot-key { color: #f2cf7a; min-width: 8px; }
.loot-row canvas { flex: none; }

/* ---- multiplayer ---- */
.net-big { text-align: center; font-size: 28px; color: #f2cf7a; text-shadow: 3px 3px 0 #3a1d10; margin: 6px 0; }
.net-big:empty { display: none; }
#hud-online { position: absolute; right: 12px; top: 50px; font-size: 8px; background: rgba(30,18,12,0.82); border: 3px solid #4a2f1b; border-radius: 4px; padding: 6px 9px; color: #9affb0; }
#hud-online.solo { color: #c9b48f; }
#tags { position: absolute; inset: 0; pointer-events: none; }
.tag { position: absolute; transform: translate(-50%, -100%); font-size: 7px; color: #fff; text-shadow: 1px 1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, -1px -1px 0 #000; white-space: nowrap; }

/* ---- power level ---- */
.power { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 9px; color: #f2cf7a; }
.power .rank { width: 22px; height: 22px; font-size: 11px; }
.stat-lv { display: flex; flex-direction: column; gap: 3px; }
.stat-lv .pct { font-size: 6px; color: #8a7a62; }

/* controls & guide: search + pages */
#ctl-search { width: 100%; box-sizing: border-box; margin: 4px 0 8px; padding: 8px; font: inherit; font-size: 10px; background: #1a0f0a; color: #f2e8d8; border: 2px solid #5a3a22; }
.ctl-head { color: #9ad8ff; font-size: 10px; margin: 2px 0 4px; text-align: center; }
#ctl-list { margin-bottom: 4px; }
#ctl-list .cat { color: #8a7a6a; font-size: 8px; white-space: nowrap; }
#ctl-list mark { background: #5a4a1a; color: #fff6c8; }
.ctl-pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 8px 0; font-size: 9px; }
.ctl-pager button { min-width: 36px; }

/* multiplayer chat: bottom-left log (lines fade after a minute) + bubbles over heads */
#chat { position: absolute; left: 10px; bottom: 54px; width: min(340px, 60vw); pointer-events: none; font-size: 8px; line-height: 1.5; }
#chat-log div { color: #f2e8d8; text-shadow: 1px 1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, -1px -1px 0 #000; padding: 1px 0; word-wrap: break-word; }
#chat-log b { color: #f2cf7a; font-weight: normal; }
#chat-log .sys { color: #9ad8ff; }
#chat-input { pointer-events: auto; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 6px; font: inherit; font-size: 9px; background: rgba(26,15,10,0.9); color: #f2e8d8; border: 2px solid #d9a441; }
#chat-hint { color: #8a7a6a; }
.bubble { position: absolute; transform: translate(-50%, -100%); max-width: 180px; padding: 3px 6px; font-size: 7px; line-height: 1.4; color: #1a0f0a; background: #f2e8d8; border: 2px solid #1a0f0a; white-space: normal; text-align: center; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -3px; border: 3px solid transparent; border-top-color: #1a0f0a; }

/* PvP mode + alignment */
.pvp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0; font-size: 9px; }
.pvp-mode { padding: 2px 6px; border: 2px solid #3a2416; font-size: 8px; }
.pvp-mode.spar { color: #9ad8ff; }
.pvp-mode.killer { color: #ff5a4a; border-color: #8a1a1a; background: #2a0a08; }
button.danger { background: #8a1a1a; border-color: #ff5a4a; }
.align-row { display: grid; grid-template-columns: 1.4fr 0.9fr 0.8fr 1.6fr; gap: 8px; align-items: center; padding: 6px 4px; border-bottom: 2px solid #3a2416; font-size: 9px; }
.align-row.me { background: rgba(217,164,65,0.08); }
.align-bar { position: relative; height: 6px; background: #1a0f0a; border: 1px solid #5a3a22; }
.align-fill { position: absolute; top: 0; bottom: 0; }
.align-mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: #8a7a6a; }

/* breakthrough box under the abilities */
.bt-box { margin-top: 10px; padding: 8px; border: 2px solid #3a2416; background: rgba(20,12,8,0.5); font-size: 8px; line-height: 1.6; }
.bt-title { color: #bfe4ff; margin: 2px 0 4px; }
.bt-row { color: #b8a890; display: flex; gap: 6px; }
.bt-row.ok { color: #9affb0; }
.bt-mark { width: 26px; flex: none; text-align: right; }
.stat.maxed .lv, .stat.maxed .pct { color: #bfe4ff; }
.stat.maxed .stat-bar div { background: #7ab8e0; }

/* scroll slots on the character screen */
#char-scrolls { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.scroll-slot { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; padding: 4px 6px; font: inherit; font-size: 8px; background: rgba(20,12,8,0.55); color: #f2e8d8; border: 2px solid #3a2416; cursor: pointer; }
.scroll-slot.sel { border-color: #d9a441; }
.scroll-slot.locked { opacity: 0.45; cursor: default; }
.scroll-slot .scroll-name { flex: 1; line-height: 1.5; }
.scroll-slot .dim, .scroll-name.dim { color: #9a8a74; }
.scroll-m { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; color: #bfe4ff; }
.scroll-bar { display: block; width: 36px; height: 3px; background: #1a0f0a; }
.scroll-bar span { display: block; height: 100%; background: #7ab8e0; }

/* leaderboard */
#board-search { width: 100%; box-sizing: border-box; margin: 4px 0 8px; padding: 8px; font: inherit; font-size: 10px; background: #1a0f0a; color: #f2e8d8; border: 2px solid #5a3a22; }
.board-head, .board-row { display: grid; grid-template-columns: 34px 1.6fr 48px 60px 1fr 1fr 1fr; gap: 6px; align-items: center; font-size: 8px; padding: 4px 6px; }
.board-head { color: #8a7a6a; border-bottom: 2px solid #3a2416; }
.board-list { max-height: 50vh; overflow-y: auto; margin-bottom: 8px; }
.board-row { border-bottom: 1px solid #2a1a10; color: #f2e8d8; }
.board-row.me { background: rgba(217,164,65,0.15); }
.board-row .on { color: #9affb0; }
.board-row .killer { color: #ff6a5a; }
.board-row mark { background: #5a4a1a; color: #fff6c8; }
@media (max-width: 760px) { .board-head span:nth-child(5), .board-row span:nth-child(5), .board-head span:nth-child(7), .board-row span:nth-child(7) { display: none; } .board-head, .board-row { grid-template-columns: 30px 1.6fr 40px 50px 1fr; } }

/* world map: corner minimap and the full map */
#minimap { position: absolute; right: 12px; top: 84px; width: 160px; height: 112px; border: 3px solid #4a2f1b; border-radius: 4px; image-rendering: pixelated; pointer-events: auto; cursor: pointer; background: #10161c; }
#worldmap { position: absolute; inset: 0; background: rgba(8,6,4,0.72); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; pointer-events: auto; cursor: pointer; z-index: 8; }
#worldmap canvas { border: 4px solid #6b4a2c; border-radius: 4px; image-rendering: pixelated; box-shadow: 0 0 0 3px #2c1810; background: #e8d8b0; }
.wm-title { font-size: 12px; color: #f2cf7a; text-shadow: 2px 2px 0 #3a1d10; }
.wm-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; font-size: 7px; }
.wm-legend .me { color: #fff; } .wm-legend .ls { color: #8ff0ff; } .wm-legend .hw { color: #ffd36b; } .wm-legend .sk { color: #ff6a5a; } .wm-legend .pl { color: #9affb0; } .wm-legend .cn { color: #fff; }
.wm-close { font-size: 7px; color: #c9b48f; }
@media (max-width: 600px) { #minimap { width: 112px; height: 78px; top: 76px; } }

.bag-slots.huge { max-height: 372px; overflow-y: auto; padding-right: 6px; }

/* houses in Thornwall */
.house-cols { display: grid; grid-template-columns: auto auto; gap: 24px; align-items: start; }
.chest-slots { grid-template-columns: repeat(6, 54px); }
.house-explain { font-size: 9px; line-height: 1.7; margin: 0 0 10px; color: #f4e4c1; }
.house-explain.warn { color: #ffb08a; }
.house-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rent-box { margin-top: 14px; padding: 8px; border: 2px solid #4a2f1b; border-radius: 4px; background: rgba(30,18,12,0.5); }
@media (max-width: 760px) { .house-cols { grid-template-columns: 1fr; } }

/* ---- parties (online) ---- */
#pmenu { position: absolute; transform: translate(-50%, -100%); pointer-events: auto; display: flex; flex-direction: column; gap: 2px; background: rgba(20,12,8,0.92); border: 2px solid #4a2f1b; border-radius: 4px; padding: 4px; z-index: 7; min-width: 120px; }
#pmenu .pm-name { font-size: 8px; color: #ffd36b; padding: 3px 6px 4px; border-bottom: 1px solid #4a2f1b; margin-bottom: 2px; white-space: nowrap; }
#hud-party { position: absolute; left: 12px; top: 186px; background: rgba(30,18,12,0.82); border: 3px solid #4a2f1b; border-radius: 4px; padding: 7px 9px; min-width: 190px; font-size: 8px; color: #f4e4c1; pointer-events: auto; }
#hud-party .pt-title { color: #9affb0; margin-bottom: 5px; display: flex; justify-content: space-between; gap: 8px; }
#hud-party .pt-title button { font: inherit; font-size: 7px; background: #5a3a22; color: #f4e4c1; border: 1px solid #8a5a32; border-radius: 3px; padding: 2px 5px; cursor: pointer; }
#hud-party .pt-row { margin-top: 4px; }
#hud-party .pt-row .pt-zone { color: #8a7a62; }
#hud-party .pt-row.here .pt-zone { color: #9affb0; }
#hud-party .pt-bar { height: 3px; background: #2a1a10; margin-top: 2px; }
#hud-party .pt-bar div { height: 100%; background: #e04a3a; }
#pinvite { position: absolute; left: 50%; top: 90px; transform: translateX(-50%); background: rgba(30,18,12,0.92); border: 3px solid #4a2f1b; border-radius: 4px; padding: 10px 12px; font-size: 9px; color: #f4e4c1; pointer-events: auto; text-align: center; z-index: 8; }
#pinvite .pinvite-btns { margin-top: 8px; display: flex; gap: 8px; justify-content: center; }
#pinvite button { font: inherit; font-size: 8px; background: #5a3a22; color: #f4e4c1; border: 2px solid #8a5a32; border-radius: 3px; padding: 4px 9px; cursor: pointer; }
#pinvite button:hover, #hud-party .pt-title button:hover { background: #7a4a2a; }
.tag.party { color: #9affb0; }

/* Enter: the last few things said, above the chat box */
#chat-history { background: rgba(26,15,10,0.78); border: 2px solid #4a2f1b; border-radius: 3px; padding: 4px 6px; margin-bottom: 3px; }
#chat-history div { color: #f2e8d8; padding: 1px 0; word-wrap: break-word; }
#chat-history b { color: #f2cf7a; font-weight: normal; }
#chat-history .none { color: #8a7a62; }
#chat.recall #chat-log { display: none; }

/* ---- market stands ---- */
.stand-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.stand-row .slot { flex: none; }
.stand-info { flex: 1; font-size: 9px; color: #f4e4c1; min-width: 120px; }
.stand-info .sub { margin: 2px 0 0; }
.stand-num { width: 56px; font: inherit; font-size: 9px; padding: 4px; background: #1e1612; color: #f4e4c1; border: 2px solid #4a2f1b; }
.stand-form { margin-top: 8px; padding: 6px; border: 2px solid #4a2f1b; background: rgba(30,18,12,0.6); }
.stand-form .house-buttons { align-items: center; }

/* chat channels: All / Party */
#chat-ch { display: flex; gap: 4px; margin-top: 4px; pointer-events: auto; }
#chat-ch button { font: inherit; font-size: 8px; padding: 3px 7px; background: rgba(26,15,10,0.9); color: #c9b48f; border: 2px solid #4a2f1b; border-radius: 3px; cursor: pointer; }
#chat-ch button.on { color: #fff; border-color: #d9a441; }
#chat-ch button.party.on { border-color: #6ad88a; color: #9affb0; }
#chat-ch button:disabled { opacity: 0.4; cursor: default; }
#chat-ch .hint { font-size: 7px; color: #8a7a62; align-self: center; }
#chat-log .party, #chat-history .party { color: #9affb0; }
#chat-log .party b, #chat-history .party b { color: #6ad88a; }
.tag.npc { color: #bfe4ff; font-size: 6px; }
.tag.npc.hostile { color: #ff8a7a; }

/* ---- the cultivators: ranking, family tree, rumours ---- */
.cult-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
#cult-body { max-height: 62vh; overflow-y: auto; font-size: 9px; color: #f4e4c1; }
.cult-table { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; }
.cult-row { display: grid; grid-template-columns: 26px minmax(110px, 1.6fr) 48px 80px 96px 80px 48px 52px; gap: 6px; align-items: center; padding: 3px 4px; border-bottom: 1px solid #3a2a1e; }
.cult-row.head { color: #c9b48f; border-bottom: 2px solid #4a2f1b; }
.cult-row.dead { color: #8a7a62; }
.cult-row.sel { background: rgba(217,164,65,0.12); }
.cult-link { font: inherit; font-size: 9px; background: none; border: none; color: #f2cf7a; padding: 2px 4px; cursor: pointer; text-align: left; }
.cult-link:hover { color: #fff; text-decoration: underline; background: none; }
.cult-link.dead { color: #a8987e; }
.cult-link.sel { color: #9affb0; }
.cult-card { padding: 8px; border: 2px solid #4a2f1b; background: rgba(30,18,12,0.6); margin-bottom: 8px; line-height: 1.7; }
.cult-gen { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; padding: 4px 0; border-bottom: 1px solid #3a2a1e; }
.cult-gen-l { width: 120px; color: #c9b48f; }
.cult-news { padding: 3px 0; border-bottom: 1px solid #2a1e16; line-height: 1.6; }
@media (max-width: 760px) { .cult-row { grid-template-columns: 22px 1fr 40px 60px; } .cult-row span:nth-child(n+5) { display: none; } }
.cult-card.sel { border-color: #d9a441; }
.cult-empty { color: #6a5a46; font-style: italic; padding: 2px 4px; }
.talk-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 9px; }
.talk-bond { color: #f4e4c1; min-width: 86px; }
.talk-bond.good { color: #9affb0; } .talk-bond.bad { color: #ff8a7a; }
.talk-bar { flex: 1; height: 5px; background: #2a1e16; border: 1px solid #4a2f1b; }
.talk-fill { height: 100%; background: #6ad06a; } .talk-fill.bad { background: #e05040; }
.talk-line { margin: 10px 0; padding: 10px; border: 2px solid #4a2f1b; background: rgba(30,18,12,0.6); color: #f4e4c1; font-size: 10px; line-height: 1.7; min-height: 40px; }
.talk-gain { color: #9affb0; margin-bottom: 6px; }
.talk-btns, .talk-gifts { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.talk-gifts { max-height: 26vh; overflow-y: auto; }
.tag.npc { white-space: pre; text-align: center; }
.tag.npc.ally { color: #9affb0; }
.cult-link.player { color: #9affb0; cursor: default; }
.boards { display: grid; grid-template-columns: 1.25fr 1fr; gap: 14px; }
.board-col { min-width: 0; }
.board-col .board-head, .board-col .board-row { grid-template-columns: 26px 1.5fr 36px 44px 1fr 46px 1fr; }
.nboard-head, .nboard-row { display: grid; grid-template-columns: 26px 1.5fr 1.3fr 36px 40px; gap: 6px; align-items: center; font-size: 8px; padding: 4px 6px; }
.nboard-head { color: #8a7a6a; border-bottom: 2px solid #3a2416; }
.nboard-row { border-bottom: 1px solid #2a1a10; color: #f2e8d8; }
.nboard-row .where { color: #9fc8e8; }
.nboard-row .lead { color: #f2cf7a; }
@media (max-width: 860px) { .boards { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .board-col .board-head, .board-col .board-row { grid-template-columns: 26px 1.6fr 36px 44px 46px; } }
#bossbar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: min(420px, 70vw); text-align: center; pointer-events: none; z-index: 5; }
.boss-name { color: #ffd0b0; font-size: 9px; text-shadow: 1px 1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, -1px -1px 0 #000; margin-bottom: 3px; }
.boss-track { height: 7px; background: #1a0f0a; border: 2px solid #4a2f1b; }
.boss-fill { height: 100%; background: linear-gradient(#e05040, #a82a20); transition: width 0.2s; }
