/* The battle inventory hangs below the bar so the hand stays in view. */
.battle-bar { position:relative; }
.battle-bar:has(#battle-trinkets[open]) { z-index:10; }
.battle-place { min-width:0; }
.battle-place-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.battle-bar-actions { flex:none; }
#battle-trinket-toggle {
  display:flex; align-items:center; gap:5px; min-height:44px; padding:0 6px;
  list-style:none; cursor:pointer; color:inherit; font:600 17px/1 var(--font-body);
}
#battle-trinket-toggle::-webkit-details-marker { display:none; }
#battle-trinket-toggle b { color:var(--print-gold); font-variant-numeric:tabular-nums; }
#battle-trinket-toggle::after {
  content:""; width:6px; height:6px; margin:-3px 1px 0 3px;
  border:solid currentColor; border-width:0 1.5px 1.5px 0; transform:rotate(45deg);
}
#battle-trinkets[open] summary::after { transform:rotate(225deg); margin-top:3px; }
#battle-trinket-toggle:hover { color:var(--print-gold); }
#battle-trinket-toggle:focus-visible, #battle-trinket-list:focus-visible { outline:2px solid var(--print-gold); outline-offset:-2px; }
#battle-trinket-list {
  --right-edge:max(10px,env(safe-area-inset-right));
  position:absolute; top:100%; right:var(--right-edge);
  width:min(370px,calc(100% - var(--right-edge) - max(10px,env(safe-area-inset-left))));
  max-height:min(46dvh,440px); overflow:auto; overscroll-behavior:contain;
  padding:4px 13px; border:1px solid #756347; border-top:3px solid #ba9455;
  background:#eee1ca; color:#322d26; box-shadow:0 7px 18px #18150f66;
  font:500 16px/1.3 var(--font-body); text-align:left;
}
#battle-trinket-list ul { margin:0; padding:0; list-style:none; }
#battle-trinket-list li { display:flex; align-items:center; gap:11px; padding:9px 0; }
#battle-trinket-list li + li { border-top:1px solid #b8a88d; }
#battle-trinket-list li img { flex:none; object-fit:cover; border:1px solid #77694f; background:#242525; }
#battle-trinket-list strong { font:700 21px/1.1 var(--font-display); }
#battle-trinket-list p { margin:3px 0; }
#battle-trinket-list small { color:#674b2a; font-weight:600; }

