:root {
  --noche: #050a18;
  --noche-2: #120c2c;
  --violeta: #2a1850;
  --oro: #e8c872;
  --oro-claro: #f7e6b0;
  --oro-oscuro: #9a7430;
  --texto: #efe6d2;
  --texto-suave: #b9ad96;
  --panel: rgba(8, 12, 28, 0.8);
  --borde: rgba(232, 200, 114, 0.35);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --titulo: 'Cinzel', 'Times New Roman', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--noche); color: var(--texto); font-family: var(--serif); overflow: hidden; }
button { font: inherit; cursor: pointer; }
.oculto { display: none !important; }

#escenario { position: fixed; inset: 0; overflow: hidden; }

#fondo {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 45% at 50% 30%, rgba(70, 100, 170, 0.26), transparent 70%),
    radial-gradient(ellipse 40% 30% at 18% 60%, rgba(255, 130, 50, 0.13), transparent 70%),
    radial-gradient(ellipse 40% 30% at 82% 55%, rgba(255, 150, 60, 0.07), transparent 70%),
    linear-gradient(180deg, #081022 0%, #050a18 55%, #03050d 100%);
}
#fondo.con-imagen { background-size: cover; background-position: center 30%; }
#fondo::after { /* cortinas laterales sutiles */
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.55), transparent 18%, transparent 82%, rgba(0,0,0,.55));
}

/* ——— Tarotista ——— */
#vidente { position: absolute; left: 50%; transform: translateX(-50%); pointer-events: none; will-change: transform; }
#vidente svg, #vidente .marco { width: 100%; height: 100%; display: block; overflow: visible; }
#vidente .marco { position: relative; transform-origin: 50% 70%;
  -webkit-mask-image: radial-gradient(ellipse 50% 56% at 50% 46%, #000 50%, transparent 100%);
          mask-image: radial-gradient(ellipse 50% 56% at 50% 46%, #000 50%, transparent 100%); }
#vidente .luz-vela { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: soft-light;
  background: radial-gradient(circle at 12% 55%, rgba(255,170,80,.55), transparent 45%); animation: vela 3.2s infinite; }
@keyframes vela { 0%,100% { opacity: .7; } 20% { opacity: .95; } 35% { opacity: .6; } 60% { opacity: .9; } 80% { opacity: .75; } }
#vidente .marco img, #vidente .marco video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: bottom; opacity: 0; transition: opacity .05s linear; }
#vidente .respira { transform-origin: 50% 100%; animation: respirar 5.5s ease-in-out infinite; width: 100%; height: 100%; }
@keyframes respirar { 0%,100% { transform: scale(1, 1); } 50% { transform: scale(1.004, 1.012); } }
.aura { animation: aura 6s ease-in-out infinite; transform-origin: 300px 250px; }
@keyframes aura { 0%,100% { opacity: .55; transform: scale(1); } 50% { opacity: .9; transform: scale(1.05); } }

#lienzo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#velo { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 80% 70% at 50% 45%, transparent 55%, rgba(0,0,0,.6)); }

/* ——— Barra ——— */
#barra { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; pointer-events: none; }
.marca { display: flex; align-items: center; gap: 14px; font-family: var(--titulo); letter-spacing: .12em; font-size: 15px; color: var(--oro); text-shadow: 0 0 12px rgba(232,200,114,.4); }
.volver { pointer-events: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--oro-claro); text-decoration: none; font-size: 12.5px; letter-spacing: .1em;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--borde); background: rgba(10,6,25,.65); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); text-shadow: none; transition: .25s; }
.volver:hover { background: rgba(232,200,114,.16); border-color: var(--oro); }
.marca-estrella { display: inline-block; animation: girar 12s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.barra-botones { display: flex; gap: 8px; pointer-events: auto; }
.icono { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--borde); background: rgba(10,6,25,.6); color: var(--oro); font-size: 17px; display: grid; place-items: center; transition: .25s; }
.icono:hover { background: rgba(232,200,114,.15); }
.icono.apagado { opacity: .4; }

