/* Arena TCG vertical — dark fantasy sci-fi (referência 1080×1920, responsivo) */
:root {
  --bg-0: #050508;
  --bg-1: #0a0a10;
  --metal: linear-gradient(145deg, #12121a 0%, #060608 40%, #0e1018 100%);
  --enemy: #ff2a3a;
  --enemy-dim: #8b0018;
  --enemy-glow: rgba(255, 42, 58, 0.55);
  --player: #00c8ff;
  --player-deep: #0066ff;
  --player-glow: rgba(0, 200, 255, 0.5);
  --text: #f0f4fc;
  --text-dim: rgba(240, 244, 252, 0.62);
  --slot-bg: rgba(6, 8, 14, 0.92);
  --font-display: "Orbitron", "Outfit", system-ui, sans-serif;
  --font-ui: "Outfit", system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.arena-demo {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: #020203;
  color: var(--text);
  font-family: var(--font-ui);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: var(--safe-top) 0 calc(var(--safe-bottom) + 4px);
}

/* Viewport: proporção 9:16, máx. 1080×1920 */
.arena-shell {
  width: 100%;
  max-width: 1080px;
  min-height: min(100dvh, 1920px);
  max-height: 1920px;
  aspect-ratio: 9 / 16;
  position: relative;
  overflow: hidden;
  background: var(--metal);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 80px rgba(0, 0, 0, 0.85);
}

.arena-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 42, 58, 0.12), transparent 55%),
    radial-gradient(ellipse 80% 45% at 50% 100%, rgba(0, 200, 255, 0.1), transparent 50%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.015) 2px,
      rgba(255, 255, 255, 0.015) 3px
    );
  pointer-events: none;
  z-index: 0;
}

.arena-grid {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: min(100dvh, 1920px);
  padding: clamp(10px, 2.2vw, 18px) clamp(12px, 3vw, 20px) 0;
  padding-bottom: calc(72px + var(--safe-bottom));
  gap: clamp(6px, 1.2vw, 12px);
}

/* —— Zona superior (inimigo) —— */
.hud-enemy {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  gap: 8px 10px;
  align-items: center;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 42, 58, 0.22);
  box-shadow: 0 8px 32px rgba(255, 42, 58, 0.08);
}

.hud-enemy__chrome {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hud-icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 0 14px rgba(255, 42, 58, 0.15);
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}

.hud-icon-btn:active {
  transform: scale(0.96);
}

.hud-icon-btn--enemy {
  border-color: rgba(255, 42, 58, 0.35);
}

.hud-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--enemy);
  box-shadow:
    0 0 16px var(--enemy-glow),
    inset 0 0 12px rgba(0, 0, 0, 0.6);
  background: radial-gradient(circle at 30% 25%, #3a2528, #120808);
  flex-shrink: 0;
}

.hud-nameplate {
  clip-path: polygon(6% 0, 94% 0, 100% 100%, 0 100%);
  padding: 0.45rem 1.25rem 0.5rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.65rem, 2.8vw, 0.82rem);
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 12px var(--enemy-glow);
  background: linear-gradient(180deg, rgba(80, 10, 20, 0.95), rgba(20, 4, 8, 0.98));
  border: 1px solid rgba(255, 42, 58, 0.45);
  box-shadow: 0 0 20px rgba(255, 42, 58, 0.25);
}

.hud-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 14px;
  grid-column: 2 / -1;
  grid-row: 2;
}

