/* ───────── Открытие сундука: кейс-рулетка на весь экран ───────── */
.modal:has(> .case-modal) { padding: 0; background: #050302; backdrop-filter: none; }
.modal-card.case-modal {
  width: 100vw; height: 100dvh; max-height: none; max-width: none; padding: 0; border: 0; border-radius: 0; overflow: hidden;
  color: var(--cream-on-night); background: #0b0806; animation: cs-in .45s cubic-bezier(.2,.9,.3,1) both;
}
@keyframes cs-in { from { opacity: 0; transform: scale(1.04); } }
.modal-card.case-modal > .modal-x { position: absolute; z-index: 30; top: max(10px, env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; color: var(--cream-on-night); background: rgba(241,230,207,.1); border-radius: 50%; font-size: 28px; display: grid; place-items: center; }
.modal-card.case-modal > .modal-x:hover, .modal-card.case-modal > .modal-x:focus-visible { background: rgba(241,230,207,.22); }

.cs {
  --best: #ffb347; --cw: clamp(86px, min(11.6vw, 17.5vh), 176px); --ch: calc(var(--cw) * 1.2); --gap: clamp(6px, .8vw, 10px);
  position: relative; height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; justify-items: center;
  padding: max(18px, env(safe-area-inset-top)) clamp(12px, 3vw, 40px) max(16px, env(safe-area-inset-bottom)); isolation: isolate; overflow: hidden;
}
.cs.shake { animation: cs-shake .45s cubic-bezier(.36,.07,.19,.97); }
.cs.shake-big { animation: cs-shake .8s cubic-bezier(.36,.07,.19,.97); --sh: 2; }
.cs.beat .cs-vig { animation: cs-beat .38s ease-out; }
@keyframes cs-beat { 30% { opacity: .55; } }
@keyframes cs-shake { 10%, 90% { translate: calc(-2px * var(--sh, 1)) 1px; } 20%, 80% { translate: calc(4px * var(--sh, 1)) -2px; } 30%, 50%, 70% { translate: calc(-7px * var(--sh, 1)) calc(3px * var(--sh, 1)); } 40%, 60% { translate: calc(7px * var(--sh, 1)) -2px; } }

/* фон: кузнечный жар снизу, морозная синь сверху, лучи */
.cs-bg { position: absolute; inset: 0; z-index: -2; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(60% 45% at 50% 108%, rgba(226,98,42,.42), transparent 70%),
    radial-gradient(70% 50% at 50% -12%, rgba(75,147,189,.28), transparent 70%),
    radial-gradient(100% 80% at 50% 50%, #24170e 0%, #120c08 55%, #070504 100%); }
.cs-vig { position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0,0,0,.75)); }
.cs-rays { position: absolute; left: 50%; top: 46%; width: 180vmax; height: 180vmax; translate: -50% -50%; opacity: .32;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--best) 40%, transparent) 0 5deg, transparent 5deg 15deg);
  -webkit-mask: radial-gradient(circle, #000 0, transparent 42%); mask: radial-gradient(circle, #000 0, transparent 42%);
  animation: cs-spin 60s linear infinite; transition: opacity .8s, filter .8s; }
