@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: 96vw;
  max-width: 1680px;
  margin: 0 auto;
  padding: 12px 16px 36px;
  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 18px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  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.66rem, 1.25vw, 0.8rem);
  font-weight: 700;
  letter-spacing: 1.4px;
  color: #111111;
  text-transform: uppercase;
}

.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.08);
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 5px 10px;
  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-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 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.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #222222;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  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);
}

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

/* ==========================================================================
   TEACHER CONTROL BAR
   ========================================================================== */
.control-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  margin-bottom: 18px;
}

/* Theme Filter Pills */
.theme-filter-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tema-filter-pill {
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 13px;
  border-radius: 10px;
  border: 2px solid rgba(0, 0, 0, 0.14);
  background: #ffffff;
  color: #1f1f1f;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.18s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.tema-filter-pill::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--pill-color, var(--cor-verde));
  border: 1px solid rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.tema-filter-pill:hover {
  transform: translateY(-1px);
  border-color: var(--pill-color, var(--cor-verde));
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.tema-filter-pill.active {
  background: var(--pill-color, var(--cor-verde));
  border-color: #000000;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow: 0 2px 0 #000000;
}

.tema-filter-pill.active::before {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.35);
}

.tema-pill-0 { --pill-color: var(--cor-verde); }
.tema-pill-1 { --pill-color: var(--tema-1-solid); border-color: rgba(248, 151, 0, 0.45); background: rgba(248, 151, 0, 0.08); }
.tema-pill-2 { --pill-color: var(--tema-2-solid); border-color: rgba(245, 88, 3, 0.45); background: rgba(245, 88, 3, 0.08); }
.tema-pill-3 { --pill-color: var(--tema-3-solid); border-color: rgba(129, 97, 225, 0.45); background: rgba(129, 97, 225, 0.08); }
.tema-pill-4 { --pill-color: var(--tema-4-solid); border-color: rgba(165, 113, 2, 0.45); background: rgba(165, 113, 2, 0.08); }
.tema-pill-5 { --pill-color: var(--tema-5-solid); border-color: rgba(44, 181, 53, 0.45); background: rgba(44, 181, 53, 0.08); }
.tema-pill-6 { --pill-color: var(--tema-6-solid); border-color: rgba(2, 132, 199, 0.45); background: rgba(2, 132, 199, 0.08); }
.tema-pill-7 { --pill-color: var(--tema-7-solid); border-color: rgba(206, 114, 183, 0.45); background: rgba(206, 114, 183, 0.08); }

/* Search & Action Controls Row */
.control-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}

.search-and-count {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1 1 320px;
}

.search-box-wrapper {
  position: relative;
  flex: 1 1 260px;
  max-width: 420px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #555555;
  pointer-events: none;
}

.card-search-input {
  width: 100%;
  font-family: var(--font-family);
  font-size: 0.86rem;
  font-weight: 400;
  color: #111111;
  background: #ffffff;
  border: 2px solid rgba(0, 0, 0, 0.16);
  border-radius: 12px;
  padding: 8px 34px 8px 36px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card-search-input:focus {
  border-color: var(--cor-verde);
  box-shadow: 0 0 0 3px rgba(62, 120, 67, 0.16);
}

.card-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.08);
  color: #333333;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search-clear-btn:hover {
  background: rgba(0, 0, 0, 0.18);
}

.cards-count-status {
  font-size: 0.8rem;
  font-weight: 700;
  color: #444444;
  background: rgba(62, 120, 67, 0.09);
  border: 1px solid rgba(62, 120, 67, 0.22);
  padding: 5px 11px;
  border-radius: 10px;
  white-space: nowrap;
}

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

/* Segmented View Mode Toggle */
.segmented-control {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.05);
  border: 1.5px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 3px;
  gap: 3px;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 7px 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.14);
}

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

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