/* Each trinket is a dark relief print with its rules set on tinted paper. */
.trinket-row {
  display:flex;
  flex-wrap:wrap;
  align-items:stretch;
  justify-content:center;
  gap:clamp(12px,1.5vw,22px);
  margin:12px auto 26px;
}
.trinket-tile {
  --metal:#b7a17b;
  --engraving:#6e5d45;
  --paper:#e5d8bd;
  position:relative;
  display:flex;
  flex:0 1 240px;
  flex-direction:column;
  min-width:0;
  padding:0;
  overflow:hidden;
  border:1px solid var(--metal);
  border-radius:3px 3px 5px 5px;
  text-align:left;
  color:#2c2923;
  background:#1d2020;
  box-shadow:0 2px 0 #0d1010,0 5px 14px #090c0c78;
}
.trinket-tile[data-rarity="uncommon"] { --metal:#9cb6a3; --engraving:#436655; --paper:#d6dfcf; }
.trinket-tile[data-rarity="rare"] { --metal:#b8abc9; --engraving:#665274; --paper:#e1d5e0; }
.trinket-tile[data-rarity="boss"] { --metal:#e1b568; --engraving:#80532f; --paper:#ebd5ab; }
.trinket-tile[data-rarity="legendary"] { --metal:#d0a0ee; --engraving:#613479; --paper:#efdcf4; }
.trinket-tile[data-rarity="starter"] { --metal:#90a9b5; --engraving:#4b6571; --paper:#d8dedd; }
.trinket-tile::before {
  content:"";
  position:absolute;
  z-index:1;
  inset:3px;
  border:1px solid color-mix(in srgb,var(--metal) 58%,transparent);
  border-radius:1px 1px 2px 2px;
  pointer-events:none;
}
.trinket-tile .ti {
  position:relative;
  display:block;
  overflow:hidden;
  width:100%;
  aspect-ratio:1.43;
  flex:none;
  background:#202222;
}
.trinket-tile .ti img {
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
}
.trinket-tile .trinket-caption {
  position:relative;
  display:flex;
  flex:1;
  flex-direction:column;
  padding:11px 17px 17px;
  border-top:2px solid var(--metal);
  background:linear-gradient(112deg,#fff4df40,transparent 62%),var(--paper);
}
.trinket-meta, .trinket-rarity, .trinket-price { display:flex; align-items:center; }
.trinket-meta {
  justify-content:space-between;
  min-height:15px;
  gap:8px;
  margin-bottom:4px;
}
.trinket-rarity {
  gap:7px;
  color:var(--engraving);
  font:700 12px/1 var(--font-body);
  letter-spacing:.13em;
  text-transform:uppercase;
}
.trinket-rarity i {
  width:6px;
  height:6px;
  border:1px solid currentColor;
  transform:rotate(45deg);
}
.trinket-tile[data-rarity="uncommon"] .trinket-rarity i { background:linear-gradient(to right,currentColor 50%,transparent 50%); }
.trinket-tile:is([data-rarity="rare"],[data-rarity="boss"]) .trinket-rarity i { background:currentColor; }
.trinket-tile[data-rarity="legendary"] .trinket-rarity i { background:currentColor; outline:1px solid currentColor; outline-offset:2px; }
.trinket-price {
  gap:4px;
  color:#493c29;
  font:700 16px/1 var(--font-body);
  font-variant-numeric:tabular-nums;
}
.trinket-price .icon { width:15px; height:15px; stroke-width:1.8; }
.trinket-price.poor { color:#903c30; }
.trinket-tile .tn {
  font:700 clamp(25px,2.1vw,30px)/1.02 var(--font-display);
  letter-spacing:-.012em;
  overflow-wrap:break-word;
}
.trinket-tile .td {
  margin-top:7px;
  color:#3e3a30;
  font:500 17px/1.28 var(--font-body);
}
.trinket-tile.pickable { cursor:pointer; }
.trinket-tile[data-tip]:not(.pickable) { cursor:help; }
.trinket-tile.chosen { border-color:#ffe0a1; box-shadow:0 0 0 1px #d2a763,0 5px 14px #090c0c78; }
.trinket-chosen {
  position:absolute;
  z-index:2;
  top:6px; right:6px;
  display:grid;
  place-items:center;
  width:26px; height:30px;
  padding-bottom:4px;
  background:#d8b778; color:#322c20;
  clip-path:polygon(0 0,100% 0,100% 100%,50% 83%,0 100%);
}
.trinket-chosen .icon { width:17px; height:17px; stroke-width:2.3; }
.trinket-sr { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.trinket-tile.faded .ti img { filter:saturate(.38) brightness(.71); }
.trinket-tile.faded .trinket-caption { background:color-mix(in srgb,var(--paper) 78%,#777970); }
.trinket-tile:focus-visible { outline:3px solid #ffe2a3; outline-offset:3px; }
@media (hover:hover) {
  .trinket-tile.pickable:hover { border-color:#f8da9b; box-shadow:0 0 0 1px #ddbd7b,0 5px 13px #07090988; }
}
@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  .trinket-tile .ti img { transition:transform .22s ease-out; }
  .trinket-tile.pickable:hover .ti img { transform:scale(1.035); }
}
@media (max-width:640px) {
  .trinket-row { flex-direction:column; align-items:center; gap:9px; }
  .trinket-tile {
    display:grid;
    grid-template-columns:clamp(92px,27vw,128px) minmax(0,1fr);
    align-items:stretch;
    flex:none;
    width:min(100%,438px);
    min-height:105px;
  }
  .trinket-tile .ti { width:100%; height:100%; min-height:100px; aspect-ratio:auto; }
  .trinket-tile .ti img { position:absolute; inset:0; object-fit:cover; }
  .trinket-tile .trinket-caption { justify-content:center; padding:11px 13px 12px; border-top:0; border-left:2px solid var(--metal); }
  .trinket-meta { min-height:13px; margin-bottom:4px; }
  .trinket-rarity { font-size:11px; }
  .trinket-tile .tn { font-size:25px; }
  .trinket-tile .td { margin-top:4px; font-size:16px; }
  .trinket-chosen { left:6px; right:auto; }
}
@media (forced-colors:active) {
  .trinket-tile,.trinket-tile::before { border-color:CanvasText; }
  .trinket-tile:focus-visible { outline-color:Highlight; }
}
