:root {
  color-scheme: dark;
  --bg: #06070b;
  --panel: rgba(12, 16, 24, 0.78);
  --panel-strong: rgba(18, 23, 32, 0.94);
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.24);
  --text: #eef3f8;
  --muted: rgba(238, 243, 248, 0.62);
  --soft: rgba(238, 243, 248, 0.36);
  --accent: #4fd7c8;
  --warn: #ffb000;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(90% 70% at 52% 20%, rgba(63, 99, 107, 0.28), transparent 56%),
    radial-gradient(80% 70% at 82% 88%, rgba(126, 51, 50, 0.18), transparent 62%),
    linear-gradient(145deg, #07090d 0%, #101015 52%, #06070b 100%);
  color: var(--text);
}

a {
  color: inherit;
}

button,
a.demo-link,
a.nav-link {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

button:hover,
a.demo-link:hover,
a.nav-link:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.12);
}

button:active,
a.demo-link:active,
a.nav-link:active {
  transform: translateY(1px);
}

.index-page {
  min-height: 100vh;
  overflow-x: hidden;
}

.index-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 42px;
}

.index-top {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.index-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 52px);
  line-height: 0.95;
  font-weight: 760;
  letter-spacing: 0;
}

.index-copy {
  max-width: 560px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.asset-note {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.demo-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(10, 13, 18, 0.76);
  backdrop-filter: blur(12px);
}

.demo-card h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.demo-card p {
  margin: 10px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.demo-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--soft);
  font-size: 11px;
  text-transform: uppercase;
}

.status {
  color: var(--accent);
}

.demo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 12px;
  font-size: 13px;
}

.demo-page {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.rcxi-app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(95% 78% at 50% 36%, rgba(38, 51, 72, 0.64) 0%, rgba(10, 11, 17, 0.92) 56%, #05060a 100%);
}

.rcxi-app.stage-lava {
  background:
    radial-gradient(80% 62% at 50% 84%, rgba(239, 75, 41, 0.32), transparent 52%),
    radial-gradient(95% 78% at 50% 36%, rgba(43, 33, 30, 0.7), rgba(8, 8, 10, 0.94) 60%, #050505 100%);
}

.rcxi-app.stage-prism {
  background:
    radial-gradient(70% 62% at 30% 18%, rgba(72, 199, 192, 0.27), transparent 56%),
    radial-gradient(62% 70% at 76% 72%, rgba(201, 67, 102, 0.18), transparent 60%),
    linear-gradient(135deg, #07100f, #11101a 56%, #06060a);
}

.rcxi-app.stage-arena {
  background:
    radial-gradient(80% 48% at 50% 88%, rgba(255, 176, 0, 0.18), transparent 62%),
    linear-gradient(155deg, #07080a 0%, #111114 48%, #06070a 100%);
}

.rcxi-app.stage-ice {
  background:
    radial-gradient(72% 58% at 50% 48%, rgba(124, 218, 242, 0.34), transparent 58%),
    radial-gradient(80% 62% at 52% 88%, rgba(235, 252, 255, 0.13), transparent 68%),
    linear-gradient(145deg, #061017 0%, #08151e 48%, #03070a 100%);
}

.rcxi-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.nav-link {
  position: fixed;
  left: 18px;
  top: 16px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.76);
  background: rgba(4, 6, 8, 0.46);
  backdrop-filter: blur(10px);
  font-size: 13px;
}

.demo-heading {
  position: fixed;
  left: 50%;
  top: 16px;
  z-index: 18;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  user-select: none;
}

.demo-heading strong {
  display: block;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.demo-heading span {
  display: block;
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.38);
  font-size: 12px;
}

.result {
  position: fixed;
  left: 50%;
  bottom: 102px;
  z-index: 16;
  width: min(520px, calc(100% - 48px));
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  user-select: none;
}

.card-name {
  opacity: 0;
  transition: opacity 320ms ease, transform 320ms ease;
  transform: translateY(8px);
  font-size: clamp(22px, 3.4vw, 34px);
  line-height: 1.12;
  font-weight: 740;
}

.tier-label {
  margin-top: 7px;
  opacity: 0;
  transition: opacity 320ms ease, transform 320ms ease;
  transform: translateY(8px);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.result.is-visible .card-name,
.result.is-visible .tier-label {
  opacity: 1;
  transform: translateY(0);
}

.hint {
  position: fixed;
  left: 50%;
  bottom: 122px;
  z-index: 15;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.58);
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
  animation: pulse 1.7s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.34;
  }
  50% {
    opacity: 0.88;
  }
}

.again {
  position: fixed;
  left: 50%;
  bottom: 42px;
  z-index: 17;
  min-width: 180px;
  padding: 0 22px;
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(8px);
  font-size: 14px;
  letter-spacing: 0.04em;
  transition: opacity 260ms ease, transform 260ms ease, background 160ms ease, border-color 160ms ease;
}

.again.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.odds {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 13px;
  z-index: 12;
  text-align: center;
  color: rgba(255, 255, 255, 0.28);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  pointer-events: none;
}

.flash {
  position: fixed;
  inset: 0;
  z-index: 14;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.teaser {
  position: fixed;
  left: 50%;
  top: 22%;
  z-index: 19;
  transform: translateX(-50%) scale(0.96);
  opacity: 0;
  pointer-events: none;
  user-select: none;
  color: #fff4c9;
  text-shadow: 0 0 28px rgba(255, 176, 0, 0.65);
  font-size: clamp(26px, 6vw, 64px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: opacity 180ms ease, transform 180ms ease;
}

.teaser.is-visible {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.stage-controls {
  position: fixed;
  right: 18px;
  top: 16px;
  z-index: 20;
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(4, 6, 8, 0.46);
  backdrop-filter: blur(10px);
}

.stage-controls button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.stage-controls button.is-active {
  border-color: rgba(79, 215, 200, 0.72);
  background: rgba(79, 215, 200, 0.14);
}

.demo-controls {
  position: fixed;
  right: 18px;
  top: 16px;
  z-index: 21;
  width: 246px;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(4, 6, 8, 0.58);
  backdrop-filter: blur(12px);
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.control-row output {
  color: rgba(255, 255, 255, 0.42);
  font-variant-numeric: tabular-nums;
}

.demo-controls input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.demo-controls button {
  min-height: 34px;
  margin-top: 3px;
  font-size: 12px;
}

.demo-controls button:disabled {
  cursor: default;
  opacity: 0.45;
}

.reel {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 13;
  width: min(920px, calc(100vw - 24px));
  height: min(230px, 32vh);
  transform: translate(-50%, -50%);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent);
}

.reel.is-visible {
  opacity: 1;
}

.reel-track {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  will-change: transform;
}

.reel-card {
  flex: 0 0 auto;
  width: min(130px, 17vw);
  height: calc(min(130px, 17vw) * 1.48);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.32);
}

.reel-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.reel-card.is-target {
  border-color: rgba(255, 176, 0, 0.54);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.38), 0 0 22px rgba(255, 176, 0, 0.2);
}

.reel-card.is-target.is-missed {
  border-color: rgba(255, 96, 96, 0.72);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.38), 0 0 28px rgba(255, 96, 96, 0.32);
}

.reel-card.is-target.is-locking {
  border-color: rgba(255, 230, 154, 0.96);
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.42), 0 0 34px rgba(255, 176, 0, 0.48);
}

.reel-marker {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 14;
  width: 2px;
  height: min(250px, 35vh);
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.82), transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.reel-marker.is-visible {
  opacity: 1;
}

.multi-slots {
  position: fixed;
  left: 50%;
  top: 82px;
  z-index: 18;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.multi-slot {
  width: 54px;
  height: 74px;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03)),
    #090b10;
  opacity: 0.7;
}

.multi-slot.is-pending {
  animation: slotPulse 1.1s ease-in-out infinite;
}

.multi-slot.is-current {
  border-color: rgba(255, 176, 0, 0.78);
  opacity: 1;
}

.multi-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@keyframes slotPulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }
  50% {
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.26);
  }
}

