:root {
  --bg: #06080f;
  --panel: rgba(12, 16, 28, 0.88);
  --panel-2: rgba(18, 24, 40, 0.92);
  --stroke: rgba(255, 255, 255, 0.07);
  --stroke-gold: rgba(212, 175, 55, 0.45);
  --text: #f4f6fb;
  --muted: #8a94ab;
  --gold: #e8c547;
  --gold-dim: #b8922a;
  --gold-glow: rgba(232, 197, 71, 0.35);
  --blue: #5b9dff;
  --err: #ff6b6b;
  --ok: #5ee4a0;
  --font-display: "Orbitron", sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --reel-item: 188px;
  --reel-gap: 14px;
  --r-common: #9aa8bc;
  --r-uncommon: #4db8ff;
  --r-rare: #4f6bff;
  --r-epic: #b44dff;
  --r-legendary: #ff4fd8;
  --r-mythic: #ffc940;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== Scene ===== */
.dc-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.dc-stars {
  position: absolute;
  inset: -50%;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.35), transparent),
    radial-gradient(1.5px 1.5px at 80% 20%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 10% 60%, rgba(255,255,255,0.45), transparent),
    radial-gradient(1px 1px at 90% 50%, rgba(255,255,255,0.35), transparent);
  background-size: 550px 550px;
  animation: drift 120s linear infinite;
  opacity: 0.7;
}
@keyframes drift {
  to { transform: translate3d(-80px, -40px, 0); }
}

.dc-nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
}
.dc-nebula--1 {
  width: 600px; height: 500px;
  top: -200px; left: 50%;
  transform: translateX(-30%);
  background: radial-gradient(circle, rgba(75, 120, 255, 0.18), transparent 70%);
}
.dc-nebula--2 {
  width: 500px; height: 450px;
  bottom: -150px; right: -80px;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.12), transparent 70%);
}

.dc-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 80% at 50% 40%, transparent 30%, rgba(0,0,0,0.65) 100%);
}

/* ===== App ===== */
.dc-app {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 20px 72px;
}

.dc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--stroke);
}

.dc-header__tag {
  display: block;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}

.dc-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.dc-header__nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dc-header__nav a,
.dc-ghost {
  appearance: none;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--muted);
  padding: 9px 16px;
  border-radius: 8px;
  font: 600 12px/1 var(--font-body);
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.dc-header__nav a:hover,
.dc-ghost:hover {
  color: var(--text);
  border-color: var(--stroke-gold);
}
.dc-ghost { padding: 9px 12px; font-size: 14px; }

.dc-toast {
  margin-bottom: 20px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--panel-2);
  font-size: 13px;
  line-height: 1.45;
}
.dc-toast.err { border-color: rgba(255,107,107,0.35); color: #ffb4b4; background: rgba(40,12,16,0.9); }
.dc-toast.ok { border-color: rgba(94,228,160,0.3); color: #b8f5d8; background: rgba(10,32,24,0.9); }

.dc-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dc-empty {
  text-align: center;
  padding: 80px 24px;
  color: var(--muted);
  font-size: 15px;
}

/* ===== Case card ===== */
.dc-case {
  border-radius: 20px;
  border: 1px solid var(--stroke);
  background: linear-gradient(165deg, rgba(20, 26, 42, 0.95) 0%, rgba(8, 10, 18, 0.98) 100%);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.02) inset,
    0 32px 64px rgba(0,0,0,0.5);
}

.dc-case__hero {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 240px;
}
@media (max-width: 680px) {
  .dc-case__hero { grid-template-columns: 1fr; }
}

.dc-case__visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(232, 197, 71, 0.08), transparent),
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
  border-right: 1px solid var(--stroke);
}
@media (max-width: 680px) {
  .dc-case__visual { border-right: none; border-bottom: 1px solid var(--stroke); min-height: 200px; }
}

.dc-case__glow {
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold-glow), transparent 70%);
  filter: blur(8px);
  animation: pulseGlow 4s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.08); }
}

