/**
 * Horóscopo maya y oráculo del Kin Tzolk'in — Estilos canónicos
 * Diseño estético Midnight Slate con acentos sagrados mayas (Rojo, Blanco, Azul, Amarillo),
 * Cruz Maya adaptativa en rejilla 3x3, glifos vectoriales nítidos y modo claro/oscuro.
 */

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Colores sagrados del Tzolk'in */
  --maya-red: #ef4444;
  --maya-red-bg: rgba(239, 68, 68, 0.12);
  --maya-red-border: rgba(239, 68, 68, 0.35);

  --maya-white: #f8fafc;
  --maya-white-bg: rgba(248, 250, 252, 0.08);
  --maya-white-border: rgba(248, 250, 252, 0.3);

  --maya-blue: #3b82f6;
  --maya-blue-bg: rgba(59, 130, 246, 0.12);
  --maya-blue-border: rgba(59, 130, 246, 0.35);

  --maya-yellow: #eab308;
  --maya-yellow-bg: rgba(234, 179, 8, 0.12);
  --maya-yellow-border: rgba(234, 179, 8, 0.35);

  --maya-gold: #f59e0b;
  --maya-gold-glow: rgba(245, 158, 11, 0.25);

  /* Paleta base oscura (Midnight Slate) */
  --bg-page: #0b0f17;
  --bg-card: #131b26;
  --bg-card-hover: #192433;
  --bg-card-elevated: #1a2536;
  --border-subtle: #202c3d;
  --border-focus: #3b82f6;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.45);
}

/* Modo claro (conmutado por tema corporativo) */
[data-theme="light"], body.light-theme {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-card-elevated: #f8fafc;
  --border-subtle: #e2e8f0;
  --border-focus: #2563eb;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.08);

  --maya-white: #334155;
  --maya-white-bg: rgba(51, 65, 85, 0.08);
  --maya-white-border: rgba(51, 65, 85, 0.25);
}

/* Reglas de contención global obligatorias */
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
  width: 100%;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* Tarjetas y módulos generales */
.tool-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-card);
}

.section-hero-header {
  margin-bottom: 1.5rem;
}

.section-hero-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--text-main);
}

.section-hero-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.5;
}

/* Selector interactivo de fecha y controles */
.maya-controls-box {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.controls-row-top {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}

.control-field {
  flex: 1 1 240px;
}

.control-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.date-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-date-custom {
  width: 100%;
  height: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 0 0.85rem;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-date-custom:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Selector de sistema (Dreamspell vs Tradicional) */
.system-switch-wrap {
  flex: 1 1 300px;
}

.system-radio-group {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}

.system-radio-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text-muted);
  transition: background-color 0.2s, color 0.2s;
  user-select: none;
  min-height: 38px;
  box-sizing: border-box;
}

.system-radio-label input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.system-radio-label:has(input:checked) {
  background: var(--border-focus);
  color: #ffffff;
}

/* Barra de presets de fecha */
.presets-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.presets-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-right: 0.25rem;
}

.btn-preset-date {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 12px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
  min-height: 36px;
}

.btn-preset-date:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-focus);
}

/* Barra de sonido ceremonial y acciones */
.audio-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

.sound-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 38px;
}

.sound-toggle-btn:hover {
  border-color: var(--maya-gold);
  color: var(--maya-gold);
}

.sound-toggle-btn.is-muted {
  color: var(--text-dim);
}

.btn-sound-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  color: var(--maya-gold);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 38px;
}

.btn-sound-action:hover {
  background: rgba(245, 158, 11, 0.22);
}

/* Tarjeta principal de resultado del Kin */
.kin-hero-card {
  position: relative;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-elevated) 100%);
  border: 2px solid var(--border-subtle);
  border-radius: 18px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.kin-hero-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.kin-badge-kin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--maya-gold);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 20px;
}

.kin-gap-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(147, 51, 234, 0.15);
  border: 1px solid rgba(147, 51, 234, 0.4);
  color: #c084fc;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kin-glyph-hero {
  width: 96px;
  height: 96px;
  min-width: 96px;
  border-radius: 20px;
  padding: 10px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.35);
  transition: transform 0.3s;
}