.btn-primary:hover {
  background: #111111;
  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-escuro);
  border: 2px solid var(--cor-verde);
  border-radius: 12px;
  padding: 7px 14px;
  font-weight: 700;
  font-size: 0.84rem;
  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: 7px;
}

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

.btn-secondary:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--cor-verde);
}

.btn-print-pdf {
  padding: 9px 18px;
  font-size: 0.88rem;
  letter-spacing: 0.2px;
}

/* ==========================================================================
   BOARD CONTAINER & INTERACTIVE 3D EXPLORER GRID
   ========================================================================== */
.board-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 0 auto;
  padding: 4px 0 20px;
}

.explorer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 18px;
  width: 100%;
  perspective: 1400px;
}

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

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease;
  box-shadow: var(--card-shadow);
  border: 3px solid #000000;
  border-radius: 15px;
}

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

.card-slot.flipped .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;
}

/* Top-Right Inspect / Magnifier Button */
.card-inspect-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 12;
  pointer-events: auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #000000;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  line-height: 1;
  transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.card-inspect-btn:hover {
  transform: scale(1.12);
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
}

.card-inspect-btn:active {
  transform: scale(0.96);
}

/* Card Faces (Default: Visual Front at 0deg, Knowledge Verso at 180deg) */
.card-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.visual-front {
  transform: rotateY(0deg);
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
}

.knowledge-verso {
  transform: rotateY(180deg);
  background-color: #ffffff;
}

/* Visual Card Layout (Artwork + #badge + bottom bar) */
.visual-card {
  position: relative;
  background-color: #ffffff;
  overflow: hidden;
}

.visual-card .capa {
  position: absolute;
  inset: 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;
  display: block;
}

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

.numero-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background-color: #ffffff;
  padding: 2px 8px;
  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;
}

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

.card-bottom-bar .titulo {
  font-size: clamp(0.75rem, 1.05vw, 0.88rem);
  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.68rem;
  color: #ffffff;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Knowledge Card Layout (Verso) */
.knowledge-card {
  background: #ffffff;
  padding: 9px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  height: 100%;
  box-sizing: border-box;
}

.knowledge-header {
  padding: 6px 8px;
  border-radius: 8px;
  border-bottom: 2px solid #000000;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}

.card-slot .knowledge-header {
  padding-right: 36px;
}

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

.knowledge-header .val-symbol {
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
  color: #000000;
  background: rgba(255, 255, 255, 0.96);
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid #000000;
}

.knowledge-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 3px;
  gap: 6px;
  overflow: hidden;
}

.knowledge-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.72rem;
  line-height: 1.32;
  color: #111111;
  font-weight: 400;
}

.knowledge-desc-bullet {
  margin: 0;
}

.knowledge-fact-bullet {
  margin: 0;
  background: #f4faf4;
  border-left: 3px solid var(--cor-verde);
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  line-height: 1.28;
  color: #192d1b;
}

.knowledge-fact-bullet strong {
  color: var(--cor-verde-escuro);
}

.knowledge-footer {
  padding: 5px 2px 1px;
  border-top: 1.5px solid rgba(0, 0, 0, 0.16);
  font-size: 0.6rem;
  line-height: 1.2;
  font-weight: 700;
  color: #444444;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Theme Colors for Bars & Headers */
.tema_1 .card-bottom-bar,
.tema_1.knowledge-header,
.discovery-tag.tema_1 {
  background-color: var(--tema-1);
}

.tema_2 .card-bottom-bar,
.tema_2.knowledge-header,
.discovery-tag.tema_2 {
  background-color: var(--tema-2);
}

.tema_3 .card-bottom-bar,
.tema_3.knowledge-header,
.discovery-tag.tema_3 {
  background-color: var(--tema-3);
}

.tema_4 .card-bottom-bar,
.tema_4.knowledge-header,
.discovery-tag.tema_4 {
  background-color: var(--tema-4);
}

.tema_5 .card-bottom-bar,
.tema_5.knowledge-header,
.discovery-tag.tema_5 {
  background-color: var(--tema-5);
}

.tema_6 .card-bottom-bar,
.tema_6.knowledge-header,
.discovery-tag.tema_6 {
  background-color: var(--tema-6);
}

.tema_7 .card-bottom-bar,
.tema_7.knowledge-header,
.discovery-tag.tema_7 {
  background-color: var(--tema-7);
}

/* ==========================================================================
   SIDE-BY-SIDE VIEW (ON SCREEN)
   ========================================================================== */
.side-by-side-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(520px, 1fr));
  gap: 22px;
  width: 100%;
}

