@import url('https://fonts.googleapis.com/css2?family=Andika:ital,wght@0,400;0,700;1,400;1,700&display=swap');

:root {
  --font-family: 'Andika', sans-serif;
  --cor-verde: #3E7843;
  --cor-verde-escuro: #2e5932;
  --cor-verde-claro: #4fa055;
  --cor-preto: #000000;
  --cor-branco: #ffffff;
  --cor-fundo: #fdfbf7;
  --card-border: 2px solid #000000;
  --card-radius: 12px;
  --card-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);

  /* Theme Colors */
  --tema-1: rgba(248, 151, 0, 0.95);
  --tema-1-solid: #F89700;
  --tema-2: rgba(245, 88, 3, 0.95);
  --tema-2-solid: #F55803;
  --tema-3: rgba(129, 97, 225, 0.95);
  --tema-3-solid: #8161E1;
  --tema-4: rgba(165, 113, 2, 0.95);
  --tema-4-solid: #A57102;
  --tema-5: rgba(44, 181, 53, 0.95);
  --tema-5-solid: #2CB535;
  --tema-6: #0284c7;
  --tema-6-solid: #0284c7;
  --tema-7: #CE72B7;
  --tema-7-solid: #CE72B7;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: #ffffff;
  background-image: url('../img/fundo.png'), url('./img/fundo.png');
  background-repeat: repeat;
  background-attachment: fixed;
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Container */
.app-wrapper {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 16px 28px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* Header */
.top-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  margin-bottom: 12px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  transition: transform 0.25s ease;
}

.brand-logo:hover {
  transform: rotate(-4deg) scale(1.06);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: clamp(1.2rem, 2.5vw, 1.65rem);
  font-weight: 700;
  color: var(--cor-verde);
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.brand-subtitle {
  font-size: clamp(0.68rem, 1.4vw, 0.8rem);
  font-weight: 700;
  letter-spacing: 1.8px;
  color: #000000;
  text-transform: uppercase;
}

/* Stats and Language Section */
.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* Language selector pills */
.lang-selector {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.04);
  padding: 3px;
  border-radius: 24px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 4px 9px;
  border-radius: 18px;
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  color: #333333;
  transition: all 0.2s ease;
}

.lang-btn:hover {
  background: rgba(62, 120, 67, 0.15);
}

.lang-btn.active {
  background: var(--cor-verde);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(62, 120, 67, 0.25);
}

/* Stats Pills */
.stats-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.stat-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon img,
.stat-icon svg {
  width: 100%;
  height: 100%;
}

.stat-value {
  color: var(--cor-verde);
  font-size: 0.95rem;
}

/* Icon Buttons in Header */
.header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
}

.header-btn:hover {
  background: var(--cor-verde);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(62, 120, 67, 0.2);
  border-color: var(--cor-verde);
}

.header-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.header-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  pointer-events: none;
}

.header-btn:hover svg {
  stroke: #ffffff;
}

/* Leaderboard Trigger Button in Top Header */
button#btn-leaderboard {
  color: #2e5932;
}

button#btn-leaderboard:hover {
  background: #f89700;
  border-color: #f89700;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(248, 151, 0, 0.25);
}

button#btn-leaderboard:hover svg {
  stroke: #ffffff;
}

/* Control Bar */
.control-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  margin-bottom: 16px;
}

.control-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.control-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #555555;
  margin-right: 2px;
}

/* Segmented Buttons */
.segmented-control {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 9px;
  font-family: var(--font-family);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  color: #222222;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.seg-btn:hover {
  background: rgba(62, 120, 67, 0.15);
}

.seg-btn.active {
  background: var(--cor-verde);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(62, 120, 67, 0.25);
}

/* Dropdown Filters */
.theme-select-wrapper {
  position: relative;
}

.theme-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 7px 32px 7px 12px;
  font-family: var(--font-family);
  font-size: 0.82rem;
  font-weight: 700;
  color: #111111;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  outline: none;
  transition: all 0.2s ease;
}

