/* Jornadas & Batalhas — visual de arena (inspirado no género; arte original) */
:root {
  --font-display: "Cinzel", Georgia, serif;
  --font-ui: "Outfit", system-ui, sans-serif;
  --gold: #d4a64b;
  --gold-dim: #8a6f2e;
  --parchment: #e8dcc4;
  --ink: #0d0c0a;
  /* Arena: paddings fluidos + rail desktop */
  --arena-pad-x: clamp(0.35rem, 1.8vw, 0.95rem);
  --arena-pad-y: clamp(0.22rem, 1.2vw, 0.5rem);
  --bp-stack-rail: 960px;
  --bp-mobile-arena: 640px;
  --card-back-image: url('../assets/brand/card-back.png');
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  background: radial-gradient(ellipse 120% 80% at 50% 0%, #2a2218 0%, #0f0d0b 55%, #080706 100%);
  color: var(--parchment);
  min-height: 100vh;
}

body.battle-active {
  overflow: hidden;
}

body.battle-active .app {
  height: 100vh;
  height: 100dvh;
  min-height: 100dvh;
}

body.battle-active:has(#battle.battle--arena-tcg:not(.hidden)) .topbar {
  display: none !important;
}

body.battle-active.battle-ended:has(#battle.battle--arena-tcg:not(.hidden)) .topbar {
  display: flex !important;
}

body.battle-active #battle.battle--arena-tcg {
  padding-top: env(safe-area-inset-top, 0px) !important;
  padding-bottom: 0 !important;
  min-height: 0;
}

body.battle-active .battle:not(.battle--arena-tcg) {
  padding-top: max(2.35rem, env(safe-area-inset-top, 0px) + 1.75rem);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  min-height: 0;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  padding: 0.65rem clamp(0.65rem, 3vw, 1.25rem);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent);
  z-index: 50;
}

.topbar-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.topbar-start {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  min-width: 0;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
  font-size: 0.88rem;
}

.site-nav a {
  color: rgba(232, 220, 196, 0.78);
  text-decoration: none;
  padding: 0.2rem 0.1rem;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-nav a:hover {
  color: var(--gold);
  border-bottom-color: rgba(212, 166, 75, 0.45);
}

@media (max-width: 720px) {
  .site-nav {
    display: none;
  }

  .topbar-start {
    flex: 1 1 auto;
    min-width: 0;
  }

  .topbar .btn-ghost {
    flex-shrink: 0;
    padding: 0.45rem 0.65rem;
    font-size: 0.82rem;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-logo {
  display: block;
  height: clamp(2.25rem, 5vw, 3rem);
  width: auto;
  max-width: min(220px, 52vw);
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.65));
}

.btn {
  font-family: var(--font-ui);
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--parchment);
  border: 1px solid rgba(212, 166, 75, 0.25);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--gold);
}

.btn-gold {
  background: linear-gradient(180deg, #e8c56e, #9a7028);
  color: #1a1206;
  box-shadow: 0 4px 20px rgba(212, 166, 75, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-gold:hover {
  filter: brightness(1.08);
}

/* CTA salão online na sala / setup — destaque frente ao btn-ghost «apagado» */
.setup-salon-cta {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  margin: 0.35rem 0 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(36, 28, 48, 0.55), rgba(14, 12, 22, 0.72));
  border: 1px solid rgba(212, 166, 75, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.setup-salon-cta__hint {
  margin: 0;
  opacity: 0.88;
}

.btn-salon-online {
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: none;
  padding: 0.65rem 1.2rem;
  border-radius: 11px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease,
    filter 0.2s ease;
  color: #f8f0e0;
  background: linear-gradient(168deg, rgba(55, 42, 72, 0.98) 0%, rgba(22, 16, 36, 0.99) 100%);
  border: 2px solid rgba(212, 166, 75, 0.75);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 4px 18px rgba(0, 0, 0, 0.45),
    0 0 28px rgba(120, 200, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.btn-salon-online:hover:not(:disabled) {
  border-color: #e8c56e;
  color: #fffdf8;
  filter: brightness(1.06);
  box-shadow:
    0 0 0 1px rgba(232, 197, 110, 0.35),
    0 6px 22px rgba(0, 0, 0, 0.5),
    0 0 32px rgba(212, 166, 75, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.btn-salon-online:active:not(:disabled) {
  transform: scale(0.98);
}

/* Desabilitado: legível (sem opacity 0.4 do browser por defeito) */
.btn-salon-online:disabled {
  cursor: not-allowed;
  opacity: 1;
  color: rgba(248, 240, 224, 0.72);
  background: linear-gradient(168deg, rgba(38, 34, 48, 0.88), rgba(20, 18, 28, 0.92));
  border-color: rgba(212, 166, 75, 0.38);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  text-shadow: none;
}

.btn-draw {
  width: 100%;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  animation: btn-draw-glow 1.35s ease-in-out infinite;
}

@keyframes btn-draw-glow {
  0%,
  100% {
    box-shadow: 0 0 12px rgba(232, 197, 110, 0.35), 0 4px 16px rgba(0, 0, 0, 0.45);
  }
  50% {
    box-shadow: 0 0 22px rgba(232, 197, 110, 0.65), 0 4px 20px rgba(0, 0, 0, 0.5);
  }
}

.btn.large {
  width: 100%;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
}

.btn-end {
  width: 100%;
  min-height: 5.25rem;
  border-radius: 14px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #3d9a52, #1d5a2e);
  color: #fff;
  box-shadow: 0 4px 0 #0f3318, 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  border: 2px solid #5ecf7a;
}

.btn-end:hover {
  filter: brightness(1.1);
}

.btn-sec {
  width: 100%;
  margin-top: 0.45rem;
  background: rgba(0, 0, 0, 0.35);
  color: var(--parchment);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 0.45rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-sec:hover {
  border-color: var(--gold-dim);
}

.hidden {
  display: none !important;
}

.setup {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  min-height: 0;
}

/* Página inicial: logo ao centro + mesmo fundo temático da marca */
.home-screen {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(1.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  background:
    linear-gradient(180deg, rgba(8, 2, 4, 0.55) 0%, rgba(12, 3, 6, 0.72) 45%, rgba(6, 0, 2, 0.88) 100%),
    url('../assets/brand/home-fenda-fundo.png') center / cover no-repeat fixed;
}

.home-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 85% 70% at 50% 38%, rgba(120, 20, 30, 0.2), transparent 58%);
  pointer-events: none;
}

.home-screen__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.35rem;
  width: 100%;
  max-width: 640px;
}

.home-screen__logo {
  display: block;
  width: min(92vw, 520px);
  height: auto;
  max-height: min(42vh, 320px);
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 12px 48px rgba(0, 0, 0, 0.75)) drop-shadow(0 0 40px rgba(212, 166, 75, 0.12));
}

.home-screen__tagline {
  margin: 0;
  font-family: var(--font-ui);
  font-size: clamp(0.95rem, 3.2vw, 1.15rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(248, 236, 216, 0.82);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.65);
}

.home-screen__cta {
  padding: 0.75rem 1.85rem;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.home-screen__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.65rem;
  margin-top: 0.25rem;
  font-size: 0.88rem;
}

.home-screen__nav a {
  color: rgba(232, 220, 196, 0.72);
  text-decoration: none;
  border-bottom: 1px solid rgba(212, 166, 75, 0.35);
  padding-bottom: 0.08rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.home-screen__nav a:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.home-screen__nav-sep {
  opacity: 0.35;
  user-select: none;
}

.setup-frame {
  width: min(520px, 100%);
  padding: clamp(1.25rem, 4vw, 2rem) clamp(1rem, 4vw, 1.75rem);
  border-radius: clamp(12px, 2.5vw, 20px);
  background: linear-gradient(145deg, rgba(40, 32, 22, 0.95), rgba(18, 14, 10, 0.98));
  border: 2px solid var(--gold-dim);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

@media (max-width: 720px) {
  .setup {
    padding: 1rem clamp(0.65rem, 3vw, 1rem);
  }

  .setup-frame {
    width: 100%;
    border-radius: 14px;
  }

  .setup-grid {
    gap: 0.75rem;
  }
}

.setup-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--gold);
  text-align: center;
  letter-spacing: 0.06em;
}

.setup-intro {
  margin: 0 0 1.25rem;
  text-align: center;
  opacity: 0.75;
  font-size: 0.9rem;
  line-height: 1.5;
}

.setup-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.setup-block label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.65;
  margin-bottom: 0.35rem;
}

.setup-block select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(212, 166, 75, 0.25);
  background: rgba(0, 0, 0, 0.4);
  color: var(--parchment);
  font-family: var(--font-ui);
  font-size: 0.95rem;
}

.setup-local-mode {
  border: 1px solid rgba(212, 166, 75, 0.2);
  border-radius: 12px;
  padding: 0.85rem 1rem 1rem;
  margin-bottom: 1rem;
}

.setup-local-mode legend {
  padding: 0 0.35rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.75;
}

.local-mode-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.4rem 0;
  font-size: 0.92rem;
  cursor: pointer;
}

.setup-hint {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  opacity: 0.82;
}

.setup-hint strong {
  color: rgba(230, 210, 170, 0.95);
}

.setup-hint--tight {
  margin-top: 0.35rem !important;
  margin-bottom: 0.5rem !important;
  font-size: 0.8rem !important;
}

.setup-grid--profiles {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 640px) {
  .setup-grid--profiles {
    grid-template-columns: 1fr;
  }
}

.setup-block--span {
  grid-column: 1 / -1;
}

.battle {
  flex: 1;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background-color: #06040a;
}

.battle-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.battle-backdrop__layer {
  position: absolute;
  inset: 0;
  background-color: #06040a;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1.05s ease-in-out;
  z-index: 0;
}

.battle-backdrop__layer.is-active {
  opacity: 1;
  z-index: 1;
}

.battle-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.42) 0%, rgba(12, 4, 18, 0.36) 45%, rgba(4, 2, 10, 0.68) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.38) 0%, transparent 55%, rgba(0, 0, 0, 0.22) 100%);
  pointer-events: none;
}

