/* ═══════════════════════════════════════════════════════
   🔮 TarotAI v18.0 — ARCANUM EDITION
   Estilos de ARBOR (Árbol de la Vida), ASTRARIUM (36
   decanatos) y SIGILLUM (forja de sigilos).
   Todo vectorial, sin imágenes, sin librerías.
   ═══════════════════════════════════════════════════════ */

:root {
  --arc-gold: #ffd86b;
  --arc-gold-soft: rgba(255, 216, 107, .28);
  --arc-violet: #d6c9ff;
  --arc-ink: rgba(10, 7, 22, .55);
}

/* ─── Contenedores comunes ───────────────────────────── */
.ar-body, .as-body, .sg-body {
  padding: 4px 2px 8px;
}

.ar-stage, .as-wheel-wrap, .sg-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 14px 0;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 35%, rgba(126, 87, 194, .18), transparent 65%),
    var(--arc-ink);
  border: 1px solid rgba(255, 216, 107, .14);
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════
   ARBOR — Árbol de la Vida
   ═══════════════════════════════════════════════════════ */
/* El árbol es muy vertical (340×540). Fijamos la ALTURA (no el ancho): con
   width:100% el navegador ignora max-height y el diagrama desbordaba el modal
   scrollable, dejando las Sefirot 7–10 fuera de vista. Con height explícita y
   width:auto, el viewBox conserva la proporción y cabe entero. */
.ar-svg {
  height: min(34vh, 380px);
  width: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto;
  padding: 6px 0 8px;
}

/* La intro y los controles compiten con el árbol por el alto del modal:
   las compactamos para que el diagrama quepa completo de un vistazo. */
.ar-body .bc-intro {
  font-size: .8rem;
  line-height: 1.5;
  margin-bottom: 8px;
}

.ar-stage { margin: 8px 0; }

/* Sendas */
.ar-path {
  stroke: rgba(214, 201, 255, .34);
  stroke-width: 2;
  transition: stroke .35s ease, stroke-width .35s ease, filter .35s ease;
}

.ar-path.lit {
  stroke: var(--arc-gold);
  stroke-width: 3.4;
  filter: drop-shadow(0 0 6px rgba(255, 216, 107, .85));
}

/* Zona de toque generosa (WCAG 2.5.5) e invisible */
.ar-path-hit {
  stroke: transparent;
  stroke-width: 20;
  cursor: pointer;
}

/* El SVG se escala a min(34vh,380px) desde un viewBox de 540 de alto, así que
   las unidades se reducen ~30%: a 13px las letras quedaban ilegibles. Las
   agrandamos y les damos un contorno oscuro (paint-order) para que se lean
   por encima de las líneas de las sendas. */
.ar-path-letter {
  font-family: serif;
  font-size: 19px;
  font-weight: 700;
  fill: #ffe9a8;
  paint-order: stroke;
  stroke: rgba(10, 7, 22, .95);
  stroke-width: 3.5px;
  stroke-linejoin: round;
  pointer-events: none;
  user-select: none;
}

.ar-path-g:hover .ar-path,
.ar-path-g:focus-visible .ar-path {
  stroke: var(--arc-gold);
  stroke-width: 3;
}

.ar-path-g:focus-visible {
  outline: none;
}

.ar-path-g:focus-visible .ar-path-letter {
  fill: #fff;
  font-weight: 700;
}

/* Sefirot */
.ar-sef {
  fill: rgba(29, 20, 54, .96);
  stroke: rgba(214, 201, 255, .55);
  stroke-width: 1.6;
  transition: stroke .3s ease, fill .3s ease;
  cursor: pointer;
}

.ar-sef-g.middle .ar-sef { stroke: rgba(255, 216, 107, .75); }
.ar-sef-g.right  .ar-sef { stroke: rgba(140, 220, 255, .6); }
.ar-sef-g.left   .ar-sef { stroke: rgba(255, 140, 170, .6); }

