/* F11: the squares of the inventory (the screen itself is in inventory-screen.css),
   the GM's enchanting form and the loot windows over the board. */

.btn.btn-small, .btn-danger.btn-small { padding: 4px 9px; font-size: 0.82rem; }
.row.wrap { flex-wrap: wrap; gap: 6px; }

/* One square: an item, or an empty slot. */
.inv-cell {
  position: relative; width: 48px; height: 48px; padding: 8px; display: grid; place-items: center;
  background: rgba(14, 15, 19, 0.9); border: 1px solid var(--border); border-radius: 8px; color: var(--text);
}
.inv-cell .icon { width: 28px; height: 28px; }
.inv-cell:hover { border-color: var(--accent); }
.inv-cell.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(212, 162, 76, 0.35); }
.inv-cell.magic { border-color: #8e6fd1; box-shadow: inset 0 0 8px rgba(142, 111, 209, 0.45); }
.inv-cell.magic.active { border-color: var(--accent); }
.inv-cell.empty { border-style: dashed; background: rgba(14, 15, 19, 0.55); }
.inv-qty {
  position: absolute; right: 2px; bottom: 1px; font-size: 0.68rem; font-weight: 700; color: var(--text);
  text-shadow: 0 1px 2px #000, 0 0 2px #000;
}
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, 48px); gap: 6px; min-height: 56px; align-content: start; }
.inv-grid p { grid-column: 1 / -1; margin: 0; }

.inv-tip {
  position: absolute; z-index: 5; max-width: 260px; padding: 8px 10px; pointer-events: none;
  background: rgba(14, 15, 19, 0.98); border: 1px solid var(--accent); border-radius: 8px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.6);
}
.inv-tip strong { display: block; color: var(--accent); font-family: var(--font-title); margin-bottom: 4px; }
.inv-tip p { margin: 0 0 3px; font-size: 0.8rem; }
.inv-tip p:last-child { color: var(--muted); margin: 0; }

.enchant-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.enchant-form > * { min-width: 0; }
.enchant-form > summary { cursor: pointer; font-weight: 600; color: #b9a2ec; }
.enchant-form[open] > summary { margin-bottom: 4px; }
.enchant-form p { margin: 0; font-size: 0.8rem; }
.enchant-form .chip { max-width: 100%; text-align: left; white-space: normal; }
.enchant-form select, .enchant-form input[type='text']:not(.dice) { width: 100%; box-sizing: border-box; text-overflow: ellipsis; }
.enchant-form .row { gap: 6px; align-items: center; flex-wrap: wrap; }
.enchant-form .row > select { flex: 1 1 7em; width: auto; min-width: 0; }
.enchant-form .row > select:first-child { flex-basis: 100%; }
.enchant-form input.dice { width: 5.5em; flex: 0 0 auto; min-width: 0; }
.enchant-form input.num { width: 4.5em; flex: 0 0 auto; min-width: 0; }

/* Loot windows: over the board, next to the party frames (the toasts stay clear at the top). */
.loot-stack {
  position: absolute; top: 150px; left: 96px; z-index: 35;
  display: flex; gap: 10px; align-items: flex-start; max-width: calc(100% - 120px);
}
.loot-window {
  width: 300px; display: grid; gap: 10px; padding: 0 12px 12px;
  background: rgba(24, 26, 32, 0.97); border: 1px solid var(--accent); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}
.loot-window .window-head { margin: 0 -12px; }
.loot-money { display: flex; align-items: center; gap: 6px; margin: 0; color: #e8cf7a; }
.loot-money .icon { width: 18px; height: 18px; }
.loot-money .btn { margin-left: auto; }

/* With the inventory screen open the loot windows go over its left part (the character's, which is not needed to
   loot), at its left edge and one on top of the other, so that they never cover the bag (client/css/inventory-screen.css). */
.board.inv-open .loot-stack {
  top: calc((100% - var(--inv-h)) / 2 + 70px); left: calc((100% - var(--inv-w)) / 2 + 12px); max-width: none;
  flex-direction: column; max-height: calc(var(--inv-h) - 82px); overflow-y: auto; padding-right: 4px;
}
.board.inv-open .loot-window { width: 250px; flex: none; }

@media (max-width: 760px), (max-height: 520px) {
  .loot-stack { top: 120px; left: 8px; right: 8px; transform: none; flex-direction: column; max-width: none; }
  .loot-window { width: auto; }
}

/* F11b: going up a level. */
.levelup-btn {
  margin-top: 4px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--accent); cursor: pointer;
  background: linear-gradient(180deg, #e8c46a, #b8862e); color: var(--accent-ink); font-weight: 700; font-size: 0.7rem;
  box-shadow: 0 0 10px rgba(212, 162, 76, 0.6); animation: levelup-glow 1.6s ease-in-out infinite alternate;
}
@keyframes levelup-glow { from { box-shadow: 0 0 4px rgba(212, 162, 76, 0.4); } to { box-shadow: 0 0 14px rgba(212, 162, 76, 0.9); } }
.levelup-layer { position: absolute; inset: 0; z-index: 45; display: grid; place-items: center; background: rgba(8, 9, 12, 0.55); }
.levelup {
  width: min(820px, calc(100% - 24px)); max-height: calc(100% - 40px); display: flex; flex-direction: column;
  background: rgba(24, 26, 32, 0.98); border: 1px solid var(--accent); border-radius: 12px; box-shadow: 0 16px 50px rgba(0, 0, 0, 0.7);
}
.levelup-body { overflow-y: auto; padding: 14px 16px; display: grid; gap: 14px; }
.levelup-body h3 { margin: 0 0 6px; color: var(--accent); font-family: var(--font-title); }
.levelup-hp { color: #9be08f; }
.levelup-foot { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 10px 16px; border-top: 1px solid var(--border); }
.asi-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 14px; }
.asi-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px; align-items: center; }
.xp-line { margin: 0; color: #e8cf7a; font-size: 0.85rem; }