.print-pair-box {
  border: 2px dashed #555555;
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.print-pair-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: stretch;
}

.print-card {
  width: 100%;
  aspect-ratio: 68 / 89;
  border: 3px solid #000000;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.print-fold-line {
  width: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.print-fold-line::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  border-left: 2px dashed #666666;
}

.print-fold-label {
  position: relative;
  z-index: 1;
  background: #ffffff;
  color: #555555;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 2px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  text-transform: uppercase;
}

/* Empty State */
.empty-search-state {
  width: 100%;
  max-width: 480px;
  margin: 40px auto;
  padding: 32px 24px;
  background: rgba(255, 255, 255, 0.94);
  border: 2px dashed rgba(62, 120, 67, 0.45);
  border-radius: 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.empty-search-state p {
  font-size: 0.95rem;
  font-weight: 700;
  color: #333333;
}

/* ==========================================================================
   MODALS (CLASSROOM DISCOVERY & TEACHER GUIDE)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s 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: 660px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  transform: scale(0.94) translateY(14px);
  transition: transform 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.2);
}

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

.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  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.15rem;
  z-index: 10;
  transition: all 0.2s ease;
}

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

/* Discovery Classroom Modal */
.discovery-modal-card {
  max-width: 720px;
}

.discovery-content {
  padding: 22px 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;
  padding-right: 38px;
}

.discovery-badges-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.discovery-num-pill {
  background: #111111;
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 700;
}

.discovery-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 14px;
  border: 2px solid #000000;
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.discovery-country-pill {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--cor-verde-escuro);
  background: rgba(62, 120, 67, 0.1);
  border: 1.5px solid rgba(62, 120, 67, 0.35);
  padding: 4px 10px;
  border-radius: 12px;
}

.discovery-body {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 26px;
  align-items: center;
}

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

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

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

.discovery-meta {
  font-size: 0.85rem;
  color: #555555;
  font-weight: 700;
}

.discovery-desc {
  font-size: 0.94rem;
  line-height: 1.48;
  color: #222222;
}

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

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

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

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

.discovery-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-sm-nav {
  padding: 7px 12px;
  font-size: 0.82rem;
}

/* Teacher Guide / Info Modal */
.info-modal-content {
  padding: 24px;
}

.info-modal-title {
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--cor-verde);
  margin-bottom: 14px;
  padding-right: 34px;
}

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

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

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

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1100px) {
  .side-by-side-board {
    grid-template-columns: 1fr;
  }

  .print-pair-box {
    max-width: 680px;
    margin: 0 auto;
    width: 100%;
  }
}

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

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

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

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

  .explorer-grid {
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 12px;
  }

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

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

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

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

  .explorer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

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

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

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

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

  .card-inspect-btn {
    top: 5px;
    right: 5px;
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
  }

  .knowledge-card {
    padding: 6px;
  }

  .knowledge-header {
    padding: 4px 6px;
  }

  .card-slot .knowledge-header {
    padding-right: 30px;
  }

  .knowledge-header .val-badge {
    font-size: 0.54rem;
  }

  .knowledge-header .val-symbol {
    font-size: 0.64rem;
    padding: 2px 4px;
  }

  .knowledge-text {
    font-size: 0.61rem;
    line-height: 1.24;
    gap: 4px;
  }

  .knowledge-fact-bullet {
    font-size: 0.58rem;
    padding: 3px 4px;
  }

  .knowledge-footer {
    font-size: 0.52rem;
  }

  .control-buttons-group {
    width: 100%;
    justify-content: stretch;
  }

  .control-buttons-group > * {
    flex: 1 1 auto;
  }

  .view-mode-toggle {
    justify-content: center;
  }

  .print-pair-box {
    padding: 8px;
  }

  .print-pair-inner {
    gap: 4px;
  }

  .print-fold-line {
    width: 12px;
  }

  .print-fold-label {
    font-size: 0.5rem;
  }
}

