/* =====================================================
   ARCANE TRUCO — THE DUEL
   Cena pintada em camadas + UI flutuante.
   Asset paths preservam acentos (ç, á, ã) — UTF-8 OK
   nos navegadores modernos.
   ===================================================== */

:root {
  --c-bg-deep: #0a0612;
  --c-bg-mid: #14102a;
  --c-bg-soft: #1d1740;
  --c-stone: #2a2440;
  --c-stone-light: #3a3358;
  --c-purple: #6b3fa0;
  --c-cyan: #4ad6e0;
  --c-cyan-glow: #66f0ff;
  --c-green-magic: #6fe09a;
  --c-gold: #c9a24a;
  --c-gold-bright: #e9c267;
  --c-gold-deep: #8a6a2a;
  --c-blood: #b03050;
  --c-text: #e8e4f5;
  --c-text-soft: #b3a8d4;
  --c-text-dim: #7a6f9a;

  --suit-copas: #d34960;
  --suit-ouros: #e9c267;
  --suit-espadas: #4ad6e0;
  --suit-paus: #6fe09a;

  --font-display: 'Cinzel', 'Times New Roman', serif;
  --font-body: 'Cormorant Garamond', Georgia, serif;
  --font-ui: system-ui, -apple-system, sans-serif;

  --radius-frame: 6px;
  --shadow-arcane: 0 0 24px rgba(106, 192, 255, 0.25), 0 0 48px rgba(106, 63, 160, 0.18);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--c-text);
  background: transparent;
  user-select: none;
}

.svg-filters {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* =====================================================
   SCREENS
   ===================================================== */

.screen {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1;
}

.screen.active {
  display: block;
}

.shared-background {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  background: url('assets/cenario/background.png') center/cover no-repeat;
  filter: saturate(1.08) contrast(1.04) brightness(0.82);
}

/* =====================================================
   TITLE SCREEN
   ===================================================== */

#title-screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

#title-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  /* Overlay escurecido para destacar o logo */
  background:
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0.65) 100%);
}

.scene-transition-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.scene-transition-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.title-bg {
  position: absolute;
  inset: 0;
  background: transparent;
  filter: none;
  overflow: hidden;
  z-index: 0;
}

.title-bg-video {
  /* Vortex centralizado atrás do logo (TRUCO ARCANO).
     O vídeo original tem o "olho" do vortex deslocado do centro do frame —
     então puxamos o vídeo pra esquerda E pra cima até o olho cair atrás
     do logo. Escala >1 garante que não apareça borda preta depois do shift.

     Tunáveis (em % da própria altura/largura escalada do vídeo):
       --vortex-shift-x  =  negativo puxa pra esquerda
       --vortex-shift-y  =  negativo puxa pra cima */
  --vortex-shift-x: -10%;
  --vortex-shift-y: -4%;
  object-position: 50% 50%;
  transform:
    scale(1.28) translate(var(--vortex-shift-x), var(--vortex-shift-y));
  transform-origin: center center;
}

.bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.title-bg::after {
  /* Overlay desativado — vídeo da tela inicial fica limpo. */
  content: none;
}

.title-table-layer {
  /* Mesa removida da tela inicial — o vídeo fala por si. */
  display: none;
}

.title-content {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 40px;
  width: min(700px, 90vw);
  max-width: 700px;
}

#title-screen.is-leaving .title-content {
  pointer-events: none;
  animation: title-duel-fade-out 560ms cubic-bezier(.18, .76, .28, 1) both;
}

.title-logo {
  max-width: 494px;
  width: 80%;
  margin-bottom: 28px;
  filter: drop-shadow(0 0 24px rgba(74, 214, 224, 0.5));
  animation: pulse-glow 4s ease-in-out infinite;
}

@keyframes pulse-glow {

  0%,
  100% {
    filter: drop-shadow(0 0 18px rgba(74, 214, 224, 0.4));
  }

  50% {
    filter: drop-shadow(0 0 32px rgba(74, 214, 224, 0.7));
  }
}

@keyframes title-duel-fade-out {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }

  100% {
    opacity: 0;
    transform: translateY(-14px) scale(0.985);
    filter: blur(4px);
  }
}

.title-name {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, var(--c-gold-bright) 0%, var(--c-gold) 50%, var(--c-gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 28px rgba(201, 162, 74, 0.35);
  margin-bottom: 4px;
}

.title-sub {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--c-cyan);
  letter-spacing: 0.4em;
  font-weight: 500;
  margin-bottom: 28px;
}

.title-flavor {
  font-style: italic;
  color: var(--c-text-soft);
  font-size: 1.15rem;
  margin-bottom: 38px;
}

/* =====================================================
   ARCANE BUTTONS
   ===================================================== */

.arcane-btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  padding: 12px 28px;
  background: linear-gradient(180deg, var(--c-stone-light) 0%, var(--c-stone) 100%);
  color: var(--c-gold-bright);
  border: 2px solid var(--c-gold-deep);
  border-radius: var(--radius-frame);
  cursor: pointer;
  position: relative;
  text-transform: uppercase;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -2px 4px rgba(0, 0, 0, 0.6),
    0 4px 14px rgba(0, 0, 0, 0.55);
}

.arcane-btn::before,
.arcane-btn::after {
  content: "✦";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-gold-deep);
  font-size: 0.7rem;
  opacity: 0.8;
  transition: color 0.2s ease;
}

.arcane-btn::before {
  left: 8px;
}

.arcane-btn::after {
  right: 8px;
}

.arcane-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--c-gold-bright);
  color: #fff5d6;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 22px rgba(201, 162, 74, 0.45),
    0 6px 18px rgba(0, 0, 0, 0.6);
}

.arcane-btn:hover:not(:disabled)::before,
.arcane-btn:hover:not(:disabled)::after {
  color: var(--c-gold-bright);
}

.arcane-btn:active:not(:disabled) {
  transform: translateY(0);
}

.arcane-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.arcane-btn[hidden] {
  display: none !important;
}

.arcane-btn.primary {
  font-size: 1.1rem;
  padding: 16px 44px;
  background: linear-gradient(180deg, #3d2e6e 0%, #1f1840 100%);
  border-color: var(--c-cyan);
  color: var(--c-cyan-glow);
  box-shadow:
    inset 0 1px 0 rgba(74, 214, 224, 0.2),
    0 0 28px rgba(74, 214, 224, 0.35),
    0 6px 20px rgba(0, 0, 0, 0.6);
}

.arcane-btn.primary:hover:not(:disabled) {
  border-color: var(--c-cyan-glow);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(74, 214, 224, 0.3),
    0 0 38px rgba(74, 214, 224, 0.6),
    0 6px 24px rgba(0, 0, 0, 0.7);
}

.arcane-btn.truco {
  color: var(--c-gold-bright);
  border-color: var(--c-gold);
}

.arcane-btn.raise {
  color: #ff9a4a;
  border-color: #aa5a1a;
}

.arcane-btn.accept {
  color: var(--c-green-magic);
  border-color: #2a6a4a;
}

.arcane-btn.run {
  color: var(--c-blood);
  border-color: #602030;
}

.arcane-btn.pass {
  color: var(--c-text-soft);
  border-color: var(--c-stone-light);
}

/* =====================================================
   GAME SCREEN — cena fullscreen + UI flutuante
   ===================================================== */

#game-screen.active {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  bottom: auto;
  width: calc(100vw / 0.9);
  height: calc(100vh / 0.9);
  overflow: hidden;
  background: transparent;
  transform: scale(0.9);
  transform-origin: top left;
}

/* ----------- SCENE: camadas pintadas ----------- */

.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 2;
}

/* Camadas visuais não interceptam cliques. Cliques só nas cartas da mão. */
.layer {
  position: absolute;
  pointer-events: none;
}

/* z=0: fundo */
.layer-bg {
  inset: 0;
  background: transparent;
  overflow: hidden;
  z-index: 0;
}

.layer-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background: linear-gradient(180deg, rgba(10, 6, 18, 0.15) 0%, rgba(10, 6, 18, 0.55) 100%);
}

/* z=2: rival */
.layer-rival {
  top: 4%;
  left: 50%;
  width: 30%;
  max-width: 480px;
  min-width: 260px;
  aspect-ratio: 1 / 1.05;
  transform: translateX(-50%);
  background: url('assets/rival/rival.png') center/contain no-repeat;
  z-index: 4; /* Aumentado para ficar acima do overlay do bg */
  filter: drop-shadow(0 14px 30px rgba(74, 25, 80, 0.55));
  animation: rival-breathe 6s ease-in-out infinite;
}

@keyframes rival-breathe {

  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }

  50% {
    transform: translateX(-50%) translateY(-6px);
  }
}

/* z=2.5: cartas que a Malistrix segura — abaixadas até o nível do peito/braços */
.layer-opp-hand {
  top: 38%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 3;
  perspective: 700px;
  animation: rival-breathe-cards 6s ease-in-out infinite;
}

@keyframes rival-breathe-cards {

  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }

  50% {
    transform: translateX(-50%) translateY(-6px);
  }
}

/* z=3: tampo da mesa */
.layer-table {
  bottom: 0;
  left: 0;
  right: 0;
  height: 48%;
  background:
    url('assets/cenario/mesa.png') bottom center/100% auto no-repeat;
  z-index: 4;
  filter: drop-shadow(0 -10px 30px rgba(74, 214, 224, 0.12));
}

/* z=4: props (ordem do conceito: caneca de madeira esq, caveira centro-esq, moedas/cartas centro, vela direita) */
.layer-props {
  inset: 0;
  z-index: 8;
}

.prop {
  position: absolute;
  pointer-events: none;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.6));
}

.prop-mug {
  /* caneca de madeira: canto esquerdo da mesa */
  bottom: 4%;
  left: 3%;
  width: 11%;
  min-width: 90px;
}

.prop-skull {
  /* caneca caveira: ao centro-esquerda, em frente ao rival */
  bottom: 30%;
  left: 26%;
  width: 9%;
  min-width: 80px;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 14px rgba(74, 214, 224, 0.18));
}

.prop-coins {
  /* moedas: centro-frente da mesa */
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  width: 30%;
  min-width: 240px;
  opacity: 0.95;
}

.prop-candle-r {
  /* vela direita */
  bottom: 16%;
  right: 14%;
  width: 7%;
  min-width: 60px;
  filter: drop-shadow(0 0 22px rgba(255, 180, 90, 0.6));
  animation: candle-flicker 2.4s ease-in-out infinite;
}

.prop-candle-l {
  /* vela esquerda — mais discreta */
  bottom: 36%;
  left: 14%;
  width: 5%;
  min-width: 44px;
  opacity: 0.85;
  filter: drop-shadow(0 0 18px rgba(255, 180, 90, 0.5));
  animation: candle-flicker 3.1s ease-in-out infinite reverse;
}

@keyframes candle-flicker {

  0%,
  100% {
    filter: drop-shadow(0 0 22px rgba(255, 180, 90, 0.6)) brightness(1);
  }

  35% {
    filter: drop-shadow(0 0 26px rgba(255, 200, 110, 0.75)) brightness(1.1);
  }

  60% {
    filter: drop-shadow(0 0 18px rgba(255, 160, 80, 0.5)) brightness(0.92);
  }
}

/* z=5: cartas no centro da mesa — fileira HORIZONTAL deitadas na perspectiva da mesa */
.layer-played {
  position: absolute;
  bottom: 16%;
  /* sobre o tampo da mesa, não no centro do viewport */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  /* HORIZONTAL: opp | vira | self */
  align-items: center;
  gap: 22px;
  z-index: 6;
  pointer-events: none;
}

/* perspective vai DIRETO no pai das cartas pra rotateX surtir efeito */
.played-row {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 110px;
  min-height: 100px;
  justify-content: center;
  perspective: 900px;
  perspective-origin: 50% 0%;
  transform-style: preserve-3d;
}

.vira-spot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  min-height: 100px;
  perspective: 900px;
  perspective-origin: 50% 0%;
  transform-style: preserve-3d;
}

/* z=6: braço frontal do rival — alinhado ao corpo dele e estendendo p/ a mesa */
.layer-rival-arm {
  top: 46%;
  left: 50%;
  transform: translateX(-22%);
  /* hand a esquerda do centro, ombro encostado no rival */
  width: 22%;
  min-width: 200px;
  aspect-ratio: 1.4 / 1;
  background: url('assets/rival/braco_frente_rival.png') center/contain no-repeat;
  z-index: 5;
  /* atrás das cartas jogadas (cartas vencem o braço) */
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.6));
}

/* z=7-9: POV do jogador — proporção igual ao concept (alto e estreito, canto inferior-esquerdo) */
.layer-player {
  bottom: -8%;
  left: -6%;
  width: 30%;
  min-width: 320px;
  height: 92%;
  z-index: 8;
}

.player-hand-bg {
  position: absolute;
  inset: 0;
  background: url('assets/jogador/mao_jogador.png') bottom left/contain no-repeat;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.65));
  z-index: 1;
  pointer-events: none;
}

/* Cartas no leque, sobre os dedos */
.player-hand-cards {
  position: absolute;
  bottom: 22%;
  left: 42%; /* Ajustado */
  width: 50%;
  height: 50%;
  z-index: 5;
  pointer-events: auto;
  /* CRÍTICO: habilita cliques */
  perspective: 900px;
}

/* Polegar GRANDE, à frente das cartas (z=4) */
.player-hand-thumb {
  position: absolute;
  bottom: -10%;
  left: 32%;
  width: 42%;
  aspect-ratio: 1 / 1.25;
  background: url('assets/jogador/dedao_mao_jogador.png') center/contain no-repeat;
  z-index: 4;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

/* =====================================================
   CARDS (3D wrapper + face PNG)
   ===================================================== */

.card {
  --card-w: 100px;
  width: var(--card-w);
  aspect-ratio: 5 / 7;
  position: relative;
  flex-shrink: 0;
  transform-style: preserve-3d;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7));
  transition: transform 0.3s ease, filter 0.25s ease;
}

.card-3d {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.card-face {
  position: absolute;
  inset: 0;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: calc(var(--card-w) * 0.06);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card-front {
  /* PNG ilustrado completo, atribuído via inline-style por carta */
  z-index: 2;
}

.card-back {
  background-image: url('assets/cartas/verso_padrao.png');
  transform: rotateY(180deg);
  z-index: 3;
}

/* Vira por padrão fica de frente. Quando .face-down, vira pro verso */
.card.face-down .card-3d {
  transform: rotateY(180deg);
}

/* Pequena espessura visual */
.card::after {
  content: "";
  position: absolute;
  inset: auto -1px -3px -1px;
  height: 4px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.7));
  border-radius: 0 0 calc(var(--card-w) * 0.06) calc(var(--card-w) * 0.06);
  z-index: 0;
  filter: blur(2px);
}

/* MANILHA: aura roxa pulsante (mesmo idioma da vira no HUD).
   Sem estrela — o fogo já comunica que é manilha. */