/* ——— Bocadillo ——— */
#bocadillo {
  position: absolute; max-width: 330px; padding: 14px 18px 16px; border-radius: 14px;
  background: linear-gradient(160deg, rgba(18,26,56,.92), rgba(8,10,24,.94));
  border: 1px solid var(--borde); box-shadow: 0 10px 40px rgba(0,0,0,.5), 0 0 30px rgba(255,140,60,.12);
  font-size: 19px; line-height: 1.35; pointer-events: none;
  animation: aparecer .5s ease both;
}
.bocadillo-nombre { font-family: var(--titulo); font-size: 12px; letter-spacing: .25em; color: var(--oro); margin-bottom: 4px; text-transform: uppercase; }
#bocadillo p { margin: 0; font-style: italic; min-height: 1.35em; }
@keyframes aparecer { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ——— Panel ——— */
.panel {
  position: absolute; left: 20px; top: 50%; transform: translateY(-50%); width: 320px;
  padding: 20px; border-radius: 18px; background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--borde); box-shadow: 0 20px 60px rgba(0,0,0,.55);
}
.panel h2 { font-family: var(--titulo); font-weight: 600; font-size: 18px; letter-spacing: .08em; color: var(--oro); margin: 0 0 12px; }
.tiradas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.tirada {
  text-align: left; padding: 10px 10px 9px; border-radius: 12px; border: 1px solid rgba(232,200,114,.18);
  background: rgba(255,255,255,.03); color: var(--texto); transition: .25s;
}
.tirada:hover { border-color: var(--borde); background: rgba(232,200,114,.06); }
.tirada.activa { border-color: var(--oro); background: linear-gradient(160deg, rgba(232,200,114,.16), rgba(232,200,114,.04)); box-shadow: 0 0 18px rgba(232,200,114,.15) inset; }
.tirada b { display: block; font-family: var(--titulo); font-size: 13.5px; font-weight: 600; color: var(--oro-claro); letter-spacing: .04em; }
.tirada span { font-size: 14px; color: var(--texto-suave); line-height: 1.15; display: block; margin-top: 2px; }
.etiqueta { display: block; font-size: 15px; color: var(--oro-claro); margin-bottom: 6px; }
.etiqueta span { color: var(--texto-suave); font-size: 13.5px; }
textarea {
  width: 100%; resize: none; border-radius: 10px; border: 1px solid rgba(232,200,114,.25); background: rgba(0,0,0,.35);
  color: var(--texto); font-family: var(--serif); font-size: 17px; padding: 10px 12px; outline: none; margin-bottom: 14px;
}
textarea:focus { border-color: var(--oro); box-shadow: 0 0 0 3px rgba(232,200,114,.12); }
.boton-oro {
  width: 100%; padding: 12px 16px; border-radius: 999px; border: 0; font-family: var(--titulo); font-weight: 700; letter-spacing: .1em; font-size: 14px;
  color: #1a1030; background: linear-gradient(180deg, #f8e4a6, #d9ac4e 55%, #b98a32); box-shadow: 0 6px 24px rgba(232,200,114,.28), inset 0 1px 0 rgba(255,255,255,.6);
  transition: transform .2s, box-shadow .2s, filter .2s;
}
.boton-oro:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(232,200,114,.4); }
.boton-oro:disabled { filter: grayscale(.6) brightness(.7); cursor: wait; transform: none; }
.boton-linea {
  width: 100%; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--borde); background: transparent; color: var(--oro);
  font-family: var(--titulo); letter-spacing: .08em; font-size: 13px; transition: .25s;
}
.boton-linea:hover { background: rgba(232,200,114,.1); }
.nota { color: var(--texto-suave); font-size: 16px; margin: 0 0 12px; line-height: 1.3; }
.contador { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.contador i { width: 22px; height: 28px; border-radius: 50% / 45%; border: 1px solid var(--borde); background: rgba(255,255,255,.03); transition: .3s; }
.contador i.lleno { background: radial-gradient(circle at 35% 30%, #9a9ca2, #4a4c52 70%); border-color: var(--oro); box-shadow: 0 0 10px rgba(232,200,114,.35); }

.tirada.ancha { grid-column: 1 / -1; }
.glifo-tirada { float: right; font-size: 20px; line-height: 1; color: var(--oro); opacity: .8; margin-left: 6px; }
/* Botón de mantener pulsado para agitar el saco */
.boton-agitar { position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.boton-agitar .carga { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, rgba(255,140,60,.35), rgba(255,220,140,.55)); pointer-events: none; }
.boton-agitar span { position: relative; }
.boton-agitar.agitando { animation: temblar .12s infinite; }
@keyframes temblar { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-1.5px) rotate(-.4deg); } 75% { transform: translateX(1.5px) rotate(.4deg); } }
.resumen { font-size: 16px; color: var(--texto-suave); margin: 0 0 12px; line-height: 1.35; }

/* ——— Botones al terminar ——— */
.final { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; animation: aparecer .6s ease both; }
.final .boton-oro { width: auto; padding: 14px 34px; font-size: 16px; animation: latido 2.4s ease-in-out infinite; }
.final .boton-linea { width: auto; background: rgba(10,6,25,.6); }
@keyframes latido { 0%,100% { box-shadow: 0 6px 24px rgba(232,200,114,.28); } 50% { box-shadow: 0 6px 38px rgba(232,200,114,.65); } }
.detener { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); width: auto; background: rgba(10,6,25,.7); }