.kin-glyph-hero:hover {
  transform: scale(1.04);
}

.kin-glyph-hero svg {
  width: 100%;
  height: 100%;
}

.kin-hero-info {
  flex: 1 1 300px;
}

.kin-result-heading {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 0.35rem 0;
  letter-spacing: -0.5px;
}

.kin-result-subheading {
  font-size: 1rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem 0;
  font-family: var(--font-mono);
}

.kin-hero-archetype {
  display: inline-block;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Notación maya de puntos y barras */
.maya-tone-glyph {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.maya-dots-row {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
}

.maya-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
}

.maya-bars-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.maya-bar {
  display: block;
  height: 4px;
  width: 32px;
  background-color: currentColor;
  border-radius: 2px;
}

/* Afirmación sagrada */
.kin-quote-box {
  background: rgba(0, 0, 0, 0.25);
  border-left: 4px solid var(--border-focus);
  border-radius: 0 12px 12px 0;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.kin-quote-text {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-style: italic;
  line-height: 1.6;
  margin: 0;
  color: var(--text-main);
}

/* Rejilla de atributos */
.kin-attributes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.kin-attr-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1rem;
}

.attr-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

.attr-val {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Colores sagrados del Tzolk'in */
.color-rojo {
  color: var(--maya-red);
}
.kin-glyph-hero.color-rojo, .cross-cell.color-rojo, .modal-glyph-large.color-rojo {
  background: var(--maya-red-bg);
  border-color: var(--maya-red-border);
  color: var(--maya-red);
}

.color-blanco {
  color: var(--maya-white);
}
.kin-glyph-hero.color-blanco, .cross-cell.color-blanco, .modal-glyph-large.color-blanco {
  background: var(--maya-white-bg);
  border-color: var(--maya-white-border);
  color: var(--maya-white);
}

.color-azul {
  color: var(--maya-blue);
}
.kin-glyph-hero.color-azul, .cross-cell.color-azul, .modal-glyph-large.color-azul {
  background: var(--maya-blue-bg);
  border-color: var(--maya-blue-border);
  color: var(--maya-blue);
}

.color-amarillo {
  color: var(--maya-yellow);
}
.kin-glyph-hero.color-amarillo, .cross-cell.color-amarillo, .modal-glyph-large.color-amarillo {
  background: var(--maya-yellow-bg);
  border-color: var(--maya-yellow-border);
  color: var(--maya-yellow);
}

/* Oráculo de la Cruz Maya (La Quinta Fuerza) */
.oracle-cross-section {
  margin-top: 2.5rem;
}

.oracle-cross-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 2rem;
}

.maya-cross-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, auto);
  grid-template-areas:
    ". guide ."
    "antipode destiny analog"
    ". occult .";
  gap: 1.25rem;
  max-width: 760px;
  margin: 0 auto;
}

.cross-guide { grid-area: guide; }
.cross-antipode { grid-area: antipode; }
.cross-destiny { grid-area: destiny; }
.cross-analog { grid-area: analog; }
.cross-occult { grid-area: occult; }

.cross-cell {
  position: relative;
  border: 2px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
  box-shadow: var(--shadow-card);
  user-select: none;
}

.cross-cell:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px -4px rgba(0, 0, 0, 0.4);
}

.cross-cell:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 3px;
}

.cross-cell.is-destiny-cell {
  border-width: 3px;
  border-color: var(--maya-gold);
  box-shadow: 0 0 25px var(--maya-gold-glow);
  transform: scale(1.02);
}

.cross-cell.is-destiny-cell:hover {
  transform: scale(1.05) translateY(-3px);
}

.cell-role-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.cell-glyph-wrapper {
  width: 64px;
  height: 64px;
  margin-bottom: 0.5rem;
}

.cell-glyph-wrapper svg {
  width: 100%;
  height: 100%;
}

.cell-tone-glyph {
  margin-bottom: 0.4rem;
}

