html, body { margin: 0; height: 100%; overflow: hidden; background: radial-gradient(ellipse at 50% 35%, #2a3140 0%, #12151c 70%, #0b0d12 100%); font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: #d8dde6; }
canvas { display: block; }
#fade { position: absolute; inset: 0; background: #0b0d12; opacity: 1; pointer-events: none; transition: opacity .35s; }
#flash { position: absolute; inset: 0; background: #ff3b1f; opacity: 0; pointer-events: none; transition: opacity .4s; }
#minimap { position: absolute; top: 14px; right: 16px; pointer-events: none; image-rendering: pixelated; }
#loading { position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px;
  color: #e6e9ef; font-size: 12px; letter-spacing: 1px; background: #0b0d12cc; border: 1px solid #444c5c; border-radius: 4px;
  padding: 6px 12px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 10; }
#loading.on { opacity: 1; }
#loading span { width: 12px; height: 12px; border: 2px solid #5fd3ff55; border-top-color: #5fd3ff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

[hidden] { display: none !important; }
kbd { display: inline-block; min-width: 1.2em; text-align: center; background: #2a2f3a; border: 1px solid #444c5c; border-radius: 3px; padding: 0 4px; color: #e6e9ef; font: inherit; }

#dev { position: absolute; top: 8px; left: 8px; z-index: 5; max-width: min(640px, calc(100vw - 260px)); padding: 4px 7px;
  font-size: 10px; line-height: 1.45; color: #aab3c2; background: #0b0d1299; border-radius: 3px; user-select: text; }
#dev b { color: #fff; font-weight: normal; }
#dev .pick { user-select: all; cursor: text; }
#dev-status { color: #ffd27a; min-height: 1.45em; }
#dev-copy { font: inherit; color: #aab3c2; background: #2a2f3a; border: 1px solid #444c5c; border-radius: 2px; padding: 0 4px; cursor: pointer; }
#dev-copy:hover { color: #fff; }
#dev-spawn { margin-top: 2px; }
#dev-spawn :is(select, input, button) { font: inherit; color: #e6e9ef; background: #2a2f3a; border: 1px solid #444c5c; border-radius: 2px; padding: 0 3px; }
#dev-spawn input[type=number] { width: 3.6em; }
#dev-spawn button { color: #aab3c2; cursor: pointer; }
#dev-spawn button:hover { color: #fff; }
#dev-spawn label { white-space: nowrap; cursor: pointer; }
#dev-spawn input[type=checkbox] { vertical-align: middle; margin: 0 2px 0 4px; }

#help-overlay { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: 16px; pointer-events: none; }
#help-panel { pointer-events: auto; box-sizing: border-box; width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 16px 20px; background: #12161ee6; border: 1px solid #444c5c; border-radius: 8px; box-shadow: 0 16px 60px #0008; font-size: 12px; }
#help-panel header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; color: #8a96a8; font-size: 11px; }
#help-panel h1 { margin: 0 0 10px; color: #fff; font-size: 15px; letter-spacing: 3px; }
#help-panel h2 { margin: 14px 0 6px; color: #c5cdbc; font-size: 12px; }
#help-panel .keys { display: grid; grid-template-columns: 9.5em 1fr; gap: 5px 14px; margin: 0; }
#help-panel dt { color: #e6e9ef; white-space: nowrap; }
#help-panel dd { margin: 0; color: #aab3c2; }
#legend { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; color: #aab3c2; }
#legend div { display: flex; align-items: center; gap: 6px; }
#legend i { display: inline-block; width: 11px; height: 11px; border: 1px solid #0006; }
#inventory-overlay { position: fixed; inset: 0; z-index: 20; background: #080c13b8; display: grid; place-items: center; padding: 16px 16px 84px; }
#inventory-panel { box-sizing: border-box; width: min(760px, 100%); max-height: calc(100dvh - 100px); overflow: auto; padding: 22px;
  background: #202631; border: 1px solid #68715e; border-radius: 8px; box-shadow: 0 16px 80px #0009; }
#inventory-panel header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#inventory-panel h1 { margin: 0 0 5px; color: #ffe4ae; font-size: 22px; letter-spacing: 2px; }
#inventory-panel h2 { font-size: 13px; margin: 12px 0 8px; color: #c5cdbc; }
#inventory-panel button, #inventory-panel select { font: inherit; color: #e7dfcf; background: #343d46; border: 1px solid #69746d; border-radius: 4px; padding: 7px 10px; cursor: pointer; }
#inventory-panel button:hover:not(:disabled) { background: #465249; }
#inventory-panel button:focus-visible, #inventory-panel select:focus-visible { outline: 2px solid #ffcf7a; outline-offset: 2px; }
#inventory-panel button:disabled { opacity: .5; cursor: default; }
#inventory-equipped { margin-top: 12px; color: #ffcf7a; }
#inventory-currency { display: flex; gap: 12px; margin: 14px 0 6px; }
.coin-slot { flex: 1; display: flex; align-items: center; gap: 8px; background: #181e28; border: 1px solid #444e5e; padding: 4px 10px; border-radius: 4px; }
.coin-slot img { width: 42px; height: 42px; object-fit: contain; }
.coin-slot small { display: block; color: #a4b0ba; }
.inventory-body { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 18px; }
#inventory-panel.with-floor { width: min(1000px, 100%); }
#inventory-panel.with-floor .inventory-body { grid-template-columns: 230px minmax(0, 1fr) 210px; }
#inventory-floor, #inventory-shop { display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow-y: auto; }
#inventory-shop-title { color: #e6c35a !important; }
.floor-item .price { margin-left: auto; color: #e6c35a; font-size: 11px; flex: none; }
.floor-item.poor .price { color: #9a6a5a; }
#inventory-panel .floor-item { display: flex; align-items: center; gap: 8px; text-align: left; background: #181e28; padding: 3px 8px 3px 3px;
  border-color: var(--rarity, #444e5e); }
.floor-item img { width: 34px; height: 34px; object-fit: contain; flex: none; }
.floor-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#inventory-panel .floor-item.selected { box-shadow: inset 0 0 0 1px #ffcf7a, 0 0 0 1px #ffcf7a; }
.floor-empty { color: #8b95a3; font-size: 12px; }
#inventory-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
#inventory-panel .inventory-slot { aspect-ratio: 1; position: relative; background: #181e28; padding: 2px; min-width: 0; overflow: hidden;
  border-color: var(--rarity, #69746d); }
#inventory-panel .inventory-slot[style*="--rarity"] { background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--rarity) 22%, transparent), #181e28 70%); }
.inventory-slot img { width: 100%; height: 100%; object-fit: contain; display: block; }
.inventory-slot .count { position: absolute; right: 5px; bottom: 2px; color: #fff; text-shadow: 0 1px 3px #000; }
.inventory-slot .equipped { position: absolute; left: 4px; top: 2px; color: #ffcf7a; font-size: 10px; }
.inventory-slot .bar-key { position: absolute; right: 4px; top: 2px; color: #b98cff; font-size: 10px; text-shadow: 0 1px 2px #000; }
#inventory-panel .inventory-slot.selected { box-shadow: inset 0 0 0 2px #ffcf7a; }
#inventory-details { padding: 6px 12px; background: #181e28; border-radius: 4px; }
#inventory-item-icon { width: 100%; height: 120px; object-fit: contain; }
#inventory-item-stats { color: #b8c2d0; white-space: pre-line; font-size: 12px; margin: 6px 0; }
#inventory-item-name { margin-bottom: 2px !important; }
#inventory-item-base { color: #8f9aaa; font-size: 12px; }
#inventory-item-affixes { margin: 4px 0; padding: 0; list-style: none; color: #8fb6ff; font-size: 12px; }
#inventory-item-compare { font-size: 12px; color: #9ea9b6; white-space: pre-line; margin: 6px 0; }
#inventory-item-compare .up { color: #7fd87a; } #inventory-item-compare .down { color: #ff7a6a; }
.inventory-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
#inventory-dev input { font: inherit; width: 4em; color: #e7dfcf; background: #343d46; border: 1px solid #69746d; border-radius: 4px; padding: 6px; }
#loot-labels { position: fixed; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.loot-label { position: absolute; left: 0; top: 0; pointer-events: auto; font: 12px/1.25 monospace; padding: 2px 6px; white-space: nowrap;
  background: #0b0e14d0; border: 1px solid #ffffff22; border-radius: 3px; cursor: pointer; text-shadow: 0 1px 2px #000; }
.loot-label.hovered { background: #1d2532f0; border-color: currentColor; }
.loot-label[data-rarity="legendary"], .loot-label[data-rarity="mythic"], .loot-label[data-rarity="ancient"] { font-weight: bold; }
#inventory-dev { margin: 18px 0 0; border: 1px solid #555c50; border-radius: 4px; }
#inventory-dev legend { color: #ffcf7a; }
#inventory-dev p, #inventory-panel footer { font-size: 11px; color: #9ea9b6; }
#inventory-feedback { min-height: 18px; color: #ffcf7a; }
@media (max-width: 540px) {
  #inventory-panel { padding: 12px; }
  .inventory-body, #inventory-panel.with-floor .inventory-body { grid-template-columns: 1fr; }
  #inventory-details { display: grid; grid-template-columns: 60px 1fr; column-gap: 10px; }
  #inventory-item-icon { grid-row: 1 / 4; height: 70px; }
  #inventory-details h2, #inventory-details p { margin: 4px 0; }
  #inventory-currency { gap: 4px; }
  .coin-slot { padding: 3px; gap: 3px; }
  .coin-slot img { width: 28px; height: 28px; }
}

/* quick bar (game/quickbar.js): above the inventory's dimmed backdrop, so items can be assigned */
#quickbar { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 21; display: flex; gap: 6px;
  padding: 6px; background: #0b0d12b3; border: 1px solid #444c5c; border-radius: 6px; }
#quickbar.assigning { border-color: #ffcf7a; }
#quickbar .qb-slot { position: relative; width: 50px; height: 50px; padding: 3px; overflow: hidden; cursor: pointer;
  background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--rarity, transparent) 22%, transparent), #181e28 70%);
  border: 1px solid #3a4352; border-radius: 4px; }
#quickbar .qb-slot:hover { border-color: #8a96a8; }
#quickbar .qb-slot.equipped { box-shadow: inset 0 0 0 2px #ffcf7a; }
#quickbar .qb-slot.none-left img { filter: grayscale(1); opacity: .35; }
#quickbar .qb-slot img { width: 100%; height: 100%; object-fit: contain; display: block; position: relative; }
#quickbar .qb-key { position: absolute; left: 4px; top: 1px; color: #e6e9ef; font-size: 10px; text-shadow: 0 1px 2px #000; }
#quickbar .qb-count { position: absolute; right: 4px; bottom: 1px; color: #fff; font-size: 11px; text-shadow: 0 1px 3px #000; }
#quickbar .qb-cast { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: #b98cff59; pointer-events: none; }
#quickbar .qb-slot.casting { border-color: #b98cff; }
#quickbar .qb-slot.cooling .qb-cast { background: #10141c99; }
#quickbar .qb-slot.in-hand { box-shadow: inset 0 0 0 2px #ffcf7a, 0 0 8px #ffcf7a88; }

/* potions at work and poison (game/effects.js): little icons with the time left, over the quick bar */
#effects { position: fixed; left: 50%; bottom: 78px; transform: translateX(-50%); z-index: 19; display: flex; gap: 5px; pointer-events: none; }
#effects .fx { position: relative; width: 30px; height: 30px; padding: 2px; background: #0b0d12cc; border: 1px solid #5a6475; border-radius: 4px; overflow: hidden; }
#effects .fx img { width: 100%; height: 100%; object-fit: contain; display: block; position: relative; }
#effects .fx .left { position: absolute; left: 0; right: 0; bottom: -1px; text-align: center; color: #fff; font: 10px/1.2 monospace; text-shadow: 0 1px 2px #000; }
#effects .fx .bar { position: absolute; left: 0; bottom: 0; height: 2px; background: #ffcf7a; }
#effects .fx.status { border-color: #8fdc3c; width: auto; padding: 2px 6px; color: #b8f080; font: 11px/26px monospace; }
#effects .fx.ending { animation: fx-blink .5s steps(2) infinite; }
@keyframes fx-blink { 50% { opacity: .45; } }
