/* ===========================================================
   Bang! Duel — estilos
   Tema: velho oeste, tons terrosos, sem dependência de imagens externas
   =========================================================== */

:root {
  --color-bg: #1a120b;
  --color-bg-panel: #2b1d12;
  --color-bg-panel-light: #3a2817;
  --color-leather: #5c3a1e;
  --color-leather-light: #7a5230;
  --color-gold: #d4a13d;
  --color-gold-light: #e8c374;
  --color-cream: #f0e0c0;
  --color-cream-dim: #c9b896;
  --color-red: #a13d3d;
  --color-red-light: #c75555;
  --color-green: #4a7a4a;
  --color-blue-distance: #3d6a8a;

  --shadow-panel: 0 8px 24px rgba(0, 0, 0, 0.6);
  --radius-card: 10px;
  --radius-panel: 14px;

  font-family: 'Georgia', 'Times New Roman', serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: radial-gradient(ellipse at top, #2b1d12 0%, #1a120b 70%);
  color: var(--color-cream);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

/* Tela de entrada: ocupa o espaço restante para centralizar o painel */
#screen-entry.active {
  flex: 1;
  align-items: center;
}

/* ---------------------------------------------------------
   Tela de entrada — fundo e animação
   --------------------------------------------------------- */
.entry-bg-stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.entry-bg-stars svg {
  width: 100%;
  height: 100%;
  display: block;
}

.entry-panel {
  position: relative;
  z-index: 1;
  animation: entry-rise 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  border-color: var(--color-gold);
  border-width: 2px;
  box-shadow:
    0 0 0 4px #2b1d12,
    0 0 0 6px var(--color-leather),
    var(--shadow-panel);
}

@keyframes entry-rise {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Carta chegando à mão ---- */
@keyframes card-arrive {
  0%   { opacity: 0; transform: translateY(-14px) scale(0.9); }
  60%  { opacity: 1; transform: translateY(2px) scale(1.04); }
  100% { transform: translateY(0) scale(1); }
}
.card-new {
  animation: card-arrive 0.35s ease-out;
  box-shadow: 0 0 10px 2px rgba(212, 161, 61, 0.55);
}

/* ---- Carta sendo jogada (fly-up antes de sumir) ---- */
@keyframes card-play {
  0%   { transform: scale(1) translateY(0); opacity: 1; }
  50%  { transform: scale(1.15) translateY(-14px); opacity: 0.9; }
  100% { transform: scale(0.75) translateY(-28px); opacity: 0; }
}
.card-playing {
  animation: card-play 0.22s ease-in forwards;
  pointer-events: none;
}

/* ---- Dano no painel ---- */
@keyframes panel-damage {
  0%   { box-shadow: none; }
  20%  { box-shadow: inset 0 0 0 4px rgba(200, 32, 32, 0.85), 0 0 28px rgba(200, 32, 32, 0.55); }
  100% { box-shadow: none; }
}
.panel-damaged { animation: panel-damage 0.65s ease-out; }

/* ---- Cura no painel ---- */
@keyframes panel-heal {
  0%   { box-shadow: none; }
  20%  { box-shadow: inset 0 0 0 4px rgba(40, 180, 90, 0.8), 0 0 24px rgba(40, 180, 90, 0.45); }
  100% { box-shadow: none; }
}
.panel-healed { animation: panel-heal 0.65s ease-out; }

/* ---- Virou sua vez ---- */
@keyframes your-turn-glow {
  0%   { box-shadow: none; }
  35%  { box-shadow: inset 0 0 0 3px rgba(212, 161, 61, 0.8), 0 0 32px rgba(212, 161, 61, 0.5); }
  100% { box-shadow: none; }
}
.panel-your-turn { animation: your-turn-glow 0.9s ease-out; }

/* ---- Área de resposta pedindo atenção ---- */
@keyframes pending-pulse {
  0%, 100% { border-color: var(--color-gold); box-shadow: none; }
  50%       { border-color: #d42020; box-shadow: 0 0 18px rgba(212, 32, 32, 0.4); }
}
.pending-area.needs-response {
  animation: pending-pulse 1.1s ease-in-out infinite;
}

/* ---- Nova entrada no log ---- */
@keyframes log-in {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}
.log-entry-new { animation: log-in 0.25s ease-out; }

/* --- Overlay de carta jogada --- */
.card-reveal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.35);
}
.card-reveal-overlay.hidden { display: none; }

.card-reveal-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.card-reveal-label {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--color-gold);
  text-shadow: 0 2px 10px #000, 0 0 20px rgba(212,175,55,0.5);
  letter-spacing: 0.05em;
}
.card-reveal-card {
  width: 110px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.8);
  pointer-events: none;
}