/* Campo + rail: desktop em duas colunas fluidas (sem painel embutido no tabuleiro) */
.battle-layout {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(188px, min(30vw, 320px));
  grid-template-rows: 1fr;
  min-height: 0;
  gap: 0;
}

.battle-field {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  padding: var(--arena-pad-y) var(--arena-pad-x) calc(var(--arena-pad-y) * 0.85);
  gap: clamp(0.1rem, 0.6vw, 0.2rem);
}

/* Faixa por jogador: estado | campo | mão (referência layout TCG) */
.battle-band {
  display: grid;
  grid-template-columns: minmax(104px, 1fr) minmax(0, 4fr) minmax(96px, 1fr);
  align-items: stretch;
  gap: clamp(0.28rem, 1.5vw, 0.55rem) clamp(0.35rem, 1.8vw, 0.65rem);
  min-height: 0;
}

.battle-band--enemy {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: visible;
  position: relative;
  z-index: 1;
  --band-accent: rgba(255, 72, 64, 0.85);
  --band-accent-dim: rgba(120, 28, 24, 0.55);
  grid-template-areas: "status center hand";
}

.battle-band--enemy .player-status {
  grid-area: status;
}

.battle-band--enemy .band-center {
  grid-area: center;
}

.battle-band--enemy .hand-column--enemy {
  grid-area: hand;
}

.battle-band--me {
  flex: 1.15;
  min-height: 0;
  position: relative;
  z-index: 2;
  --band-accent: rgba(64, 168, 255, 0.88);
  --band-accent-dim: rgba(24, 72, 120, 0.5);
  grid-template-columns: minmax(104px, 1fr) minmax(0, 4fr) minmax(100px, 1fr);
  grid-template-areas: "status center hand";
}

.battle-band--me .player-status {
  grid-area: status;
}

.battle-band--me .band-center {
  grid-area: center;
}

.battle-band--me .hand-column--me {
  grid-area: hand;
  min-height: 0;
}

.hand-column--me .hand-column__chrome {
  justify-content: flex-end;
  min-height: 0;
  max-height: min(48vh, clamp(220px, 40vh, 440px));
  flex: 1 1 auto;
}

.battle-vs {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0;
}

.battle-vs__strip {
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  max-width: 92%;
  line-height: 1.2;
  color: rgba(232, 220, 196, 0.82);
}

