/* The Potenzia tab of the backpack (inventory.js upgradesTab, drawn by src/upgrades.js): the guardians of the chapter on
   top, the purse, one card per upgrade, then the rank. Our own palette: night blue for the guardians, the sheet's cream and
   gold for the cards. Fits a 375 px wide phone without sideways scrolling. */

/* ---- the guardians of the chapter */
.guardians { margin-top: 10px; padding: 10px 10px 12px; border-radius: 18px; background: linear-gradient(165deg, #33427a, #1d2445 72%); color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1), 0 3px 0 rgba(58, 42, 34, 0.18); }
.guardians.all { background: linear-gradient(165deg, #3a6f8c, #1d3a52 72%); }
.guardians header { display: flex; align-items: center; gap: 8px; }
.guardians header b { flex: 1; min-width: 0; font-size: 14px; font-weight: 900; line-height: 1.2; }
.guardians header span { flex: none; padding: 2px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.16); font-size: 13px; font-weight: 900; font-variant-numeric: tabular-nums; }
.gtiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
@media (min-width: 620px) { .gtiles { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.gtile { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.gpic { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 12px; background: radial-gradient(circle at 50% 62%, #56619a 0 22%, #2a3158 74%); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12); }
.gpic > img, .gpic > svg { position: absolute; left: 5%; top: 5%; width: 90%; height: 90%; object-fit: contain; }
/* not beaten yet: the same picture, made into a black shape with a faint rift glow */
.gtile:not(.won) .gpic > img, .gtile:not(.won) .gpic > svg { filter: brightness(0) drop-shadow(0 0 3px rgba(214, 120, 255, 0.75)); }
.gtile.won .gpic { background: radial-gradient(circle at 50% 42%, #fffaf0 0 18%, var(--map) 78%); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75); }
.gpic > b { position: absolute; right: 3px; top: 3px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #ffd85a; color: #3a2a22; font-size: 12px; font-weight: 900; line-height: 1; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.gcrown { position: absolute; left: 2px; top: 1px; width: 20px; height: 20px; }
.gcrown svg { display: block; width: 100%; height: 100%; }
.gtile.final .gpic { box-shadow: inset 0 0 0 2px #c26bff, 0 0 0 1px rgba(194, 107, 255, 0.5); }
.gtile small { display: -webkit-box; width: 100%; min-height: 2.3em; overflow: hidden; color: #fff; font-size: 10px; font-weight: 700; line-height: 1.15; text-align: center; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.gtile:not(.won) small { color: rgba(255, 255, 255, 0.4); letter-spacing: 2px; }
.guardians p { margin: 8px 0 0; color: #ffe08a; font-size: 12px; font-weight: 700; text-align: center; }

/* ---- the cards of the upgrades */
.upcards { display: flex; flex-direction: column; gap: 8px; }
.upcard { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 18px; background: #fff; box-shadow: 0 2px 0 rgba(58, 42, 34, 0.1); }
.upart { flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 16px; background: radial-gradient(circle at 50% 36%, var(--tone2) 0 28%, var(--tone) 80%); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12), inset 0 0 0 2px rgba(255, 255, 255, 0.55); }
.upart svg { width: 54px; height: 54px; filter: drop-shadow(0 2px 0 rgba(58, 42, 34, 0.25)); }
.upinfo { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.upinfo strong { color: #3a2a22; font-size: 15px; font-weight: 900; }
.updesc { color: #6a5244; font-size: 12px; line-height: 1.25; }
.upval { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; color: #8a6a55; font-size: 14px; font-weight: 900; font-variant-numeric: tabular-nums; }
.upval i { color: #c9b79c; font-style: normal; }
.upval b { padding: 0 6px; border-radius: 8px; background: #d9f5ef; color: #148a7f; }
.upcard.maxed .upval b { background: #fff1c7; color: #a26a00; }
.uplvl { display: flex; align-items: center; gap: 6px; color: #8a6a55; font-size: 11px; }
.uplvl em { font-style: normal; white-space: nowrap; }
.uplvl i { flex: 1; max-width: 90px; height: 6px; overflow: hidden; border-radius: 3px; background: #efe2cb; }
.uplvl i span { display: block; height: 100%; background: #3fd1b8; }
.upcard.maxed .uplvl i span { background: #ffc531; }
.sheet .upbuy { display: flex; flex: none; align-items: center; justify-content: center; gap: 3px; min-width: 76px; min-height: 48px; padding: 4px 10px; border: 0; border-radius: 14px; background: linear-gradient(#ffd85a, #ffb81f); color: #5a3a00; font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; box-shadow: 0 3px 0 #c98a00; }
.sheet .upbuy svg { width: 22px; height: 22px; }
.sheet .upbuy:disabled { background: #efe2cb; color: #a89a88; box-shadow: 0 3px 0 #d9c9ae; cursor: default; }
.sheet .upbuy:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 #c98a00; }
/* the test tools at the bottom of the sheet (only with ?debug) wrap instead of pushing the sheet sideways at 375 px */
.sheet footer { flex-wrap: wrap; }
.upmax { display: grid; flex: none; place-items: center; min-width: 76px; min-height: 48px; border-radius: 14px; background: #3a2a22; color: #ffd85a; font-size: 15px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; }