/* Animação completa: entra, fica visível, sai — duração total = timeout do JS (1.8s) */
@keyframes reveal-from-bottom {
  0%   { opacity: 0; transform: translateY(90px) scale(0.7); }
  22%  { opacity: 1; transform: translateY(-6px) scale(1.04); }
  30%  { opacity: 1; transform: translateY(0) scale(1); }
  78%  { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(0) scale(0.92); }
}
@keyframes reveal-from-top {
  0%   { opacity: 0; transform: translateY(-90px) scale(0.7); }
  22%  { opacity: 1; transform: translateY(6px) scale(1.04); }
  30%  { opacity: 1; transform: translateY(0) scale(1); }
  78%  { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(0) scale(0.92); }
}

.card-reveal-inner.from-bottom {
  animation: reveal-from-bottom 1.8s ease-in-out both;
}
.card-reveal-inner.from-top {
  animation: reveal-from-top 1.8s ease-in-out both;
}

/* --- Overlay de teste de sorte (barrel / dinamite / prisão) --- */
.check-reveal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 201;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.5);
}
.check-reveal-overlay.hidden { display: none; }

.check-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: reveal-from-bottom 2.6s ease-in-out both;
}
.check-context-label {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--color-gold);
  text-shadow: 0 2px 10px #000;
  letter-spacing: 0.06em;
}
.check-who {
  font-size: 0.9rem;
  color: var(--color-cream-dim);
}