.battle-vs__text {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gold);
  opacity: 0.92;
  text-shadow: 0 0 14px rgba(212, 166, 75, 0.4);
  border: 2px solid rgba(212, 166, 75, 0.38);
  background: radial-gradient(circle at 35% 28%, rgba(52, 44, 30, 0.96), rgba(10, 8, 6, 0.99));
  box-shadow:
    0 0 28px rgba(212, 166, 75, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.player-status {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: var(--arena-pad-y) var(--arena-pad-x);
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Faixas de estado integradas ao tabuleiro (jogador 1 e 2) */
.player-status--enemy {
  padding: 0.28rem var(--arena-pad-x) 0.32rem;
}

.player-status--enemy .player-status__banner {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 90, 80, 0.38);
  border-radius: 0;
  box-shadow: none;
  padding: 0.28rem 0.15rem 0.32rem;
}

.player-status--me {
  padding: 0.28rem var(--arena-pad-x) 0.32rem;
}

.player-status--me .player-status__banner {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(64, 168, 255, 0.38);
  border-radius: 0;
  box-shadow: none;
  padding: 0.28rem 0.15rem 0.32rem;
}

.player-status__banner {
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.35;
  text-align: center;
  text-transform: uppercase;
  padding: 0.34rem 0.35rem 0.3rem;
  border-radius: 6px;
  color: #f4f0e8;
  background: linear-gradient(90deg, var(--band-accent-dim), rgba(0, 0, 0, 0.35));
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.player-status__stats {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.62rem;
  line-height: 1.45;
}

.player-status__stats li {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.12rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.player-status__stats span:first-child {
  opacity: 0.55;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.55rem;
}

.player-status__stats span:last-child {
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.player-status__fx {
  margin-top: auto;
  font-size: 0.52rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.42;
  padding-top: 0.25rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.player-status .hero-plate {
  align-self: center;
  transform: scale(0.92);
  transform-origin: top center;
}

.player-status .hero-plate__meta {
  max-width: 100%;
}

.band-center {
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-self: stretch;
  width: 100%;
  min-width: 0;
  padding: var(--arena-pad-y) var(--arena-pad-x) calc(var(--arena-pad-y) * 0.75);
  gap: clamp(0.18rem, 1vw, 0.35rem);
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.band-center.combatant--enemy {
  border-bottom: 1px solid rgba(255, 72, 64, 0.14);
}

.band-center.combatant--me {
  border-top: 1px solid rgba(64, 168, 255, 0.14);
}

.arena-deck-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
}

.arena-deck-cluster {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.32rem;
  flex-shrink: 0;
}

.arena-deck-cluster .deck-stack {
  margin-bottom: 0;
}

.arena-deck-cluster .deck-stack__label {
  bottom: -0.72rem;
  font-size: 0.5rem;
}

.arena-deck-row__mid {
  flex: 1;
  text-align: center;
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.38;
  padding: 0.15rem 0;
}

/* Rótulos Deck / Mesa / Mão — só telemóvel (ver @media max-width 640px) */
.mobile-zone-ribbon {
  display: none;
}

.deck-stack--muted {
  opacity: 0.48;
  filter: saturate(0.65);
}

.deck-stack--discard {
  opacity: 0.55;
  border-color: rgba(80, 62, 48, 0.55);
  box-shadow: 2px 2px 0 #120c08, 3px 3px 10px rgba(0, 0, 0, 0.35);
}

.deck-stack--discard::before {
  opacity: 0.35;
}

.deck-stack--discard .deck-stack__count {
  font-size: 0.95rem;
}

.hand-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

.hand-column__chrome {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: min(40vh, clamp(200px, 32vh, 380px));
  overflow: visible;
  padding: 0.15rem 0.05rem 0.25rem;
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.hand-column--enemy .hand-column__chrome {
  justify-content: flex-start;
  max-height: min(30vh, 200px);
}

.hand-column__label {
  display: block;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.75;
  margin-bottom: 0.2rem;
}

.battle-footer {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  padding: 0.35rem 0.75rem 0.55rem;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.82), transparent);
  border-top: 1px solid rgba(212, 166, 75, 0.1);
}

/* Menu inferior (telemóvel) — conteúdo activo em @media max-width 640px */
.battle-mobile-dock {
  display: none;
  position: relative;
  z-index: 24;
  flex-shrink: 0;
}

.phase-track {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  max-width: 920px;
  margin: 0 auto;
}

.phase-track__step {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.28rem 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  color: var(--parchment);
  opacity: 0.45;
}

.phase-track__step--on {
  opacity: 1;
  color: #b8e6ff;
  border-color: rgba(100, 190, 255, 0.55);
  box-shadow: 0 0 14px rgba(80, 160, 255, 0.28);
  background: rgba(20, 40, 56, 0.55);
}

@media (max-width: 960px) {
  .battle-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .side-rail {
    max-height: min(36vh, 260px);
    border-left: none !important;
    border-top: 1px solid rgba(212, 166, 75, 0.12);
  }

  .battle-band {
    grid-template-columns: minmax(92px, 1fr) minmax(0, 4fr) minmax(80px, 1fr);
    gap: 0.28rem 0.4rem;
  }

  .battle-band--me {
    grid-template-columns: minmax(88px, 1fr) minmax(0, 4fr) minmax(80px, 1fr);
  }

  .player-status .hero-plate {
    transform: scale(0.82);
  }

  .hand-column--me .hand {
    min-height: 160px;
  }
}

/* HUD menu/chat — só em campo de batalha ≤640px */
.battle-hud-chrome {
  display: none;
}

/* Telemóvel: coluna única por faixa (estado → campo → mão), peças mais compactas */
@media (max-width: 640px) {
  .battle {
    --neon-enemy: #ff2a2a;
    --neon-enemy-deep: #8b0000;
    --neon-me: #00aeef;
    --neon-me-deep: #0440ff;
    --battle-gutter: 16px;
    --battle-card-gap: 12px;
  }

  body.battle-active .topbar {
    padding: 0.35rem max(0.55rem, env(safe-area-inset-right)) 0.35rem max(0.55rem, env(safe-area-inset-left));
  }

  body.battle-active .battle {
    padding-top: max(1.85rem, env(safe-area-inset-top, 0px) + 1.35rem);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .battle-layout {
    position: relative;
    z-index: 3;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    min-height: 0;
  }

  .battle-field {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows:
      auto
      auto
      minmax(72px, 1fr)
      auto
      minmax(72px, 1fr)
      minmax(100px, auto)
      auto;
    grid-template-areas:
      "p2status"
      "p2hand"
      "p2field"
      "vs"
      "p1field"
      "p1hand"
      "p1status";
    gap: 0.1rem;
    min-height: 0;
    padding: 0.12rem max(var(--battle-gutter), env(safe-area-inset-left))
      0.1rem max(var(--battle-gutter), env(safe-area-inset-right));
    align-content: stretch;
  }

  .battle-band.battle-band--enemy,
  .battle-band.battle-band--me,
  .battle-band {
    display: contents;
  }

  #player-status-p2 {
    grid-area: p2status;
    overflow: visible;
    max-width: 100%;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.14rem;
    padding: 0.12rem 0.28rem 0.18rem;
    min-height: 5.5rem;
  }

  #player-status-p2 .player-status__banner {
    flex: 0 0 auto;
    width: 100%;
    order: 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 90, 80, 0.32);
    border-radius: 0;
    box-shadow: none;
    padding: 0.18rem 0.1rem 0.22rem;
  }

  #player-status-p2 .hero-plate {
    order: 1;
    width: auto;
    max-width: 100%;
    flex: 0 0 auto;
    padding: 0.15rem 0.35rem 0.25rem;
    margin: 0 auto;
    touch-action: manipulation;
  }

  #player-status-p2 .player-status__stats {
    order: 2;
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.2rem 0.55rem;
    padding: 0;
    margin: 0;
    list-style: none;
  }

  #player-status-p2 .player-status__stats li {
    border-bottom: none;
    padding: 0.1rem 0;
    flex: 0 0 auto;
  }

  #hand-column-p2 {
    grid-area: p2hand;
  }

  #zone-p2 {
    grid-area: p2field;
  }

  .battle-field > .battle-vs {
    grid-area: vs;
  }

  #zone-p1 {
    grid-area: p1field;
  }

  #player-status-p1 {
    grid-area: p1status;
    overflow: visible;
    max-width: 100%;
  }

  #hand-column-p1 {
    grid-area: p1hand;
    position: relative;
    z-index: 16;
    align-self: stretch;
    width: 100%;
    min-width: 0;
    min-height: 0;
    background: rgba(4, 3, 12, 0.88);
    border-top: 1px solid rgba(100, 168, 255, 0.22);
    border-bottom: 1px solid rgba(212, 166, 75, 0.1);
    padding: 0.18rem 0.12rem 0.22rem;
  }

  .battle-vs {
    padding: 0.02rem 0;
    flex-direction: column;
    gap: 0.12rem;
  }

  .battle-vs__strip {
    color: rgba(255, 255, 255, 0.88);
    text-shadow: 0 0 10px rgba(255, 42, 42, 0.35), 0 0 12px rgba(0, 174, 239, 0.28);
  }

  /* Botão central de fase — hexágono (referência mobile) */
  .battle-vs__text,
  .battle-vs__badge.battle-vs__text {
    width: 3.15rem;
    height: 3.15rem;
    border-radius: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    font-family: var(--font-ui);
    font-size: 0.48rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1.05;
    text-align: center;
    padding: 0.15rem 0.35rem;
    color: #f4f8ff;
    opacity: 1;
    text-shadow: 0 0 12px rgba(0, 174, 239, 0.55), 0 0 10px rgba(255, 42, 42, 0.45);
    border: 2px solid rgba(255, 255, 255, 0.28);
    background:
      radial-gradient(circle at 38% 28%, rgba(55, 40, 52, 0.95), rgba(8, 5, 14, 0.99));
    box-shadow:
      0 0 20px rgba(255, 42, 42, 0.42),
      0 0 26px rgba(0, 174, 239, 0.32),
      inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    animation: battle-vs-hex-pulse 2.5s ease-in-out infinite;
  }

  @keyframes battle-vs-hex-pulse {
    0%,
    100% {
      box-shadow:
        0 0 16px rgba(255, 42, 42, 0.32),
        0 0 20px rgba(0, 174, 239, 0.25),
        inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    }
    50% {
      box-shadow:
        0 0 26px rgba(255, 42, 42, 0.5),
        0 0 32px rgba(0, 174, 239, 0.42),
        inset 0 0 0 1px rgba(255, 255, 255, 0.12);
    }
  }

  .player-status {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    align-content: flex-start;
    gap: 0.16rem 0.26rem;
    padding: 0.16rem 0.24rem;
    overflow: visible;
  }

  .player-status--me {
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .player-status__banner {
    flex: 1 1 100%;
    order: 0;
    font-size: 0.48rem;
    padding: 0.22rem 0.28rem;
    line-height: 1.25;
  }

  .player-status__stats {
    order: 1;
    flex: 1 1 0;
    min-width: 0;
    max-width: 46%;
    font-size: 0.48rem;
    line-height: 1.25;
  }

  .player-status .hero-plate {
    order: 2;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 52%;
    transform: none;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
  }

  .player-status .hero-plate__cluster {
    gap: 0.18rem;
    align-items: center;
  }

  .player-status .hero-plate__avatar {
    width: 52px;
    height: 52px;
    border-width: 2px;
  }

  .player-status .hero-plate__ring {
    inset: -2px;
  }

  .player-status .hero-life-rail {
    gap: 0.08rem;
    padding: 0.08rem 0.02rem;
  }

  .player-status .hero-life-rail__pip {
    width: 5px;
    height: 5px;
  }

  .player-status .hero-plate__badge {
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.18rem;
    font-size: 0.65rem;
    border-width: 2px;
    bottom: -1px;
    right: -2px;
  }

  .player-status .hero-plate__meta {
    margin-top: 0.12rem;
    max-width: 100%;
    margin-inline: 0;
    text-align: center;
  }

  .player-status .hero-plate__name {
    font-size: 0.52rem;
  }

  .player-status .hero-plate__clan,
  .player-status .hero-plate__raca {
    font-size: 0.42rem;
    margin-top: 0.06rem;
  }

  .player-status__stats li {
    padding: 0.06rem 0;
  }

  .player-status__stats span:first-child {
    font-size: 0.44rem;
  }

  .player-status__fx {
    display: none;
  }

  .band-center {
    border: none;
    box-shadow: none;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    padding: 0.14rem 0.2rem;
    gap: 0.16rem;
    min-height: 0;
    justify-content: center;
  }

  .arena-deck-row {
    gap: 0.28rem;
  }

  .arena-deck-cluster {
    gap: 0.22rem;
  }

  /* Modelo de ecrã móvel: zonas Deck → Mesa (lacaios + artefactos) */
  .mobile-zone-ribbon {
    display: block;
    flex-shrink: 0;
    align-self: flex-start;
    margin: 0 0 0.04rem;
    padding: 0.1rem 0.42rem 0.11rem;
    font-size: 0.44rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    line-height: 1.1;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
    color: rgba(232, 220, 196, 0.88);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }

  .combatant--enemy .mobile-zone-ribbon {
    color: rgba(255, 200, 195, 0.95);
    border-color: rgba(255, 90, 80, 0.38);
    background: linear-gradient(180deg, rgba(48, 14, 16, 0.75), rgba(18, 6, 8, 0.88));
    box-shadow:
      0 0 12px rgba(255, 60, 48, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }

  .combatant--me .mobile-zone-ribbon {
    color: rgba(186, 220, 255, 0.96);
    border-color: rgba(64, 168, 255, 0.4);
    background: linear-gradient(180deg, rgba(12, 28, 48, 0.78), rgba(6, 14, 28, 0.9));
    box-shadow:
      0 0 12px rgba(64, 168, 255, 0.14),
      inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }

  .hand-column--enemy > .mobile-zone-ribbon {
    align-self: center;
    margin: 0 auto 0.12rem;
    color: rgba(255, 200, 195, 0.95);
    border-color: rgba(255, 90, 80, 0.38);
    background: linear-gradient(180deg, rgba(48, 14, 16, 0.75), rgba(18, 6, 8, 0.88));
    box-shadow:
      0 0 12px rgba(255, 60, 48, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }

  .deck-stack {
    width: 38px;
    height: 52px;
  }

  .deck-stack__count {
    font-size: 0.82rem;
  }

  .deck-stack__label {
    font-size: 0.42rem;
    bottom: -0.72rem;
  }

  .minion-row {
    min-height: 0;
    padding: 0.12rem 0.1rem;
    gap: var(--battle-card-gap, 12px);
    row-gap: var(--battle-card-gap, 12px);
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .combatant--enemy .minion-row {
    min-height: 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .minion-slot {
    width: 54px;
    min-height: 78px;
  }

  .board-minion {
    width: 50px;
    height: 72px;
  }

  .board-minion:hover {
    transform: none;
  }

  .board-minion .tcg-card-frame--compact .tcg-card__banner {
    font-size: 0.36rem;
  }

  .board-minion .tcg-card-frame--compact .tcg-card__texto {
    font-size: 0.34rem;
    -webkit-line-clamp: 2;
  }

  .hand-column__label {
    font-size: 0.46rem;
    margin-bottom: 0.06rem;
    flex-shrink: 0;
  }

  .hand-column--me .hand-column__chrome {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-height: none;
    min-height: 0;
    width: 100%;
    padding: 0.08rem 0.06rem 0.06rem;
    overflow: visible;
  }

  .hand-column--me .hand-dock {
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }

  .hand-column--enemy .hand-column__chrome {
    max-height: none;
    justify-content: center;
    padding: 0.08rem 0.1rem;
  }

  .hand-column--enemy .hand-backs--column {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-end;
    justify-content: center;
    max-height: none;
    min-height: 0;
    padding: 0.08rem 0.12rem;
    gap: 0.14rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .hand-column--enemy .hand-backs--column .card-back {
    margin-top: 0;
    margin-left: 0;
    flex-shrink: 0;
  }

  .hand-column--enemy .hand-backs--column .card-back:first-child {
    margin-left: 0;
  }

  .hand-dock__hint {
    font-size: 0.46rem;
    margin-bottom: 0.08rem;
    flex-shrink: 0;
  }

  .hand {
    min-height: 0;
    width: 100%;
    max-width: 100%;
    padding: 0 0.12rem;
  }

  .hand.hand--column {
    pointer-events: auto;
  }

  .hand-column--me .hand {
    min-height: 0;
  }

  .hand--column {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: flex-end;
    align-content: flex-end;
    gap: var(--battle-card-gap, 12px);
    min-height: 88px;
    max-height: 112px;
    padding: 0.12rem 0.1rem 0.16rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
  }

  .hand--column .hand-card {
    flex: 0 0 auto;
    margin-top: 0;
    margin-left: 0;
    margin-bottom: 0;
    transform: none !important;
    scroll-snap-align: center;
  }

  .hand--column .hand-card:active:not(.disabled) {
    transform: scale(1.08) !important;
    z-index: 6;
    filter: brightness(1.12);
  }

  .hand--column .hand-card:first-child {
    margin-top: 0;
  }

  .hand--column .hand-card:hover:not(.disabled) {
    filter: brightness(1.08);
    z-index: 2;
  }

  .hand-card {
    width: clamp(50px, 14vw, 64px);
    height: clamp(72px, 20vw, 92px);
    border-radius: 7px;
    padding: 2px;
  }

  .side-rail {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    align-content: flex-start;
    gap: 0.22rem 0.3rem;
    padding: 0.26rem max(0.35rem, env(safe-area-inset-right)) calc(0.3rem + env(safe-area-inset-bottom, 0px))
      max(0.35rem, env(safe-area-inset-left));
    max-height: min(22vh, 132px);
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    background: rgba(0, 0, 0, 0.42);
    border-top: 1px solid rgba(212, 166, 75, 0.12);
    border-left: none;
  }

  .rail-turn {
    flex: 1 1 45%;
    min-width: 0;
    font-size: 0.6rem;
  }

  .rail-phase {
    flex: 1 1 45%;
    min-width: 0;
    font-size: 0.56rem;
  }

  .ap-tray {
    flex: 0 0 auto;
    padding: 0.1rem 0;
  }

  .crystal {
    width: 16px;
    height: 22px;
  }

  .rail-controls {
    flex: 1 1 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.28rem;
    justify-content: center;
  }

  .rail-controls .btn {
    padding: 0.35rem 0.55rem;
    font-size: 0.72rem;
  }

  /* Secundários (ex.: cancelar alvo) — compacto mas tocável */
  .rail-controls .btn-sec {
    min-height: 44px;
    padding: 0.35rem 0.65rem;
  }

  .log-panel {
    display: none;
  }

  .battle-layout--log-open .log-panel {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    max-height: min(42vh, 320px);
    z-index: 130;
    background: linear-gradient(180deg, rgba(14, 10, 22, 0.98), rgba(6, 4, 12, 0.99));
    border: 1px solid rgba(0, 174, 239, 0.38);
    border-radius: 12px;
    padding: 0.4rem 0.45rem 0.45rem;
    box-shadow:
      0 0 28px rgba(0, 174, 239, 0.2),
      0 12px 40px rgba(0, 0, 0, 0.65);
  }

  .battle-layout--log-open .log {
    flex: 1;
    min-height: 0;
    max-height: min(34vh, 260px);
  }

  .battle-footer {
    padding: 0.22rem max(0.45rem, env(safe-area-inset-right)) calc(0.32rem + env(safe-area-inset-bottom, 0px))
      max(0.45rem, env(safe-area-inset-left));
    margin-bottom: calc(54px + env(safe-area-inset-bottom, 0px));
  }

  .phase-track {
    gap: 0.18rem 0.28rem;
  }

  .phase-track__step {
    font-size: 0.42rem;
    padding: 0.16rem 0.3rem;
    letter-spacing: 0.04em;
  }

  /* Barra inferior fixa (acima da safe area) */
  .battle-mobile-dock {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 110;
    flex-direction: row;
    align-items: stretch;
    justify-content: space-between;
    gap: 0.35rem;
    padding: 0.35rem max(var(--battle-gutter), env(safe-area-inset-right)) calc(0.35rem + env(safe-area-inset-bottom, 0px))
      max(var(--battle-gutter), env(safe-area-inset-left));
    min-height: calc(48px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(0deg, rgba(4, 3, 8, 0.98), rgba(10, 8, 16, 0.94));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.45);
  }

  .battle-mobile-dock__btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    padding: 0.2rem 0.15rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
    color: rgba(232, 228, 240, 0.92);
    font-family: var(--font-ui);
    font-size: 0.52rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    touch-action: manipulation;
    transition:
      transform 0.12s ease,
      box-shadow 0.15s ease,
      border-color 0.15s ease;
  }

  .battle-mobile-dock__btn:active:not(:disabled) {
    transform: scale(0.97);
  }

  .battle-mobile-dock__btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
  }

  .battle-mobile-dock__btn--phase {
    flex: 1.35 1 0;
    border-color: rgba(0, 174, 239, 0.55);
    color: #dff6ff;
    background: linear-gradient(165deg, rgba(0, 68, 255, 0.35), rgba(0, 20, 48, 0.88));
    box-shadow:
      0 0 18px rgba(0, 174, 239, 0.35),
      inset 0 1px 0 rgba(255, 255, 255, 0.12);
  }

  .battle-mobile-dock__btn--phase:disabled {
    box-shadow: none;
  }

  .battle-mobile-dock__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.92;
  }

  .battle-mobile-dock__icon--phase svg {
    filter: drop-shadow(0 0 6px rgba(0, 174, 239, 0.65));
  }

  .battle-mobile-dock__label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.48rem;
  }

  /* HUD topo: menu + chat */
  .battle-hud-chrome {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    flex: 1 1 100%;
    order: -1;
    margin-bottom: 0.06rem;
    padding: 0.06rem 0.04rem 0.12rem;
    gap: 0.35rem;
  }

  .battle-hud-chrome__btn {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.4);
    color: rgba(255, 255, 255, 0.88);
    cursor: pointer;
    touch-action: manipulation;
  }

  .battle-hud-chrome__btn:active {
    transform: scale(0.96);
  }

  .battle-hud-chrome__spacer {
    flex: 1 1 auto;
  }

  .battle-hud-chrome--enemy .battle-hud-chrome__btn {
    border-color: rgba(255, 42, 42, 0.35);
    box-shadow: 0 0 12px rgba(255, 42, 42, 0.12);
  }

  .battle-hud-chrome--me .battle-hud-chrome__btn {
    border-color: rgba(0, 174, 239, 0.38);
    box-shadow: 0 0 12px rgba(0, 174, 239, 0.14);
  }

  .battle-field--turn-p0 {
    animation: battlefield-glow-blue 2.8s ease-in-out infinite;
  }

  .battle-field--turn-p1 {
    animation: battlefield-glow-red 2.8s ease-in-out infinite;
  }

  @keyframes battlefield-glow-blue {
    0%,
    100% {
      box-shadow: inset 0 0 50px rgba(0, 174, 239, 0.04);
    }
    50% {
      box-shadow: inset 0 0 70px rgba(0, 174, 239, 0.1);
    }
  }

  @keyframes battlefield-glow-red {
    0%,
    100% {
      box-shadow: inset 0 0 50px rgba(255, 42, 42, 0.04);
    }
    50% {
      box-shadow: inset 0 0 70px rgba(255, 42, 42, 0.09);
    }
  }
}