/* ==========================================================================
   PRINT & PDF EXPORT LAYOUT (A4 PORTRAIT, 2 SIDE-BY-SIDE PAIRS PER PAGE)
   ========================================================================== */
@page {
  size: A4 portrait;
  margin: 10mm;
}

@media print {
  * {
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
  }

  html,
  body {
    background: #ffffff !important;
    background-image: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    min-height: auto !important;
  }

  .top-header,
  .control-bar,
  #flip-grid-board,
  #empty-search-state,
  .modal-overlay {
    display: none !important;
  }

  .app-wrapper,
  .board-container {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
  }

  #side-by-side-board {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 10mm !important;
    width: 100% !important;
  }

  .print-pair-box {
    width: 176mm !important;
    max-width: none !important;
    margin: 0 auto !important;
    padding: 4.5mm !important;
    border: 1.2pt dashed #444444 !important;
    border-radius: 4mm !important;
    background: #ffffff !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .print-pair-box:nth-child(2n) {
    page-break-after: always !important;
    break-after: page !important;
  }

  .print-pair-box:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  .print-pair-inner {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0 !important;
  }

  .print-card {
    width: 78mm !important;
    height: 102mm !important;
    flex: 0 0 78mm !important;
    aspect-ratio: auto !important;
    border: 2pt solid #000000 !important;
    border-radius: 3.5mm !important;
    box-shadow: none !important;
  }

  .print-fold-line {
    width: 8mm !important;
    height: 102mm !important;
    flex: 0 0 8mm !important;
  }

  .print-fold-line::before {
    border-left: 1.2pt dashed #555555 !important;
  }

  .print-fold-label {
    font-size: 6pt !important;
    padding: 2mm 0.5mm !important;
  }

  /* Crisp Typography Inside Printable Visual Card */
  .print-card .numero-badge {
    top: 2.5mm !important;
    left: 2.5mm !important;
    font-size: 8.5pt !important;
    padding: 0.6mm 2.2mm !important;
  }

  .print-card .card-bottom-bar {
    padding: 2.2mm 2.5mm !important;
    min-height: 13mm !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .print-card .card-bottom-bar .titulo {
    font-size: 9pt !important;
    line-height: 1.15 !important;
  }

  .print-card .card-bottom-bar .categoria {
    font-size: 7pt !important;
  }

  /* Crisp Typography Inside Printable Knowledge Verso */
  .print-card.knowledge-card {
    padding: 2.8mm !important;
  }

  .print-card .knowledge-header {
    padding: 2mm 2.4mm !important;
    border-radius: 2mm !important;
  }

  .print-card .knowledge-header .val-badge {
    font-size: 6.8pt !important;
  }

  .print-card .knowledge-header .val-symbol {
    font-size: 8.2pt !important;
    padding: 0.8mm 1.8mm !important;
  }

  .print-card .knowledge-body {
    padding: 2mm 1mm !important;
  }

  .print-card .knowledge-text {
    font-size: 8pt !important;
    line-height: 1.32 !important;
    gap: 2mm !important;
  }

  .print-card .knowledge-fact-bullet {
    font-size: 7.4pt !important;
    line-height: 1.28 !important;
    padding: 1.4mm 2mm !important;
  }

  .print-card .knowledge-footer {
    font-size: 6.4pt !important;
    padding-top: 1.4mm !important;
  }
}