/* MANILHA — aura roxa incandescente sempre visível.
   Sem línguas, sem pseudos, sem máscara. Toda aura via filter: drop-shadow stack
   animado por `manilha-incandescent`. No :hover, adiciona ondulação de calor
   (`#truco-heat-haze-filter`) por cima — mesmo efeito do botão de TRUCO. */
.card.is-manilha {
  /* Mantém a ordem natural da mão, removendo z-index fixo */
}

.card.is-manilha::before,
.card.is-manilha::after {
  content: none;
}

.card.is-manilha:hover {
  /* Animação desligada */
  animation: none;
  filter:
    drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 10px rgba(230, 80, 255, 0.9)) drop-shadow(0 0 24px rgba(180, 30, 255, 0.7)) drop-shadow(0 0 42px rgba(130, 10, 255, 0.5));
}

/* Aura roxa pulsante — drop-shadow stack puro em magenta/violeta/profundo. */
@keyframes manilha-incandescent {
  0% {
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 10px rgba(245, 170, 255, 0.85)) drop-shadow(0 0 22px rgba(190, 80, 255, 0.7)) drop-shadow(0 0 40px rgba(125, 30, 220, 0.5));
  }

  50% {
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 14px rgba(255, 200, 255, 1)) drop-shadow(0 0 30px rgba(210, 95, 255, 0.92)) drop-shadow(0 0 50px rgba(140, 40, 230, 0.68));
  }

  100% {
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 10px rgba(245, 170, 255, 0.85)) drop-shadow(0 0 22px rgba(190, 80, 255, 0.7)) drop-shadow(0 0 40px rgba(125, 30, 220, 0.5));
  }
}

/* =====================================================
   MÃO DO JOGADOR — leque, hover, deal animation
   ===================================================== */

.player-hand-cards .card {
  --card-w: 138px;
  --i: 0;
  --total: 3;
  --centered: calc(var(--i) - (var(--total) - 1) / 2);
  --rot: calc(var(--centered) * 28deg);
  --tx: calc(var(--centered) * 82px);
  --ty: calc(var(--centered) * var(--centered) * -16px);
  position: absolute;
  bottom: 0;
  left: 50%;
  transform-origin: bottom center;
  transform: translateX(-50%) translate(var(--tx), var(--ty)) rotate(var(--rot));
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.25s ease, filter 0.2s ease;
}

.player-hand-cards .card.fresh {
  animation: card-deal 0.9s cubic-bezier(.18, .76, .24, 1.12) backwards;
}

.player-hand-cards .card.fresh:nth-child(1) {
  animation-delay: 1.12s;
}

.player-hand-cards .card.fresh:nth-child(2) {
  animation-delay: 1.48s;
}

.player-hand-cards .card.fresh:nth-child(3) {
  animation-delay: 1.84s;
}

@keyframes card-deal {
  0% {
    transform: translateX(-50%) translate(calc(var(--tx) + 420px), -250px) rotate(28deg) scale(0.72);
    opacity: 0;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.45));
  }

  58% {
    opacity: 1;
    transform: translateX(-50%) translate(calc(var(--tx) - 16px), calc(var(--ty) - 24px)) rotate(calc(var(--rot) - 8deg)) scale(1.04);
  }

  100% {
    transform: translateX(-50%) translate(var(--tx), var(--ty)) rotate(var(--rot));
    opacity: 1;
  }
}

.player-hand-cards .card:hover {
  transform: translateX(-50%) translate(var(--tx), -32px) rotate(var(--rot)) scale(1.1);
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 22px rgba(74, 214, 224, 0.8));
  z-index: 50;
}

.player-hand-cards .card.disabled {
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7)) brightness(0.7) saturate(0.6);
  cursor: not-allowed;
}

.player-hand-cards .card.disabled:hover {
  transform: translateX(-50%) translate(var(--tx), var(--ty)) rotate(var(--rot));
}

/* =====================================================
   CARTAS NA MESA — em perspectiva 3D (deitadas)
   ===================================================== */

.played-row .card {
  --card-w: 160px;
  --card-tilt: 0deg;
  --table-card-scale: 1;
  transform: translateY(-6px) rotateZ(var(--card-tilt)) scale(var(--table-card-scale));
  transform-origin: center;
  z-index: 2;
}

/* tilts aleatórios pra parecer cartas largadas */
#played-opp .card {
  --card-tilt: 5deg;
}

#played-self .card {
  --card-tilt: -5deg;
}

.played-row .card.played {
  animation:
    card-play 0.48s cubic-bezier(.2, .7, .3, 1.22),
    card-float 3.4s ease-in-out 0.48s infinite;
}

@keyframes card-play {
  0% {
    transform: translateY(42px) rotateZ(calc(var(--card-tilt) - 10deg)) scale(0.72);
    opacity: 0;
  }

  70% {
    transform: translateY(-16px) rotateZ(var(--card-tilt)) scale(calc(var(--table-card-scale) * 1.06));
    opacity: 1;
  }

  100% {
    transform: translateY(-6px) rotateZ(var(--card-tilt)) scale(var(--table-card-scale));
    opacity: 1;
  }
}

@keyframes card-float {

  0%,
  100% {
    transform: translateY(-6px) rotateZ(var(--card-tilt)) scale(var(--table-card-scale));
  }

  50% {
    transform: translateY(-18px) rotateZ(var(--card-tilt)) scale(var(--table-card-scale));
  }
}

.played-row .card.winner-glow {
  filter: drop-shadow(0 9px 18px rgba(0, 0, 0, 0.75)) drop-shadow(0 0 34px rgba(111, 224, 154, 0.95));
  animation:
    card-float 3.4s ease-in-out infinite,
    winner-pulse 1.2s ease-in-out infinite;
}

.played-row .card.loser-fade {
  filter: brightness(0.55) saturate(0.5);
  opacity: 0.68;
}

@keyframes winner-pulse {

  0%,
  100% {
    filter: drop-shadow(0 9px 18px rgba(0, 0, 0, 0.75)) drop-shadow(0 0 24px rgba(111, 224, 154, 0.85));
  }

  50% {
    filter: drop-shadow(0 9px 18px rgba(0, 0, 0, 0.75)) drop-shadow(0 0 44px rgba(111, 224, 154, 1));
  }
}

/* VIRA: carta deitada e levemente girada */
.vira-spot .card {
  --card-w: 226px;
  --card-rx: 66deg;
  --card-tilt: 14deg;
  transform: rotateX(var(--card-rx)) rotateZ(var(--card-tilt)) scaleY(0.42);
  transform-origin: center 70%;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.74)) drop-shadow(0 0 30px rgba(233, 194, 103, 0.84));
}

.vira-spot .card::after {
  display: none;
}

/* =====================================================
   CARTAS NA MÃO DO RIVAL — face-down em leque inclinado
   ===================================================== */

.layer-opp-hand .card {
  --card-w: 54px;
  --opp-final-transform: rotateY(0deg) rotateZ(0deg) translateY(-4px);
  pointer-events: none;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.7));
  transform: var(--opp-final-transform);
}

.layer-opp-hand .card:nth-child(1) {
  --opp-final-transform: rotateY(20deg) rotateZ(-14deg) translateX(-6px);
}

.layer-opp-hand .card:nth-child(2) {
  --opp-final-transform: rotateY(0deg) rotateZ(0deg) translateY(-4px);
}

.layer-opp-hand .card:nth-child(3) {
  --opp-final-transform: rotateY(-20deg) rotateZ(14deg) translateX(6px);
}

.layer-opp-hand .card.fresh {
  animation: opp-card-deal 0.78s cubic-bezier(.18, .76, .24, 1.12) backwards;
}

.layer-opp-hand .card.fresh:nth-child(1) {
  animation-delay: 1.26s;
}

.layer-opp-hand .card.fresh:nth-child(2) {
  animation-delay: 1.58s;
}

.layer-opp-hand .card.fresh:nth-child(3) {
  animation-delay: 1.9s;
}

@keyframes opp-card-deal {
  0% {
    opacity: 0;
    transform: translate(460px, 210px) rotateZ(24deg) scale(0.62);
  }

  62% {
    opacity: 1;
    transform: translate(-10px, -14px) rotateZ(-6deg) scale(1.08);
  }

  100% {
    opacity: 1;
    transform: var(--opp-final-transform);
  }
}

/* Cartas no cemitério (mini) */
.graveyard .card {
  --card-w: 30px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
  transform: none;
}

.graveyard .card::after {
  display: none;
}

/* =====================================================
   HUD SUPERIOR (flutuante)
   ===================================================== */

.hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 16px;
  padding: 10px 18px;
  background: linear-gradient(180deg, rgba(20, 16, 42, 0.85) 0%, rgba(10, 6, 18, 0.5) 100%);
  border: 1px solid var(--c-gold-deep);
  border-radius: var(--radius-frame);
  box-shadow: var(--shadow-arcane), inset 0 1px 0 rgba(201, 162, 74, 0.1);
  z-index: 20;
  backdrop-filter: blur(2px);
}

.hud-player {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hud-self {
  justify-content: flex-end;
}

.portrait {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--c-gold-deep);
  background: radial-gradient(circle at 30% 30%, var(--c-stone-light), var(--c-bg-deep));
  flex-shrink: 0;
  box-shadow: 0 0 14px rgba(201, 162, 74, 0.25), inset 0 0 12px rgba(0, 0, 0, 0.7);
  position: relative;
}

.portrait::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--c-gold);
  opacity: 0.5;
}

.portrait-opp {
  background: url('assets/rival/rival.png') center 20%/180% no-repeat, radial-gradient(circle at 30% 30%, #4a1d3a, #1a0612);
  border-color: var(--c-blood);
}

.portrait-opp::after {
  border-color: var(--c-blood);
}

.portrait-self {
  background: url('assets/jogador/mao_jogador.png') center 60%/180% no-repeat, radial-gradient(circle at 30% 30%, #1d3a4a, #061218);
  border-color: var(--c-cyan);
}

.portrait-self::after {
  border-color: var(--c-cyan);
}

.hud-info {
  min-width: 180px;
  max-width: 240px;
}

.hud-info-right {
  text-align: right;
}

.hud-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-gold-bright);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  text-shadow: 0 0 10px rgba(201, 162, 74, 0.3);
}

.hud-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-info-right .hud-bar {
  flex-direction: row-reverse;
}

.bar-track {
  flex: 1;
  height: 12px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--c-stone-light);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
}

.bar-fill {
  height: 100%;
  transition: width 0.5s ease;
  background-size: 200% 100%;
  animation: bar-shimmer 3s linear infinite;
}

.opp-bar {
  background: linear-gradient(90deg, #b03050 0%, #ff5a7a 50%, #b03050 100%);
}

.player-bar {
  background: linear-gradient(90deg, #2a8aaa 0%, #66f0ff 50%, #2a8aaa 100%);
}

@keyframes bar-shimmer {
  0% {
    background-position: 0% 0%;
  }

  100% {
    background-position: 200% 0%;
  }
}

.bar-text {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--c-text-soft);
  font-weight: 600;
  min-width: 42px;
}

.hud-rounds-mini {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--c-text-dim);
  margin-top: 2px;
}

.hud-center {
  text-align: center;
  padding: 0 16px;
}

.hud-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, var(--c-gold-bright) 0%, var(--c-gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hud-subtitle {
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: var(--c-cyan);
  letter-spacing: 0.3em;
  margin-bottom: 6px;
}

.hand-value-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(107, 63, 160, 0.3);
  border: 1px solid var(--c-purple);
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--c-cyan-glow);
  letter-spacing: 0.1em;
}

/* =====================================================
   PAINEL LATERAL (esquerdo, flutuante)
   ===================================================== */

.info-panel {
  position: absolute;
  bottom: 90px;
  left: 12px;
  width: 200px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(20, 16, 42, 0.88) 0%, rgba(10, 6, 18, 0.78) 100%);
  border: 1px solid var(--c-gold-deep);
  border-radius: var(--radius-frame);
  box-shadow: inset 0 1px 0 rgba(201, 162, 74, 0.1), 0 6px 20px rgba(0, 0, 0, 0.5);
  z-index: 20;
  backdrop-filter: blur(2px);
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

.panel-block {
  padding: 6px 10px;
  background: rgba(10, 6, 18, 0.4);
  border: 1px solid var(--c-stone-light);
  border-radius: 4px;
}

.panel-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--c-text-dim);
  text-transform: uppercase;
  margin-bottom: 3px;
}

.panel-value {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--c-gold-bright);
  font-weight: 700;
}

.panel-value.tentos {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
}

.tento-row em {
  font-style: normal;
  color: var(--c-text-soft);
  font-size: 0.78rem;
  margin-right: 6px;
}

.manilha-info {
  font-size: 0.85rem;
  color: var(--c-cyan-glow);
  text-shadow: 0 0 8px rgba(74, 214, 224, 0.5);
}

.panel-graveyard {
  min-height: 70px;
}

.graveyard {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-height: 50px;
  max-height: 110px;
  overflow-y: auto;
}

.history-panel {
  position: absolute;
  left: 16px;
  top: 150px;
  width: 46px;
  max-height: 330px;
  padding: 8px 7px;
  background: linear-gradient(180deg, rgba(36, 40, 58, 0.84), rgba(8, 10, 17, 0.78));
  border: 2px solid rgba(8, 10, 16, 0.95);
  border-radius: 8px;
  box-shadow:
    0 0 0 1px rgba(116, 129, 154, 0.42) inset,
    0 10px 24px rgba(0, 0, 0, 0.44);
  z-index: 24;
  pointer-events: auto;
  cursor: pointer;
  overflow: hidden;
  transition: width 180ms ease, padding 180ms ease, background 180ms ease;
}

.history-panel.is-expanded {
  width: 260px;
  padding: 11px 12px 12px;
  background: linear-gradient(180deg, rgba(36, 40, 58, 0.88), rgba(8, 10, 17, 0.82));
}

.history-panel:focus-visible {
  outline: 2px solid rgba(113, 226, 255, 0.9);
  outline-offset: 3px;
}

.history-title {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #d9e8ff;
  text-transform: uppercase;
  text-align: center;
  max-height: 0;
  margin-bottom: 0;
  text-shadow: 0 0 10px rgba(118, 190, 255, 0.42);
  opacity: 0;
  transform: translateX(-8px);
  overflow: hidden;
  transition: opacity 160ms ease, transform 160ms ease, max-height 160ms ease, margin 160ms ease;
  pointer-events: none;
}