@media (min-width: 400px) {
  .hud-stats {
    grid-column: 3;
    grid-row: 1 / span 2;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
  }
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: clamp(0.72rem, 2.6vw, 0.85rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.stat-pill--enemy svg {
  filter: drop-shadow(0 0 6px var(--enemy-glow));
}

.stat-pill--player svg {
  filter: drop-shadow(0 0 6px var(--player-glow));
}

/* Prémios inimigo */
.prize-row {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: clamp(8px, 2vw, 12px);
  padding: 4px 0;
}

.prize-card {
  width: clamp(44px, 11vw, 56px);
  height: clamp(60px, 15vw, 76px);
  border-radius: 8px;
  border: 2px solid transparent;
  background: linear-gradient(160deg, #1a1014, #08060a);
  position: relative;
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 4px 16px rgba(0, 0, 0, 0.5);
}

.prize-card--enemy {
  border-color: rgba(255, 42, 58, 0.65);
  box-shadow:
    0 0 18px rgba(255, 42, 58, 0.35),
    inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.prize-card--enemy::after {
  content: "✦";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: rgba(255, 100, 110, 0.45);
  text-shadow: 0 0 10px var(--enemy-glow);
}

.prize-card--player {
  border-color: rgba(0, 200, 255, 0.65);
  box-shadow:
    0 0 18px rgba(0, 200, 255, 0.3),
    inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.prize-card--player::after {
  content: "✦";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: rgba(100, 210, 255, 0.45);
  text-shadow: 0 0 10px var(--player-glow);
}

.zone-label {
  font-family: var(--font-display);
  font-size: clamp(0.52rem, 2vw, 0.62rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
  margin: 2px 0 0;
}

/* Zona de batalha */
.battle-zone {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(20px, 6.5%);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "c0 c1 c2 c3 dis";
  gap: clamp(2px, 0.7vw, 5px);
  min-height: clamp(76px, 13vh, 112px);
  max-height: clamp(88px, 15vh, 124px);
  padding: 4px 1px;
  overflow: hidden;
}

.battle-zone--enemy {
  border-top: 1px solid rgba(255, 42, 58, 0.15);
  border-bottom: 1px solid rgba(255, 42, 58, 0.12);
}

.battle-zone--player {
  border-top: 1px solid rgba(0, 200, 255, 0.15);
  border-bottom: 1px solid rgba(0, 200, 255, 0.12);
}

.slot-label {
  font-size: 0.5rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
}

.slot {
  flex: 1;
  min-height: 72px;
  border-radius: 10px;
  background: var(--slot-bg);
  border: 2px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
}

.slot--enemy {
  border-color: rgba(255, 42, 58, 0.45);
  box-shadow:
    0 0 16px rgba(255, 42, 58, 0.12),
    inset 0 0 24px rgba(0, 0, 0, 0.45);
}

.slot--player {
  border-color: rgba(0, 200, 255, 0.45);
  box-shadow:
    0 0 16px rgba(0, 200, 255, 0.12),
    inset 0 0 24px rgba(0, 0, 0, 0.45);
}

.slot--creature {
  min-height: clamp(52px, 11vh, 82px);
  min-width: 0;
}

.slot-c0 {
  grid-area: c0;
}

.slot-c1 {
  grid-area: c1;
}

.slot-c2 {
  grid-area: c2;
}

.slot--active.slot--enemy {
  box-shadow:
    0 0 28px rgba(255, 42, 58, 0.22),
    inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.slot--active.slot--player {
  box-shadow:
    0 0 28px rgba(0, 200, 255, 0.2),
    inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.slot__glyph {
  width: 36%;
  max-width: 48px;
  aspect-ratio: 1;
  opacity: 0.22;
  border: 2px solid currentColor;
  border-radius: 50%;
  position: relative;
}

.slot--enemy .slot__glyph {
  color: var(--enemy);
}

.slot--player .slot__glyph {
  color: var(--player);
}

.slot__glyph::before,
.slot__glyph::after {
  content: "";
  position: absolute;
  background: currentColor;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.slot__glyph::before {
  width: 2px;
  height: 70%;
}

.slot__glyph::after {
  width: 70%;
  height: 2px;
}

.slot__tag {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 0.48rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}

.slot-discard {
  grid-area: dis;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.slot-discard .slot {
  width: 100%;
  flex: 1;
  min-height: 0;
}

.slot-a1,
.slot-c0 {
  grid-area: c0;
}

.slot-a2,
.slot-c1 {
  grid-area: c1;
}

.slot-c2 {
  grid-area: c2;
}

.slot-c3 {
  grid-area: c3;
}

/* Hex fase central */
.phase-wrap {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 0 10px;
  gap: 6px;
}

.phase-hex {
  width: clamp(88px, 24vw, 118px);
  height: clamp(88px, 24vw, 118px);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.48rem, 2.2vw, 0.58rem);
  letter-spacing: 0.08em;
  line-height: 1.15;
  text-align: center;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.35);
  background: conic-gradient(from 180deg at 50% 50%, rgba(90, 12, 24, 0.95), rgba(8, 20, 40, 0.95), rgba(90, 12, 24, 0.95));
  box-shadow:
    0 0 28px rgba(255, 42, 58, 0.45),
    0 0 36px rgba(0, 200, 255, 0.35),
    inset 0 0 0 2px rgba(255, 255, 255, 0.12);
  animation: hex-pulse 2.8s ease-in-out infinite;
  transition: transform 0.15s ease;
}

.phase-hex:active {
  transform: scale(0.97);
}

.phase-hex svg {
  width: clamp(26px, 8vw, 34px);
  height: clamp(26px, 8vw, 34px);
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.4));
}

@keyframes hex-pulse {
  0%,
  100% {
    box-shadow:
      0 0 22px rgba(255, 42, 58, 0.35),
      0 0 28px rgba(0, 200, 255, 0.28),
      inset 0 0 0 2px rgba(255, 255, 255, 0.1);
  }
  50% {
    box-shadow:
      0 0 36px rgba(255, 42, 58, 0.55),
      0 0 42px rgba(0, 200, 255, 0.45),
      inset 0 0 0 2px rgba(255, 255, 255, 0.16);
  }
}

/* HUD jogador */
.hud-player {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  gap: 8px 10px;
  align-items: center;
  padding-top: 4px;
  padding-bottom: 2px;
  border-top: none;
  border-bottom: 1px solid rgba(0, 200, 255, 0.2);
  box-shadow: 0 10px 28px rgba(0, 200, 255, 0.07);
}

.hud-player .hud-avatar {
  border-color: var(--player);
  box-shadow:
    0 0 16px var(--player-glow),
    inset 0 0 12px rgba(0, 0, 0, 0.6);
  background: radial-gradient(circle at 30% 25%, #182838, #060a12);
}

.hud-nameplate--player {
  clip-path: polygon(6% 0, 94% 0, 100% 100%, 0 100%);
  padding: 0.45rem 1.25rem 0.5rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.65rem, 2.8vw, 0.82rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  color: #fff;
  text-shadow: 0 0 12px var(--player-glow);
  background: linear-gradient(180deg, rgba(0, 40, 72, 0.95), rgba(4, 8, 20, 0.98));
  border: 1px solid rgba(0, 200, 255, 0.45);
  box-shadow: 0 0 20px rgba(0, 200, 255, 0.22);
}

.hud-icon-btn--player {
  border-color: rgba(0, 200, 255, 0.35);
  box-shadow: 0 0 14px rgba(0, 200, 255, 0.12);
}

/* Mão */
.hand-section {
  flex: 0 0 auto;
  padding: 8px 0 6px;
}

.hand-section__title {
  font-family: var(--font-display);
  font-size: clamp(0.55rem, 2vw, 0.65rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hand-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 8px 4px 14px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.hand-card-demo {
  flex: 0 0 auto;
  width: clamp(100px, 26vw, 132px);
  height: clamp(142px, 36vw, 186px);
  scroll-snap-align: center;
  border-radius: 10px;
  padding: 3px;
  background: linear-gradient(145deg, rgba(0, 120, 200, 0.5), rgba(20, 20, 30, 0.95));
  border: 1px solid rgba(0, 200, 255, 0.5);
  box-shadow:
    0 0 20px rgba(0, 200, 255, 0.2),
    0 12px 28px rgba(0, 0, 0, 0.55);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 2px;
  font-size: 0.52rem;
}

.hand-card-demo__cost {
  justify-self: start;
  min-width: 1.65rem;
  height: 1.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-family: var(--font-display);
  color: #0a1620;
  background: radial-gradient(circle at 35% 30%, #8ef, #06a);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 10px var(--player-glow);
}

.hand-card-demo__art {
  border-radius: 4px;
  background: linear-gradient(160deg, #1a2840, #0a0e18);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 0;
}

.hand-card-demo__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.5rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(230, 240, 255, 0.95);
  line-height: 1.2;
}

.hand-card-demo__stats {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  padding: 2px 4px 4px;
}

.hand-card-demo__stats span {
  min-width: 1.5rem;
  text-align: center;
  font-weight: 800;
  font-size: 0.55rem;
  border-radius: 4px;
  padding: 2px 4px;
}

.hand-card-demo__stats span:first-child {
  background: linear-gradient(180deg, #c84, #831);
  color: #fff;
}

.hand-card-demo__stats span:last-child {
  background: linear-gradient(180deg, #f44, #801);
  color: #fff;
}

/* Dock fixo */
.dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 1080px;
  z-index: 50;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  padding: 10px clamp(12px, 3vw, 20px) calc(10px + var(--safe-bottom));
  min-height: calc(56px + var(--safe-bottom));
  background: linear-gradient(0deg, rgba(4, 4, 10, 0.98), rgba(12, 12, 22, 0.92));
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.65);
}

.dock__btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(0.48rem, 2vw, 0.55rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}

.dock__btn:active {
  transform: scale(0.97);
}

.dock__btn--phase {
  flex: 1.25 1 0;
  border-color: rgba(0, 200, 255, 0.55);
  background: linear-gradient(165deg, rgba(0, 60, 120, 0.55), rgba(6, 8, 20, 0.95));
  box-shadow:
    0 0 22px rgba(0, 200, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.dock__btn svg {
  opacity: 0.92;
}

/* Spacer flex para empurrar conteúdo */
.flex-spacer {
  flex: 0 0 4px;
}

/* ========= Integração no jogo principal (index.html) ========= */
#battle.battle--arena-tcg {
  --tcg-neon-enemy: rgba(255, 42, 58, 0.55);
  --tcg-neon-player: rgba(0, 200, 255, 0.48);
}

#battle.battle--arena-tcg .battle-backdrop::after {
  background:
    radial-gradient(ellipse 90% 45% at 50% 0%, rgba(255, 42, 58, 0.14), transparent 52%),
    radial-gradient(ellipse 90% 42% at 50% 100%, rgba(0, 200, 255, 0.12), transparent 48%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(8, 4, 14, 0.38) 50%, rgba(0, 0, 0, 0.62) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.42) 0%, transparent 50%, rgba(0, 0, 0, 0.28) 100%);
}

/*
 * Arena vertical (como mobile-arena-tcg.html): coluna única.
 * Ordem: HUD inimigo → prémios → campo inimigo → mão inimigo → fase (VS) →
 * HUD jogador → campo jogador → prémios → mão (secção).
 */
#battle.battle--arena-tcg .battle-layout {
  width: 100%;
  max-width: min(1080px, 100%);
  margin-left: auto;
  margin-right: auto;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  min-height: 0;
  position: relative;
  z-index: 3;
}

#battle.battle--arena-tcg .battle-field.arena-tcg-field {
  border-radius: 0;
  position: relative;
  z-index: 6;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows:
    auto
    auto
    auto
    minmax(86px, 1.08fr)
    auto
    auto
    auto
    auto
    minmax(96px, 1.2fr)
    auto
    minmax(min-content, auto);
  grid-template-areas:
    "p2status"
    "p2prizes"
    "p2fieldpack"
    "p2hand"
    "vs"
    "p1status"
    "p1fieldpack"
    "p1prizes"
    "p1hand";
  gap: clamp(6px, 1.2vw, 12px);
  min-height: 0;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  padding: clamp(8px, 2vw, 16px) max(12px, env(safe-area-inset-left)) 0 max(12px, env(safe-area-inset-right));
  align-content: stretch;
}

#battle.battle--arena-tcg .arena-tcg-prize-block--enemy {
  grid-area: p2prizes;
}

#battle.battle--arena-tcg .arena-tcg-prize-block--player {
  grid-area: p1prizes;
}

#battle.battle--arena-tcg .arena-tcg-prize-block--enemy .prize-row,
#battle.battle--arena-tcg .arena-tcg-prize-block--player .prize-row {
  margin: 0;
}

#battle.battle--arena-tcg .arena-tcg-field-pack--enemy {
  grid-area: p2fieldpack;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  width: 100%;
}

#battle.battle--arena-tcg .arena-tcg-field-pack--player {
  grid-area: p1fieldpack;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  width: 100%;
}

#battle.battle--arena-tcg #battle-phase-wrap {
  grid-area: vs;
}

#battle.battle--arena-tcg #battle-phase-wrap.phase-wrap {
  padding: 4px 0 8px;
}

#battle.battle--arena-tcg #battle-phase-wrap .battle-vs {
  margin: 0 auto;
}