/* Flip 3D da carta */
.check-flip-wrapper {
  width: 90px;
  height: 126px;
  perspective: 700px;
}
.check-flip-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  animation: check-card-flip 2.6s ease-in-out both;
}
.check-face-back,
.check-face-front {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.check-face-back {
  background: repeating-linear-gradient(
    45deg,
    #2b1d12 0px, #2b1d12 8px,
    #3a2817 8px, #3a2817 16px
  );
  border: 2px solid var(--color-leather);
  box-shadow: inset 0 0 12px rgba(0,0,0,0.5);
}
.check-face-front {
  transform: rotateY(180deg);
  background: var(--color-cream);
  border: 2px solid var(--color-leather);
  gap: 6px;
}
.check-face-front.suit-red  { border-color: var(--color-red); }
.check-face-front.suit-black { border-color: #222; }
.check-suit-big {
  font-size: 2.4rem;
  line-height: 1;
}
.check-face-front.suit-red .check-suit-big { color: var(--color-red); }
.check-face-front.suit-black .check-suit-big { color: #1a1a1a; }
.check-card-name {
  font-size: 0.65rem;
  font-weight: bold;
  color: #333;
  text-align: center;
  padding: 0 4px;
}

@keyframes check-card-flip {
  /* face-down → flip to face-up → hold → fade */
  0%   { transform: rotateY(0deg) scale(0.7); opacity: 0; }
  10%  { transform: rotateY(0deg) scale(1);   opacity: 1; }
  38%  { transform: rotateY(0deg) scale(1);   opacity: 1; }
  54%  { transform: rotateY(180deg) scale(1); opacity: 1; }
  85%  { transform: rotateY(180deg) scale(1); opacity: 1; }
  100% { transform: rotateY(180deg) scale(0.9); opacity: 0; }
}

.check-result {
  font-size: 1rem;
  font-weight: bold;
  padding: 6px 16px;
  border-radius: 6px;
  text-shadow: 0 1px 6px #000;
  opacity: 0;
  animation: check-result-appear 2.6s ease-in-out both;
}
.check-good { color: #2ecc71; }
.check-bad  { color: #e74c3c; }

@keyframes check-result-appear {
  0%,  52% { opacity: 0; transform: translateY(6px); }
  62%       { opacity: 1; transform: translateY(0); }
  85%       { opacity: 1; }
  100%      { opacity: 0; }
}

.entry-ornament {
  text-align: center;
  margin-bottom: 16px;
}
.entry-ornament svg {
  width: 100%;
  max-width: 340px;
}
.entry-ornament-bottom {
  margin-top: 20px;
  margin-bottom: 0;
}

.entry-title-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 6px;
}
.entry-star {
  color: var(--color-gold);
  font-size: 1.2rem;
  opacity: 0.7;
  flex-shrink: 0;
}

.entry-rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-leather-light), transparent);
  margin: 20px 0;
}

.btn-lg {
  padding: 14px 20px;
  font-size: 1.05rem;
  letter-spacing: 1px;
}

/* ---------------------------------------------------------
   Telas (mostra/esconde)
   --------------------------------------------------------- */
.screen {
  display: none;
  width: 100%;
}
.screen.active {
  display: flex;
  justify-content: center;
}

/* ---------------------------------------------------------
   Painéis genéricos
   --------------------------------------------------------- */
.panel {
  background: var(--color-bg-panel);
  border: 2px solid var(--color-leather);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
  padding: 32px;
  width: 100%;
  max-width: 420px;
}
.panel-wide {
  max-width: 720px;
}

.title {
  font-size: 2.6rem;
  text-align: center;
  color: var(--color-gold);
  letter-spacing: 3px;
  text-shadow: 2px 2px 0 #000, 0 0 20px rgba(212, 161, 61, 0.3);
  line-height: 1;
}
.title-accent {
  color: var(--color-red-light);
}
.subtitle {
  text-align: center;
  color: var(--color-cream-dim);
  margin-top: 6px;
  margin-bottom: 28px;
  font-style: italic;
}

/* ---------------------------------------------------------
   Campos de formulário
   --------------------------------------------------------- */
.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--color-gold-light);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.field input {
  width: 100%;
  background: var(--color-bg);
  border: 1px solid var(--color-leather-light);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--color-cream);
  font-size: 1rem;
  font-family: inherit;
}
.field input:focus {
  outline: none;
  border-color: var(--color-gold);
}
.input-code {
  text-transform: uppercase;
  letter-spacing: 4px;
  text-align: center;
  font-size: 1.3rem;
}

.entry-name-field {
  margin-bottom: 24px;
}

.entry-choices {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
}

.entry-choice {
  display: flex;
  flex-direction: column;
}

.choice-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-gold-light);
  margin-bottom: 10px;
}

.entry-choice-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--color-cream-dim);
  font-size: 0.8rem;
  gap: 6px;
}
.entry-choice-divider::before,
.entry-choice-divider::after {
  content: '';
  width: 1px;
  height: 36px;
  background: var(--color-leather-light);
}

@media (max-width: 480px) {
  .entry-choices {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .entry-choice-divider {
    flex-direction: row;
    width: 100%;
  }
  .entry-choice-divider::before,
  .entry-choice-divider::after {
    width: auto;
    flex: 1;
    height: 1px;
  }
}

/* ---------------------------------------------------------
   Botões
   --------------------------------------------------------- */
.btn {
  display: inline-block;
  font-family: inherit;
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  padding: 12px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.1s ease;
  text-transform: uppercase;
}
.btn:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.btn:active:not(:disabled) {
  transform: translateY(0);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-block {
  width: 100%;
}
.btn-primary {
  background: linear-gradient(180deg, var(--color-gold-light), var(--color-gold));
  color: #2b1d0a;
  box-shadow: 0 3px 0 #8a6520;
}
.btn-secondary {
  background: linear-gradient(180deg, var(--color-leather-light), var(--color-leather));
  color: var(--color-cream);
  box-shadow: 0 3px 0 #3a2410;
  width: 100%;
  margin-top: 4px;
}
.btn-danger {
  background: linear-gradient(180deg, var(--color-red-light), var(--color-red));
  color: #fff;
  box-shadow: 0 3px 0 #6a2424;
}

/* ---------------------------------------------------------
   Erros e toasts
   --------------------------------------------------------- */
.error-text {
  color: var(--color-red-light);
  font-size: 0.9rem;
  margin-top: 14px;
  text-align: center;
}
.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-red);
  color: #fff;
  padding: 12px 22px 12px 18px;
  border-radius: 8px;
  box-shadow: var(--shadow-panel);
  font-size: 0.95rem;
  z-index: 1000;
  max-width: 90vw;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}