.ar-sef-glow {
  fill: url(#ar-halo);
  opacity: 0;
  transition: opacity .45s ease;
  pointer-events: none;
}

.ar-sef-glow.on {
  opacity: 1;
}

.ar-sef-n {
  font-size: 12px;
  font-weight: 700;
  fill: var(--arc-gold);
  pointer-events: none;
  user-select: none;
}

.ar-sef-pl {
  font-size: 9px;
  fill: rgba(214, 201, 255, .85);
  pointer-events: none;
  user-select: none;
}

.ar-sef-g:hover .ar-sef,
.ar-sef-g:focus-visible .ar-sef {
  fill: rgba(58, 40, 100, .98);
  stroke: var(--arc-gold);
}

.ar-sef-g:focus-visible { outline: none; }

/* Controles */
.ar-controls, .sg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 12px 0 4px;
}

.ar-ctl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 216, 107, .3);
  background: rgba(255, 216, 107, .07);
  color: var(--arc-violet);
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .25s ease, transform .2s ease, border-color .25s ease;
}

.ar-ctl:hover {
  background: rgba(255, 216, 107, .16);
  border-color: var(--arc-gold);
  transform: translateY(-2px);
}

.ar-ctl:active { transform: translateY(0); }

/* Panel de lectura */
.ar-readout, .as-readout, .sg-readout {
  min-height: 60px;
  margin-top: 10px;
}

.ar-readout-hint {
  text-align: center;
  font-size: .84rem;
  color: rgba(214, 201, 255, .6);
  font-style: italic;
  padding: 16px 8px;
}

.ar-card-out {
  border-radius: 16px;
  padding: 14px 16px;
  background: linear-gradient(160deg, rgba(126, 87, 194, .2), rgba(10, 7, 22, .5));
  border: 1px solid rgba(255, 216, 107, .22);
  animation: arFade .4s ease both;
}

@keyframes arFade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.ar-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.ar-card-icon {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(255, 216, 107, .5));
}

.ar-card-name {
  font-weight: 700;
  color: var(--arc-gold);
  font-size: 1.02rem;
}

.ar-card-sub {
  font-size: .78rem;
  color: rgba(214, 201, 255, .78);
  margin-top: 2px;
}

.ar-route {
  font-size: .82rem;
  color: var(--arc-violet);
  margin: 6px 0 10px;
  letter-spacing: .3px;
}

.ar-route span {
  color: var(--arc-gold);
  margin: 0 4px;
}

.ar-kw {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.ar-kw span, .ar-chip {
  font-size: .72rem;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 216, 107, .1);
  border: 1px solid rgba(255, 216, 107, .25);
  color: var(--arc-violet);
}

.ar-chip {
  cursor: pointer;
  min-height: 32px;
  transition: background .2s ease;
}

.ar-chip:hover {
  background: rgba(255, 216, 107, .22);
  color: #fff;
}

.ar-advice {
  font-size: .87rem;
  line-height: 1.6;
  color: rgba(232, 226, 255, .92);
  font-style: italic;
  margin: 8px 0 4px;
}

.ar-more {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  margin-top: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #7e57c2, #4a2f86);
  color: #fff;
  font-weight: 600;
  font-size: .84rem;
  cursor: pointer;
  transition: filter .25s ease, transform .2s ease;
}

.ar-more:hover { filter: brightness(1.15); transform: translateY(-2px); }

.ar-links strong {
  display: block;
  font-size: .78rem;
  color: var(--arc-gold);
  margin: 10px 0 4px;
}

.ar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
  font-size: .74rem;
  color: rgba(214, 201, 255, .72);
}