.dc-case__crate {
  position: relative;
  z-index: 1;
  width: 160px;
  height: 160px;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,0.6));
  animation: floatCrate 6s ease-in-out infinite;
}
@keyframes floatCrate {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.dc-case__body {
  flex: 1;
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dc-case__body h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dc-case__body > p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  max-width: 38ch;
}

.dc-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.dc-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  min-width: 72px;
  border-radius: 10px;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--stroke);
}
.dc-stat span:first-child {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.dc-stat span:last-child {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.dc-stat--gold span:last-child { color: var(--gold); }

.dc-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dc-btn {
  appearance: none;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 13px 24px;
  border-radius: 10px;
  font: 700 11px/1 var(--font-display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, background 0.15s;
}
.dc-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.15);
}
.dc-btn:disabled {
  opacity: 0.3;
  cursor: default;
  transform: none;
}
.dc-btn--open {
  background: linear-gradient(180deg, #3a8cff 0%, #2563c9 100%);
  border-color: rgba(91, 157, 255, 0.5);
  box-shadow: 0 8px 24px rgba(37, 99, 201, 0.35);
  color: #fff;
}
.dc-btn--gold {
  background: linear-gradient(180deg, #f0d060 0%, #c89420 100%);
  border-color: rgba(232, 197, 71, 0.55);
  box-shadow: 0 8px 28px rgba(200, 148, 32, 0.3);
  color: #1a1200;
}

/* Loot pool */
.dc-pool {
  padding: 18px 24px 22px;
  border-top: 1px solid var(--stroke);
  background: rgba(0,0,0,0.2);
}
.dc-pool h3 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.dc-pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}
.dc-pool-item {
  position: relative;
  text-align: center;
  padding: 10px 6px 8px;
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--stroke);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}
.dc-pool-item::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--rarity, var(--r-rare));
  box-shadow: 0 0 12px var(--rarity, var(--r-rare));
}
.dc-pool-item:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--rarity, var(--r-rare)) 40%, var(--stroke));
}
.dc-pool-item img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.5));
}
.dc-pool-name {
  margin-top: 6px;
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dc-pool-pct {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 600;
  color: var(--gold);
}

/* ===== Spin overlay ===== */
.dc-spin {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.dc-spin[hidden] { display: none !important; }

.dc-spin__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 10, 0.92);
  backdrop-filter: blur(20px);
}

.dc-spin__flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255,255,255,0.9), transparent 55%);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.15s;
}
.dc-spin__flash.is-on { opacity: 0.35; }

.dc-spin__confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.dc-spin__stage {
  position: relative;
  z-index: 3;
  width: min(1080px, 100%);
  transition: opacity 0.4s, transform 0.4s;
}
.dc-spin.is-won .dc-spin__stage {
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
  position: absolute;
}

.dc-spin__head {
  text-align: center;
  margin-bottom: 24px;
}
.dc-spin__case {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
}
.dc-spin__status {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

/* Reel */
.dc-reel {
  position: relative;
}

.dc-reel__pointer {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  z-index: 6;
  filter: drop-shadow(0 0 8px var(--gold-glow));
  transition: transform 0.05s;
}
.dc-reel__pointer--top {
  top: -2px;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 18px solid var(--gold);
}
.dc-reel__pointer--bot {
  bottom: -2px;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-bottom: 18px solid var(--gold);
}
.dc-reel__pointer.tick {
  transform: translateX(-50%) scale(1.15);
}

.dc-reel__frame {
  position: relative;
  padding: 3px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(232,197,71,0.5), rgba(232,197,71,0.08) 40%, rgba(232,197,71,0.25));
  box-shadow:
    0 0 60px rgba(232, 197, 71, 0.12),
    0 24px 48px rgba(0,0,0,0.5);
}

.dc-reel__viewport {
  position: relative;
  height: 280px;
  overflow: hidden;
  border-radius: 14px;
  background: #080a12;
  box-shadow: inset 0 0 100px rgba(0,0,0,0.8);
}
.dc-reel__viewport.is-fast .dc-reel__track {
  filter: blur(1px) brightness(1.08);
}
.dc-reel__viewport.is-landed .dc-reel__track {
  filter: none;
}