.theme-select:hover,
.theme-select:focus {
  border-color: var(--cor-verde);
  box-shadow: 0 4px 12px rgba(62, 120, 67, 0.15);
}

.theme-select-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  width: 14px;
  height: 14px;
}

/* Game Board */
.board-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.game-board {
  display: grid;
  width: 100%;
  gap: 14px;
  justify-content: center;
  align-content: center;
  margin: 0 auto;
  perspective: 1200px;
  transition: all 0.3s ease;
}

/* Responsive Grid layouts */
/* Easy: 12 cards (3x4 or 4x3) */
.game-board.difficulty-easy {
  grid-template-columns: repeat(4, minmax(130px, 175px));
}

/* Medium: 16 cards (4x4) */
.game-board.difficulty-medium {
  grid-template-columns: repeat(4, minmax(125px, 165px));
}

/* Hard: 20 cards (5x4) */
.game-board.difficulty-hard {
  grid-template-columns: repeat(5, minmax(115px, 155px));
}

/* Card Structure */
.card-slot {
  position: relative;
  width: 100%;
  aspect-ratio: 68 / 89;
  cursor: pointer;
  perspective: 1200px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 68 / 89;
  transform-style: preserve-3d;
  transition: transform 0.32s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: var(--card-shadow);
  border: var(--card-border);
  border-radius: var(--card-radius);
  user-select: none;
  -webkit-user-select: none;
}

