/* F11: the Inventario screen (BG3 style): a big panel over the board in three
   parts: the character at the left, its figure with the equipment slots in the
   middle, the bag at the right. On a phone: mobile.css. */

/* Its size and place; the loot windows (inventory.css) line up with them. */
.board { --inv-w: min(1180px, calc(100% - 128px)); --inv-h: min(780px, 90%); }

.inv-screen {
  position: absolute; inset: 0; margin: auto; z-index: 26; width: var(--inv-w); height: var(--inv-h);
  display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(180deg, #1f1a14, #0f0d0b);
  /* The huge shadow dims the board and the interface around it, without catching the pointer (the dock stays within reach). */
  border: 1px solid #5a4630; border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(6, 5, 4, 0.58), 0 18px 60px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(212, 162, 76, 0.07);
}
.board.inv-open .hud-right { z-index: 27; }

.inv-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 18px; border-bottom: 1px solid #4a3a28; background: linear-gradient(180deg, rgba(74, 58, 40, 0.35), transparent); }
.inv-head-main { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 6px 20px; flex-wrap: wrap; }
.inv-title { min-width: 0; }
.inv-title h2 { margin: 0; font-family: var(--font-title); font-size: 1.35rem; line-height: 1.2; color: var(--accent); letter-spacing: 0.02em; overflow-wrap: anywhere; }
.inv-title p { margin: 0; font-size: 0.85rem; }
.inv-numbers { display: flex; align-items: center; gap: 18px; font-size: 0.9rem; color: var(--muted); }
.inv-numbers span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.inv-numbers .icon { width: 18px; height: 18px; }
.inv-weight-sum.over { color: var(--danger); }
.inv-money { color: #e8cf7a; }
.inv-close {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: rgba(14, 15, 19, 0.8);
  color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.inv-close:hover { color: var(--text); border-color: var(--accent); }
.inv-empty { margin: 28px; }
.inv-screen:not(.is-empty) .inv-empty, .inv-screen.is-empty .inv-body { display: none; }

/* The three parts. */
.inv-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px 340px minmax(0, 1fr); gap: 12px; padding: 12px; }
.inv-body > * { min-width: 0; min-height: 0; background: rgba(8, 7, 6, 0.38); border: 1px solid #3a2f22; border-radius: 10px; }
.inv-body.is-container { grid-template-columns: minmax(0, 1fr); }
.inv-body.is-container .inv-char, .inv-body.is-container .inv-doll { display: none; }

/* Left: who it is. */
.inv-char { overflow-y: auto; padding: 12px; }
.inv-char-toggle { display: none; }
.inv-char-sheet { display: grid; gap: 14px; }
.inv-identity { display: grid; gap: 1px; }
.inv-identity strong { font-family: var(--font-title); font-size: 1.05rem; }
.inv-class { font-size: 0.9rem; }
.inv-abilities { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.inv-abilities .ability-box { padding: 4px 0 3px; background: rgba(34, 28, 21, 0.9); border-color: #4a3a28; line-height: 1.25; }
.inv-abilities .ability-box.save { border-color: var(--accent); }
.inv-abilities small { font-size: 0.62rem; letter-spacing: 0.05em; color: var(--muted); }
.inv-abilities strong { font-size: 1.1rem; }
.inv-abilities span { font-size: 0.72rem; color: var(--accent); }
.inv-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.inv-stats .stat { background: rgba(34, 28, 21, 0.9); border-color: #4a3a28; padding: 5px 8px; }
.inv-stats .stat small { font-size: 0.7rem; }
.inv-block h4 { margin: 0 0 5px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.inv-block p { margin: 0 0 4px; font-size: 0.85rem; }
.inv-features { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.inv-features .chip { font-size: 0.75rem; padding: 2px 8px; cursor: help; }

/* A loot window over this part (inventory.css): what is under it goes blank, as if the chest took its place. */
@media (min-width: 761px) and (min-height: 521px) {
  .board.inv-open:has(.loot-window) .inv-char-body { visibility: hidden; }
}

/* Middle: the figure, the slots at its sides, the weapons and the Armor Class below. */
.inv-doll { overflow-y: auto; padding: 14px 12px; }
.inv-doll-body { min-height: 100%; display: flex; flex-direction: column; gap: 16px; }
.inv-doll-slots { flex: 1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; }
.is-creature .inv-doll-slots { grid-template-columns: minmax(0, 1fr); }
.inv-slots { display: flex; flex-direction: column; gap: 8px; }
.inv-slots-left { justify-content: space-between; }
.inv-figure {
  position: relative; min-height: 330px; overflow: hidden; border-radius: 90px 90px 14px 14px; border: 1px solid #4a3a28;
  background: radial-gradient(ellipse at 50% 18%, color-mix(in srgb, var(--fig, #6b6f7a) 42%, transparent), transparent 68%), linear-gradient(180deg, rgba(44, 35, 26, 0.6), rgba(10, 9, 8, 0.7));
}
.inv-figure::after { content: ''; position: absolute; left: 50%; bottom: 4px; width: 78%; height: 22px; transform: translateX(-50%); background: radial-gradient(ellipse at center, rgba(212, 162, 76, 0.22), transparent 70%); }
.inv-silhouette { position: absolute; left: 50%; bottom: 6px; height: 88%; width: auto; transform: translateX(-50%); fill: color-mix(in srgb, var(--fig, #6b6f7a) 30%, #1b1713); }
.face.face-fig { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); width: 84px; height: 84px; border-radius: 50%; border-width: 3px; font-size: 1.8rem; }
.inv-weapons { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: end; }
.inv-hands { display: grid; justify-items: center; align-content: end; gap: 6px; }
.inv-pair { display: flex; gap: 8px; }
.inv-attack { display: grid; justify-items: center; line-height: 1.2; text-align: center; }
.inv-attack small { font-size: 0.68rem; color: var(--muted); }
.inv-attack strong { font-size: 0.92rem; white-space: nowrap; }
/* The Armor Class in a shield: a gold outline, a dark fill. */
.inv-ac {
  position: relative; width: 66px; height: 78px; display: grid; place-content: center; text-align: center; line-height: 1.05;
  background: #a07c43; clip-path: polygon(0 6%, 50% 0, 100% 6%, 100% 54%, 86% 74%, 50% 100%, 14% 74%, 0 54%);
}
.inv-ac::before {
  content: ''; position: absolute; inset: 2px; background: linear-gradient(180deg, #3a3025, #17130f);
  clip-path: polygon(0 6%, 50% 0, 100% 6%, 100% 54%, 86% 74%, 50% 100%, 14% 74%, 0 54%);
}
.inv-ac > * { position: relative; }
.inv-ac small { font-size: 0.62rem; letter-spacing: 0.08em; color: var(--muted); }
.inv-ac strong { font-size: 1.6rem; font-family: var(--font-title); }

/* The squares of this screen: a bit bigger, warmer, the empty ones with a faint icon. */
.inv-screen .inv-cell { width: 52px; height: 52px; background: linear-gradient(180deg, #2b241c, #17130f); border-color: #5a4630; }
.inv-screen .inv-cell .icon { width: 30px; height: 30px; }
.inv-screen .inv-cell:hover { border-color: var(--accent); }
.inv-screen .inv-cell.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(212, 162, 76, 0.4); }
.inv-screen .inv-cell.magic { border-color: #8e6fd1; box-shadow: inset 0 0 8px rgba(142, 111, 209, 0.45); }
.inv-screen .inv-cell.magic.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(212, 162, 76, 0.4), inset 0 0 8px rgba(142, 111, 209, 0.45); }
.inv-screen .inv-cell.empty { background: rgba(14, 12, 10, 0.55); border: 1px dashed #4a3a28; color: var(--muted); }
.inv-screen .inv-cell.empty .icon { opacity: 0.3; }
.inv-screen .inv-slot .inv-cell { width: 56px; height: 56px; }
.inv-screen .inv-hands .inv-slot .inv-cell { width: 50px; height: 50px; }
/* A stack some of which is worn: a gold dot. */
.inv-cell.worn::after { content: ''; position: absolute; left: 4px; top: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 5px rgba(212, 162, 76, 0.9); }

/* Right: the bag. */
.inv-bag { display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.inv-tabs { display: flex; gap: 4px; }
.inv-tab { padding: 4px 16px; border-radius: 999px; border: 1px solid #4a3a28; background: rgba(40, 32, 24, 0.9); color: var(--muted); font-size: 0.82rem; }
.inv-tab:hover { color: var(--text); }
.inv-tab.on { color: var(--accent); border-color: var(--accent); }
.inv-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.inv-tools { display: flex; gap: 8px; }
.inv-search { flex: 1; min-width: 0; }
.inv-filter { flex: none; max-width: 45%; }
.inv-screen .inv-grid {
  flex: 1; min-height: 90px; overflow-y: auto; padding: 8px; grid-template-columns: repeat(auto-fill, 52px); gap: 6px;
  background: rgba(0, 0, 0, 0.28); border: 1px solid #3a2f22; border-radius: 8px; align-content: start;
}
.inv-weight { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); }
.inv-weight .icon { width: 18px; height: 18px; flex: none; }
.inv-weight-text { white-space: nowrap; }
.inv-weight-track { flex: 1; min-width: 40px; height: 8px; border-radius: 4px; overflow: hidden; background: rgba(0, 0, 0, 0.6); border: 1px solid #3a2f22; }
.inv-weight-fill { display: block; height: 100%; background: linear-gradient(90deg, #7a5d2a, var(--accent)); }
.inv-weight.over { color: var(--danger); }
.inv-weight.over .inv-weight-fill { background: var(--danger); }

/* The item picked: what it is and what can be done with it. */
.inv-detail-host { flex: none; max-height: 42%; overflow-y: auto; border-top: 1px solid #3a2f22; padding-top: 8px; }
.inv-hint { margin: 0; font-size: 0.85rem; }
.inv-detail { display: grid; gap: 8px; }
.inv-detail-head { display: flex; align-items: center; gap: 10px; }
.inv-detail-head > div { display: grid; min-width: 0; }
.inv-detail-head strong { font-family: var(--font-title); color: var(--accent); overflow-wrap: anywhere; }
.inv-detail-icon { flex: none; width: 40px; height: 40px; padding: 7px; border: 1px solid #5a4630; border-radius: 8px; background: linear-gradient(180deg, #2b241c, #17130f); }
.inv-detail-icon.magic { border-color: #8e6fd1; }
.inv-detail-lines p { margin: 0 0 3px; font-size: 0.82rem; }
.inv-detail-lines p:last-child { color: var(--muted); }
.inv-detail .row { margin: 0; }

/* The GM's tab. */
.inv-gm-pane { overflow-y: auto; }
.inv-gm { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-content: start; }
.inv-gm > * { min-width: 0; }
.inv-gm h4 { margin: 4px 0 0; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--secret); }
.inv-gm .row { align-items: center; flex-wrap: wrap; gap: 6px; }
.inv-gm input:not(.num) { flex: 1; min-width: 140px; }
.inv-gm label input.num { width: 9em; }

.inv-tip {
  position: absolute; z-index: 5; max-width: 280px; padding: 8px 10px; pointer-events: none;
  background: rgba(14, 12, 10, 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; }

/* A window not so tall: smaller slots. */
@media (max-height: 760px) {
  .inv-screen .inv-slot .inv-cell { width: 48px; height: 48px; padding: 6px; }
  .inv-slots { gap: 6px; }
  .inv-figure { min-height: 280px; }
}

/* A narrower window: the character folds away over the other two (a button opens it). */
@media (max-width: 1060px) {
  .inv-body { grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .inv-char { grid-column: 1 / -1; padding: 0; max-height: 46%; }
  .inv-screen .inv-hands .inv-slot .inv-cell { width: 44px; height: 44px; padding: 5px; }
  .inv-char-toggle { display: block; width: 100%; padding: 7px 12px; border: 0; background: none; color: var(--accent); font: inherit; text-align: left; cursor: pointer; }
  .inv-char-toggle::after { content: '▾'; float: right; }
  .inv-char.open .inv-char-toggle::after { content: '▴'; }
  .inv-char:not(.open) { overflow: visible; }
  .inv-char:not(.open) .inv-char-body { display: none; }
  .inv-char-body { padding: 0 12px 12px; }
  .inv-body.is-container { grid-template-rows: minmax(0, 1fr); }
}