/* Campo real: flex em coluna (não a grelha de slots do demo .battle-zone vazio). */
#battle.battle--arena-tcg #zone-p1.band-center.battle-zone,
#battle.battle--arena-tcg #zone-p2.band-center.battle-zone,
#battle.battle--arena-tcg .battle-zone--fantasia {
  display: flex !important;
  flex-direction: column !important;
  grid-template-columns: unset !important;
  grid-template-rows: unset !important;
  grid-template-areas: unset !important;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

#battle.battle--arena-tcg #player-status-p2 {
  grid-area: ehud;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.14rem;
  overflow: visible;
  max-width: 100%;
  padding: 0.12rem 0.22rem 0.16rem;
}

#battle.battle--arena-tcg #zone-p2 {
  overflow: visible;
  max-height: none;
  min-height: 0;
  width: 100%;
  max-width: 100%;
}

#battle.battle--arena-tcg #hand-column-p2 {
  grid-area: p2hand;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  align-self: stretch;
  background: linear-gradient(180deg, rgba(32, 10, 16, 0.55), rgba(10, 6, 12, 0.85));
  border-top: 1px solid rgba(255, 72, 64, 0.22);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#battle.battle--arena-tcg .hand-column--enemy .hand-column__chrome {
  max-height: none;
  justify-content: center;
  padding: 0.12rem 0.15rem;
}

#battle.battle--arena-tcg .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.1rem 0.12rem;
  gap: 0.14rem;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

#battle.battle--arena-tcg #zone-p1 {
  overflow: visible;
  max-height: none;
  min-height: 0;
}

#battle.battle--arena-tcg .band-center.combatant--me {
  overflow: visible;
  max-height: none;
  min-height: 0;
}

#battle.battle--arena-tcg #hand-column-p1 {
  grid-area: p1hand;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  align-self: stretch;
  position: relative;
  z-index: 4;
  background: linear-gradient(180deg, rgba(12, 18, 36, 0.55), rgba(4, 6, 14, 0.82));
  border-top: 1px solid rgba(0, 160, 255, 0.22);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#battle.battle--arena-tcg #hand-column-p1.hand-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
}

#battle.battle--arena-tcg #hand-column-p1 .hand-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overscroll-behavior-x: contain;
}

#battle.battle--arena-tcg #hand-column-p1 .hand-column__chrome {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  min-width: 100%;
  max-width: none;
  max-height: none;
  min-height: 0;
}

#battle.battle--arena-tcg #hand-mine-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#battle.battle--arena-tcg #player-status-p1 {
  grid-area: phud;
}

#battle.battle--arena-tcg .band-center.combatant--enemy {
  overflow: visible;
  max-height: none;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  border-bottom-color: rgba(255, 42, 58, 0.28);
  box-shadow: 0 10px 36px rgba(255, 42, 58, 0.06);
}

#battle.battle--arena-tcg .hand-column--me .hand-column__chrome {
  max-height: none;
  min-height: 0;
}

#battle.battle--arena-tcg #player-status-p2.hud-enemy {
  border-bottom: 1px solid rgba(255, 42, 58, 0.22);
  box-shadow: 0 8px 32px rgba(255, 42, 58, 0.08);
}

#battle.battle--arena-tcg #player-status-p1.hud-player {
  border-bottom: 1px solid rgba(0, 200, 255, 0.2);
  box-shadow: 0 10px 28px rgba(0, 200, 255, 0.07);
  padding-top: 0.18rem;
}

#battle.battle--arena-tcg #hand-column-p1 .hand-section__title {
  padding: 0 2px;
}

/* game.css (≤640px) define grid-area em #zone-p1/2 para o template antigo; aqui usamos packs. */
#battle.battle--arena-tcg #zone-p1,
#battle.battle--arena-tcg #zone-p2 {
  grid-area: unset !important;
}

#battle.battle--arena-tcg .side-rail {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  justify-content: center;
  gap: 0.28rem 0.45rem;
  max-height: none;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  position: relative;
  z-index: 1;
  border-left: none;
  border-top: 1px solid rgba(0, 200, 255, 0.14);
  padding: 0.4rem max(14px, env(safe-area-inset-right)) 0.45rem max(14px, env(safe-area-inset-left));
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, rgba(8, 6, 16, 0.92), rgba(4, 4, 10, 0.96));
}

#battle.battle--arena-tcg .rail-turn {
  flex: 1 1 38%;
  min-width: 0;
  font-family: "Orbitron", var(--font-display, Georgia), serif;
  color: #e8f4ff;
  text-shadow: 0 0 12px rgba(0, 200, 255, 0.35);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#battle.battle--arena-tcg .rail-phase {
  flex: 1 1 38%;
  min-width: 0;
  color: rgba(232, 244, 255, 0.88);
}

#battle.battle--arena-tcg .rail-controls {
  flex: 1 1 100%;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
}

/* Registro: não ocupar o rail (evita sobrepor cartas); só ao abrir — painel flutuante */
#battle.battle--arena-tcg .log-panel {
  display: none !important;
  flex: 0 0 auto !important;
  margin: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  border: none !important;
}

#battle.battle--arena-tcg .battle-layout--log-open .log-panel {
  display: flex !important;
  flex-direction: column;
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  max-height: min(42vh, 320px);
  width: auto;
  z-index: 130;
  margin-top: 0 !important;
  padding: 0.4rem 0.45rem 0.45rem !important;
  border-radius: 12px;
  border: 1px solid rgba(0, 200, 255, 0.38) !important;
  background: rgba(4, 6, 14, 0.98) !important;
  box-shadow:
    0 0 28px rgba(0, 174, 239, 0.22),
    0 12px 40px rgba(0, 0, 0, 0.65);
  overflow: hidden !important;
}

#battle.battle--arena-tcg .battle-layout--log-open .log {
  max-height: min(34vh, 260px);
}

#battle.battle--arena-tcg .hand--column {
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-end;
  align-content: flex-end;
  gap: var(--battle-card-gap, 12px);
  min-height: 88px;
  max-height: min(112px, 20vh);
  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;
}

#battle.battle--arena-tcg .hand--column .hand-card {
  flex: 0 0 auto;
  scroll-snap-align: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 200, 255, 0.15);
}

@media (min-width: 641px) {
  #battle.battle--arena-tcg .hand--column {
    min-height: 92px;
    max-height: min(160px, 22vh);
  }

  #battle.battle--arena-tcg .hand-card {
    width: clamp(56px, 7.5vw, 76px);
    height: clamp(80px, 10.5vw, 108px);
  }
}

#battle.battle--arena-tcg .player-status__banner {
  font-family: "Orbitron", var(--font-ui, system-ui), sans-serif;
  letter-spacing: 0.12em;
}

#battle.battle--arena-tcg .player-status--enemy .player-status__banner {
  text-shadow: 0 0 14px var(--tcg-neon-enemy);
  border-bottom-color: rgba(255, 42, 58, 0.55);
}

#battle.battle--arena-tcg .player-status--me .player-status__banner {
  text-shadow: 0 0 14px var(--tcg-neon-player);
  border-bottom-color: rgba(0, 200, 255, 0.5);
}

#battle.battle--arena-tcg .band-center.combatant--me {
  border-top-color: rgba(0, 200, 255, 0.28);
  box-shadow: 0 -10px 36px rgba(0, 200, 255, 0.06);
}

#battle.battle--arena-tcg .battle-footer {
  background: linear-gradient(0deg, rgba(4, 4, 10, 0.95), rgba(10, 8, 18, 0.75));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

body.battle-active #battle.battle--arena-tcg .battle-footer {
  margin-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
}

/* Dock fixo em todos os tamanhos (igual referência mobile); faixa de fase sobe para não ficar por baixo */
body.battle-active #battle.battle--arena-tcg:not(.hidden) .arena-action-bar {
  display: flex;
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(62px + env(safe-area-inset-bottom, 0px));
  z-index: 210;
  max-width: min(1080px, 100%);
  margin: 0 auto;
  width: 100%;
  padding: 0.35rem max(12px, env(safe-area-inset-left)) 0.4rem max(12px, env(safe-area-inset-right));
  justify-content: center;
  gap: 0.45rem;
  pointer-events: none;
  box-sizing: border-box;
}

body.battle-active #battle.battle--arena-tcg:not(.hidden) .arena-action-bar[hidden] {
  display: none !important;
}

body.battle-active #battle.battle--arena-tcg:not(.hidden) .arena-action-bar .arena-action-bar__btn {
  pointer-events: auto;
  min-height: 54px;
  min-width: min(100%, 280px);
  max-width: min(92vw, 420px);
}

