/* Idioma (PT/EN/ES), Prévia Expandida de Carta (Toque + Confirmar) e Layout Mobile-First (Poco X7 Pro / 412px) */

/* Seletor de idioma no desktop e mobile */
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--parch);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
}
.lang-btn:hover { box-shadow: var(--glow-brass); }
.lang-btn.m-lang { min-height: 32px; padding: 4px 8px; font-size: 12px; }
.lang-pop { min-width: 175px !important; z-index: 120 !important; }

/* Botão e caixa de tradução sob demanda dentro do detalhe/prévia da carta */
.card-tr-box { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; align-items: flex-start; }
.card-tr-btn { border-color: rgba(230, 185, 92, 0.45); color: #fde047; }
.card-tr-out {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #e0f2fe;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  width: 100%;
  text-align: left;
}

/* Modal expandido de carta (toque para ler + "Quer jogar esta carta?") */
.m-card-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(4, 8, 16, 0.84);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  animation: mCpIn 0.16s ease-out;
}
.m-card-preview {
  width: min(480px, 100%);
  max-height: 86dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, #121c30 0%, #0a101d 100%);
  border: 1px solid rgba(230, 185, 92, 0.55);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.78);
}
.m-cp-body {
  display: grid;
  grid-template-columns: minmax(105px, 38%) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.m-cp-art {
  display: flex;
  justify-content: center;
}
.m-cp-img {
  width: 100%;
  max-width: 155px;
  max-height: 36dvh;
  object-fit: contain;
  border-radius: 9px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}
.m-cp-noimg {
  width: 100%;
  min-height: 150px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #162038;
  display: grid;
  place-items: center;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}
.m-cp-info { display: flex; flex-direction: column; gap: 4px; text-align: left; min-width: 0; }
.m-cp-name { margin: 0; font-size: 15px !important; line-height: 1.25; color: var(--parch); word-break: break-word; }
.m-cp-sub { margin: 0; font-size: 12px; color: #fde047; font-weight: 600; }
.m-cp-stats { margin: 0; font-size: 12px; color: #93c5fd; font-weight: 600; }
.m-cp-text {
  margin: 2px 0 0;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12.5px;
  line-height: 1.4;
  color: #e2e8f0;
  text-align: left;
  white-space: pre-wrap;
  max-height: 30dvh;
  overflow-y: auto;
}
.m-cp-foot { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 8px; }
.m-cp-ask { margin: 0; font-size: 13px; font-weight: 700; color: #86efac; text-align: center; }
.m-cp-reason { margin: 0; font-size: 12px; color: #fca5a5; text-align: center; }
.m-cp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.m-cp-actions .btn { flex: 1 1 120px; min-height: 40px; font-size: 13.5px; justify-content: center; }

@keyframes mCpIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* Trava de orientação horizontal no celular (portrait bloqueado até girar o aparelho) */
@media (orientation: portrait) and (max-width: 920px) and (pointer: coarse) {
  .rotate-hint {
    display: flex !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 9999 !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 28px;
    text-align: center;
    background: radial-gradient(circle at 50% 45%, #162238 0%, #070b14 85%);
    color: #f8fafc;
  }
  .rotate-hint .rh-icon {
    font-size: 62px;
    animation: rh-turn 1.6s ease-in-out infinite;
  }
  .rotate-hint strong { font-size: 20px; color: #fde047; }
  .rotate-hint span { font-size: 14px; color: #cbd5e1; max-width: 300px; line-height: 1.45; }
}

/* ===== Layout Mobile-First Real (Poco X7 Pro ~ 915×412 landscape) ===== */
@media (max-width: 920px) {

  /* Hub e menus: sem parecer miniatura espremida do desktop */
  .hero-title, h1 { font-size: clamp(22px, 6.5vw, 32px) !important; }
  .menu-wrap, .hub-wrap, .op-wrap { padding-left: 12px; padding-right: 12px; }

  /* Magic: HUD compacto + botões acessíveis ao polegar */
  body.in-game .hud-top { padding: 6px 8px; gap: 6px; font-size: 12px; }
  body.in-game .hud-actions { bottom: 8px; right: 8px; gap: 6px; }
  body.in-game .hud-actions .btn { min-height: 42px; padding: 8px 12px; font-size: 13px; }

  /* One Piece: layout vertical nativo (Arena 56dvh -> Mão Dock -> Painel compacto) */
  body.op-playing { overflow: auto; }
  body.op-playing .op-match {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
  }
  body.op-playing .op-left { flex: none; }
  body.op-playing .op-stage { height: 54dvh; min-height: 300px; flex: none; }
  body.op-playing .op-hand {
    min-height: 132px;
    max-height: none;
    padding: 8px 10px;
    gap: 10px;
    scroll-snap-type: x proximity;
  }
  body.op-playing .op-hcard { scroll-snap-align: start; }
  body.op-playing .op-thumb-hand { width: 82px; height: 114px; }
  body.op-playing .op-side { border-left: 0; border-top: 1px solid rgba(230, 185, 92, 0.25); padding: 10px; }
  .op-stage-hud { flex-direction: column; gap: 6px; top: 6px; left: 6px; right: 6px; }
  .op-pill-bar { font-size: 11.5px; padding: 5px 10px; flex-wrap: wrap; gap: 6px; }
  .op-battle-overlay { bottom: 8px; padding: 8px 10px; width: calc(100% - 16px); }

  /* Chaotic: arena em largura total + ataques/mugic em grade tocável */
  body.chx-playing .chx-match {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 100dvh;
  }
  body.chx-playing .chx-stage,
  body.chx-playing .chx-arena {
    min-height: 50dvh;
    width: 100% !important;
  }
  body.chx-playing .chx-side {
    width: 100% !important;
    max-width: none !important;
    border-left: 0 !important;
    border-top: 1px solid var(--line);
  }

  /* Lorcana e Star Wars: arenas empilhadas em largura total + mão com scroll suave */
  body.lor-playing .lor-hand,
  body.swu-playing .swu-hand {
    display: flex !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    scroll-snap-type: x proximity;
  }
  body.swu-playing .swu-arenas {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
}