.card-slot:hover .card-inner:not(.flipped):not(.matched) {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.card-slot.flipped .card-inner,
.card-slot.matched .card-inner {
  transform: rotateY(180deg);
}

.card-slot .card-face,
.card-slot .card-face * {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.card-slot.matched .card-inner {
  box-shadow: 0 0 0 3px #2CB535, 0 8px 20px rgba(44, 181, 53, 0.35);
  animation: matchPulse 0.4s ease;
}

@keyframes matchPulse {
  0% { transform: rotateY(180deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.05); }
  100% { transform: rotateY(180deg) scale(1); }
}

/* Card Faces */
.card-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Card Back (Face Down) */
.card-back {
  background-color: #000000;
  background-image: url('../img/costas_carta.png'), url('./img/costas_carta.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Card Front (Face Up) */
.card-front {
  transform: rotateY(180deg);
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Visual Card Layout (Artwork + #badge + bottom bar) */
.visual-card .capa {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #f7f7f7;
}

.visual-card .capa img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  transition: transform 0.35s ease;
}

.card-slot:hover .visual-card .capa img {
  transform: scale(1.04);
}

.numero-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background-color: #ffffff;
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.78rem;
  border: 1.5px solid #000000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  z-index: 2;
  color: #000000;
}

.theme-pill-top {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid #000000;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.card-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 8px 8px;
  text-align: center;
  min-height: 48px;
  border-top: 2px solid #000000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  z-index: 2;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.card-bottom-bar .titulo {
  font-size: clamp(0.72rem, 1.1vw, 0.85rem);
  font-weight: 700;
  color: #000000;
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-bottom-bar .categoria {
  font-size: 0.65rem;
  color: #ffffff;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Knowledge Card Layout (for Learning Mode) */
.knowledge-card {
  background: #ffffff;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 2px solid #000000;
  text-align: center;
}

.knowledge-header {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1.5px solid #000000;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.knowledge-header .val-badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.knowledge-header .val-symbol {
  font-size: clamp(0.74rem, 1.1vw, 0.85rem);
  font-weight: 700;
  color: #000000;
  line-height: 1.15;
  background: rgba(255, 255, 255, 0.9);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #000000;
  width: 100%;
}

.knowledge-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 2px;
}

.knowledge-fact-icon {
  display: inline-block;
  margin-bottom: 4px;
}

.knowledge-fact-icon svg {
  width: 22px;
  height: 22px;
}

.knowledge-text {
  font-size: clamp(0.68rem, 1vw, 0.78rem);
  line-height: 1.35;
  color: #222222;
  font-weight: 400;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.knowledge-footer {
  padding: 4px;
  border-top: 1.5px dashed #000000;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--cor-verde);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Theme Colors for Bars & Badges */
.tema_1 .card-bottom-bar,
.tema_1.knowledge-header {
  background-color: var(--tema-1);
}
.tema_1 .theme-pill-top {
  background-color: var(--tema-1-solid);
}

.tema_2 .card-bottom-bar,
.tema_2.knowledge-header {
  background-color: var(--tema-2);
}
.tema_2 .theme-pill-top {
  background-color: var(--tema-2-solid);
}

.tema_3 .card-bottom-bar,
.tema_3.knowledge-header {
  background-color: var(--tema-3);
}
.tema_3 .theme-pill-top {
  background-color: var(--tema-3-solid);
}

.tema_4 .card-bottom-bar,
.tema_4.knowledge-header {
  background-color: var(--tema-4);
}
.tema_4 .theme-pill-top {
  background-color: var(--tema-4-solid);
}

.tema_5 .card-bottom-bar,
.tema_5.knowledge-header {
  background-color: var(--tema-5);
}
.tema_5 .theme-pill-top {
  background-color: var(--tema-5-solid);
}

.tema_6 .card-bottom-bar,
.tema_6.knowledge-header {
  background-color: var(--tema-6);
}
.tema_6 .theme-pill-top {
  background-color: var(--tema-6-solid);
}

.tema_7 .card-bottom-bar,
.tema_7.knowledge-header {
  background-color: var(--tema-7);
}
.tema_7 .theme-pill-top {
  background-color: var(--tema-7-solid);
}

/* Buttons */
.btn-primary {
  font-family: var(--font-family);
  background: var(--cor-verde);
  color: #ffffff;
  border: 2px solid #000000;
  border-radius: 12px;
  padding: 9px 18px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 3px 0 #000000;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  background: #000000;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #000000;
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #000000;
}

.btn-secondary {
  font-family: var(--font-family);
  background: #ffffff;
  color: var(--cor-verde);
  border: 2px solid var(--cor-verde);
  border-radius: 12px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--cor-verde);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-secondary:hover {
  background: var(--cor-verde);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 0 #000000;
}

/* Modal Overlay & Base */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #ffffff;
  border: 4px solid #000000;
  border-radius: 20px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #000000;
  background: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  z-index: 10;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: #000000;
  color: #ffffff;
}

/* Discovery Modal Content */
.discovery-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.discovery-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.discovery-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 16px;
  border: 2px solid #000000;
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffffff;
}

.credit-award-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff8e1;
  border: 2px solid #000000;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #b78103;
  animation: coinBounce 0.6s ease;
}

@keyframes coinBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.discovery-body {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 18px;
  align-items: start;
}

.discovery-card-preview {
  width: 100%;
  aspect-ratio: 68 / 89;
  border: 3px solid #000000;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  position: relative;
}

.discovery-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discovery-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.discovery-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #000000;
  line-height: 1.2;
}

.discovery-meta {
  font-size: 0.8rem;
  color: #666666;
  font-weight: 700;
}

.discovery-desc {
  font-size: 0.88rem;
  line-height: 1.45;
  color: #333333;
}

.discovery-fun-fact {
  background: #f4faf4;
  border-left: 4px solid var(--cor-verde);
  border: 2px solid #000000;
  border-left-width: 6px;
  border-left-color: var(--cor-verde);
  padding: 10px 12px;
  border-radius: 8px;
}

.discovery-fun-fact-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--cor-verde);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.discovery-fun-fact-text {
  font-size: 0.82rem;
  line-height: 1.4;
  color: #222222;
}

.discovery-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 2px solid #e5e5e5;
  padding-top: 14px;
  gap: 12px;
}

.auto-dismiss-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #666666;
  cursor: pointer;
  user-select: none;
}

/* Victory Modal */
.victory-modal-card {
  max-width: 640px;
  text-align: center;
  padding: 32px 24px 28px;
}