body.battle-active #battle.battle--arena-tcg #battle-mobile-dock {
  display: flex !important;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  flex-direction: row;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.35rem;
  max-width: min(1080px, 100%);
  margin: 0 auto;
  width: 100%;
  padding: 0.4rem max(12px, env(safe-area-inset-right)) calc(0.4rem + env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-left));
  min-height: calc(52px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(0deg, rgba(4, 4, 10, 0.98), rgba(12, 12, 22, 0.92));
  border-top: 1px solid rgba(0, 200, 255, 0.2);
  box-shadow:
    0 -12px 40px rgba(0, 0, 0, 0.65),
    0 0 24px rgba(0, 200, 255, 0.06);
}

body.battle-active #battle.battle--arena-tcg .battle-mobile-dock__btn,
body.battle-active #battle.battle--arena-tcg .dock__btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 52px;
  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, 244, 255, 0.92);
  font-family: "Orbitron", var(--font-display, system-ui), sans-serif;
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
}

body.battle-active #battle.battle--arena-tcg .battle-mobile-dock__btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

body.battle-active #battle.battle--arena-tcg .battle-mobile-dock__btn--phase,
body.battle-active #battle.battle--arena-tcg .dock__btn--phase,
body.battle-active #battle.battle--arena-tcg .dock__btn--primary {
  flex: 1.35 1 0;
  border-color: rgba(0, 200, 255, 0.55);
  color: #dff6ff;
  background: linear-gradient(165deg, rgba(0, 60, 120, 0.55), rgba(6, 8, 20, 0.95));
  box-shadow:
    0 0 22px rgba(0, 200, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.battle-active #battle.battle--arena-tcg .battle-mobile-dock__btn--phase:disabled {
  opacity: 0.38;
}

@media (min-width: 961px) {
  #battle.battle--arena-tcg .battle-layout {
    padding: 0 clamp(0.5rem, 2vw, 1.25rem);
  }
}

/* —— Arena TCG no jogo: tema forte (sobrepõe ouro / pergaminho do game.css) —— */
body.battle-active #battle.battle--arena-tcg {
  color: var(--text);
  background: linear-gradient(145deg, #12121a 0%, #060608 42%, #0e1018 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 80px rgba(0, 0, 0, 0.72),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    inset 0 0 120px rgba(0, 0, 0, 0.55);
  max-width: min(1080px, 100%);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

body.battle-active .app:has(#battle.battle--arena-tcg:not(.hidden)) .topbar {
  background: linear-gradient(180deg, rgba(6, 8, 18, 0.92), rgba(4, 4, 10, 0.78));
  border-bottom: 1px solid rgba(0, 200, 255, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

#battle.battle--arena-tcg .battle-backdrop__layer {
  filter: saturate(1.08) contrast(1.05);
}

#battle.battle--arena-tcg .battle-vs__strip {
  color: rgba(220, 240, 255, 0.88);
  text-shadow: 0 0 14px rgba(0, 200, 255, 0.25);
  font-family: var(--font-display);
  letter-spacing: 0.12em;
}

#battle.battle--arena-tcg .battle-vs__text,
#battle.battle--arena-tcg .battle-vs__badge.battle-vs__text {
  color: #dff6ff;
  border-color: rgba(0, 200, 255, 0.55);
  background: radial-gradient(circle at 35% 28%, rgba(0, 40, 80, 0.55), rgba(4, 6, 14, 0.98));
  box-shadow:
    0 0 28px rgba(0, 200, 255, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  text-shadow: 0 0 16px rgba(0, 200, 255, 0.45);
}

#battle.battle--arena-tcg .log-title {
  color: rgba(240, 248, 255, 0.55);
  border-bottom-color: rgba(0, 200, 255, 0.12);
}

#battle.battle--arena-tcg .log {
  color: rgba(230, 240, 252, 0.88);
}

#battle.battle--arena-tcg .phase-track__step {
  color: rgba(220, 235, 255, 0.55);
  border-color: rgba(255, 255, 255, 0.08);
}

#battle.battle--arena-tcg .phase-track__step--on {
  color: #b8f0ff;
  border-color: rgba(0, 200, 255, 0.55);
  box-shadow: 0 0 16px rgba(0, 200, 255, 0.28);
  background: linear-gradient(180deg, rgba(0, 50, 90, 0.55), rgba(8, 12, 28, 0.85));
}

#battle.battle--arena-tcg .hand-card {
  background: linear-gradient(145deg, #1a2230 0%, #0c0e16 45%, #050508 100%);
  border-color: rgba(0, 200, 255, 0.35);
  box-shadow:
    0 0 0 1px rgba(0, 200, 255, 0.12),
    0 14px 28px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#battle.battle--arena-tcg .hand-card.criatura {
  border-color: rgba(0, 200, 255, 0.45);
}

#battle.battle--arena-tcg .hand-card.ativador {
  border-color: rgba(120, 140, 255, 0.55);
}

#battle.battle--arena-tcg .hand-card.artefato {
  border-color: rgba(180, 190, 210, 0.45);
}

#battle.battle--arena-tcg .crystal {
  border-color: rgba(0, 200, 255, 0.35);
  background: linear-gradient(180deg, #2a5080, #0a1830);
}

#battle.battle--arena-tcg .crystal--full {
  filter: drop-shadow(0 0 10px rgba(0, 200, 255, 0.55));
}

@media (max-width: 640px) {
  body.battle-active #battle.battle--arena-tcg .battle-mobile-dock {
    background: linear-gradient(0deg, rgba(4, 4, 10, 0.98), rgba(10, 12, 22, 0.94));
    border-top-color: rgba(0, 200, 255, 0.18);
    box-shadow:
      0 -12px 40px rgba(0, 0, 0, 0.65),
      0 0 24px rgba(0, 200, 255, 0.06);
  }

  body.battle-active #battle.battle--arena-tcg .battle-mobile-dock__btn {
    font-family: var(--font-display);
    color: rgba(232, 244, 255, 0.92);
    border-color: rgba(255, 255, 255, 0.1);
  }

  body.battle-active #battle.battle--arena-tcg .battle-mobile-dock__btn--phase {
    border-color: rgba(0, 200, 255, 0.55);
    background: linear-gradient(165deg, rgba(0, 60, 120, 0.55), rgba(6, 8, 20, 0.95));
    box-shadow:
      0 0 22px rgba(0, 200, 255, 0.35),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
}

/* ========= Fluxo mesa: home + setup (mesmo vocabulário visual da arena TCG) ========= */

.home-screen.home-screen--arena-tcg {
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(4, 4, 12, 0.94) 0%, rgba(8, 6, 20, 0.88) 48%, rgba(2, 3, 10, 0.96) 100%),
    url("../assets/brand/home-fenda-fundo.png") center / cover no-repeat fixed;
}

.home-screen.home-screen--arena-tcg::before {
  background:
    radial-gradient(ellipse 85% 55% at 50% 0%, rgba(255, 42, 58, 0.22), transparent 58%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(0, 200, 255, 0.16), transparent 55%),
    radial-gradient(ellipse 70% 45% at 50% 45%, rgba(0, 120, 200, 0.08), transparent 60%);
}

.home-screen.home-screen--arena-tcg .home-screen__inner {
  gap: 1.5rem;
  max-width: min(640px, 100%);
}

.home-screen.home-screen--arena-tcg .home-screen__logo {
  filter:
    drop-shadow(0 0 28px rgba(0, 200, 255, 0.28))
    drop-shadow(0 0 40px rgba(255, 42, 58, 0.14))
    drop-shadow(0 18px 48px rgba(0, 0, 0, 0.75));
  animation: tcg-home-logo 6s ease-in-out infinite;
}

.home-screen.home-screen--arena-tcg .home-screen__tagline {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: clamp(0.72rem, 2.6vw, 0.88rem);
  color: rgba(220, 240, 255, 0.88);
  text-shadow:
    0 0 20px rgba(0, 200, 255, 0.35),
    0 2px 12px rgba(0, 0, 0, 0.75);
}

.home-screen.home-screen--arena-tcg .home-screen__nav a {
  color: rgba(200, 230, 255, 0.78);
  border-bottom-color: rgba(0, 200, 255, 0.4);
  font-weight: 600;
  letter-spacing: 0.06em;
}

.home-screen.home-screen--arena-tcg .home-screen__nav a:hover {
  color: #dff6ff;
  border-bottom-color: rgba(0, 240, 255, 0.85);
  text-shadow: 0 0 12px rgba(0, 200, 255, 0.45);
}

