@import url("../../styles.css");

/* ── Page header ──────────────────────────────────────────── */
.page-header {
  max-width: 420px;
  margin: 0 auto;
  padding: 48px 8px 0;
  text-align: center;
}

/* ── Game layout ──────────────────────────────────────────── */
.game-layout {
  position: relative;
  max-width: 420px;
  margin: 0 auto;
  padding: 0 4px;
  min-height: 100vh;
}

.game-layout > main {
  max-width: 420px;
  width: 100%;
  padding: 0 4px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: -20px;
  margin-bottom: 28px;
}

/* ── Leopold sidebar ──────────────────────────────────────── */
.leopold-sidebar {
  position: fixed;
  top: 200px;
  left: calc(50% + 215px);
  width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.leopold-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* ── Debt counter ──────────────────────────────────────────── */
.debt-counter {
  text-align: center;
  margin-bottom: 2px;
}

.debt-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.debt-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: #ff6b6b;
  line-height: 1.2;
  transition: transform 0.2s ease, color 0.6s ease;
}

.debt-value.pop {
  transform: scale(1.15);
}

/* ── Leopold character ─────────────────────────────────────── */
.leopold {
  position: relative;
  width: 120px;
  height: 155px;
  flex-shrink: 0;
  transform: scale(0.75);
  transform-origin: top center;
  cursor: pointer;
  animation: leopold-idle 4s ease-in-out infinite;
}

.leopold-body {
  position: relative;
  width: 105px;
  height: 90px;
  border-radius: 38% 38% 42% 42%;
  left: 10px;
  transition: background-color 0.6s ease, box-shadow 0.6s ease;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.15);
  z-index: 1;
}

/* Default color (mood 3 = neutral) */
.leopold-body {
  background: #444;
}

/* ── Eyes ───────────────────────────────────────────────────── */
.leopold-eye {
  width: 15px;
  height: 15px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 38px;
  transition: transform 0.4s ease, background 0.4s ease, border-radius 0.4s ease, height 0.4s ease;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.15);
}

.leopold-eye-left {
  left: 28px;
}

.leopold-eye-right {
  right: 28px;
}

.leopold-pupil {
  width: 5px;
  height: 5px;
  background: #111;
  border-radius: 50%;
  position: absolute;
  top: 5px;
  left: 5px;
  transition: transform 0.3s ease;
}

/* ── Eyebrows (hidden) ─────────────────────────────────────── */
.leopold-brow {
  display: none;
}

/* ── Mouth ─────────────────────────────────────────────────── */
.leopold-mouth {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 8px;
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 0 0 50% 50%;
  transition: all 0.4s ease;
}

/* ── Tentacles ─────────────────────────────────────────────── */
.leopold-tentacles {
  position: absolute;
  bottom: 20px;
  left: 10px;
  width: 100px;
  height: 50px;
}

.tentacle {
  position: absolute;
  width: 22px;
  height: 55px;
  border-radius: 0 0 50% 50%;
  top: 0;
  transform-origin: top center;
  transition: background-color 0.6s ease, box-shadow 0.6s ease;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.15);
  animation: tentacle-wave 2s ease-in-out infinite;
}