.history-panel.is-expanded .history-title {
  max-height: 22px;
  margin-bottom: 8px;
  opacity: 1;
  transform: translateX(0);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-entry {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: center;
  justify-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: linear-gradient(180deg, rgba(18, 22, 34, 0.78), rgba(7, 9, 15, 0.66));
  border: 1px solid rgba(105, 116, 140, 0.34);
  border-radius: 6px;
  overflow: hidden;
  transition: width 180ms ease, min-height 180ms ease, padding 180ms ease, gap 180ms ease;
}

.history-panel.is-expanded .history-entry {
  grid-template-columns: 24px 1fr;
  gap: 7px;
  justify-items: start;
  width: auto;
  min-height: 30px;
  height: auto;
  padding: 5px 8px;
}

.history-marker {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin: 0;
  border-radius: 50%;
  color: #9fb1c9;
  background: rgba(159, 177, 201, 0.12);
  border: 1px solid currentColor;
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 10px currentColor;
}

.history-text {
  font-family: var(--font-display);
  font-size: 0.72rem;
  line-height: 1.25;
  color: #f0f4ff;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.75);
  width: 0;
  opacity: 0;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 160ms ease, width 160ms ease;
}

.history-panel.is-expanded .history-text {
  width: auto;
  opacity: 1;
  white-space: normal;
}

.history-empty {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: rgba(225, 234, 255, 0.62);
  text-align: center;
  border: 1px solid rgba(105, 116, 140, 0.34);
  border-radius: 6px;
}

.history-panel.is-expanded .history-empty {
  width: auto;
  height: auto;
  padding: 8px;
}

.history-entry.type-player .history-marker {
  color: #61e6ff;
}

.history-entry.type-opp .history-marker {
  color: #ff4e6a;
}

.history-entry.type-truco .history-marker {
  color: #ff9b22;
}

.history-entry.type-round .history-marker {
  color: #e9c267;
}

.history-entry.type-vira .history-marker {
  color: #79f2ae;
}

.history-entry.type-hand .history-marker {
  color: #b889ff;
}

/* =====================================================
   MESSAGE BAR (flutuante, abaixo do HUD)
   ===================================================== */

.message-bar {
  position: absolute;
  top: 110px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  padding: 8px 24px;
  background: linear-gradient(90deg, transparent 0%, rgba(20, 16, 42, 0.85) 20%, rgba(20, 16, 42, 0.85) 80%, transparent 100%);
  border-top: 1px solid var(--c-gold-deep);
  border-bottom: 1px solid var(--c-gold-deep);
  z-index: 20;
  min-width: 320px;
  max-width: 60vw;
}

.message-text {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--c-cyan-glow);
  letter-spacing: 0.08em;
  text-shadow: 0 0 12px rgba(74, 214, 224, 0.5);
  min-height: 1.4em;
}

.message-text.flash {
  animation: message-flash 0.6s ease;
}

@keyframes message-flash {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
    color: #fff;
    text-shadow: 0 0 20px var(--c-cyan-glow);
  }

  100% {
    transform: scale(1);
  }
}

/* =====================================================
   ACTION BAR (canto inferior direito)
   ===================================================== */

.action-bar {
  position: absolute;
  bottom: 14px;
  right: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  z-index: 20;
  max-width: 50%;
}

.action-bar .arcane-btn {
  font-size: 0.78rem;
  padding: 10px 18px;
}

/* =====================================================
   END SCREEN
   ===================================================== */

#end-screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.end-content {
  text-align: center;
  padding: 50px 60px;
  background: linear-gradient(180deg, rgba(20, 16, 42, 0.95) 0%, rgba(10, 6, 18, 0.95) 100%);
  border: 2px solid var(--c-gold-deep);
  border-radius: var(--radius-frame);
  box-shadow: 0 0 60px rgba(74, 214, 224, 0.3), inset 0 0 40px rgba(0, 0, 0, 0.6);
  max-width: 540px;
}

.end-title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, var(--c-gold-bright), var(--c-gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 14px;
}

.end-title.defeat {
  background: linear-gradient(180deg, #ff5a7a, #6a1830);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.end-flavor {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--c-text-soft);
  margin-bottom: 28px;
}

.end-score {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 32px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--c-gold-bright);
}

.end-score em {
  font-style: normal;
  color: var(--c-text-soft);
  margin-right: 6px;
}

/* =====================================================
   RESPONSIVO
   ===================================================== */

@media (max-width: 1300px) {
  .player-hand-cards .card {
    --card-w: 110px;
  }

  .played-row .card {
    --card-w: 88px;
  }

  .vira-spot .card {
    --card-w: 78px;
  }

  .info-panel {
    width: 180px;
  }
}

@media (max-width: 1024px) {
  .layer-rival {
    width: 36%;
  }

  .layer-player {
    width: 44%;
  }

  .player-hand-cards .card {
    --card-w: 100px;
  }

  .info-panel {
    bottom: 80px;
    width: 170px;
  }
}

@media (max-width: 820px) {
  .hud {
    padding: 6px 10px;
  }

  .hud-name {
    font-size: 0.85rem;
  }

  .hud-info {
    min-width: 130px;
  }

  .hud-title {
    font-size: 1.1rem;
  }

  .info-panel {
    position: static;
    width: auto;
    max-height: none;
    margin: 12px;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .history-panel {
    left: 8px;
    top: 116px;
    width: 42px;
    max-height: 220px;
    padding: 7px;
  }

  .history-panel.is-expanded {
    width: 210px;
    padding: 8px;
  }

  .history-text {
    font-size: 0.64rem;
  }

  .panel-block {
    min-width: 130px;
    flex-shrink: 0;
  }

  .layer-player {
    width: 56%;
  }

  .layer-rival {
    width: 50%;
  }

  .player-hand-cards .card {
    --card-w: 88px;
  }

  .action-bar {
    max-width: 95%;
    bottom: 8px;
    right: 8px;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
  background: var(--c-stone-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--c-purple);
}

/* =====================================================
   CONCEPT UI PASS
   HUD e controles inspirados no concept.png.
   ===================================================== */

#game-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 48% 46%, transparent 0%, transparent 48%, rgba(3, 6, 14, 0.36) 100%),
    linear-gradient(180deg, rgba(4, 7, 18, 0.16) 0%, transparent 34%, rgba(4, 7, 18, 0.24) 100%);
}

.layer-bg {
  filter: none;
  background: transparent;
}

.layer-bg::after {
  display: none;
}

.layer-rival {
  top: 11.6%;
  left: auto;
  right: 6.6%;
  width: 38.5%;
  max-width: 680px;
  min-width: 340px;
  z-index: 4; /* Mantido acima do overlay */
  transform: none;
  background-image: url('assets/rival/piscada/step_01.png');
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  animation: malistrix-soft-breathe 7.8s ease-in-out infinite;
  overflow: hidden;
}

.layer-rival::before,
.layer-rival::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0;
}

.layer-rival::before {
  background-image: url('assets/rival/piscada/step_02.png');
  animation: malistrix-blink-step-2 9.6s linear infinite;
}

.layer-rival::after {
  background-image: url('assets/rival/piscada/step_03.png');
  animation: malistrix-blink-step-3 9.6s linear infinite;
}

.layer-rival-card-rig {
  top: 11.6%;
  left: auto;
  right: 6.6%;
  width: 38.5%;
  max-width: 680px;
  min-width: 340px;
  aspect-ratio: 1 / 1.05;
  z-index: 7;
  transform: none;
  animation: malistrix-soft-breathe 7.8s ease-in-out infinite;
}

@keyframes malistrix-soft-breathe {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-2.2px);
  }
}

@keyframes malistrix-blink-step-2 {

  0%,
  56.9%,
  58.2%,
  60.5%,
  62.1%,
  100% {
    opacity: 0;
  }

  57.35%,
  61.25% {
    opacity: 1;
  }
}

@keyframes malistrix-blink-step-3 {

  0%,
  58.0%,
  60.9%,
  100% {
    opacity: 0;
  }

  58.45%,
  60.45% {
    opacity: 1;
  }
}

.layer-opp-hand {
  position: absolute;
  top: 69.8%;
  left: 34%;
  right: auto;
  transform: none;
  z-index: 3;
  animation: none;
}

.layer-rival-right-arm {
  position: absolute;
  top: 71.4%;
  left: 0;
  width: 39.8%;
  max-width: none;
  min-width: 0;
  aspect-ratio: 267 / 190;
  z-index: 4;
  transform: rotate(0.5deg);
  transform-origin: 70% 34%;
  background: url('assets/rival/braco_direiro_rival.png') center/contain no-repeat;
  opacity: 0.98;
  filter: drop-shadow(0 7px 14px rgba(0, 0, 0, 0.55));
  pointer-events: none;
}

.layer-opp-hand .card {
  --card-w: clamp(48px, 3vw, 58px);
}

@keyframes rival-breathe-cards {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

.layer-rival-arm {
  position: absolute;
  display: none;
  top: 74.3%;
  left: 46.7%;
  right: auto;
  width: 53.1%;
  max-width: none;
  min-width: 0;
  aspect-ratio: 357 / 142;
  z-index: 4;
  transform: rotate(1deg);
  transform-origin: 78% 50%;
  opacity: 0.98;
  filter: drop-shadow(0 7px 14px rgba(0, 0, 0, 0.58));
  animation: none;
}

.layer-rival-arm.is-holding-cards {
  display: block;
}

@keyframes rival-card-arm-breathe {

  0%,
  100% {
    transform: rotate(1deg) translateY(0);
  }

  50% {
    transform: rotate(1deg) translateY(-6px);
  }
}

.layer-table {
  inset: 0;
  height: auto;
  display: block;
  z-index: 4;
  background: url('assets/export_mesa_props_sem_vela_alpha.png') center / cover no-repeat;
  clip-path: none;
  filter: none;
}

.layer-table::after {
  content: none;
}

.layer-props {
  display: none;
}

.layer-played {
  inset: 0;
  left: 0;
  bottom: auto;
  width: 100%;
  height: 100%;
  display: block;
  gap: 0;
  z-index: 10;
  perspective: none;
  perspective-origin: center;
  transform: none;
  transform-style: flat;
}

.layer-played .played-row,
.layer-played .vira-spot {
  position: absolute;
  margin: 0;
}

.layer-played .played-row {
  min-width: 300px;
  min-height: 390px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layer-played .played-row::before,
.layer-played .vira-spot::before {
  content: "";
  position: absolute;
  inset: 16%;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.82);
  filter: blur(18px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.layer-played .played-row:has(.card)::before,
.layer-played .vira-spot:has(.card)::before {
  opacity: 1;
  transform: scale(1);
}

#played-opp {
  top: 51%;
  left: 67%;
  transform: translate(-50%, -50%);
}

#played-self {
  top: 52%;
  left: 55%;
  transform: translate(-50%, -50%);
}

.layer-played .vira-spot {
  top: 73%;
  left: 75%;
  width: 440px;
  height: 260px;
  transform: translate(-50%, -50%);
  transform-origin: center;
  transform-style: flat;
  isolation: auto;
}

.played-row .card {
  --card-w: 160px;
  --table-card-scale: 1;
  transform: translateY(-6px) rotateZ(var(--card-tilt)) scale(var(--table-card-scale));
  transform-origin: center;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.72)) drop-shadow(0 0 18px var(--card-aura, rgba(72, 215, 235, 0.48)));
}

.vira-spot .card {
  --card-w: 292px;
  position: relative;
  left: -128px;
  top: -12px;
  width: var(--card-w);
  aspect-ratio: 7 / 5;
  z-index: 3;
  transform: rotateZ(5deg) rotateX(6deg);
  transform-origin: center;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.74)) drop-shadow(0 0 30px rgba(233, 194, 103, 0.84));
}

.vira-spot .card .card-3d {
  inset: auto;
  left: 50%;
  top: 50%;
  width: calc(var(--card-w) * 5 / 7);
  height: var(--card-w);
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center;
}

.layer-player {
  left: -3%;
  bottom: -11%;
  width: 42%;
  min-width: 500px;
  height: 94%;
}

.player-hand-cards {
  position: absolute;
  bottom: 43%;
  left: 45%; /* Retornado mais para a direita para equilibrar */
  width: 50%;
  height: 50%;
  pointer-events: none;
  z-index: 5;
}

.player-hand-thumb {
  bottom: 17.5%;
  left: 44%;
  width: 43%;
  aspect-ratio: 1 / 1;
  transition: opacity 0.18s ease;
}

.layer-player.no-cards .player-hand-thumb {
  opacity: 0;
  visibility: hidden;
}

.layer-player.has-cards .player-hand-thumb {
  opacity: 1;
  visibility: visible;
}

.player-hand-bg {
  transform: scale(0.92);
  transform-origin: bottom left;
}

.player-hand-thumb {
  position: absolute;
  bottom: 7%; /* Baixado um pouco */
  left: 35%; /* Movido mais para a esquerda */
  width: 51%;
  transform: scale(0.9);
  transform-origin: 42% 86%;
  z-index: 100; /* SEMPRE ACIMA DAS CARTAS */
  pointer-events: none;
}

.player-hand-cards .card {
  --card-w: 290px;
  --rot: calc(var(--centered) * 24deg); 
  --tx: calc(var(--centered) * 78px);
  --ty: calc(var(--centered) * var(--centered) * -16px);
}

.player-hand-cards .card:hover {
  transform: translateX(-50%) translate(var(--tx), -42px) rotate(var(--rot)) scale(1.08);
}

.prop-skull {
  bottom: 43.8%;
  left: 43.2%;
  width: 7.5%;
  z-index: 2;
}

.prop-mug {
  bottom: 24%;
  left: 4%;
  width: 10.5%;
  z-index: 3;
}

.prop-coins {
  bottom: 5%;
  left: 52%;
  width: 46%;
  z-index: 2;
}

.prop-candle-r {
  bottom: 34.5%;
  right: 12%;
  width: 5.6%;
  z-index: 4;
}

.prop-candle-l {
  bottom: 35.2%;
  left: 13.2%;
  width: 4.9%;
  z-index: 2;
}

#played-opp .card {
  --card-w: 180px;
  --card-tilt: -1deg;
  --table-card-scale: 1;
  --card-aura: rgba(255, 46, 80, 0.68);
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.74)) drop-shadow(0 0 24px rgba(255, 46, 80, 0.72)) drop-shadow(0 0 44px rgba(142, 16, 49, 0.5));
}

#played-self .card {
  --card-w: 238px;
  --card-tilt: 2deg;
  --table-card-scale: 1;
  --card-aura: rgba(78, 219, 255, 0.72);
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.74)) drop-shadow(0 0 26px rgba(78, 219, 255, 0.78)) drop-shadow(0 0 48px rgba(29, 114, 255, 0.5));
}

.vira-spot {
  position: relative;
  min-width: 440px;
  min-height: 260px;
}

#played-self::before {
  background:
    radial-gradient(circle, rgba(117, 239, 255, 0.72) 0 16%, rgba(48, 154, 255, 0.38) 38%, transparent 72%),
    radial-gradient(circle, rgba(80, 195, 255, 0.38), transparent 62%);
}

#played-opp::before {
  background:
    radial-gradient(circle, rgba(255, 82, 94, 0.7) 0 16%, rgba(170, 20, 48, 0.42) 38%, transparent 72%),
    radial-gradient(circle, rgba(255, 40, 74, 0.32), transparent 64%);
}