.home-screen.home-screen--arena-tcg .home-screen__cta.btn-gold {
  background: linear-gradient(165deg, #00b4f0 0%, #0060c0 48%, #002060 100%);
  color: #f0fbff;
  border: 1px solid rgba(0, 220, 255, 0.5);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow:
    0 0 32px rgba(0, 200, 255, 0.35),
    0 8px 28px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  animation: tcg-cta-pulse 2.8s ease-in-out infinite;
}

.home-screen.home-screen--arena-tcg .home-screen__cta.btn-gold:hover {
  filter: brightness(1.12);
}

.home-screen.home-screen--arena-tcg .home-screen__auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  width: min(22rem, 100%);
}

.home-screen.home-screen--arena-tcg .home-screen__auth-lead {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: center;
  color: rgba(200, 220, 245, 0.88);
}

.home-screen.home-screen--arena-tcg .google-signin-slot--home {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.home-screen.home-screen--arena-tcg .home-screen__guest {
  font-size: 0.78rem;
  opacity: 0.85;
}

.home-screen.home-screen--arena-tcg .home-screen__logged {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  width: min(22rem, 100%);
}

.home-screen.home-screen--arena-tcg .home-screen__welcome {
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
  color: rgba(220, 235, 255, 0.92);
}

.home-screen.home-screen--arena-tcg .home-level {
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 200, 255, 0.22);
  background: rgba(0, 0, 0, 0.35);
}

.home-screen.home-screen--arena-tcg .home-level__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.home-screen.home-screen--arena-tcg .home-level__lvl {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: rgba(255, 220, 150, 0.98);
}

.home-screen.home-screen--arena-tcg .home-level__next {
  font-size: 0.72rem;
  color: rgba(180, 200, 230, 0.8);
}

.home-screen.home-screen--arena-tcg .home-level__track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.home-screen.home-screen--arena-tcg .home-level__fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #0060c0, #00d4ff);
  box-shadow: 0 0 12px rgba(0, 200, 255, 0.45);
  transition: width 0.35s ease;
}

.home-screen.home-screen--arena-tcg .home-level__hint {
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: rgba(170, 190, 220, 0.85);
}

.home-screen.home-screen--arena-tcg .home-screen__account-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
  margin-bottom: 0.55rem;
}

.home-screen.home-screen--arena-tcg .home-screen__account-actions .btn {
  width: 100%;
  justify-content: center;
}

.home-screen.home-screen--arena-tcg .home-screen__logged-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
}

.home-screen.home-screen--arena-tcg .home-screen__logged-actions .btn-ghost {
  border-color: rgba(0, 200, 255, 0.35);
  color: rgba(210, 235, 255, 0.92);
}

/* Topbar fixa na home com sessão Google (Perfil + Meu Deck) */
body.home-logged-topbar:not(.battle-active) .topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 120;
}

body.home-logged-topbar #home .home-screen__inner {
  padding-top: 3.25rem;
}

.setup.setup--arena-tcg {
  min-height: min(100dvh, 100vh);
  background: linear-gradient(180deg, #020208 0%, #0a0818 35%, #05050c 100%);
}

.setup.setup--arena-tcg .setup-frame {
  position: relative;
  width: min(560px, 100%);
  border-radius: clamp(14px, 3vw, 22px);
  border: 1px solid rgba(0, 200, 255, 0.28);
  background: linear-gradient(155deg, rgba(22, 18, 38, 0.97), rgba(6, 6, 14, 0.99));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 28px 90px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 80px rgba(0, 200, 255, 0.08);
}

.setup.setup--arena-tcg .setup-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 40% at 50% 0%, rgba(255, 42, 58, 0.1), transparent 55%),
    radial-gradient(ellipse 85% 45% at 50% 100%, rgba(0, 200, 255, 0.08), transparent 52%);
  z-index: 0;
}

.setup.setup--arena-tcg .setup-frame > * {
  position: relative;
  z-index: 1;
}

.setup.setup--arena-tcg .setup-title {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  color: #e8f8ff;
  text-shadow: 0 0 24px rgba(0, 200, 255, 0.35);
}

.setup.setup--arena-tcg .mode-tab {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  color: rgba(200, 220, 255, 0.55);
}

.setup.setup--arena-tcg .mode-tab--on {
  opacity: 1;
  color: #dff6ff;
  border-color: rgba(0, 200, 255, 0.55);
  background: linear-gradient(165deg, rgba(0, 70, 130, 0.45), rgba(8, 10, 24, 0.95));
  box-shadow: 0 0 20px rgba(0, 200, 255, 0.25);
}

.setup.setup--arena-tcg .setup-block label,
.setup.setup--arena-tcg .online-label {
  color: rgba(200, 215, 240, 0.72);
  opacity: 1;
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
}

.setup.setup--arena-tcg .setup-block select,
.setup.setup--arena-tcg .online-input {
  border-radius: 10px;
  border: 1px solid rgba(0, 200, 255, 0.22);
  background: rgba(4, 6, 14, 0.85);
  color: rgba(232, 244, 255, 0.95);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.35);
}

.setup.setup--arena-tcg .setup-block select:focus,
.setup.setup--arena-tcg .online-input:focus {
  outline: none;
  border-color: rgba(0, 220, 255, 0.55);
  box-shadow:
    inset 0 0 20px rgba(0, 0, 0, 0.35),
    0 0 0 2px rgba(0, 200, 255, 0.2);
}

.setup.setup--arena-tcg .btn-gold {
  background: linear-gradient(165deg, #00b4f0 0%, #0058b8 50%, #001848 100%);
  color: #f4fcff;
  border: 1px solid rgba(0, 220, 255, 0.45);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  box-shadow:
    0 0 28px rgba(0, 200, 255, 0.3),
    0 6px 24px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.setup.setup--arena-tcg .btn-gold:hover {
  filter: brightness(1.1);
}

.setup.setup--arena-tcg .btn-ghost {
  color: rgba(220, 235, 255, 0.88);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.35);
}

.setup.setup--arena-tcg .btn-ghost:hover {
  border-color: rgba(0, 200, 255, 0.45);
  background: rgba(0, 40, 80, 0.25);
}

.setup.setup--arena-tcg .online-status {
  color: rgba(200, 230, 255, 0.88);
}

.setup.setup--arena-tcg .lobby-box {
  border: 1px solid rgba(0, 200, 255, 0.15);
  background: rgba(4, 6, 14, 0.72);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35);
}

.setup.setup--arena-tcg .lobby-title {
  color: rgba(180, 210, 255, 0.55);
}