@media (max-width: 380px) {
  .minion-slot {
    width: 48px;
    min-height: 68px;
  }

  .board-minion {
    width: 44px;
    height: 64px;
  }

  .hand-card {
    width: clamp(46px, 14vw, 60px);
    height: clamp(66px, 19vw, 86px);
  }

  .hand--column {
    gap: 0.16rem;
    min-height: 80px;
    max-height: 104px;
  }

  .side-rail {
    max-height: min(20vh, 118px);
  }
}

.hud-win {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  padding: 1.5rem 2rem;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(30, 24, 16, 0.98), rgba(10, 8, 6, 0.99));
  border: 2px solid var(--gold);
  box-shadow: 0 0 80px rgba(212, 166, 75, 0.35), 0 24px 48px rgba(0, 0, 0, 0.7);
  font-family: var(--font-display);
  font-size: 1.2rem;
  text-align: center;
  max-width: 90vw;
  color: var(--gold);
  white-space: pre-line;
}

.side-rail {
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.65rem clamp(0.45rem, 1.2vw, 0.65rem) 0.85rem;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.55));
  border-left: 1px solid rgba(212, 166, 75, 0.12);
}

.rail-turn {
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--gold);
  letter-spacing: 0.04em;
  line-height: 1.35;
}

.rail-phase {
  font-size: 0.74rem;
  opacity: 0.85;
  line-height: 1.3;
}

