/* Сундуки наград (client/chest.js). Окно сводки #chs — поверх всего, кроме подтверждений (#dlg), внутри безопасной области. */
.chs { position: fixed; left: 0; top: 0; width: 100%; height: var(--app-h, 100%); z-index: 320; box-sizing: border-box; overflow: hidden;
  padding: 8px calc(var(--sar, 0px) + 12px) 8px calc(var(--sal, 0px) + 12px); display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 35% 50%, rgba(40, 30, 12, 0.97), rgba(0, 0, 0, 0.98)); --rc: #d8dde6; --u: 1; --cw: 64px; -webkit-tap-highlight-color: transparent; }
.chs.hidden, .chs-got.hidden { display: none; }
body.chs-on #tips, body.chs-on #tips-ring { display: none !important; }
body.chs-on #dlg { z-index: 330; }
.chs-in { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.35fr); gap: 12px; width: 100%; max-width: 900px; height: 100%; align-items: center; }
.chs-stage { position: relative; height: 100%; min-height: 0; display: flex; align-items: center; justify-content: center; }
.chs-ch { position: relative; z-index: 2; width: min(100%, calc(var(--app-h, 100vh) * 0.6)); aspect-ratio: 120 / 112; }
.chs-ch svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.7)); }
.chs-lo, .chs-li { transform-box: fill-box; transform-origin: 50% 100%; }
.chs-lo { transform: scaleY(0); }          /* итог: внешняя крышка откинута */
.chs-li { transform: scaleY(1); }          /* итог: внутренняя сторона крышки видна целиком над сундуком */
.chs-slit { opacity: 0.9; }
.chs-rays { position: absolute; z-index: 1; left: 50%; top: 46%; width: calc(var(--app-h, 100vh) * 0.95); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; opacity: 0.5; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, var(--rc) 0 7deg, transparent 7deg 45deg); -webkit-mask: radial-gradient(circle, #000 18%, transparent 68%); mask: radial-gradient(circle, #000 18%, transparent 68%); }
.chs-flash { position: absolute; z-index: 3; left: 50%; top: 42%; width: calc(var(--app-h, 100vh) * 0.5); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(circle, #fff 0, var(--rc) 30%, transparent 70%); }
.chs.low .chs-rays { display: none; }
.chs-side { display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 8px; height: 100%; min-width: 0; min-height: 0; }
.chs-t { font: 700 15px/1.2 inherit; color: #ffe2a0; text-align: center; text-shadow: 0 1px 2px #000; }
.chs-cards { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-content: center; min-height: 0; overflow: hidden; padding: 2px; }
.chs-c { position: relative; width: var(--cw); height: var(--cw); box-sizing: border-box; display: flex; align-items: center; justify-content: center; border-radius: 6px;
  background: linear-gradient(#2a2016, #120c06); border: 2px solid #6a5a44; box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.6); }
.chs-c img { width: 62%; height: 62%; object-fit: contain; }
.chs-c b { position: absolute; right: 3px; bottom: 1px; font: 700 11px/1.2 inherit; color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.chs-c.r1 { border-color: #4aa8ff; } .chs-c.r2 { border-color: #b46cff; } .chs-c.r3 { border-color: #3ee06a; box-shadow: 0 0 10px rgba(62, 224, 106, 0.55); } .chs-c.r4 { border-color: #ffc93a; box-shadow: 0 0 12px rgba(255, 201, 58, 0.65); }
.chs-c .exc { position: absolute; left: 3px; top: 3px; width: 7px; height: 7px; border-radius: 50%; background: #3ee06a; }
.chs-c.more b { position: static; font-size: 15px; color: #ffe2a0; }
.chs-ok { align-self: center; min-height: 44px; min-width: 160px; padding: 0 22px; border-radius: 6px; border: 1px solid #c99a3a; color: #2a1806; font: 700 14px/1 inherit;
  background: linear-gradient(#ffe08a, #d39a2a); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6); flex: 0 0 auto; }
/* анимация: --u — масштаб времени (1 обычная, 0,4 «Низкая»: ≥ 600 мс, без лучей) */
.chs.play .chs-ch { animation: chs-shake calc(0.7s * var(--u)) ease-in both; }
.chs.play .chs-lo { animation: chs-lo calc(0.2s * var(--u)) ease-in calc(0.7s * var(--u)) both; }
.chs.play .chs-li { animation: chs-li calc(0.22s * var(--u)) ease-out calc(0.86s * var(--u)) both; }
.chs.play .chs-flash { animation: chs-flash calc(0.6s * var(--u)) ease-out calc(0.9s * var(--u)) both; }
.chs.play .chs-rays { animation: chs-rays-in calc(0.4s * var(--u)) ease-out calc(0.95s * var(--u)) both, chs-spin 14s linear calc(0.95s * var(--u)) infinite; }
.chs.play .chs-c { animation: chs-fly calc(0.36s * var(--u)) cubic-bezier(.2, .9, .3, 1.2) var(--d) both; }
.chs.skip *, .chs.skip { animation: none !important; }
@keyframes chs-shake { 0% { transform: translateY(-18%) scale(0.7); opacity: 0; } 18% { transform: none; opacity: 1; } 30% { transform: rotate(-3deg); } 42% { transform: rotate(4deg); } 54% { transform: rotate(-6deg); } 66% { transform: rotate(7deg); } 78% { transform: rotate(-8deg); } 90% { transform: rotate(5deg); } 100% { transform: none; } }
@keyframes chs-lo { from { transform: scaleY(1); } to { transform: scaleY(0); } }
@keyframes chs-li { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes chs-flash { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }
@keyframes chs-rays-in { from { opacity: 0; } to { opacity: 0.5; } }
@keyframes chs-spin { from { transform: translate(-50%, -50%) rotate(0); } to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes chs-fly { from { transform: translate(var(--fx), var(--fy)) scale(0.3); opacity: 0; } 30% { opacity: 1; } to { transform: none; opacity: 1; } }

/* «щелчок»: сундук получен — влетает в «Сумку» */
.chs-got { position: fixed; left: 50%; top: calc(var(--app-h, 100vh) * 0.42); z-index: 318; pointer-events: none; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chs-got i { display: block; width: 72px; height: 63px; filter: drop-shadow(0 0 10px var(--rc)); }
.chs-got i svg { width: 100%; height: 100%; }
.chs-got b { font: 700 12px/1.2 inherit; color: #ffe2a0; text-shadow: 0 1px 2px #000, 0 0 4px #000; white-space: nowrap; }
.chs-got.play { animation: chs-got 0.95s ease-in both; }
.chs-got.low.play { animation-duration: 0.62s; }
@keyframes chs-got { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); } 25% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 55% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.25); } }

/* вкладка «Награды» в сумке */
#rws { box-sizing: border-box; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px; display: flex; flex-direction: column; gap: 4px; }
#rws.hidden { display: none; }
.rw-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; font: 12px/1.3 inherit; color: #d8c8a0; min-height: 44px; }
.rw-hint { font-size: 11px; color: #a89878; text-align: right; }
.rw-row { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 5px; background: rgba(0, 0, 0, 0.35); border: 1px solid #4a3a26; }
.rw-row.r3 { border-color: #3ee06a88; } .rw-row.r4 { border-color: #ffc93a99; }
.rw-ic { flex: 0 0 auto; width: 40px; height: 35px; filter: drop-shadow(0 0 4px var(--rc)); }
.rw-ic svg { width: 100%; height: 100%; }
.rw-tx { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.rw-tx b { font: 700 12px/1.25 inherit; color: #ffe2a0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rw-tx em { font: 11px/1.25 inherit; color: #b8a888; font-style: normal; }
.rw-open, .rw-all { flex: 0 0 auto; min-height: 44px; min-width: 44px; padding: 0 10px; border-radius: 5px; border: 1px solid #c99a3a; color: #2a1806; font: 700 12px/1 inherit; background: linear-gradient(#ffe08a, #d39a2a); }
.rw-open:disabled, .rw-all:disabled { filter: grayscale(1) brightness(0.7); }
.rw-empty { font: 12px/1.4 inherit; color: #b8a888; margin: 8px 4px; }
.chs-glow { transform-box: fill-box; transform-origin: 50% 50%; filter: blur(2px); }
.chs.play .chs-glow { animation: chs-li calc(0.3s * var(--u)) ease-out calc(0.8s * var(--u)) both; }