.app:has(#setup.setup--arena-tcg:not(.hidden)) .topbar,
.app:has(#battle.battle--arena-tcg:not(.hidden)) .topbar,
.app:has(#lobby.lobby-screen:not(.hidden)) .topbar {
  background: linear-gradient(180deg, rgba(6, 8, 18, 0.95), rgba(4, 4, 12, 0.88));
  border-bottom: 1px solid rgba(0, 200, 255, 0.12);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.setup-frame--clean {
  max-width: min(420px, 100%);
}

.setup-frame__head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.setup-frame__head .setup-title {
  flex: 1;
  margin: 0;
  text-align: center;
}

.setup-frame__back {
  flex-shrink: 0;
  font-size: 0.72rem;
  padding: 0.35rem 0.55rem;
}

.setup-mode-pills {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.setup-mode-pill {
  flex: 1;
  cursor: pointer;
}

.setup-mode-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.setup-mode-pill span {
  display: block;
  text-align: center;
  padding: 0.55rem 0.5rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(200, 220, 255, 0.65);
  transition:
    border-color 0.12s ease,
    background 0.12s ease,
    color 0.12s ease;
}

.setup-mode-pill input:checked + span {
  color: #dff6ff;
  border-color: rgba(0, 200, 255, 0.55);
  background: linear-gradient(165deg, rgba(0, 70, 130, 0.45), rgba(8, 10, 24, 0.95));
  box-shadow: 0 0 16px rgba(0, 200, 255, 0.2);
}

.setup-mode-pills--sub {
  margin-bottom: 0.45rem;
}

.setup-mode-pill--small span {
  padding: 0.4rem 0.35rem;
  font-size: 0.65rem;
}

.setup-block--compact {
  margin-bottom: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.22);
}

.setup-auth-compact--logged legend {
  display: none;
}

.setup-auth-compact--logged {
  padding: 0.35rem 0;
  border: none;
  background: transparent;
}

.setup-play-card,
.setup-grid#setup-play-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.setup-cpu-opponent-hint {
  margin: 0;
  opacity: 0.75;
}

.setup-cta {
  width: 100%;
  margin-top: 0.25rem;
}

.setup-footer-actions {
  margin-top: 0.65rem;
  text-align: center;
}

.setup-footer-actions .btn {
  width: 100%;
}

.topbar-rank {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.topbar-back {
  font-size: 0.78rem;
}

/* ========= Arena em jogo: entrada e movimento (mais dinâmico) ========= */

@keyframes tcg-home-logo {
  0%,
  100% {
    transform: translateY(0) scale(1);
    filter:
      drop-shadow(0 0 28px rgba(0, 200, 255, 0.28))
      drop-shadow(0 0 40px rgba(255, 42, 58, 0.14))
      drop-shadow(0 18px 48px rgba(0, 0, 0, 0.75));
  }
  50% {
    transform: translateY(-6px) scale(1.01);
    filter:
      drop-shadow(0 0 36px rgba(0, 200, 255, 0.38))
      drop-shadow(0 0 48px rgba(255, 42, 58, 0.2))
      drop-shadow(0 22px 52px rgba(0, 0, 0, 0.78));
  }
}

@keyframes tcg-cta-pulse {
  0%,
  100% {
    box-shadow:
      0 0 28px rgba(0, 200, 255, 0.3),
      0 8px 28px rgba(0, 0, 0, 0.55),
      inset 0 1px 0 rgba(255, 255, 255, 0.22);
  }
  50% {
    box-shadow:
      0 0 44px rgba(0, 200, 255, 0.48),
      0 10px 32px rgba(0, 0, 0, 0.58),
      inset 0 1px 0 rgba(255, 255, 255, 0.28);
  }
}

@keyframes tcg-arena-layout-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes tcg-backdrop-breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.88;
  }
}

@keyframes tcg-scan-drift {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 0 120px;
  }
}

@keyframes tcg-field-shift {
  0%,
  100% {
    filter: saturate(1.05) contrast(1.02);
  }
  50% {
    filter: saturate(1.12) contrast(1.04);
  }
}

@keyframes tcg-vs-glow {
  0%,
  100% {
    box-shadow:
      0 0 24px rgba(0, 200, 255, 0.35),
      0 0 20px rgba(255, 42, 58, 0.22),
      inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  }
  50% {
    box-shadow:
      0 0 40px rgba(0, 200, 255, 0.5),
      0 0 36px rgba(255, 42, 58, 0.38),
      inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  }
}

#battle.battle--arena-tcg:not(.hidden) .battle-layout {
  animation: tcg-arena-layout-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#battle.battle--arena-tcg:not(.hidden) .battle-backdrop::after {
  animation: tcg-backdrop-breathe 7s ease-in-out infinite;
}

#battle.battle--arena-tcg:not(.hidden) .battle-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 200, 255, 0.035) 3px,
    rgba(0, 200, 255, 0.035) 4px
  );
  background-size: 100% 100%;
  mix-blend-mode: soft-light;
  opacity: 0.55;
  animation: tcg-scan-drift 22s linear infinite;
}

#battle.battle--arena-tcg:not(.hidden) .battle-field.arena-tcg-field {
  animation: tcg-field-shift 10s ease-in-out infinite;
}

#battle.battle--arena-tcg .battle-vs__text,
#battle.battle--arena-tcg .battle-vs__badge.battle-vs__text {
  animation: tcg-vs-glow 2.4s ease-in-out infinite;
}

/* Arena TCG — ecrã estreito: mão compacta e rail táctil */
@media (max-width: 640px) {
  /* Espaço para o dock fixo: secção da mão */
  body.battle-active #battle.battle--arena-tcg #hand-column-p1 {
    padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px));
    margin-top: 0.28rem;
    background: linear-gradient(180deg, rgba(10, 16, 32, 0.35), rgba(4, 6, 14, 0.78));
    border-top-color: rgba(0, 160, 255, 0.2);
    z-index: 4;
    pointer-events: none;
  }

  body.battle-active #battle.battle--arena-tcg #hand-column-p1 .hand-scroll {
    pointer-events: auto;
  }

  body.battle-active #battle.battle--arena-tcg #hand-column-p1 .hand-column__chrome {
    pointer-events: none;
  }

  body.battle-active #battle.battle--arena-tcg #hand-column-p1 .hand.hand--column {
    pointer-events: auto;
  }

  body.battle-active #battle.battle--arena-tcg #hand-column-p1 .hand-card {
    pointer-events: auto;
  }

  #battle.battle--arena-tcg .hand-card {
    width: clamp(46px, 12vw, 60px) !important;
    height: clamp(66px, 17vw, 86px) !important;
    border-radius: 6px;
  }

  #battle.battle--arena-tcg .hand--column {
    min-height: 76px !important;
    max-height: 108px !important;
    gap: 7px;
    padding: 0.55rem 0.08rem 0.12rem;
    overflow-y: visible;
    align-items: flex-end;
  }

  #battle.battle--arena-tcg #hand-column-p1 .hand-column__label {
    pointer-events: none;
    opacity: 0.55;
  }

  #battle.battle--arena-tcg .side-rail {
    position: relative;
    z-index: 12;
  }

  #battle.battle--arena-tcg .rail-controls {
    position: relative;
    z-index: 14;
  }

  #battle.battle--arena-tcg .rail-controls .btn {
    min-height: 48px;
    padding: 0.5rem 0.75rem;
    touch-action: manipulation;
  }

  #battle.battle--arena-tcg #player-status-p1,
  #battle.battle--arena-tcg #player-status-p2 {
    position: relative;
    align-items: flex-start !important;
    justify-content: flex-start;
    min-height: 0 !important;
    padding: 0.35rem 0.28rem 0.28rem !important;
    gap: 0.12rem !important;
  }

  #battle.battle--arena-tcg #player-status-p2 .hero-plate,
  #battle.battle--arena-tcg #player-status-p1 .hero-plate {
    order: 0 !important;
    margin: 0 !important;
    align-self: flex-start;
    transform: scale(0.82);
    transform-origin: top left;
  }

  #battle.battle--arena-tcg #player-status-p2 .player-status__banner,
  #battle.battle--arena-tcg #player-status-p1 .player-status__banner {
    order: 1 !important;
    width: 100%;
    text-align: left;
    padding-left: 0.2rem !important;
  }

  #battle.battle--arena-tcg #player-status-p2 .player-status__stats,
  #battle.battle--arena-tcg #player-status-p1 .player-status__stats {
    order: 2 !important;
    justify-content: flex-start !important;
    width: 100%;
  }

  #battle.battle--arena-tcg .battle-hud-chrome {
    position: absolute;
    top: 2px;
    right: 2px;
    left: auto;
    width: auto;
    z-index: 6;
    gap: 4px;
  }
}

/* Controlo de som na arena (ícone falante + volume) */
#battle.battle--arena-tcg .battle-audio-hud {
  position: fixed;
  top: auto;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  right: max(10px, env(safe-area-inset-right));
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

#battle.battle--arena-tcg .battle-audio-hud__toggle {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(0, 200, 255, 0.45);
  background: linear-gradient(165deg, rgba(0, 40, 80, 0.75), rgba(6, 8, 18, 0.95));
  color: rgba(230, 244, 255, 0.95);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 18px rgba(0, 200, 255, 0.25),
    0 6px 20px rgba(0, 0, 0, 0.5);
}

#battle.battle--arena-tcg .battle-audio-hud__toggle:hover {
  border-color: rgba(0, 240, 255, 0.65);
}

#battle.battle--arena-tcg .battle-audio-popover {
  min-width: min(280px, calc(100vw - 24px));
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 200, 255, 0.38);
  background: rgba(4, 6, 14, 0.97);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65);
}

#battle.battle--arena-tcg .battle-audio-popover__row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

#battle.battle--arena-tcg .battle-audio-popover__label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(200, 220, 255, 0.75);
  margin-right: 0.25rem;
}

#battle.battle--arena-tcg .battle-audio-popover__range {
  flex: 1 1 auto;
  min-width: 0;
  accent-color: #4ad4ff;
}

#battle.battle--arena-tcg .battle-audio-popover__step {
  width: 32px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: #dff6ff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

#battle.battle--arena-tcg .battle-audio-popover__mute {
  width: 100%;
  margin-top: 0.15rem;
  font-size: 0.75rem;
}

