/* Roulette table, Daily Level Cases with their opening animation, the battle
   lobby rows, the create-battle page and the full-screen big win. Uses the
   design tokens from base.css. */

/* ---------- Roulette table ---------- */
.roulette-stage {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  justify-content: center;
  min-height: 370px;
}
.stage canvas.roulette-table {
  background: transparent;
  border-radius: 20px;
  box-shadow: var(--shadow-2);
  cursor: pointer;
}

/* ---------- Daily Level Cases ---------- */
.daily-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s3);
  flex-wrap: wrap;
  margin-bottom: var(--s3);
}
.daily-head .kicker {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.daily-head h1 {
  font-size: var(--fs-2xl);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.daily-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(60, 207, 142, 0.35);
  background: var(--green-soft);
  color: var(--green);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.daily-pill .icon {
  width: 13px;
  height: 13px;
}
.lvl-cases {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--s3);
}
.lvl-case {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 206px;
  padding: 34px var(--s3) var(--s4);
  border-radius: var(--r-md);
  border: 1px solid rgba(242, 196, 74, 0.38);
  background: radial-gradient(120% 75% at 50% 0%, color-mix(in srgb, var(--trim) 13%, transparent), transparent 70%), rgba(21, 23, 26, 0.86);
  color: var(--text);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.lvl-case:hover {
  transform: translateY(-4px);
  border-color: rgba(242, 196, 74, 0.7);
  box-shadow: 0 18px 40px -18px var(--trim);
}
.lvl-badge {
  position: absolute;
  top: 9px;
  left: 9px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px 2px 7px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(242, 196, 74, 0.5);
  background: rgba(242, 196, 74, 0.1);
  color: var(--gold-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.lvl-badge .icon {
  width: 11px;
  height: 11px;
}
.lvl-lock {
  position: absolute;
  top: 11px;
  right: 11px;
  width: 15px;
  height: 15px;
  color: var(--text-dim);
}
.lvl-lock[hidden] {
  display: none;
}
.lvl-art {
  position: relative;
  width: 112px;
  height: 104px;
  filter: drop-shadow(0 0 16px color-mix(in srgb, var(--trim) 45%, transparent));
  transition: transform 0.25s;
}
.lvl-chest {
  position: absolute;
  inset: -4px 0 0;
}
.lvl-chest svg,
.lvl-item svg {
  display: block;
  width: 100%;
  height: 100%;
}
.lvl-item {
  position: absolute;
  width: 44px;
  height: 44px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
}
.lvl-item.a {
  left: 6px;
  bottom: 2px;
}
.lvl-item.b {
  right: 6px;
  bottom: 12px;
  width: 40px;
  height: 40px;
}
.lvl-case:hover .lvl-art {
  transform: scale(1.07) rotate(-2deg);
}
.lvl-name {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.lvl-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 20px;
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.lvl-status .icon {
  width: 13px;
  height: 13px;
}
.lvl-status.cooldown {
  color: var(--gold-2);
}
.lvl-status.ready {
  padding: 1px 12px;
  border-radius: var(--r-pill);
  background: var(--gold-2);
  color: #1d1505;
  text-transform: uppercase;
}
.lvl-case.ready {
  border-color: rgba(242, 196, 74, 0.75);
  box-shadow: 0 0 0 1px rgba(242, 196, 74, 0.25), 0 0 26px -10px var(--gold-2);
}
.lvl-case.ready .lvl-art {
  animation: bob 3s ease-in-out infinite;
}
.lvl-case.locked {
  border-color: var(--hairline);
  background: rgba(16, 17, 20, 0.7);
  cursor: default;
}
.lvl-case.locked:hover {
  transform: none;
  border-color: var(--line);
  box-shadow: none;
}
.lvl-case.locked .lvl-art {
  filter: grayscale(1) brightness(0.55);
  transform: none;
}
.lvl-case.locked .lvl-name {
  color: var(--text-muted);
}
.lvl-case.locked .lvl-badge {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text-dim);
}
/* ---------- Daily case opening animation ---------- */
.dopen {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(70% 60% at 50% 45%, rgba(20, 22, 26, 0.9), rgba(5, 6, 7, 0.97));
  backdrop-filter: blur(6px);
  animation: dopen-in 0.3s ease-out;
}
.dopen.out {
  opacity: 0;
  transition: opacity 0.3s;
}
@keyframes dopen-in {
  from {
    opacity: 0;
  }
}
.dopen-rays {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 180vmax;
  height: 180vmax;
  margin: -90vmax 0 0 -90vmax;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--glow) 22%, transparent) 0 7deg, transparent 7deg 20deg);
  mask-image: radial-gradient(closest-side, #000 0, transparent 62%);
  -webkit-mask-image: radial-gradient(closest-side, #000 0, transparent 62%);
  opacity: 0;
  transition: opacity 0.6s;
  animation: cos-spin 28s linear infinite;
}
.dopen.opened .dopen-rays {
  opacity: 1;
}
.dopen-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 42%, #fff, var(--glow) 30%, transparent 70%);
  opacity: 0;
  pointer-events: none;
}
.dopen.opened .dopen-flash {
  animation: dopen-flash 0.7s ease-out;
}
@keyframes dopen-flash {
  0% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
  }
}
.dopen-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s4);
  width: min(720px, 94vw);
  padding: var(--s4);
}
.dopen-caption {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--glow);
  text-shadow: 0 0 24px color-mix(in srgb, var(--glow) 50%, transparent);
}
.dopen-chest-wrap {
  position: relative;
  width: 220px;
  height: 220px;
}
.dopen-chest {
  width: 100%;
  height: 100%;
  transform-origin: 50% 85%;
  animation: dopen-drop 0.45s cubic-bezier(0.3, 1.5, 0.5, 1);
  filter: drop-shadow(0 0 30px color-mix(in srgb, var(--glow) 45%, transparent));
}
.dopen-chest svg {
  width: 100%;
  height: 100%;
}
@keyframes dopen-drop {
  from {
    transform: translateY(-70vh) scale(0.6);
  }
}
.dopen.shaking .dopen-chest {
  animation: dopen-shake 0.16s linear infinite, dopen-swell 1.5s ease-in forwards;
}
@keyframes dopen-shake {
  0%,
  100% {
    rotate: -5deg;
    translate: -3px 0;
  }
  50% {
    rotate: 5deg;
    translate: 3px -2px;
  }
}
@keyframes dopen-swell {
  to {
    transform: scale(1.14);
    filter: drop-shadow(0 0 60px var(--glow)) brightness(1.5);
  }
}
.dopen.opened .dopen-chest {
  animation: dopen-pop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes dopen-pop {
  0% {
    transform: scale(1.35);
    filter: brightness(3);
  }
}
.dopen-beam {
  position: absolute;
  left: 50%;
  bottom: 48%;
  width: 150px;
  height: 60vh;
  margin-left: -75px;
  background: linear-gradient(0deg, color-mix(in srgb, var(--glow) 65%, transparent), transparent);
  clip-path: polygon(34% 100%, 66% 100%, 100% 0, 0 0);
  opacity: 0;
  transform-origin: 50% 100%;
  transform: scaleY(0);
  transition: transform 0.5s ease-out, opacity 0.5s;
}
.dopen.opened .dopen-beam {
  opacity: 0.55;
  transform: scaleY(1);
}
.dopen-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--s2);
  width: 100%;
  min-height: 118px;
}
.dopen-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--s3) var(--s1);
  border-radius: var(--r-md);
  border: 2px solid color-mix(in srgb, var(--rarity) 45%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--rarity) 14%, var(--surface-2)), var(--surface-1));
  opacity: 0;
  transform: translateY(-90px) scale(0.3);
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s, opacity 0.3s, filter 0.3s;
}
.dopen.opened .dopen-card {
  animation: dopen-card-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) calc(var(--i) * 70ms + 150ms) forwards;
}
@keyframes dopen-card-in {
  to {
    opacity: 1;
    transform: none;
  }
}
.dopen-coin {
  width: 34px;
  height: 34px;
}
.dopen-coin svg {
  width: 100%;
  height: 100%;
}
.dopen-coins {
  font-size: var(--fs-lg);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.dopen-rarity {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rarity);
}
.dopen-card.lit {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--rarity), 0 0 28px var(--rarity);
  scale: 1.07;
}
.dopen.revealed .dopen-card:not(.won) {
  filter: grayscale(0.8) brightness(0.5);
  scale: 0.94;
}
.dopen.revealed .dopen-card.won {
  border-color: #fff;
  box-shadow: 0 0 0 3px var(--rarity), 0 0 50px var(--rarity);
  scale: 1.16;
  z-index: 1;
  animation: dopen-card-in 0.5s forwards, dopen-won 1.1s ease-in-out infinite alternate;
}
@keyframes dopen-won {
  to {
    box-shadow: 0 0 0 3px var(--rarity), 0 0 80px var(--rarity);
  }
}
.dopen-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 74px;
}
.dopen-result .big {
  font-size: 40px;
  font-weight: 750;
  color: var(--gold-2);
  animation: pop 0.45s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.dopen-collect {
  min-width: 200px;
  min-height: 46px;
  font-size: var(--fs-lg);
}
.dopen-collect[hidden] {
  display: none;
}

/* ---------- Battle lobby rows ---------- */
.blobby-head {
  display: flex;
  align-items: center;
  gap: var(--s4);
  flex-wrap: wrap;
  margin: var(--s4) 0 var(--s3);
}
.blobby-head h2 {
  font-size: var(--fs-2xl);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.blobby-sort {
  width: auto;
}
.blobby-stats {
  display: flex;
  gap: var(--s4);
  margin-left: auto;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.blobby-stats b {
  color: var(--text);
}
.blobby-stats .joinable,
.blobby-stats .joinable b {
  color: var(--green);
}
.blobby-create .plus,
.bcreate-drop .plus {
  font-size: 20px;
  line-height: 1;
  font-weight: 500;
}
.blobby-list {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}
.blobby-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  padding: var(--s6);
  border-radius: var(--r-md);
  border: 1px dashed var(--line-strong);
}
.brow {
  display: grid;
  grid-template-columns: 64px minmax(150px, 190px) minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: var(--s4);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-1);
  box-shadow: inset 0 1px 0 var(--hairline);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.brow:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.brow.open {
  border-color: rgba(60, 207, 142, 0.35);
}
.brow.running {
  border-color: rgba(242, 196, 74, 0.45);
}
.brow.mine {
  box-shadow: inset 3px 0 0 var(--gold-2);
}
.brow.done {
  opacity: 0.78;
}
.brow-rounds {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.brow-rounds b {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-0);
  font-size: var(--fs-xl);
  font-weight: 750;
}
.brow-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.brow-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.brow.open .brow-status {
  color: var(--green);
}
.brow.running .brow-status {
  color: var(--gold-2);
}
.brow.running .brow-status .dot {
  animation: cos-pulse 1s ease-in-out infinite;
}
.brow-creator {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-width: 0;
}
.brow-creator > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brow-creator .label,
.brow-cost .label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.brow-cases {
  display: flex;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
  padding: 6px;
  border-radius: var(--r-sm);
  background: var(--surface-0);
  border: 1px solid var(--hairline);
  overflow-x: auto;
  scrollbar-width: thin;
}
.brow-case {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 74px;
  padding: 4px 2px;
  border-radius: 6px;
  border: 1px solid transparent;
}
.brow-case .case-art {
  width: 44px;
  height: 44px;
}
.brow-case-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}
.brow-case.live {
  border-color: var(--gold-2);
  background: var(--gold-soft);
}
.brow-case.played {
  opacity: 0.45;
}
.brow-cost {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 96px;
}
.brow-cost .coin-amount {
  font-size: var(--fs-xl);
  font-weight: 750;
}
.brow-players {
  display: flex;
  align-items: center;
  gap: 6px;
}
.brow-players .seat-mini.empty {
  width: 32px;
  height: 32px;
}
.brow-players .seat-mini.won {
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--gold-2), 0 0 14px var(--gold-2);
}
.brow-count {
  margin-left: 2px;
  font-size: var(--fs-xs);
  font-weight: 650;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.brow-btn {
  min-width: 92px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.brow-btn-cost {
  opacity: 0.75;
  font-weight: 600;
}

/* ---------- Create battle ---------- */
.bcreate-head {
  display: flex;
  align-items: center;
  gap: var(--s4);
  margin-bottom: var(--s4);
}
.bcreate-head h2 {
  font-size: var(--fs-2xl);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bcreate {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 280px;
  gap: var(--s4);
  align-items: start;
}
.bcreate .panel + .panel {
  margin-top: 0;
}
.bcreate-side,
.bcreate-cart {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  position: sticky;
  top: calc(var(--topbar-h) + var(--s4));
}
.bcreate .label {
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.bcreate-players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  gap: var(--s2);
}
.bcreate-players button {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--s2);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
}
.bcreate-players button b {
  font-size: var(--fs-xl);
  color: var(--text);
}
.bcreate-players button span {
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.bcreate-players button:hover {
  background: var(--surface-3);
}
.bcreate-players button.active,
.bcreate-mode.active {
  border-color: var(--gold-2);
  background: var(--gold-soft);
}
.bcreate-mode {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.bcreate-mode > .icon {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--gold-2);
}
.bcreate-mode > div {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.bcreate-mode.toggle-row {
  cursor: pointer;
}
.bcreate-mode input {
  width: 18px;
  height: 18px;
  accent-color: var(--gold-2);
}
.bcreate-main {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  min-width: 0;
}
.bcreate-tools {
  display: flex;
  gap: var(--s3);
  align-items: center;
  flex-wrap: wrap;
}
.bcreate-tools .segmented {
  width: auto;
}
.bcreate-search {
  position: relative;
  flex: 1;
  min-width: 180px;
}
.bcreate-search .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  color: var(--text-dim);
  pointer-events: none;
}
.bcreate-search .input {
  padding-left: 36px;
}
.bcreate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--s3);
  max-height: 640px;
  overflow-y: auto;
  padding: 2px 4px 2px 2px;
  scrollbar-width: thin;
}
.bcase {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--s3);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-align: center;
  transition: border-color 0.15s, transform 0.15s;
}
.bcase:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}
.bcase.picked {
  border-color: rgba(242, 196, 74, 0.55);
}
.bcase .case-art {
  width: 72px;
  height: 72px;
}
.bcase-name {
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bcase .coin-amount {
  color: var(--green);
  margin-bottom: 4px;
}
.bcase-count {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--gold-2);
  color: #1d1505;
  font-size: 11px;
  font-weight: 750;
}
.bcreate-picked {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  min-height: 190px;
}
.bcreate-drop {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 190px;
  border-radius: var(--r-md);
  border: 2px dashed var(--line-strong);
  color: var(--text-dim);
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
}
.bcreate-drop .hint {
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
}
.bpicked {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 6px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  animation: msg-in 0.2s ease-out;
}
.bpicked-n {
  width: 18px;
  text-align: center;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-dim);
}
.bpicked .case-art {
  flex: none;
  width: 40px;
  height: 40px;
}
.bpicked-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sm);
}
.bpicked-info b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bcreate-sum {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
}
.bcreate-total {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-3xl);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.bcreate-total .coin {
  width: 26px;
  height: 26px;
}