.layer-played .vira-spot::before {
  inset: 54% 4% 6%;
  background:
    radial-gradient(ellipse, rgba(255, 225, 112, 0.68) 0 16%, rgba(214, 142, 42, 0.42) 40%, transparent 72%),
    radial-gradient(ellipse, rgba(255, 196, 74, 0.32), transparent 66%);
  filter: blur(14px);
  transform: scale(1.06, 0.44);
}

.hud {
  top: 10px;
  left: 12px;
  right: 12px;
  display: grid;
  grid-template-columns: minmax(310px, 390px) 1fr minmax(310px, 390px);
  align-items: start;
  gap: 18px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  z-index: 30;
}

.duelist-panel {
  position: relative;
  min-height: 124px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px 16px 118px;
  background:
    linear-gradient(180deg, rgba(52, 56, 75, 0.96) 0%, rgba(24, 26, 40, 0.96) 62%, rgba(12, 13, 22, 0.96) 100%);
  border: 2px solid rgba(12, 16, 30, 0.95);
  clip-path: polygon(24px 0, 100% 0, calc(100% - 26px) 84%, 56px 84%, 40px 100%, 0 100%, 0 28px);
  box-shadow:
    0 0 0 2px rgba(121, 126, 150, 0.58) inset,
    0 0 0 4px rgba(4, 5, 11, 0.78) inset,
    0 8px 24px rgba(0, 0, 0, 0.58),
    0 0 28px rgba(109, 53, 218, 0.24);
}

.duelist-panel::before {
  content: "";
  position: absolute;
  inset: 8px 12px auto auto;
  width: 19px;
  height: 27px;
  background: radial-gradient(circle at 50% 28%, #b661ff 0 22%, #6c19d4 44%, #211136 78%);
  clip-path: polygon(50% 0, 100% 34%, 72% 100%, 28% 100%, 0 34%);
  filter: drop-shadow(0 0 12px rgba(178, 87, 255, 0.95));
}

.hud-opponent {
  padding: 14px 118px 16px 18px;
  justify-content: flex-end;
  clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 28px, 100% 100%, calc(100% - 40px) 100%, calc(100% - 56px) 84%, 26px 84%);
}

.hud-opponent::before {
  inset: 8px auto auto 12px;
}

.portrait-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 116px;
  height: 116px;
  display: grid;
  place-items: center;
}

.hud-opponent .portrait-frame {
  left: auto;
  right: 0;
}

.portrait {
  width: 100px;
  height: 100px;
  border: 4px solid #596070;
  background-color: #111622;
  box-shadow:
    0 0 0 4px rgba(14, 17, 28, 0.95),
    0 0 0 7px rgba(111, 118, 142, 0.72),
    inset 0 0 18px rgba(0, 0, 0, 0.85),
    0 10px 22px rgba(0, 0, 0, 0.62);
}

.portrait::after {
  inset: -10px;
  border: 2px solid rgba(18, 21, 34, 0.95);
  box-shadow: inset 0 0 18px rgba(155, 104, 255, 0.2);
}

.portrait-self {
  background: url('assets/jogador/mao_jogador.png') center 53%/170% no-repeat, radial-gradient(circle at 45% 30%, #314b63, #08111a);
  border-color: #607180;
}

.portrait-opp {
  background: url('assets/rival/rival.png') center 18%/190% no-repeat, radial-gradient(circle at 45% 26%, #463053, #080912);
  border-color: #716b87;
}

.pov-badge {
  position: absolute;
  left: 48px;
  bottom: -26px;
  transform: translateX(-50%);
  padding: 3px 11px 5px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 900;
  color: #f2f1ff;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.75);
  background: linear-gradient(180deg, #3b3c4d 0%, #1a1b28 100%);
  border: 2px solid #0a0c14;
  border-radius: 5px;
  box-shadow: 0 0 0 1px rgba(131, 138, 160, 0.8) inset, 0 5px 10px rgba(0, 0, 0, 0.5);
}

.hud-info {
  min-width: 0;
  max-width: none;
  width: 100%;
}

.hud-info-right {
  text-align: right;
}

.hud-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
  color: #fff8eb;
  letter-spacing: 0;
  margin-bottom: 9px;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.9),
    0 0 10px rgba(255, 255, 255, 0.22);
}

.hud-bar {
  gap: 7px;
}

.bar-track {
  height: 24px;
  border: 3px solid #10131d;
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.13), transparent 45%),
    #242838;
  box-shadow:
    0 0 0 2px rgba(90, 97, 112, 0.8),
    inset 0 3px 4px rgba(0, 0, 0, 0.65);
}

.bar-fill {
  position: relative;
  background-size: 100% 100%;
  animation: none;
}

.bar-fill::after {
  content: "";
  position: absolute;
  inset: 2px 0 auto 0;
  height: 42%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent);
}

.player-bar,
.opp-bar {
  background: linear-gradient(90deg, #109b23 0%, #35f65c 58%, #138d29 100%);
}

.bar-text {
  position: absolute;
  z-index: 2;
  left: 50%;
  transform: translateX(-50%);
  min-width: 0;
  width: max-content;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 24px;
  color: #eef6ea;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.9), 0 0 4px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.hud-bar {
  position: relative;
}

.hud-opponent .bar-text {
  left: auto;
  right: 50%;
  transform: translateX(50%);
}

.hud-tokens {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
}

.hud-tokens-right {
  justify-content: flex-end;
}

.mana-gem,
.round-token {
  width: 30px;
  height: 34px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 900;
  color: #f5efff;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.75);
  border: 2px solid #111521;
  clip-path: polygon(50% 0, 92% 25%, 80% 82%, 50% 100%, 20% 82%, 8% 25%);
  box-shadow: 0 0 0 1px rgba(235, 235, 255, 0.28) inset, 0 0 12px rgba(144, 58, 244, 0.5);
}

.mana-gem {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.82), transparent 16%),
    linear-gradient(140deg, #d06cff 0%, #8129e9 44%, #321156 100%);
}

.round-token {
  border-radius: 6px;
  clip-path: none;
}

.round-token.purple {
  background: linear-gradient(180deg, #b45cff 0%, #5a1ab4 100%);
}

.round-token.blue {
  background: linear-gradient(180deg, #46b8ff 0%, #134f91 100%);
  box-shadow: 0 0 0 1px rgba(220, 245, 255, 0.38) inset, 0 0 12px rgba(64, 190, 255, 0.5);
}

.round-progress {
  padding: 4px 10px 5px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 900;
  color: #f1f4ff;
  background: linear-gradient(180deg, #3d3f51, #171924);
  border: 2px solid #0a0c14;
  border-radius: 5px;
  box-shadow: 0 0 0 1px rgba(135, 143, 170, 0.74) inset;
}

.hud-center {
  position: relative;
  justify-self: center;
  padding: 2px 8px 0;
  text-align: center;
  min-width: 360px;
}

.hud-title {
  font-size: clamp(1.9rem, 3.2vw, 3rem);
  line-height: 0.95;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #fff9ff 0%, #a9ddff 38%, #6c6fe2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 9px rgba(159, 213, 255, 0.86)) drop-shadow(0 2px 0 rgba(0, 0, 0, 0.9));
}

.hud-subtitle {
  margin-top: -1px;
  color: #cfd8ff;
  font-size: 0.72rem;
  letter-spacing: 0.38em;
  text-shadow: 0 0 12px rgba(123, 131, 255, 0.7);
}

.hand-value-badge {
  margin-top: 7px;
  padding: 4px 13px 5px;
  background: linear-gradient(180deg, rgba(53, 55, 74, 0.92), rgba(18, 19, 29, 0.92));
  border: 2px solid #151824;
  border-radius: 5px;
  color: #dec5ff;
  box-shadow: 0 0 0 1px rgba(132, 89, 219, 0.62) inset, 0 0 16px rgba(109, 53, 218, 0.25);
}

.message-bar {
  top: 31%;
  left: 51%;
  min-width: min(560px, 80vw);
  max-width: min(720px, 86vw);
  padding: 5px 28px 9px;
  background:
    linear-gradient(90deg, transparent 0%, rgba(7, 13, 29, 0.88) 18%, rgba(7, 13, 29, 0.9) 82%, transparent 100%);
  border: 0;
  z-index: 25;
  pointer-events: none;
}

.message-bar::before,
.message-bar::after {
  content: "";
  position: absolute;
  left: 9%;
  right: 9%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(170, 225, 255, 0.95), transparent);
  box-shadow: 0 0 12px rgba(115, 190, 255, 0.9);
}

.message-bar::before {
  top: 0;
}

.message-bar::after {
  bottom: 0;
}

.message-text {
  font-size: clamp(2rem, 3.8vw, 3.55rem);
  line-height: 0.98;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #f3f5ff;
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.95),
    0 0 16px rgba(159, 213, 255, 0.9),
    0 0 30px rgba(98, 87, 205, 0.62);
}

.message-detail {
  margin-top: 5px;
  font-family: var(--font-display);
  font-size: clamp(0.72rem, 1vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(225, 234, 255, 0.82);
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.86);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-panel {
  left: 14px;
  bottom: 18px;
  width: 232px;
  max-height: none;
  gap: 7px;
  padding: 12px 12px 10px;
  background:
    linear-gradient(180deg, rgba(47, 50, 63, 0.96), rgba(18, 19, 28, 0.96));
  border: 2px solid #0c0f18;
  border-radius: 6px;
  box-shadow:
    0 0 0 2px rgba(110, 118, 139, 0.52) inset,
    0 8px 24px rgba(0, 0, 0, 0.55);
  display: none; /* Removido da interface por solicitação do usuário */
}

.panel-block {
  padding: 7px 8px;
  background: linear-gradient(180deg, rgba(18, 21, 32, 0.9), rgba(9, 11, 18, 0.88));
  border: 1px solid rgba(123, 130, 148, 0.62);
  border-radius: 4px;
  text-align: center;
}

.panel-round {
  padding: 9px 8px;
  background:
    linear-gradient(180deg, rgba(56, 58, 74, 0.94), rgba(16, 17, 26, 0.94));
}

.panel-round .panel-value {
  color: #f6f4ff;
  font-size: 1.12rem;
  text-transform: uppercase;
}

.panel-label {
  margin-bottom: 5px;
  color: #f4f0e6;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
}

.panel-value {
  color: #f3f0ff;
  font-size: 0.94rem;
}

.panel-value.tentos {
  gap: 2px;
  font-size: 0.88rem;
  text-transform: uppercase;
}

.tento-row {
  color: #f3f0ff;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.75);
}

.manilha-info {
  color: #9beaff;
}

.panel-inventory {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 1px;
}

.inventory-slot {
  min-width: 0;
  display: grid;
  grid-template-rows: 58px auto;
  justify-items: center;
  gap: 5px;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 900;
  color: #f2f3ff;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.8);
}

.inventory-slot span {
  white-space: nowrap;
}

.deck-icon {
  width: 45px;
  height: 58px;
  border-radius: 4px;
  background:
    url('assets/cartas/verso_padrao.png') center/100% 100% no-repeat,
    linear-gradient(180deg, #4e2b20, #1b1110);
  box-shadow: 0 0 0 2px #0b0d13, 0 0 0 3px rgba(130, 138, 160, 0.55), 0 6px 12px rgba(0, 0, 0, 0.55);
}

.grave-icon {
  width: 50px;
  height: 58px;
  position: relative;
  border-radius: 24px 24px 5px 5px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 35%),
    linear-gradient(180deg, #657282, #2d3943);
  box-shadow: 0 0 0 2px #0b0d13, 0 0 0 3px rgba(130, 138, 160, 0.55), 0 6px 12px rgba(0, 0, 0, 0.55);
}

.grave-icon::before,
.grave-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  background: #16202a;
  box-shadow: 0 0 3px rgba(255, 255, 255, 0.2);
}

.grave-icon::before {
  width: 8px;
  height: 25px;
}

.grave-icon::after {
  width: 25px;
  height: 8px;
  top: 22px;
}

.graveyard {
  min-height: 0;
  max-height: 0;
  overflow: hidden;
  gap: 0;
}

.action-bar {
  right: 17px;
  bottom: 17px;
  width: min(402px, 42vw);
  max-width: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  grid-auto-rows: auto;
  gap: 11px 12px;
  justify-content: stretch;
  padding: 17px 18px 16px;
  background:
    radial-gradient(circle at 20% 30%, rgba(108, 64, 202, 0.35), transparent 24%),
    radial-gradient(circle at 79% 34%, rgba(58, 201, 220, 0.22), transparent 26%),
    linear-gradient(180deg, rgba(54, 57, 73, 0.96), rgba(17, 19, 30, 0.98));
  border: 3px solid #0a0d16;
  border-radius: 16px 16px 8px 8px;
  box-shadow:
    0 0 0 2px rgba(111, 120, 144, 0.6) inset,
    0 0 0 5px rgba(21, 25, 39, 0.68) inset,
    0 0 36px rgba(111, 56, 216, 0.35),
    0 10px 28px rgba(0, 0, 0, 0.62);
}

.action-bar[hidden] {
  display: none !important;
}

.action-bar::before {
  content: "";
  position: absolute;
  inset: 7px 9px auto 9px;
  height: 10px;
  border-radius: 50%;
  border-top: 2px solid rgba(124, 232, 255, 0.72);
  opacity: 0.8;
}

.arcane-btn {
  min-width: 0;
  min-height: 0;
  font-size: 0.9rem;
  letter-spacing: 0;
  padding: 0;
  border-radius: 999px;
  border: 3px solid #111421;
  color: #fff8ee;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.92);
  box-shadow:
    inset 0 2px 5px rgba(255, 255, 255, 0.24),
    inset 0 -8px 18px rgba(0, 0, 0, 0.48),
    0 0 0 3px rgba(109, 116, 138, 0.58),
    0 0 20px rgba(0, 0, 0, 0.7);
}

.arcane-btn::before,
.arcane-btn::after {
  display: none;
}

.action-bar .arcane-btn {
  padding: 0;
  min-height: 82px;
}

.arcane-btn.truco,
.arcane-btn.pass,
.arcane-btn.run {
  aspect-ratio: 1 / 1;
}

.arcane-btn.truco {
  background:
    radial-gradient(circle at 35% 28%, #fff1a3 0 8%, #ff9b22 22%, #d24b0e 54%, #5b1606 100%);
  box-shadow:
    inset 0 2px 5px rgba(255, 255, 255, 0.3),
    inset 0 -8px 18px rgba(78, 20, 0, 0.55),
    0 0 0 3px rgba(129, 76, 32, 0.9),
    0 0 22px rgba(255, 112, 21, 0.72);
}

.arcane-btn.pass {
  background:
    radial-gradient(circle at 38% 26%, #d7b3ff 0 8%, #8d42e9 34%, #5819a2 68%, #210b46 100%);
  box-shadow:
    inset 0 2px 5px rgba(255, 255, 255, 0.28),
    inset 0 -8px 18px rgba(40, 10, 75, 0.58),
    0 0 0 3px rgba(100, 61, 168, 0.9),
    0 0 24px rgba(167, 76, 255, 0.74);
}

.arcane-btn.run {
  background:
    radial-gradient(circle at 38% 26%, #d9fbff 0 8%, #45d7e6 34%, #16879a 66%, #062f45 100%);
  box-shadow:
    inset 0 2px 5px rgba(255, 255, 255, 0.3),
    inset 0 -8px 18px rgba(0, 50, 67, 0.58),
    0 0 0 3px rgba(51, 133, 152, 0.9),
    0 0 22px rgba(82, 232, 255, 0.72);
}

.arcane-btn.accept,
.arcane-btn.raise {
  min-height: 43px;
  aspect-ratio: auto;
  border-radius: 6px;
  font-size: 0.82rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 35%),
    linear-gradient(180deg, #7b3fb5 0%, #451b79 100%);
  clip-path: polygon(11% 0, 89% 0, 100% 50%, 89% 100%, 11% 100%, 0 50%);
}

.arcane-btn.accept {
  grid-column: 1 / 3;
  width: 74%;
  justify-self: end;
}

.arcane-btn.raise {
  grid-column: 2 / 4;
  width: 74%;
  justify-self: start;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 35%),
    linear-gradient(180deg, #277e9b 0%, #124e65 100%);
}

.arcane-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
  color: #fff;
  border-color: #191d2e;
}

.arcane-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

/* =====================================================
   UI ASSETS PASS
   Status, avatares e painel de truco vindos de assets/conceito_ui.png.
   ===================================================== */

.hud {
  top: 42px;
  left: 66px;
  right: 66px;
  grid-template-columns: 495px 1fr 495px;
  gap: 14px;
  align-items: start;
}

.duelist-panel {
  width: 495px;
  height: 162px;
  min-height: 162px;
  padding: 0;
  display: block;
  background: transparent center/contain no-repeat;
  border: 0;
  clip-path: none;
  box-shadow: none;
}

.hud-self {
  justify-self: start;
  background-image: url('assets/interface/hud_container_status/container_status_kaelen.png');
}

.hud-opponent {
  justify-self: end;
  padding: 0;
  background-image: url('assets/interface/hud_container_status/container_status_malistrix.png');
  clip-path: none;
}

.duelist-panel::before,
.hud-opponent::before {
  display: none;
}

.portrait-frame {
  top: 16px;
  left: 6px;
  width: 123px;
  height: 123px;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
}

.hud-opponent .portrait-frame {
  left: auto;
  right: 6px;
}

.portrait {
  width: 106px;
  height: 106px;
  border: 0;
  border-radius: 50%;
  box-shadow:
    inset 0 0 26px rgba(0, 0, 0, 0.78),
    0 0 16px rgba(95, 54, 174, 0.4);
}

.portrait::after {
  display: none;
}

.portrait-self {
  background: url('assets/jogador/avatar_kaelen_the_seer.png') center/cover no-repeat;
}

.portrait-opp {
  background: url('assets/rival/avatar_malistrix_the_void.png') center/cover no-repeat;
}

.pov-badge {
  display: none;
}

.hud-info,
.hud-opponent .hud-info {
  position: absolute;
  top: 26px;
  width: 296px;
  min-width: 0;
  max-width: none;
  text-align: center;
}

.hud-info {
  left: 142px;
}

.hud-opponent .hud-info {
  left: 58px;
  right: auto;
}

.hud-info-right {
  text-align: center;
}

.hud-name {
  font-size: 1.26rem;
  line-height: 1;
  margin-bottom: 12px;
  color: #fff8ef;
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.95),
    0 0 12px rgba(255, 255, 255, 0.25);
}

.hud-bar,
.hud-info-right .hud-bar {
  position: relative;
  width: 293px;
  height: 22px;
  display: block;
  margin: 0 auto;
  gap: 0;
  flex-direction: row;
}

.bar-track {
  width: 100%;
  height: 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  display: block;
  border-radius: 0;
  opacity: 0.86;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.28),
    inset 0 -4px 7px rgba(0, 0, 0, 0.38);
}

.bar-fill::after {
  inset: 1px 0 auto 0;
  height: 38%;
}

.player-bar,
.opp-bar {
  background: linear-gradient(90deg, #1ebd37 0%, #47ff67 54%, #12962a 100%);
}

.hud-opponent .bar-fill {
  margin-left: auto;
}

.bar-text,
.hud-opponent .bar-text {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  top: 0;
  font-size: 0.82rem;
  line-height: 22px;
  color: #f7f7f1;
}

.hud-tokens,
.hud-tokens-right {
  position: absolute;
  left: 41px;
  top: 74px;
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 0;
}

.hud-opponent .hud-tokens {
  left: 154px;
  top: 74px;
}

.round-stone,
.mana-gem,
.round-token,
.round-progress,
.round-token.purple,
.round-token.blue {
  width: 24px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  clip-path: none;
  background: url('assets/interface/hud_container_status/pedra_tento_vida.png') center/contain no-repeat;
  color: transparent;
  text-shadow: none;
  box-shadow: none; /* Frame removido */
  transform-origin: center;
  transition: opacity 240ms ease, filter 240ms ease, transform 240ms ease;
}

.round-stone.is-active {
  opacity: 1;
  filter: saturate(1.15) brightness(1.08);
}

.round-stone.is-broken {
  opacity: 0.28;
  filter: grayscale(0.65) brightness(0.62);
  transform: translateY(3px) rotate(-8deg) scale(0.82);
}

.round-stone.is-breaking {
  position: relative;
}

.stone-explosion-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 160px; /* Maior impacto */
  height: 160px;
  pointer-events: none;
  mix-blend-mode: screen;
  z-index: 100;
  filter: url(#black-to-alpha) brightness(2.2) contrast(1.4) drop-shadow(0 0 20px rgba(255, 60, 120, 0.9));
}

.mana-gem span,
.round-token span,
.round-progress span,
.round-stone span {
  color: transparent;
}

.hud-center {
  padding-top: 82px;
  pointer-events: none;
}

.hud-title,
.hud-subtitle {
  display: none;
}

.hand-value-badge {
  margin-top: 0;
  pointer-events: none;
}

.message-bar {
  top: 32px;
  left: 50%;
  min-width: min(760px, 48vw);
  max-width: min(820px, 50vw);
  padding: 2px 30px 7px;
  z-index: 28;
}

.message-text {
  font-size: clamp(1.95rem, 3.1vw, 3.05rem);
  line-height: 0.98;
}

.message-detail {
  margin-top: 3px;
}

/* Durante o sorteio da moeda (coin-toss) escondemos a cena/HUDs auxiliares
   pra deixar a moldura central só. A action-bar (botões de truco/correr/etc)
   fica de fora dessa lista — o usuário pediu HUD visível desde a escolha. */
#game-screen.is-coin-stage .hud,
#game-screen.is-coin-stage .info-panel,
#game-screen.is-coin-stage .history-panel,
#game-screen.is-coin-stage .message-bar,
#game-screen.is-coin-stage .hud-vira-stack,
#game-screen.is-coin-stage .action-bar,
#game-screen.is-coin-stage .layer-rival,
#game-screen.is-coin-stage .layer-rival-card-rig,
#game-screen.is-coin-stage .layer-player,
#game-screen.is-coin-stage .layer-played,
#game-screen.is-coin-stage .layer-props {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.coin-modal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 70;
  background:
    radial-gradient(ellipse at center, rgba(28, 12, 52, 0.42), rgba(4, 5, 12, 0.82) 72%);
  backdrop-filter: blur(2px);
}

.coin-modal[hidden] {
  display: none !important;
}

.coin-modal.is-video-only {
  place-items: center;
  padding-top: 0;
}

.coin-popup {
  position: relative;
  width: 1120px;
  height: 630px;
  max-width: 76vw;
  max-height: 76vh;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  padding: 0;
  text-align: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  isolation: auto;
  transform: translate3d(0, 0, 0) scale(1);
  transform-origin: 50% 50%;
  backface-visibility: hidden;
  will-change: transform;
}

.coin-popup::before {
  content: "";
  position: absolute;
  inset: 114px 132px 98px;
  z-index: 0;
  background:
    radial-gradient(ellipse at center, rgba(18, 22, 38, 0.04), rgba(3, 5, 12, 0.14) 84%),
    url('assets/videos_moeda/mesa_moldura_escolha_moedas.png') center calc(50% + 44px) / 124% auto no-repeat,
    #090d18;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.18);
}

.coin-popup::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: url('assets/videos_moeda/moldura_video_moedas.png') center/100% 100% no-repeat;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.72));
  transform: translate3d(0, 0, 0);
  transform-origin: 50% 50%;
  backface-visibility: hidden;
  will-change: transform;
}