/* Folha da carta (telemóvel): ler texto e confirmar jogar */
#battle.battle--arena-tcg .hand-card-sheet {
  position: fixed;
  inset: 0;
  z-index: 260;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 12px;
  padding-bottom: max(72px, calc(56px + env(safe-area-inset-bottom, 0px)));
  pointer-events: none;
}

#battle.battle--arena-tcg .hand-card-sheet[hidden] {
  display: none !important;
}

#battle.battle--arena-tcg .hand-card-sheet__backdrop {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(0, 0, 0, 0.75);
  cursor: pointer;
  pointer-events: auto;
}

#battle.battle--arena-tcg .hand-card-sheet__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(400px, 100vw - 24px);
  max-height: min(78vh, 620px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.75rem 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(0, 200, 255, 0.45);
  background: linear-gradient(180deg, rgba(8, 12, 24, 0.98), rgba(4, 6, 14, 0.99));
  box-shadow:
    0 0 32px rgba(0, 200, 255, 0.2),
    0 16px 48px rgba(0, 0, 0, 0.75);
  pointer-events: auto;
  -webkit-overflow-scrolling: touch;
}

#battle.battle--arena-tcg .hand-card-sheet__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(220, 240, 255, 0.9);
  text-align: center;
}

#battle.battle--arena-tcg .hand-card-sheet__card {
  display: flex;
  justify-content: center;
  margin-bottom: 0.65rem;
}

#battle.battle--arena-tcg .hand-card-sheet__card .tcg-card-frame {
  max-width: min(320px, 88vw);
  width: 100%;
  margin: 0 auto;
}

#battle.battle--arena-tcg .hand-card-sheet__reason {
  margin: 0 0 0.65rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: rgba(255, 200, 160, 0.95);
  background: rgba(80, 30, 10, 0.45);
  border: 1px solid rgba(255, 120, 80, 0.35);
}

#battle.battle--arena-tcg .hand-card-sheet__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: stretch;
}

#battle.battle--arena-tcg .hand-card-sheet__actions .btn {
  flex: 1 1 auto;
  min-width: 0;
}

#battle.battle--arena-tcg .hand-card-sheet__actions .btn-gold:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Desktop arena TCG: mão em fila (sem margens negativas do layout «column» do game.css) */
#battle.battle--arena-tcg .hand--column .hand-card {
  margin-top: 0 !important;
  margin-left: 0 !important;
}

#battle.battle--arena-tcg .battle-footer {
  margin-top: 0.55rem;
  position: relative;
  z-index: 32;
}

#battle.battle--arena-tcg #player-status-p1 {
  margin-bottom: 0.35rem;
}

.google-signin-slot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  margin: 0.35rem 0;
}

.setup-google-auth .setup-hint--tight {
  margin-bottom: 0.35rem;
}

.profile-sheet {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  pointer-events: none;
}

.profile-sheet[hidden] {
  display: none !important;
}

.profile-sheet__backdrop {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(0, 0, 0, 0.72);
  cursor: pointer;
  pointer-events: auto;
}

.profile-sheet__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(480px, 100vw - 24px);
  max-height: min(92vh, 900px);
  overflow: auto;
  padding: 1rem 1.1rem 1.15rem;
  border-radius: 14px;
  border: 1px solid rgba(0, 200, 255, 0.4);
  background: linear-gradient(180deg, rgba(10, 14, 28, 0.98), rgba(4, 6, 14, 0.99));
  box-shadow:
    0 0 28px rgba(0, 200, 255, 0.18),
    0 16px 48px rgba(0, 0, 0, 0.75);
  pointer-events: auto;
}

.profile-sheet__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(220, 240, 255, 0.95);
  text-align: center;
}

.profile-sheet__label {
  display: block;
  margin: 0.65rem 0 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(200, 215, 235, 0.75);
}

.profile-sheet__fieldset {
  margin: 0.75rem 0 0.35rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.profile-sheet__legend {
  padding: 0 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(200, 220, 255, 0.8);
}

.profile-sheet__radio {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.35rem 0;
  font-size: 0.88rem;
  cursor: pointer;
  color: rgba(232, 240, 255, 0.92);
}

.profile-sheet__sub {
  margin: 0.5rem 0 0.25rem;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(180, 200, 230, 0.65);
}

.profile-leader-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  margin-top: 0.35rem;
}

.profile-leader-pick {
  padding: 0.15rem;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  line-height: 0;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.profile-leader-pick img {
  display: block;
  width: 72px;
  height: 96px;
  object-fit: cover;
  border-radius: 6px;
}

.profile-leader-pick--on,
.profile-leader-pick:hover {
  border-color: rgba(0, 200, 255, 0.65);
  box-shadow: 0 0 16px rgba(0, 200, 255, 0.25);
}

.profile-sheet__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.profile-deck-fieldset {
  margin-top: 0.85rem;
}

.profile-deck-hint {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: rgba(200, 215, 235, 0.78);
}

.profile-deck-hint code {
  font-size: 0.85em;
  color: rgba(160, 220, 255, 0.95);
}

.profile-deck-hint--spoil {
  margin-top: 0.15rem;
  color: rgba(200, 235, 170, 0.88);
}

.profile-deck-feedback {
  margin: 0 0 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  font-size: 0.76rem;
  line-height: 1.35;
}

.profile-deck-feedback--error {
  color: rgba(255, 205, 200, 0.96);
  background: rgba(120, 20, 30, 0.35);
  border: 1px solid rgba(255, 100, 100, 0.35);
}

.profile-deck-feedback--ok {
  color: rgba(190, 255, 215, 0.95);
  background: rgba(20, 80, 55, 0.28);
  border: 1px solid rgba(80, 200, 140, 0.35);
}

.profile-deck-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.5rem 0 0.35rem;
}

.profile-deck-count {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: rgba(255, 200, 120, 0.95);
}

.profile-deck-count--ok {
  color: rgba(120, 255, 180, 0.95);
}

.profile-deck-toolbar__btn {
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
}

.profile-deck-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-height: 200px;
  overflow: auto;
  padding: 0.25rem 0 0.15rem;
  margin: 0.25rem 0 0.5rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.profile-deck-slot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 4.5rem;
  padding: 0.2rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(12, 18, 32, 0.85);
  cursor: pointer;
  text-align: left;
  color: rgba(232, 240, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.profile-deck-slot:hover {
  border-color: rgba(255, 120, 140, 0.55);
  box-shadow:
    0 0 10px rgba(255, 100, 120, 0.2),
    0 0 0 1px rgba(0, 0, 0, 0.35);
}

.profile-deck-slot__art {
  display: block;
  line-height: 0;
  border-radius: 4px;
  overflow: hidden;
  background: linear-gradient(
    145deg,
    hsl(var(--card-hue, 200), 42%, 22%),
    hsl(calc(var(--card-hue, 200) + 18), 35%, 10%)
  );
}

.profile-deck-slot__img {
  display: block;
  width: 100%;
  height: 52px;
  object-fit: cover;
}

.profile-deck-slot__name {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.58rem;
  line-height: 1.15;
  max-height: 2.4em;
  overflow: hidden;
}

.profile-deck-pool {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.25rem, 1fr));
  gap: 0.4rem;
  max-height: 260px;
  overflow: auto;
  padding: 0.25rem 0 0.35rem;
  margin-top: 0.2rem;
}

.profile-deck-pool__btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(8, 12, 24, 0.9);
  cursor: pointer;
  text-align: left;
  color: rgba(230, 238, 255, 0.95);
  min-height: 3.35rem;
  transition:
    border-color 0.12s ease,
    opacity 0.12s ease;
}

.profile-deck-pool__btn:hover:not(:disabled) {
  border-color: rgba(0, 220, 255, 0.45);
}

.profile-deck-pool__btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.profile-deck-pool__btn--legendary-gold {
  border-color: rgba(212, 166, 75, 0.65);
  background: linear-gradient(135deg, rgba(48, 36, 12, 0.95), rgba(18, 14, 8, 0.98));
  box-shadow:
    0 0 14px rgba(212, 166, 75, 0.18),
    inset 0 1px 0 rgba(255, 220, 140, 0.1);
}

.profile-deck-pool__btn--legendary-gold:hover:not(:disabled) {
  border-color: rgba(255, 220, 140, 0.75);
  box-shadow: 0 0 18px rgba(212, 166, 75, 0.32);
}