.dc-reel__line {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 100%;
  margin: -50% 0 0 -1px;
  background: linear-gradient(180deg, transparent, var(--gold), #fff, var(--gold), transparent);
  opacity: 0.6;
  pointer-events: none;
  z-index: 5;
}

.dc-reel__shade {
  position: absolute;
  top: 0; bottom: 0;
  width: 35%;
  z-index: 4;
  pointer-events: none;
}
.dc-reel__shade--l {
  left: 0;
  background: linear-gradient(90deg, #06080f 0%, transparent 100%);
}
.dc-reel__shade--r {
  right: 0;
  background: linear-gradient(270deg, #06080f 0%, transparent 100%);
}

.dc-reel__track {
  display: flex;
  align-items: center;
  gap: var(--reel-gap);
  height: 100%;
  padding: 20px 0;
  will-change: transform;
}

/* Reel cards */
.reel-card {
  flex: 0 0 var(--reel-item);
  width: var(--reel-item);
  height: calc(100% - 8px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.01) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.reel-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 120% 80% at 50% 120%, color-mix(in srgb, var(--rarity, var(--r-rare)) 30%, transparent), transparent);
  pointer-events: none;
}
.reel-card-rarity {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  font-family: var(--font-display);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--rarity, var(--r-rare));
  color: #080a10;
}
.reel-card-img {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  position: relative;
  z-index: 1;
}
.reel-card-img img {
  width: 130px;
  height: 130px;
  object-fit: contain;
  filter: drop-shadow(0 16px 28px rgba(0,0,0,0.6));
  transition: transform 0.3s, filter 0.3s;
}
.reel-card-name {
  padding: 0 12px 12px;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 1;
}
.reel-card-bar {
  height: 3px;
  background: var(--rarity, var(--r-rare));
  box-shadow: 0 0 16px color-mix(in srgb, var(--rarity, var(--r-rare)) 60%, transparent);
}

.reel-card.is-winner.landed {
  border-color: var(--rarity, var(--r-mythic));
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--rarity, var(--r-mythic)) 70%, transparent),
    0 0 60px color-mix(in srgb, var(--rarity, var(--r-mythic)) 40%, transparent);
  animation: winPulse 1.2s ease-in-out infinite;
}
@keyframes winPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.reel-card.is-winner.landed img {
  transform: scale(1.12);
  filter: drop-shadow(0 0 32px var(--rarity, var(--r-mythic)));
}

.dc-spin__progress {
  margin-top: 22px;
  height: 3px;
  border-radius: 99px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.dc-spin__progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  box-shadow: 0 0 12px var(--gold-glow);
}

/* ===== Win reveal ===== */
.dc-reveal {
  position: relative;
  z-index: 4;
  width: min(400px, 100%);
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
}
.dc-reveal[hidden] { display: none !important; }
.dc-spin.is-won .dc-reveal {
  display: block !important;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  animation: revealIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes revealIn {
  from { opacity: 0; transform: scale(0.88) translateY(20px); }
  to { opacity: 1; transform: none; }
}

.dc-reveal__rays {
  position: absolute;
  top: 50%; left: 50%;
  width: 420px; height: 420px;
  margin: -210px 0 0 -210px;
  border-radius: 50%;
  background:
    conic-gradient(from 0deg,
      transparent 0deg,
      color-mix(in srgb, var(--rarity, var(--gold)) 25%, transparent) 20deg,
      transparent 40deg,
      color-mix(in srgb, var(--rarity, var(--gold)) 20%, transparent) 60deg,
      transparent 80deg,
      color-mix(in srgb, var(--rarity, var(--gold)) 25%, transparent) 100deg,
      transparent 120deg);
  animation: spinRays 12s linear infinite;
  pointer-events: none;
  opacity: 0.7;
}
@keyframes spinRays {
  to { transform: rotate(360deg); }
}

.dc-reveal__card {
  position: relative;
  padding: 28px 24px 24px;
  border-radius: 20px;
  border: 1px solid var(--stroke-gold);
  background: linear-gradient(165deg, rgba(22, 28, 44, 0.98), rgba(8, 10, 18, 0.99));
  text-align: center;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6);
}

.dc-reveal__badge {
  display: inline-block;
  margin-bottom: 16px;
  padding: 6px 18px;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #080a10;
  background: var(--rarity, var(--r-rare));
}

.dc-reveal__frame {
  width: 180px;
  height: 180px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.05), transparent 70%);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 0 40px color-mix(in srgb, var(--rarity, var(--gold)) 25%, transparent);
}
.dc-reveal__frame img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 0 36px var(--rarity, var(--gold)));
  animation: popArt 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both;
}
@keyframes popArt {
  from { opacity: 0; transform: scale(0.4) rotate(-8deg); }
  to { opacity: 1; transform: none; }
}

.dc-reveal__label {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
}

.dc-reveal__card h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.dc-reveal__meta {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.dc-reveal__meta.is-dup { color: var(--gold); }

@media (max-width: 640px) {
  :root { --reel-item: 152px; --reel-gap: 10px; }
  .dc-reel__viewport { height: 240px; }
  .reel-card-img img { width: 100px; height: 100px; }
}