.coin-choice-panel {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  max-width: none;
  pointer-events: none;
}

.coin-choice-panel[hidden],
.coin-video-panel[hidden] {
  display: none !important;
}

.coin-title {
  position: absolute;
  top: -126px;
  left: 50%;
  width: max-content;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 2.45rem;
  font-weight: 900;
  color: #fff8ef;
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.9),
    0 0 18px rgba(148, 190, 255, 0.82);
}

.coin-subtitle {
  position: absolute;
  top: -80px;
  left: 50%;
  width: max-content;
  transform: translateX(-50%);
  margin-top: 0;
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: rgba(226, 235, 255, 0.78);
}

.coin-options {
  position: absolute;
  top: 250px;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 0;
  display: flex;
  justify-content: center;
  gap: 48px;
  pointer-events: auto;
}

.coin-choice-btn {
  width: 210px;
  height: 220px;
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff8ef;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 900;
  cursor: pointer;
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.92),
    0 0 12px rgba(255, 236, 171, 0.38);
  box-shadow: none;
  transition: transform 160ms ease, filter 160ms ease;
}

.coin-choice-btn:hover:not(:disabled) {
  transform: translateY(-6px) scale(1.03);
  filter: brightness(1.12);
}

.coin-choice-btn:disabled {
  cursor: wait;
  filter: saturate(0.75) brightness(0.75);
}

.coin-choice-btn img {
  width: 174px;
  height: 180px;
  object-fit: contain;
  filter:
    drop-shadow(0 18px 18px rgba(0, 0, 0, 0.52)) drop-shadow(0 0 18px rgba(255, 193, 72, 0.38));
  transition: transform 160ms ease, filter 160ms ease;
}

.coin-choice-btn:hover:not(:disabled) img {
  transform: translateY(-4px);
  filter:
    drop-shadow(0 22px 22px rgba(0, 0, 0, 0.58)) drop-shadow(0 0 28px rgba(255, 214, 94, 0.7));
}

.coin-video-panel {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
}

.coin-video-frame {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0;
  display: grid;
  place-items: center;
  background: transparent;
}

.coin-video-frame::before {
  content: "";
  position: absolute;
  inset: 8.3% 8.25%;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(2, 4, 12, 0.42), rgba(2, 4, 12, 0.72));
  transition: opacity 260ms ease;
}

.coin-video-frame::after {
  display: none;
}

.coin-video {
  position: relative;
  z-index: 1;
  width: 83.5%;
  height: 83.4%;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 28px rgba(0, 0, 0, 0.82);
  image-rendering: auto;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  will-change: transform;
}

.coin-result-text {
  position: absolute;
  left: 50%;
  top: 49%;
  z-index: 4;
  width: min(760px, 72%);
  min-height: 0;
  margin-top: 0;
  transform: translate(-50%, -50%);
  display: none;
  place-items: center;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 3.6vw, 3.65rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.02em;
  color: #fff8ef;
  text-shadow: none;
  opacity: 0;
  pointer-events: none;
}

.coin-modal.is-video-only .coin-result-text {
  display: none;
}

.coin-modal.is-result-reveal .coin-result-text {
  display: grid;
  animation: coin-result-reveal 520ms cubic-bezier(.16, .84, .3, 1) both;
}

.coin-modal.is-result-reveal .coin-video-frame::before {
  opacity: 1;
}

.coin-modal.is-result-reveal .coin-popup::after {
  animation: none;
  filter: none;
}

.coin-modal.is-choice-enter {
  pointer-events: none;
}

.coin-modal.is-choice-enter .coin-popup::after {
  animation: coin-frame-portal-enter 920ms linear both;
}

.coin-modal.is-choice-enter .coin-popup::before {
  animation: coin-surface-enter 1040ms ease-out both;
}

.coin-modal.is-choice-enter .coin-choice-panel {
  animation: coin-choice-panel-enter 1120ms cubic-bezier(.18, .76, .28, 1) both;
}

.coin-modal.is-dissolving {
  pointer-events: none;
}

.coin-modal.is-dissolving .coin-popup {
  animation: coin-stage-dissolve 780ms ease-in both;
}

.coin-modal.is-dissolving .coin-result-text {
  animation: coin-result-dissolve 620ms ease-in both;
}

.coin-modal.is-portal-zoom {
  background: radial-gradient(ellipse at center, rgba(28, 12, 52, 0.35), rgba(4, 5, 12, 0.64) 76%);
  backdrop-filter: none;
  pointer-events: none;
}

.coin-modal.is-portal-zoom .coin-popup {
  animation: none;
}

.coin-modal.is-portal-zoom .coin-video-frame {
  animation: coin-video-fade-out 360ms ease-out both;
}

.coin-modal.is-portal-zoom .coin-popup::before {
  opacity: 0;
}

.coin-modal.is-portal-zoom .coin-popup::after {
  animation: coin-frame-portal-zoom 1120ms linear both;
  filter: none;
}

.coin-modal.is-portal-zoom .coin-result-text {
  display: grid;
  animation: coin-result-dissolve 320ms ease-out both;
}

#game-screen.is-entering-game .hud,
#game-screen.is-entering-game .info-panel,
#game-screen.is-entering-game .history-panel,
#game-screen.is-entering-game .message-bar,
#game-screen.is-entering-game .action-bar,
#game-screen.is-entering-game .hud-vira-stack,
#game-screen.is-entering-game .layer-rival,
#game-screen.is-entering-game .layer-rival-card-rig,
#game-screen.is-entering-game .layer-player,
#game-screen.is-entering-game .layer-played,
#game-screen.is-entering-game .layer-props {
  animation: game-stage-enter 900ms cubic-bezier(.18, .78, .32, 1) both;
}

#game-screen.is-entering-game .hud,
#game-screen.is-entering-game .message-bar {
  animation-delay: 90ms;
  animation-name: game-stage-enter-centered;
}

#game-screen.is-entering-game .layer-rival,
#game-screen.is-entering-game .layer-rival-card-rig {
  animation-delay: 180ms;
}

#game-screen.is-entering-game .layer-player,
#game-screen.is-entering-game .layer-played,
#game-screen.is-entering-game .layer-props,
#game-screen.is-entering-game .hud-vira-stack {
  animation-delay: 280ms;
}