.profile-deck-pool__btn--legendary-gold .profile-deck-pool__tipo {
  color: #e8c878;
}

.profile-deck-slot--legendary-gold {
  border-color: rgba(212, 166, 75, 0.55);
  box-shadow: 0 0 10px rgba(212, 166, 75, 0.2);
}

.deck-card-detail__card--legendary-gold .tcg-card-frame--legendary-gold {
  max-width: 10rem;
  margin: 0 auto;
}

.hand-card-sheet--legendary-gold .hand-card-sheet__panel {
  border-color: rgba(212, 166, 75, 0.55);
  box-shadow:
    0 0 28px rgba(212, 166, 75, 0.22),
    0 18px 48px rgba(0, 0, 0, 0.75);
}

.profile-deck-pool__art {
  flex: 0 0 auto;
  line-height: 0;
  border-radius: 4px;
  overflow: hidden;
  background: linear-gradient(
    145deg,
    hsl(var(--card-hue, 200), 42%, 22%),
    hsl(calc(var(--card-hue, 200) + 18), 35%, 10%)
  );
}

.profile-deck-pool__img {
  display: block;
  width: 40px;
  height: 52px;
  object-fit: cover;
}

.profile-deck-pool__meta {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.profile-deck-pool__name {
  font-size: 0.66rem;
  line-height: 1.15;
  font-weight: 600;
}

.profile-deck-pool__tipo {
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(170, 195, 220, 0.75);
}

/* Tooltip ao pairar cartas no editor de baralho (perfil) */
.profile-deck-card-tooltip {
  position: fixed;
  z-index: 520;
  max-width: min(288px, calc(100vw - 20px));
  padding: 0.65rem 0.78rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 220, 255, 0.38);
  background: rgba(6, 12, 26, 0.97);
  box-shadow:
    0 0 20px rgba(0, 200, 255, 0.12),
    0 14px 40px rgba(0, 0, 0, 0.72);
  font-size: 0.72rem;
  line-height: 1.38;
  color: rgba(230, 238, 255, 0.96);
  pointer-events: none;
}

.profile-deck-card-tooltip__title {
  font-weight: 700;
  font-size: 0.8rem;
  margin: 0 0 0.35rem;
  color: #f0f8ff;
  line-height: 1.25;
}

.profile-deck-card-tooltip__row {
  font-size: 0.66rem;
  opacity: 0.88;
  margin-bottom: 0.38rem;
}

.profile-deck-card-tooltip__stats {
  display: flex;
  gap: 0.85rem;
  margin: 0 0 0.4rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.74rem;
  color: rgba(130, 230, 255, 0.98);
}

.profile-deck-card-tooltip__text {
  margin: 0;
  opacity: 0.92;
  white-space: pre-wrap;
}

/* Arena: melhor uso do ecrã (mobile + desktop) */
body.battle-active #battle.battle--arena-tcg {
  flex: 1 1 auto;
  min-height: 0;
}

body.battle-active #battle.battle--arena-tcg .battle-layout {
  flex: 1 1 auto;
  min-height: 0;
  align-content: stretch;
}

#battle.battle--arena-tcg .battle-field.arena-tcg-field {
  min-height: min(52vh, 520px);
}

@media (max-width: 640px) {
  #battle.battle--arena-tcg .battle-field.arena-tcg-field {
    min-height: 0;
  }

  #battle.battle--arena-tcg .side-rail {
    flex: 0 0 auto;
  }
}

@media (min-width: 641px) {
  #battle.battle--arena-tcg .battle-layout {
    min-height: min(72vh, 900px);
  }

  #battle.battle--arena-tcg #hand-column-p1 .hand--column {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-screen.home-screen--arena-tcg .home-screen__logo,
  .home-screen.home-screen--arena-tcg .home-screen__cta.btn-gold,
  #battle.battle--arena-tcg:not(.hidden) .battle-layout,
  #battle.battle--arena-tcg:not(.hidden) .battle-backdrop::after,
  #battle.battle--arena-tcg:not(.hidden) .battle-backdrop::before,
  #battle.battle--arena-tcg:not(.hidden) .battle-field.arena-tcg-field,
  #battle.battle--arena-tcg .battle-vs__text,
  #battle.battle--arena-tcg .battle-vs__badge.battle-vs__text {
    animation: none !important;
  }

  .home-screen.home-screen--arena-tcg .home-screen__logo {
    transform: none;
  }
}

/* ——— Meu Deck (painel dedicado) ——— */
.deck-sheet__panel {
  max-width: min(52rem, 96vw);
  max-height: min(92vh, 900px);
  overflow-y: auto;
}

.deck-sheet__section {
  margin: 0.75rem 0 1rem;
  padding: 0.65rem 0.5rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.deck-sheet__heading {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: rgba(255, 220, 140, 0.95);
}

.deck-spoils-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  gap: 0.45rem;
  max-height: 11rem;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.15rem 0.1rem 0.25rem;
  -webkit-overflow-scrolling: touch;
}

.deck-spoil-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 5rem;
  margin: 0 auto;
  padding: 0.25rem;
  border: 1px solid rgba(120, 200, 120, 0.35);
  border-radius: 8px;
  background: rgba(12, 28, 18, 0.85);
  cursor: pointer;
  text-align: left;
  color: rgba(232, 255, 240, 0.95);
}

.deck-spoil-card:hover {
  border-color: rgba(160, 255, 180, 0.55);
  box-shadow: 0 0 12px rgba(80, 200, 120, 0.2);
}

.deck-spoil-card__art {
  display: block;
  line-height: 0;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(
    145deg,
    hsl(var(--card-hue, 140), 38%, 22%),
    hsl(calc(var(--card-hue, 140) + 18), 32%, 10%)
  );
}

.deck-spoil-card__img {
  display: block;
  width: 100%;
  height: 3.25rem;
  object-fit: cover;
  object-position: center center;
}

.deck-spoil-card__name {
  font-size: 0.62rem;
  line-height: 1.2;
  margin-top: 0.2rem;
  font-weight: 600;
  max-height: 2.35em;
  overflow: hidden;
}

.deck-spoil-card__tag {
  font-size: 0.58rem;
  color: rgba(160, 230, 170, 0.9);
}

.deck-card-detail {
  margin: 0.65rem 0 1rem;
  padding: 0.75rem;
  border-radius: 10px;
  background: rgba(8, 14, 28, 0.92);
  border: 1px solid rgba(240, 192, 64, 0.35);
}

.deck-card-detail__body {
  display: grid;
  grid-template-columns: minmax(8rem, 10rem) 1fr;
  gap: 0.75rem;
  align-items: start;
}

@media (max-width: 520px) {
  .deck-card-detail__body {
    grid-template-columns: 1fr;
  }
}

.deck-card-detail__card .tcg-card-frame {
  max-width: 10rem;
  margin: 0 auto;
}

.deck-card-detail__stats {
  font-size: 0.82rem;
  line-height: 1.4;
  color: rgba(220, 230, 245, 0.95);
}

.deck-card-detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
  justify-content: flex-end;
}

.deck-sheet .profile-deck-pool {
  max-height: 220px;
}

@media (max-width: 640px) {
  .deck-sheet.profile-sheet {
    justify-content: flex-end;
    align-items: stretch;
    padding: 0;
    padding-top: env(safe-area-inset-top, 0);
  }

  .deck-sheet .deck-sheet__panel {
    width: 100%;
    max-width: none;
    max-height: min(94dvh, 94vh);
    margin: 0;
    border-radius: 16px 16px 0 0;
    padding: 0.85rem 0.9rem  calc(0.9rem + env(safe-area-inset-bottom, 0));
  }

  .deck-sheet .profile-deck-hint:first-of-type {
    font-size: 0.78rem;
    margin-bottom: 0.5rem;
  }

  .deck-sheet__section {
    margin-top: 0.5rem;
    padding: 0.55rem 0.45rem;
  }

  .deck-spoils-grid {
    max-height: 9.5rem;
    grid-template-columns: repeat(auto-fill, minmax(4.25rem, 1fr));
    gap: 0.4rem;
  }

  .deck-spoil-card {
    max-width: none;
  }

  .deck-spoil-card__img {
    height: 2.85rem;
    object-position: center 40%;
  }

  .deck-card-detail {
    margin: 0.5rem 0 0.75rem;
  }

  .deck-sheet .profile-deck-slots {
    max-height: 9.5rem;
  }

  .deck-sheet .profile-deck-pool {
    max-height: 11rem;
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  }
}