.cell-kin-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.2);
  padding: 3px 8px;
  border-radius: 12px;
  margin-bottom: 0.35rem;
}

.cell-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  color: var(--text-main);
}

.cell-maya-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.cell-action-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Onda Encantada de 13 días */
.wavespell-header {
  margin-bottom: 1.25rem;
}

.wavespell-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.35rem 0;
  color: var(--text-main);
}

.wavespell-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0;
  line-height: 1.5;
}

.wavespell-strip-scroll {
  overflow-x: auto;
  padding: 0.75rem 0.25rem 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

.wavespell-strip-scroll::-webkit-scrollbar {
  height: 8px;
}

.wavespell-strip-scroll::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

.wavespell-track {
  display: flex;
  gap: 1rem;
  min-width: min-content;
}

.wavespell-step-card {
  position: relative;
  flex: 0 0 130px;
  width: 130px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1rem 0.75rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--shadow-card);
}

.wavespell-step-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-focus);
}

.wavespell-step-card.is-user-step {
  border: 2px solid var(--maya-gold);
  background: linear-gradient(180deg, var(--bg-card-elevated) 0%, rgba(245, 158, 11, 0.08) 100%);
  box-shadow: 0 0 15px var(--maya-gold-glow);
}

.user-step-pill {
  position: absolute;
  top: -9px;
  background: var(--maya-gold);
  color: #000000;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.step-tone-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

.step-tone-icon {
  margin-bottom: 0.5rem;
}

.step-glyph {
  width: 44px;
  height: 44px;
  margin-bottom: 0.5rem;
}

.step-glyph svg {
  width: 100%;
  height: 100%;
}

.step-kin-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.step-name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.step-tone-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.step-action-tag {
  font-size: 0.7rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.4rem;
  width: 100%;
}

/* Glosario interactivo con buscador */
.glossary-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.glossary-search-input {
  width: 100%;
  height: 44px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 0.95rem;
  padding: 0 1rem;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.glossary-search-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.glossary-tabs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.glossary-tab-btn {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 38px;
}

.glossary-tab-btn:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
}

.glossary-tab-btn.is-active {
  background: var(--border-focus);
  color: #ffffff;
  border-color: var(--border-focus);
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.glossary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--shadow-card);
}

.glossary-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-focus);
}

.glossary-card-header {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.card-num-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
}

.card-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-card-elevated);
}

.glossary-glyph-box {
  width: 56px;
  height: 56px;
  margin-bottom: 0.75rem;
}

.glossary-glyph-box svg {
  width: 100%;
  height: 100%;
}

.glossary-tone-glyph {
  margin-bottom: 0.75rem;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.glossary-card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: var(--text-main);
}

.glossary-card-maya {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.glossary-card-keywords {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.5rem;
  width: 100%;
}

.glossary-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

/* Barra inferior de acciones del informe */
.report-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  margin: 2rem 0;
}

.btn-report-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 44px;
  padding: 0 1.5rem;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-copy-main {
  background: var(--border-focus);
  color: #ffffff;
}

.btn-copy-main:hover {
  background: #1d4ed8;
}

.btn-copy-main.btn-copied {
  background: #10b981;
}

.btn-print-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-print-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

/* Modales accesibles */
.maya-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
  box-sizing: border-box;
}

.maya-modal-overlay.is-visible {
  display: flex;
}

.maya-modal-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  width: 100%;
  max-width: 620px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.maya-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.modal-title-wrap {
  flex: 1;
}

.modal-badge-role {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--maya-gold);
  margin-bottom: 0.25rem;
}

.modal-main-heading {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-main);
}