#game-screen.is-entering-game .action-bar {
  animation: action-bar-enter 900ms cubic-bezier(.18, .78, .32, 1) 280ms both;
}

@keyframes action-bar-enter {
  0% {
    opacity: 0;
    filter: blur(6px);
    transform: scale(0.85) translateY(16px);
  }

  100% {
    opacity: 1;
    filter: blur(0);
    transform: scale(0.85) translateY(0);
  }
}

@keyframes coin-result-reveal {
  0% {
    opacity: 0;
    transform: translate(-50%, -48%) scale(1);
    filter: none;
  }

  70% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    filter: none;
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    filter: none;
  }
}

@keyframes coin-video-afterglow {
  0% {
    filter: brightness(1) saturate(1);
  }

  45% {
    filter: brightness(0.68) saturate(1.25) blur(1px);
  }

  100% {
    filter: brightness(0.52) saturate(1.08) blur(2px);
  }
}

@keyframes coin-frame-pulse {

  0%,
  100% {
    filter:
      drop-shadow(0 12px 28px rgba(0, 0, 0, 0.72)) drop-shadow(0 0 0 rgba(255, 214, 107, 0));
  }

  42% {
    filter:
      drop-shadow(0 12px 28px rgba(0, 0, 0, 0.72)) drop-shadow(0 0 34px rgba(255, 214, 107, 0.82)) drop-shadow(0 0 58px rgba(131, 92, 255, 0.58));
  }
}

@keyframes coin-stage-dissolve {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }

  100% {
    opacity: 0;
    transform: scale(1.035);
    filter: blur(8px);
  }
}

@keyframes coin-result-dissolve {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -56%) scale(1.14);
  }
}

@keyframes coin-portal-backdrop {

  0%,
  52% {
    background:
      radial-gradient(ellipse at center, rgba(28, 12, 52, 0.42), rgba(4, 5, 12, 0.82) 72%);
    backdrop-filter: blur(2px);
  }

  100% {
    background:
      radial-gradient(ellipse at center, rgba(28, 12, 52, 0.08), rgba(4, 5, 12, 0.24) 76%);
    backdrop-filter: blur(0);
  }
}

@keyframes coin-portal-zoom {
  0% {
    transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
  }

  14% {
    transform: translate3d(0, 0, 0) scale3d(1.035, 1.035, 1);
  }

  42% {
    transform: translate3d(0, 0, 0) scale3d(1.42, 1.42, 1);
  }

  70% {
    transform: translate3d(0, 0, 0) scale3d(2.35, 2.35, 1);
  }

  100% {
    transform: translate3d(0, 0, 0) scale3d(4.25, 4.25, 1);
  }
}

@keyframes coin-frame-portal-zoom {
  0% {
    transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
  }

  100% {
    transform: translate3d(0, 0, 0) scale3d(6.25, 6.25, 1);
  }
}

@keyframes coin-frame-portal-enter {
  0% {
    transform: translate3d(0, 0, 0) scale3d(6.25, 6.25, 1);
  }

  100% {
    transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
  }
}

@keyframes coin-surface-enter {

  0%,
  46% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@keyframes coin-choice-panel-enter {

  0%,
  58% {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(5px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes coin-video-fade-out {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes game-stage-enter {
  0% {
    opacity: 0;
    filter: blur(6px);
    transform: translateY(16px);
  }

  100% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes game-stage-enter-centered {
  0% {
    opacity: 0;
    filter: blur(6px);
    transform: translate(-50%, 16px);
  }

  100% {
    opacity: 1;
    filter: blur(0);
    transform: translate(-50%, 0);
  }
}

/* ===================== HUD action-bar (INTERFACE 2.0) =====================
   O game-screen usa transform: scale(0.9); por isso o HUD é definido maior
   aqui para aparecer em Full HD com ~547×401px, como no modelo visual. */
.action-bar {
  right: 0 !important;
  bottom: 0 !important;
  z-index: 100;
  width: 608px !important;
  height: 446px !important;
  max-width: none !important;
  min-width: 0 !important;
  padding: 0 !important;
  display: block !important;
  background: url('assets/interface_2.0/hud_de_pedra_truco.png') center/100% 100% no-repeat;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none;
  overflow: visible;
  grid-template-columns: none !important;
  gap: 0 !important;
  pointer-events: none;

  /* Ajuste fino: HUD com escala de 0.85 */
  transform: scale(0.85);
  transform-origin: bottom right;
}

.action-bar::before {
  display: none;
}

.action-bar .arcane-btn {
  position: absolute !important;
  margin: 0 !important;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  clip-path: none;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  box-shadow: none;
  color: #fffaf2;
  font-size: 1.52rem;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.95),
    0 0 10px rgba(255, 255, 255, 0.25);
  pointer-events: auto;
}

.action-bar .arcane-btn,
.action-bar .arcane-btn:hover,
.action-bar .arcane-btn:focus,
.action-bar .arcane-btn:focus-visible,
.action-bar .arcane-btn:active,
.action-bar .arcane-btn:disabled {
  appearance: none;
  -webkit-appearance: none;
  background-color: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
  -webkit-tap-highlight-color: transparent;
}

.action-bar .arcane-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.035);
  filter: brightness(1.13);
  border: 0;
}

.action-bar .arcane-btn:disabled {
  opacity: 1 !important;
  visibility: visible !important;
  cursor: not-allowed;
  filter: grayscale(0.94) brightness(0.42) saturate(0.26) contrast(0.96);
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.95),
    0 0 7px rgba(20, 24, 38, 0.9);
  animation: none !important;
  pointer-events: none;
}

.action-bar .arcane-btn:disabled:hover {
  transform: none;
  filter: grayscale(0.94) brightness(0.42) saturate(0.26) contrast(0.96);
}

.action-bar .arcane-btn:not(:disabled) {
  filter: brightness(1.05);
}

.action-bar .arcane-btn:not(:disabled):hover {
  filter: brightness(1.18);
}

.action-bar .arcane-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

/* Posições calibradas pelos furos transparentes do HUD asset (1301×955).
   Slots detectados na arte:
     TRUCO     centro raw (393.5, 613)
     CORRER    centro raw (765.5, 611.5)
     ESCONDER  centro raw (1045.5, 611)
     MENSAGENS centro raw (1099, 298)
   O PNG do TRUCO tem chama subindo além do círculo, então a caixa é mais alta. */
.arcane-btn.truco {
  left: 98px !important;
  top: 168px !important;
  width: 178px !important;
  height: 202px !important;
  background-image: url('assets/interface_2.0/botao_truco.png');
  font-size: 1.78rem;
  line-height: 0.9;
  letter-spacing: 0.015em;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 16px 0 5px;
  color: #fff8df;
  text-shadow:
    0 3px 0 rgba(78, 19, 0, 0.98),
    0 0 8px rgba(255, 245, 205, 0.7),
    0 0 18px rgba(255, 112, 21, 0.9);
}

.arcane-btn.truco.is-numeric-label {
  font-size: 3.82rem;
  line-height: 0.78;
  letter-spacing: 0;
  padding: 30px 14px 0 2px;
  -webkit-text-stroke: 1px rgba(86, 24, 0, 0.56);
  text-shadow:
    0 4px 0 rgba(78, 19, 0, 0.98),
    0 0 10px rgba(255, 248, 214, 0.9),
    0 0 22px rgba(255, 122, 25, 0.95);
}

.arcane-btn.truco:disabled {
  color: rgba(255, 234, 188, 0.72);
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.95),
    0 0 6px rgba(40, 24, 18, 0.95);
}

.arcane-btn.run {
  left: 306px !important;
  top: 231px !important;
  width: 106px !important;
  height: 106px !important;
  background-image: url('assets/interface_2.0/botao_correr.png');
  background-size: 100% 100%;
  font-size: 0;
  color: transparent;
}

.arcane-btn.pass {
  left: 436px !important;
  top: 231px !important;
  width: 106px !important;
  height: 106px !important;
  background-image: url('assets/interface_2.0/botao_esconder.png');
  background-size: 100% 100%;
  font-size: 0;
  color: transparent;
}

.arcane-btn.chat {
  left: 486px !important;
  top: 111px !important;
  width: 56px !important;
  height: 56px !important;
  background-image: url('assets/interface_2.0/botao_mensagens.png');
  font-size: 0;
  color: transparent;
}

.arcane-btn.chat.is-open {
  filter: brightness(1.25) drop-shadow(0 0 16px rgba(110, 255, 170, 0.7));
}

.hud-vira-stack {
  --hud-card-w: 170px;
  /* Nudged coordinates for better overlap: Deck vertical, Vira tucked under */
  --hud-vira-left: 210px;
  --hud-vira-top: 40px;
  --hud-deck-left: 370px;
  --hud-deck-top: 10px;

  position: absolute;
  right: 0;
  bottom: 0;
  width: 608px;
  height: 446px;
  z-index: 50;
  /* Abaixo do action-bar (z=82/100) */
  pointer-events: auto;
  overflow: visible;
}

.hud-vira-stack .vira-spot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

.hud-vira-stack .vira-spot::before {
  display: none;
}

.hud-vira-card,
.hud-deck-card,
.hud-shuffle-card {
  position: absolute;
  pointer-events: none;
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border-radius: 7px;
  transform-origin: center;
  will-change: transform;
}

/* 1. Vira Card (Fica embaixo do maço) */
.hud-vira-card {
  left: var(--hud-vira-left);
  top: var(--hud-vira-top);
  width: var(--hud-card-w);
  aspect-ratio: 5 / 7;
  z-index: 10;
  background-color: #efe1c2;
  transform: rotate(-45deg);
  pointer-events: auto;
  transition: transform 180ms ease, filter 220ms ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* Pseudo-elementos da vira ZERADOS */
.hud-vira-card::before,
.hud-vira-card::after {
  content: none;
}

/* 2. Efeito de Plasma (Fica em cima do vira, mas embaixo do maço?) 
      O usuário pediu: "efeito de plasma e a carta vira uma camada abaixo do efeito e da carta maço"
      Interpretado: Vira < Plasma < Maço. */
/* Container que abriga o vídeo fora do hud-vira-stack para permitir blend mode com o cenário */
.vira-effect-video {
  position: absolute;
  left: calc(var(--hud-vira-left) + 6px);
  top: calc(var(--hud-vira-top) + 14px);
  width: var(--hud-card-w);
  aspect-ratio: 5 / 7;
  transform: scale(2.55) rotate(-45deg);
  transform-origin: center center;
  object-fit: cover;
  pointer-events: none;
  filter: url(#black-to-alpha) brightness(1.5) contrast(1.3) saturate(1.2);
  mix-blend-mode: normal;
  z-index: 11;
  border-radius: 0;
  background: transparent;
  opacity: 0;
  transition: opacity 0.3s ease-in-out, transform 180ms ease;
}

/* Bloqueia a exibição do plasma durante a animação de compra/deal */
.vira-spot.is-dealing-vira .vira-effect-video {
  opacity: 0 !important;
}

/* O plasma só ativa quando o mouse passa sobre a própria carta Vira (e não a área ao redor) */
.hud-vira-card:hover ~ .vira-effect-video {
  opacity: 1;
  /* Acompanha o scale de hover da carta (2.55 * 1.02 = 2.601) e o ajuste Y */
  transform: scale(2.601) rotate(-45deg) translateY(-1px);
}

/* Vídeo de plasma instanciado dentro de cartas manilha na mão/mesa */
.manilha-effect-video {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  /* Reajuste para escala maior (2.35) e leve deslocamento X (-52%) e Y (-48%) para centralizar perfeitamente a aura na carta */
  transform: translate(-52%, -48%) scale(2.35); 
  transform-origin: center center;
  object-fit: cover;
  pointer-events: none;
  filter: url(#black-to-alpha) brightness(1.5) contrast(1.3) saturate(1.2);
  mix-blend-mode: normal;
  z-index: 11;
  border-radius: 0;
  background: transparent;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

/* O plasma nas manilhas também só ativa no hover da carta específica */
.card.is-manilha:hover .manilha-effect-video {
  opacity: 1;
}

/* HOVER: leve scale up */
.hud-vira-card:hover {
  transform: rotate(-45deg) translateY(-1px) scale(1.02);
  box-shadow: none;
}

/* Vira que é manilha */
.hud-vira-card.is-manilha {}

.hud-vira-card.is-manilha:hover {}

/* 3. Maço (Deck) - Vertical e POR CIMA de tudo na pilha */
.hud-deck-card {
  left: var(--hud-deck-left);
  top: var(--hud-deck-top);
  width: var(--hud-card-w);
  aspect-ratio: 5 / 7;
  z-index: 20;
  /* No topo da pilha vira/maço */
  background-image: url('assets/cartas/verso_padrao.png');
  transform: none;
  /* Vertical */
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
  filter: drop-shadow(0 0 10px rgba(146, 95, 255, 0.2));
}

.hud-shuffle-card {
  left: var(--hud-deck-left);
  top: var(--hud-deck-top);
  width: var(--hud-card-w);
  aspect-ratio: 5 / 7;
  opacity: 0;
  z-index: 15;
  background-image: url('assets/cartas/verso_padrao.png');
}

.hud-shuffle-card.under-a,
.hud-shuffle-card.under-c {
  z-index: 2;
}

.hud-shuffle-card.over-b {
  z-index: 4;
}

.hud-vira-stack .vira-spot.is-dealing-vira .hud-vira-card {
  pointer-events: none;
  animation: hud-vira-drop-in 920ms cubic-bezier(.18, .82, .24, 1.14) 2760ms both;
}

.hud-vira-stack .vira-spot.is-dealing-vira .hud-deck-card {
  animation: hud-deck-shuffle-core 900ms cubic-bezier(.2, .78, .26, 1) 0ms 3 both;
}

.hud-vira-stack .vira-spot.is-dealing-vira .hud-shuffle-card.under-a {
  animation: hud-shuffle-under-a 860ms cubic-bezier(.17, .78, .28, 1) 60ms 3 both;
}

.hud-vira-stack .vira-spot.is-dealing-vira .hud-shuffle-card.over-b {
  animation: hud-shuffle-over-b 860ms cubic-bezier(.17, .78, .28, 1) 180ms 3 both;
}

.hud-vira-stack .vira-spot.is-dealing-vira .hud-shuffle-card.under-c {
  animation: hud-shuffle-under-c 860ms cubic-bezier(.17, .78, .28, 1) 300ms 3 both;
}

@keyframes hud-deck-shuffle-core {
  0% {
    transform: rotate(1deg) translate(0, 0) scale(1);
  }

  18% {
    transform: rotate(-4deg) translate(-10px, -5px) scale(1.015);
  }

  36% {
    transform: rotate(5deg) translate(8px, 4px) scale(1.02);
  }

  58% {
    transform: rotate(-3deg) translate(-7px, 3px) scale(1.01);
  }

  78% {
    transform: rotate(3deg) translate(5px, -3px) scale(1.01);
  }

  100% {
    transform: rotate(1deg) translate(0, 0) scale(1);
  }
}

@keyframes hud-shuffle-under-a {
  0% {
    opacity: 0;
    transform: translate(-110px, -82px) rotate(-24deg) scale(0.96);
  }

  16% {
    opacity: 0.92;
  }

  72% {
    opacity: 0.92;
    transform: translate(14px, 8px) rotate(6deg) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(0, 0) rotate(1deg) scale(1);
  }
}

@keyframes hud-shuffle-over-b {
  0% {
    opacity: 0;
    transform: translate(118px, -58px) rotate(20deg) scale(0.97);
  }

  16% {
    opacity: 0.96;
  }

  70% {
    opacity: 0.96;
    transform: translate(-16px, -7px) rotate(-7deg) scale(1.02);
  }

  100% {
    opacity: 0;
    transform: translate(0, 0) rotate(1deg) scale(1);
  }
}

@keyframes hud-shuffle-under-c {
  0% {
    opacity: 0;
    transform: translate(-96px, 84px) rotate(17deg) scale(0.96);
  }

  18% {
    opacity: 0.88;
  }

  68% {
    opacity: 0.88;
    transform: translate(16px, -9px) rotate(-6deg) scale(1.01);
  }

  100% {
    opacity: 0;
    transform: translate(0, 0) rotate(1deg) scale(1);
  }
}

@keyframes hud-vira-drop-in {
  0% {
    opacity: 0;
    transform: translate(166px, -16px) rotate(1deg) scale(0.96);
    filter:
      drop-shadow(0 9px 10px rgba(0, 0, 0, 0.5));
  }

  18% {
    opacity: 0.28;
    transform: translate(166px, -16px) rotate(1deg) scale(0.96);
  }

  38% {
    opacity: 1;
    transform: translate(92px, -22px) rotate(-16deg) scale(0.99);
  }

  72% {
    transform: translate(18px, 16px) rotate(-38deg) scale(1.035);
  }

  88% {
    transform: translate(-5px, -5px) rotate(-48deg) scale(0.995);
  }

  100% {
    opacity: 1;
    transform: rotate(-45deg) scale(1);
    filter:
      drop-shadow(0 15px 16px rgba(0, 0, 0, 0.74)) drop-shadow(0 0 16px rgba(102, 205, 255, 0.28));
  }
}

/* Contorno incandescente roxo — pulso suave (não mais flicker frenético).
   Núcleo magenta brilhante + camada média violeta + halo profundo. */
@keyframes hud-vira-incandescent {
  0% {
    filter: drop-shadow(0 15px 16px rgba(0, 0, 0, 0.74)) drop-shadow(0 0 9px rgba(255, 220, 126, 0.98)) drop-shadow(0 0 20px rgba(255, 116, 28, 0.82)) drop-shadow(0 0 38px rgba(205, 72, 255, 0.72)) drop-shadow(0 0 68px rgba(95, 25, 200, 0.42));
  }

  50% {
    filter: drop-shadow(0 15px 16px rgba(0, 0, 0, 0.74)) drop-shadow(0 0 15px rgba(255, 242, 170, 1)) drop-shadow(0 0 32px rgba(255, 142, 32, 0.96)) drop-shadow(0 0 58px rgba(226, 88, 255, 0.84)) drop-shadow(0 0 96px rgba(112, 28, 220, 0.52));
  }

  100% {
    filter: drop-shadow(0 15px 16px rgba(0, 0, 0, 0.74)) drop-shadow(0 0 9px rgba(255, 220, 126, 0.98)) drop-shadow(0 0 20px rgba(255, 116, 28, 0.82)) drop-shadow(0 0 38px rgba(205, 72, 255, 0.72)) drop-shadow(0 0 68px rgba(95, 25, 200, 0.42));
  }
}

/* Respiração das chamas — escala/translate sutis (o filtro SVG cuida da dança). */
@keyframes hud-vira-flame-breath {
  0% {
    transform: scale(1) translateY(0) rotate(-1deg);
    opacity: 0.98;
  }

  50% {
    transform: scale(1.08) translateY(-4px) rotate(1deg);
    opacity: 1;
  }

  100% {
    transform: scale(1.03) translateY(-1px) rotate(-0.5deg);
    opacity: 0.98;
  }
}

/* Halo difuso atrás — pulso lento. */
@keyframes hud-vira-halo-pulse {
  0% {
    opacity: 0.9;
    transform: scale(0.98);
  }

  50% {
    opacity: 1;
    transform: scale(1.08);
  }

  100% {
    opacity: 0.94;
    transform: scale(1.02);
  }
}

@keyframes hud-vira-purple-aura {

  0%,
  100% {
    opacity: 0.52;
    transform: scale(0.98) rotate(0deg);
  }

  50% {
    opacity: 0.82;
    transform: scale(1.06) rotate(9deg);
  }
}

@keyframes hud-vira-purple-flames {
  0% {
    opacity: 0.32;
    transform: translate(-2px, 2px) scale(0.96);
  }

  45% {
    opacity: 0.56;
    transform: translate(2px, -4px) scale(1.04);
  }

  100% {
    opacity: 0.42;
    transform: translate(-1px, -7px) scale(1.08);
  }
}

/* ===================== TRUCO RECEBIDO ===================== */
#game-screen.is-truco-alert .action-bar {
  z-index: 94;
}

#game-screen.is-truco-alert .hud-vira-stack {
  z-index: 92; /* Fica acima do alert (90), mas atrás da action-bar (94) */
}

.truco-alert {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse at center, rgba(18, 28, 56, 0.24), rgba(4, 5, 12, 0.78) 72%),
    linear-gradient(180deg, rgba(4, 6, 16, 0.42), rgba(3, 4, 10, 0.66));
  animation: truco-alert-dim-in 260ms ease-out both;
}

.truco-alert::before {
  content: "";
  position: absolute;
  inset: -12%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 43%, rgba(115, 194, 255, 0.22), transparent 32%),
    radial-gradient(ellipse at 50% 50%, rgba(118, 91, 255, 0.16), transparent 46%);
  mix-blend-mode: screen;
  opacity: 0;
  animation: truco-electric-flash 1320ms steps(1, end) infinite;
}

.truco-alert[hidden] {
  display: none !important;
}

.truco-alert-stage {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 24px;
  margin-top: -72px;
  width: min(1040px, 80vw);
  min-height: 268px;
  pointer-events: auto;
  isolation: auto;
}

.truco-lightning-field {
  display: none;
  position: absolute;
  left: 50%;
  top: 39%;
  width: min(1130px, 88vw);
  height: 338px;
  overflow: visible;
  pointer-events: none;
  transform: translate3d(-50%, -50%, 0);
  transform-origin: 50% 50%;
  z-index: 3;
  mix-blend-mode: screen;
  opacity: 1;
}

.truco-lightning-gif {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 132vw;
  height: 132vh;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transform: translate3d(-50%, -50%, 0);
  transform-origin: 50% 50%;
  mix-blend-mode: screen;
  background: transparent;
  object-fit: cover;
  object-position: center;
  filter:
    brightness(1.42) contrast(1.14) saturate(1.08) drop-shadow(0 0 20px rgba(93, 217, 255, 0.9)) drop-shadow(0 0 62px rgba(32, 183, 255, 0.72));
  will-change: opacity;
}

.truco-lightning-gif.is-playing {
  opacity: 1 !important;
  animation: none;
}

.truco-lightning-gif.is-spent {
  opacity: 0;
}

.truco-electric-shapes,
.truco-electric-flares {
  transform-box: view-box;
  transform-origin: center;
}

.truco-shard,
.truco-flare {
  fill: rgba(249, 252, 255, 0.98);
  stroke: rgba(166, 222, 255, 0.72);
  stroke-width: 1.15;
  stroke-linejoin: miter;
  paint-order: stroke fill;
  shape-rendering: geometricPrecision;
  filter: url("#truco-electric-glow");
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  vector-effect: non-scaling-stroke;
  will-change: opacity, transform;
}

.truco-shard {
  animation: truco-shard-flash var(--fx-duration, 1180ms) steps(1, end) infinite;
  animation-delay: var(--fx-delay, 0ms);
}

.truco-flare {
  fill: #ffffff;
  stroke-width: 0.8;
  animation: truco-flare-flash var(--fx-duration, 1180ms) steps(1, end) infinite;
  animation-delay: var(--fx-delay, 0ms);
}

.shard-a {
  --fx-duration: 960ms;
  --fx-delay: -40ms;
}

.shard-b {
  --fx-duration: 960ms;
  --fx-delay: -40ms;
}

.shard-c {
  --fx-duration: 1280ms;
  --fx-delay: -260ms;
}

.shard-d {
  --fx-duration: 1190ms;
  --fx-delay: -410ms;
}

.shard-e {
  --fx-duration: 1360ms;
  --fx-delay: -610ms;
}

.shard-f {
  --fx-duration: 1320ms;
  --fx-delay: -510ms;
}

.shard-g {
  --fx-duration: 1040ms;
  --fx-delay: -190ms;
}

.shard-h {
  --fx-duration: 1070ms;
  --fx-delay: -360ms;
}

.shard-i {
  --fx-duration: 1210ms;
  --fx-delay: -720ms;
}

.shard-j {
  --fx-duration: 1160ms;
  --fx-delay: -780ms;
}

.flare-a {
  --fx-duration: 960ms;
  --fx-delay: -40ms;
}

.flare-b {
  --fx-duration: 1280ms;
  --fx-delay: -260ms;
}

.flare-c {
  --fx-duration: 1190ms;
  --fx-delay: -410ms;
}

.flare-d {
  --fx-duration: 1320ms;
  --fx-delay: -510ms;
}

.flare-e {
  --fx-duration: 1210ms;
  --fx-delay: -720ms;
}

.truco-alert-word {
  position: relative;
  z-index: 5;
  pointer-events: none;
  font-family: var(--font-display);
  font-size: clamp(5.8rem, 9.6vw, 9.4rem);
  font-weight: 900;
  line-height: 0.82;
  letter-spacing: 0.035em;
  color: #ffffff;
  text-transform: uppercase;
  -webkit-text-stroke: 1px rgba(196, 232, 255, 0.72);
  text-shadow:
    0 0 8px rgba(255, 255, 255, 1),
    0 0 22px rgba(168, 235, 255, 0.98),
    0 0 52px rgba(92, 132, 255, 0.96),
    0 0 96px rgba(78, 58, 255, 0.78),
    0 0 128px rgba(34, 198, 255, 0.46);
  filter: brightness(1.18) saturate(1.08);
  animation: truco-word-surge 1120ms steps(1, end) infinite;
}

.truco-accept-btn {
  position: relative;
  z-index: 5;
  min-width: 230px;
  height: 64px;
  padding: 0 34px;
  border: 2px solid rgba(174, 239, 255, 0.9);
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 1.38rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #f7fcff;
  text-transform: uppercase;
  cursor: pointer;
  background:
    linear-gradient(180deg, rgba(105, 222, 255, 0.22), rgba(53, 66, 139, 0.28)),
    linear-gradient(180deg, #26335c, #11152d);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -7px 16px rgba(0, 0, 0, 0.38),
    0 0 24px rgba(81, 221, 255, 0.42),
    0 12px 28px rgba(0, 0, 0, 0.62);
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.92),
    0 0 12px rgba(132, 229, 255, 0.75);
  transition: transform 120ms ease, filter 120ms ease;
}

.truco-accept-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.14);
}