.victory-trophy-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  animation: trophySpin 0.75s ease;
}

@keyframes trophySpin {
  0% { transform: scale(0.5) rotate(-15deg); }
  60% { transform: scale(1.15) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}

.victory-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--cor-verde);
  margin-bottom: 4px;
}

.victory-subtitle {
  font-size: 0.95rem;
  color: #555555;
  margin-bottom: 20px;
}

.victory-stars-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 22px;
}

.victory-star {
  width: 44px;
  height: 44px;
  transition: transform 0.3s ease;
}

.victory-star.active {
  animation: starPop 0.5s ease backwards;
}

.victory-star.active:nth-child(1) { animation-delay: 0.15s; }
.victory-star.active:nth-child(2) { animation-delay: 0.3s; }
.victory-star.active:nth-child(3) { animation-delay: 0.45s; }

@keyframes starPop {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.25); }
  100% { transform: scale(1); opacity: 1; }
}

.victory-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.v-stat-card {
  background: #f9fbf8;
  border: 2px solid #000000;
  border-radius: 12px;
  padding: 12px 8px;
  box-shadow: 0 3px 0 #000000;
}

.v-stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #666666;
  font-weight: 700;
  margin-bottom: 4px;
}

.v-stat-number {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--cor-verde);
}

.discovered-symbols-section {
  text-align: left;
  border-top: 2px dashed #000000;
  padding-top: 18px;
  margin-bottom: 22px;
}

.discovered-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111111;
  margin-bottom: 4px;
}

.discovered-hint {
  font-size: 0.75rem;
  color: #777777;
  margin-bottom: 12px;
}

.discovered-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
  gap: 10px;
  max-height: 180px;
  overflow-y: auto;
  padding: 4px;
}

.mini-symbol-card {
  aspect-ratio: 68 / 89;
  border: 2px solid #000000;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  background: #ffffff;
}

.mini-symbol-card:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

.mini-symbol-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.victory-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Confetti canvas */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1050;
}

/* Instructions / Rules Modal */
.info-modal-content {
  padding: 24px;
}

.info-modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--cor-verde);
  margin-bottom: 12px;
}

.info-section {
  margin-bottom: 16px;
  text-align: left;
}

.info-section h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #111111;
}

.info-section p {
  font-size: 0.85rem;
  line-height: 1.45;
  color: #444444;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .game-board.difficulty-hard {
    grid-template-columns: repeat(4, minmax(110px, 150px));
  }
}

@media (max-width: 768px) {
  .app-wrapper {
    padding: 8px 10px 20px;
  }

  .top-header {
    padding: 8px 12px;
  }

  .brand-logo {
    width: 42px;
    height: 42px;
  }

  .control-bar {
    padding: 8px 12px;
  }

  .discovery-body {
    grid-template-columns: 1fr;
  }

  .discovery-card-preview {
    max-width: 180px;
    margin: 0 auto;
  }
}

@media (max-width: 580px) {
  .top-header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    justify-content: space-between;
  }

  .lang-selector {
    order: 2;
  }

  .control-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .control-group {
    justify-content: space-between;
    width: 100%;
  }

  /* 3 columns on phone */
  .game-board.difficulty-easy {
    grid-template-columns: repeat(3, minmax(85px, 1fr));
    gap: 8px;
  }

  .game-board.difficulty-medium {
    grid-template-columns: repeat(4, minmax(70px, 1fr));
    gap: 6px;
  }

  .game-board.difficulty-hard {
    grid-template-columns: repeat(4, minmax(70px, 1fr));
    gap: 6px;
  }

  .card-bottom-bar {
    padding: 4px 4px;
    min-height: 38px;
  }

  .card-bottom-bar .titulo {
    font-size: 0.68rem;
  }

  .card-bottom-bar .categoria {
    font-size: 0.58rem;
  }

  .numero-badge {
    top: 4px;
    left: 4px;
    padding: 1px 5px;
    font-size: 0.68rem;
  }

  .theme-pill-top {
    top: 4px;
    right: 4px;
    width: 11px;
    height: 11px;
  }

  .victory-stats-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Leaderboard Styles --- */
