/* ===== Tetris guideline 10×20 — substitui board/tray Block Blast ===== */

html.tx-tetris-root,
body.tx-tetris-root {
  background-color: #14081f !important;
}

.tx-tetris-mode.game-page,
.tx-tetris-mode.tutorial-game-page {
  /* HUD real ~ padding-top 60 + placar; embaixo: resgatar + mute */
  --tx-top-chrome: calc(168px + env(safe-area-inset-top, 0px));
  --tx-bottom-chrome: calc(118px + env(safe-area-inset-bottom, 0px));
  /* transparente: o fundo fantasy vem do html/body.game-active */
  background: transparent !important;
  align-items: center !important;
  overflow-x: hidden !important;
}

/* Esconde UI Block Blast (board quadrado + bandeja drag) */
.tx-tetris-mode .board,
.tx-tetris-mode .tray,
.tx-tetris-mode .drag-ghost,
.tx-tetris-mode .tx-controls {
  display: none !important;
}

/* Loading só some via JS (tetris-play dismissLoading) — não forçar hide no CSS */

/* Stage: centralizado; altura deixa espaço pro botão resgatar */
.tx-stage {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  align-self: center !important;
  width: min(
    100%,
    calc((100dvh - var(--tx-top-chrome) - var(--tx-bottom-chrome)) * 0.5),
    380px
  );
  max-width: 100%;
  margin: 0 auto 10px !important;
  padding: 0;
  order: 2;
  z-index: 6;
  box-sizing: border-box;
  flex: 0 0 auto;
}

.tx-stage-main {
  flex: 0 1 auto;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.tx-well-frame {
  background:
    linear-gradient(160deg, rgba(80, 36, 140, 0.55) 0%, rgba(26, 8, 56, 0.72) 100%);
  border: 2px solid rgba(255, 150, 255, 0.5);
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(255, 120, 220, 0.28),
    0 0 32px rgba(160, 64, 255, 0.32),
    0 14px 36px rgba(0, 0, 0, 0.45);
  padding: 5px;
  overflow: hidden;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  backdrop-filter: blur(2px);
}

.tx-well {
  position: relative;
  width: 100%;
  /* 10×20 → aspect 1:2 */
  aspect-ratio: 10 / 20;
  max-height: calc(100dvh - var(--tx-top-chrome) - var(--tx-bottom-chrome));
  margin: 0 auto;
  background:
    linear-gradient(180deg, rgba(40, 12, 72, 0.55), rgba(12, 4, 28, 0.78)),
    rgba(10, 4, 22, 0.65);
  border-radius: 10px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
  cursor: pointer;
}

.tx-well-msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(220, 235, 255, 0.75);
  font-size: 0.85rem;
  text-align: center;
  line-height: 1.4;
  padding: 12px;
}

.tx-well-msg small {
  opacity: 0.65;
  margin-top: 4px;
  font-size: 0.7rem;
}

.tx-side,
.tx-next,
.tx-next-slot,
.tx-mini {
  display: none !important;
}

.tx-grid {
  position: absolute;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.tx-col-guide {
  position: absolute;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(130, 175, 255, 0.12) 0%,
    rgba(130, 175, 255, 0.04) 100%
  );
  z-index: 0;
}

.tx-cell {
  position: absolute;
  border-radius: 22%;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 2;
}