.cs-rays--2 { opacity: .16; animation-duration: 90s; animation-direction: reverse; background: repeating-conic-gradient(from 7deg, rgba(159,207,232,.35) 0 3deg, transparent 3deg 22deg); }
@keyframes cs-spin { to { rotate: 360deg; } }
.cs:is([data-phase="spin"], [data-phase="reveal"]) .cs-rays { opacity: .12; }
.cs[data-phase="loot"] .cs-rays { opacity: .55; animation-duration: 30s; }
.cs-bg::after { content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity 1s; background: radial-gradient(70% 60% at 50% 45%, rgba(255,170,40,.32), rgba(80,36,0,.55) 55%, #1a0b00 100%); }
.cs.is-legend .cs-bg::after { opacity: 1; }
.cs.is-legend .cs-rays { opacity: .75; background: repeating-conic-gradient(from 0deg, rgba(255,194,61,.55) 0 5deg, rgba(255,138,0,.12) 5deg 8deg, transparent 8deg 14deg); }
.cs.is-legend .cs-rays--2 { opacity: .35; background: repeating-conic-gradient(from 7deg, rgba(255,226,140,.4) 0 2deg, transparent 2deg 19deg); }
.cs-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.cs-flash { position: absolute; inset: 0; z-index: 21; pointer-events: none; opacity: 0;
  mix-blend-mode: screen; background: radial-gradient(circle at var(--fx, 50%) var(--fy, 50%), #fff 0, color-mix(in srgb, var(--fc, #fff) 75%, transparent) 14%, color-mix(in srgb, var(--fc, #fff) 25%, transparent) 30%, transparent 42%); }
.cs-flash.on { animation: cs-flash .7s ease-out; }
@keyframes cs-flash { 0% { opacity: 0; } 12% { opacity: var(--fa, .8); } 100% { opacity: 0; } }

/* звук */
.cs-snd { position: absolute; z-index: 30; top: max(10px, env(safe-area-inset-top)); left: 12px; width: 44px; height: 44px; border: 0; border-radius: 50%; display: grid; place-items: center; color: var(--cream-on-night); background: rgba(241,230,207,.1); cursor: pointer; }
.cs-snd:hover, .cs-snd:focus-visible { background: rgba(241,230,207,.22); }
.cs-snd .cs-snd-x { display: none; }
.cs-snd.is-off { color: var(--muted-on-night); }
.cs-snd.is-off .cs-snd-x { display: inline; } .cs-snd.is-off .cs-snd-w { display: none; }

/* заголовок */
.cs-head { text-align: center; z-index: 2; padding-inline: 52px; min-height: 0; }
.cs-title { margin: 0; font: 800 clamp(26px, 4.4vw, 46px)/1.02 var(--f-display); letter-spacing: .01em; color: #ffd9a0;
  text-shadow: 0 0 22px rgba(242,146,51,.55), 0 3px 0 #3a1705, 0 6px 18px rgba(0,0,0,.8); }
.cs[data-phase="loot"] .cs-title { animation: cs-title .6s cubic-bezier(.2,1.7,.4,1) both; }
@keyframes cs-title { from { opacity: 0; transform: scale(.6); } }
.cs-sub { margin: 6px 0 0; color: var(--muted-on-night); font: 500 clamp(13px, 1.5vw, 16px)/1.3 var(--f-label); letter-spacing: .05em; display: grid; gap: 2px; justify-items: center; }
.cs-note { font-size: 22px; color: var(--paper); letter-spacing: 0; }

.cs-scene { position: relative; width: 100%; min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; z-index: 2; }
.cs-scene > * { grid-area: 1 / 1; }

/* ── интро: сундук ── */
.cs-intro { display: grid; justify-items: center; align-content: center; gap: clamp(10px, 3vh, 30px); width: 100%; min-height: 0; transition: opacity .35s, transform .35s; }
.cs:is([data-phase="spin"], [data-phase="reveal"], [data-phase="loot"]) .cs-intro { opacity: 0; pointer-events: none; visibility: hidden; transition: opacity .3s, visibility 0s .3s; }
.cs-pedestal { position: relative; display: grid; justify-items: center; }
.cs-chest { position: relative; z-index: 2; width: clamp(180px, min(34vw, 46vh), 400px); aspect-ratio: 1; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; animation: cs-float 3.2s ease-in-out infinite; -webkit-tap-highlight-color: transparent; }
.cs-chest:focus-visible { outline: 3px solid var(--ember); outline-offset: 6px; }
.cs-chest-img { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; user-select: none; transition: transform .25s, filter .25s; }
.cs-body { clip-path: polygon(0 40.6%, 34.7% 53.6%, 95.8% 42%, 100% 42%, 100% 100%, 0 100%); filter: drop-shadow(0 18px 22px rgba(0,0,0,.75)); }
.cs-lid { z-index: 4; clip-path: polygon(0 0, 100% 0, 100% 42.4%, 95.8% 42.4%, 34.7% 54%, 0 41%); transform-origin: 66% 30%; }
.cs.is-gift .cs-lid { display: none; }
.cs.is-gift .cs-body { clip-path: none; }
.cs-chest:not(:disabled):hover .cs-chest-img { transform: translateY(-6px) scale(1.03) rotate(-1.5deg); }
.cs-chest-glow { position: absolute; z-index: 1; inset: 18% 10% 8%; border-radius: 50%; background: radial-gradient(closest-side, rgba(255,170,70,.55), rgba(226,98,42,.18) 60%, transparent); filter: blur(8px); animation: cs-pulse 2.4s ease-in-out infinite; }
/* свет изнутри: щель и столб */
.cs-chest-inner { position: absolute; z-index: 3; left: 18%; right: 6%; top: 36%; height: 22%; border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(closest-side, #fffbe8 0, #ffd36a 35%, rgba(255,140,40,.6) 65%, transparent); filter: blur(4px); }
.cs-chest-beam { position: absolute; z-index: 1; left: 50%; bottom: 52%; width: 70%; height: 170%; translate: -50% 0; transform-origin: 50% 100%; transform: scaleY(0); opacity: 0; pointer-events: none;
  background: linear-gradient(0deg, rgba(255,226,150,.95), rgba(255,180,80,.5) 35%, transparent 90%); -webkit-mask: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent); mask: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent); filter: blur(6px); }
.cs-chest-shine { position: absolute; z-index: 5; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(115deg, transparent 38%, rgba(255,247,220,.55) 48%, transparent 58%); -webkit-mask: url("../assets/reward/chest.webp") center / contain no-repeat; mask: url("../assets/reward/chest.webp") center / contain no-repeat;
  background-size: 260% 100%; animation: cs-shine 3.6s ease-in-out 1s infinite; }
.cs.is-gift .cs-chest-shine { -webkit-mask-image: url("../assets/reward/gift.webp"); mask-image: url("../assets/reward/gift.webp"); }
@keyframes cs-shine { 0% { opacity: 1; background-position: 120% 0; } 40%, 100% { opacity: 1; background-position: -60% 0; } }
@keyframes cs-float { 50% { transform: translateY(-10px); } }
@keyframes cs-pulse { 50% { opacity: .55; transform: scale(.92); } }
.cs-plinth { display: block; width: clamp(200px, 36vw, 440px); height: clamp(22px, 4vh, 40px); margin-top: calc(clamp(22px, 4vh, 40px) * -0.9); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,160,70,.35), rgba(255,160,70,.08) 60%, transparent), radial-gradient(closest-side, rgba(0,0,0,.7), transparent); }

/* взлом: три толчка с нарастанием, щель разгорается */
.cs[data-phase="unlock"] .cs-chest { animation: cs-jolts .96s linear both; }
.cs[data-phase="unlock"] .cs-chest-inner { opacity: .7; transition: opacity .9s ease-in; }
.cs[data-phase="unlock"] .cs-chest-glow { animation: none; inset: 0; opacity: 1; transform: scale(1.3); transition: all .9s ease-in; }
.cs[data-phase="unlock"] .cs-chest-shine, .cs[data-phase="open"] .cs-chest-shine { display: none; }
@keyframes cs-jolts {
  0% { transform: none; } 6% { transform: rotate(-3deg) translateY(-4px); } 12% { transform: rotate(2deg); } 18% { transform: none; }
  32% { transform: none; } 38% { transform: rotate(4deg) translateY(-8px) scale(1.03); } 44% { transform: rotate(-3deg) translateY(-2px); } 50% { transform: none; }
  60% { transform: none; } 66% { transform: rotate(-6deg) translateY(-14px) scale(1.07); } 72% { transform: rotate(5deg) translateY(-4px) scale(1.05); } 78% { transform: rotate(-3deg) scale(1.06); } 86%, 100% { transform: scale(1.08) translateY(-4px); } }
/* открытие: крышка откидывается, столб света, удар масштаба */
.cs[data-phase="open"] .cs-chest, .cs[data-phase="burst"] .cs-chest { animation: cs-punch .5s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes cs-punch { 0% { transform: scale(1.08); } 35% { transform: scale(1.18); } 100% { transform: scale(1.12); } }
.cs:is([data-phase="open"], [data-phase="burst"]) .cs-lid { transform: translate(-3%, -17%) rotate(-17deg); transition: transform .42s cubic-bezier(.2,1.7,.4,1); filter: drop-shadow(0 14px 18px rgba(0,0,0,.7)) brightness(1.05); }
.cs:is([data-phase="open"], [data-phase="burst"]) .cs-chest-inner { opacity: 1; transform: scale(1.25); transition: opacity .1s, transform .4s; }
.cs:is([data-phase="open"], [data-phase="burst"]) .cs-chest-beam { opacity: 1; transform: scaleY(1); transition: transform .45s cubic-bezier(.2,1,.3,1), opacity .1s; }
.cs:is([data-phase="open"], [data-phase="burst"]) .cs-chest-glow { animation: none; inset: -10%; opacity: 1; background: radial-gradient(closest-side, rgba(255,226,150,.8), rgba(255,140,40,.3) 60%, transparent); }
.cs.is-gift[data-phase="open"] .cs-body { transform: scale(1.1) rotate(4deg); filter: brightness(1.3) drop-shadow(0 0 40px #ffcf7a); }
.cs[data-phase="burst"] .cs-pedestal { animation: cs-dissolve .3s ease-in forwards; }
@keyframes cs-dissolve { to { opacity: 0; transform: scale(1.25); filter: brightness(2.2) blur(6px); } }
.cs:is([data-phase="open"], [data-phase="burst"]) .cs-odds { opacity: 0; }

/* шансы */
.cs-odds { width: min(520px, 92%); display: grid; gap: 8px; transition: opacity .3s; }
.cs-odds-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; background: rgba(255,255,255,.05); box-shadow: 0 0 0 1px rgba(255,255,255,.06); }
.cs-odds-bar i { background: var(--c); box-shadow: 0 0 10px var(--c); min-width: 4px; }
.cs-odds-l { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; font: 500 12.5px/1.2 var(--f-label); letter-spacing: .06em; text-transform: uppercase; color: var(--muted-on-night); }
.cs-odds-l span::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 2px; background: var(--c); box-shadow: 0 0 6px var(--c); vertical-align: 1px; }

/* ── рулетка ── */
.cs-reels { width: 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; gap: clamp(10px, 2.4vh, 22px); opacity: 0; pointer-events: none; transition: opacity .4s; }
.cs[data-phase="spin"] .cs-reels { opacity: 1; pointer-events: auto; cursor: pointer; }
.cs-reel { --c: #fff; position: relative; width: 100%; min-width: 0; animation: cs-reel-in .5s cubic-bezier(.2,1,.3,1) calc(var(--i) * 90ms) both; }
@keyframes cs-reel-in { from { opacity: 0; transform: translateX(80px); } }
.cs-window { position: relative; width: 100%; overflow: hidden; height: calc(var(--ch) + 22px); padding: 11px 0; border-block: 1px solid rgba(255,214,150,.16);
  background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(30,18,10,.55) 50%, rgba(0,0,0,.55));
  box-shadow: inset 0 10px 18px -12px rgba(0,0,0,.9), inset 0 -10px 18px -12px rgba(0,0,0,.9);
  -webkit-mask: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent); mask: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent); }
.cs-window::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(18% 80% at 50% 50%, rgba(255,214,140,.10), transparent 70%); }
.cs-track { display: flex; gap: var(--gap); width: max-content; will-change: transform; }
.cs-card { --c: #ccc; position: relative; flex: none; width: var(--cw); height: var(--ch); display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center; padding: 8px 6px 12px; border-radius: 6px; overflow: hidden;
  background: linear-gradient(180deg, #2a2019, #17110c); box-shadow: inset 0 0 0 1px rgba(255,255,255,.07), 0 6px 14px -6px rgba(0,0,0,.8); transition: transform .35s cubic-bezier(.2,1.6,.4,1), filter .4s, opacity .4s; }
.cs-card-bg { position: absolute; inset: 0; background: radial-gradient(80% 60% at 50% 42%, color-mix(in srgb, var(--c) 34%, transparent), transparent 72%); }
.cs-card-pic { position: relative; width: 78%; aspect-ratio: 1; display: grid; place-items: center; }
.cs-card-pic img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; -webkit-mask: radial-gradient(closest-side, #000 72%, transparent 100%); mask: radial-gradient(closest-side, #000 72%, transparent 100%); user-select: none; }
.cs-card-pic.is-emoji { font-size: calc(var(--cw) * .42); }
.cs-card-name { position: relative; width: 100%; text-align: center; font: 600 clamp(12px, calc(var(--cw) * .088), 15px)/1.12 var(--f-label); letter-spacing: .02em; color: #efe3cc; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.24em; }
.cs-card-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--c); box-shadow: 0 0 12px 1px var(--c); }
.cs-card.r-legend { background: linear-gradient(180deg, #3a2a10, #1b1308); }
.cs-card.r-epic { background: linear-gradient(180deg, #34190c, #190e07); }
.cs-card.r-rare { background: linear-gradient(180deg, #14263a, #0c141e); }

/* маркер */
.cs-marker { position: absolute; left: 50%; top: 0; bottom: 0; width: 0; z-index: 3; pointer-events: none; }
.cs-marker-line { position: absolute; left: -1.5px; top: 4px; bottom: 4px; width: 3px; border-radius: 2px; background: linear-gradient(180deg, #fff6d8, #ffc23a 50%, #fff6d8); box-shadow: 0 0 10px 2px rgba(255,190,70,.85), 0 0 26px rgba(255,140,40,.6); }
.cs-marker-t, .cs-marker-b { position: absolute; left: -11px; width: 0; height: 0; border: 11px solid transparent; filter: drop-shadow(0 0 6px rgba(255,190,70,.9)); }
.cs-marker-t { top: -6px; border-top-color: #ffd36a; border-bottom-width: 0; }
.cs-marker-b { bottom: -6px; border-bottom-color: #ffd36a; border-top-width: 0; }
.cs-reel.tick .cs-marker-t { animation: cs-tick .1s ease-out; }
.cs-reel.tick .cs-marker-b { animation: cs-tick-b .1s ease-out; }
@keyframes cs-tick { 50% { transform: translateY(-3px) rotate(-14deg); } }
@keyframes cs-tick-b { 50% { transform: translateY(3px) rotate(14deg); } }

/* финальная лента: остальные гаснут, она приближается */
.cs-reel { transition: filter .5s, transform .5s cubic-bezier(.2,1,.3,1); }
.cs.is-final .cs-reel.is-stopped .cs-card:not(.is-win) { filter: brightness(.25) saturate(.4); }
.cs.is-final .cs-reel.is-stopped .cs-window { background: rgba(0,0,0,.6); }
.cs.is-final .cs-reel.is-active { transform: scale(1.045); z-index: 2; }
.cs.is-final .cs-vig { background: radial-gradient(110% 80% at 50% 50%, transparent 40%, rgba(0,0,0,.88)); transition: background 1s; }
.cs-reel.is-freeze .cs-card.is-win, .cs-reel.is-freeze .cs-card:nth-child(n) { transition: none; }
.cs-reel.is-freeze .cs-window { box-shadow: inset 0 0 0 2px #fff, inset 0 0 60px rgba(255,255,255,.5); }
.cs-reel-tag { position: absolute; left: 50%; top: 13px; translate: -50% 0; z-index: 4; pointer-events: none; padding: 3px 12px 2px; border-radius: 3px; white-space: nowrap;
  font: 700 12px/1.2 var(--f-label); letter-spacing: .14em; text-transform: uppercase; color: #160d05; background: var(--c); box-shadow: 0 0 16px var(--c); opacity: 0; }
.cs-reel-tag:not(:empty) { animation: cs-tag .5s cubic-bezier(.2,1.8,.4,1) forwards; }
@keyframes cs-tag { from { opacity: 0; transform: scale(1.8); } to { opacity: 1; transform: none; } }
/* ударная волна */
.cs-ring { position: absolute; z-index: 19; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; pointer-events: none; border: 3px solid var(--c); box-shadow: 0 0 18px var(--c), inset 0 0 18px var(--c); opacity: 0; animation: cs-ring .9s cubic-bezier(.1,.7,.3,1) both; }
@keyframes cs-ring { 0% { opacity: 1; transform: scale(.2); } 100% { opacity: 0; transform: scale(calc(var(--s) * 4)); border-width: 1px; } }

/* остановка: победитель вспыхивает, остальные гаснут */
.cs-reel.is-stopped .cs-card:not(.is-win) { filter: brightness(.38) saturate(.5); }
.cs-reel.is-stopped .cs-marker-line { opacity: 0; transition: opacity .25s .1s; }
.cs-reel.is-landed .cs-marker { animation: cs-mpunch .25s ease-out; }
@keyframes cs-mpunch { 40% { transform: scale(1.35); } }
.cs-reel.is-stopped .cs-marker-t { border-top-color: var(--c); }
.cs-reel.is-stopped .cs-marker-b { border-bottom-color: var(--c); }
.cs-reel.is-stopped .cs-window { border-color: color-mix(in srgb, var(--c) 45%, transparent); box-shadow: inset 0 0 40px -10px var(--c), inset 0 10px 18px -12px rgba(0,0,0,.9); }
.cs-card.is-win { z-index: 2; transform: scale(1.1); box-shadow: 0 0 0 2px var(--c), 0 0 26px 2px var(--c), 0 0 60px color-mix(in srgb, var(--c) 50%, transparent); animation: cs-win .9s ease-out; }
.cs-card.is-win .cs-card-bg { background: radial-gradient(90% 70% at 50% 42%, color-mix(in srgb, var(--c) 70%, transparent), transparent 75%); }
@keyframes cs-win { 0% { transform: scale(1); filter: brightness(2.2); } 30% { transform: scale(1.22); } 100% { transform: scale(1.1); } }

/* штамп редкости — над лентами, в шапке */
.cs-head { position: relative; }
.cs-stamp-host { position: absolute; left: 50%; top: calc(50% + 10px); translate: -50% -50%; z-index: 22; pointer-events: none; }
.cs-stamp { white-space: nowrap; font: 900 clamp(30px, 5.6vw, 66px)/1 var(--f-display); text-transform: uppercase; letter-spacing: .04em;
  color: #fff3d6; -webkit-text-stroke: 2px color-mix(in srgb, var(--c) 40%, #000);
  text-shadow: 0 0 18px var(--c), 0 0 46px var(--c), 0 4px 0 color-mix(in srgb, var(--c) 45%, #000);
  animation: cs-stamp 2.4s cubic-bezier(.2,1.6,.4,1) both; }
.cs-stamp.r-epic { color: #ffe1c4; }
.cs-stamp.r-legend span { position: relative; display: inline-block; color: transparent; -webkit-text-stroke: 0; text-shadow: none;
  background: linear-gradient(180deg, #fff6c8 0%, #ffe58a 35%, #ffb000 70%, #c86a00 100%); -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 3px 0 #4a2400) drop-shadow(0 0 3px #4a2400) drop-shadow(0 0 30px #ffb000); }
.cs-stamp.r-legend span::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.95) 50%, transparent 65%) -150% 0 / 250% 100% no-repeat; -webkit-background-clip: text; background-clip: text; color: transparent; animation: cs-sweep 1.2s .35s ease-in-out; }
.cs-stamp.r-legend { animation-name: cs-stamp-l; animation-duration: 2.8s; }
@keyframes cs-sweep { to { background-position: 250% 0; } }
@keyframes cs-stamp { 0% { opacity: 0; transform: scale(2.4) rotate(-6deg); } 14% { opacity: 1; transform: scale(1) rotate(-3deg); } 80% { opacity: 1; transform: scale(1.04) rotate(-3deg); } 100% { opacity: 0; transform: scale(1.08) rotate(-3deg); } }
@keyframes cs-stamp-l { 0% { opacity: 0; transform: scale(2.2) rotate(-6deg); } 12% { opacity: 1; transform: scale(.94) rotate(-3deg); } 18% { transform: scale(1.02) rotate(-3deg); } 85% { opacity: 1; transform: scale(1.06) rotate(-3deg); } 100% { opacity: 0; transform: scale(1.1) rotate(-3deg); } }
.cs-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.cs-from { font: 600 15px/1.2 var(--f-label); letter-spacing: .06em; color: var(--cream-on-night); }

/* ── витрина добычи ── */
.cs-loot { width: 100%; display: grid; align-content: center; justify-items: center; gap: clamp(12px, 2.4vh, 22px); opacity: 0; pointer-events: none; min-height: 0; perspective: 1200px; }
.cs[data-phase="loot"] .cs-loot { opacity: 1; pointer-events: auto; }
.cs[data-phase="loot"] .cs-reels { opacity: 0; pointer-events: none; transition: opacity .25s; }
.cs-prizes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, clamp(200px, 24vw, 340px))); gap: clamp(14px, 2vw, 28px); justify-content: center; }
.cs-prize { --c: #ccc; position: relative; display: grid; grid-template-rows: auto 1fr; justify-items: center; text-align: center; gap: 12px; padding: clamp(16px, 2.8vh, 26px) 16px clamp(16px, 2.6vh, 22px); border-radius: 12px; isolation: isolate; overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 20%, #1e150e), #120c08 72%);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 70%, transparent), 0 0 40px -4px color-mix(in srgb, var(--c) 65%, transparent), 0 20px 34px -14px rgba(0,0,0,.9);
  backface-visibility: hidden; animation: cs-deal .75s cubic-bezier(.2,1.3,.4,1) var(--d) both; }
@keyframes cs-deal { 0% { opacity: 0; transform: translateY(60px) rotateY(180deg) scale(.6); } 55% { opacity: 1; } 100% { transform: none; } }
.cs-prize::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--c); box-shadow: 0 0 16px 2px var(--c); }
.cs-prize-rays { position: absolute; z-index: -1; left: 50%; top: 32%; width: 260%; aspect-ratio: 1; translate: -50% -50%; opacity: .55;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--c) 45%, transparent) 0 6deg, transparent 6deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 0, transparent 34%); mask: radial-gradient(circle, #000 0, transparent 34%); animation: cs-spin 24s linear infinite; }
.cs-prize-shine { position: absolute; inset: 0; z-index: 3; pointer-events: none; display: none; background: linear-gradient(110deg, transparent 35%, rgba(255,246,210,.38) 50%, transparent 65%) -150% 0 / 250% 100% no-repeat; animation: cs-sweep 2.6s calc(var(--d) + .8s) ease-in-out infinite; }
.cs-prize.r-legend .cs-prize-shine, .cs-prize.r-epic .cs-prize-shine { display: block; }
.cs-prize.r-common .cs-prize-rays { opacity: .25; }
.cs-prize.r-legend { background: linear-gradient(180deg, #5a3e0c, #1a1006 72%); box-shadow: inset 0 0 0 2px #ffc23d, 0 0 60px 0 rgba(255,176,0,.6), 0 20px 34px -14px rgba(0,0,0,.9); }
.cs-prize.r-legend .cs-prize-rays { opacity: 1; }
.cs-prize-pic { width: clamp(90px, min(12vw, 19vh), 168px); aspect-ratio: 1; display: grid; place-items: center; animation: cs-bob 3s ease-in-out calc(var(--d) + .8s) infinite; }
.cs-prize-pic img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; -webkit-mask: radial-gradient(closest-side, #000 74%, transparent 100%); mask: radial-gradient(closest-side, #000 74%, transparent 100%); filter: drop-shadow(0 0 18px color-mix(in srgb, var(--c) 60%, transparent)); }
.cs-prize-pic.is-cutout img, .cs-card-pic.is-cutout img { -webkit-mask: none; mask: none; border-radius: 0; }
.cs-prize-pic.is-emoji { font-size: 64px; }
@keyframes cs-bob { 50% { transform: translateY(-5px); } }
.cs-prize-txt { display: grid; align-content: start; gap: 5px; min-width: 0; }
.cs-prize-r { font: 700 12px/1.2 var(--f-label); letter-spacing: .14em; text-transform: uppercase; color: var(--c); text-shadow: 0 0 10px color-mix(in srgb, var(--c) 60%, transparent); }
.cs-prize-name { font: 700 clamp(17px, 1.7vw, 22px)/1.15 var(--f-label); color: #fff4de; }
.cs-prize-desc { margin: 2px 0 0; font: 400 13.5px/1.4 var(--f-body); color: #cdbfa6; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.cs-bonuses { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; animation: cs-pop .6s cubic-bezier(.2,1.6,.4,1) calc(var(--n, 3) * 150ms + .5s) both; }
@keyframes cs-pop { from { opacity: 0; transform: scale(.4); } }
.cs-bonus { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 20px 6px 6px; border-radius: 999px; background: linear-gradient(180deg, rgba(159,207,232,.16), rgba(159,207,232,.06)); box-shadow: inset 0 0 0 1px rgba(159,207,232,.35), 0 0 22px -6px rgba(159,207,232,.5); }
.cs-bonus-pic { width: 42px; height: 42px; display: grid; place-items: center; }
.cs-bonus-pic img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.cs-bonus b { font: 700 17px/1 var(--f-label); color: #eaf6ff; letter-spacing: .04em; }

/* кнопки */
.cs-actions { z-index: 5; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; align-items: center; min-height: 58px; padding-top: 10px; }
.cs-go { min-width: 240px; font-size: 19px; letter-spacing: .1em; --bg: linear-gradient(180deg, #ef7a32, #c9431b); box-shadow: 0 4px 0 var(--bd), 0 0 28px rgba(242,146,51,.5), inset 0 1px 0 rgba(255,255,255,.3); animation: cs-cta 2.2s ease-in-out infinite; }
@keyframes cs-cta { 50% { box-shadow: 0 4px 0 var(--bd), 0 0 44px rgba(242,146,51,.85), inset 0 1px 0 rgba(255,255,255,.3); } }
.cs-go[disabled] { animation: none; opacity: 0; transition: opacity .2s; filter: none; }
.cs-skip { color: var(--muted-on-night); min-height: 44px; min-width: 150px; font-size: 14px; opacity: .65; --bd: rgba(241,230,207,.3); }
.cs-skip:hover, .cs-skip:focus-visible { opacity: 1; color: var(--cream-on-night); }
.cs-more { --bg: linear-gradient(180deg, #ef7a32, #c9431b); box-shadow: 0 4px 0 var(--bd), 0 0 24px rgba(242,146,51,.45), inset 0 1px 0 rgba(255,255,255,.3); }
.cs-done { min-height: 54px; min-width: 150px; font-size: 16px; }
.cs[data-phase="loot"] .cs-actions > * { animation: cs-pop .5s cubic-bezier(.2,1.5,.4,1) .7s both; }

/* ── телефон ── */
@media (max-width: 640px) {
  .cs { --cw: clamp(92px, 27vw, 112px); --gap: 7px; padding-inline: 0; }
  .cs-head { padding-inline: 56px; }
  .cs-title { font-size: clamp(24px, 7.4vw, 32px); }
  .cs-stamp { font-size: clamp(28px, 9vw, 44px); -webkit-text-stroke-width: 1.5px; }
  .cs-window { -webkit-mask: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
  .cs-loot { padding-inline: 14px; align-content: center; }
  .cs-prizes { grid-template-columns: 1fr; width: 100%; gap: 10px; }
  .cs-prize { grid-template-columns: 78px 1fr; grid-template-rows: none; text-align: left; justify-items: start; align-items: center; gap: 12px; padding: 10px 14px 13px 10px; }
  .cs-prize-rays { left: 48px; top: 50%; width: 220px; }
  .cs-prize-pic { width: 78px; }
  .cs-prize-desc { -webkit-line-clamp: 3; font-size: 12.5px; }
  .cs-prize-name { font-size: 17px; }
  .cs-actions { padding-inline: 14px; }
  .cs-actions .btn { flex: 1 1 auto; }
  .cs-odds-l { font-size: 11px; gap: 4px 10px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .cs { --cw: clamp(64px, 15vh, 90px); padding-top: 8px; padding-bottom: 8px; }
  .cs-title { font-size: 22px; } .cs-sub { margin-top: 2px; }
  .cs-reels { gap: 8px; }
  .cs-intro { grid-auto-flow: column; align-items: center; }
  .cs-chest { width: clamp(140px, 48vh, 240px); }
  .cs-prizes { grid-template-columns: repeat(var(--n), minmax(0, 260px)); }
  .cs-prize { grid-template-columns: 56px 1fr; grid-template-rows: none; text-align: left; justify-items: start; align-items: center; gap: 10px; padding: 8px 12px 10px 8px; }
  .cs-prize-desc { display: none; }
  .cs-prize-pic { width: 56px; }
  .cs-prize-name { font-size: 15px; }
  .cs-bonus { min-height: 40px; } .cs-bonus-pic { width: 32px; height: 32px; }
  .cs-actions { min-height: 48px; padding-top: 6px; } .cs-actions .btn--lg { min-height: 46px; }
}

/* без анимаций: сразу витрина */
.cs.is-rm *, .cs.is-rm *::before, .cs.is-rm *::after { animation: none !important; transition: none !important; }
.cs-head:has(.cs-stamp) > :is(.cs-title, .cs-sub) { opacity: 0; transition: opacity .15s; }
@media (max-width: 640px) { .cs-stamp { font-size: clamp(24px, 8.2vw, 40px); } }

.cs:has(.cs-stamp) .cs-reel-tag { opacity: 0 !important; animation: none; }
.cs[data-phase="loot"] .cs-rays--2 { opacity: 0; }
.case-modal .btn:focus { outline: none; }
.case-modal .btn:focus-visible, .case-modal .cs-snd:focus-visible, .case-modal .modal-x:focus-visible { outline: 2px solid #ffc23d; outline-offset: 3px; box-shadow: none; }
.cs-prize-r { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cs-prizes.is-solo .cs-prize { min-width: min(340px, 100%); }
@media (max-width: 640px) {
  .cs-prize-desc { -webkit-line-clamp: 4; }
  .cs-prizes.is-solo { width: auto; }
  .cs-prizes.is-solo .cs-prize { grid-template-columns: none; text-align: center; justify-items: center; padding: 22px 18px 20px; min-width: 0; width: min(300px, 82vw); }
  .cs-prizes.is-solo .cs-prize-pic { width: 150px; }
  .cs-prizes.is-solo .cs-prize-rays { left: 50%; top: 34%; width: 260%; }
  .cs-actions .btn { flex: 1 1 0; min-width: 0; padding-inline: .8em; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .cs { --cw: clamp(62px, 18.5vh, 82px); }
  .cs:is([data-phase="spin"], [data-phase="reveal"]) .cs-head { position: absolute; left: 0; right: 0; top: 4px; }
  .cs:is([data-phase="spin"], [data-phase="reveal"]) .cs-title { opacity: 0; }
  .cs:is([data-phase="spin"], [data-phase="reveal"]) { grid-template-rows: 0 minmax(0, 1fr) 0; }
  .cs[data-phase="spin"] .cs-actions { position: absolute; right: 64px; top: 6px; padding: 0; min-height: 0; }
  .cs[data-phase="spin"] .cs-skip { min-height: 40px; min-width: 0; font-size: 12px; }
  .cs-card-name { font-size: 11px; -webkit-line-clamp: 1; min-height: 1.2em; white-space: nowrap; text-overflow: ellipsis; display: block; }
  .cs-card { padding: 6px 4px 9px; }
  .cs-window { height: calc(var(--ch) + 12px); padding: 6px 0; }
  .cs-stamp { font-size: clamp(22px, 7vh, 34px); }
  .cs-stamp-host { top: 18px; position: fixed; }
  .cs-reel-tag { top: 8px; font-size: 10px; }
}
.cs-reel-in { position: relative; }
.cs.is-hush .cs-vig { background: radial-gradient(60% 40% at 50% 50%, rgba(0,0,0,.2), rgba(0,0,0,.95)); transition: background .12s; }
.cs.is-hush .cs-rays { opacity: 0; transition: opacity .12s; }
.cs.is-hush .cs-reel:not(.is-active) { opacity: .25; transition: opacity .12s; }
.cs-card.is-pre { z-index: 2; transform: scale(1.12); box-shadow: 0 0 0 2px #fff, 0 0 30px rgba(255,255,255,.6); transition: transform .12s, box-shadow .12s; }
.cs[data-phase="reveal"] .cs-reels { opacity: 1; }
.cs-prizes { width: 100%; }
.cs-actions .btn { white-space: nowrap; }
@media (max-width: 640px) {
  .cs-actions .cs-more { flex: 1.6 1 0; }
  .cs-actions .cs-done { flex: 1 1 0; }
}
@media (max-width: 370px) { .cs-actions .btn { font-size: 14px; letter-spacing: .04em; } }
@media (max-height: 560px) and (orientation: landscape) {
  .cs-stamp-host { position: fixed; top: 50%; translate: -50% -50%; z-index: 26; padding: 10px 28px; border-radius: 10px; background: rgba(8,4,0,.72); box-shadow: 0 0 60px 30px rgba(8,4,0,.6); }
  .cs-stamp-host:empty { display: none; }
  .cs-card.is-win .cs-card-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; min-height: 2.3em; }
  .cs-card.is-win .cs-card-pic { width: 60%; }
}

/* ── раунд 4 ── */
/* штамп всегда поверх лент: шапка поднимается над сценой, пока он виден */
.cs-head:has(.cs-stamp) { z-index: 24; }
/* портрет: штамп не залезает под кнопки звука и ✕ */
.cs-stamp-host { max-width: calc(100vw - 112px); }
.cs-stamp { max-width: 100%; }
@media (max-width: 640px) { .cs-stamp { font-size: clamp(22px, 7.6vw, 36px); letter-spacing: .02em; } }
/* ландшафт: шапки нет — штамп по центру над лентами на тёмной плашке */
@media (max-height: 560px) and (orientation: landscape) {
  .cs-stamp-host { position: fixed; left: 50%; top: 50%; translate: -50% -50%; z-index: 60; max-width: calc(100vw - 2 * 64px); padding: 8px 20px; border-radius: 12px; background: rgba(20,10,0,.75); box-shadow: 0 0 60px 30px rgba(20,10,0,.55); }
  .cs-stamp { font-size: clamp(26px, 8vh, 36px); }
}
/* легендарный победитель после белого «удара» становится золотым */
.cs-card.is-win { transition: box-shadow .35s ease-out, border-color .35s ease-out; }
.cs-reel.r-legend .cs-card.is-win { border-color: #ffc23d; box-shadow: 0 0 0 2px #ffc23d, 0 0 36px rgba(255,180,0,.7), 0 0 80px rgba(255,170,0,.35);
  background: linear-gradient(180deg, #5a3a0c 0%, #3a2206 55%, #2a1804 100%); overflow: hidden; }
.cs-reel.r-legend .cs-card.is-win .cs-card-bg { background: radial-gradient(90% 70% at 50% 42%, rgba(255,200,70,.75), rgba(255,150,0,.2) 55%, transparent 78%); }
.cs-reel.r-legend .cs-card.is-win .cs-card-name { color: #ffe7a6; }
.cs-reel.r-legend .cs-card.is-win::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 3; border-radius: inherit;
  background: linear-gradient(110deg, transparent 35%, rgba(255,250,220,.7) 50%, transparent 65%) -150% 0 / 250% 100% no-repeat; animation: cs-sweep .9s .25s ease-in-out both; }
/* маркер золотеет в «тишине» перед легендаркой */
.cs.is-hush .cs-reel.is-active .cs-marker-t { border-top-color: #ffc23d; }
.cs.is-hush .cs-reel.is-active .cs-marker-b { border-bottom-color: #ffc23d; }
.cs.is-hush .cs-reel.is-active .cs-marker-line { background: #ffc23d; box-shadow: 0 0 12px #ffc23d; }
/* переход к витрине: сначала уходят ленты, потом заголовок и подзаголовок — вместе */
.cs[data-phase="loot"] .cs-title { animation: cs-title .6s cubic-bezier(.2,1.7,.4,1) .3s both; }
.cs[data-phase="loot"] .cs-sub { animation: cs-subin .45s ease-out .3s both; }
@keyframes cs-subin { from { opacity: 0; transform: translateY(6px); } }
/* ландшафт: штамп чуть выше центра, плашка плотнее — не закрывает победителя нижней ленты */
@media (max-height: 560px) and (orientation: landscape) {
  .cs-stamp-host { top: 38%; background: rgba(20,10,0,.85); }
}
/* обычный приз — тёплое свечение каймы, чтобы не выглядел «понижением» */
.cs-prize.r-common { box-shadow: 0 0 0 1px rgba(217,195,160,.45), 0 0 24px rgba(217,195,160,.35); }