.modal-close-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.maya-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-glyph-hero-row {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.modal-glyph-large {
  width: 80px;
  height: 80px;
  min-width: 80px;
  border-radius: 16px;
  padding: 8px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-glyph-large svg {
  width: 100%;
  height: 100%;
}

.modal-meta-box {
  flex: 1;
}

.modal-role-explanation {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem 0;
  line-height: 1.5;
}

.modal-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.modal-tag {
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 3px 8px;
  color: var(--text-muted);
}

.modal-tag.tag-gap {
  background: rgba(147, 51, 234, 0.15);
  border-color: rgba(147, 51, 234, 0.4);
  color: #c084fc;
}

.modal-section-card {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

.modal-section-card h4 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--text-main);
}

.modal-section-card p {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-section-card p:last-child {
  margin-bottom: 0;
}

.modal-quote {
  font-style: italic;
  font-size: 1.05rem;
  color: var(--text-main);
  margin: 0;
  line-height: 1.5;
}

.modal-grid-duo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.modal-subcard {
  border-radius: 12px;
  padding: 1rem;
}

.modal-subcard h5 {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0 0 0.35rem 0;
}

.modal-subcard p {
  font-size: 0.85rem;
  line-height: 1.45;
  margin: 0;
}

.subcard-light {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.subcard-light h5 { color: #34d399; }
.subcard-light p { color: var(--text-main); }

.subcard-shadow {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.subcard-shadow h5 { color: #f87171; }
.subcard-shadow p { color: var(--text-main); }

.modal-question-box {
  background: var(--bg-card);
  border-left: 3px solid var(--maya-gold);
  padding: 0.5rem 0.75rem;
  border-radius: 0 6px 6px 0;
  font-style: italic;
  color: var(--text-main) !important;
}

/* Guía de contenido y SEO */
.seo-guide-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  line-height: 1.65;
}

.seo-guide-section h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 1rem 0;
  color: var(--text-main);
}

.seo-guide-section h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.5rem 0 0.75rem 0;
  color: var(--text-main);
}

.seo-guide-section p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 1rem 0;
}

.seo-guide-section ul, .seo-guide-section ol {
  color: var(--text-muted);
  font-size: 0.95rem;
  padding-left: 1.5rem;
  margin: 0 0 1rem 0;
}

.seo-guide-section li {
  margin-bottom: 0.4rem;
}

/* Acordeón FAQ accesible */
.faq-accordion-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.faq-item {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
}

.faq-summary {
  padding: 1.15rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-main);
  transition: background-color 0.2s;
  user-select: none;
}

.faq-summary::-webkit-details-marker {
  display: none;
}

.faq-summary::after {
  content: "+";
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--text-dim);
  transition: transform 0.25s;
}

.faq-item[open] .faq-summary::after {
  transform: rotate(45deg);
}

.faq-content {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* Adaptación responsive en móviles */
@media (max-width: 768px) {
  .tool-layout {
    padding: 0 0.75rem;
    margin: 1rem auto 2rem;
  }

  .tool-section-card {
    padding: 1.25rem;
  }

  .kin-hero-card {
    padding: 1.25rem;
  }

  .kin-result-heading {
    font-size: 1.5rem;
  }

  .maya-cross-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "destiny"
      "guide"
      "analog"
      "antipode"
      "occult";
    gap: 1rem;
  }

  .cross-cell {
    padding: 1rem;
  }

  .cross-cell.is-destiny-cell {
    transform: none;
  }

  .controls-row-top {
    flex-direction: column;
    gap: 1rem;
  }

  .control-field, .system-switch-wrap {
    width: 100%;
    flex: 1 1 100%;
  }

  .presets-bar {
    justify-content: flex-start;
  }

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

  .btn-sound-action, .sound-toggle-btn {
    justify-content: center;
  }

  .report-actions-row {
    flex-direction: column;
    width: 100%;
  }

  .btn-report-action {
    width: 100%;
    justify-content: center;
  }
}

/* Hoja de impresión limpia */
@media print {
  .app-header,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .fijate-footer,
  .audio-actions-bar,
  .report-actions-row,
  .presets-bar,
  .system-switch-wrap,
  .glossary-controls {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .tool-layout {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .tool-section-card, .kin-hero-card, .cross-cell {
    box-shadow: none !important;
    border: 1px solid #cccccc !important;
    background: #ffffff !important;
    color: #000000 !important;
    break-inside: avoid;
  }

  .kin-result-heading, .cell-title {
    color: #000000 !important;
  }
}