.ap-tray {
  display: flex;
  gap: 0.3rem;
  justify-content: center;
  padding: 0.3rem 0;
}

.crystal {
  width: 20px;
  height: 28px;
  border-radius: 5px 5px 9px 9px;
  background: linear-gradient(180deg, #4a90b8, #1a3a52);
  border: 1px solid #6ab0d8;
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.35);
  opacity: 0.22;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.crystal--full {
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(100, 180, 255, 0.55));
}

.rail-controls {
  display: flex;
  flex-direction: column;
}

.log-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: 0.35rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.log-title {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 0.3rem 0.45rem;
  opacity: 0.5;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.log {
  flex: 1;
  overflow-y: auto;
  padding: 0.35rem 0.45rem;
  font-size: clamp(0.58rem, 1.1vw, 0.65rem);
  line-height: 1.35;
  opacity: 0.8;
  max-height: min(32vh, 280px);
}

.log div {
  margin-bottom: 0.2rem;
}

.combatant {
  --clan-hue: 38;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.deck-stack {
  flex-shrink: 0;
  width: 54px;
  height: 74px;
  position: relative;
  border-radius: 8px;
  background: var(--card-back-image) center / cover no-repeat;
  border: 2px solid rgba(90, 64, 32, 0.85);
  box-shadow: 3px 3px 0 #1a1008, 6px 6px 16px rgba(0, 0, 0, 0.5);
}

.deck-stack::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.35) 100%);
  pointer-events: none;
}

.deck-stack__count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--gold);
  text-shadow: 0 2px 4px #000;
}

.deck-stack__label {
  position: absolute;
  bottom: -1rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.4;
  white-space: nowrap;
}

.hand-backs {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 48px;
  flex: 1;
  padding: 0 0.35rem;
}

.card-back {
  width: 32px;
  height: 44px;
  margin-left: -13px;
  border-radius: 5px;
  background: var(--card-back-image) center / cover no-repeat;
  border: 1px solid rgba(120, 90, 40, 0.75);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.45);
  transform-origin: bottom center;
}

.card-back:first-child {
  margin-left: 0;
}

.hand-backs--column {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: auto;
  min-height: 0;
  max-height: min(26vh, 200px);
  overflow: visible;
  flex: 0 1 auto;
  padding: 0.45rem 0.2rem;
}

.hand-backs--column .card-back {
  margin-left: 0;
  margin-top: -24px;
}

.hand-backs--column .card-back:first-child {
  margin-top: 0;
}

.hero-plate {
  position: relative;
  flex-shrink: 0;
  width: fit-content;
  max-width: 100%;
  cursor: default;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
}

.hero-plate__cluster {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.hero-plate__avatar-shell {
  position: relative;
  flex-shrink: 0;
}

.hero-life-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  padding: 0.2rem 0.05rem;
  flex-shrink: 0;
}

.hero-life-rail__pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.38);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.85);
}

.hero-life-rail__pip.is-on {
  background: radial-gradient(
    circle at 32% 28%,
    hsl(var(--clan-hue), 72%, 58%),
    hsl(var(--clan-hue), 52%, 26%)
  );
  border-color: hsla(var(--clan-hue), 55%, 42%, 0.95);
  box-shadow:
    0 0 5px hsla(var(--clan-hue), 75%, 48%, 0.55),
    inset 0 0 4px hsla(var(--clan-hue), 80%, 70%, 0.25);
}

.hero-plate.targetable {
  cursor: crosshair;
  animation: pulse-target 1.2s ease-in-out infinite;
}

@keyframes pulse-target {
  0%,
  100% {
    filter: drop-shadow(0 0 0 rgba(212, 166, 75, 0));
  }
  50% {
    filter: drop-shadow(0 0 14px rgba(212, 166, 75, 0.65));
  }
}

.hero-plate__ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(
    from 200deg,
    hsl(var(--clan-hue), 55%, 32%),
    hsl(calc(var(--clan-hue) + 40), 50%, 45%),
    hsl(var(--clan-hue), 60%, 28%)
  );
  z-index: 0;
}