.toast::after {
  content: '✕';
  font-size: 0.8rem;
  opacity: 0.7;
  flex-shrink: 0;
}

/* ---------------------------------------------------------
   Lobby
   --------------------------------------------------------- */
.lobby-header {
  text-align: center;
  margin-bottom: 24px;
}
.room-code-display {
  color: var(--color-gold);
  letter-spacing: 4px;
  font-size: 1.4rem;
}
.hint {
  color: var(--color-cream-dim);
  font-size: 0.85rem;
  margin-top: 4px;
}

.lobby-players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 640px) {
  .lobby-players {
    grid-template-columns: 1fr;
  }
}

.lobby-player-slot h3 {
  color: var(--color-gold-light);
  margin-bottom: 12px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.character-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}
.character-card {
  background: var(--color-bg-panel-light);
  border: 2px solid var(--color-leather);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.character-card:hover {
  border-color: var(--color-gold-light);
}
.character-card.selected {
  border-color: var(--color-gold);
  background: #4a3318;
}
.char-avatar {
  width: 100%;
  height: 70px;
  display: block;
  margin-bottom: 4px;
}
.character-card .char-name {
  font-weight: bold;
  color: var(--color-cream);
  font-size: 0.9rem;
}
.character-card .char-health {
  color: var(--color-red-light);
  font-size: 0.8rem;
  margin: 2px 0;
}
.character-card .char-ability {
  color: var(--color-cream-dim);
  font-size: 0.72rem;
  line-height: 1.3;
}

.opponent-info {
  background: var(--color-bg-panel-light);
  border-radius: 8px;
  padding: 16px;
  min-height: 120px;
}
.waiting-text {
  color: var(--color-cream-dim);
  font-style: italic;
  text-align: center;
  padding-top: 30px;
}
.opponent-info .char-name {
  font-weight: bold;
  color: var(--color-gold-light);
  margin-bottom: 6px;
}
.opponent-info .char-ability {
  color: var(--color-cream-dim);
  font-size: 0.8rem;
  margin-bottom: 10px;
}
.ready-badge {
  display: inline-block;
  background: var(--color-green);
  color: #fff;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
}
.not-ready-badge {
  display: inline-block;
  background: var(--color-leather);
  color: var(--color-cream-dim);
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
}

/* ---------------------------------------------------------
   Tela de jogo — layout geral
   --------------------------------------------------------- */
#screen-game.active {
  display: block;
  position: relative;
}

#game-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}
#game-background svg {
  display: block;
}

.game-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.player-panel {
  background: var(--color-bg-panel);
  border: 2px solid var(--color-leather);
  border-radius: var(--radius-panel);
  padding: 14px 18px;
}
.player-panel-opponent {
  border-color: var(--color-red);
}
.player-panel-self {
  border-color: var(--color-gold);
}

