/* Treasure chests (src/chests.js): the HUD button (left column), the panel #shelf with the 4 slots, the deposit and the
   chests of the world, and the loot card. Linked after style.css. */

/* the chest icons: plain pictures (style.css gives the class .chest to the chest box of the backpack) */
#chestbtn svg.chest, #shelf svg.chest, #loot svg.chest { display: block; margin: 0; padding: 0; border-radius: 0; background: none; }

/* HUD button: the chest, the countdown of the one being opened, the badge */
#chestbtn .cico { display: block; }
/* the countdown hangs under the button as a small pill, so the row of buttons is no wider (phones: the minimap is close) */
#chestbtn .ctime { position: absolute; left: 50%; bottom: -4px; height: 16px; padding: 0 6px; transform: translateX(-50%); border-radius: 8px; background: #17566b; color: #fff; font-size: 10px; font-weight: 900; line-height: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; }
#chestbtn .ctime[hidden], #chestbtn i[hidden] { display: none; }
#chestbtn.opening { box-shadow: 0 4px 0 rgba(27, 58, 75, 0.35), 0 0 0 2px #ffc93c; }
#chestbtn i.idle { background: #ff9f1a; animation: cpulse 1.2s ease-in-out infinite; }

/* the panel: opening times of the five kinds */
/* the five kinds of chest side by side on one row, small (icon + time), and the "i" button that shows the explanation (2026-11-13) */
.chelp { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; }
.ctimes { flex: 1; min-width: 0; display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ctimes li { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 2px; height: 24px; padding: 0 3px; border-radius: 12px; background: #fff; font-size: 10px; font-weight: 800; color: #3a2a22; white-space: nowrap; overflow: hidden; }
.ctimes li svg { flex: none; width: 18px; height: 16px; }
.cinfo { flex: none; width: 26px; height: 26px; padding: 0; border: 2px solid #8a6a55; border-radius: 50%; background: #fff; color: #8a6a55; font: inherit; font-size: 14px; font-weight: 900; font-style: italic; line-height: 1; cursor: pointer; }
.cinfo.on { border-color: #1fb5a8; background: #1fb5a8; color: #fff; }
.cintro { margin: 8px 0 0; }

/* the 4 slots */
.cslot, .cdep { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 8px 10px; border-radius: 14px; background: #fff; color: #6a5244; font-size: 12px; }
.cslot > svg, .cdep > svg { flex: none; width: 46px; height: 40px; }
.cslot .about, .cdep .about { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.cslot .about strong, .cdep .about strong { font-size: 15px; color: #3a2a22; }
.cslot.empty { background: transparent; box-shadow: inset 0 0 0 2px #e2d3ba; color: #a89a88; }
.cslot.empty > svg { opacity: 0.25; filter: grayscale(1); }
.cslot.opening { background: #fffaf0; animation: cglow 1.6s ease-in-out infinite; }
.cslot.opening > svg { animation: crattle 1.6s ease-in-out infinite; }
.cslot.ready { background: #fff7dc; box-shadow: inset 0 0 0 3px #ffc93c; }
.cslot.ready > svg { animation: cbounce 0.9s ease-in-out infinite; }
.cslot .go, .cdep .go { flex: none; min-height: 42px; padding: 0 16px; border: 0; border-radius: 12px; background: #1fb5a8; color: #fff; font-size: 14px; font-weight: 900; }
.cslot.ready .go { background: #ffc93c; color: #5a3a00; }
.cslot .wait, .cdep .wait { flex: none; padding: 7px 10px; border-radius: 10px; background: #efe2cb; color: #a08a72; font-size: 12px; font-weight: 900; }
.cslot .count { flex: none; min-width: 56px; font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; text-align: right; color: #3a2a22; }
.cbar { display: block; height: 8px; margin-top: 3px; overflow: hidden; border-radius: 4px; background: #efe2cb; }
.cbar i { display: block; height: 100%; border-radius: 4px; background: var(--bar, #1fb5a8); transition: width 0.25s linear; }

/* the deposit */
.cdep .many { flex: none; font-size: 15px; font-weight: 900; color: #3a2a22; }
.cdep .go { padding: 0 12px; background: #3a2a22; font-size: 13px; }
.cempty { margin-top: 2px; }

/* the chests of the world, one row per area */
.cworld { display: grid; gap: 5px; margin: 8px 0 0; padding: 0; list-style: none; }
.cworld li { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 10px; background: #fff; font-size: 12px; color: #6a5244; }
.cworld li > i { flex: none; width: 12px; height: 26px; border-radius: 5px; }
.cworld li > span { flex: 1; font-weight: 900; color: #3a2a22; }
.cworld li > b { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.cworld li > b svg { width: 24px; height: 21px; }

/* test tool switched on */
#shelf .sheet footer button.on { border-style: solid; border-color: #1fb5a8; background: #1fb5a8; color: #fff; }

/* the panel opens compact (only the places with a chest); "Mostra tutto" / "Mostra solo quelli in corso" under it */
#shelf .sheet { padding-bottom: 64px; } /* room for the DEV badge of the test tools, bottom left */
#shelf .cmore { margin: 10px 0 0; }
#shelf .cmore button { min-height: 40px; padding: 0 12px; border: 1px dashed #c9b79c; border-radius: 12px; background: transparent; color: #6a5244; font: inherit; font-size: 12px; font-weight: 900; }

/* the loot card: the note of the first chest */
#loot .card > svg.chest { margin: 0 auto; }
#loot .cnote { margin: 0 0 10px; padding: 8px 10px; border-radius: 12px; background: #fff; font-size: 12px; font-weight: 700; line-height: 1.35; color: #6a5244; text-align: left; }
/* the things come out one at a time (2026-11-13: "uno ad uno gli oggetti con tasto skip"); "Salta" shows the rest */
#loot .lootlist li { animation: lootin 0.35s ease-out both; }
#loot .cfoot { margin-top: 10px; }
#loot .cfoot button.skip { background: transparent; border: 2px solid #1fb5a8; color: #13786f; }
@keyframes lootin {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@keyframes cglow {
  0%, 100% { box-shadow: inset 0 0 0 2px var(--glow, #ffc93c); }
  50% { box-shadow: inset 0 0 0 3px var(--glow, #ffc93c), 0 0 14px var(--glow, #ffc93c); }
}
@keyframes crattle {
  0%, 60%, 100% { transform: rotate(0); }
  70% { transform: rotate(-6deg); }
  80% { transform: rotate(5deg); }
  90% { transform: rotate(-3deg); }
}
@keyframes cbounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes cpulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}
/* The chip of the chest being carried (2026-11-13): its own row under the mission, clear of the magnet chip and the mission box */
#stage #chestchip { top: calc(258px + env(safe-area-inset-top)); height: 34px; gap: 6px; padding: 0 12px 0 6px; border: 2px solid #ffc93c; background: rgba(42, 26, 12, 0.82); color: #fff; }
#stage #chestchip svg.chest { width: 30px; height: 26px; }
#stage #chestchip span { font-size: 13px; font-weight: 800; white-space: nowrap; }
#stage #chestchip small { font-size: 12px; font-weight: 800; color: #ffe08a; }
