/* 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); }

/* Equipment and Costume tabs over the paper doll (v0.84): the Costume tab shows the portrait with the costume slot under
   it; the equipment slots keep their room (hidden, not removed) so the doll doesn't jump between tabs */
.bag-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 2px 0 6px; }
.bag-tabs button {
  padding: 6px 0; border: 1px solid #000; border-radius: 4px; cursor: pointer;
  background: #0b0f0c; box-shadow: inset 0 0 0 1px var(--edge);
  color: var(--ink-dim); font: 700 13px/1 var(--f-display); letter-spacing: 0.08em; text-transform: uppercase;
}
.bag-tabs button.is-on { color: #1b140f; background: linear-gradient(#f3d68a, #c99d45); box-shadow: none; }
.bag-tabs button:focus-visible { outline: 2px solid #f3d68a; outline-offset: 2px; }
.bag-doll[data-tab="costume"] .doll-left, .bag-doll[data-tab="costume"] .doll-right { visibility: hidden; }
.bag-doll[data-tab="costume"] .doll-slot[data-slot="glove"], .bag-doll[data-tab="gear"] .doll-slot[data-slot="costume"] { display: none; }
.bag-doll[data-tab="costume"] { background: radial-gradient(ellipse 50% 60% at 50% 55%, rgba(122, 108, 255, 0.24), transparent 70%); }

.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)); }
/* the middle column: the portrait with the glove slot under it (v0.72) */
.doll-mid { justify-items: center; gap: 0; }
.doll-mid .doll-portrait { height: 128px; width: 128px; margin-top: -6px; }

.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; }