/* ---------- Big hits inside a battle ---------- */
.reel-cell.big {
  box-shadow: inset 0 0 0 2px var(--rarity), 0 0 30px var(--rarity);
}
.battle-seat.big-hit,
.battle-row.big-hit {
  animation: big-hit 1.4s ease-out;
}
@keyframes big-hit {
  0% {
    box-shadow: 0 0 0 4px var(--gold-2), 0 0 70px var(--gold-2);
    transform: scale(1.03);
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
    transform: none;
  }
}
.case-reels.big-win {
  animation: reel-quake 0.5s linear;
}
@keyframes reel-quake {
  20% {
    transform: translate(-6px, 3px);
  }
  40% {
    transform: translate(6px, -4px);
  }
  60% {
    transform: translate(-4px, -2px);
  }
  80% {
    transform: translate(3px, 2px);
  }
}

/* ---------- Full-screen big win ---------- */
.bigwin {
  position: fixed;
  inset: 0;
  z-index: 185;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  background: radial-gradient(60% 55% at 50% 50%, rgba(18, 19, 22, 0.72), rgba(4, 5, 6, 0.93));
  animation: dopen-in 0.25s ease-out;
}
.bigwin.out {
  opacity: 0;
  transition: opacity 0.35s;
}
.bigwin-rays {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 200vmax;
  height: 200vmax;
  margin: -100vmax 0 0 -100vmax;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--accent) 30%, transparent) 0 6deg, transparent 6deg 18deg);
  mask-image: radial-gradient(closest-side, #000 0, transparent 55%);
  -webkit-mask-image: radial-gradient(closest-side, #000 0, transparent 55%);
  animation: cos-spin 22s linear infinite, bigwin-rays-in 0.8s ease-out;
}
@keyframes bigwin-rays-in {
  from {
    opacity: 0;
    scale: 0.3;
  }
}
.bigwin-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 240px;
  height: 240px;
  margin: -120px 0 0 -120px;
  border-radius: 50%;
  border: 6px solid var(--accent);
  opacity: 0;
  animation: bigwin-ring 1s ease-out forwards;
}
.bigwin-ring.late {
  animation-delay: 0.25s;
  border-color: #fff;
  border-width: 3px;
}
@keyframes bigwin-ring {
  0% {
    opacity: 0.9;
    transform: scale(0.2);
  }
  100% {
    opacity: 0;
    transform: scale(6);
  }
}
.bigwin-body {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4);
  text-align: center;
}
.bigwin-title {
  display: flex;
  font-family: var(--font-display);
  font-size: clamp(44px, 9vw, 104px);
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.02em;
  line-height: 1;
}
.bigwin-title span {
  display: inline-block;
  background: linear-gradient(180deg, #fff 10%, #fff1bd 40%, var(--gold-2) 60%, var(--gold-dark));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.55)) drop-shadow(0 0 26px color-mix(in srgb, var(--accent) 70%, transparent));
  animation: bigwin-letter 0.55s cubic-bezier(0.2, 1.7, 0.4, 1) calc(var(--i) * 45ms) backwards, bigwin-wave 1.6s ease-in-out calc(var(--i) * 80ms + 0.8s) infinite;
}
@keyframes bigwin-letter {
  from {
    opacity: 0;
    transform: translateY(-120px) scale(2.4) rotate(-14deg);
  }
}
@keyframes bigwin-wave {
  50% {
    transform: translateY(-8px);
  }
}
.bigwin-art {
  display: grid;
  place-items: center;
  width: 168px;
  height: 168px;
  border-radius: 28px;
  border: 3px solid var(--accent);
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--accent) 35%, #15171a), #0c0d0f 75%);
  box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.35), 0 0 70px color-mix(in srgb, var(--accent) 70%, transparent);
  animation: bigwin-art 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) 0.2s backwards, bigwin-float 2.4s ease-in-out 0.9s infinite;
}
.bigwin-art svg {
  width: 112px;
  height: 112px;
}
@keyframes bigwin-art {
  from {
    opacity: 0;
    transform: scale(0.1) rotate(-200deg);
  }
}
@keyframes bigwin-float {
  50% {
    transform: translateY(-8px) rotate(2deg);
  }
}
.bigwin-name {
  font-size: var(--fs-xl);
  font-weight: 650;
  color: var(--text);
  text-shadow: 0 2px 8px #000;
}
.bigwin-value {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s5) var(--s2) var(--s3);
  border-radius: var(--r-pill);
  border: 1px solid rgba(242, 196, 74, 0.6);
  background: rgba(10, 11, 13, 0.82);
  font-size: clamp(30px, 5vw, 52px);
  font-weight: 800;
  color: var(--gold-2);
  font-variant-numeric: tabular-nums;
  animation: pop 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) 0.35s backwards;
}
.bigwin-value .coin {
  width: 1em;
  height: 1em;
}
.bigwin.counted .bigwin-value {
  animation: bigwin-count 0.5s ease-out;
}
@keyframes bigwin-count {
  30% {
    transform: scale(1.18);
    box-shadow: 0 0 60px var(--gold-2);
  }
}
.bigwin-mult {
  padding: 2px 14px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #0b0c0e;
  font-size: var(--fs-xl);
  font-weight: 800;
  animation: pop 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) 0.55s backwards;
}
.bigwin.huge .bigwin-art {
  width: 200px;
  height: 200px;
}
.bigwin.huge .bigwin-art svg {
  width: 144px;
  height: 144px;
}