.gallery-panel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 18;
  width: min(390px, calc(100vw - 36px));
  max-height: min(460px, 48vh);
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background: rgba(4, 6, 8, 0.54);
  backdrop-filter: blur(10px);
}

.gallery-card {
  aspect-ratio: 0.68;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  overflow: hidden;
  background: #090a0d;
}

.gallery-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.gallery-card.is-locked img {
  filter: grayscale(1) brightness(0.18);
  opacity: 0.72;
}

.gallery-card.is-unlocked {
  border-color: rgba(79, 215, 200, 0.62);
  box-shadow: 0 0 18px rgba(79, 215, 200, 0.22);
}

@media (max-width: 980px) {
  .index-top {
    display: block;
  }

  .asset-note {
    margin-top: 18px;
  }

  .demo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .index-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 22px;
  }

  .demo-grid {
    grid-template-columns: 1fr;
  }

  .nav-link {
    left: 10px;
    top: 10px;
  }

  .demo-heading {
    width: calc(100% - 150px);
    top: 12px;
  }

  .demo-heading span {
    display: none;
  }

  .stage-controls {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 88px;
    justify-content: center;
  }

  .stage-controls button {
    flex: 1;
    padding: 0 8px;
  }

  .demo-controls {
    left: 10px;
    right: 10px;
    top: 56px;
    bottom: auto;
    width: auto;
    grid-template-columns: 78px 1fr;
    align-items: center;
    max-height: 36vh;
    overflow: auto;
  }

  .demo-controls .control-row {
    display: block;
  }

  .demo-controls button {
    grid-column: 1 / -1;
  }

  .gallery-panel {
    left: 10px;
    right: 10px;
    bottom: 86px;
    width: auto;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    max-height: 168px;
  }

  .multi-slots {
    top: 62px;
  }

  .multi-slot {
    width: 44px;
    height: 62px;
  }
}
