/* ==========================================================================
   css/chest.css - treasure chests (DECISIONS 501, docs/PLAN-CHEST.md; the proposal's docs/img/chest/src/chest.css).
   --------------------------------------------------------------------------
   On the map: the chest is an object like the sign and the ferry (js/scene/actors.js, js/scene/scene.js setChest),
   drawn by a strip of frames that scripts/slice_chest.py cut from the owner's sheets into assets/scenes/objects/:
   cells of 120 x 148 px, the chest's base 48 px wide and centred, its foot on y 132 of the cell. A ball chest strip
   has 10 cells (idle 1-4, open 1-6), the stone chest 22 (idle 1-8, then 14 frames that open it on nothing and shut
   it again), the sparkle burst 8 cells of 160 x 160.
   The window: the Minecraft-like grids of js/ui/chest.js in openModal({wide, sheet}) - the chest's slots on top, your
   Bag below.
   ========================================================================== */

/* The frame number is a registered integer, so keyframes can step it (steps(1) holds each frame) and one set of
   keyframes drives every chest: background-position-x = frame / (frames - 1). */
@property --f { syntax: '<integer>'; inherits: true; initial-value: 0; }
@property --b { syntax: '<integer>'; inherits: true; initial-value: 0; }

:root {
  /* A chest's cell on the map. Its base is 40 % of the cell: 36 px here, about a trainer's width (css/scene.css:
     trainers are 48 px tall), 30 px on a phone. */
  --chest-cell: 90px;
}
@media (max-width: 420px) { :root { --chest-cell: 75px; } }