.hero-plate__avatar {
  position: relative;
  z-index: 1;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 4px solid #2a2018;
  overflow: hidden;
  background: #120e0a;
  box-shadow: inset 0 -20px 40px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.combatant--enemy .hero-plate__avatar {
  width: 88px;
  height: 88px;
}

.combatant--enemy .hero-plate__ring {
  inset: -3px;
}

.hero-plate__badge {
  position: absolute;
  bottom: -2px;
  right: -4px;
  z-index: 3;
  min-width: 2.35rem;
  height: 2.35rem;
  padding: 0 0.3rem;
  border-radius: 50%;
  background: linear-gradient(180deg, #2ecf6a, #0d6e32);
  border: 3px solid #0a3018;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  text-shadow: 0 2px 0 #000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
}

.hero-plate__meta {
  margin-top: 0.35rem;
  text-align: center;
  max-width: min(148px, 100%);
  margin-inline: auto;
}

.hero-plate__player {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.5;
}

.hero-plate__name {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.15;
}

.hero-plate__clan {
  font-size: 0.58rem;
  opacity: 0.62;
  margin-top: 0.12rem;
  line-height: 1.15;
}

.minion-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 0.5rem;
  min-height: 170px;
  padding: 0.45rem 0.4rem 0.4rem;
  background:
    radial-gradient(ellipse 88% 120% at 50% 100%, rgba(0, 0, 0, 0.28), transparent 68%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 40%);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.combatant--enemy .minion-row {
  min-height: 158px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 72, 64, 0.1);
  box-shadow: none;
}

.minion-slot {
  width: 132px;
  min-height: 164px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.minion-slot--empty {
  border-radius: 10px;
  border: 2px dashed rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.14);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.minion-slot--empty span {
  font-size: 0.55rem;
  opacity: 0.22;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.board-minion {
  position: relative;
  width: 126px;
  height: 172px;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  background: transparent;
  border: none;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.45);
  cursor: default;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.board-minion .tcg-card-frame {
  border-color: rgba(122, 98, 56, 0.85);
}

.board-minion:hover {
  transform: translateY(-3px);
  z-index: 5;
}

.board-minion.criatura .tcg-card-frame {
  border-color: rgba(138, 112, 56, 0.95);
}

.board-minion.ativador .tcg-card-frame {
  border-color: rgba(74, 90, 138, 0.95);
}

.board-minion.artefato .tcg-card-frame {
  border-color: rgba(106, 106, 106, 0.95);
}

.board-minion.exhausted {
  filter: grayscale(0.35) brightness(0.85);
}

.board-minion.summon {
  box-shadow: 0 0 0 2px rgba(212, 166, 75, 0.45), 0 10px 20px rgba(0, 0, 0, 0.45);
}

.board-minion.can-act {
  cursor: pointer;
  box-shadow: 0 0 0 2px #5ecf7a, 0 10px 24px rgba(0, 0, 0, 0.5);
}

.board-minion.targetable {
  cursor: crosshair;
  animation: minion-target 1s ease-in-out infinite;
}

@keyframes minion-target {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(196, 60, 60, 0.3);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(196, 60, 60, 0.75);
  }
}

/* Cartas no tabuleiro: maior + texto da regra visível */
.board-minion .tcg-card-frame--compact {
  padding: 3px 14px 3px 3px;
}

.board-minion .tcg-card-frame--compact .tcg-card__banner {
  font-size: 0.48rem;
}

.board-minion .tcg-card-frame--compact .tcg-card__mid {
  font-size: 0.42rem;
}

.board-minion .tcg-card__art-wrap {
  flex: 1 1 44%;
  max-height: 50%;
  min-height: 42px;
}

.board-minion .tcg-card-frame--compact .tcg-card__art {
  min-height: 48px;
}

.board-minion .tcg-card-frame--compact .tcg-card__texto {
  -webkit-line-clamp: 4;
  font-size: 0.44rem;
  line-height: 1.12;
}

.board-minion .tcg-card__scale {
  top: 20px;
  bottom: 4px;
}

.board-minion .tcg-card-frame--compact .tcg-card__scale {
  top: 18px;
  width: 10px;
}

.artifact-strip {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  min-height: 32px;
}

.artifact-chip {
  padding: 0.2rem 0.45rem;
  border-radius: 8px;
  font-size: 0.58rem;
  background: rgba(40, 40, 45, 0.92);
  border: 1px solid #666;
}

.artifact-chip--empty {
  opacity: 0.22;
  border-style: dashed;
}

.hand-dock {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 30;
  padding: 0.1rem 0 0.35rem;
  background: transparent;
  pointer-events: none;
}

.hand-dock__hint {
  text-align: center;
  font-size: 0.62rem;
  opacity: 0.62;
  margin-bottom: 0.2rem;
  min-height: 1em;
  pointer-events: none;
}

.hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: 120px;
  padding: 0 0.45rem;
  pointer-events: none;
}

.hand--column {
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-height: 200px;
  max-height: none;
  overflow: visible;
  padding-bottom: 0.35rem;
}

.hand--column .hand-card {
  margin-left: 0;
  margin-top: -168px;
  transform-origin: center bottom;
  transition: transform 0.2s ease, margin 0.2s ease, filter 0.2s ease;
}

.hand--column .hand-card:first-child {
  margin-top: 0;
}

.hand--column .hand-card:hover:not(.disabled) {
  z-index: 20;
  transform: translateX(-6px) scale(1.05) !important;
  filter: brightness(1.08);
}

.hand--fan .hand-card {
  margin-left: -62px;
  transform-origin: bottom center;
  transition: transform 0.2s ease, margin 0.2s ease, filter 0.2s ease;
}

.hand--fan .hand-card:first-child {
  margin-left: 0;
}

.hand--fan .hand-card:hover:not(.disabled) {
  z-index: 20;
  transform: translateY(-12px) scale(1.04) rotate(0deg) !important;
  filter: brightness(1.08);
}

.hand-card {
  position: relative;
  flex-shrink: 0;
  width: 142px;
  height: 204px;
  border-radius: 14px;
  padding: 3px;
  pointer-events: auto;
  background: linear-gradient(145deg, #5a4830 0%, #2a2218 40%, #0a0806 100%);
  border: 2px solid #6a5538;
  box-shadow:
    0 0 0 1px rgba(212, 166, 75, 0.25),
    0 14px 28px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  cursor: pointer;
  overflow: hidden;
}

.hand-card.criatura {
  border-color: #8a7038;
}

.hand-card.ativador {
  border-color: #4a5a9a;
}

.hand-card.artefato {
  border-color: #777;
}

.hand-card.disabled {
  opacity: 0.36;
  cursor: not-allowed;
  filter: grayscale(0.15);
}

.hand-card__glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle at 50% 0%, rgba(212, 166, 75, 0.14), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.hand-card__pa-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 3;
  font-size: 0.52rem;
  font-weight: 700;
  color: #f0d060;
  text-shadow: 0 1px 2px #000;
  background: rgba(0, 0, 0, 0.55);
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid rgba(212, 166, 75, 0.45);
}

/* Face TCG (mão + mesa) — alinhada às cartas físicas de referência */
.tcg-card-frame {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 3px 15px 4px 4px;
  border-radius: 10px;
  background: linear-gradient(180deg, hsl(var(--card-hue, 38), 22%, 18%) 0%, #0f0d0a 55%, #080706 100%);
  border: 2px solid #4a3828;
  box-shadow:
    inset 0 0 0 1px rgba(212, 166, 75, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.tcg-card-frame--compact {
  padding: 2px 13px 2px 2px;
  border-radius: 8px;
}

/* Lendária oculta dourada — Códice do Equilíbrio Velado */
.tcg-card-frame--legendary-gold {
  --lg-gold-1: #ffe9a8;
  --lg-gold-2: #d4a64b;
  --lg-gold-3: #8a6a28;
  --lg-ink: #1a1206;
  background: linear-gradient(
    165deg,
    #3d2e14 0%,
    #221a0c 38%,
    #120e08 72%,
    #0a0806 100%
  );
  border: 2px solid var(--lg-gold-2);
  box-shadow:
    0 0 0 1px rgba(255, 220, 140, 0.35),
    0 0 18px rgba(212, 166, 75, 0.28),
    inset 0 1px 0 rgba(255, 235, 180, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45);
}

.tcg-card-frame--legendary-gold::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(ellipse 95% 55% at 50% 0%, rgba(255, 210, 100, 0.22), transparent 58%);
  z-index: 0;
}

.tcg-card-frame--legendary-gold > * {
  position: relative;
  z-index: 1;
}

.tcg-card-frame--legendary-gold .tcg-card__banner {
  color: var(--lg-gold-1);
  background: linear-gradient(180deg, #1a1408, #2e2410);
  border-color: rgba(212, 166, 75, 0.55);
  text-shadow: 0 0 12px rgba(255, 200, 80, 0.35);
}

.tcg-card-frame--legendary-gold .tcg-card__mid,
.tcg-card-frame--legendary-gold .tcg-card__raca {
  color: #e8d4a8;
}

.tcg-card-frame--legendary-gold .tcg-card__texto {
  color: #f0e0c0;
  opacity: 0.92;
}

.tcg-card-frame--legendary-gold .tcg-card__art {
  border-color: rgba(212, 166, 75, 0.45);
  box-shadow: inset 0 0 24px rgba(255, 200, 80, 0.12);
}

.tcg-card-frame--legendary-gold .tcg-card__stats {
  border-top-color: rgba(212, 166, 75, 0.35);
}

.tcg-card-frame--legendary-gold .tcg-card__stat-row b {
  color: var(--lg-gold-1);
}

.tcg-card-frame--legendary-gold .tcg-card__scale-marker {
  background: var(--lg-gold-2);
  box-shadow: 0 0 6px rgba(255, 210, 80, 0.65);
}

.hand-card--legendary-gold {
  background: linear-gradient(145deg, #6a5528 0%, #3d3018 35%, #1a1408 100%);
  border-color: #c9a03a;
  box-shadow:
    0 0 0 1px rgba(255, 220, 140, 0.4),
    0 0 22px rgba(212, 166, 75, 0.35),
    0 14px 28px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 240, 200, 0.15);
}

.hand-card--legendary-gold .hand-card__glow {
  background: radial-gradient(circle at 50% 0%, rgba(255, 220, 120, 0.35), transparent 58%);
}

.hand-card--legendary-gold .hand-card__pa-badge {
  color: #ffe9a8;
  border-color: rgba(255, 220, 140, 0.65);
  background: rgba(40, 28, 8, 0.75);
}

.board-minion--legendary-gold .tcg-card-frame--legendary-gold {
  box-shadow:
    0 0 0 1px rgba(255, 220, 140, 0.3),
    0 0 12px rgba(212, 166, 75, 0.22),
    inset 0 1px 0 rgba(255, 235, 180, 0.12);
}

.tcg-card__banner {
  margin: 0 0 3px;
  padding: 3px 4px;
  font-family: var(--font-display);
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.15;
  text-align: center;
  color: #e8dcc4;
  background: linear-gradient(180deg, #050403, #151210);
  border: 1px solid rgba(0, 0, 0, 0.65);
  border-radius: 4px;
}

.tcg-card-frame--compact .tcg-card__banner {
  font-size: 0.44rem;
  padding: 2px 3px;
  margin-bottom: 2px;
}

.tcg-card__art-wrap {
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 3px;
}

.tcg-card-frame--compact .tcg-card__art-wrap {
  margin-bottom: 2px;
}

.tcg-card__art {
  height: 100%;
  min-height: 44px;
  border-radius: 5px;
  overflow: hidden;
  background: linear-gradient(135deg, hsl(var(--card-hue, 38), 40%, 28%), hsl(var(--card-hue, 38), 28%, 10%));
  border: 1px solid rgba(0, 0, 0, 0.45);
}

.tcg-card-frame--compact .tcg-card__art {
  min-height: 34px;
}

.tcg-card__art .portrait-img,
.tcg-card__art .portrait-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tcg-card__mid {
  margin: 0 0 1px;
  padding: 0 2px;
  font-size: 0.48rem;
  text-align: center;
  line-height: 1.15;
  opacity: 0.88;
  color: #c9b896;
}

.tcg-card-frame--compact .tcg-card__mid {
  font-size: 0.4rem;
}

.tcg-card__raca {
  margin: 0 0 2px;
  padding: 0 2px;
  font-size: 0.44rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  opacity: 0.62;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tcg-card-frame--compact .tcg-card__raca {
  font-size: 0.36rem;
  margin-bottom: 1px;
}

.tcg-card__texto {
  margin: 0 0 3px;
  padding: 0 3px;
  font-size: 0.5rem;
  line-height: 1.18;
  opacity: 0.72;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-shrink: 0;
}

.tcg-card-frame--compact .tcg-card__texto {
  -webkit-line-clamp: 3;
  font-size: 0.42rem;
  line-height: 1.1;
}

/* Na mão: retrato não deve ocupar toda a altura e empurrar o texto para fora do cartão */
.hand-card .tcg-card__art-wrap {
  flex: 0 1 auto;
  max-height: 46%;
  min-height: 0;
}

.hand-card .tcg-card__art {
  min-height: 40px;
}

.tcg-card__stats {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px 1px 1px 0;
  border-top: 1px solid rgba(212, 166, 75, 0.12);
}

.tcg-card__stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
  font-size: 0.48rem;
  line-height: 1.1;
}

.tcg-card__stat-row span {
  opacity: 0.72;
  font-weight: 500;
}

.tcg-card__stat-row b {
  font-family: var(--font-display);
  font-weight: 700;
  color: #e8dcc4;
}

.tcg-card-frame--compact .tcg-card__stat-row {
  font-size: 0.4rem;
  gap: 2px;
}

.tcg-card__scale {
  position: absolute;
  top: 22px;
  bottom: 3px;
  right: 1px;
  width: 12px;
  pointer-events: none;
}

.tcg-card-frame--compact .tcg-card__scale {
  top: 18px;
  width: 10px;
}

.tcg-card__scale-nums {
  height: 100%;
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  align-items: flex-end;
}

.tcg-card__scale-num {
  font-size: 0.36rem;
  line-height: 1;
  color: rgba(232, 220, 196, 0.48);
  font-family: var(--font-ui);
  font-weight: 600;
}

.tcg-card-frame--compact .tcg-card__scale-num {
  font-size: 0.3rem;
}

.tcg-card__scale-marker {
  position: absolute;
  left: -2px;
  right: 0;
  height: 2px;
  bottom: var(--tcg-scale-marker, 50%);
  background: linear-gradient(90deg, transparent, #e8c56e, transparent);
  box-shadow: 0 0 5px rgba(232, 197, 110, 0.85);
}

/* ——— Setup: modo local / online ——— */
.mode-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  justify-content: center;
}

.mode-tab {
  padding: 0.4rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  opacity: 0.55;
  border: 1px solid rgba(212, 166, 75, 0.2);
}

.mode-tab--on {
  opacity: 1;
  border-color: var(--gold);
  color: var(--gold);
}

.mode-panel.hidden {
  display: none;
}

.online-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.6;
  margin: 0.65rem 0 0.25rem;
}

.online-input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(212, 166, 75, 0.22);
  background: rgba(0, 0, 0, 0.35);
  color: var(--parchment);
  font-family: var(--font-ui);
}

.online-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.online-actions .btn {
  flex: 1;
  min-width: 140px;
}

.online-status {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  opacity: 0.85;
  min-height: 1.2em;
}

.lobby-box {
  margin-top: 1rem;
  padding: 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
}

.lobby-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.55;
  margin-bottom: 0.35rem;
}

.lobby-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  max-height: 120px;
  overflow-y: auto;
}

.google-slot {
  min-height: 44px;
  margin-bottom: 0.35rem;
}

.online-google-hint {
  font-size: 0.78rem;
  opacity: 0.75;
  line-height: 1.4;
  margin: 0;
}

.hero-plate__raca {
  font-size: 0.58rem;
  opacity: 0.75;
  margin-top: 0.15rem;
  line-height: 1.15;
  color: #c9d4e8;
}

/* Salão de desafios + modais */
.lobby-list-wrap {
  margin-top: 0.5rem;
}

.lobby-subtitle {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.65;
  margin: 0 0 0.5rem;
}

.lobby-player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(52vh, 420px);
  overflow-y: auto;
}