.leaderboard-modal-card {
  max-width: 660px;
  padding: 24px 20px 20px;
}

.leaderboard-header {
  text-align: center;
  margin-bottom: 16px;
}

.trophy-badge-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trophy-badge-icon svg {
  width: 100%;
  height: 100%;
}

.leaderboard-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--cor-verde);
  margin-bottom: 3px;
}

.leaderboard-subtitle {
  font-size: 0.85rem;
  color: #666666;
}

.leaderboard-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  background: #f1f4f0;
  padding: 4px;
  border-radius: 14px;
  border: 2px solid #000000;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 10px;
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  color: #333333;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: rgba(62, 120, 67, 0.15);
}

.tab-btn.active {
  background: var(--cor-verde);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.leaderboard-table-container {
  border: 2px solid #000000;
  border-radius: 12px;
  background: #ffffff;
  max-height: 380px;
  overflow-y: auto;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.04);
  margin-bottom: 18px;
}

.leaderboard-entries {
  display: flex;
  flex-direction: column;
}

.leaderboard-entry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #edf1eb;
  transition: background 0.15s ease;
}

.leaderboard-entry-row:last-child {
  border-bottom: none;
}

.leaderboard-entry-row:hover {
  background: #f8faf7;
}

.leaderboard-entry-row.newly-added {
  background: #eef8ee;
  border-left: 4px solid var(--cor-verde);
  animation: entryHighlight 2s ease infinite alternate;
}

@keyframes entryHighlight {
  from { background: #eef8ee; }
  to { background: #dff2e0; }
}

.entry-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rank-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  background: #f1f3f0;
  color: #111111;
}

.rank-badge.rank-1 {
  background: #FFD700;
  color: #000000;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.rank-badge.rank-2 {
  background: #D9D9D9;
  color: #000000;
}

.rank-badge.rank-3 {
  background: #E8A87C;
  color: #000000;
}

.entry-player-meta {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.entry-player-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111111;
  display: flex;
  align-items: center;
  gap: 6px;
}

.entry-mode-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  background: #eef2ed;
  border: 1px solid #000000;
  color: #333333;
  display: inline-block;
  margin-top: 2px;
}

.entry-right {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: right;
}

.entry-stats-sub {
  display: flex;
  flex-direction: column;
  font-size: 0.76rem;
  color: #666666;
}

.entry-stars {
  font-size: 0.75rem;
  color: #f59e0b;
}

.entry-score {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--cor-verde);
  min-width: 60px;
}

.leaderboard-empty {
  padding: 30px 16px;
  text-align: center;
  color: #666666;
  font-size: 0.9rem;
}

/* Victory Top 10 Prompt */
.victory-top10-container {
  background: #edf8ee;
  border: 2px solid var(--cor-verde);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 16px 0;
  text-align: center;
  box-shadow: 0 4px 12px rgba(62, 120, 67, 0.12);
}

.top10-badge {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cor-verde);
  margin-bottom: 10px;
}

.top10-input-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  max-width: 440px;
  margin: 0 auto;
}

.top10-input-row input {
  flex-grow: 1;
  border: 2px solid #000000;
  border-radius: 10px;
  padding: 8px 12px;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 700;
  color: #111111;
  outline: none;
}

.top10-input-row input:focus {
  border-color: var(--cor-verde);
  box-shadow: 0 0 0 2px rgba(62, 120, 67, 0.25);
}

.leaderboard-footer {
  text-align: center;
}

/* ==========================================================================
   2-PLAYER HEAD-TO-HEAD DUEL MODE STYLES
   ========================================================================== */

/* Header Player Mode Button */
.player-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  background: rgba(62, 120, 67, 0.08);
  border-color: var(--cor-verde);
  color: var(--cor-verde);
  font-weight: 700;
  font-size: 0.82rem;
  width: auto;
  min-width: 80px;
}