.truco-accept-btn:active:not(:disabled) {
  transform: translateY(1px);
}

#game-screen.is-truco-alert .arcane-btn.truco.is-heat-alert {
  animation: none !important;
  filter:
    url("#truco-heat-haze-filter") brightness(1.2) saturate(1.32) drop-shadow(0 0 14px rgba(255, 118, 25, 0.86)) drop-shadow(0 0 30px rgba(255, 210, 74, 0.46));
  isolation: isolate;
  overflow: visible;
  transform: none !important;
  will-change: filter;
}

#game-screen.is-truco-alert .arcane-btn.truco.is-heat-alert::before,
#game-screen.is-truco-alert .arcane-btn.truco.is-heat-alert::after {
  content: "";
  display: block;
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
}

#game-screen.is-truco-alert .arcane-btn.truco.is-heat-alert::before {
  inset: 0;
  z-index: 0;
  background: url('assets/interface_2.0/botao_truco.png') center/contain no-repeat;
  filter: url("#truco-heat-haze-filter") brightness(1.22) saturate(1.22) blur(0.18px);
  mix-blend-mode: screen;
  opacity: 0.42;
  clip-path: ellipse(48% 44% at 48% 63%);
  -webkit-mask-image: radial-gradient(ellipse 54% 48% at 48% 63%, rgba(0, 0, 0, 1) 0 54%, rgba(0, 0, 0, 0.62) 76%, transparent 96%);
  mask-image: radial-gradient(ellipse 54% 48% at 48% 63%, rgba(0, 0, 0, 1) 0 54%, rgba(0, 0, 0, 0.62) 76%, transparent 96%);
  transform: translate3d(0, 0, 0);
  animation: truco-heat-soft-refraction 1180ms ease-in-out infinite;
}

#game-screen.is-truco-alert .arcane-btn.truco.is-heat-alert::after {
  inset: 22px -2px -6px -10px;
  z-index: 0;
  background:
    radial-gradient(ellipse at 48% 62%, rgba(255, 239, 140, 0.34), rgba(255, 129, 24, 0.16) 42%, rgba(255, 88, 12, 0.06) 62%, transparent 78%),
    linear-gradient(104deg, transparent 12%, rgba(255, 244, 196, 0.12) 34%, transparent 58%, rgba(255, 153, 45, 0.11) 76%, transparent 92%);
  filter: url("#truco-heat-haze-filter") blur(8px);
  mix-blend-mode: screen;
  opacity: 0.64;
  transform-origin: 50% 82%;
  animation: truco-heat-haze-rise 1120ms ease-in-out infinite;
}

@keyframes truco-alert-dim-in {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@keyframes truco-word-surge {

  0%,
  6%,
  14%,
  27%,
  42%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    filter: brightness(1.18) saturate(1.08);
  }

  7%,
  29% {
    transform: translate3d(-1px, -1px, 0) scale(1.018);
    filter: brightness(1.92) saturate(1.26);
  }

  9%,
  31% {
    transform: translate3d(1px, 0, 0) scale(1.006);
    filter: brightness(1.42) saturate(1.16);
  }
}

@keyframes truco-electric-flash {

  0%,
  6%,
  12%,
  27%,
  36%,
  100% {
    opacity: 0;
  }

  7%,
  29% {
    opacity: 0.98;
  }

  9%,
  31% {
    opacity: 0.22;
  }
}