@media (max-width: 1180px) {
  .lvl-cases {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .bcreate {
    grid-template-columns: 200px minmax(0, 1fr);
  }
  .bcreate-cart {
    grid-column: 1 / -1;
    position: static;
  }
  .bcreate-picked,
  .bcreate-drop {
    min-height: 90px;
  }
  .brow {
    grid-template-columns: 64px minmax(0, 1fr) auto auto;
  }
  .brow-cases {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .brow-players {
    display: none;
  }
}
@media (max-width: 720px) {
  .lvl-cases {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bcreate {
    grid-template-columns: 1fr;
  }
  .bcreate-side {
    position: static;
  }
  .brow {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: var(--s3);
  }
  .brow-cost {
    grid-column: 2;
    align-items: flex-start;
  }
  .dopen-chest-wrap {
    width: 160px;
    height: 160px;
  }
  .dopen-coins {
    font-size: var(--fs-sm);
  }
  .dopen-rarity {
    display: none;
  }
}
.bcase .btn {
  min-height: 34px;
  padding: 6px var(--s2);
  font-size: var(--fs-sm);
}
@media (prefers-reduced-motion: reduce) {
  .lvl-case.ready .lvl-art {
    animation: none;
  }
}

/* ---------- Item pictures (image files instead of drawn sprites) ---------- */
img.item-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
}
img.item-img.pixel {
  image-rendering: pixelated;
}

/* ---------- Admin dashboard ---------- */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--s4);
}
.admin-grid .panel + .panel {
  margin-top: 0;
}
.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s2);
  margin-bottom: var(--s3);
}
.admin-form {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  margin-bottom: var(--s2);
}

