/* ═══ GAME SCREEN ═══ */
.game-app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.game-overlay {
  background: linear-gradient(
    180deg,
    rgba(0,0,0,0.55) 0%,
    rgba(0,0,0,0.05) 25%,
    rgba(0,0,0,0.05) 75%,
    rgba(0,0,0,0.3) 100%
  );
}

.game-app .bg-layer,
.game-app .bg-overlay {
  opacity: 0;
  pointer-events: none;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  touch-action: none;
  cursor: crosshair;
  background: #2a1810;
}

/* HUD */
.game-hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  pointer-events: none;
}

.game-hud > * { pointer-events: auto; }

.hud-left, .hud-right { flex: 0 0 auto; }
.hud-center { flex: 1; min-width: 0; }

/* ── Chances (✕) ── */
.lives-bar {
  display: flex;
  gap: 5px;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  backdrop-filter: blur(6px);
}

.lives-bar.shake {
  animation: life-shake 0.45s ease;
}

.life-slot {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.14);
  overflow: hidden;
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}

.life-mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: #ff5a5a;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(1);
  opacity: 1;
}

.life-slot.active {
  background: rgba(255, 70, 70, 0.18);
  border-color: rgba(255, 120, 120, 0.65);
  box-shadow: 0 0 12px rgba(255, 70, 70, 0.25);
}

.life-slot.lost {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.life-slot.lost .life-mark {
  opacity: 0;
  transform: scale(0.2) rotate(90deg);
  pointer-events: none;
}

.life-slot.just-lost .life-mark {
  animation: life-pop-out 0.55s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes life-pop-out {
  0% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    color: #ff5a5a;
  }
  40% {
    opacity: 1;
    transform: scale(1.35) rotate(-12deg);
    color: #ff2222;
  }
  100% {
    opacity: 0;
    transform: scale(0) rotate(90deg);
  }
}

@keyframes life-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ── Ganhos / Meta ── */
.hud-money-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 0;
  background: none;
  border: none;
  text-align: center;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.8));
}

.hud-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(255, 215, 100, 0.6);
  margin-bottom: 0;
}

.hud-score {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 5.5vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffd700;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85), 0 0 14px rgba(255, 215, 0, 0.2);
  line-height: 1.05;
  transition: color 0.3s, text-shadow 0.3s;
}

.hud-goal {
  display: block;
  font-size: clamp(0.8rem, 3.2vw, 0.95rem);
  font-weight: 800;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.03em;
  margin-top: 2px;
  transition: color 0.3s, text-shadow 0.3s;
}