/* the free shot's pick (v1.96, ui/bag-shot.js): which spell the free attack shoots, a tap to change it (phones have no R) */
.bag-shot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--edge); }
.bag-shot[hidden] { display: none; }
.bs-label { margin-right: 2px; color: var(--ink-dim); font: 700 12px/1 var(--f-display); letter-spacing: 0.08em; text-transform: uppercase; }
.bs-pick {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 3px 10px 3px 3px; cursor: pointer;
  border: 1px solid #000; border-radius: 16px; background: #0b0f0c; box-shadow: inset 0 0 0 1px var(--edge);
  color: var(--ink-dim); font: 600 12.5px/1 var(--f-body);
}
.bs-pick img { width: 26px; height: 26px; border-radius: 50%; pointer-events: none; opacity: 0.7; }
.bs-pick:hover { color: var(--ink); box-shadow: inset 0 0 0 1px #f3d68a; }
.bs-pick.is-on { color: #1b140f; background: linear-gradient(#f3d68a, #c99d45); box-shadow: none; cursor: default; }
.bs-pick.is-on img { opacity: 1; }
.bs-pick:focus-visible { outline: 2px solid #f3d68a; outline-offset: 2px; }

.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-name: #ffffff; }
.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-name);
  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-heal.heal-mend { font-size: 24px; color: #6dff9a; }                  /* Thornshell mending (v0.78) */
.dmg-heal.heal-mend.heal-big { font-size: 30px; }
.dmg-note.note-quake { color: #e8c27a; }                                  /* thrown by her Earthquake */
.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, .doll-mid .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; }
}
.bag-lines .ln-gm span, .bag-lines .ln-gm em { color: #e7a6ff; }   /* stats a GM command put on a piece (v0.55) */
.bag-lines .ln-special span, .bag-lines .ln-special em { color: #ffbf7a; }   /* a wand's special stats, rolled per drop (v0.59) */
.bag-lines .ln-owner span { color: #c9b8ff; font-weight: 700; }   /* whose costume it is (v0.84: "Game master: Ping Chi") */
.bag-lines .ln-look span { color: var(--ink-dim); font-style: italic; }   /* a costume: looks only */
/* v1.90: set and rare pieces (data/items-tiers.js): set green, rare yellow [P]; a rim drawn over the picture */
.bag-cell[data-tier="set"]::before, .bag-cell[data-tier="rare"]::before,
.doll-slot[data-tier="set"] .cell::before, .doll-slot[data-tier="rare"] .cell::before {
  content: ''; position: absolute; inset: 0; z-index: 1; border-radius: 4px; pointer-events: none;
  box-shadow: inset 0 0 0 2px var(--tier);
}
.bag-cell[data-tier="set"], .doll-slot[data-tier="set"] { --tier: #5fe36f; }
.bag-cell[data-tier="rare"], .doll-slot[data-tier="rare"] { --tier: #ffe14a; }
.bag-lines .ln-tier span { font: 700 12px/1.2 var(--f-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); }
.bag-lines .ln-unique span, .bag-lines .ln-unique em { color: #ffe14a; }   /* a rare piece's unique stat */
.bag-lines .ln-set span, .bag-lines .ln-set em { color: #5fe36f; }          /* a set line that counts: worn with enough of its set */
.bag-lines .ln-setOff span, .bag-lines .ln-setOff em { color: #6f8a72; font-weight: 500; }   /* one that doesn't yet */
.bag-lines .ln-setName span { color: #5fe36f; padding-top: 4px; }
.bag-lines .ln-setPiece, .bag-lines .ln-setPieceOff { border-bottom: none; padding: 0 0 0 12px; }
.bag-lines .ln-setPiece span { color: #5fe36f; font-weight: 500; font-size: 13px; }
.bag-lines .ln-setPieceOff span { color: #6f8a72; font-weight: 500; font-size: 13px; }

/* ---- the Inspect window (v0.59): right-click an item, its picture left, its details right ------------ */
#inspect {
  top: 12px; left: 50%; transform: translateX(-50%); z-index: 6;
  width: min(540px, calc(100% - 24px));
  max-height: calc(100% - 100px);
  overflow-y: auto;
  padding: 10px 14px 14px;
}
/* beside the Bag or the Shop (both on the right), where there is room for it */
body.bag-open #inspect, body.shop-open #inspect { left: auto; transform: none; right: calc(min(424px, 100% - 24px) + 24px); }
@media (max-width: 1060px) {
  body.bag-open #inspect, body.shop-open #inspect { right: auto; left: 50%; transform: translateX(-50%); }
}
#inspect header { align-items: center; }
.insp-body { display: grid; grid-template-columns: 168px 1fr; gap: 16px; align-items: start; }
.insp-pic { margin: 0; display: grid; gap: 6px; justify-items: center; }
.insp-pic canvas {
  width: 168px; height: 168px; display: block;
  border: 2px solid var(--grade, #7a6a45); border-radius: 8px;
  background: radial-gradient(circle at 50% 44%, color-mix(in srgb, var(--grade, #7a6a45) 24%, #1d2620) 0%, #0a0e0b 74%);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.55), 0 0 14px color-mix(in srgb, var(--grade, #7a6a45) 22%, transparent);
}
.insp-pic figcaption {
  font: 700 12px/1 var(--f-display); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--grade, var(--ink-dim));
  padding: 4px 10px; border: 1px solid color-mix(in srgb, var(--grade, #7a6a45) 55%, transparent); border-radius: 999px;
}
.insp-info { display: grid; gap: 8px; min-width: 0; }
.insp-info h3 { margin: 0; font: 700 22px/1.05 var(--f-display); letter-spacing: 0.03em; }
.insp-info h3 small { font: 400 15px/1 var(--f-num); color: var(--ink-dim); }
.insp-kind { margin: -4px 0 0; font-size: 13px; color: var(--ink-dim); }
.insp-lines li { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; align-items: baseline; }
.insp-roll { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 1px; }
.insp-meter {
  display: inline-block; width: 72px; height: 5px;
  background: #080b09; border: 1px solid rgba(0, 0, 0, 0.7); border-radius: 3px; overflow: hidden;
}
.insp-meter b { display: block; height: 100%; }
.insp-info .sk-blurb { font-size: 13.5px; font-style: italic; }
.insp-foot { margin: 0; padding-top: 8px; border-top: 1px solid var(--edge); display: grid; gap: 4px; font-size: 13px; }
.insp-foot div { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: baseline; }
.insp-foot dt { font: 700 11px/1 var(--f-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.insp-foot dd { margin: 0; color: var(--ink-dim); }
@media (max-width: 520px) {
  .insp-body { grid-template-columns: 1fr; justify-items: center; }
  .insp-info { width: 100%; }
}