.player-panel-body {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.panel-avatar-holder {
  flex-shrink: 0;
  width: 64px;
  height: 70px;
}
.panel-avatar-holder svg {
  width: 100%;
  height: 100%;
  display: block;
}
.panel-info {
  flex: 1;
  min-width: 0;
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.player-name {
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--color-cream);
}
.player-character {
  font-size: 0.85rem;
  color: var(--color-gold-light);
  font-style: italic;
}

.health-row {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.heart {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}
.heart-full {
  background: var(--color-red);
  box-shadow: 0 0 4px rgba(161, 61, 61, 0.7);
}
.heart-empty {
  background: #3a2817;
  border: 1px solid var(--color-leather-light);
}

.equipment-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  min-height: 26px;
}
.equipment-chip {
  background: var(--color-bg-panel-light);
  border: 1px solid var(--color-leather-light);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 0.72rem;
  color: var(--color-cream-dim);
}
/* Mini-cards de equipamento em jogo */
.equipment-row {
  align-items: flex-start;
}
.inplay-mini-card {
  width: 52px;
  min-height: 72px;
  background: var(--color-cream);
  border: 2px solid var(--color-leather);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 3px 2px 4px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.mini-card-label {
  font-size: 0.48rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  line-height: 1;
  align-self: flex-start;
  padding-left: 3px;
}
.mini-card-art {
  width: 38px;
  height: 34px;
  flex-shrink: 0;
}
.mini-card-art-placeholder {
  width: 38px;
  height: 34px;
}
.mini-card-name {
  font-size: 0.54rem;
  font-weight: bold;
  color: #1a1a1a;
  text-align: center;
  line-height: 1.1;
}
.mini-card-detail {
  font-size: 0.48rem;
  color: #555;
  text-align: center;
}

.inplay-weapon  { border-color: var(--color-gold); }
.inplay-weapon .mini-card-label { color: #8b6914; }
.inplay-weapon .mini-card-name  { color: #6b4c10; }

.inplay-barrel  { border-color: #8b5e3c; }
.inplay-barrel .mini-card-label { color: #6b3e1e; }

.inplay-dynamite {
  border-color: #c0392b;
  animation: dynamite-card-pulse 1.8s ease-in-out infinite;
}
@keyframes dynamite-card-pulse {
  0%, 100% { box-shadow: 0 2px 6px rgba(0,0,0,0.4), 0 0 4px rgba(192,57,43,0.4); }
  50%       { box-shadow: 0 2px 6px rgba(0,0,0,0.4), 0 0 14px rgba(220,60,30,0.85); }
}
.inplay-dynamite .mini-card-label { color: #9b1e10; }
.inplay-dynamite .mini-card-name  { color: #9b1e10; }

.inplay-jail    { border-color: #555; }
.inplay-jail .mini-card-label { color: #444; }
.inplay-jail .mini-card-name  { color: #444; }

.inplay-scope, .inplay-mustang { border-color: var(--color-leather-light); }

/* Chips legados (ainda usados nos botões de Cat Balou / Panic!) */
.chip-dynamite {
  background: rgba(120, 0, 0, 0.4);
  border-color: #c0392b;
  color: #ff6b5b;
  font-weight: bold;
}
.chip-barrel {
  background: rgba(92, 58, 30, 0.5);
  border-color: #8b5e3c;
  color: #c9935a;
}
.chip-jail {
  background: rgba(40, 40, 40, 0.6);
  border-color: #555;
  color: #999;
}

/* --- Estados de painel por equipamento --- */
@keyframes dynamite-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(192, 57, 43, 0.35), inset 0 0 10px rgba(192, 57, 43, 0.1); }
  50%       { box-shadow: 0 0 22px rgba(220, 60, 30, 0.7), inset 0 0 18px rgba(192, 57, 43, 0.25); }
}
.player-panel.has-dynamite {
  border-color: #c0392b !important;
  animation: dynamite-pulse 1.8s ease-in-out infinite;
}

.player-panel.has-barrel {
  border-color: #8b5e3c !important;
  box-shadow: inset 0 0 12px rgba(139, 94, 60, 0.2);
}

.player-panel.in-jail {
  border-color: #555 !important;
  position: relative;
  overflow: hidden;
}
.player-panel.in-jail::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px, transparent 20px,
    rgba(80, 80, 80, 0.15) 20px, rgba(80, 80, 80, 0.15) 24px
  );
  pointer-events: none;
  border-radius: inherit;
  z-index: 0;
}
.player-panel.in-jail .player-panel-body,
.player-panel.in-jail .hand-area,
.player-panel.in-jail .action-bar {
  position: relative;
  z-index: 1;
}

.hand-count {
  color: var(--color-cream-dim);
  font-size: 0.85rem;
}

/* ---------------------------------------------------------
   Centro: monte/descarte/log/pending
   --------------------------------------------------------- */
.center-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deck-info {
  display: flex;
  justify-content: center;
  gap: 24px;
}
.deck-pile,
.discard-pile {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--color-bg-panel-light);
  border: 1px solid var(--color-leather-light);
  border-radius: 8px;
  padding: 8px 18px;
  min-width: 80px;
}
.pile-label {
  font-size: 0.7rem;
  color: var(--color-cream-dim);
  text-transform: uppercase;
}
.pile-count {
  font-size: 1.1rem;
  color: var(--color-gold-light);
  font-weight: bold;
}

.turn-indicator {
  text-align: center;
  font-size: 1rem;
  color: var(--color-gold);
  font-weight: bold;
  padding: 6px;
  background: var(--color-bg-panel-light);
  border-radius: 8px;
}
.turn-indicator.your-turn {
  background: #3a4a1f;
  color: #c7e89a;
}
.turn-indicator.opponent-turn {
  background: #4a1f1f;
  color: #e8a3a3;
}

/* ---------------------------------------------------------
   Barra de revanche (fim de partida)
   --------------------------------------------------------- */
.rematch-bar {
  background: linear-gradient(135deg, #2b1d0a, #3a2817);
  border: 2px solid var(--color-gold);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.rematch-bar p {
  color: var(--color-cream-dim);
  font-size: 0.85rem;
  margin-top: 8px;
}
.rematch-bar .btn {
  margin-top: 4px;
}

.pending-area {
  background: #4a3318;
  border: 2px solid var(--color-gold);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}
.pending-area p {
  margin-bottom: 10px;
  color: var(--color-cream);
}
.pending-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Grade de seleção de alvo (Cat Balou / Panic!) */
.target-pick-grid {
  gap: 10px;
  justify-content: center;
}

/* Carta da mão — virada para baixo */
.target-hand-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 2px solid var(--color-leather);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--color-cream-dim);
  font-size: 0.72rem;
  transition: border-color 0.15s, transform 0.15s;
}
.target-hand-card:hover {
  border-color: var(--color-gold);
  color: var(--color-cream);
  transform: translateY(-4px);
}
.hand-card-back {
  width: 44px;
  height: 62px;
  border-radius: 6px;
  background: repeating-linear-gradient(
    45deg,
    #2b1d12 0px, #2b1d12 6px,
    #3a2817 6px, #3a2817 12px
  );
  border: 1px solid var(--color-leather);
  box-shadow: inset 0 0 8px rgba(0,0,0,0.4);
}

/* Carta em jogo — virada para cima */
.target-inplay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 2px solid var(--color-leather-light);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.72rem;
  color: var(--color-cream-dim);
  transition: border-color 0.15s, transform 0.15s;
}
.target-inplay-card:hover {
  border-color: var(--color-gold);
  color: var(--color-cream);
  transform: translateY(-4px);
}
.inplay-card-face {
  width: 44px;
  height: 62px;
  border-radius: 6px;
  background: var(--color-bg-panel-light);
  border: 1px solid var(--color-leather-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: bold;
  text-align: center;
  padding: 4px;
  color: var(--color-cream);
}
.target-inplay-card.chip-dynamite .inplay-card-face {
  background: rgba(120, 0, 0, 0.4);
  border-color: #c0392b;
  color: #ff6b5b;
}
.target-inplay-card.chip-barrel .inplay-card-face {
  background: rgba(92, 58, 30, 0.5);
  border-color: #8b5e3c;
  color: #c9935a;
}
.target-inplay-card.chip-jail .inplay-card-face {
  background: rgba(40, 40, 40, 0.6);
  border-color: #555;
  color: #999;
}
.target-inplay-card.weapon-chip .inplay-card-face {
  background: rgba(60, 50, 20, 0.5);
  border-color: var(--color-gold);
  color: var(--color-gold-light);
}

.game-log {
  background: var(--color-bg);
  border: 1px solid var(--color-leather);
  border-radius: 8px;
  padding: 10px 14px;
  height: 140px;
  overflow-y: auto;
  font-size: 0.82rem;
  color: var(--color-cream-dim);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.game-log .log-entry {
  line-height: 1.4;
}
.game-log .log-win {
  color: var(--color-gold);
  font-weight: bold;
}

/* ---------------------------------------------------------
   Mão de cartas
   --------------------------------------------------------- */
.hand-area {
  margin: 10px 0;
}
.hand-cards {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 2px 12px;
}

.game-card {
  flex-shrink: 0;
  width: 100px;
  height: 178px;
  background: linear-gradient(180deg, #fdf6e3, #f0e0c0);
  color: #2b1d0a;
  border: 2px solid var(--color-leather);
  border-radius: var(--radius-card);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}
.card-top {
  flex-shrink: 0;
}
.card-art {
  flex: 1;
  width: 100%;
  min-height: 0;
}
.game-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}
.game-card.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}
.game-card.disabled:hover {
  transform: none;
  box-shadow: none;
}
.game-card.discard-mode {
  border-color: var(--color-red);
  cursor: pointer;
}
.game-card.discard-mode:hover {
  transform: translateY(-6px);
  box-shadow: 0 0 12px var(--color-red);
}
.card-name {
  font-weight: bold;
  font-size: 0.78rem;
  line-height: 1.15;
}
.card-type-tag {
  font-size: 0.62rem;
  text-transform: uppercase;
  color: #6a5230;
  letter-spacing: 0.5px;
}
.card-suit {
  font-size: 1.1rem;
  text-align: right;
}
.card-suit.suit-red {
  color: var(--color-red);
}
.card-suit.suit-black {
  color: #2b1d0a;
}


/* tipos de carta com cor de destaque na borda esquerda */
.game-card.type-bang { border-left: 5px solid var(--color-red); }
.game-card.type-missed { border-left: 5px solid var(--color-blue-distance); }
.game-card.type-beer { border-left: 5px solid var(--color-green); }
.game-card.type-weapon { border-left: 5px solid var(--color-gold); }
.game-card.type-duel,
.game-card.type-gatling,
.game-card.type-indians { border-left: 5px solid #7a3da1; }

.action-bar {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* ---------------------------------------------------------
   Tooltip de carta
   --------------------------------------------------------- */
.card-tooltip {
  position: fixed;
  z-index: 9000;
  max-width: 220px;
  background: #1e130a;
  border: 1px solid var(--color-gold);
  border-radius: 8px;
  padding: 10px 12px;
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(0,0,0,0.7);
  transform: translateX(-50%);
}
.card-tooltip strong {
  display: block;
  color: var(--color-gold-light);
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.card-tooltip p {
  color: var(--color-cream-dim);
  font-size: 0.78rem;
  line-height: 1.45;
  margin: 0;
}

/* ---------------------------------------------------------
   Scrollbars discretas
   --------------------------------------------------------- */
.hand-cards::-webkit-scrollbar,
.game-log::-webkit-scrollbar,
.character-grid::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}
.hand-cards::-webkit-scrollbar-thumb,
.game-log::-webkit-scrollbar-thumb,
.character-grid::-webkit-scrollbar-thumb {
  background: var(--color-leather-light);
  border-radius: 4px;
}

/* ---------------------------------------------------------
   Rodapé de regras
   --------------------------------------------------------- */
#rules-footer {
  width: 100%;
  margin-top: 20px;
}

#rules-details {
  background: var(--color-bg-panel);
  border: 1px solid var(--color-leather);
  border-radius: var(--radius-panel);
  overflow: hidden;
}

#rules-details summary {
  padding: 11px 16px;
  cursor: pointer;
  color: var(--color-gold-light);
  font-size: 0.82rem;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 1px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#rules-details summary::-webkit-details-marker { display: none; }
#rules-details summary::after {
  content: '▾';
  margin-left: auto;
  font-size: 1rem;
  transition: transform 0.2s ease;
  color: var(--color-gold);
}
#rules-details[open] summary::after {
  transform: rotate(180deg);
}
#rules-details summary:hover {
  background: var(--color-bg-panel-light);
}

.rules-content {
  padding: 16px;
  border-top: 1px solid var(--color-leather);
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px 24px;
}

.rules-section h4 {
  color: var(--color-gold);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--color-leather);
}

.rules-section p,
.rules-section li {
  font-size: 0.77rem;
  color: var(--color-cream-dim);
  line-height: 1.45;
}

.rules-section ul,
.rules-section ol {
  padding-left: 14px;
}

.rules-section li {
  margin-bottom: 3px;
}

.rules-section strong {
  color: var(--color-cream);
}

/* =========================================================
   Responsividade — smartphones
   ========================================================= */
@media (max-width: 600px) {

  /* Bordas da tela: menos padding */
  body {
    padding: 8px;
  }

  /* Painéis: padding reduzido */
  .panel,
  .panel-wide {
    padding: 18px 14px;
    border-radius: 10px;
  }

  /* Título menor para caber sem quebrar */
  .title {
    font-size: 2rem;
    letter-spacing: 2px;
  }
  .subtitle {
    font-size: 0.9rem;
    margin-bottom: 18px;
  }

  /* Ornamentos: reduzir margens */
  .entry-ornament {
    margin-bottom: 10px;
  }
  .entry-rule {
    margin: 14px 0;
  }
  .entry-name-field {
    margin-bottom: 16px;
  }

  /* Botões: toque mais responsivo */
  .btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  /* ---- Lobby ------------------------------------------ */
  .lobby-header {
    margin-bottom: 16px;
  }
  .character-grid {
    max-height: 220px;
  }

  /* ---- Tela de jogo ----------------------------------- */
  .game-layout {
    gap: 6px;
  }

  .player-panel {
    padding: 10px 12px;
  }

  /* Avatar menor mas presente */
  .panel-avatar-holder {
    width: 44px;
    height: 48px;
  }

  /* Nome e personagem empilhados para não se espremem */
  .player-header {
    flex-direction: column;
    gap: 2px;
    margin-bottom: 6px;
  }
  .player-name {
    font-size: 1rem;
  }
  .player-character {
    font-size: 0.78rem;
  }

  /* Equipamentos: chips menores */
  .equipment-chip {
    font-size: 0.65rem;
    padding: 2px 6px;
  }
  .equipment-row {
    min-height: 22px;
    margin-bottom: 4px;
  }

  /* Log de jogo mais compacto */
  .game-log {
    height: 90px;
    font-size: 0.78rem;
  }

  /* Botão de fim de turno ocupa toda a largura */
  .action-bar {
    justify-content: stretch;
  }
  .action-bar .btn {
    width: 100%;
  }

  /* Botão de revanche centralizado e full-width */
  .rematch-bar .btn {
    width: 100%;
  }

  /* Cartas ligeiramente menores */
  .game-card {
    width: 82px;
    height: 148px;
    padding: 6px 5px;
  }
  .card-name {
    font-size: 0.72rem;
  }
  .card-type-tag {
    font-size: 0.58rem;
  }
  .card-suit {
    font-size: 1rem;
  }

  /* Ações pendentes: botões empilhados */
  .pending-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .pending-actions .btn {
    width: 100%;
  }

  /* Tooltip não existe em touch */
  .card-tooltip {
    display: none !important;
  }

  /* Rodapé: regras em coluna única */
  #rules-footer {
    margin-top: 12px;
  }
  .rules-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* Telas muito estreitas (< 360px) */
@media (max-width: 360px) {
  .title {
    font-size: 1.7rem;
    letter-spacing: 1px;
  }

  /* Avatar oculto para ganhar mais espaço */
  .panel-avatar-holder {
    display: none;
  }

  .game-card {
    width: 72px;
    height: 132px;
  }
}
