:root {
  --bg-deep: #1a0a2e;
  --bg-mid: #2d1455;
  --neon-pink: #ff3dc8;
  --neon-purple: #9d4edd;
  --neon-violet: #7b2cbf;
  --neon-green: #39ff14;
  --neon-green-dim: #22c55e;
  --gold: #ffd700;
  --gold-dark: #b8860b;
  --glass: rgba(40, 20, 70, 0.75);
  --glass-border: rgba(255, 100, 220, 0.45);
  --text: #fff;
  --text-dim: rgba(255, 255, 255, 0.65);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --font: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: #0d0518;
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }

.casino-app {
  position: relative;
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, rgba(123, 44, 191, 0.5), transparent 55%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(255, 61, 200, 0.15), transparent 50%),
    linear-gradient(180deg, #1a0a2e 0%, #0f0620 45%, #120828 100%);
  overflow: hidden;
}

.neon-frame {
  pointer-events: none;
  position: absolute;
  inset: 6px;
  border-radius: 20px;
  border: 2px solid rgba(255, 61, 200, 0.55);
  box-shadow:
    inset 0 0 30px rgba(157, 78, 221, 0.35),
    0 0 25px rgba(255, 61, 200, 0.25),
    0 0 60px rgba(123, 44, 191, 0.2);
  z-index: 20;
}

/* —— Top bar —— */
.top-bar {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  align-items: center;
  gap: 0.35rem;
  padding: calc(8px + var(--safe-top)) 10px 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, #6b21a8, #4c1d95);
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 0 12px rgba(157, 78, 221, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1;
}
.icon-btn--back { font-size: 1.25rem; }

.top-currencies { min-width: 0; }
.pill-currency {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 215, 0, 0.35);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.pill-currency--gold { color: var(--gold); }

.btn-buy {
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: #fff;
  background: linear-gradient(180deg, #4ade80 0%, #16a34a 100%);
  box-shadow: 0 0 18px rgba(57, 255, 20, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  cursor: pointer;
}
.top-level {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gold);
}
.top-level .star { color: #fbbf24; }

/* —— Mission —— */
.mission-card {
  position: absolute;
  left: 8px;
  top: calc(52px + var(--safe-top));
  z-index: 8;
  display: flex;
  gap: 6px;
  align-items: center;
  max-width: 120px;
  padding: 6px 8px;
  border-radius: 12px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  font-size: 0.65rem;
}
.mission-card__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.mission-card__title { margin: 0 0 4px; font-weight: 700; }
.mission-card__bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.mission-card__bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #39ff14);
  border-radius: 3px;
  transition: width 0.35s ease;
}
.mission-card__count { margin: 2px 0 0; color: var(--text-dim); }

/* —— Stage / reels —— */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 8px 8px;
  position: relative;
  z-index: 5;
  min-height: 0;
}

.reel-frame {
  position: relative;
  width: 100%;
  padding: 28px 8px 16px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(60, 30, 90, 0.9) 0%, rgba(20, 10, 40, 0.95) 100%);
  border: 3px solid;
  border-image: linear-gradient(180deg, var(--gold), var(--gold-dark), var(--neon-purple)) 1;
  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.6),
    0 0 30px rgba(157, 78, 221, 0.4);
}

.reel-frame__lions {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: clamp(2.5rem, 12vw, 3.5rem);
  opacity: 0.85;
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
  pointer-events: none;
  z-index: 1;
}
.reel-frame__lions--left { left: -4px; }
.reel-frame__lions--right { right: -4px; transform: translateY(-50%) scaleX(-1); }

