/* All UI is laid out in logical pixels inside #ui, which is scaled to the
   canvas pixel size — so DOM and pixel art share one grid. */
:root { --ink: #0c0610; --gold: #e8c052; --panel: #1c1420; --panel2: #2a1e2a; --edge: #5a4a3a; --txt: #e8dcc6; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #050307; overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
body { display: flex; justify-content: center; align-items: flex-start; }
#app { position: relative; }
#cv { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
#ui { position: absolute; left: 0; top: 0; transform-origin: 0 0; font-family: 'Tiny5', monospace; font-size: 8px; color: var(--txt); pointer-events: none; }
#ui > * { position: absolute; pointer-events: auto; }
button { font: inherit; color: inherit; cursor: pointer; }
.hide { display: none !important; }
.dim { color: #9a8a90; }
.gold { color: var(--gold); }
.red { color: #ff5a5a; }
.center { text-align: center; }

/* HUD */
#hud { display: flex; align-items: center; justify-content: space-between; padding: 1px 3px; background: linear-gradient(#0c0610e0, #0c061000); }
#bMenu { width: 13px; height: 12px; padding: 0; background: #2a1e2a; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #4a3a44; }
.gear { display: block; width: 7px; height: 7px; margin: auto; background:
  linear-gradient(#c9b8a0, #c9b8a0) 3px 0/1px 7px no-repeat, linear-gradient(#c9b8a0, #c9b8a0) 0 3px/7px 1px no-repeat,
  radial-gradient(circle at 50% 50%, #2a1e2a 1.2px, #c9b8a0 1.3px, #c9b8a0 2.6px, transparent 2.7px); }
#loc { text-align: center; line-height: 1; }
#locName { font-size: 6.5px; letter-spacing: .2px; color: #d8c8b0; text-shadow: 1px 1px 0 var(--ink); }
#pips { display: flex; gap: 1px; justify-content: center; margin-top: 1px; }
#pips i { width: 5px; height: 3px; background: #2a2028; border: 1px solid var(--ink); box-sizing: content-box; }
#pips i.done { background: #5ec85a; }
#pips i.cur { background: #e8c052; }
#pips i.boss { width: 7px; }
#pips i.boss:not(.done) { background: #7a1a24; }
#pips i.boss.cur { background: #ff4a5a; }
#goldBox { display: flex; align-items: center; gap: 2px; background: #1a1016c0; border: 1px solid var(--ink); padding: 0 3px; height: 10px; font-size: 7px; color: var(--gold); }
.coin { width: 5px; height: 5px; background: radial-gradient(circle at 40% 40%, #fff0a0 0.6px, #e8c052 1px, #a07020 2.4px, transparent 2.6px); display: inline-block; }

/* bars */
.bar { position: relative; height: 8px; background: #1a0c10; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #3a1a20; }
.bar i { position: absolute; left: 1px; top: 1px; bottom: 1px; max-width: calc(100% - 2px); background: linear-gradient(#ff5a5a 0 2px, #c8202c 2px); transition: width .25s steps(8); }
.bar b { position: relative; display: block; text-align: center; font-size: 6.5px; line-height: 6px; font-weight: 600; color: #fff; text-shadow: 1px 1px 0 var(--ink); }
#ebar { display: flex; align-items: center; gap: 3px; }
#eName { font-size: 7px; color: #ffb0a0; text-shadow: 1px 1px 0 var(--ink); white-space: nowrap; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
#ebar .bar { flex: 1; }
#eBar i { background: linear-gradient(#e0405a 0 2px, #901a2c 2px); }

/* combo & strike */
#combo { text-align: center; font-size: 7.5px; line-height: 10px; text-shadow: 1px 1px 0 var(--ink), -1px 0 0 var(--ink); pointer-events: none; }
#combo b { color: #fff; }
#combo .en { color: #ff7a6a; font-weight: 700; }
#bStrike { font-family: 'Press Start 2P', monospace; font-size: 6px; background: linear-gradient(#c0302a, #801a1a); color: #ffe8c0; border: 1px solid var(--ink); box-shadow: inset 0 1px 0 #ff7a5a, inset 0 -2px 0 #4a0c10, 0 1px 0 var(--ink); padding: 0; }
#hbar #bStrike { flex: none; height: 26px; }
#hbar #bStrike.hide { display: block !important; visibility: hidden; }   /* keeps the HP bar the same length before the deal */
#bStrike:disabled { filter: grayscale(.8) brightness(.55); }
#bStrike:not(:disabled) { animation: pulse 0.9s steps(2) infinite; }
@keyframes pulse { 50% { box-shadow: inset 0 1px 0 #ff9a7a, inset 0 -2px 0 #4a0c10, 0 0 0 1px #ffd040; } }

/* banner */
#banner { text-align: center; font-family: 'Press Start 2P', monospace; font-size: 8px; line-height: 18px; background: linear-gradient(90deg, transparent, #0c0610d8 20%, #0c0610d8 80%, transparent); opacity: 0; pointer-events: none; text-shadow: 1px 1px 0 var(--ink); }
#banner.show { animation: ban .9s steps(6) forwards; }
@keyframes ban { 0% { opacity: 0; transform: scaleY(0.2); } 15% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }

/* hero bar */
#hbar { display: flex; align-items: center; gap: 3px; padding: 2px 30px 2px 3px; pointer-events: none !important; }
#hbar > * { pointer-events: auto; }
#diceLbl { left: 0; width: 100%; display: flex; justify-content: center; gap: 30px; font-size: 8px; text-shadow: 1px 1px 0 var(--ink); pointer-events: none; }
#diceLbl span { width: 40px; text-align: center; }
#bHero { width: 26px; height: 26px; padding: 1px; background: #2a1e2a; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #8a7040; flex: none; }
#bHero canvas { width: 22px; height: 22px; image-rendering: pixelated; display: block; }
.hmid { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#hAtk { display: flex; gap: 6px; font-size: 7px; color: #d8c8b0; text-shadow: 1px 1px 0 var(--ink); }
.sq { width: 18px; height: 24px; padding: 0; background: #2a1e2a; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #4a3a44; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; flex: none; }
.sq small { font-size: 6px; color: var(--gold); line-height: 1; }
.sq:disabled { opacity: .45; }
.bulb { width: 7px; height: 9px; background: radial-gradient(circle at 50% 35%, #fff8c0 1px, #ffd040 2px, #c09020 3.4px, transparent 3.6px) 0 0/7px 7px no-repeat, linear-gradient(#8a8a8a, #5a5a5a) 2px 7px/3px 2px no-repeat; }
.potion { width: 7px; height: 9px; background: linear-gradient(#8a6a4a, #8a6a4a) 2px 0/3px 2px no-repeat, radial-gradient(circle at 50% 65%, #ff8a9a 0.8px, #e0304a 2px, #801a2a 3.4px, transparent 3.6px) 0 2px/7px 7px no-repeat; }

/* tips */
#tip { text-align: center; font-size: 7.5px; color: #ffe0a0; text-shadow: 1px 1px 0 var(--ink); opacity: 0; pointer-events: none; }
#tip.show { opacity: 1; animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: .55; } }

/* modal */
#modal { left: 0; top: 0; right: 0; bottom: 0; display: none; background: #06030ad0; align-items: center; justify-content: center; padding: 6px; }
#modal.show { display: flex; }
.panel { position: relative; width: 100%; max-height: 100%; overflow-y: auto; background: var(--panel); border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #6a5040, inset 0 0 0 2px var(--ink), inset 0 0 0 3px #2e2230; padding: 7px 7px 6px; scrollbar-width: thin; scrollbar-color: #5a4a3a #1c1420; animation: pop .18s steps(3); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.panel h2 { font-family: 'Press Start 2P', monospace; font-size: 8px; text-align: center; margin: 2px 0 6px; color: var(--gold); text-shadow: 1px 1px 0 var(--ink); font-weight: normal; }
.panel h3 { font-size: 8px; margin: 6px 0 3px; color: #d8c8b0; border-bottom: 1px solid #3a2e34; }
.panel p { margin: 3px 0; line-height: 1.3; }
.row { display: flex; gap: 4px; justify-content: center; margin-top: 6px; }
.col { display: flex; flex-direction: column; gap: 4px; margin: 4px 0; }
.btn { flex: 1; min-height: 16px; padding: 2px 4px; background: linear-gradient(#3a2c34, #2a1e26); border: 1px solid var(--ink); box-shadow: inset 0 1px 0 #5a4a50, inset 0 -1px 0 #1a1016; font-size: 8px; line-height: 1.1; }
.btn small { font-size: 6.5px; color: var(--gold); }
.btn.gold { background: linear-gradient(#b08a30, #7a5a18); color: #fff4d0; box-shadow: inset 0 1px 0 #f0d070, inset 0 -1px 0 #4a3008; text-shadow: 1px 1px 0 #3a2008; }
.btn.red { background: linear-gradient(#8a2a2a, #5a1414); box-shadow: inset 0 1px 0 #c05050; }
.btn.big { font-size: 10px; min-height: 22px; }
.btn:disabled { opacity: .4; }
.btn:active, .slot:active { transform: translateY(1px); }

/* title */
#modal.title { background: linear-gradient(#06030a40, #06030ae0 60%); }
#modal.title .panel { background: #1c1420e8; }
.logo { text-align: center; margin: 4px 0 8px; font-family: 'Press Start 2P', monospace; line-height: 1; }
.logo .l1 { font-size: 16px; color: #e8dcc6; text-shadow: 2px 2px 0 #7a1a24, 3px 3px 0 var(--ink); letter-spacing: 2px; }
.logo .l2 { font-size: 20px; color: var(--gold); text-shadow: 2px 2px 0 #7a4a10, 3px 3px 0 var(--ink); margin-top: 3px; letter-spacing: 3px; }
.logo .l3 { font-family: 'Tiny5', monospace; font-size: 9px; color: #c08a8a; margin-top: 5px; }

/* loot */
.newgear { font-family: 'Press Start 2P', monospace; font-size: 8px; text-align: center; color: #fff4e0; background: linear-gradient(#c0302a, #801a1a); border: 1px solid var(--ink); box-shadow: inset 0 1px 0 #ff7a5a; padding: 4px 2px; margin: -1px -1px 5px; clip-path: polygon(0 0, 100% 0, 97% 50%, 100% 100%, 0 100%, 3% 50%); }
.cur-lbl { text-align: center; color: var(--gold); font-size: 7px; margin-bottom: 2px; }
.swipe { touch-action: pan-y; transition: transform .12s; }
.icard { background: #e8dcc6; color: #2a1e24; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px var(--rc), inset 0 0 0 2px #b8a88a; padding: 2px 4px 4px; margin: 0 auto 4px; max-width: 150px; }
.icard.small { max-width: 110px; opacity: .92; transform: scale(.92); }
.icard .rhead { margin: -2px -4px 2px; background: var(--rc); color: #140810; text-align: center; font-weight: 700; font-size: 7.5px; line-height: 10px; text-shadow: 0 1px 0 #ffffff60; }
.icard .iname { text-align: center; font-weight: 700; font-size: 8px; line-height: 1.1; margin-bottom: 2px; }
.ipic { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 2px 0; }
.ipic img { width: 36px; height: 36px; image-rendering: pixelated; background: #2a1e24; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px var(--rc); padding: 0; }
.ipic span { font-size: 7px; }
.stats { list-style: none; margin: 2px 0; padding: 0; }
.stats li { display: flex; align-items: center; gap: 3px; font-size: 7px; line-height: 9px; border-bottom: 1px dotted #b8a88a60; }
.stats li span { flex: 1; }
.stats li em { font-style: normal; font-size: 6px; }
.stats.two { display: grid; grid-template-columns: 1fr 1fr; column-gap: 6px; color: var(--txt); }
.stats.two li { border-color: #3a2e34; }
.panel > .stats li { border-color: #3a2e34; }
.up { color: #2a9a2a; } .down { color: #c02020; }
.panel > .stats .up, .stats.two .up { color: #7ee07a; }
.setbox { border-left: 2px solid var(--sc); background: #0c061018; padding: 2px 3px; margin-top: 3px; font-size: 7px; }
.panel > .setbox { background: #0c061060; margin-bottom: 3px; }
.sname { font-weight: 700; color: var(--sc); text-shadow: 1px 1px 0 var(--ink); }
.icard .sname { text-shadow: none; filter: brightness(.7); }
.sname small { font-weight: 400; opacity: .8; }
.sb { opacity: .5; line-height: 9px; }
.sb.on { opacity: 1; }
.sb i { font-style: normal; display: inline-block; width: 8px; height: 8px; line-height: 8px; text-align: center; background: var(--sc); color: #140810; margin-right: 2px; font-weight: 700; }
.pieces { font-size: 6.5px; color: #b8a8a0; line-height: 1.2; }

/* inventory */
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-bottom: 4px; }
.slots.bag { grid-template-columns: repeat(6, 1fr); }
.slot { position: relative; aspect-ratio: 1; padding: 1px; background: #2a1e26; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px var(--rc, #3a3040); display: flex; align-items: center; justify-content: center; }
.slot img { width: 100%; height: 100%; image-rendering: pixelated; }
.slot small { position: absolute; right: 1px; bottom: 0; font-size: 6px; text-shadow: 1px 1px 0 var(--ink); }
.slot.empty span { font-size: 6px; color: #6a5a60; text-align: center; }
.aset { font-size: 7px; line-height: 9px; border-left: 2px solid var(--sc); padding-left: 3px; margin: 2px 0; }
.aset b { color: var(--sc); }
.aset.off { opacity: .5; text-decoration: line-through; }

/* bestiary */
.beast { background: #0c061060; border: 1px solid #2e2230; padding: 3px; margin-bottom: 4px; }
.bname { font-weight: 700; color: var(--gold); font-size: 8px; }
.bimgs { display: flex; justify-content: space-around; align-items: flex-end; gap: 2px; }
.bimgs figure { margin: 0; text-align: center; font-size: 6px; line-height: 1.1; flex: 1; }
.bimgs img { image-rendering: pixelated; max-width: 100%; }
#modal.wide .panel { padding: 5px; }

/* ---------------------------------------------------------------- town */
#ui.town > #hud, #ui.town > #ebar, #ui.town > #combo, #ui.town > #bStrike, #ui.town > #banner,
#ui.town > #hbar, #ui.town > #tip, #ui.town > #diceLbl { display: none !important; }
#screen { left: 0; top: 0; right: 0; bottom: 0; display: none; background: #0c0810; overflow: hidden; flex-direction: column; }
#screen.show { display: flex; }
.shead { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 2px 4px; background: linear-gradient(#0c0610, #0c0610c0); font-size: 8px; }
.shead b { font-family: 'Press Start 2P', monospace; font-size: 6.5px; color: var(--gold); text-shadow: 1px 1px 0 var(--ink); text-align: center; flex: 1; }
.sback { width: 14px; height: 13px; padding: 0; font-size: 10px; line-height: 10px; background: #2a1e2a; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #4a3a44; }
.sgold { display: flex; align-items: center; gap: 2px; color: var(--gold); font-size: 7.5px; min-width: 26px; justify-content: flex-end; }
.sbar { position: relative; z-index: 2; display: flex; gap: 3px; align-items: center; padding: 1px 4px 2px; background: #0c0610c0; }
.sbar .bar { flex: 1; }
.mini { font-size: 6.5px; padding: 1px 3px; height: 11px; background: #2a1e2a; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #4a3a44; white-space: nowrap; }
.buffs { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 2px; padding: 1px 4px 2px; background: #0c0610a0; }
.buff { font-size: 6.5px; color: #7ee0c8; background: #10302a; border: 1px solid #1e5a4a; padding: 0 2px; }
.buff small { color: #9ab0a8; }
.sfoot { position: relative; z-index: 2; display: flex; gap: 4px; padding: 3px 4px 4px; background: linear-gradient(#0c061000, #0c0610); margin-top: auto; }
.sfoot .btn { flex: 1; }
.map-foot { display: grid; grid-template-columns: 1fr 1fr 24px; }
.map-foot [data-v=go1] { grid-column: 1 / -1; }
/* map */
.mapscroll { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; scrollbar-width: none; touch-action: pan-y; }
.mapscroll::-webkit-scrollbar { display: none; }
.mapinner { position: relative; }
.mapimg { position: absolute; left: 0; top: 0; image-rendering: pixelated; }
.mnode { position: absolute; width: 22px; height: 24px; padding: 0; background: none; border: 0; }
.mnode img { width: 22px; height: 24px; image-rendering: pixelated; display: block; }
.mnode.open img { animation: bob 1s steps(2) infinite; }
@keyframes bob { 50% { transform: translateY(-1px); filter: drop-shadow(0 0 2px #ffd040); } }
.mlabel { position: absolute; transform: translateX(-50%); font-size: 6.5px; white-space: nowrap; color: #b8a8a0; text-shadow: 1px 1px 0 var(--ink), -1px 0 0 var(--ink), 0 -1px 0 var(--ink); pointer-events: none; }
.mlabel.open { color: #ffe0a0; } .mlabel.done { color: #7ee07a; } .mlabel.vil { color: #ffd040; }
.mlabel.locked { opacity: .6; }
.mregion { position: absolute; left: 0; width: 50%; text-align: center; font-family: 'Press Start 2P', monospace; font-size: 6px; letter-spacing: 1px; color: #d8c8b0a0; text-shadow: 1px 1px 0 var(--ink); pointer-events: none; }
.lockbig { text-align: center; font-size: 22px; margin: 4px; filter: grayscale(1); }
/* village */
.vbg, .ibg { position: absolute; left: 0; top: 0; image-rendering: pixelated; z-index: 0; }
.vhot { position: absolute; z-index: 1; background: none; border: 0; padding: 0; }
.vhot span { position: absolute; left: 50%; top: 0; transform: translateX(-50%); white-space: nowrap; font-size: 7px; color: #ffe0a0; background: #1a1016d8; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #8a7040; padding: 1px 3px; animation: bob 1.2s steps(2) infinite; }
.vhot:active span { background: #5a3a1a; }
/* interiors */
.ipanel { position: absolute; z-index: 1; left: 4px; right: 4px; bottom: 4px; overflow-y: auto; background: #1c1420ee; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #6a5040; padding: 4px; scrollbar-width: none; }
.pc.npc { width: 18px; height: 24px; }
.ipanel.table { bottom: auto; max-height: calc(100% - 60px); }
.tabs { display: flex; gap: 2px; margin-bottom: 3px; }
.tab { flex: 1; font-size: 7px; padding: 2px; background: #2a1e26; border: 1px solid var(--ink); color: #9a8a90; }
.tab.on { background: #5a4020; color: #ffe0a0; box-shadow: inset 0 1px 0 #8a6a30; }
.npcline { font-size: 7px; color: #d8c8b0; font-style: normal; margin: 2px 0 4px; text-align: center; line-height: 1.25; }
.shopline { display: flex; align-items: center; gap: 4px; padding: 2px 0; border-bottom: 1px solid #2e2230; }
.shopline img { width: 18px; height: 18px; image-rendering: pixelated; flex: none; }
.shopline img.ic { width: 20px; height: 20px; background: #2a1e24; box-shadow: inset 0 0 0 1px var(--rc); padding: 1px; }
.shopline img.face { width: 26px; height: 26px; background: #2a1e24; border: 1px solid var(--ink); }
.sl-t { flex: 1; min-width: 0; line-height: 1.15; }
.sl-t b { display: block; font-size: 7.5px; }
.sl-t small { font-size: 6.5px; color: #a89aa0; }
.btn.small { flex: none; min-width: 34px; font-size: 7px; min-height: 13px; padding: 1px 3px; }
.npcbox { display: flex; gap: 5px; align-items: flex-start; margin: 3px 0; }
.npcbox > div { flex: 1; min-width: 0; font-size: 7.5px; }
.npcbox p { margin: 2px 0; font-size: 7px; font-style: normal; color: #d8c8b0; }
.face.big { width: 54px; height: 54px; image-rendering: pixelated; background: radial-gradient(#3a2a34, #1a1016); border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #8a7040; flex: none; }
.npcbox.bath .face.big { background: radial-gradient(#4a4a5a, #1e1e2a); }
.slidein { animation: slidein .5s steps(5); }
@keyframes slidein { from { transform: translateX(-60px); opacity: 0; } }
.prow { display: flex; gap: 2px; justify-content: center; flex-wrap: wrap; margin: 3px 0; min-height: 4px; }
.pc { width: 24px; height: 32px; image-rendering: pixelated; transition: transform .1s steps(2); }
.pc.up { transform: translateY(-4px); filter: drop-shadow(0 1px 0 #ffd040) drop-shadow(0 -1px 0 #ffd040); }
.pc.hot { filter: grayscale(.8) brightness(.6); }
.pc.sm { width: 12px; height: 16px; }
.prow.aside { min-height: 16px; opacity: .85; }
.pot, .fturn { text-align: center; font-size: 7.5px; margin: 2px 0; }
.fscore { display: flex; gap: 6px; font-size: 7px; margin-top: 3px; flex-wrap: wrap; }
.fscore b { color: var(--gold); }
/* fade to black with hourglass */
#cinematic { inset: 0; display: none; overflow: hidden; background: #09070a; z-index: 5; }
#cinematic.show { display: block; }
#cinematic img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
#cinematic.full img { object-fit: contain; }
#cinematic.face img { position: absolute; width: 170%; height: 170%; left: -35%; top: 0; }
#cinematic::before, #cinematic::after { content: ''; position: absolute; left: 0; right: 0; height: 51%; background: #000; z-index: 1; transition: transform .42s steps(8); }
#cinematic::before { top: 0; transform: translateY(-100%); }
#cinematic::after { bottom: 0; transform: translateY(100%); }
#cinematic.closed::before, #cinematic.closed::after { transform: translateY(0); }
#fade { left: 0; top: 0; right: 0; bottom: 0; background: #000; opacity: 0; pointer-events: none; display: flex; align-items: center; justify-content: center; transition: opacity .8s steps(8); z-index: 6; }
#fade.show { opacity: 1; pointer-events: auto; }
#fade.out { opacity: 0; }
#fade .hg { width: 32px; height: 44px; image-rendering: pixelated; animation: hg 1.3s steps(8) infinite; }
@keyframes hg { 0%, 40% { transform: rotate(0); } 60%, 100% { transform: rotate(180deg); } }
#toast { left: 10%; right: 10%; bottom: 40px; text-align: center; font-size: 7.5px; background: #1a1016ee; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #8a7040; padding: 3px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 6; }
#toast.show { opacity: 1; }
#modal { z-index: 4; }

/* ------------------------------------------------------- living scenes */
#screen.scene { background: transparent; pointer-events: none !important; }
#screen.scene > * { pointer-events: auto; }
#screen.scene > #sceneFx { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
#sceneNav { position: absolute; left: 0; right: 0; top: 50%; height: 0; z-index: 3; pointer-events: none !important; }
.rnav { position: absolute; top: -14px; width: 18px; height: 28px; padding: 0; font-size: 14px; line-height: 12px; color: #ffe0a0; background: #1a1016d8; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #8a7040; pointer-events: auto; }
.rnav.l { left: 2px; } .rnav.r { right: 2px; }
.rnav:active { background: #5a3a1a; }
.rtitle { position: absolute; left: 50%; transform: translateX(-50%); top: calc(-50vh); }
#screen.tavern .rtitle { position: fixed; }
.rtitle { display: none; }
.vlabel { position: absolute; transform: translateX(-50%); white-space: nowrap; font-size: 7px; color: #ffe0a0; background: #1a1016d8; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #8a7040; padding: 1px 3px; pointer-events: none; }
.bubble { position: absolute; font-size: 7px; line-height: 1.2; color: #1a1016; background: #efe6d2; border: 1px solid var(--ink); padding: 2px 3px; text-align: center; animation: bubin .18s steps(3); pointer-events: none; z-index: 3; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -3px; width: 3px; height: 3px; background: #efe6d2; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); transform: translateX(-50%); }
.bubble.out { opacity: 0; transition: opacity .35s steps(3); }
@keyframes bubin { from { transform: scale(.6); opacity: 0; } }
/* visual-novel dialogue */
#dlg { position: absolute; left: 3px; right: 3px; bottom: 3px; z-index: 4; display: none; }
#dlg.show { display: block; }
.vnbox { background: #140c14ee; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #8a7040, inset 0 0 0 2px var(--ink); padding: 8px 5px 5px; position: relative; margin-top: 8px; }
.vnopts { max-height: 190px; overflow-y: auto; scrollbar-width: none; }
.vnname { position: absolute; top: -7px; left: 6px; font-family: 'Press Start 2P', monospace; font-size: 6px; color: #1a1016; background: var(--gold); border: 1px solid var(--ink); padding: 2px 4px; }
.vntext { font-size: 8px; line-height: 1.3; min-height: 20px; color: #efe6d2; margin-bottom: 4px; }
.vnopts { display: flex; flex-direction: column; gap: 2px; }
.vnopt { display: flex; align-items: center; gap: 4px; text-align: left; font-size: 7.5px; padding: 3px 5px; background: linear-gradient(#2e2230, #221822); border: 1px solid var(--ink); box-shadow: inset 0 1px 0 #4a3a44; color: #e8dcc6; }
.vnopt::before { content: '›'; color: var(--gold); }
.vnopt em { margin-left: auto; font-style: normal; color: var(--gold); }
.vnopt.gold { color: #ffe0a0; }
.vnopt.red { color: #ff8a8a; }
.vnopt:disabled { opacity: .4; }
.vnopt.item img { width: 16px; height: 16px; image-rendering: pixelated; }
.vnopt.item span { display: flex; flex-direction: column; line-height: 1.1; }
.vnopt.item small { font-size: 6px; color: #a89aa0; }
/* table games */
.tbltop { position: absolute; top: 28px; left: 3px; right: 3px; display: flex; justify-content: space-between; font-size: 7.5px; text-shadow: 1px 1px 0 var(--ink); z-index: 3; pointer-events: none; }
.tbltop b { color: var(--gold); }
.tbltop .goal { color: #9a8a90; }
.tblmsg { position: absolute; left: 6px; right: 6px; top: 51%; text-align: center; font-size: 8px; text-shadow: 1px 1px 0 var(--ink), -1px 0 0 var(--ink); z-index: 3; pointer-events: none; }
.tblact { position: absolute; left: 3px; right: 3px; bottom: 3px; display: flex; gap: 3px; z-index: 3; }
.tblact .btn { min-height: 22px; font-size: 7.5px; }
.ibtn { width: 13px; height: 12px; padding: 0; font-family: 'Press Start 2P', monospace; font-size: 6px; line-height: 10px; color: #7ec8ff; background: #1a2030; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #4a6a9a; border-radius: 0; }
#screen .ibtn#tblInfo { position: absolute; right: 4px; top: 40px; z-index: 4; width: 16px; height: 16px; font-size: 8px; line-height: 14px; }
.hl { display: flex; gap: 2px; }
.quip { color: #c8b8a0; font-style: normal; font-weight: normal; }


/* ----------------------------------------------------------- skill tree */
#screen.skills { background: #0c0810; }
.sklvl { display: flex; align-items: center; gap: 4px; padding: 2px 4px; font-size: 7.5px; background: #140c16; border-bottom: 1px solid #2e2230; }
.sklvl b { color: var(--gold); }
.xpbar { position: relative; flex: 1; height: 9px; background: #0c0610; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #2a3a5a; }
.xpbar i { position: absolute; left: 1px; top: 1px; bottom: 1px; max-width: calc(100% - 2px); background: linear-gradient(#4a8ad0 0 2px, #1e4a80 2px); }
.xpbar em { position: relative; display: block; text-align: center; font-style: normal; font-size: 6.5px; line-height: 7px; color: #fff; text-shadow: 1px 0 0 var(--ink), -1px 0 0 var(--ink), 0 1px 0 var(--ink), 0 -1px 0 var(--ink); }
.skwrap { position: relative; }
#skCv { display: block; image-rendering: pixelated; touch-action: none; }
.skzoom { position: absolute; right: 3px; top: 3px; display: flex; flex-direction: column; gap: 2px; }
.skzoom button { width: 14px; height: 14px; padding: 0; font-size: 9px; line-height: 12px; color: #e8dcc6; background: #1a1016e0; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #5a4a3a; }
.skinfo { flex: 1; min-height: 40px; padding: 3px 4px; background: #140c16; border-top: 1px solid #2e2230; }
.skhint { text-align: center; font-size: 7px; color: #9a8a90; line-height: 1.4; }
.skcard { display: flex; align-items: center; gap: 4px; }
.skcard img { width: 28px; height: 28px; image-rendering: pixelated; background: #1e1620; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px var(--bc); flex: none; padding: 1px; }
.skc { flex: 1; min-width: 0; }
.skt { font-size: 8px; font-weight: 700; color: var(--bc); text-shadow: 1px 1px 0 var(--ink); }
.skt small { display: block; font-weight: 400; font-size: 6px; color: #9a8a90; }
.skd { font-size: 7px; line-height: 1.25; color: #d8c8b0; }
.skcard .btn { flex: none; min-width: 26px; min-height: 22px; font-size: 9px; }
.mini.hot { color: #ffe070; box-shadow: inset 0 0 0 1px #c9a03a; animation: blink 1s steps(2) infinite; }
/* HUD bits */
.ibtn.flee { color: #ff9a8a; background: #2a1414; box-shadow: inset 0 0 0 1px #8a3a3a; }
#bHero { position: relative; }
#lvlTag { position: absolute; right: -2px; bottom: -3px; min-width: 9px; font-size: 6px; line-height: 7px; padding: 0 1px; color: #0c0610; background: #7ec8ff; border: 1px solid var(--ink); }
/* character creation */
#screen.chargen { background: radial-gradient(ellipse at 50% 30%, #2a1e2e, #0c0810 70%); }
.cgprev { display: flex; justify-content: center; padding: 2px 0; }
#cgCv { width: 120px; height: 174px; image-rendering: pixelated; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #6a5040, 0 0 0 1px #2e2230; }
.cgopts { flex: 1; overflow-y: auto; padding: 0 6px; scrollbar-width: none; }
.cgrow { display: flex; align-items: center; gap: 3px; margin: 2px 0; font-size: 7.5px; }
.cgl { width: 44px; color: #9a8a90; }
.cga { width: 16px; height: 14px; padding: 0; font-size: 10px; line-height: 10px; color: var(--gold); background: #2a1e26; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #5a4a3a; }
.cgv { flex: 1; text-align: center; background: #140c14; border: 1px solid #2e2230; line-height: 12px; height: 14px; display: flex; align-items: center; justify-content: center; }
.cgv .sw { width: 30px; height: 7px; border: 1px solid var(--ink); display: inline-block; }
#cgName { flex: 1; font: inherit; font-size: 8px; color: #e8dcc6; background: #140c14; border: 1px solid #2e2230; padding: 1px 3px; height: 14px; outline: none; user-select: text; -webkit-user-select: text; }

/* pixel fonts must never be slanted; glyph helpers */
#ui i, #ui em { font-style: normal; }
.gl { display: inline-block; width: 7px; height: 7px; margin-right: 2px; vertical-align: -1px; image-rendering: pixelated; background-size: 7px 7px; }
.gl-atk { background-image: var(--gl-atk); } .gl-crit { background-image: var(--gl-crit); }
.ib { display: inline-block; width: 9px; height: 9px; line-height: 9px; text-align: center; font-family: 'Press Start 2P', monospace; font-size: 6px; color: #7ec8ff; background: #1a2030; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #4a6a9a; }
.vnname { white-space: nowrap; max-width: calc(100% - 12px); overflow: hidden; text-overflow: ellipsis; }
.quip { display: inline-block; background: #0c0610c8; padding: 1px 3px; max-width: 94%; }
#tblMsg, .tblmsg { background: #0c0610b0; padding: 1px 3px; }
.slot img { width: 36px; height: 36px; }
.slots.bag { grid-template-columns: repeat(4, 1fr); }
.slot { overflow: hidden; }

/* racial skill */
.sq.race img { width: 14px; height: 14px; image-rendering: pixelated; }
.sq .hud-icon { display: block; width: 14px; height: 14px; object-fit: contain; image-rendering: pixelated; margin: 0 auto; }
.sq.race small { font-size: 5.5px; color: #9a8a90; }
.sq.race.ready { box-shadow: inset 0 0 0 1px #ffd040; animation: pulse 0.9s steps(2) infinite; }
.sq.race.ready small { color: #ffe070; }
#shieldBar { display: block; height: 2px; max-width: 100%; background: #8ac0ff; box-shadow: 0 1px 0 #3a6aa0; }
.shieldwrap { height: 3px; margin-bottom: -1px; }
.pick2 { gap: 10px; }
.cardpick { padding: 2px; background: #2a1e26; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #c9a03a; }
.cardpick img { width: 48px; height: 64px; image-rendering: pixelated; display: block; }
.cgrace { font-size: 6.5px; color: #c8b8a0; text-align: center; margin: 2px 0 1px; line-height: 1.3; }
.cgrace b { color: var(--gold); }

.mregion { background: #0c0610c8; border: 1px solid #3a2e3a; padding: 2px 4px; width: auto !important; max-width: 46%; font-size: 5.5px; line-height: 7px; }

.xpbar { display: flex; align-items: center; }
.xpbar em { flex: 1; line-height: 7px; }
.xpbar em { padding-top: 1px; }
.sfoot .btn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* settings */
.set-vol { display: grid; grid-template-columns: 34px 1fr 20px; align-items: center; gap: 4px; font-size: 7px; }
.set-vol b { text-align: right; color: var(--gold); font-weight: normal; }
.set-vol input { width: 100%; height: 8px; margin: 0; accent-color: var(--gold); }
.set-vol input:disabled { opacity: .4; }
.settings h3 { margin: 4px 0 0; }
.set-opt b { font-weight: normal; }

/* ---------------------------------------------------------------- PvP raids */
.raidbar { position: relative; z-index: 2; padding: 3px 4px 0; background: linear-gradient(#3a241800, #3a2418 30%); }
.rchests { display: flex; gap: 2px; justify-content: center; }
.rchest { position: relative; width: 26px; height: 22px; display: flex; align-items: center; justify-content: center; background: #6a2a14; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #b85a24; }
.rchest img { width: 20px; height: 18px; object-fit: contain; image-rendering: pixelated; }
.rchest.done { background: #2a6a24; box-shadow: inset 0 0 0 1px #5ec85a; }
.rchests.big .rchest { width: 32px; height: 28px; }
.rchests.big .rchest img { width: 28px; height: 25px; }
.rhint { text-align: center; font-size: 6.5px; color: #e8dcc6; margin: 2px 0; }
.rrow { display: flex; gap: 4px; }
.rrow .rleague { flex: 0 0 auto; display: flex; align-items: center; gap: 2px; padding: 1px 4px; }
.rrow .rleague img { width: 10px; height: 10px; image-rendering: pixelated; }
.rrow .rleague small { font-size: 5.5px; color: #d8c8b0; max-width: 44px; line-height: 1; }
.rrow .rgo { font-size: 10px; min-height: 20px; background: linear-gradient(#4ac840, #2a8a24); box-shadow: inset 0 1px 0 #9aff80, inset 0 -1px 0 #145a10; color: #fff; text-shadow: 1px 1px 0 #0a3a08; }
#pips .rprog { position: relative; width: 90px; height: 7px; margin: 1px auto 0; background: #2a2028; border: 1px solid var(--ink); }
#pips .rprog i { position: absolute; left: 0; top: 0; bottom: 0; background: #4ac840; }
#pips .rprog b { position: absolute; inset: 0; font-size: 5.5px; line-height: 7px; text-align: center; color: #fff; text-shadow: 1px 1px 0 var(--ink); font-weight: normal; }
#pips .rprog img { position: absolute; right: -10px; top: -2px; width: 8px; height: 8px; image-rendering: pixelated; }

#raidOv { left: 0; top: 0; right: 0; bottom: 0; display: none; z-index: 3; flex-direction: column; align-items: center; justify-content: center; text-align: center; touch-action: none; user-select: none; }
#raidOv.show { display: flex; }
#raidOv h2 { font-family: 'Press Start 2P', monospace; font-size: 8px; font-weight: normal; color: #fff; text-shadow: 1px 1px 0 var(--ink); margin: 0 0 6px; }
#raidOv .rbannerh { background: #c8182c; border: 1px solid var(--ink); box-shadow: inset 0 1px 0 #ff5a6a; padding: 4px 10px; }
#raidOv .row { width: 70%; }
/* matchmaking: opponent on red, you on blue */
#raidOv.rmatch { justify-content: stretch; background: #0c0610; }
.rhalf { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; }
.rhalf.red { background: repeating-linear-gradient(45deg, #c83a44 0 10px, #c2343e 10px 20px); }
.rhalf.blue { background: repeating-linear-gradient(45deg, #3a78b0 0 10px, #3672aa 10px 20px); }
.rbanner { position: absolute; left: 0; top: 50%; transform: translateY(-50%); background: #c8182c; border: 1px solid var(--ink); padding: 4px 12px; font-family: 'Press Start 2P', monospace; font-size: 7px; color: #fff; }
.rvs { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-family: 'Press Start 2P', monospace; font-size: 18px; color: #fff; text-shadow: 2px 2px 0 var(--ink); animation: pop .3s steps(4); }
.rsearch { display: flex; align-items: center; gap: 4px; color: #ffe0e0; font-size: 8px; opacity: .8; }
.rspin { width: 10px; height: 10px; border: 2px solid #ffe0e0; border-top-color: transparent; border-radius: 50%; animation: rspin .8s steps(8) infinite; }
@keyframes rspin { to { transform: rotate(360deg); } }
.rcard { position: relative; width: 150px; padding-top: 34px; animation: pop .25s steps(4); }
.rfig { position: absolute; left: 0; right: 0; top: -30px; height: 66px; display: flex; justify-content: center; pointer-events: none; }
.rfig .rhero { height: 66px; image-rendering: pixelated; filter: drop-shadow(0 1px 0 #0c0610); }
.rpow { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); display: flex; gap: 1px; align-items: center; font-size: 7px; color: #fff; text-shadow: 1px 1px 0 var(--ink); }
.rpow img { width: 9px; height: 9px; image-rendering: pixelated; }
.rcard .rname, .rcard .rstat { position: relative; z-index: 1; }
.rside.foe .rcard { background: #d0404a; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #6a3a20; }
.rside.me .rcard { background: #3a6aa0; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #6a3a20; }
.rcard .rname { font-size: 8px; color: #fff; text-shadow: 1px 1px 0 var(--ink); background: #0c061060; padding: 1px 0; }
.rside.foe .rname { color: #ffd0d0; }
.rstat { display: flex; justify-content: space-between; padding: 3px 8px; font-size: 7px; color: #fff; }
.rstat span { display: flex; align-items: center; gap: 2px; }
.rstat img { width: 9px; height: 9px; image-rendering: pixelated; }
/* powerup and spare-or-kill choices */
#raidOv.rpick, #raidOv.rspare { background: #0c0610c8; }
.rchoice { position: relative; display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; }
.ropt { flex: 1; max-width: 70px; display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; color: #fff; font: inherit; font-size: 8px; text-shadow: 1px 1px 0 var(--ink); }
.ropt img { width: 24px; height: 24px; image-rendering: pixelated; }
.ropt b { font-size: 10px; color: #fff; }
.ropt small { font-size: 6px; color: #d8c8b0; }
.ropt em { display: flex; align-items: center; gap: 2px; font-size: 7px; padding: 2px 3px; background: #1c1420; border: 1px solid var(--ink); }
.ropt em img { width: 12px; height: 12px; }
.ropt .rgold { color: var(--gold); }
.rthumb { font-size: 16px; }
.rswipe { width: 30px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 16px; color: #ffd040; background: #e8a030; border: 1px solid var(--ink); box-shadow: inset 0 1px 0 #ffe080; transition: transform .2s; animation: rwob 1.4s ease-in-out infinite; }
@keyframes rwob { 0%, 100% { margin-left: -4px; } 50% { margin-left: 4px; } }
.rarrow { font-size: 14px; color: #8a8a70; }
.rfoot { margin-top: 10px; font-size: 7px; color: #e8dcc6; }
.rnick { font-size: 9px; margin: 2px 0; text-shadow: 1px 1px 0 var(--ink); }
.rbeaten, .rhappy { height: 80px; image-rendering: pixelated; margin-bottom: 4px; }
.rbeaten { filter: grayscale(.3); transform: translateY(8px) scaleY(.88); }
#raidOv.rverdict { background: radial-gradient(circle, #2a2a2a, #000 70%); }
.rv p { font-size: 7.5px; margin-top: 6px; color: #e8dcc6; }
.rvicon { font-size: 28px; margin-bottom: 4px; animation: pop .3s steps(4); }
/* chest and rewards */
#raidOv.rchestov { background: #0c0610e0; }
.rpanel { background: #e8d8b8; color: #1a1016; border: 1px solid var(--ink); padding: 6px; width: 92%; }
.rpanel p { font-size: 8px; margin: 0 0 4px; }
.rreward { display: flex; gap: 6px; margin-bottom: 8px; }
.rcardr { width: 64px; padding: 5px 3px; display: flex; flex-direction: column; align-items: center; gap: 3px; background: #e8d8b8; color: #1a1016; border: 1px solid var(--ink); box-shadow: 0 0 12px #ffd04080; animation: pop .3s steps(4); }
.rcardr img { width: 24px; height: 24px; image-rendering: pixelated; }
.rcardr .rbig { font-size: 12px; }
.rcardr small { font-size: 6px; }
/* league table */
#raidOv.rleagueov { background: #20140e; justify-content: flex-start; padding: 4px; }
.lhead { display: flex; justify-content: space-between; width: 100%; padding: 3px 5px; background: #3a2418; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #8a6040; font-size: 7px; }
.lhead div { display: flex; align-items: center; gap: 3px; }
.lhead img { width: 12px; height: 12px; image-rendering: pixelated; }
.llist { flex: 1; width: 100%; overflow-y: auto; margin: 3px 0; scrollbar-width: none; scroll-behavior: smooth; }
.llist::-webkit-scrollbar { display: none; }
.lrow { display: flex; align-items: center; gap: 3px; margin: 2px 0; padding: 1px 4px; background: #e8d8b8; color: #1a1016; border: 1px solid var(--ink); font-size: 7.5px; text-align: left; }
.lrow.me { background: #f0d860; }
.lrow.me.up { animation: pop .4s steps(4); }
.lrank { width: 16px; height: 16px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: #5a3a2a; color: #f0e0c0; font-size: 6px; }
.lava { width: 16px; height: 16px; flex: none; }
.lnick { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lcup { width: 9px; height: 9px; image-rendering: pixelated; }
.lrow b { width: 16px; text-align: right; color: #7a5a10; }
.lnote { font-size: 6px; color: #d8c8b0; margin-bottom: 3px; }
img.icup { width: 9px; height: 9px; image-rendering: pixelated; vertical-align: middle; }

/* ------------------------------------------------------------- pixel icons */
img.pxi { image-rendering: pixelated; vertical-align: middle; display: inline-block; }
.rchest .rcheck { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(1.4); }
.lockbig .pxi { filter: grayscale(1); }
.btn .pxi { margin: 0 1px; }

/* ------------------------------------------------------------- my castle */
.castle-map-pin { position: absolute; left: 70%; top: 84%; transform: translate(-50%, -50%); background: none; border: 0; padding: 0; width: 36px; height: 38px; cursor: pointer; }
.castle-map-pin img { width: 34px; height: 34px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(1px 2px 1px #000); }
.castle-map-pin .pxi { filter: drop-shadow(1px 2px 1px #000); }
.castle-map-pin span { position: absolute; left: 50%; top: 31px; transform: translateX(-50%); white-space: nowrap; background: #0d1b27d9; color: #ffdd87; font-size: 6px; padding: 1px 2px; }
.castle-map-pin .cbadge { position: absolute; right: -4px; top: -3px; min-width: 9px; height: 9px; border-radius: 5px; background: #d0303a; color: #fff; font-size: 6px; line-height: 9px; font-weight: normal; border: 1px solid var(--ink); }
.castle-map-pin .quest-mark { display: flex; width: 11px; height: 14px; margin: 2px auto 0; align-items: center; justify-content: center; color: #26140a; background: #e8ba3f; border: 1px solid #1a1016; box-shadow: inset 0 0 0 1px #fff1a0, 1px 2px 0 #0009; font: 9px 'Press Start 2P', monospace; animation: pulse .9s steps(2) infinite; }
.castle-news-icon { display: block; width: 30px; height: 30px; object-fit: contain; image-rendering: pixelated; margin: 0 auto 6px; filter: drop-shadow(1px 2px 1px #000); }
#screen.castle { background: #1a1016; }
#screen.castle .tabs { position: relative; z-index: 2; }
.cbody { flex: 1; overflow-y: auto; padding: 3px 4px 8px; scrollbar-width: none; }
.cbody::-webkit-scrollbar { display: none; }
.cbody h3 { font-size: 8px; margin: 6px 0 3px; color: #d8c8b0; border-bottom: 1px solid #3a2e34; }
.csum { text-align: center; font-size: 8px; margin: 2px 0; }
.chint { font-size: 6.5px; line-height: 1.3; margin: 2px 0 4px; }
.grow, .hrow, .frow, .lgrow { display: flex; align-items: center; gap: 4px; margin: 2px 0; padding: 2px 3px; background: #2a1e26; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #4a3a3a; }
.grow.duty { box-shadow: inset 0 0 0 1px #5a8a4a; }
.grow.rest { opacity: .7; }
.gimg { width: 26px; height: 30px; object-fit: contain; image-rendering: pixelated; flex: none; }
.ginfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ginfo b { font-size: 7.5px; font-weight: normal; color: #f0e0c0; }
.ginfo small { font-size: 6px; color: #b8a8a0; }
.gst, .gen { display: flex; align-items: center; gap: 2px; font-size: 6.5px; }
.ebar { position: relative; flex: 1; max-width: 60px; height: 4px; background: #140c10; border: 1px solid var(--ink); }
.ebar i { position: absolute; left: 0; top: 0; bottom: 0; background: #e8c052; }
.ebar i.low { background: #d0303a; }
.gact { display: flex; flex-direction: column; gap: 1px; flex: none; }
.gact .btn { min-height: 12px; font-size: 6.5px; padding: 1px 3px; }
.htiers { display: flex; gap: 2px; margin-top: 2px; }
.htiers .btn { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 1px 2px; min-height: 0; }
.htiers .btn span { font-size: 6px; }
.htiers .btn small { font-size: 5.5px; color: #d8c8b0; display: flex; align-items: center; gap: 1px; }
.htiers .btn em { font-size: 6px; color: var(--gold); }
.htiers .btn.gold small, .htiers .btn.gold em { color: #fff4d0; }
.frow .btn { flex: none; font-size: 6.5px; min-height: 18px; }
.frow .btn em { color: var(--gold); }
.frow .btn.gold em { color: #fff4d0; }
.lgrow.won { box-shadow: inset 0 0 0 1px #5a8a4a; }
.lgrow.lost { box-shadow: inset 0 0 0 1px #8a3a3a; }

/* ------------------------------------------------------ castle scene & graffiti */
.cscene { position: relative; width: 100%; flex: none; overflow: hidden; }
.cscene canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; image-rendering: pixelated; }
#cPaint { pointer-events: none; }
#cPaint.wiping { pointer-events: auto; cursor: grab; touch-action: none; z-index: 2; }
#cHot { position: absolute; inset: 0; }
.chot { position: absolute; background: none; border: 0; padding: 0; }
.chot:active { background: #ffd04018; }
.chot span { position: absolute; left: 50%; top: -3px; transform: translateX(-50%); white-space: nowrap; font-size: 6.5px; color: #f0d890; background: #140a14e0; border: 1px solid #5a3a3a; box-shadow: inset 0 0 0 1px #2a1418; padding: 1px 3px; text-shadow: 1px 1px 0 var(--ink); pointer-events: none; }
.cwipe { position: absolute; left: 6px; right: 6px; top: 6px; display: flex; align-items: center; gap: 4px; padding: 3px 5px; font-size: 7px; color: #ffd0d0; background: #2a0810e8; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #8a1a28; pointer-events: none; }
.csheet { position: absolute; left: 3px; right: 3px; bottom: 3px; max-height: 64%; display: flex; flex-direction: column; background: #1a1016f4; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #5a3a3a, 0 -4px 12px #000a; z-index: 3; animation: pop .18s steps(3); }
.csh { display: flex; align-items: center; justify-content: space-between; padding: 3px 5px; background: #2a1418; border-bottom: 1px solid var(--ink); }
.csh b { font-family: 'Press Start 2P', monospace; font-size: 7px; font-weight: normal; color: var(--gold); }
.csh .btn { flex: none; }
.csheet .tabs { margin: 3px 4px 0; }
.csheet .cbody { flex: 1; min-height: 0; }
#raidOv.rvandal { justify-content: flex-start; background: #06030a; }
.vhead { width: 100%; padding: 4px 6px 3px; font-size: 8px; color: #ffd0d0; background: #2a0810; border-bottom: 1px solid var(--ink); text-shadow: 1px 1px 0 var(--ink); }
.vtime { display: block; height: 4px; margin-top: 3px; background: #140a10; border: 1px solid var(--ink); }
.vtime i { display: block; height: 100%; width: 100%; background: #d0303a; }
.rvandal .vpaint { touch-action: none; cursor: crosshair; }
/* quest journal */
.quest { border: 1px solid #4a3a44; background: #1a121c; padding: 4px 5px; margin: 4px 0; font-size: 7px; }
.quest h3 { margin: 0 0 3px; font-size: 8px; font-weight: normal; color: #ffd040; }
.quest.ready h3 { color: #58e858; }
.quest p { margin: 3px 0; }
.quest .qprog b { color: #ffd040; }
.quest.ready .qprog b, .quest .qready { color: #58e858; }
.quest .qgold { color: #e7bf66; }

/* ---- unique quests: the Toothed Shore pin, the Codex, Adriel */
.kingdom-art .map-region-pin.shore-map-pin { left: 3%; top: 72%; transform: translate(0, -50%); white-space: nowrap; border-color: #7ac8d0; }
.codex-tabs { margin-top: 2px; }
.codex-entry { border: 1px solid #4a3a44; background: #1a121c; padding: 4px 6px; margin: 4px 0; font-size: 7px; line-height: 1.45; }
.codex-entry h3 { margin: 0 0 3px; font-size: 9px; font-weight: normal; color: #ffd040; }
.codex-entry.locked h3 { color: #6a5e66; }
.codex-cat { font-size: 6px; color: #9ee0e8; text-transform: uppercase; letter-spacing: 1px; }
.lutebig { text-align: center; }
.lutebig img { width: 80px; height: 80px; image-rendering: pixelated; filter: drop-shadow(0 0 6px #ffd07088); }
.gcharm { display: block; color: #ff9ad8; font-size: 6px; }
.vnopt.dim { opacity: .6; }


/* Volodya's quest: the quest item badge and the chest */
.qitem { position: relative; display: inline-block; width: 26px; height: 26px; flex: none; }
.qitem img { width: 26px; height: 26px; image-rendering: pixelated; background: #0a1520; border: 1px solid #58b4ff; }
.qitem i { position: absolute; right: -3px; top: -3px; width: 9px; height: 9px; line-height: 9px; text-align: center; font: 7px 'Press Start 2P', monospace; font-style: normal; color: #0c0610; background: #58b4ff; border: 1px solid #0c0610; }
.ipic .qitem, .ipic .qitem img { width: 36px; height: 36px; }
.qline { display: flex; gap: 5px; align-items: center; }
.newgear.qnew { background: linear-gradient(#2a6ab0, #16406a); box-shadow: inset 0 1px 0 #8ac8ff; }
.vchest { display: block; margin: 6px auto; padding: 0; background: none; border: 0; cursor: pointer; }
.vchest img { width: 96px; height: 96px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 0 6px #ffd04088); }
button.vchest img { animation: vshake 1.2s steps(2) infinite; }
@keyframes vshake { 0%, 70% { transform: none; } 75% { transform: rotate(-4deg); } 85% { transform: rotate(4deg); } 95% { transform: rotate(-2deg); } }
.vchest.open img { width: 110px; height: 110px; filter: drop-shadow(0 0 10px #ffd040); }
.vloot { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 3px 0; font-size: 8px; }
.vloot img { width: 18px; height: 18px; image-rendering: pixelated; }
.vloot small { color: #98a8ac; font-size: 6.5px; }

.slot.qslot { box-shadow: inset 0 0 0 1px #58b4ff, 0 0 4px #58b4ff88; }
.slot .qmark { position: absolute; right: -2px; top: -2px; width: 8px; height: 9px; line-height: 9px; text-align: center; font: 7px 'Press Start 2P', monospace; font-style: normal; color: #0c0610; background: #58b4ff; border: 1px solid #0c0610; }

/* ---- prologue: cutscene captions, skip, the guided fight overlay (js/prologue.js) ---- */
#screen.prologue .pskip { position: absolute; top: 4px; right: 4px; z-index: 5; font-size: 6.5px; padding: 2px 5px; opacity: .75; }
.pcap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0 16px; pointer-events: auto; animation: pcapin .6s steps(6); transition: opacity .35s steps(4); }
.pcap span { font-size: 8.5px; line-height: 1.5; color: #efe0c4; text-align: center; font-style: italic; text-shadow: 1px 1px 0 var(--ink), -1px 0 0 var(--ink); }
.pcap.out { opacity: 0; }
@keyframes pcapin { from { opacity: 0; } }
#tut { left: 0; top: 0; right: 0; bottom: 0; display: none; z-index: 3; pointer-events: none !important; }
#tut.show { display: block; }
#tut .tspot { position: absolute; box-shadow: 0 0 0 999px rgba(6, 3, 10, .64); outline: 1px solid #ffd040; transition: left .15s, top .15s, width .15s, height .15s; }
#tut .thand { position: absolute; width: 14px; height: 14px; image-rendering: pixelated; transform: rotate(180deg); animation: tutdn .5s steps(2) infinite alternate; }
#tut .thand.up { transform: none; animation-name: tutup; }
#tut .ttext { position: absolute; left: 8px; right: 8px; font-size: 7.5px; line-height: 1.35; color: #ffe0a0; text-align: center; background: #140c14ee; border: 1px solid var(--ink); box-shadow: inset 0 0 0 1px #8a7040; padding: 4px; }
#tut.nudge .tspot { animation: tutno .3s steps(4); }
@keyframes tutdn { to { transform: rotate(180deg) translateY(-3px); } }
@keyframes tutup { to { transform: translateY(-3px); } }
@keyframes tutno { 25% { margin-left: -3px; } 75% { margin-left: 3px; } }
.quest.main { border-color: #b08aff; }
.castle-map-pin.ruins img { filter: grayscale(.8) brightness(.7) drop-shadow(1px 2px 1px #000); }
.castle-map-pin .cbadge.quest { background: #e8b830; color: #1a1016; }
.raidbar.locked .rhint { display: flex; align-items: center; justify-content: center; gap: 3px; padding: 4px 0; color: #a89aa0; }
#tut .tblk { position: absolute; pointer-events: auto; background: transparent; }

/* ---- unique decks (js/decks.js) ---- */
.ucard { display: inline-block; position: relative; line-height: 0; border: 1px solid var(--dc, #5a4a3a); box-shadow: 0 0 0 1px #0c0610, 0 0 4px var(--dc, transparent); animation: ucglow 1.6s steps(6) infinite alternate; }
.ucard img { width: 24px; height: 32px; image-rendering: pixelated; }
.ucard.big img { width: 72px; height: 96px; }
.ucard.big { display: block; width: max-content; margin: 6px auto; }
.ucard.miss { --dc: #3a3040; width: 24px; height: 32px; background: #140c14; animation: none; box-shadow: none; }
.ucard.miss i { display: block; line-height: 32px; text-align: center; font-style: normal; color: #5a4a5a; font-size: 9px; }
@keyframes ucglow { from { box-shadow: 0 0 0 1px #0c0610, 0 0 1px var(--dc); } to { box-shadow: 0 0 0 1px #0c0610, 0 0 6px var(--dc); } }
.slots.ucslots .slot.ucslot { width: 30px; height: 38px; padding: 2px; }
.slots.ucslots .slot.ucslot .ucard { animation-duration: 1.2s; }
.ucpick { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.ucbtn { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; padding: 2px; color: #e8dcc0; font-size: 6px; }
.ucrow { border: 1px solid var(--dc); box-shadow: inset 0 0 0 1px #0c0610; background: #140c14cc; padding: 4px; margin: 4px 0; }
.ucrow p { font-size: 7px; margin: 2px 0; }
.uchead { display: flex; justify-content: space-between; font-size: 7.5px; }
.uchead b { color: var(--dc); }
.uccards { display: flex; gap: 3px; margin: 3px 0; }
#deckTest { left: 2px; right: 2px; display: flex; gap: 2px; justify-content: center; z-index: 2; }
#deckTest button { width: 18px; height: 16px; padding: 0; background: #140c14e6; border: 1px solid var(--dc, #5a4a3a); line-height: 0; }
#deckTest button.on { background: var(--dc); }
#deckTest button img { width: 9px; height: 9px; image-rendering: pixelated; }
#deckTest .dtx { --dc: #a03040; color: #ffb0b0; font-size: 8px; line-height: 14px; }

/* ---- unique decks: animated pixel art (js/deck-art.js) ---- */
.abox, .acard { display: inline-block; flex: none; image-rendering: pixelated; background-repeat: no-repeat; background-position: 0 0; }
.abox { width: calc(40px * var(--k)); height: calc(54px * var(--k)); background-size: calc(240px * var(--k)) 100%; animation: aboxf .72s steps(6) infinite; }
.acard { width: calc(24px * var(--k)); height: calc(32px * var(--k)); background-size: calc(96px * var(--k)) 100%; animation: acardf .62s steps(4) infinite; }
@keyframes aboxf { to { background-position: calc(-240px * var(--k)) 0; } }
@keyframes acardf { to { background-position: calc(-96px * var(--k)) 0; } }
.abox.empty { --k: 1; background: #140c14; border: 1px dashed #4a3a4a; animation: none; }
.amini { width: 12px; height: 16px; image-rendering: pixelated; opacity: .45; }
.amini.own { opacity: 1; }
.ucshow { display: flex; justify-content: center; margin: 4px 0; }
.ushowcase { display: flex; gap: 3px; justify-content: center; margin: 3px 0; }
.ugrid { display: flex; flex-direction: column; gap: 1px; align-items: center; margin: 3px 0; }
.ugrow { display: flex; gap: 1px; }
.udeck { display: flex; gap: 6px; align-items: center; background: #140c14cc; border: 1px solid #3a2a3a; padding: 3px; }
.udeck-t { display: flex; flex-direction: column; gap: 2px; font-size: 7px; }
.udeck-t small { color: #a89aa0; }
.ushares { display: flex; gap: 2px; flex-wrap: wrap; }
.ushares .btn.small { padding: 1px 3px; font-size: 6.5px; min-width: 0; }
.udrow { display: flex; align-items: center; gap: 6px; width: 100%; background: #140c14cc; border: 1px solid #3a2a3a; padding: 3px; margin: 2px 0; color: #e8dcc0; text-align: left; }
.udrow.on { border-color: #ffd040; }
.udrow span { display: flex; flex-direction: column; gap: 2px; font-size: 7.5px; }
.udrow small { color: #a89aa0; font-size: 6.5px; }
.shopline .acard, .shopline .abox { margin-right: 2px; }