.tx-cell.tx-c1 {
  background: linear-gradient(155deg, #9ef6ff 0%, #22d3ee 42%, #0284c7 100%);
}
.tx-cell.tx-c2,
.tx-mini i.tx-c2 {
  background: linear-gradient(155deg, #ffe9a0 0%, #fbbf24 42%, #d97706 100%);
}
.tx-cell.tx-c3,
.tx-mini i.tx-c3 {
  background: linear-gradient(155deg, #f0abfc 0%, #d946ef 42%, #a21caf 100%);
}
.tx-cell.tx-c4,
.tx-mini i.tx-c4 {
  background: linear-gradient(155deg, #bbf7d0 0%, #4ade80 42%, #16a34a 100%);
}
.tx-cell.tx-c5,
.tx-mini i.tx-c5 {
  background: linear-gradient(155deg, #fda4af 0%, #f43f5e 42%, #be123c 100%);
}
.tx-cell.tx-c6,
.tx-mini i.tx-c6 {
  background: linear-gradient(155deg, #93c5fd 0%, #3b82f6 42%, #1d4ed8 100%);
}
.tx-cell.tx-c7,
.tx-mini i.tx-c7 {
  background: linear-gradient(155deg, #fef08a 0%, #facc15 42%, #ca8a04 100%);
}
.tx-mini i.tx-c1 {
  background: linear-gradient(155deg, #9ef6ff 0%, #22d3ee 42%, #0284c7 100%);
}

.tx-cell.tx-locked,
.tx-cell.tx-active {
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.55),
    inset -2px -3px 0 rgba(0, 0, 0, 0.28),
    0 2px 6px rgba(0, 0, 0, 0.35),
    0 0 10px rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.tx-cell.tx-active {
  z-index: 3;
  filter: brightness(1.1) saturate(1.15);
  will-change: top, left;
  animation: tx-active-pulse 1.1s ease-in-out infinite;
}

@keyframes tx-active-pulse {
  0%,
  100% {
    filter: brightness(1.08) saturate(1.1);
  }
  50% {
    filter: brightness(1.18) saturate(1.2);
  }
}

.tx-cell.tx-ghost {
  background: transparent !important;
  border: 1.5px solid rgba(200, 220, 255, 0.32);
  box-shadow: none;
  opacity: 0.5;
  z-index: 1;
}

.tx-gain-float {
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translate(-50%, 0);
  z-index: 40;
  pointer-events: none;
  color: #fff59a;
  font-size: 1.4rem;
  font-weight: 900;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
  animation: tx-gain-rise 1.1s ease-out forwards;
}

@keyframes tx-gain-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.9);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -36px) scale(1);
  }
}

.tx-lose-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(20, 6, 40, 0.78);
  backdrop-filter: blur(4px);
}

.tx-lose-card {
  width: min(100%, 360px);
  background: linear-gradient(180deg, #2a1248 0%, #160828 100%);
  border: 1px solid rgba(255, 122, 217, 0.35);
  border-radius: 16px;
  padding: 22px 20px 18px;
  text-align: center;
  box-shadow: 0 18px 48px rgba(40, 0, 60, 0.55);
  color: #ffe8fb;
}

.tx-lose-card h2 {
  margin: 0 0 8px;
  font-size: 1.45rem;
}

.tx-lose-bet {
  margin: 0 0 10px;
  color: #ff7ad9;
  font-size: 1.6rem;
  font-weight: 800;
}

.tx-lose-note {
  margin: 0 0 18px;
  color: rgba(255, 232, 251, 0.75);
  font-size: 0.92rem;
  line-height: 1.4;
}

.tx-lose-btn {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 12px 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff9ae0, #ff4eb8 45%, #c84bff);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(255, 78, 184, 0.4);
}

.tx-lose-btn.tx-lose-ghost {
  background: transparent;
  border: 1px solid rgba(255, 180, 255, 0.28);
  color: rgba(255, 232, 251, 0.92);
  box-shadow: none;
}

.tx-tetris-mode .cashout-btn,
.tx-tetris-mode .tutorial-cashout-wrap {
  order: 3;
  align-self: center !important;
  width: min(100%, 380px) !important;
  max-width: 100%;
  margin: 4px auto 0 !important;
  flex: 0 0 auto;
  min-height: 52px;
}

/* mute fica abaixo do poço, sem cobrir o resgatar */
.tx-tetris-mode .game-mute-btn {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
  transform: translateX(-50%);
  margin: 0 !important;
  z-index: 85;
}

@media (max-width: 480px) {
  .tx-tetris-mode.game-page,
  .tx-tetris-mode.tutorial-game-page {
    --tx-top-chrome: calc(176px + env(safe-area-inset-top, 0px));
    --tx-bottom-chrome: calc(128px + env(safe-area-inset-bottom, 0px));
  }

  .tx-stage {
    width: min(
      100%,
      calc((100dvh - var(--tx-top-chrome) - var(--tx-bottom-chrome)) * 0.5)
    );
  }
}