/* Daily case rewards are items now: bigger picture, item name instead of the rarity label. */
.dopen-coin {
  width: 52px;
  height: 52px;
}
.dopen-rarity {
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
}
/* Short windows: let the opening scroll instead of cutting off its top. */
.dopen {
  overflow-y: auto;
}
.dopen-stage {
  margin-block: auto;
}

/* ---------- Big win lines in the chat ---------- */
.chat-event.bigwin-line {
  border-color: rgba(242, 196, 74, 0.45);
  background: linear-gradient(90deg, rgba(242, 196, 74, 0.16), transparent 80%), var(--surface-1);
}
.chat-event.bigwin-line .icon {
  color: var(--gold-2);
}
.chat-event.bigwin-line.mega {
  border-color: rgba(239, 91, 107, 0.55);
  background: linear-gradient(90deg, rgba(239, 91, 107, 0.18), transparent 80%), var(--surface-1);
}
.chat-event.bigwin-line.epic {
  border-color: rgba(167, 123, 232, 0.6);
  background: linear-gradient(90deg, rgba(167, 123, 232, 0.22), rgba(242, 196, 74, 0.1) 60%, transparent), var(--surface-1);
  animation: bigwin-line 2.4s ease-in-out 3;
}
@keyframes bigwin-line {
  50% {
    box-shadow: 0 0 18px rgba(167, 123, 232, 0.5);
  }
}
.admin-form.row {
  flex-direction: row;
  align-items: flex-end;
}
.admin-form.row .field {
  flex: 1;
}
.admin-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-bottom: var(--s2);
}
.chip-btn {
  padding: 4px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
}
.chip-btn:hover {
  border-color: var(--gold-2);
}
.admin-player {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding: var(--s3);
  margin-bottom: var(--s3);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-0);
}
.admin-player[hidden],
.admin-actions[hidden] {
  display: none;
}
.admin-player-head {
  display: flex;
  gap: var(--s2);
  align-items: baseline;
  flex-wrap: wrap;
}
.admin-actions {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  margin-bottom: var(--s2);
}
.admin-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s2);
}
.admin-buttons.danger .btn {
  color: var(--red);
  border-color: rgba(240, 96, 111, 0.35);
}