.paylines-layer {
  position: absolute;
  inset: 28px 12px 16px;
  pointer-events: none;
  z-index: 3;
}
.paylines-svg { width: 100%; height: 100%; }
.payline {
  fill: none;
  stroke-width: 0.35;
  stroke-linecap: round;
  opacity: 0.35;
}
.payline--mid { stroke: #fde047; opacity: 0.85; stroke-width: 0.5; }
.payline--top { stroke: #4ade80; }
.payline--bot { stroke: #4ade80; }
.payline--v1, .payline--v2 { stroke: #a78bfa; }

.casino-app.is-win-flash .payline--mid {
  animation: payline-pulse 0.6s ease 2;
}
@keyframes payline-pulse {
  50% { opacity: 1; stroke-width: 0.8; filter: drop-shadow(0 0 4px #fde047); }
}

.reels-wrap {
  position: relative;
  z-index: 2;
  margin: 0 18px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.reels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  padding: 4px;
  min-height: clamp(140px, 38vw, 180px);
}

.slots-reel {
  overflow: hidden;
  border-radius: 6px;
  background: linear-gradient(180deg, #1e1035 0%, #0a0515 100%);
  border: 1px solid rgba(255, 215, 0, 0.15);
  aspect-ratio: 1 / 3;
  min-height: 0;
  container-type: size;
}
.slots-reel__strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}
.slots-reel.is-spinning .slots-reel__strip {
  animation: reel-scroll var(--spin-duration, 1.1s) cubic-bezier(0.12, 0.7, 0.15, 1) forwards;
  animation-delay: var(--reel-delay, 0ms);
}
@keyframes reel-scroll {
  0% {
    transform: translateY(0);
    filter: blur(0);
  }
  12% {
    filter: blur(2px);
  }
  88% {
    filter: blur(2px);
  }
  100% {
    transform: translateY(var(--spin-end, -240px));
    filter: blur(0);
  }
}

.slots-cell {
  flex: 0 0 auto;
  width: 100%;
  height: 33.333cqh;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.35rem, 6vw, 1.75rem);
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.slots-cell.is-y2026:not(.is-figure) {
  font-weight: 900;
  font-size: clamp(0.85rem, 4vw, 1rem);
  color: var(--neon-green);
  text-shadow: 0 0 12px rgba(57, 255, 20, 0.8);
}
.slots-cell.is-bonus-figure .slots-cell__img {
  filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.85)) drop-shadow(0 0 8px rgba(251, 191, 36, 0.6));
  transform: scale(1.05);
}
body[data-slot-theme="salon2026"] .slots-cell.is-figure .slots-cell__img {
  filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.4)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}
.slots-cell.is-seven { filter: drop-shadow(0 0 6px gold); }
.slots-cell.is-letter {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 900;
  color: #f472b6;
  -webkit-text-stroke: 1px rgba(255, 215, 0, 0.6);
}

.bonus-wheel-hint {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7c3aed, #db2777);
  border: 2px solid var(--gold);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  font-weight: 800;
  font-size: 0.65rem;
  z-index: 4;
}
.bonus-wheel-hint__year {
  font-size: 0.85rem;
  color: var(--neon-green);
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.7);
}

.status-line {
  margin: 14px 8px 4px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  min-height: 1.2em;
}
.status-line.is-win { color: var(--neon-green); font-weight: 700; }
.status-line.is-bonus { color: var(--neon-pink); font-weight: 700; }
.free-spins-line {
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.casino-app.is-bonus-glow .reel-frame {
  animation: frame-glow 1.2s ease-in-out infinite alternate;
}
@keyframes frame-glow {
  from { box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(157, 78, 221, 0.4); }
  to { box-shadow: inset 0 0 40px rgba(57, 255, 20, 0.15), 0 0 45px rgba(57, 255, 20, 0.35); }
}

/* —— Control dock —— */
.control-dock {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  grid-template-rows: auto auto;
  gap: 8px 6px;
  padding: 8px 10px calc(10px + var(--safe-bot));
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(30, 15, 50, 0.9) 100%);
  border-top: 1px solid rgba(255, 61, 200, 0.25);
}

.dock-icon {
  grid-row: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #7c3aed, #5b21b6);
  color: #fff;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
  cursor: pointer;
}

.bet-stepper {
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  justify-self: center;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 999px;
  padding: 2px 4px;
  border: 1px solid rgba(157, 78, 221, 0.4);
}
.bet-stepper__btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(180deg, #6d28d9, #4c1d95);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.bet-stepper__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.bet-stepper__label {
  text-align: center;
  min-width: 72px;
  padding: 0 4px;
}
.bet-stepper__caption {
  display: block;
  font-size: 0.55rem;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.bet-stepper__value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--gold);
}

.win-panel {
  grid-row: 1;
  text-align: center;
  padding: 4px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.5), rgba(60, 20, 100, 0.8));
  border: 1px solid rgba(255, 100, 220, 0.4);
  box-shadow: inset 0 0 15px rgba(157, 78, 221, 0.3);
}
.win-panel__value {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
}
.win-panel__label {
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}
.win-panel.is-big-win .win-panel__value {
  color: var(--neon-green);
  text-shadow: 0 0 12px rgba(57, 255, 20, 0.6);
}

