/* ==========================================================================
   ESTILOS UNIFICADOS - ACADEMIA TAROT PRAGMÁTICO
   ========================================================================== */

:root {
  /* Variables visuales de tu web principal */
  --bg: #f6f0e7;
  --surface: rgba(255,255,255,0.72);
  --text: #2b211c;
  --muted: #69564d;
  --line: rgba(75,50,34,0.15);
  --accent: #8a5a3b;
  --accent-dark: #6f4328;
  --shadow: 0 18px 45px rgba(68,43,25,0.12);
  --radius: 24px;

  /* VARIABLES CRÍTICAS: Evitan que las cartas se vuelvan gigantes */
  --card-w: clamp(92px, 18vw, 130px);
  --card-h: calc(var(--card-w) * 1.42);
  --gap: 14px;
}

/* Base general */
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  text-align: center;
  min-height: 100vh;
}

/* Textura suave estilo pergamino */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1100px 700px at 50% -10%, rgba(255,255,255,0.35), transparent 60%),
    radial-gradient(900px 700px at 20% 30%, rgba(120,90,40,0.10), transparent 55%),
    radial-gradient(900px 700px at 80% 40%, rgba(120,90,40,0.08), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,0.25) 0%, rgba(0,0,0,0.02) 100%);
}

h1, h2, h3, h4 {
  font-family: 'Cormorant Garamond', serif;
}

.wrap {
  width: min(calc(100% - 2rem), 980px);
  margin: auto;
  padding: 26px 16px 30px;
}

.brand-logo {
  width: 140px;
  height: auto;
  display: block;
  margin: 0 auto 10px;
}

/* BARRA DE USUARIO SUPERIOR */
.user-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--accent-dark);
  color: #fff;
  padding: 10px 24px;
  font-size: 14px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.logout-btn {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background: #fff;
  color: var(--accent-dark);
}

/* DASHBOARD MACRO GLOBAL NUEVO */
.quiz-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  max-width: 600px;
  margin: 0 auto 20px;
}

.dashboard-card {
  background: rgba(255, 255, 255, 0.6);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 10px rgba(0,0,0,0.02);
  text-align: center;
}

.dashboard-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.dashboard-card strong {
  display: block;
  font-size: 18px;
  color: var(--accent-dark);
  margin-top: 4px;
}

/* Controles y Botones Segmentados */
.segmented {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.seg-btn {
  display: inline-block;
  text-decoration: none;
  padding: 10px 14px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.55);
  color: var(--text);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s ease;
}

.seg-btn.is-active {
  background: rgba(255,255,255,.9);
  border-color: var(--accent);
  font-weight: 500;
}

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

button {
  padding: 10px 14px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.55);
  color: var(--text);
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent-dark);
  font-weight: 700;
}

button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* El Tablero Mesa */
.board {
  margin-top: 18px;
  position: relative;
}

.start-image {
  position: relative;
  z-index: 5;
  margin: 16px auto 8px;
  width: min(260px, 55vw);
  transition: opacity .45s ease, transform .45s ease;
}

.start-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.start-image.is-hidden {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  height: 0;
  margin: 0;
  overflow: hidden;
}

.board-hint {
  position: relative;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  font-size: 13px;
}

/* CONTROL DE REJILLA Y CARTAS */
.grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: var(--gap);
  justify-content: center;
  margin-top: 12px;
  padding: 18px 12px 12px;
}

.card {
  width: var(--card-w) !important;
  height: var(--card-h) !important;
  border-radius: 12px;
  background: transparent !important;
  border: none !important;
  box-shadow: 0 14px 34px rgba(68,43,25,0.20);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  perspective: 800px;
  padding: 0 !important;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 420ms ease;
}

.card.is-revealed .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
}

.card-front { transform: rotateY(0deg); }
.card-back { transform: rotateY(180deg); }

.grid.is-shuffling {
  animation: shuffleShake 520ms ease-in-out;
}

@keyframes shuffleShake {
  0% { transform: translateY(0); }
  20% { transform: translateY(-2px) rotate(-0.6deg); }
  50% { transform: translateY(1px) rotate(0.7deg); }
  80% { transform: translateY(-1px) rotate(-0.4deg); }
  100% { transform: translateY(0); }
}

.card.is-highlight {
  box-shadow: 0 0 0 2px var(--accent), 0 14px 34px rgba(0,0,0,.20);
  transform: translateY(-2px);
}

.card-number-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  background-color: rgba(0, 0, 0, 0.75);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  z-index: 10;
  pointer-events: none;
}

/* Estilos de la Academia */
.tab-container {
  display: flex;
  justify-content: center;
  margin-bottom: 25px;
}

.quiz-box {
  width: 100%;
  max-width: 600px;
  margin: 20px auto 0;
  padding: 30px 24px;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.quiz-options-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
  width: 100%;
}

.quiz-option-btn {
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  font-size: 15px;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.6);
  transition: all 0.2s ease;
}

.quiz-option-btn:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
}

.quiz-progress-container {
  width: 100%;
  height: 8px;
  background: rgba(75, 50, 34, 0.1);
  border-radius: 4px;
  margin-bottom: 20px;
  overflow: hidden;
}

.quiz-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* Scrollbar estilizada para el historial de errores */
.pdf-report-history::-webkit-scrollbar {
  width: 6px;
}
.pdf-report-history::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

.footer {
  margin-top: 30px;
  color: var(--muted);
  font-size: 13px;
}