/* Dark Mage of Mossfen — items (v0.14): the Bag window, potions on the hotbar, loot labels.
   Same look as style.css: moss-black glass, tarnished brass, bone-coloured type. A piece's
   grade colour (--grade) rims its cell: Worn grey, Fine bone, Superb blue, Perfect gold. */

/* ---- the Bag window -------------------------------------------------------- */
#bag {
  top: 12px; right: 12px; z-index: 5;
  width: min(424px, calc(100% - 24px));
  max-height: calc(100% - 100px);
  overflow-y: auto;
  padding: 10px 14px 12px;
}
#bag header { align-items: center; }
.bag-count { margin-left: auto; font: 600 13px/1 var(--f-display); letter-spacing: 0.05em; color: var(--ink-dim); }
.bag-count b { color: var(--ink); font: 400 14px/1 var(--f-num); }

.bag-doll {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px;
  padding: 4px 6px 8px;
  background: radial-gradient(ellipse 50% 60% at 50% 55%, rgba(120, 90, 200, 0.16), transparent 70%);
}
.doll-col { display: grid; gap: 6px; }
.doll-slot {
  display: grid; justify-items: center; gap: 2px; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--ink-dim); font: 600 11px/1 var(--f-display); letter-spacing: 0.08em; text-transform: uppercase;
  touch-action: none;
}
.doll-slot .cell, .bag-cell {
  position: relative; display: block; overflow: hidden;
  background: #0b0f0c; border: 1px solid #000; border-radius: 4px;
  box-shadow: inset 0 0 0 2px var(--grade, #2c3530);
}
.doll-slot .cell { width: 48px; height: 48px; }
.doll-slot img, .bag-cell img { display: block; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; }
.doll-slot.is-empty .cell { box-shadow: inset 0 0 0 1px var(--edge); background: repeating-linear-gradient(135deg, #0b0f0c 0 6px, #101611 6px 12px); }
.doll-slot.is-empty img { display: none; }
.doll-slot:hover .cell, .bag-cell:hover { box-shadow: inset 0 0 0 2px #f3d68a; }
.doll-slot:focus-visible .cell, .bag-cell:focus-visible { outline: 2px solid #f3d68a; outline-offset: 2px; }
.doll-slot.is-selected .cell, .bag-cell.is-selected { outline: 2px solid var(--mix); outline-offset: 2px; }
.doll-slot.drop-hover .cell { outline: 2px solid var(--mix); box-shadow: 0 0 16px var(--mix); }
.doll-portrait { justify-self: center; width: 136px; height: 136px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5)); }

.bonus {
  position: absolute; right: 3px; top: 1px; font: 700 12px/1 var(--f-body); font-style: normal;
  color: #9be07a; text-shadow: 0 0 3px #000, 0 0 6px rgba(155, 224, 122, 0.8);
}

.bag-sum {
  display: flex; flex-wrap: wrap; gap: 4px 6px; padding: 7px 0 9px;
  border-top: 1px solid var(--edge); border-bottom: 1px solid var(--edge);
}
.bag-sum span {
  padding: 2px 7px; border-radius: 9px; background: #0b0f0c; border: 1px solid rgba(206, 184, 118, 0.2);
  font: 600 12.5px/1.3 var(--f-body); color: var(--ink); font-variant-numeric: tabular-nums;
}
.bag-sum .none { color: var(--ink-faint); border-style: dashed; }

.bag-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: 10px 0; }
.bag-grid.drop-hover { outline: 2px dashed var(--mix); outline-offset: 3px; border-radius: 4px; }
.bag-cell { aspect-ratio: 1; width: 100%; padding: 0; cursor: pointer; color: var(--ink); touch-action: none; }
.bag-cell.is-empty { cursor: default; box-shadow: none; background: #0a0e0b; opacity: 0.7; }
.bag-cell.is-empty img { display: none; }
.bag-cell.is-empty:hover { box-shadow: inset 0 0 0 1px var(--edge); }
.bag-cell .n {
  position: absolute; right: 2px; bottom: 1px; font: 400 12px/1 var(--f-num); color: #fff;
  text-shadow: 0 0 2px #000, 1px 1px 0 #000;
}
.bag-cell .key {
  position: absolute; left: 2px; top: 1px; text-decoration: none;
  font: 400 11px/1 var(--f-num); color: #ffe28a; text-shadow: 0 0 2px #000, 1px 1px 0 #000;
}

/* the detail panel under the grid */
.bag-detail { border-top: 1px solid var(--edge); padding-top: 10px; display: grid; gap: 8px; min-height: 96px; }
.bag-head { display: flex; align-items: center; gap: 10px; }
.bag-head img { width: 44px; height: 44px; border-radius: 4px; border: 2px solid var(--grade, #7a6a45); }
.bag-head strong { display: block; font: 700 18px/1.1 var(--f-display); letter-spacing: 0.03em; }
.bag-head span { font-size: 13px; color: var(--ink-dim); }
.bag-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 14px; }
.bag-lines li { display: flex; align-items: baseline; gap: 8px; padding: 2px 0; border-bottom: 1px solid rgba(206, 184, 118, 0.1); }
.bag-lines li span { font-weight: 700; font-variant-numeric: tabular-nums; }
.bag-lines small { color: var(--ink-faint); font-size: 12.5px; }
.bag-lines em { margin-left: auto; font: 700 11px/1 var(--f-display); letter-spacing: 0.08em; text-transform: uppercase; font-style: normal; color: var(--ink-faint); }
.bag-lines .ln-bonus span, .bag-lines .ln-bonus em { color: #9be07a; }
.bag-lines .ln-use span { font-weight: 500; }
.bag-compare { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.bag-compare small { flex-basis: 100%; color: var(--ink-faint); font-size: 12.5px; }
.bag-compare .up { color: #9be07a; font-weight: 700; }
.bag-compare .down { color: var(--danger); font-weight: 700; }
.bag-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.bag-actions .link-btn { padding: 6px 0; margin: 0; }
.bag-actions .sk-upgrade { padding: 8px 16px; }
.bag-detail .sk-blurb { font-size: 13px; }
.bag-empty-note { margin: 0; font-size: 13.5px; color: var(--ink-faint); }

/* binding a potion: the keys light up as drop targets while the bag is open */
body.bag-open .slot { outline: 1px dashed rgba(215, 168, 255, 0.55); outline-offset: 1px; }

/* ---- potions on the hotbar -------------------------------------------------- */
.slot.is-item .cost { color: #fff; font-size: 11px; }
.slot.is-item .tier { border-color: rgba(232, 82, 74, 0); }
.slot.is-out img { filter: grayscale(1) brightness(0.45); }
.slot.is-out .cost { color: var(--danger); }

/* ---- loot lying on the ground ----------------------------------------------- */
#scene.is-over-loot { cursor: pointer; }
.loot-label { position: absolute; left: 0; top: 0; width: 0; height: 0; --loot: #efe6cf; }
.loot-label b {
  position: absolute; left: 0; bottom: 0; transform: translateX(-50%); white-space: nowrap;
  padding: 1px 6px 2px; border-radius: 3px; background: rgba(8, 11, 9, 0.62);
  font: 700 13px/1.2 var(--f-body); color: var(--loot);
  text-shadow: 1px 0 0 #000, -1px 0 0 #000, 0 1px 0 #000, 0 -1px 0 #000;
}
.loot-label.is-rare b { box-shadow: 0 0 0 1px color-mix(in srgb, var(--loot) 55%, transparent), 0 0 10px color-mix(in srgb, var(--loot) 45%, transparent); }
.loot-label.is-hover b { background: rgba(8, 11, 9, 0.85); box-shadow: 0 0 0 1px #f3d68a; }

/* ---- floating text and log --------------------------------------------------- */
.dmg-heal { color: #9bff8a; }
.dmg-sp { color: #8fc8ff; font-size: 20px; }
#log .tone-rare { color: #ffc94a; font-weight: 700; }
.stats dd small { color: #9be07a; font-size: 11.5px; }

/* ---- small screens ------------------------------------------------------------ */
@media (max-width: 760px) {
  #bag { top: 12px; bottom: 84px; max-height: none; }
  .doll-portrait { width: 110px; height: 110px; }
  .doll-slot .cell { width: 44px; height: 44px; }
}
@media (max-width: 600px) {
  .bar-btn { min-width: 32px; padding: 0 2px; }
  .bar-btn span { font-size: 10px; }
  .slot { width: 31px; height: 31px; }
  .bag-grid { gap: 3px; }
}
@media (max-width: 400px) {
  .slot { width: 28px; height: 28px; }
  #hotbar { gap: 2px; padding: 3px; }
  .bar-btn kbd { display: none; }
}