.lobby-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lobby-player-row__meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.lobby-player-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.lobby-tag-you {
  font-weight: 500;
  opacity: 0.65;
  font-size: 0.85rem;
}

.lobby-player-clan {
  font-size: 0.82rem;
  opacity: 0.78;
}

.lobby-field-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.6;
  margin: 0.75rem 0 0.35rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(4, 2, 10, 0.72);
  backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-panel {
  width: min(100%, 420px);
  padding: 1.25rem 1.35rem;
  border-radius: 14px;
  border: 1px solid rgba(212, 166, 75, 0.28);
  background: linear-gradient(165deg, rgba(22, 12, 28, 0.96), rgba(8, 4, 14, 0.98));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.1rem;
  justify-content: flex-end;
}

.modal-actions .btn {
  min-width: 120px;
}

.lobby-connect-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0.35rem;
}

.lobby-connect-row .btn {
  min-width: 200px;
}

/* Mesa redonda 12 lugares (salão HTTP) */
.salon-wrap {
  overflow: visible;
}

.salon-wrap.hidden {
  display: none !important;
}

.salon-table {
  position: relative;
  width: min(100%, min(480px, 96vw));
  aspect-ratio: 1;
  margin: 1.25rem auto;
  padding: 5%;
  box-sizing: border-box;
  border-radius: 50%;
  overflow: visible;
  isolation: isolate;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.6),
    inset 0 0 80px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(180, 140, 60, 0.25);
  background:
    radial-gradient(ellipse 72% 72% at 50% 48%, rgba(8, 6, 14, 0.08) 0%, rgba(4, 2, 8, 0.52) 100%),
    url('../assets/img/salon-mesa-formacao.png') center 42% / 108% no-repeat;
}

.salon-table::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 1;
}

