/* ============================================================
   Sylvaria — Wizard de reservas (overlay gamificado)
   On-brand: reusa --arena/--verde/--verde-lima, fuentes Brice/Death Bones,
   y el lenguaje visual de anillos/sigilos del Guardián.
   ============================================================ */

/* ---- Overlay raíz ---- */
.rv-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 4vw, 40px);
  background: radial-gradient(ellipse at 50% 20%, rgba(0, 50, 0, .55), rgba(0, 22, 0, .92) 70%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 360ms cubic-bezier(.2, .7, .2, 1);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.rv-overlay.is-open {
  display: flex;
  opacity: 1;
}
body.rv-lock { overflow: hidden; }

/* sigilos/motes de fondo dentro del overlay */
.rv-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 80% 18%, rgba(150, 190, 60, .14), transparent 45%),
                    radial-gradient(circle at 18% 82%, rgba(80, 145, 225, .10), transparent 45%);
  pointer-events: none;
}

/* ---- Tarjeta / pergamino contenedor ---- */
.rv-card {
  position: relative;
  width: min(680px, 100%);
  background: linear-gradient(180deg, var(--verde-2, #002100), var(--verde-3, #001600));
  border: 1.5px solid rgba(200, 180, 130, .28);
  border-radius: var(--radius, 16px);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(150, 190, 60, .12) inset;
  color: var(--arena, #C8B482);
  padding: clamp(20px, 4vw, 36px);
  margin: auto;
  transform: translateY(18px) scale(.98);
  transition: transform 420ms cubic-bezier(.2, .7, .2, 1);
}
.rv-overlay.is-open .rv-card { transform: translateY(0) scale(1); }

/* anillos decorativos detrás de la tarjeta (como los del Guardián) */
.rv-card__rings {
  position: absolute;
  inset: -40px;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: -1;
  opacity: .5;
}
.rv-card__ring {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(200, 180, 130, .25);
}
.rv-card__ring--1 { width: min(620px, 96%); aspect-ratio: 1; animation: rv-spin-cw 70s linear infinite; }
.rv-card__ring--2 { width: min(520px, 80%); aspect-ratio: 1; border-style: solid; border-color: rgba(150, 190, 60, .14); animation: rv-spin-ccw 90s linear infinite; }
@keyframes rv-spin-cw  { to { transform: rotate(360deg); } }
@keyframes rv-spin-ccw { to { transform: rotate(-360deg); } }

/* ---- Top bar: cerrar + sonido ---- */
.rv-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: var(--s-4, 24px);
}
.rv-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body, sans-serif);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--verde-lima, #96BE3C);
}
.rv-eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--verde-lima, #96BE3C);
}
.rv-top__actions { display: inline-flex; gap: 8px; }
.rv-iconbtn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(200, 180, 130, .08);
  border: 1.5px solid rgba(200, 180, 130, .4);
  color: var(--arena, #C8B482);
  cursor: pointer;
  transition: all 220ms ease;
}
.rv-iconbtn:hover { border-color: var(--arena, #C8B482); background: rgba(200, 180, 130, .2); transform: translateY(-2px); }
.rv-iconbtn:focus-visible { outline: 2px solid var(--verde-lima, #96BE3C); outline-offset: 2px; }
.rv-iconbtn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rv-iconbtn[aria-pressed="false"] .rv-sound-on { display: none; }
.rv-iconbtn[aria-pressed="true"] .rv-sound-off { display: none; }

/* ---- Barra de progreso tipo quest ---- */
.rv-quest {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--s-5, 32px);
}
.rv-quest__node {
  position: relative;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 22, 0, .6);
  border: 1.5px solid rgba(200, 180, 130, .35);
  color: rgba(200, 180, 130, .6);
  font-family: var(--font-display, sans-serif);
  font-size: 12px;
  transition: all 320ms cubic-bezier(.2, .7, .2, 1);
}
.rv-quest__link {
  flex: 1 1 auto;
  height: 2px;
  background: rgba(200, 180, 130, .2);
  position: relative;
  overflow: hidden;
}
.rv-quest__link::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 0;
  background: linear-gradient(90deg, var(--verde-lima, #96BE3C), rgba(150, 190, 60, .6));
  transition: width 480ms cubic-bezier(.2, .7, .2, 1);
}
.rv-quest__link.is-filled::after { width: 100%; }
.rv-quest__node.is-active {
  border-color: var(--verde-lima, #96BE3C);
  color: var(--verde-3, #001600);
  background: var(--verde-lima, #96BE3C);
  box-shadow: 0 0 16px rgba(150, 190, 60, .6);
  transform: scale(1.12);
}
.rv-quest__node.is-done {
  border-color: var(--verde-lima, #96BE3C);
  color: var(--verde-lima, #96BE3C);
  background: rgba(150, 190, 60, .15);
}
.rv-quest__node.is-done::after {
  content: "✓";
  font-size: 13px;
}
.rv-quest__node.is-done .rv-quest__num { display: none; }

/* ---- Pasos ---- */
.rv-steps { position: relative; min-height: 280px; }
.rv-step { display: none; animation: rv-fade-in 420ms cubic-bezier(.2, .7, .2, 1); }
.rv-step.is-current { display: block; }
@keyframes rv-fade-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rv-step__title {
  font-family: var(--font-display, sans-serif);
  text-transform: uppercase;
  letter-spacing: .01em;
  line-height: 1;
  font-size: clamp(26px, 4.5vw, 40px);
  color: var(--arena-claro, #E8DCBE);
  margin: 0 0 6px;
}
.rv-step__title .rv-accent {
  font-family: var(--font-accent, serif);
  text-transform: none;
  color: var(--verde-lima, #96BE3C);
}
.rv-step__sub {
  color: rgba(232, 220, 190, .8);
  font-size: 15px;
  margin: 0 0 var(--s-4, 24px);
  max-width: 46ch;
}

/* ---- Paso 1: héroes ---- */
.rv-people {
  display: flex;
  align-items: center;
  gap: var(--s-4, 24px);
  margin-bottom: var(--s-4, 24px);
}
.rv-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 22, 0, .5);
  border: 1.5px solid rgba(200, 180, 130, .3);
  border-radius: 999px;
  padding: 6px;
}
.rv-stepper__btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  background: var(--arena, #C8B482);
  color: var(--verde, #003200);
  font-family: var(--font-display, sans-serif);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 160ms ease, background 200ms ease;
}
.rv-stepper__btn:hover:not(:disabled) { transform: translateY(-2px); background: var(--arena-claro, #E8DCBE); }
.rv-stepper__btn:disabled { opacity: .35; cursor: not-allowed; }
.rv-stepper__btn:focus-visible { outline: 2px solid var(--verde-lima, #96BE3C); outline-offset: 2px; }
.rv-stepper__val {
  min-width: 64px;
  text-align: center;
  font-family: var(--font-display, sans-serif);
  font-size: 40px;
  color: var(--arena-claro, #E8DCBE);
}
.rv-offering {
  flex: 1 1 auto;
  padding: var(--s-4, 24px);
  border-radius: 12px;
  background: rgba(150, 190, 60, .08);
  border: 1px solid rgba(150, 190, 60, .25);
}
.rv-offering__label {
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--verde-lima, #96BE3C);
  font-weight: 600;
}
.rv-offering__amount {
  font-family: var(--font-display, sans-serif);
  font-size: clamp(28px, 5vw, 40px);
  color: var(--arena-claro, #E8DCBE);
  line-height: 1.1;
  margin-top: 4px;
}
.rv-offering__note { font-size: 12px; color: rgba(232, 220, 190, .65); margin-top: 4px; }

/* ---- Paso 2: calendario ---- */
.rv-cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-3, 16px);
}
.rv-cal__month {
  font-family: var(--font-display, sans-serif);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 18px;
  color: var(--arena-claro, #E8DCBE);
}
.rv-cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.rv-cal__dow {
  text-align: center;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(200, 180, 130, .55);
  padding-bottom: 4px;
}
.rv-day {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid rgba(200, 180, 130, .18);
  background: rgba(0, 22, 0, .4);
  color: var(--arena, #C8B482);
  font-family: var(--font-display, sans-serif);
  font-size: 15px;
  cursor: pointer;
  transition: all 200ms ease;
  display: grid;
  place-items: center;
}
.rv-day:hover:not(:disabled) {
  border-color: var(--verde-lima, #96BE3C);
  background: rgba(150, 190, 60, .14);
  transform: translateY(-2px);
}
.rv-day:focus-visible { outline: 2px solid var(--verde-lima, #96BE3C); outline-offset: 1px; }
.rv-day:disabled { opacity: .22; cursor: not-allowed; }
.rv-day.is-empty { border: 0; background: none; cursor: default; }
.rv-day.is-selected {
  background: var(--verde-lima, #96BE3C);
  color: var(--verde-3, #001600);
  border-color: var(--verde-lima, #96BE3C);
  box-shadow: 0 0 14px rgba(150, 190, 60, .5);
}
.rv-day.is-today { border-color: rgba(200, 180, 130, .55); }

/* ---- Paso 3: portales ---- */
.rv-portals {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}
.rv-portal {
  position: relative;
  padding: 16px 8px;
  border-radius: 12px;
  border: 1.5px solid rgba(150, 190, 60, .35);
  background: rgba(0, 22, 0, .5);
  color: var(--arena-claro, #E8DCBE);
  font-family: var(--font-display, sans-serif);
  font-size: 18px;
  cursor: pointer;
  overflow: hidden;
  transition: all 220ms cubic-bezier(.2, .7, .2, 1);
}
.rv-portal::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(150, 190, 60, .35), transparent 65%);
  opacity: .5;
  transition: opacity 260ms ease;
}
.rv-portal:hover { transform: translateY(-3px); border-color: var(--verde-lima, #96BE3C); }
.rv-portal:hover::before { opacity: 1; }
.rv-portal:focus-visible { outline: 2px solid var(--verde-lima, #96BE3C); outline-offset: 2px; }
.rv-portal__time { position: relative; z-index: 1; }
.rv-portal__left {
  position: relative;
  z-index: 1;
  display: block;
  font-family: var(--font-body, sans-serif);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--verde-lima, #96BE3C);
  margin-top: 4px;
}
.rv-portal.is-selected {
  background: var(--verde-lima, #96BE3C);
  color: var(--verde-3, #001600);
  box-shadow: 0 0 18px rgba(150, 190, 60, .6);
}
.rv-portal.is-selected .rv-portal__left { color: var(--verde-2, #002100); }
.rv-portal.is-off {
  border-color: rgba(200, 180, 130, .15);
  background: rgba(0, 22, 0, .3);
  color: rgba(200, 180, 130, .3);
  cursor: not-allowed;
}
.rv-portal.is-off::before { opacity: 0; }

/* ---- Paso 4: formulario ---- */
.rv-field { margin-bottom: var(--s-3, 16px); }
.rv-label {
  display: block;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--verde-lima, #96BE3C);
  font-weight: 600;
  margin-bottom: 6px;
}
.rv-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1.5px solid rgba(200, 180, 130, .3);
  background: rgba(0, 22, 0, .5);
  color: var(--arena-claro, #E8DCBE);
  font-family: var(--font-body, sans-serif);
  font-size: 16px;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
.rv-input::placeholder { color: rgba(200, 180, 130, .4); }
.rv-input:focus {
  outline: none;
  border-color: var(--verde-lima, #96BE3C);
  box-shadow: 0 0 0 3px rgba(150, 190, 60, .18);
}
.rv-input[aria-invalid="true"] { border-color: var(--rojo, #B45046); }
.rv-error {
  display: block;
  color: #e0938b;
  font-size: 12.5px;
  margin-top: 5px;
  min-height: 1em;
}

/* ---- Paso 5: pergamino de confirmación ---- */
.rv-scroll {
  text-align: center;
  padding: var(--s-3, 16px) 0;
}
.rv-sigil {
  width: 120px;
  height: 120px;
  margin: 0 auto var(--s-4, 24px);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(150, 190, 60, .25), transparent 70%);
  position: relative;
}
.rv-sigil svg { width: 64px; height: 64px; stroke: var(--verde-lima, #96BE3C); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rv-sigil::before, .rv-sigil::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(150, 190, 60, .4);
}
.rv-sigil::before { inset: 0; animation: rv-spin-cw 14s linear infinite; border-style: dashed; }
.rv-sigil::after { inset: 14px; border-color: rgba(200, 180, 130, .35); animation: rv-spin-ccw 20s linear infinite; }
.rv-sigil.is-cast svg { animation: rv-sigil-pop 700ms cubic-bezier(.2, .9, .2, 1.2); }
@keyframes rv-sigil-pop {
  0%   { transform: scale(.4) rotate(-30deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
.rv-code {
  display: block;
  width: fit-content;
  margin: var(--s-4, 24px) auto;
  padding: 12px 26px;
  border-radius: 12px;
  border: 1.5px dashed rgba(150, 190, 60, .5);
  background: rgba(150, 190, 60, .08);
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: clamp(22px, 4.5vw, 32px);
  letter-spacing: .18em;
  color: var(--verde-lima, #96BE3C);
}
.rv-summary {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 10px 28px;
  width: fit-content;
  max-width: 100%;
  margin: var(--s-4, 24px) auto 0;
  text-align: left;
  font-size: 15px;
  color: rgba(232, 220, 190, .85);
}
.rv-summary dt { margin: 0; font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--verde-lima, #96BE3C); }
.rv-summary dd { margin: 0; font-family: var(--font-display, sans-serif); font-size: 18px; color: var(--arena-claro, #E8DCBE); text-align: right; }
.rv-depositnote {
  margin-top: var(--s-4, 24px);
  font-size: 13px;
  color: rgba(232, 220, 190, .7);
  font-style: italic;
}

/* ---- Footer nav ---- */
.rv-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: var(--s-5, 32px);
  padding-top: var(--s-4, 24px);
  border-top: 1px solid rgba(200, 180, 130, .15);
}
.rv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  font-family: var(--font-display, sans-serif);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: 15px;
  line-height: 1;
  border: 2px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 220ms ease, background 220ms ease, opacity 200ms ease;
}
.rv-btn:hover:not(:disabled) { transform: translateY(-2px); }
.rv-btn:focus-visible { outline: 2px solid var(--verde-lima, #96BE3C); outline-offset: 2px; }
.rv-btn:disabled { opacity: .4; cursor: not-allowed; }
.rv-btn--primary {
  background: var(--arena, #C8B482);
  color: var(--verde, #003200);
  box-shadow: 0 6px 0 0 var(--verde-2, #002100);
}
.rv-btn--primary:hover:not(:disabled) { box-shadow: 0 8px 0 0 var(--verde-2, #002100); }
.rv-btn--ghost {
  background: transparent;
  color: var(--arena, #C8B482);
  border-color: rgba(200, 180, 130, .4);
}
.rv-btn--ghost:hover:not(:disabled) { border-color: var(--arena, #C8B482); background: rgba(200, 180, 130, .08); }
.rv-btn--full { width: 100%; }

/* ---- Estados loading / error ---- */
.rv-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 50, 0, .3);
  border-top-color: var(--verde, #003200);
  border-radius: 50%;
  animation: rv-spin 700ms linear infinite;
}
@keyframes rv-spin { to { transform: rotate(360deg); } }
.rv-loading {
  text-align: center;
  color: rgba(232, 220, 190, .8);
  padding: var(--s-5, 32px) 0;
}
.rv-loading .rv-spinner { margin: 0 auto 12px; border-top-color: var(--verde-lima, #96BE3C); border-color: rgba(150, 190, 60, .25); border-top-color: var(--verde-lima, #96BE3C); }
.rv-banner {
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(180, 80, 70, .15);
  border: 1px solid rgba(180, 80, 70, .5);
  color: #e9b3ac;
  font-size: 14px;
  margin-bottom: var(--s-3, 16px);
}
.rv-empty {
  text-align: center;
  color: rgba(232, 220, 190, .6);
  padding: var(--s-5, 32px) 0;
  font-style: italic;
}

/* ---- Live region oculta ---- */
.rv-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .rv-overlay, .rv-card { transition: none !important; }
  .rv-step,
  .rv-card__ring--1, .rv-card__ring--2,
  .rv-sigil::before, .rv-sigil::after, .rv-sigil.is-cast svg,
  .rv-spinner { animation: none !important; }
  .rv-card { transform: none !important; }
}

@media (max-width: 540px) {
  .rv-people { flex-direction: column; align-items: stretch; }
  .rv-quest__node { width: 24px; height: 24px; font-size: 11px; }
}