/* ---------- Win tiers: mega and epic full-screen moments ---------- */
.bigwin-sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.bigwin.tier-mega .bigwin-sky {
  background: radial-gradient(60% 50% at 50% 45%, rgba(255, 90, 122, 0.28), transparent 70%), radial-gradient(40% 40% at 20% 20%, rgba(167, 123, 232, 0.25), transparent 70%);
  animation: sky-pulse 0.9s ease-in-out infinite alternate;
}
.bigwin.tier-epic .bigwin-sky {
  background: conic-gradient(from 0deg at 50% 45%, rgba(255, 90, 122, 0.3), rgba(242, 196, 74, 0.3), rgba(60, 207, 142, 0.3), rgba(90, 158, 240, 0.3), rgba(185, 139, 255, 0.3), rgba(255, 90, 122, 0.3));
  mask-image: radial-gradient(closest-side, #000 20%, transparent 85%);
  -webkit-mask-image: radial-gradient(closest-side, #000 20%, transparent 85%);
  animation: cos-spin 8s linear infinite;
}
@keyframes sky-pulse {
  to {
    opacity: 0.55;
  }
}
.bigwin.tier-epic .bigwin-rays {
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.22) 0 4deg, transparent 4deg 12deg);
  animation-duration: 10s;
}
.bigwin-bolts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 46%, rgba(255, 255, 255, 0.95) 47%, transparent 48%), linear-gradient(70deg, transparent 62%, rgba(255, 240, 200, 0.85) 63%, transparent 64%);
  opacity: 0;
  animation: bolts 1.3s steps(1) 4;
}
@keyframes bolts {
  0%,
  100% {
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  14% {
    opacity: 0;
  }
  22% {
    opacity: 0.8;
  }
  28% {
    opacity: 0;
  }
}
.bigwin.tier-mega .bigwin-title,
.bigwin.tier-epic .bigwin-title {
  font-size: clamp(52px, 11vw, 128px);
}
.bigwin.tier-epic .bigwin-title span {
  background: linear-gradient(90deg, #ff5a7a, #f2c44a, #3ccf8e, #5a9ef0, #b98bff, #ff5a7a);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: bigwin-letter 0.55s cubic-bezier(0.2, 1.7, 0.4, 1) calc(var(--i) * 45ms) backwards, bigwin-wave 1.6s ease-in-out calc(var(--i) * 80ms + 0.8s) infinite, rainbow-text 3s linear infinite;
}
@keyframes rainbow-text {
  to {
    background-position: 300% 0;
  }
}
.bigwin-crown {
  font-size: 72px;
  line-height: 1;
  color: #f2c44a;
  text-shadow: 0 0 30px #f2c44a, 0 4px 0 #8a5a08;
  animation: crown-drop 0.8s cubic-bezier(0.2, 1.6, 0.4, 1) backwards, bigwin-float 2.4s ease-in-out 0.8s infinite;
}
@keyframes crown-drop {
  from {
    opacity: 0;
    transform: translateY(-200px) rotate(-30deg) scale(2);
  }
}
.bigwin.tier-mega .bigwin-ring,
.bigwin.tier-epic .bigwin-ring {
  border-width: 10px;
}
.win-shake {
  animation: win-shake 0.6s linear;
}
@keyframes win-shake {
  10%,
  50%,
  90% {
    transform: translate(-6px, 3px);
  }
  30%,
  70% {
    transform: translate(6px, -4px);
  }
}

/* Daily opening with the case reel */
.dopen.reel-mode .dopen-stage {
  width: min(900px, 96vw);
}
.dopen-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.dopen-mini {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--glow) 55%, transparent));
}
.dopen-mini svg {
  width: 100%;
  height: 100%;
}
.dopen-reel {
  width: 100%;
  animation: dopen-in 0.3s ease-out;
}