/* The six chests (their colours are the column headers of the owner's sheet) and the stone chest. */
.chest-poke     { --chest-c: #e0493f; --chest-c2: #ffd166; --chest-strip: url("../assets/scenes/objects/poke.webp");     --chest-hero: url("../assets/scenes/objects/poke-hero.webp");     --chest-fx: url("../assets/scenes/objects/poke-fx.webp"); }
.chest-great    { --chest-c: #3f7fe6; --chest-c2: #8fd0ff; --chest-strip: url("../assets/scenes/objects/great.webp");    --chest-hero: url("../assets/scenes/objects/great-hero.webp");    --chest-fx: url("../assets/scenes/objects/great-fx.webp"); }
.chest-ultra    { --chest-c: #e3a51a; --chest-c2: #ffe08a; --chest-strip: url("../assets/scenes/objects/ultra.webp");    --chest-hero: url("../assets/scenes/objects/ultra-hero.webp");    --chest-fx: url("../assets/scenes/objects/ultra-fx.webp"); }
.chest-master   { --chest-c: #a24ff0; --chest-c2: #f59bff; --chest-strip: url("../assets/scenes/objects/master.webp");   --chest-hero: url("../assets/scenes/objects/master-hero.webp");   --chest-fx: url("../assets/scenes/objects/master-fx.webp"); }
.chest-premier  { --chest-c: #e9ecf4; --chest-c2: #ff9aa8; --chest-strip: url("../assets/scenes/objects/premier.webp");  --chest-hero: url("../assets/scenes/objects/premier-hero.webp");  --chest-fx: url("../assets/scenes/objects/premier-fx.webp"); }
.chest-apricorn { --chest-c: #62b04e; --chest-c2: #b9f36a; --chest-strip: url("../assets/scenes/objects/apricorn.webp"); --chest-hero: url("../assets/scenes/objects/apricorn-hero.webp"); --chest-fx: url("../assets/scenes/objects/apricorn-fx.webp"); }
.chest-empty    { --chest-c: #8d95a3; --chest-c2: #c9cfd8; --chest-strip: url("../assets/scenes/objects/empty.webp"); --chest-frames: 22; }
/* The sparkle burst is gold; per chest the hue turns (Great blue, Master violet, Premier pink). */
.chest-great   { --burst-filter: hue-rotate(175deg) saturate(1.3); }
.chest-master  { --burst-filter: hue-rotate(245deg) saturate(1.4); }
.chest-premier { --burst-filter: hue-rotate(305deg) saturate(0.7) brightness(1.15); }

/* --------------------------------------------------------------------------
   On the map
   -------------------------------------------------------------------------- */
.scene .actor.object.obj-chest,
.scene .actor.object.obj-chest:is(:hover, :focus-visible, .near) { background: transparent; outline-color: transparent; }
.obj-chest .chest-body { position: absolute; inset: 0; transform-origin: 50% 100%; pointer-events: none; }
.obj-chest .chest-sprite {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: var(--chest-cell);
  aspect-ratio: 120 / 148;
  translate: -50% calc(16 / 148 * 100%);   /* the cell's foot line (y 132 of 148) on the object's bottom edge */
  background-image: var(--chest-strip);
  background-repeat: no-repeat;
  background-size: calc(var(--chest-frames, 10) * 100%) 100%;
  background-position: calc(var(--f) * 100% / (var(--chest-frames, 10) - 1)) 0;
  pointer-events: none;
  transition: filter 0.15s ease;
}
/* Near it (E) or under the mouse: the soft white glow of the buildings (css/scene.css), and the chest lifts 1 px. */
.obj-chest:is(:hover, :focus-visible, .near) .chest-sprite {
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.8));
  translate: -50% calc(16 / 148 * 100% - 1px);
}
.obj-chest .object-label { bottom: -14px; }
.obj-chest .object-label .object-icon { color: var(--chest-c); }
.obj-chest .object-label .chest-left { color: #cfd6e4; font-weight: 700; margin-left: 3px; }

/* Closed: a short glint every few seconds (idle frames 1-4: the ball button flashes), so a chest in the grass
   catches the eye like the glint of a hidden item in the games. js/scene/scene.js staggers the start per chest. */
@keyframes chestIdle { 0%, 70% { --f: 0; } 73% { --f: 1; } 76% { --f: 2; } 79% { --f: 3; } 82%, 100% { --f: 0; } }
.obj-chest.is-closed .chest-sprite { animation: chestIdle 3.6s steps(1, end) var(--glint-delay, 0s) infinite; }

/* Opening: frames 5-10 at about 90 / 80 / 80 / 80 / 90 ms, then the last one stays (the chest stands open). */
@keyframes chestOpen { 0% { --f: 4; } 21% { --f: 5; } 40% { --f: 6; } 58% { --f: 7; } 77% { --f: 8; } 96%, 100% { --f: 9; } }
.obj-chest.is-opening .chest-sprite { animation: chestOpen 0.44s steps(1, end) forwards; }
/* Open (you, or someone else, is looking inside): the last frame with a slow glow in the chest's colour. */
@keyframes chestGlow { 50% { filter: brightness(1.12) drop-shadow(0 0 7px var(--chest-c2)); } }
.obj-chest.is-open .chest-sprite { --f: 9; animation: chestGlow 1.8s ease-in-out infinite; }
/* Shutting with items left in it: the opening backwards (70 ms a frame), then closed again. */
@keyframes chestShut { 0% { --f: 9; } 20% { --f: 8; } 40% { --f: 7; } 60% { --f: 6; } 80% { --f: 5; } 100% { --f: 4; } }
.obj-chest.is-shutting .chest-sprite { animation: chestShut 0.36s steps(1, end) forwards; }
/* The pop when the lid flies up: a little squash on the base, over by the time the burst is at its biggest. */
@keyframes chestPop { 0% { scale: 1 1; } 30% { scale: 1.06 0.94; } 60% { scale: 0.97 1.04; } 100% { scale: 1 1; } }
.obj-chest.is-opening .chest-body { animation: chestPop 0.36s ease-out 0.12s both; }

/* The sparkle burst (the 8 frames of the owner's first, wooden chest sheet), in the chest's hue; the Apricorn chest
   throws its leaves instead. Over the chest's mouth, once. */
.obj-chest .chest-burst {
  position: absolute;
  left: 50%;
  bottom: 30%;
  width: calc(var(--chest-cell) * 1.25);
  aspect-ratio: 1;
  translate: -50% 0;
  background: url("../assets/scenes/objects/sparkle.webp") 0 0 / 800% 100% no-repeat;
  background-position: calc(var(--b) * 100% / 7) 0;
  filter: var(--burst-filter, none);
  pointer-events: none;
  opacity: 0;
}
@keyframes chestBurst {
  0% { --b: 0; opacity: 1; }
  12% { --b: 1; } 24% { --b: 2; } 36% { --b: 3; } 48% { --b: 4; } 62% { --b: 5; } 76% { --b: 6; }
  90% { --b: 7; opacity: 1; }
  100% { --b: 7; opacity: 0; }
}
.obj-chest.is-opening .chest-burst { animation: chestBurst 0.62s steps(1, end) 0.14s both; }
.obj-chest.chest-apricorn .chest-burst { background: var(--chest-fx) center / contain no-repeat; filter: none; }
@keyframes chestLeaves { 0% { opacity: 0; scale: 0.3; translate: -50% 20%; } 30% { opacity: 1; } 100% { opacity: 0; scale: 1.25; translate: -50% -30%; } }
.obj-chest.chest-apricorn.is-opening .chest-burst { animation: chestLeaves 0.8s ease-out 0.14s both; }

/* Someone else has it open: their name over it. */
.obj-chest .chest-tag {
  position: absolute;
  left: 50%;
  bottom: calc(var(--chest-cell) * 1.05);
  translate: -50% 0;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(12, 18, 32, 0.85);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--chest-c) 70%, transparent), 0 1px 3px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.obj-chest .chest-tag b { color: var(--chest-c2); }
.obj-chest .chest-tag[hidden] { display: none; }

/* The stone chest (moss, cobwebs): its 8 idle frames turn slowly; E opens it on nothing and shuts it again. */
@keyframes chestEmptyIdle { 0% { --f: 0; } 12.5% { --f: 1; } 25% { --f: 2; } 37.5% { --f: 3; } 50% { --f: 4; } 62.5% { --f: 5; } 75% { --f: 6; } 87.5%, 100% { --f: 7; } }
.obj-chest.chest-empty.is-closed .chest-sprite { animation: chestEmptyIdle 4s steps(1, end) infinite; }
@keyframes chestEmptyOpen {
  0% { --f: 8; } 7% { --f: 9; } 14% { --f: 10; } 21% { --f: 11; } 28% { --f: 12; } 35% { --f: 13; } 42% { --f: 14; }
  56% { --f: 15; } 63% { --f: 16; } 70% { --f: 17; } 77% { --f: 18; } 84% { --f: 19; } 91% { --f: 20; } 98%, 100% { --f: 21; }
}
.obj-chest.chest-empty.is-opening .chest-sprite { animation: chestEmptyOpen 1.05s steps(1, end) forwards; }
.obj-chest.chest-empty .chest-burst { background: url("../assets/scenes/objects/empty-fx.webp") 0 0 / 400% 100% no-repeat; filter: none; }
@keyframes chestDust { 0% { opacity: 0; scale: 0.5; } 25% { opacity: 0.9; } 100% { opacity: 0; scale: 1.3; translate: -50% -12%; } }
.obj-chest.chest-empty.is-opening .chest-burst,
.obj-chest.is-turning .chest-burst { animation: chestDust 0.9s ease-out 0.2s both; }
.obj-chest.is-turning .chest-burst { background: url("../assets/scenes/objects/empty-fx.webp") 0 0 / 400% 100% no-repeat; filter: none; animation-delay: 0s; }

/* A chest that just appeared drops in with a little bounce; one whose time is up crumbles to dust and goes. */
@keyframes chestDrop { 0% { opacity: 0; translate: -50% calc(16 / 148 * 100% - 30px); } 60% { opacity: 1; translate: -50% calc(16 / 148 * 100% + 2px); } 100% { translate: -50% calc(16 / 148 * 100%); } }
.obj-chest.is-new .chest-sprite { animation: chestDrop 0.5s cubic-bezier(0.3, 1.4, 0.5, 1) both; }
@keyframes chestGone { to { opacity: 0; scale: 0.85; } }
.obj-chest.is-gone { pointer-events: none; }
.obj-chest.is-gone .chest-sprite, .obj-chest.is-gone .object-label { animation: chestGone 0.5s ease-in forwards; }
.obj-chest.is-gone .chest-burst { background: url("../assets/scenes/objects/empty-fx.webp") 0 0 / 400% 100% no-repeat; filter: none; animation: chestDust 0.7s ease-out both; }

@media (prefers-reduced-motion: reduce) {
  .obj-chest .chest-sprite, .obj-chest .chest-body { animation: none !important; }
  .obj-chest:is(.is-opening, .is-open) .chest-sprite { --f: 9; }
  .obj-chest.is-shutting .chest-sprite { --f: 0; }
  .obj-chest.chest-empty .chest-sprite { --f: 0; }
  .obj-chest .chest-burst { display: none; }
}

/* --------------------------------------------------------------------------
   The chest window (js/ui/chest.js, in openModal({wide, sheet}))
   -------------------------------------------------------------------------- */
.modal.chest-modal { max-width: 640px; }
.chest-modal .modal-head h3 { display: flex; align-items: center; gap: 8px; }
.chest-modal .ball-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(var(--chest-c) 0 46%, #111 46% 54%, #fff 54%); box-shadow: 0 0 0 1.5px #111; }
.chest-modal .modal-body { padding-top: 12px; }

.chest-top {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 8px 14px 8px 8px;
  border-radius: 12px;
  background:
    radial-gradient(120% 140% at 12% 50%, color-mix(in srgb, var(--chest-c) 38%, transparent), transparent 62%),
    rgba(255, 255, 255, 0.04);
  border: 1px solid color-mix(in srgb, var(--chest-c) 30%, rgba(255, 255, 255, 0.08));
}
.chest-hero {
  /* The hero cell (224 px) has room round the chest for its glow: drawn bigger than its grid cell, the chest fills
     the cell and the glow spills over the edges. */
  position: relative;
  width: 176px;
  margin: -26px;
  aspect-ratio: 1;
  background: var(--chest-hero) 100% 0 / 200% 100% no-repeat;   /* frame 2: the big open chest */
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--chest-c2) 60%, transparent));
  animation: chestHero 2.2s ease-in-out infinite;
}
@keyframes chestHero { 50% { filter: drop-shadow(0 0 16px var(--chest-c2)) brightness(1.06); } }
/* The chest's own particles (the owner's sheet) pop up behind it when the window opens. */
.chest-hero::before {
  content: "";
  position: absolute;
  inset: 12%;
  z-index: -1;
  background: var(--chest-fx) center / contain no-repeat;
  animation: chestFx 1.1s ease-out 0.1s both;
  pointer-events: none;
}
@keyframes chestFx { 0% { opacity: 0; scale: 0.4; } 35% { opacity: 1; } 100% { opacity: 0; scale: 1.4; } }
.chest-empty-now .chest-hero { background-position: 0 0; animation: none; filter: grayscale(0.4) brightness(0.8); }
.chest-sub { margin: 2px 0 6px; color: var(--muted); font-size: 12.5px; }
.chest-first { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: rgba(246, 201, 69, 0.14); color: #f6d36b; font-size: 12px; font-weight: 700; }
.chest-first.after { background: rgba(90, 169, 255, 0.14); color: #9fcbff; }
.chest-first svg { width: 13px; height: 13px; }
.chest-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; color: var(--muted); font-size: 11.5px; }
.chest-meta b { color: var(--text); font-weight: 700; }
.chest-meta svg { width: 12px; height: 12px; vertical-align: -1px; }

.grid-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 14px 2px 6px; }
.grid-head h4 { margin: 0; font-size: 12.5px; letter-spacing: 0.02em; text-transform: uppercase; color: #cfd6e4; }
.grid-head .muted { font-size: 11.5px; }

.slot-grid { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; }
.slot {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.28));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), inset 0 3px 8px rgba(0, 0, 0, 0.45);
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;   /* iPhone: a long press is the tooltip, not the menu for the picture */
  transition: transform 0.12s ease, background-color 0.12s ease;
}
.slot .item-icon { display: grid; place-items: center; width: 64%; height: 64%; }
.slot .item-icon img, .slot .item-icon svg { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.45)); }
.slot .qty {
  position: absolute; right: 5px; bottom: 2px;
  font-weight: 800; font-size: 13px; color: #fff; letter-spacing: -0.02em;
  text-shadow: 1px 1px 0 #1a1a1a, -1px 0 0 #1a1a1a, 0 -1px 0 #1a1a1a, 1px 0 0 #1a1a1a;
  pointer-events: none;
}
.slot:not(:disabled):hover, .slot:not(:disabled):focus-visible { transform: translateY(-2px); background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04)); outline: none; }
.slot:focus-visible { box-shadow: inset 0 0 0 2px #fff; }
.slot:disabled { cursor: default; }
/* Rarity rims, the RPG loot colours: common grey, uncommon green, rare blue, epic violet, legendary gold. */
.chest-grid .slot.r-common   { box-shadow: inset 0 0 0 1px rgba(190, 198, 212, 0.35), inset 0 3px 8px rgba(0, 0, 0, 0.45); }
.chest-grid .slot.r-uncommon { box-shadow: inset 0 0 0 2px rgba(76, 217, 100, 0.75), inset 0 3px 8px rgba(0, 0, 0, 0.45); }
.chest-grid .slot.r-rare     { box-shadow: inset 0 0 0 2px rgba(90, 169, 255, 0.85), inset 0 3px 8px rgba(0, 0, 0, 0.45); }
.chest-grid .slot.r-epic     { box-shadow: inset 0 0 0 2px rgba(183, 123, 255, 0.9), inset 0 0 14px rgba(183, 123, 255, 0.35); }
.chest-grid .slot.r-legend   { box-shadow: inset 0 0 0 2px #f6c945, inset 0 0 16px rgba(246, 201, 69, 0.45); }
/* The chest's best item: a slow shine in the chest's colour, the loot moment of an RPG. */
.slot.is-top::before {
  content: "";
  position: absolute; inset: -3px;
  border-radius: 11px;
  border: 2px solid var(--chest-c2);
  box-shadow: 0 0 12px var(--chest-c2);
  animation: topShine 1.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes topShine { 50% { opacity: 0.45; } }
.slot .top-star { position: absolute; left: 4px; top: 2px; font-size: 10px; color: var(--chest-c2); text-shadow: 0 0 4px #000; pointer-events: none; }
/* The slots fill one after the other when the window opens (60 ms apart). */
@keyframes slotIn { from { opacity: 0; transform: translateY(6px) scale(0.9); } to { opacity: 1; transform: none; } }
.chest-grid .slot.fill-in { animation: slotIn 0.28s ease-out both; animation-delay: calc(var(--i, 0) * 60ms + 120ms); }
/* Taken on this visit: the faint picture of what was there. */
.slot.was .item-icon { opacity: 0.16; filter: grayscale(1); }
.slot.was.is-top::before { display: none; }
/* In the Bag: what just came in lights up and says "+5". */
.bag-grid .slot:not(.is-new) { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), inset 0 3px 8px rgba(0, 0, 0, 0.45); }
.bag-grid .slot.is-new { background: linear-gradient(180deg, rgba(76, 217, 100, 0.2), rgba(76, 217, 100, 0.06)); box-shadow: inset 0 0 0 2px #4cd964, 0 0 10px rgba(76, 217, 100, 0.45); }
@keyframes slotBump { 40% { transform: scale(1.12); } }
.bag-grid .slot.bump { animation: slotBump 0.3s ease-out; }
.slot .plus {
  position: absolute; left: 50%; top: -12px; translate: -50% 0;
  padding: 0 6px; border-radius: 999px;
  background: #4cd964; color: #0f2b14; font-size: 11px; font-weight: 800;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  animation: plusUp 1.2s ease-out both;
}
@keyframes plusUp { 0% { opacity: 0; translate: -50% 6px; } 20% { opacity: 1; translate: -50% 0; } 80% { opacity: 1; } 100% { opacity: 0; translate: -50% -8px; } }
.slot .full-note { position: absolute; left: 50%; bottom: -14px; translate: -50% 0; white-space: nowrap; font-size: 9.5px; font-weight: 800; color: #ffb4b4; pointer-events: none; }
/* An item on its way from the chest to the Bag (js/ui/chest.js flyTo: a copy of its picture over the page). */
.chest-fly { position: fixed; z-index: 1200; width: 34px; height: 34px; pointer-events: none; will-change: transform; }
.chest-fly .item-icon, .chest-fly img, .chest-fly svg { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.5)); }
/* While dragging (on a PC): the picture follows the pointer, the Bag lights up as the place to drop it. */
.chest-drag { position: fixed; z-index: 1200; width: 40px; height: 40px; margin: -20px 0 0 -20px; pointer-events: none; opacity: 0.9; }
.bag-grid.drop-here { outline: 2px dashed rgba(76, 217, 100, 0.8); outline-offset: 2px; border-radius: 10px; }

/* Scoped to the chest window's own grid (.slot-grid.bag-grid, js/ui/chest.js): unscoped, these two lines capped every
   pocket of the Bag page at 186 px and cut its cards off, and shrank the Bag's empty panel (found in DECISIONS 532). */
.slot-grid.bag-grid { max-height: 186px; overflow: auto; padding: 14px 2px 16px; margin-top: -12px; }
.bag-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.bag-tabs button { padding: 2px 9px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.12); background: transparent; color: var(--muted); font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.bag-tabs button.on { background: var(--accent-soft); border-color: var(--accent); color: #fff; }
.slot-grid .bag-empty { grid-column: 1 / -1; padding: 10px 2px; color: var(--muted); font-size: 12px; }

.chest-move { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.chest-move .hint { color: var(--muted); font-size: 11.5px; }
.chest-move .btn { min-height: 34px; }
/* "Sort" next to "Take all" (DECISIONS 550): lit while the chest is shown sorted. */
.chest-btns { display: flex; gap: 8px; }
.chest-sort[aria-pressed="true"] { color: var(--text); background: var(--accent-soft); border-color: var(--accent); }
.chest-divider { display: flex; align-items: center; gap: 10px; margin: 10px 2px 0; color: var(--muted); }
.chest-divider::before, .chest-divider::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, 0.1); }
.chest-divider svg { width: 14px; height: 14px; }

/* The tooltip: Minecraft's dark violet box with the name in its rarity colour. Over the page (the modal clips). */
.chest-tip {
  position: fixed;
  z-index: 1150;
  min-width: 190px;
  max-width: 250px;
  padding: 8px 10px 9px;
  border-radius: 6px;
  background: rgba(18, 8, 30, 0.97);
  border: 2px solid #2d0d63;
  outline: 1px solid rgba(0, 0, 0, 0.6);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  font-size: 11.5px;
  line-height: 1.45;
  color: #c9c3d8;
  pointer-events: none;
}
.chest-tip .t-name { font-size: 13px; font-weight: 800; margin-bottom: 2px; }
.chest-tip .t-kind { color: #8f86a6; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.chest-tip .t-line { margin-top: 5px; }
.chest-tip .t-meta { margin-top: 6px; display: grid; gap: 1px; color: #a79fbe; }
.chest-tip .t-meta b { color: #fff; }
.t-common { color: #d4d9e3; }
.t-uncommon { color: #6ee887; }
.t-rare { color: #7fbcff; }
.t-epic { color: #c79bff; }
.t-legend { color: #f6c945; }

.chest-modal .modal-actions { justify-content: space-between; align-items: center; }
.chest-modal .modal-actions .left-note { color: var(--muted); font-size: 11.5px; margin-right: auto; }

/* The picture of the What's new card (js/ui/news.js chestArt): the big closed chest of the window, filling its box. */
.news-chest { display: block; width: 100%; height: 100%; background: var(--chest-hero) 0 0 / 200% 100% no-repeat; transform: scale(1.7); transform-origin: 50% 62%; }

/* Phone: the window comes up from the bottom (openModal sheet, css/base.css), five slots a row, big targets. */
@media (max-width: 600px) {
  .chest-top { grid-template-columns: 88px minmax(0, 1fr); gap: 10px; padding: 6px 10px 6px 6px; }
  .chest-hero { width: 124px; margin: -18px; }
  .chest-meta { font-size: 11px; gap: 3px 10px; }
  .slot-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
  .slot .qty { font-size: 14px; }
  .slot-grid.bag-grid { max-height: 150px; }
  .chest-move .btn { min-height: 44px; flex: 1 1 auto; }
  .chest-btns { flex: 1 1 auto; }
  .chest-btns .chest-sort { flex: 0 0 auto; }
  .chest-move .hint { display: none; }
  .chest-modal .modal-actions .btn { flex: 1 1 auto; min-height: 46px; }
  .chest-modal .modal-actions .left-note { display: none; }
}