.salon-chair {
  --a: calc((var(--salon-i) * 30deg) - 90deg);
  position: absolute;
  overflow: visible;
  left: 50%;
  top: 50%;
  width: 4.85rem;
  min-height: 3.25rem;
  margin-left: -2.425rem;
  margin-top: -1.625rem;
  padding: 0.28rem 0.35rem;
  transform: rotate(var(--a)) translateY(calc(-1 * min(7rem, 26vmin))) rotate(calc(-1 * var(--a)));
  transform-origin: center center;
  border-radius: 10px;
  border: 1px solid rgba(200, 165, 90, 0.45);
  background: linear-gradient(165deg, rgba(14, 10, 18, 0.9), rgba(6, 4, 10, 0.94));
  color: #f4ecd8;
  font-size: 0.68rem;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  z-index: 2;
}

.salon-chair:hover:not(:disabled) {
  border-color: rgba(230, 195, 120, 0.75);
  box-shadow: 0 0 14px rgba(180, 140, 60, 0.35);
}

.salon-chair:disabled {
  cursor: default;
  opacity: 0.92;
}

.salon-chair--empty {
  opacity: 0.75;
  border-style: dashed;
}

.salon-chair--you {
  border-color: rgba(255, 214, 120, 0.65);
  box-shadow: 0 0 0 1px rgba(255, 200, 80, 0.2);
}

.salon-chair--ready:not(.salon-chair--empty)::after {
  content: '✓';
  font-size: 0.55rem;
  color: #7effff;
}

.salon-chair--turn {
  border-color: rgba(255, 220, 120, 0.95);
  box-shadow: 0 0 18px rgba(255, 200, 80, 0.45);
}

.salon-chair--your-turn {
  animation: salon-turn-pulse 1.4s ease-in-out infinite;
}

@keyframes salon-turn-pulse {
  0%,
  100% {
    box-shadow: 0 0 12px rgba(120, 255, 200, 0.35);
  }
  50% {
    box-shadow: 0 0 22px rgba(120, 255, 200, 0.65);
  }
}

.salon-chair__turn {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.55rem;
  font-weight: 800;
  color: #ffe9a8;
  line-height: 1;
}

.salon-chair__num {
  font-weight: 700;
  opacity: 0.85;
  font-size: 0.62rem;
}

.salon-chair__name {
  font-weight: 600;
  font-size: 0.72rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.salon-chair__meta {
  font-size: 0.58rem;
  opacity: 0.72;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Erros visíveis na mesa (assento / API) */
.salon-hint--error,
#salon-hint.salon-hint--error {
  color: #ffc8c8 !important;
  font-weight: 600;
  border-left: 3px solid rgba(255, 130, 110, 0.9);
  padding-left: 0.65rem;
  margin-top: 0.35rem;
  background: rgba(90, 20, 28, 0.35);
  border-radius: 0 8px 8px 0;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  padding-right: 0.5rem;
}

.salon-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
  justify-content: center;
}

.salon-formation.hidden {
  display: none;
}

.salon-arena-twelve {
  margin-top: 1rem;
  padding: 0.75rem 0.5rem 1rem;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(12, 8, 18, 0.55), rgba(6, 4, 10, 0.75));
  border: 1px solid rgba(200, 165, 90, 0.25);
}

.salon-arena-twelve__title {
  text-align: center;
  margin: 0 0 0.35rem;
}

.salon-arena-ring {
  position: relative;
  width: min(100%, 22rem);
  aspect-ratio: 1;
  margin: 0.5rem auto 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(40, 28, 52, 0.5), rgba(8, 6, 12, 0.85));
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.55);
}

.salon-arena-slot {
  --a: calc((var(--salon-i) * 30deg) - 90deg);
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5.5rem;
  min-height: 4.2rem;
  margin-left: -2.75rem;
  margin-top: -2.1rem;
  padding: 0.35rem 0.4rem;
  transform: rotate(var(--a)) translateY(calc(-1 * min(8.5rem, 32vmin))) rotate(calc(-1 * var(--a)));
  transform-origin: center center;
  border-radius: 10px;
  border: 1px solid rgba(200, 165, 90, 0.4);
  background: linear-gradient(165deg, rgba(18, 12, 24, 0.92), rgba(8, 6, 12, 0.95));
  color: #f4ecd8;
  font-size: 0.65rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  z-index: 2;
}

.salon-arena-slot--turn {
  border-color: rgba(255, 220, 120, 0.95);
  box-shadow: 0 0 16px rgba(255, 200, 80, 0.45);
}

.salon-arena-slot--you {
  border-color: rgba(120, 255, 200, 0.75);
  box-shadow: 0 0 14px rgba(80, 220, 160, 0.35);
}

.salon-arena-slot__seat {
  font-size: 0.58rem;
  opacity: 0.75;
}

.salon-arena-slot__name {
  font-weight: 700;
  font-size: 0.72rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.salon-arena-slot__clan {
  font-size: 0.58rem;
  color: #c8e8ff;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.salon-arena-slot__turn {
  font-size: 0.55rem;
  font-weight: 800;
  color: #ffe9a8;
}

.salon-arena-slot__hp {
  font-size: 0.58rem;
  color: #ffb0b0;
  font-weight: 600;
}

.salon-arena-twelve__attack-btn {
  display: block;
  margin: 0.65rem auto 0;
}

.opening-hand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.65rem;
  margin: 0.75rem 0;
  max-height: min(52vh, 28rem);
  overflow-y: auto;
}

.opening-hand-card {
  position: relative;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.opening-hand-card:hover {
  transform: translateY(-2px);
}

.opening-hand-card--picked {
  border-color: #f0c040;
  box-shadow: 0 0 0 2px rgba(240, 192, 64, 0.35);
}

.salon-target-list {
  list-style: none;
  margin: 0.75rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 50vh;
  overflow-y: auto;
}

.salon-target-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(200, 165, 90, 0.35);
  background: rgba(10, 8, 14, 0.6);
}

.salon-target-row__name {
  font-weight: 600;
}

.salon-arena-slot__npc-win {
  display: block;
  font-size: 0.65rem;
  color: #f0c040;
  margin-top: 2px;
}

.salon-arena-cpu-feed {
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.35rem 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  max-height: 5rem;
  overflow-y: auto;
}

.salon-arena-cpu-feed__line {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: #c8d4e8;
}

.salon-target-row--npc-win {
  border-color: rgba(240, 192, 64, 0.55);
  box-shadow: inset 0 0 0 1px rgba(240, 192, 64, 0.25);
}

.salon-target-row__meta {
  font-size: 0.85rem;
  opacity: 0.85;
  flex: 1 1 100%;
}

.salon-ready-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
}

.modal-panel--wide {
  width: min(100%, 480px);
  max-height: min(90vh, 520px);
  overflow-y: auto;
}

.salon-roster-list {
  margin: 0.65rem 0 0;
  padding-left: 1.15rem;
  font-size: 0.84rem;
  line-height: 1.45;
}

.salon-roster-list li {
  margin-bottom: 0.35rem;
}

/* Modo História — arena a ecrã completo (sem topbar) */
body.story-battle-active .topbar,
body.story-battle-active .app:has(#battle.battle--arena-tcg:not(.hidden)) .topbar {
  display: none !important;
}

body.story-battle-active.battle-active #battle.battle--arena-tcg {
  padding-top: env(safe-area-inset-top, 0px);
}

body.story-battle-active.battle-active #battle.battle--arena-tcg > .story-battle-banner {
  position: relative;
  flex-shrink: 0;
}

/* Banner — batalha da campanha (fluxo normal, não sobrepõe o inimigo) */
.story-battle-banner {
  position: relative;
  flex: 0 0 auto;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem 0.5rem;
  margin: 0;
  padding: 0.4rem 0.65rem 0.4rem 4.75rem;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid rgba(212, 168, 64, 0.45);
  background: linear-gradient(90deg, rgba(18, 12, 32, 0.96), rgba(40, 24, 8, 0.92));
  font-size: 0.74rem;
  line-height: 1.3;
  color: #d8dce8;
  text-align: center;
  pointer-events: auto;
}

.story-battle-banner__back {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.2;
  z-index: 2;
}

.story-battle-banner__tag {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
  color: #c9a84a;
}

.story-battle-banner__mission {
  opacity: 0.9;
}

.story-battle-banner__vs {
  opacity: 0.55;
  font-style: italic;
}

.story-battle-banner__npc {
  color: #f0d080;
  font-weight: 600;
}

.story-battle-banner__sub {
  flex: 0 1 auto;
  max-width: 100%;
  font-size: 0.68rem;
  opacity: 0.75;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .story-battle-banner {
    padding-left: 4.35rem;
    font-size: 0.7rem;
  }

  .story-battle-banner__sub {
    display: none;
  }
}