@keyframes truco-shard-flash {

  0%,
  4% {
    opacity: 0;
    transform: scaleX(0.14) scaleY(0.68);
  }

  5% {
    opacity: 0.72;
    transform: scaleX(0.72) scaleY(0.92);
  }

  6%,
  13% {
    opacity: 1;
    transform: scaleX(1) scaleY(1);
  }

  14% {
    opacity: 0.24;
    transform: scaleX(1.22) scaleY(0.78);
  }

  15%,
  25% {
    opacity: 0;
    transform: scaleX(1.28) scaleY(0.7);
  }

  26% {
    opacity: 0.82;
    transform: scaleX(0.7) scaleY(0.95);
  }

  27%,
  38% {
    opacity: 1;
    transform: scaleX(1) scaleY(1);
  }

  39% {
    opacity: 0.22;
    transform: scaleX(1.18) scaleY(0.78);
  }

  40%,
  60% {
    opacity: 0;
    transform: scaleX(1.18) scaleY(0.76);
  }

  61% {
    opacity: 0.72;
    transform: scaleX(0.74) scaleY(0.94);
  }

  62%,
  69% {
    opacity: 0.96;
    transform: scaleX(1) scaleY(1);
  }

  70%,
  100% {
    opacity: 0;
    transform: scaleX(1.22) scaleY(0.76);
  }
}

@keyframes truco-flare-flash {

  0%,
  4% {
    opacity: 0;
    transform: scaleX(0.08) scaleY(0.32);
  }

  5%,
  11% {
    opacity: 1;
    transform: scaleX(1.08) scaleY(0.94);
  }

  12% {
    opacity: 0.34;
    transform: scaleX(1.5) scaleY(0.48);
  }

  13%,
  25% {
    opacity: 0;
    transform: scaleX(1.7) scaleY(0.36);
  }

  26%,
  35% {
    opacity: 0.94;
    transform: scaleX(0.96) scaleY(0.86);
  }

  36%,
  60% {
    opacity: 0;
    transform: scaleX(1.58) scaleY(0.42);
  }

  61%,
  66% {
    opacity: 0.82;
    transform: scaleX(0.82) scaleY(0.78);
  }

  67%,
  100% {
    opacity: 0;
    transform: scaleX(1.5) scaleY(0.4);
  }
}

@keyframes truco-gif-lightning-once {
  0% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) scale(0.995) rotate(0deg);
    filter:
      brightness(1.45) contrast(1.32) saturate(1.05) drop-shadow(0 0 0 rgba(97, 204, 255, 0));
  }

  4% {
    opacity: 0.98;
    transform: translate3d(-50%, -50%, 0) scale(1) rotate(0deg);
  }

  14% {
    opacity: 1;
    transform: translate3d(-50%, -50%, 0) scale(1.012) rotate(0deg);
    filter:
      brightness(1.9) contrast(1.24) saturate(1.08) drop-shadow(0 0 34px rgba(132, 235, 255, 1)) drop-shadow(0 0 96px rgba(35, 180, 255, 0.86));
  }

  58% {
    opacity: 0.94;
    transform: translate3d(-50%, -50%, 0) scale(1.018) rotate(0deg);
  }

  82% {
    opacity: 0.52;
    transform: translate3d(-50%, -50%, 0) scale(1.012) rotate(0deg);
  }

  100% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) scale(1.01) rotate(0deg);
  }
}

@keyframes truco-heat-soft-refraction {

  0%,
  100% {
    transform: translate3d(-1px, 1px, 0) skewX(-0.35deg) scaleY(1.01);
    opacity: 0.3;
  }

  38% {
    transform: translate3d(1.6px, -2px, 0) skewX(0.42deg) scaleY(1.032);
    opacity: 0.48;
  }

  72% {
    transform: translate3d(-1.2px, -5px, 0) skewX(-0.28deg) scaleY(1.052);
    opacity: 0.36;
  }
}

@keyframes truco-heat-haze-rise {

  0%,
  100% {
    transform: translate3d(0, 2px, 0) skewX(-0.35deg) scaleX(1) scaleY(0.98);
    opacity: 0.42;
  }

  42% {
    transform: translate3d(1.4px, -3px, 0) skewX(0.42deg) scaleX(1.03) scaleY(1.045);
    opacity: 0.66;
  }

  78% {
    transform: translate3d(-1px, -7px, 0) skewX(-0.25deg) scaleX(0.99) scaleY(1.07);
    opacity: 0.48;
  }
}

@media (min-width: 1400px) and (min-aspect-ratio: 16/10) {
  .layer-rival {
    top: 11.2%;
    right: 15%;
    width: 28vw;
    max-width: 540px;
    min-width: 0;
  }

  .layer-rival-card-rig {
    top: 11.2%;
    right: 15%;
    width: 28vw;
    max-width: 540px;
    min-width: 0;
  }

  .layer-opp-hand {
    top: 69.8%;
    left: 34%;
    right: auto;
    gap: 6px;
  }

  .layer-opp-hand .card {
    --card-w: 52px;
  }

  .layer-rival-arm {
    top: 74.3%;
    left: 46.7%;
    right: auto;
    width: 53.1%;
  }
}

@media (max-width: 1180px) {
  .hud {
    grid-template-columns: minmax(250px, 330px) 1fr minmax(250px, 330px);
    gap: 10px;
  }

  .duelist-panel {
    min-height: 106px;
    padding-left: 96px;
  }

  .hud-opponent {
    padding-left: 14px;
    padding-right: 96px;
  }

  .portrait-frame {
    width: 96px;
    height: 96px;
  }

  .portrait {
    width: 82px;
    height: 82px;
  }

  .hud-name {
    font-size: 0.95rem;
  }

  .hud-title {
    font-size: clamp(1.45rem, 3vw, 2.25rem);
  }

  .player-hand-cards .card {
    --card-w: 188px;
    --tx: calc(var(--centered) * 84px);
  }

  /* .action-bar mantém tamanho fixo pra preservar o asset HUD do INTERFACE 2.0;
     a regra de scale geral abaixo cuida de viewports menores. */
}

@media (max-width: 880px) {
  .hud {
    left: 8px;
    right: 8px;
    grid-template-columns: 1fr 1fr;
  }

  .hud-center {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
    order: -1;
  }

  .hud-self,
  .hud-opponent {
    grid-row: 2;
  }

  .duelist-panel {
    min-height: 84px;
    padding: 10px 12px 11px 76px;
  }

  .hud-opponent {
    padding: 10px 76px 11px 12px;
  }

  .portrait-frame {
    width: 76px;
    height: 76px;
  }

  .portrait {
    width: 62px;
    height: 62px;
    border-width: 3px;
  }

  .pov-badge {
    left: 38px;
    bottom: -21px;
    font-size: 0.62rem;
    padding: 2px 8px 3px;
  }

  .hud-name {
    font-size: 0.72rem;
  }

  .bar-track {
    height: 18px;
  }

  .bar-text {
    font-size: 0.72rem;
    line-height: 18px;
  }

  .hud-tokens {
    gap: 4px;
    margin-top: 7px;
  }

  .mana-gem,
  .round-token {
    width: 22px;
    height: 25px;
    font-size: 0.68rem;
  }

  .round-progress {
    font-size: 0.68rem;
    padding: 2px 7px 3px;
  }

  .message-bar {
    top: 34%;
    left: 50%;
  }

  .layer-rival {
    right: -2%;
    top: 13%;
    width: 56%;
    min-width: 270px;
  }

  .layer-rival-card-rig {
    right: -2%;
    top: 13%;
    width: 56%;
    min-width: 270px;
  }

  .layer-player {
    width: 60%;
    min-width: 340px;
    left: -12%;
  }

  .player-hand-cards .card {
    --card-w: 142px;
    --tx: calc(var(--centered) * 60px);
  }

  .player-hand-cards {
    bottom: 37%;
    left: 41%;
    width: 74%;
  }

  .layer-rival-arm {
    top: 74.3%;
    left: 46.7%;
    right: auto;
    width: 53.1%;
  }

  .layer-played {
    inset: 0;
    left: 0;
    bottom: auto;
    width: 100%;
    height: 100%;
    gap: 0;
  }

  #played-opp {
    top: 51%;
    left: 67%;
  }

  #played-self {
    top: 52%;
    left: 55%;
  }

  .layer-played .vira-spot {
    top: 73%;
    left: 75%;
    width: 440px;
    height: 260px;
    transform: translate(-50%, -50%);
  }

  .played-row .card {
    --card-w: 160px;
  }

  #played-opp .card {
    --card-w: 180px;
    --card-tilt: -1deg;
    --table-card-scale: 1;
  }

  #played-self .card {
    --card-w: 238px;
    --card-tilt: 2deg;
    --table-card-scale: 1;
  }

  .vira-spot .card {
    --card-w: 292px;
  }

  .info-panel {
    position: absolute;
    left: 8px;
    bottom: 8px;
    width: 178px;
    margin: 0;
    flex-direction: column;
    overflow: hidden;
    padding: 9px;
  }

  .panel-block {
    min-width: 0;
  }

  .panel-inventory {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .inventory-slot {
    grid-template-columns: 30px 1fr;
    grid-template-rows: auto;
    align-items: center;
    justify-items: start;
    font-size: 0.64rem;
  }

  .deck-icon,
  .grave-icon {
    width: 24px;
    height: 31px;
  }

  /* HUD em viewport muito pequeno: encolhe inteiro proporcionalmente
     ao invés de tentar reposicionar (era o que quebrava o asset novo). */
  .action-bar {
    transform: scale(0.65);
    transform-origin: bottom right;
  }
}

/* ===================== ESCONDER (carta face-down) ===================== */
.arcane-btn.pass.is-armed {
  outline: 3px solid rgba(216, 168, 255, 0.95);
  outline-offset: 2px;
  box-shadow:
    inset 0 2px 5px rgba(255, 255, 255, 0.32),
    inset 0 -8px 18px rgba(40, 10, 75, 0.62),
    0 0 0 3px rgba(180, 120, 240, 0.95),
    0 0 32px rgba(200, 130, 255, 0.95);
  animation: hide-armed-pulse 1.4s ease-in-out infinite;
}

@keyframes hide-armed-pulse {

  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.18);
  }
}

.player-hand-cards.hide-arm .card:not(.disabled) {
  cursor: crosshair;
  filter: drop-shadow(0 0 10px rgba(190, 120, 255, 0.55));
}

.player-hand-cards.hide-arm .card:not(.disabled):hover {
  filter: drop-shadow(0 0 18px rgba(220, 150, 255, 0.85));
}

.card.played-hidden {
  filter: drop-shadow(0 0 12px rgba(120, 70, 200, 0.55));
}

/* ===================== EMPATE: jogar maior carta ===================== */
.card.forced-highest {
  filter: drop-shadow(0 0 14px rgba(255, 215, 100, 0.85));
  animation: forced-highest-pulse 1.6s ease-in-out infinite;
}

.card.forced-highest:hover {
  filter: drop-shadow(0 0 22px rgba(255, 230, 130, 1));
}

@keyframes forced-highest-pulse {

  0%,
  100% {
    filter: drop-shadow(0 0 12px rgba(255, 215, 100, 0.7));
  }

  50% {
    filter: drop-shadow(0 0 22px rgba(255, 230, 130, 1));
  }
}

.player-hand-cards .card.disabled {
  opacity: 1;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7));
  cursor: not-allowed;
  pointer-events: none;
}

.player-hand-cards .card.disabled.is-manilha {
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 16px rgba(233, 194, 103, 0.9));
}

/* ===================== ACEITAR IMPLÍCITO (truco pendente) ===================== */
.player-hand-cards.accept-on-play .card:not(.disabled) {
  filter: drop-shadow(0 0 12px rgba(255, 180, 80, 0.65));
  animation: accept-on-play-pulse 1.4s ease-in-out infinite;
}

@keyframes accept-on-play-pulse {

  0%,
  100% {
    filter: drop-shadow(0 0 10px rgba(255, 170, 70, 0.5));
  }

  50% {
    filter: drop-shadow(0 0 22px rgba(255, 200, 100, 0.95));
  }
}

/* ===================== CHAT / EMOTES ===================== */
.chat-panel {
  position: fixed;
  right: 24px;
  bottom: 420px;
  width: 320px;
  padding: 18px 18px 16px;
  background: linear-gradient(160deg, rgba(28, 14, 56, 0.95), rgba(14, 24, 38, 0.95));
  border: 2px solid rgba(140, 200, 170, 0.55);
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 16px 48px rgba(0, 0, 0, 0.65),
    0 0 32px rgba(80, 220, 150, 0.25);
  z-index: 50;
  font-family: 'Cormorant Garamond', serif;
  color: #f5e6c2;
  animation: chat-panel-in 220ms ease-out;
}

@keyframes chat-panel-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-panel-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #b6e8c8;
  text-align: center;
  margin-bottom: 12px;
  text-shadow: 0 0 8px rgba(120, 220, 160, 0.5);
}

.chat-emote-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.chat-emote-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  background: linear-gradient(180deg, rgba(60, 80, 95, 0.55), rgba(30, 40, 55, 0.75));
  border: 1px solid rgba(140, 200, 170, 0.35);
  border-radius: 8px;
  color: #f1e6c8;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: filter 120ms ease, transform 120ms ease, border-color 120ms ease;
}

.chat-emote-btn:hover {
  filter: brightness(1.18);
  border-color: rgba(160, 230, 190, 0.75);
  transform: translateY(-1px);
}

.chat-emote-btn:active {
  transform: translateY(0);
}

.chat-emote-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ===================== SPEECH BUBBLES ===================== */
.speech-bubble {
  position: fixed;
  max-width: 340px;
  padding: 18px 24px;
  background: linear-gradient(160deg, rgba(40, 24, 70, 0.96), rgba(20, 30, 48, 0.96));
  border: 2px solid rgba(180, 220, 200, 0.6);
  border-radius: 14px;
  color: #f5e6c2;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.45rem;
  font-style: italic;
  font-weight: 600;
  text-align: center;
  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.6),
    0 0 24px rgba(140, 200, 220, 0.25);
  z-index: 45;
  animation: bubble-in 280ms ease-out;
  pointer-events: none;
}

.speech-bubble.is-fading {
  animation: bubble-out 320ms ease-in forwards;
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.92);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bubble-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.94);
  }
}

.bubble-self {
  left: 380px;
  bottom: 240px;
  border-color: rgba(120, 200, 230, 0.65);
  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.6),
    0 0 28px rgba(80, 180, 220, 0.45);
}

.bubble-opp {
  right: 200px;
  top: 220px;
  border-color: rgba(220, 100, 130, 0.65);
  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.6),
    0 0 28px rgba(220, 80, 100, 0.45);
}

.speech-bubble::before {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
}

.bubble-self::before {
  bottom: -14px;
  left: 28px;
  border-width: 14px 12px 0 0;
  border-color: rgba(40, 24, 70, 0.96) transparent transparent transparent;
}

.bubble-opp::before {
  top: -14px;
  right: 28px;
  border-width: 0 12px 14px 0;
  border-color: transparent rgba(40, 24, 70, 0.96) transparent transparent;
}