/* ——— Lectura ——— */
#lectura {
  position: absolute; right: 20px; top: 70px; bottom: 20px; width: 380px; overflow-y: auto; padding: 22px 22px 18px;
  border-radius: 18px; background: rgba(8,12,28,.9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--borde); box-shadow: 0 20px 60px rgba(0,0,0,.6); animation: entrarDerecha .6s ease both;
  scrollbar-width: thin; scrollbar-color: var(--oro-oscuro) transparent; z-index: 5;
}
@keyframes entrarDerecha { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.cerrar { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; font-size: 18px; }
.lectura-tirada { font-family: var(--titulo); font-size: 20px; color: var(--oro); letter-spacing: .06em; padding-right: 34px; }
.lectura-pregunta { font-style: italic; color: var(--texto-suave); font-size: 17px; margin-top: 4px; }
.lectura-pregunta:empty, .lectura-resumen:empty { display: none; }
.lectura-resumen { color: var(--texto-suave); font-size: 16px; margin-top: 8px; line-height: 1.3; }
.veredicto { margin-top: 12px; padding: 10px 14px; border-radius: 12px; text-align: center; font-family: var(--titulo); font-size: 22px; letter-spacing: .12em; border: 1px solid var(--borde); background: rgba(232,200,114,.08); color: var(--oro-claro); }
.lectura-cartas { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.lectura-cartas li { display: grid; grid-template-columns: 46px 1fr; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.035); border: 1px solid rgba(232,200,114,.1); cursor: pointer; transition: .2s; }
.lectura-cartas li:hover { border-color: var(--borde); }
.lectura-cartas canvas { width: 46px; height: 46px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.6)); }
.lectura-cartas canvas.invertida { transform: rotate(180deg); }
.lectura-cartas .pos { font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--texto-suave); font-family: var(--titulo); }
.lectura-cartas .nom { font-family: var(--titulo); color: var(--oro-claro); font-size: 15.5px; margin: 2px 0; }
.lectura-cartas .nom em { font-family: var(--serif); color: #e8a878; font-size: 14px; }
.lectura-cartas .sig { font-size: 16px; line-height: 1.25; color: var(--texto); }
.interpretacion { border-top: 1px solid rgba(232,200,114,.2); padding-top: 14px; }
.interpretacion h3 { font-family: var(--titulo); color: var(--oro); font-size: 16px; letter-spacing: .08em; margin: 0 0 8px; }
.interpretacion-texto { font-size: 18px; line-height: 1.45; margin-bottom: 14px; }
.interpretacion-texto p { margin: 0 0 10px; }
.interpretacion-texto .nota { color: var(--texto-suave); font-style: italic; }
.interpretacion .boton-linea { margin-top: 8px; }
.cursor::after { content: '▍'; color: var(--oro); animation: parpadea 1s steps(1) infinite; }
@keyframes parpadea { 50% { opacity: 0; } }
.lectura-pie { margin-top: 14px; }
.aviso { font-size: 13.5px; color: var(--texto-suave); text-align: center; margin: 10px 0 0; line-height: 1.3; }

/* ——— Detalle ——— */
#detalle { position: absolute; inset: 0; background: rgba(3,2,10,.82); backdrop-filter: blur(6px); display: grid; place-items: center; animation: aparecer .35s ease both; z-index: 20; padding: 20px; }
.detalle-caja { display: flex; gap: 28px; align-items: center; max-width: 760px; }
#detalle-carta { width: min(300px, 40vw); height: auto; filter: drop-shadow(0 0 30px rgba(232,200,114,.3)) drop-shadow(0 20px 30px rgba(0,0,0,.7)); }
#detalle-carta.invertida { transform: rotate(180deg); }
.detalle-info { max-width: 360px; }
.detalle-posicion { font-family: var(--titulo); font-size: 12px; letter-spacing: .25em; text-transform: uppercase; color: var(--texto-suave); }
.detalle-info h3 { font-family: var(--titulo); font-size: 28px; color: var(--oro); margin: 6px 0 2px; font-weight: 600; }
.detalle-estado { color: #e8a878; font-style: italic; margin-bottom: 12px; }
.detalle-info p { font-size: 20px; line-height: 1.4; margin: 0 0 18px; }

/* ——— Carga ——— */
#cargando { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--noche); font-family: var(--titulo); letter-spacing: .15em; color: var(--oro); font-size: 14px; transition: opacity .8s; z-index: 30; }
#cargando.fuera { opacity: 0; pointer-events: none; }
.cargando-sello { font-size: 40px; animation: girar 4s linear infinite; text-shadow: 0 0 20px var(--oro); }

/* ——— Móvil ——— */
@media (max-width: 760px) {
  .panel { left: 10px; right: 10px; top: auto; bottom: 10px; transform: none; width: auto; padding: 14px; border-radius: 16px; }
  .panel h2 { font-size: 15px; margin-bottom: 8px; }
  .tiradas { grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
  .tirada.ancha { grid-column: auto; }
  .glifo-tirada { display: none; }
  .tirada { padding: 7px 6px; }
  .tirada b { font-size: 11.5px; }
  .tirada span { display: none; }
  textarea { font-size: 16px; margin-bottom: 10px; }
  .etiqueta span { display: none; }
  #bocadillo { left: 10px !important; right: 10px; max-width: none; font-size: 16px; padding: 9px 13px; }
  .final { left: 10px; right: 10px; transform: none; bottom: 10px; }
  .final .boton-oro { flex: 1; }
  .volver-largo, .marca-titulo { display: none; }
  #lectura { left: 0; right: 0; bottom: 0; top: 30%; width: auto; border-radius: 18px 18px 0 0; }
  .detalle-caja { flex-direction: column; gap: 14px; text-align: center; }
  #detalle-carta { width: min(210px, 52vw); }
  .detalle-info h3 { font-size: 22px; }
  .detalle-info p { font-size: 17px; }
  .marca { font-size: 12px; }
}