/* Default tentacle color matches body */
.tentacle { background: #444; }

.t1 { left: 10px; animation: wave-1 3.1s ease-in-out infinite; }
.t2 { left: 28px; animation: wave-2 2.3s ease-in-out infinite; }
.t3 { left: 48px; animation: wave-3 2.7s ease-in-out infinite; }
.t4 { left: 66px; animation: wave-4 1.9s ease-in-out infinite; }

/* Hide unused tentacles */
.t5, .t6, .t7, .t8 { display: none; }

@keyframes wave-1 {
  0%   { transform: rotate(10deg); }
  25%  { transform: rotate(16deg); }
  55%  { transform: rotate(4deg); }
  80%  { transform: rotate(12deg); }
  100% { transform: rotate(10deg); }
}

@keyframes wave-2 {
  0%   { transform: rotate(6deg); }
  20%  { transform: rotate(12deg); }
  45%  { transform: rotate(2deg); }
  70%  { transform: rotate(9deg); }
  90%  { transform: rotate(4deg); }
  100% { transform: rotate(6deg); }
}

@keyframes wave-3 {
  0%   { transform: rotate(-6deg); }
  15%  { transform: rotate(-2deg); }
  40%  { transform: rotate(-12deg); }
  60%  { transform: rotate(-4deg); }
  85%  { transform: rotate(-9deg); }
  100% { transform: rotate(-6deg); }
}

@keyframes wave-4 {
  0%   { transform: rotate(-10deg); }
  30%  { transform: rotate(-5deg); }
  50%  { transform: rotate(-16deg); }
  75%  { transform: rotate(-8deg); }
  100% { transform: rotate(-10deg); }
}

/* ── Mood 0: Furious — black body, white accents ──────────── */
.leopold[data-mood="0"] .leopold-body { background: #0a0a0a; }
.leopold[data-mood="0"] .tentacle { background: #0a0a0a; }
.leopold[data-mood="0"] .leopold-eye {
  height: 16px;
  background: #bbb;
  border-radius: 0 0 50% 50%;
}
.leopold[data-mood="0"] .leopold-eye-left { transform: rotate(12deg); }
.leopold[data-mood="0"] .leopold-eye-right { transform: rotate(-12deg); }
.leopold[data-mood="0"] .leopold-pupil { background: #fff; }
.leopold[data-mood="0"] .leopold-brow {
  border-top-color: rgba(255, 255, 255, 0.7);
}
.leopold[data-mood="0"] .leopold-brow-left { transform: rotate(20deg) translateY(3px); }
.leopold[data-mood="0"] .leopold-brow-right { transform: rotate(-20deg) translateY(3px); }
.leopold[data-mood="0"] .leopold-mouth {
  width: 14px;
  height: 10px;
  background: transparent;
  border: 2px solid #fff;
  border-bottom: none;
  border-radius: 50% 50% 0 0;
}
.leopold[data-mood="0"] .tentacle { animation-timing-function: linear; }
.leopold[data-mood="0"] .t1 { animation: tense-1 0.28s linear infinite; }
.leopold[data-mood="0"] .t2 { animation: tense-2 0.35s linear infinite; }
.leopold[data-mood="0"] .t3 { animation: tense-3 0.22s linear infinite; }
.leopold[data-mood="0"] .t4 { animation: tense-4 0.31s linear infinite; }
.leopold[data-mood="0"] .leopold-body {
  animation: leopold-shake 0.5s ease infinite;
}

/* ── Mood 1: Angry — very dark, white-ish accents ─────────── */
.leopold[data-mood="1"] .leopold-body { background: #161616; }
.leopold[data-mood="1"] .tentacle { background: #161616; }
.leopold[data-mood="1"] .leopold-eye {
  height: 16px;
  background: #999;
  border-radius: 10% 10% 50% 50%;
}
.leopold[data-mood="1"] .leopold-eye-left { transform: rotate(8deg); }
.leopold[data-mood="1"] .leopold-eye-right { transform: rotate(-8deg); }
.leopold[data-mood="1"] .leopold-pupil { background: #eee; }
.leopold[data-mood="1"] .leopold-brow {
  border-top-color: rgba(255, 255, 255, 0.5);
}
.leopold[data-mood="1"] .leopold-brow-left { transform: rotate(14deg) translateY(2px); }
.leopold[data-mood="1"] .leopold-brow-right { transform: rotate(-14deg) translateY(2px); }
.leopold[data-mood="1"] .leopold-mouth {
  width: 12px;
  height: 8px;
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-bottom: none;
  border-radius: 50% 50% 0 0;
}
.leopold[data-mood="1"] .tentacle {
  animation-duration: 1s;
}

/* ── Mood 2: Annoyed — dark gray, lighter accents ─────────── */
.leopold[data-mood="2"] .leopold-body { background: #2a2a2a; }
.leopold[data-mood="2"] .tentacle { background: #2a2a2a; }
.leopold[data-mood="2"] .leopold-eye {
  height: 17px;
  background: #777;
  border-radius: 25% 25% 50% 50%;
}
.leopold[data-mood="2"] .leopold-eye-left { transform: rotate(4deg); }
.leopold[data-mood="2"] .leopold-eye-right { transform: rotate(-4deg); }
.leopold[data-mood="2"] .leopold-pupil { background: #ddd; }
.leopold[data-mood="2"] .leopold-brow {
  border-top-color: rgba(255, 255, 255, 0.35);
}
.leopold[data-mood="2"] .leopold-brow-left { transform: rotate(6deg) translateY(1px); }
.leopold[data-mood="2"] .leopold-brow-right { transform: rotate(-6deg) translateY(1px); }
.leopold[data-mood="2"] .leopold-mouth {
  width: 14px;
  height: 6px;
  background: transparent;
  border-bottom: none;
  border-top: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50% 50% 0 0;
}

/* ── Mood 3: Neutral — mid gray ───────────────────────────── */
.leopold[data-mood="3"] .leopold-body { background: #444; }
.leopold[data-mood="3"] .tentacle { background: #444; }
.leopold[data-mood="3"] .leopold-eye { background: #333; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.4); }
.leopold[data-mood="3"] .leopold-pupil { background: #ccc; }
.leopold[data-mood="3"] .leopold-mouth {
  width: 12px;
  height: 0;
  background: transparent;
  border-top: none;
  border-bottom: 2px solid rgba(150, 150, 150, 0.4);
  border-radius: 0;
}

/* ── Mood 4: Content — lighter gray, darker accents ───────── */
.leopold[data-mood="4"] .leopold-body { background: #666; }
.leopold[data-mood="4"] .tentacle { background: #666; }
.leopold[data-mood="4"] .leopold-eye { transform: scale(1.05); background: #333; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.4); }
.leopold[data-mood="4"] .leopold-pupil { background: #ddd; }
.leopold[data-mood="4"] .leopold-brow {
  border-top-color: rgba(0, 0, 0, 0.25);
}
.leopold[data-mood="4"] .leopold-brow-left { transform: translateY(-2px); }
.leopold[data-mood="4"] .leopold-brow-right { transform: translateY(-2px); }
.leopold[data-mood="4"] .leopold-mouth {
  width: 14px;
  height: 8px;
  background: transparent;
  border: 2px solid rgba(0, 0, 0, 0.3);
  border-top: none;
  border-radius: 0 0 50% 50%;
}

/* ── Mood 5: Happy — light gray body, black accents ──────── */
.leopold[data-mood="5"] .leopold-body { background: #888; }
.leopold[data-mood="5"] .tentacle { background: #888; }
.leopold[data-mood="5"] .leopold-eye { transform: scale(1.1); background: #1a1a1a; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.5); }
.leopold[data-mood="5"] .leopold-pupil { background: #fff; }
.leopold[data-mood="5"] .leopold-brow {
  border-top-color: rgba(0, 0, 0, 0.4);
}
.leopold[data-mood="5"] .leopold-brow-left { transform: translateY(-4px); }
.leopold[data-mood="5"] .leopold-brow-right { transform: translateY(-4px); }
.leopold[data-mood="5"] .leopold-mouth {
  width: 14px;
  height: 10px;
  background: transparent;
  border: 2px solid #111;
  border-top: none;
  border-radius: 0 0 50% 50%;
}
.leopold[data-mood="5"] .leopold-eye::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  top: 2px;
  right: 3px;
}
.leopold[data-mood="5"] .t1 { animation: wave-1 1.8s ease-in-out infinite; }
.leopold[data-mood="5"] .t2 { animation: wave-2 1.3s ease-in-out infinite; }
.leopold[data-mood="5"] .t3 { animation: wave-3 1.5s ease-in-out infinite; }
.leopold[data-mood="5"] .t4 { animation: wave-4 1.1s ease-in-out infinite; }
.leopold[data-mood="5"] .leopold-body {
  animation: leopold-bounce 1s ease infinite;
}

/* ── Leopold animations ────────────────────────────────────── */
@keyframes tense-1 {
  0%   { transform: rotate(10deg) scaleY(0.85); }
  40%  { transform: rotate(17deg) scaleY(0.9); }
  70%  { transform: rotate(7deg) scaleY(0.87); }
  100% { transform: rotate(10deg) scaleY(0.85); }
}
@keyframes tense-2 {
  0%   { transform: rotate(-8deg) scaleY(0.87); }
  30%  { transform: rotate(-15deg) scaleY(0.84); }
  60%  { transform: rotate(-4deg) scaleY(0.9); }
  100% { transform: rotate(-8deg) scaleY(0.87); }
}
@keyframes tense-3 {
  0%   { transform: rotate(8deg) scaleY(0.86); }
  35%  { transform: rotate(2deg) scaleY(0.9); }
  65%  { transform: rotate(13deg) scaleY(0.83); }
  100% { transform: rotate(8deg) scaleY(0.86); }
}
@keyframes tense-4 {
  0%   { transform: rotate(-10deg) scaleY(0.85); }
  45%  { transform: rotate(-3deg) scaleY(0.88); }
  75%  { transform: rotate(-15deg) scaleY(0.84); }
  100% { transform: rotate(-10deg) scaleY(0.85); }
}

@keyframes celebrate-1 {
  0%   { transform: rotate(10deg); }
  30%  { transform: rotate(25deg); }
  60%  { transform: rotate(2deg); }
  100% { transform: rotate(10deg); }
}
@keyframes celebrate-2 {
  0%   { transform: rotate(-8deg); }
  25%  { transform: rotate(5deg); }
  55%  { transform: rotate(-20deg); }
  80%  { transform: rotate(-4deg); }
  100% { transform: rotate(-8deg); }
}
@keyframes celebrate-3 {
  0%   { transform: rotate(8deg); }
  35%  { transform: rotate(22deg); }
  70%  { transform: rotate(-2deg); }
  100% { transform: rotate(8deg); }
}
@keyframes celebrate-4 {
  0%   { transform: rotate(-10deg); }
  20%  { transform: rotate(-22deg); }
  50%  { transform: rotate(0deg); }
  75%  { transform: rotate(-16deg); }
  100% { transform: rotate(-10deg); }
}

@keyframes leopold-idle {
  0%, 100% { transform: scale(0.75) translateY(0) rotate(0deg); }
  30%      { transform: scale(0.75) translateY(-3px) rotate(0.5deg); }
  60%      { transform: scale(0.75) translateY(1px) rotate(-0.5deg); }
}

@keyframes leopold-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-3px); }
  75%      { transform: translateX(3px); }
}

@keyframes leopold-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

/* ── Speech bubble ─────────────────────────────────────────── */
.speech-bubble {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: 10px;
  padding: 8px 10px;
  margin-top: -30px;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--text);
  max-width: 110px;
  text-align: center;
  position: relative;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.speech-bubble::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 8px 8px 8px;
  border-style: solid;
  border-color: transparent transparent var(--surface2) transparent;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 7px 7px 7px;
  border-style: solid;
  border-color: transparent transparent var(--surface) transparent;
}


.speech-bubble.hidden {
  opacity: 0;
}

/* ── Leopold click menu ────────────────────────────────────── */
.leopold-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 90px;
  visibility: hidden;
}

.menu-btn {
  width: 100%;
  padding: 8px 6px;
  border: 1px solid var(--surface2);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.menu-btn:hover {
  background: var(--surface2);
  border-color: var(--accent);
}

.menu-btn:active {
  transform: scale(0.96);
}

.menu-pay { color: #34c759; border-color: rgba(52, 199, 89, 0.3); }
.menu-pay:hover { background: rgba(52, 199, 89, 0.1); border-color: #34c759; }

.menu-pay-all { color: #34c759; border-color: rgba(52, 199, 89, 0.2); }
.menu-pay-all:hover { background: rgba(52, 199, 89, 0.1); border-color: #34c759; }

.menu-borrow { color: #e8a87c; border-color: rgba(232, 168, 124, 0.3); }
.menu-borrow:hover { background: rgba(232, 168, 124, 0.1); border-color: #e8a87c; }

/* ── Mobile: stack layout ──────────────────────────────────── */
@media (max-width: 520px) {
  .game-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .leopold-sidebar {
    position: static;
    width: 100%;
    max-width: 380px;
    flex-wrap: wrap;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding-top: 0;
    margin-bottom: 12px;
    order: -1;
  }

  /* Debt: centered, bigger */
  .debt-counter { text-align: center; width: 100%; margin-bottom: 12px; }
  .info-wrapper { width: 100%; display: flex; justify-content: flex-end; margin-bottom: -20px; }
  .debt-value { font-size: 2.6rem; }
  .debt-label { font-size: 0.95rem; }

  .leopold-row { order: 0; flex-shrink: 0; flex-direction: row; align-items: center; gap: 8px; }
  .speech-bubble { order: 1; min-width: 0; flex: 1; font-size: 0.9rem; }
  .leopold-menu { order: 2; }
  .leopold-row { transform: scale(1.5) translateY(35px) translateX(10px); transform-origin: center; transition: transform 0.3s ease; }
  .leopold-sidebar.menu-open .leopold-row { transform: scale(1.1) translateY(0) translateX(0); }
  .debt-counter { width: 100%; }
  .speech-bubble::before {
    top: 50%; left: -8px; transform: translateY(-50%);
    border-width: 8px 8px 8px 0;
    border-color: transparent var(--surface2) transparent transparent;
  }
  .speech-bubble::after {
    top: 50%; left: -6px; transform: translateY(-50%);
    border-width: 7px 7px 7px 0;
    border-color: transparent var(--surface) transparent transparent;
  }

  /* Buttons: centered row beneath */
  .leopold-menu { width: 100%; flex-direction: row; justify-content: center; gap: 4px; }
  .leopold-menu .menu-btn { padding: 10px 0; font-size: 0.9rem; flex: 1; text-align: center; max-width: 100px; }
}

/* ── Balance bar ───────────────────────────────────────────── */
.balance-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-top: 12px;
  margin-bottom: 16px;
}

.balance-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.balance-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  transition: transform 0.2s ease, color 0.4s ease;
}

.balance-value.pop {
  transform: scale(1.25);
}

.balance-value.negative {
  color: #ff6b6b;
}

/* ── Machine ───────────────────────────────────────────────── */
.machine {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  padding: 16px 12px;
  margin-bottom: 0;
}

.reels {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.reel-window {
  width: 100px;
  height: 200px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--bg);
  border: 2px solid var(--surface2);
  position: relative;
}

.reel-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.reel-strip .sym {
  width: 100px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
  user-select: none;
}

.payline {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 50%;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.5;
  pointer-events: none;
  transform: translateY(-50%);
}

/* ── Result message (top of machine) ───────────────────────── */
.result-msg {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--surface2);
  color: var(--text-muted);
  transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.result-msg:empty {
  color: var(--text-muted);
}

.result-msg.win {
  color: #34c759;
  background: rgba(52, 199, 89, 0.08);
  border-color: rgba(52, 199, 89, 0.3);
}

.result-msg.big-win {
  color: #ffd60a;
  background: rgba(255, 214, 10, 0.1);
  border-color: rgba(255, 214, 10, 0.35);
  animation: result-pop 0.4s ease;
}

.result-msg.lose {
  color: var(--text-muted);
}

@keyframes result-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ── Bet controls ──────────────────────────────────────────── */
.bet-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.bet-display {
  font-size: 1rem;
  font-weight: 600;
  min-width: 80px;
  text-align: center;
}

.bet-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--surface2);
  background: var(--surface);
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.bet-btn:hover {
  background: var(--surface2);
  border-color: var(--accent);
}

.bet-btn:active {
  transform: scale(0.95);
}

/* ── Spin row ──────────────────────────────────────────────── */
.spin-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.spin-row .spin-btn {
  flex: 1;
}

/* ── Spin button ───────────────────────────────────────────── */
.spin-btn {
  display: block;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #000;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.spin-btn:hover {
  opacity: 0.85;
}

.spin-btn:active {
  transform: scale(0.98);
}

.spin-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── All In button ─────────────────────────────────────────── */
.allin-btn {
  width: 100px;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  background: #ff6b6b;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.allin-btn:hover {
  opacity: 0.85;
}

.allin-btn:active {
  transform: scale(0.98);
}

.allin-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Auto spin button ──────────────────────────────────────── */
.autospin-btn {
  display: block;
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border: none;
  border-radius: var(--radius);
  background: #e8a33c;
  color: #000;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.autospin-btn:hover {
  opacity: 0.85;
}

.autospin-btn.active {
  background: #d4782a;
}

.autospin-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Reset button ──────────────────────────────────────────── */
.reset-btn {
  display: block;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  margin-bottom: 32px;
}

.reset-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--text);
}

/* ── Info button & popup ──────────────────────────────────── */
.info-wrapper {
  position: relative;
  align-self: flex-end;
  z-index: 10;
  margin-bottom: -10px;
}

.info-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--surface2);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.info-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.info-popup {
  display: none;
  position: absolute;
  top: 32px;
  right: 0;
  width: 240px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  text-align: left;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.info-popup.visible {
  display: block;
}

.info-popup p {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text);
}

/* ── How to Play ───────────────────────────────────────────── */
.how-to-play-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.how-to-play-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--text);
}

.how-to-play {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 8px;
  margin-bottom: 12px;
  visibility: hidden;
}

.how-to-play p {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.how-to-play p:last-child {
  margin-bottom: 0;
}

.how-to-play strong {
  color: var(--text);
}

/* ── Paytable ──────────────────────────────────────────────── */
.paytable {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  padding: 20px;
}

.paytable h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-muted);
}

.paytable-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pay-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

.pay-symbols {
  font-size: 1.3rem;
  letter-spacing: 4px;
}

.pay-mult {
  font-weight: 600;
  color: var(--accent);
}

/* ── Game over overlay ─────────────────────────────────────── */
.game-over-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.game-over-content {
  text-align: center;
  padding: 40px 32px;
  max-width: 360px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-over-content .spin-btn {
  width: 200px;
}

.game-over-emoji {
  font-size: 4rem;
  margin-bottom: 16px;
}

.game-over-content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.game-over-content p {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.game-over-overlay.win h2 {
  color: #34c759;
}

.game-over-overlay.lose h2 {
  color: #ff6b6b;
}

/* ── Slot machine animations ───────────────────────────────── */

/* Reel spin: blur — increasing per reel */
.reel-window:nth-child(1) .reel-strip.spinning { filter: blur(1.5px); }
.reel-window:nth-child(2) .reel-strip.spinning { filter: blur(3px); }
.reel-window:nth-child(3) .reel-strip.spinning { filter: blur(4.5px); }

/* Reel window glow while spinning */
.reel-window.active-spin {
  border-color: var(--accent);
  box-shadow: inset 0 0 12px rgba(0, 207, 255, 0.15);
}
.reel-window.active-spin {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.reel-window:not(.active-spin) {
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

/* Reel window landing pulse — increasing intensity per reel */
@keyframes reel-land-1 {
  0%   { transform: scaleY(1); }
  40%  { transform: scaleY(0.97); }
  70%  { transform: scaleY(1.015); }
  100% { transform: scaleY(1); }
}

@keyframes reel-land-2 {
  0%   { transform: scaleY(1); }
  40%  { transform: scaleY(0.94); }
  70%  { transform: scaleY(1.03); }
  100% { transform: scaleY(1); }
}

@keyframes reel-land-3 {
  0%   { transform: scaleY(1); }
  30%  { transform: scaleY(0.9); }
  55%  { transform: scaleY(1.05); }
  75%  { transform: scaleY(0.97); }
  100% { transform: scaleY(1); }
}

.reel-window:nth-child(1).landed { animation: reel-land-1 0.25s ease; }
.reel-window:nth-child(2).landed { animation: reel-land-2 0.3s ease; }
.reel-window:nth-child(3).landed { animation: reel-land-3 0.4s ease; }

/* ── Symbol match highlights ───────────────────────────────── */
@keyframes sym-match {
  0%   { transform: scale(1); box-shadow: 0 0 0 transparent; }
  50%  { transform: scale(1.15); box-shadow: 0 0 20px rgba(52, 199, 89, 0.5); }
  100% { transform: scale(1.05); box-shadow: 0 0 10px rgba(52, 199, 89, 0.3); }
}

@keyframes sym-match-triple {
  0%   { transform: scale(1); box-shadow: 0 0 0 transparent; }
  30%  { transform: scale(1.2); box-shadow: 0 0 25px rgba(255, 214, 10, 0.6); }
  60%  { transform: scale(1.1); box-shadow: 0 0 15px rgba(255, 214, 10, 0.4); }
  100% { transform: scale(1.1); box-shadow: 0 0 18px rgba(255, 214, 10, 0.35); }
}

.sym.match {
  animation: sym-match 0.5s ease forwards;
  border-radius: 12px;
  background: rgba(52, 199, 89, 0.1);
  z-index: 1;
  position: relative;
}

.sym.match-triple {
  animation: sym-match-triple 0.6s ease forwards;
  border-radius: 12px;
  background: rgba(255, 214, 10, 0.1);
  z-index: 1;
  position: relative;
}

/* ── Spin button states ────────────────────────────────────── */
@keyframes btn-pulse {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}

.spin-btn.is-spinning {
  animation: btn-pulse 1s ease-in-out infinite;
  pointer-events: none;
}

/* ── Balance flash on loss ─────────────────────────────────── */
@keyframes balance-flash-red {
  0%   { color: #ff6b6b; }
  100% { color: var(--accent); }
}

.balance-value.flash-loss {
  animation: balance-flash-red 0.5s ease;
}

.balance-value.negative.flash-loss {
  animation: balance-flash-red 0.5s ease;
}

/* ── Machine shake & win flash ─────────────────────────────── */
@keyframes machine-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-4px); }
  40%      { transform: translateX(4px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(3px); }
}

.machine.shake {
  animation: machine-shake 0.4s ease;
}

@keyframes flash-win {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50%      { box-shadow: 0 0 30px rgba(0, 207, 255, 0.4); }
}

.machine.win-flash {
  animation: flash-win 0.6s ease 2;
}