/* ---------- Create battle, styled like the reference: violet accent, three columns ---------- */
.bcreate {
  --violet: #a855f7;
  --violet-2: #c084fc;
  --violet-soft: rgba(168, 85, 247, 0.16);
  grid-template-columns: 230px minmax(0, 1fr) 270px;
}
.bcreate-head h2 {
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.bcreate-head h2 .icon {
  width: 24px;
  height: 24px;
  color: #a855f7;
}
.bcreate-side,
.bcreate-main,
.bcreate-cart {
  padding: var(--s4);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: rgba(17, 18, 21, 0.92);
}
.bcreate-label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.bcreate-sep {
  height: 1px;
  margin: var(--s1) calc(-1 * var(--s4));
  background: var(--line);
}
.bopt-grid {
  display: grid;
  gap: var(--s2);
}
.bopt-grid.players {
  grid-template-columns: 1fr 1fr;
}
.bopt-grid.teams {
  grid-template-columns: repeat(3, 1fr);
}
.bopt {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface-1);
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.bopt b {
  font-size: var(--fs-xl);
  line-height: 1.1;
  color: var(--text);
}
.bopt.team b {
  font-size: var(--fs-md);
}
.bopt span {
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.bopt:hover {
  border-color: var(--violet);
}
.bopt.active {
  border-color: var(--violet);
  background: var(--violet-soft);
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.35) inset;
}
.bmode-list {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.bmode,
.btoggle {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 9px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface-1);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.bmode > div,
.btoggle > div {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.bmode b,
.btoggle b {
  font-size: var(--fs-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.bmode span:not(.icon),
.btoggle div span {
  font-size: 11px;
  color: var(--text-dim);
}
.bmode > .icon,
.btoggle > .icon {
  width: 18px;
  height: 18px;
  flex: none;
}
.mode-classic > .icon {
  color: #e9d5ff;
}
.mode-shared > .icon {
  color: #f59e0b;
}
.mode-biggest > .icon {
  color: #c084fc;
}
.mode-jackpot > .icon {
  color: #fbbf24;
}
.t-crazy > .icon {
  color: #f87171;
}
.t-terminal > .icon {
  color: #22d3ee;
}
.t-fast > .icon {
  color: #f59e0b;
}
.bmode:hover {
  border-color: var(--violet);
}
.bmode.active {
  border-color: var(--violet);
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.22), rgba(168, 85, 247, 0.06));
}
.bswitch-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.bswitch {
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--surface-4);
  transition: background 0.15s;
}
.bswitch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.bswitch-input:checked + .bswitch {
  background: var(--violet);
}
.bswitch-input:checked + .bswitch::after {
  transform: translateX(16px);
}
.bswitch-input:focus-visible + .bswitch {
  box-shadow: var(--ring);
}
.bcreate-tools .bcreate-search .input {
  border-radius: var(--r-md);
}
.bsort-pill,
.bsort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface-1);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.bsort-pill {
  border-color: var(--violet);
  background: var(--violet-soft);
}
.bsort-btn {
  cursor: pointer;
}
.bsort-btn .icon {
  width: 14px;
  height: 14px;
}
.bcreate .bcase {
  gap: 6px;
  padding: var(--s4) var(--s3) var(--s3);
  background: var(--surface-1);
}
.bcreate .bcase .case-art {
  width: 64px;
  height: 64px;
}
.bcreate .bcase .coin-amount {
  color: #4ade80;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
}
.bcase-add {
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, #b46cf7, #9333ea);
  color: #fff;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 18px -8px #a855f7;
}
.bcase-add:hover {
  filter: brightness(1.1);
}
.bcreate .bcase.picked {
  border-color: var(--violet);
}
.bcreate .bcase-count {
  background: var(--violet);
  color: #fff;
}
.bcreate-count {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.bcreate-picked.empty {
  min-height: 300px;
}
.bcreate-picked.empty .bcreate-drop {
  min-height: 300px;
}
.bcreate-picked {
  max-height: 380px;
  overflow-y: auto;
}
.bcreate-foot {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
}
.bcreate-foot .bcreate-sum {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  border-top: 0;
  padding-top: 0;
}
.bcreate-foot .bcreate-total {
  font-size: var(--fs-2xl);
}
.bcreate-go {
  background: linear-gradient(180deg, #b46cf7, #9333ea);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.bcreate-go:disabled {
  background: var(--surface-3);
  color: var(--text-dim);
}
.bcreate-go:hover:not(:disabled) {
  box-shadow: 0 6px 22px -6px #a855f7;
}
.brow-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.brow-mode {
  display: inline-block;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.12em;
  color: #fbbf24;
}
.brow-mode.crazy {
  color: #f472b6;
}
.brow .btn.brow-btn:not(.btn-ghost) {
  background: linear-gradient(180deg, #b46cf7, #9333ea);
  color: #fff;
}
.battle-seat.team {
  position: relative;
}
.team-tag {
  position: absolute;
  top: 8px;
  right: 10px;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.battle-seat.team-0 {
  border-color: rgba(90, 158, 240, 0.55);
}
.battle-seat.team-0 .team-tag {
  background: rgba(90, 158, 240, 0.18);
  color: #93c5fd;
}
.battle-seat.team-1 {
  border-color: rgba(239, 91, 107, 0.55);
}
.battle-seat.team-1 .team-tag {
  background: rgba(239, 91, 107, 0.18);
  color: #fca5a5;
}
.battle-seat.team-2 {
  border-color: rgba(60, 207, 142, 0.55);
}
.battle-seat.team-2 .team-tag {
  background: rgba(60, 207, 142, 0.18);
  color: #86efac;
}
.battle-head .brow-mode {
  display: block;
  margin-bottom: 2px;
}
@media (min-width: 961px) {
  .battle-seats {
    grid-template-columns: repeat(min(var(--seats, 2), 3), minmax(0, 1fr));
  }
}
@media (max-width: 1180px) {
  .bcreate {
    grid-template-columns: 210px minmax(0, 1fr);
  }
}
@media (max-width: 720px) {
  .bcreate {
    grid-template-columns: 1fr;
  }
}