.player-mode-btn:hover {
  background: var(--cor-verde);
  color: #ffffff;
}

.player-mode-btn.active-2p {
  background: #F55803;
  border-color: #F55803;
  color: #ffffff;
}

.player-mode-text {
  font-size: 0.82rem;
  font-weight: 700;
}

/* 2-Player In-Game Arena Banner */
.two-player-arena-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  margin-bottom: 12px;
}

.player-duel-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  transition: all 0.25s ease;
  min-width: 0;
}

.player-duel-card.p1.active-turn {
  background: rgba(62, 120, 67, 0.09);
  border-color: #3E7843;
  box-shadow: 0 0 0 2px rgba(62, 120, 67, 0.2), 0 4px 12px rgba(62, 120, 67, 0.12);
  transform: translateY(-1px);
}

.player-duel-card.p2.active-turn {
  background: rgba(129, 97, 225, 0.09);
  border-color: #8161E1;
  box-shadow: 0 0 0 2px rgba(129, 97, 225, 0.2), 0 4px 12px rgba(129, 97, 225, 0.12);
  transform: translateY(-1px);
}

.duel-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  flex-shrink: 0;
  border: none;
}

.p1-avatar {
  background: #3E7843;
}

.p2-avatar {
  background: #8161E1;
}

.duel-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex-grow: 1;
}

.duel-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.duel-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #111111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.duel-turn-tag {
  display: none;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.p1.active-turn .duel-turn-tag {
  display: inline-block;
  background: #3E7843;
  color: #ffffff;
  animation: pulse-badge 1.6s infinite;
}

.p2.active-turn .duel-turn-tag {
  display: inline-block;
  background: #8161E1;
  color: #ffffff;
  animation: pulse-badge 1.6s infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.05); }
}

.duel-score-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #555555;
  margin-top: 2px;
}

.duel-pairs strong {
  color: #000000;
  font-size: 0.88rem;
}

.duel-wins strong {
  color: #000000;
  font-size: 0.88rem;
}

.duel-wins-divider {
  color: #aaa;
}

.duel-center-status {
  text-align: center;
  padding: 0 8px;
  flex-shrink: 0;
}

.duel-round-chip {
  display: inline-block;
  background: #000000;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
}

.duel-turn-prompt {
  font-size: 0.84rem;
  font-weight: 700;
  color: #111111;
  margin-top: 4px;
  white-space: nowrap;
}

/* Discovery Modal Player Badge */
.discovery-player-badge {
  background: #3E7843;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  border: 1.5px solid #000000;
}

.discovery-player-badge.p2-winner {
  background: #8161E1;
}

/* Game Type Modal */
.game-type-modal-card {
  max-width: 660px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header-block {
  text-align: center;
  margin-bottom: 16px;
}

.game-type-trophy-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(62, 120, 67, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  border: 2px solid #3E7843;
}

.modal-main-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--cor-verde);
  margin-bottom: 4px;
}

.modal-main-subtitle {
  font-size: 0.85rem;
  color: #555555;
  max-width: 500px;
  margin: 0 auto;
}

.mode-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.mode-selection-card {
  border: 2.5px solid #d5d5d5;
  border-radius: 14px;
  padding: 16px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.22s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

.mode-selection-card:hover {
  border-color: var(--cor-verde);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.mode-selection-card.active {
  border-color: #3E7843;
  background: rgba(62, 120, 67, 0.04);
  box-shadow: 0 0 0 3px rgba(62, 120, 67, 0.2);
}

.mode-selection-card.active-orange {
  border-color: #F55803;
  background: rgba(245, 88, 3, 0.04);
  box-shadow: 0 0 0 3px rgba(245, 88, 3, 0.2);
}

.mode-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.solo-icon {
  background: rgba(62, 120, 67, 0.12);
}

.duel-icon {
  background: rgba(245, 88, 3, 0.12);
}

.mode-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #111111;
  margin-bottom: 4px;
}

.mode-card-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--cor-verde);
  background: rgba(62, 120, 67, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
  align-self: flex-start;
  margin-bottom: 8px;
}