.ar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ar-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.ar-dot.mid   { background: var(--arc-gold); }
.ar-dot.right { background: #8cdcff; }
.ar-dot.left  { background: #ff8caa; }

/* ═══════════════════════════════════════════════════════
   ASTRARIUM — Reloj de los 36 decanatos
   ═══════════════════════════════════════════════════════ */
/* Igual que el árbol: fijamos la altura para que la rueda quepa entera bajo
   el bloque "hoy rige" en vez de desbordar el modal scrollable. */
.as-wheel {
  height: min(38vh, 330px);
  width: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto;
  padding: 8px;
}

.as-body .bc-intro {
  font-size: .8rem;
  line-height: 1.5;
  margin-bottom: 10px;
}

.as-wheel-wrap { margin: 10px 0; }

.as-ring {
  fill: none;
  stroke: rgba(214, 201, 255, .2);
  stroke-width: 1;
}

.as-seg {
  stroke: rgba(10, 7, 22, .8);
  stroke-width: .8;
  cursor: pointer;
  transition: fill .3s ease, filter .3s ease;
}

/* Color por palo elemental */
.suit-bastos  .as-seg { fill: rgba(255, 122, 69, .3); }
.suit-copas   .as-seg { fill: rgba(94, 170, 255, .3); }
.suit-espadas .as-seg { fill: rgba(214, 201, 255, .26); }
.suit-oros    .as-seg { fill: rgba(120, 214, 140, .28); }

.as-seg-g:hover .as-seg {
  filter: brightness(1.5);
}

.as-seg-g.active .as-seg {
  fill: var(--arc-gold);
  filter: drop-shadow(0 0 8px rgba(255, 216, 107, .9));
}

.as-seg-g.sel .as-seg {
  stroke: #fff;
  stroke-width: 1.8;
}

.as-seg-g:focus-visible { outline: none; }

.as-seg-g:focus-visible .as-seg {
  stroke: var(--arc-gold);
  stroke-width: 2;
}

.as-seg-t {
  font-size: 9px;
  font-weight: 700;
  fill: rgba(255, 255, 255, .9);
  pointer-events: none;
  user-select: none;
}

.as-seg-g.active .as-seg-t {
  fill: #1d1436;
}

.as-sign {
  font-size: 15px;
  fill: rgba(255, 216, 107, .9);
  pointer-events: none;
  user-select: none;
}

.as-core {
  fill: rgba(29, 20, 54, .95);
  stroke: var(--arc-gold-soft);
  stroke-width: 1.4;
}

.as-core-t {
  font-size: 22px;
  fill: var(--arc-gold);
  pointer-events: none;
  user-select: none;
}

/* Bloque "hoy rige" */
.as-now {
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(155deg, rgba(255, 216, 107, .14), rgba(126, 87, 194, .18));
  border: 1px solid rgba(255, 216, 107, .3);
  text-align: center;
}

.as-now-badge {
  display: inline-block;
  font-size: .7rem;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--arc-gold);
  border: 1px solid var(--arc-gold-soft);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 10px;
}

.as-now-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: left;
}

.as-now-icon {
  font-size: 2.6rem;
  filter: drop-shadow(0 0 10px rgba(255, 216, 107, .6));
}

.as-now-name {
  font-size: 1.12rem;
  font-weight: 700;
  color: #fff;
}

.as-now-meta {
  font-size: .78rem;
  color: rgba(214, 201, 255, .85);
  margin-top: 3px;
}

.as-now-sun {
  font-size: .74rem;
  color: rgba(214, 201, 255, .65);
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
}

.as-now-advice {
  font-size: .88rem;
  font-style: italic;
  color: rgba(232, 226, 255, .95);
  margin-top: 10px;
  line-height: 1.6;
}

.as-decan-abs {
  font-size: .74rem;
  color: rgba(214, 201, 255, .6);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

/* Tabla de los 36 */
.as-table-wrap {
  margin-top: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 216, 107, .18);
  overflow: hidden;
}

.as-table-wrap summary {
  padding: 13px 16px;
  cursor: pointer;
  font-size: .86rem;
  font-weight: 600;
  color: var(--arc-gold);
  background: rgba(255, 216, 107, .07);
  min-height: 44px;
  display: flex;
  align-items: center;
}