/* ==========================================================================
   CATEGORY TITLE CARDS (#1, #8, #15, #22, #29, #36, #43), BULLET SPACING & LINKS
   ========================================================================== */
.title-visual-card .title-card-capa {
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 10px 54px;
}

.title-visual-card .title-card-capa img {
  width: 100%;
  height: 100%;
  object-fit: contain !important;
  object-position: center center !important;
}

.knowledge-desc-heading,
.discovery-desc-heading {
  font-weight: 700;
  font-size: 0.72rem;
  color: #000000;
  margin-bottom: 4px;
}

.discovery-desc-heading {
  font-size: 0.96rem;
  margin-bottom: 8px;
}

/* Well-spaced bullet list for easy reading on Verso & Classroom Modal */
.knowledge-bullet-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.knowledge-bullet-list .knowledge-desc-bullet {
  position: relative;
  padding-left: 13px;
  margin: 0;
  line-height: 1.32;
}

.knowledge-bullet-list .knowledge-desc-bullet::before {
  content: '•';
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 700;
  color: var(--cor-verde-escuro);
}

.discovery-desc .knowledge-bullet-list {
  gap: 10px;
  margin-bottom: 4px;
  padding-left: 6px;
}

.discovery-desc .knowledge-bullet-list .knowledge-desc-bullet {
  padding-left: 18px;
  font-size: 0.94rem;
  line-height: 1.5;
}

.knowledge-body {
  justify-content: flex-start;
  overflow-y: auto;
  padding: 6px 3px;
  pointer-events: auto;
}

.knowledge-text {
  font-size: 0.65rem;
  line-height: 1.3;
  gap: 6px;
}

.knowledge-fact-bullet {
  font-size: 0.62rem;
  line-height: 1.26;
  padding: 4px 6px;
  margin-top: 3px;
}

.knowledge-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 2px 1px;
  border-top: 1.5px solid rgba(0, 0, 0, 0.16);
  font-size: 0.58rem;
  line-height: 1.2;
  font-weight: 700;
  color: #444444;
  text-transform: uppercase;
  flex-shrink: 0;
}

.knowledge-footer-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Authentic Interactive Link Pills (Matching Original www.riu.advancis.pt) */
.knowledge-links-row,
.discovery-links-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
  pointer-events: auto;
}

.discovery-links-row {
  width: 100%;
  margin-top: 6px;
  justify-content: flex-end;
}

.card-slot .riu-link-pill,
.card-slot .riu-link-pill * {
  pointer-events: auto !important;
}

.riu-link-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 12px;
  background-color: #ffffff;
  color: #000000;
  border: 2px solid #000000;
  border-radius: 16px;
  font-family: var(--font-family);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.14);
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.18s ease;
  cursor: pointer;
}

.discovery-links-row .riu-link-pill {
  font-size: 0.88rem;
}

.riu-link-pill:hover {
  background-color: #8A3FCA;
  color: #ffffff;
  border-color: #000000;
  text-decoration: none;
  transform: translateY(-1px);
}

.riu-link-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.discovery-links-row .riu-link-icon {
  width: 18px;
  height: 18px;
}

@media print {
  .print-card .knowledge-body {
    overflow: hidden !important;
  }
  .print-card .knowledge-desc-heading {
    font-size: 7.4pt !important;
    margin-bottom: 0.8mm !important;
  }
  .print-card .knowledge-text {
    font-size: 7.1pt !important;
    line-height: 1.24 !important;
    gap: 1.2mm !important;
  }
  .print-card .knowledge-bullet-list {
    gap: 1.1mm !important;
  }
  .print-card .knowledge-fact-bullet {
    font-size: 6.7pt !important;
    line-height: 1.18 !important;
    padding: 1mm 1.5mm !important;
  }
  .knowledge-links-row,
  .riu-link-pill {
    display: none !important;
  }
}