.hud-goal.goal-hit {
  color: rgba(255, 255, 255, 0.65);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.hud-goal.is-free-round {
  color: #ffe082;
  text-shadow: 0 0 10px rgba(255, 224, 130, 0.45);
  letter-spacing: 0.04em;
}

/* ── Botão encerrar aposta ── */
.btn-cashout {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  white-space: nowrap;
  padding: 13px 22px;
  font-size: clamp(0.72rem, 3.2vw, 0.88rem);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.72);
  border: 2px solid rgba(255, 107, 53, 0.85);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 107, 53, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: cashout-enter 0.4s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.btn-cashout.pulse {
  animation: cashout-enter 0.4s cubic-bezier(0.34, 1.4, 0.64, 1) both,
             cashout-ring 1.6s ease-in-out 0.4s infinite;
}

@keyframes cashout-enter {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes cashout-ring {
  0%, 100% {
    box-shadow:
      0 4px 20px rgba(0, 0, 0, 0.45),
      0 0 0 1px rgba(255, 107, 53, 0.15),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 107, 53, 0.85);
  }
  50% {
    box-shadow:
      0 4px 24px rgba(255, 107, 53, 0.35),
      0 0 0 3px rgba(255, 107, 53, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 140, 90, 1);
  }
}

.btn-cashout:active {
  transform: translateX(-50%) scale(0.97);
  background: rgba(255, 107, 53, 0.25);
}

.btn-pause {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  color: #fff;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-pause:active { transform: scale(0.9); }

/* Combo overlay */
.combo-overlay {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  background: linear-gradient(180deg, #fff 0%, #ff6b35 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.7));
  pointer-events: none;
  animation: combo-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes combo-pop {
  from { opacity: 0; transform: translateX(-50%) scale(0.5); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* Game Over / Cashout modal */
.gameover-title {
  font-size: 1.85rem;
  color: #ff5555;
  text-shadow: 0 0 20px rgba(255, 68, 68, 0.45);
  margin-bottom: 10px;
}

.gameover-lead {
  font-size: 0.95rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.78);
  margin: 0 0 18px;
}

.gameover-box .btn-primary,
.gameover-box .btn-secondary {
  width: 100%;
  margin-top: 8px;
}

.go-stat--highlight {
  border: 1px solid rgba(255, 180, 80, 0.35);
  background: rgba(255, 140, 40, 0.12);
}

.go-stat--progress {
  flex-direction: row;
  justify-content: center;
  padding: 10px 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.go-progress-line {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.go-progress-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1 1 0;
  min-width: 0;
  max-width: calc(50% - 14px);
}

.go-progress-item .go-label {
  font-size: 0.62rem;
  letter-spacing: 0.03em;
  text-transform: none;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.2;
  white-space: nowrap;
}

.go-progress-item .go-value {
  font-size: clamp(0.82rem, 3.4vw, 1.1rem);
  font-weight: 800;
  color: #ffd54f;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.go-progress-sep {
  font-size: 1rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
  flex: 0 0 auto;
  align-self: center;
  line-height: 1;
}

.go-stat--highlight:not(.go-stat--progress) .go-value {
  color: #ffd54f;
  font-size: 1.75rem;
}

.modal-title.cashout-title {
  color: #ffd54f;
  text-shadow: 0 0 20px rgba(255, 213, 79, 0.4);
  margin-bottom: 8px;
}

.cashout-lead {
  font-size: 0.95rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.78);
  margin: 0 0 20px;
}

.cashout-stats {
  margin-bottom: 24px;
}

.go-stat--cashout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px 16px 26px;
  border: 2px solid rgba(255, 200, 80, 0.45);
  background: linear-gradient(180deg, rgba(255, 160, 40, 0.18) 0%, rgba(255, 120, 20, 0.08) 100%);
  box-shadow: 0 0 28px rgba(255, 180, 60, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.cashout-amount-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 220, 140, 0.75);
}

.cashout-amount {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(2.15rem, 9vw, 2.85rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #ffe066;
  text-shadow:
    0 0 24px rgba(255, 215, 0, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.65);
}

.go-progress-line--single {
  justify-content: center;
}

.go-progress-line--single .go-progress-item {
  max-width: 100%;
  flex: 0 1 auto;
}

.demo-promo-box {
  text-align: center;
  max-width: 340px;
}

.demo-promo-title {
  color: #ffd54f;
  font-size: 1.75rem;
  margin-bottom: 12px;
}

.demo-promo-lead {
  font-size: 1.05rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.92);
  margin: 0 0 10px;
}

.demo-promo-lead strong {
  color: #ffd700;
  font-size: 1.2rem;
}

.demo-promo-text {
  font-size: 0.9rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.65);
  margin: 0 0 20px;
}

.demo-promo-box .btn-primary,
.demo-promo-box .btn-secondary {
  width: 100%;
  margin-top: 8px;
}

.demo-promo-box .btn-primary {
  text-decoration: none;
  display: block;
  text-align: center;
  box-sizing: border-box;
}

.gameover-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.go-stat {
  display: flex;
  flex-direction: column;
  padding: 8px;
  background: rgba(0,0,0,0.3);
  border-radius: 10px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.go-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.5);
}

.go-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffd700;
}

/* Rotate message */
.rotate-msg {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.85);
  text-align: center;
  gap: 16px;
}

.rotate-icon {
  display: inline-flex;
  color: #fff;
  animation: spin-hint 2s ease-in-out infinite;
}

.rotate-icon .icon {
  width: 3rem;
  height: 3rem;
}

@keyframes spin-hint {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}

.rotate-msg p {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.5;
}

@media (max-width: 360px) {
  .game-hud { padding: 8px 10px; gap: 6px; }
  .life-slot { width: 28px; height: 28px; }
  .btn-pause { width: 38px; height: 38px; }
  .hud-money-panel { padding: 6px 10px 8px; }
}

@media (orientation: landscape) and (max-height: 500px) {
  .rotate-msg:not(.hidden) { display: flex; }
}