.btn-max {
  grid-row: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(180deg, #7c3aed, #5b21b6);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.4);
  cursor: pointer;
}
.btn-max:disabled { opacity: 0.45; }

.btn-spin {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(180deg, #4ade80 0%, #16a34a 45%, #15803d 100%);
  box-shadow:
    0 0 28px rgba(57, 255, 20, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    inset 0 -3px 0 rgba(0, 0, 0, 0.2);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.btn-spin:disabled {
  opacity: 0.55;
  filter: grayscale(0.3);
  cursor: not-allowed;
}
.btn-spin__main {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
.btn-spin__sub {
  font-size: 0.6rem;
  font-weight: 600;
  opacity: 0.9;
}

/* —— Side panel —— */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 40;
}
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 88vw);
  z-index: 50;
  background: linear-gradient(180deg, #2d1455, #1a0a2e);
  border-left: 2px solid var(--glass-border);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
}
.side-panel__inner { padding: 1rem 1rem calc(1rem + var(--safe-bot)); }
.side-panel__close {
  float: right;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}
.side-panel__title {
  margin: 0.5rem 0 0.75rem;
  font-size: 1rem;
  clear: both;
}
.side-panel__hint { font-size: 0.8rem; color: var(--text-dim); }
.side-panel__foot { margin-top: 1.5rem; font-size: 0.85rem; }
.side-panel__foot a { color: var(--neon-pink); }

.theme-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1rem;
}
.theme-btn {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.theme-btn.is-active {
  border-color: var(--neon-green);
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.35);
}
.theme-btn:disabled { opacity: 0.45; }

.paytable {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text-dim);
}

/* —— Theme accents (symbol tint) —— */
body[data-slot-theme="fortune"] .reels-wrap {
  box-shadow: inset 0 0 24px rgba(255, 215, 0, 0.08);
}
body[data-slot-theme="salon2026"] .bonus-wheel-hint__year { color: #22d3ee; }
body[data-slot-theme="zenith"] .reel-frame {
  border-image: linear-gradient(180deg, #f97316, #ea580c, #1d4ed8) 1;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6), 0 0 35px rgba(249, 115, 22, 0.35);
}
body[data-slot-theme="zenith"] .reels-wrap {
  box-shadow: inset 0 0 28px rgba(56, 189, 248, 0.12);
}
body[data-slot-theme="zenith"] .reel-frame__lions {
  opacity: 0;
}
body[data-slot-theme="zenith"] .bonus-wheel-hint__year {
  color: #fbbf24;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.8);
}
.slots-cell.is-figure {
  padding: 2px;
}
.slots-cell__img {
  width: 100%;
  height: 100%;
  max-width: 56px;
  max-height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}
body[data-slot-theme="zenith"] .slots-cell.is-figure .slots-cell__img {
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.35)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}
body[data-slot-theme="zenith"] .slots-cell.is-seven .slots-cell__img {
  filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.75)) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}
body[data-slot-theme="olympe"] .reel-frame { border-image: linear-gradient(180deg, #fde047, #ca8a04, #1e40af) 1; }
body[data-slot-theme="farwest"] .reel-frame { border-image: linear-gradient(180deg, #d97706, #78350f, #451a03) 1; }

@media (min-width: 431px) {
  .casino-app {
    margin-top: 12px;
    margin-bottom: 12px;
    min-height: calc(100dvh - 24px);
    border-radius: 24px;
  }
  .neon-frame { border-radius: 24px; }
}