.as-table {
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
}

.as-row {
  display: grid;
  grid-template-columns: 24px 62px 1fr 22px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--arc-violet);
  font-size: .78rem;
  text-align: left;
  cursor: pointer;
  transition: background .2s ease;
}

.as-row:hover { background: rgba(255, 216, 107, .1); }

.as-row.active {
  background: rgba(255, 216, 107, .18);
  color: #fff;
  font-weight: 600;
}

.as-row-sign { font-size: 1rem; color: var(--arc-gold); }
.as-row-deg  { font-variant-numeric: tabular-nums; opacity: .8; }
.as-row-ruler{ text-align: right; color: var(--arc-gold); }

/* ═══════════════════════════════════════════════════════
   SIGILLUM — Forja de sigilos
   ═══════════════════════════════════════════════════════ */
.sg-svg {
  width: 100%;
  max-width: 330px;
  height: auto;
  display: block;
  padding: 8px;
}

.sg-empty {
  padding: 54px 16px;
  text-align: center;
  font-size: .84rem;
  font-style: italic;
  color: rgba(214, 201, 255, .55);
}

.sg-ring {
  fill: none;
  stroke: var(--arc-gold-soft);
  stroke-width: 1;
}

.sg-ring.faint { stroke: rgba(214, 201, 255, .14); }

.sg-letter {
  font-family: serif;
  font-size: 13px;
  fill: rgba(214, 201, 255, .38);
  user-select: none;
}

.sg-letter.on {
  fill: var(--arc-gold);
  font-weight: 700;
}

.sg-trace {
  fill: none;
  stroke: var(--arc-gold);
  stroke-width: 2.6;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 7px rgba(255, 216, 107, .8));
  stroke-dasharray: 1400;
  stroke-dashoffset: 1400;
  animation: sgDraw 1.9s ease forwards;
}

@keyframes sgDraw {
  to { stroke-dashoffset: 0; }
}

.sg-start, .sg-cross {
  fill: none;
  stroke: var(--arc-gold);
  stroke-width: 2;
  opacity: 0;
  animation: sgPop .5s ease 1.6s forwards;
}

@keyframes sgPop {
  to { opacity: 1; }
}

.sg-node {
  fill: #fff6d8;
  opacity: 0;
  animation: sgPop .5s ease 1.3s forwards;
}

.sg-info-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(255, 216, 107, .16);
}

.sg-info-row strong {
  font-size: .76rem;
  color: var(--arc-gold);
  font-weight: 600;
}

.sg-mono {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: .82rem;
  color: #fff;
  letter-spacing: .5px;
}

.sg-info {
  border-radius: 16px;
  padding: 14px 16px;
  background: linear-gradient(160deg, rgba(126, 87, 194, .18), rgba(10, 7, 22, .5));
  border: 1px solid rgba(255, 216, 107, .2);
  animation: arFade .4s ease both;
}

/* ═══════════════════════════════════════════════════════
   Accesibilidad y rendimiento
   ═══════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .sg-trace {
    animation: none;
    stroke-dashoffset: 0;
  }
  .sg-node, .sg-start, .sg-cross {
    animation: none;
    opacity: 1;
  }
  .ar-card-out, .sg-info { animation: none; }
  .ar-ctl:hover, .ar-more:hover { transform: none; }
}

@media (prefers-contrast: more) {
  .ar-path { stroke: rgba(255, 255, 255, .7); }
  .ar-kw span, .ar-chip { border-color: var(--arc-gold); }
  .as-seg { stroke: #000; }
}

/* Móviles estrechos */
@media (max-width: 420px) {
  .as-now-card { flex-direction: column; text-align: center; gap: 8px; }
  .as-row { grid-template-columns: 22px 56px 1fr 20px; font-size: .74rem; }
  .ar-ctl { font-size: .8rem; padding: 10px 12px; }
  .sg-info-row { flex-direction: column; gap: 2px; }
}