.mode-card-tag.tag-orange {
  color: #c24500;
  background: rgba(245, 88, 3, 0.12);
}

.mode-card-desc {
  font-size: 0.8rem;
  color: #666666;
  line-height: 1.35;
  flex-grow: 1;
  margin-bottom: 10px;
}

.mode-confirm-btn {
  margin-top: auto;
  padding: 8px 12px;
  font-size: 0.82rem;
}

/* 2-Player Setup Box inside Modal */
.two-player-setup-box {
  background: #fbfbfb;
  border: 2px solid #000000;
  border-radius: 14px;
  padding: 16px;
  margin-top: 12px;
}

.setup-header-divider {
  border-bottom: 2px solid #e5e5e5;
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.setup-header-divider h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111111;
}

.setup-row {
  margin-bottom: 14px;
}

.setup-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #333333;
  margin-bottom: 6px;
}

.player-names-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.input-player-group {
  display: flex;
  flex-direction: column;
}

.player-name-input {
  width: 100%;
  border: 2px solid #000000;
  border-radius: 10px;
  padding: 8px 12px;
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 700;
  color: #111111;
  outline: none;
}

.player-name-input.p1-border:focus {
  border-color: #3E7843;
  box-shadow: 0 0 0 2px rgba(62, 120, 67, 0.25);
}

.player-name-input.p2-border:focus {
  border-color: #8161E1;
  box-shadow: 0 0 0 2px rgba(129, 97, 225, 0.25);
}

.p-bullet {
  font-size: 0.68rem;
  font-weight: 700;
  color: #ffffff;
  padding: 1px 6px;
  border-radius: 6px;
}

.p1-bullet { background: #3E7843; }
.p2-bullet { background: #8161E1; }

.full-width-seg {
  width: 100%;
}

.full-width-seg .seg-btn {
  flex: 1;
  flex-direction: column;
  padding: 8px 10px;
  gap: 2px;
}

.seg-sub {
  font-size: 0.68rem;
  font-weight: normal;
  opacity: 0.75;
}

.setup-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.two-player-friendly-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1.5px solid #d5d5d5;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.78rem;
  color: #555555;
  line-height: 1.35;
}

.two-player-friendly-notice svg {
  flex-shrink: 0;
}

.btn-large-start {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 700;
}

/* 2-Player Result Dialog */
.duel-result-score-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 16px 0;
}

.duel-player-res {
  flex: 1;
  max-width: 220px;
  border: 2px solid #000000;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.duel-player-res.p1-res {
  background: rgba(62, 120, 67, 0.08);
  border-color: #3E7843;
}

.duel-player-res.p2-res {
  background: rgba(129, 97, 225, 0.08);
  border-color: #8161E1;
}

.duel-player-res.winner-pill {
  box-shadow: 0 0 0 3px #FFD700, 0 6px 16px rgba(0, 0, 0, 0.12);
}

.duel-res-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111111;
  margin-bottom: 4px;
}

.duel-res-pairs {
  font-size: 1.6rem;
  font-weight: 700;
  color: #111111;
  line-height: 1.1;
}

.duel-res-pairs small {
  font-size: 0.75rem;
  font-weight: normal;
  color: #555555;
}

.duel-res-wins {
  font-size: 0.78rem;
  font-weight: 700;
  color: #666666;
  margin-top: 4px;
}

.duel-vs-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #000000;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.duel-series-status {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--cor-verde);
  text-align: center;
  margin-top: 4px;
}

/* Responsive adjustments for 2-Player UI */
@media (max-width: 768px) {
  .mode-cards-grid {
    grid-template-columns: 1fr;
  }
  .player-names-row {
    grid-template-columns: 1fr;
  }
  .setup-row-grid {
    grid-template-columns: 1fr;
  }
  .two-player-arena-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
  }
  .duel-center-status {
    order: -1;
  }
}

