:root {
  --bg: #120d1a;
  --panel: #1c1428;
  --panel-2: #261b36;
  --text: #f3ecfa;
  --muted: #a99bbd;
  --orange: #ff7a1a;
  --orange-d: #d9600a;
  --purple: #8b5cf6;
  --ok: #4ade80;
  --bad: #f87171;
  --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5; }
a { color: var(--orange); }
h1, h2 { font-family: Georgia, "Times New Roman", serif; margin: 0; }

.cta { display: inline-block; margin-top: 16px; padding: 12px 22px; background: var(--orange); color: #1a0f00; border: 2px solid transparent; font-family: inherit; line-height: 1.2; border-radius: 999px; font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none; }
.cta:hover { background: var(--orange-d); }

main { max-width: 1100px; margin: 0 auto; padding: 0 16px 48px; }
.count { color: var(--muted); font-size: .9rem; margin: 10px 2px; }


section.card { background: var(--panel); border: 1px solid #3a2a52; border-radius: var(--radius); padding: 20px; margin-top: 28px; }
section.card h2 { color: var(--orange); font-size: 1.5rem; margin-bottom: 4px; }
.sub { color: var(--muted); margin: 0 0 16px; }

form { display: grid; gap: 14px; }
.row { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .row.two { grid-template-columns: 2fr 1fr; } .row.times { grid-template-columns: 1fr 1fr; } }
label { display: grid; gap: 4px; font-weight: 600; font-size: .92rem; }
label small { color: var(--muted); font-weight: 400; }
input[type=text], input[type=time], textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid #4a3869; background: var(--panel-2); color: var(--text); font: inherit;
}
input:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
textarea { resize: vertical; min-height: 70px; }
fieldset { border: 1px solid #4a3869; border-radius: 10px; padding: 10px 14px 12px; margin: 0; }
legend { padding: 0 6px; font-weight: 600; font-size: .92rem; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checks label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.consent { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; background: var(--panel-2); padding: 10px 12px; border-radius: 10px; }
.consent input { margin-top: 4px; }

button.sec { padding: 10px 16px; border-radius: 10px; border: 1px solid var(--purple); background: transparent; color: var(--text); cursor: pointer; font: inherit; }
button.sec:hover { background: #2d2247; }
#pickmap { height: 280px; border-radius: 10px; border: 1px solid #4a3869; }
.hint { color: var(--muted); font-size: .85rem; margin: 4px 0 0; }
.msg { padding: 10px 12px; border-radius: 10px; display: none; }
.msg.ok { display: block; background: #12301f; color: var(--ok); }
.msg.err { display: block; background: #3a1616; color: var(--bad); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }


/* ================= Modo tenebroso ================= */
:root { --blood: #b3122a; --fog: rgba(190,170,255,.16); --glow: 0 0 14px rgba(255,122,26,.55); }
.display { font-family: "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", Georgia, serif; }
body.spooky { background: radial-gradient(ellipse at 50% -10%, #2a1646 0%, var(--bg) 55%) fixed; position: relative; }
body.spooky::after { /* viñeta */ content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.45) 100%); }

/* ---- Hero ---- */
header.hero { position: relative; overflow: hidden; text-align: center; padding: 56px 16px 72px; isolation: isolate;
  background: linear-gradient(180deg, #0b0614 0%, #1c0f33 55%, #2b1347 100%); border-bottom: 2px solid #3a2150; }
header.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 38px; z-index: 3; /* borde irregular */
  background: var(--bg);
  clip-path: polygon(0 100%, 0 55%, 4% 30%, 8% 60%, 13% 25%, 18% 55%, 24% 35%, 30% 65%, 36% 30%, 43% 60%, 50% 28%, 57% 62%, 64% 32%, 71% 60%, 78% 26%, 85% 58%, 91% 34%, 96% 55%, 100% 30%, 100% 100%); }
.hero-text { position: relative; z-index: 4; max-width: 720px; margin: 0 auto; }
.kicker { margin: 0 0 6px; letter-spacing: .3em; text-transform: uppercase; font-size: .78rem; color: #c9b6ee; }
header.hero h1 { font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; font-style: italic; font-weight: 700;
  font-size: clamp(2.3rem, 9vw, 4.6rem); line-height: 1.05; color: var(--orange); margin: 0;
  text-shadow: 0 0 10px rgba(255,122,26,.7), 0 0 32px rgba(255,122,26,.45), 0 3px 0 #5a1d00; letter-spacing: .5px; }
.flicker { display: inline-block; animation: flicker 7s infinite; }
header.hero .lead { margin: 14px auto 0; max-width: 560px; color: #d9cdf0; font-size: 1.05rem; }
.hero .cta { animation: pulse 2.6s infinite; }

.stars { position: absolute; inset: 0; z-index: 0; opacity: .9; animation: twinkle 5s ease-in-out infinite alternate;
  background-image:
    radial-gradient(1.5px 1.5px at 8% 20%, #fff, transparent 60%), radial-gradient(1px 1px at 17% 62%, #fff, transparent 60%),
    radial-gradient(1.5px 1.5px at 27% 12%, #ffe9b0, transparent 60%), radial-gradient(1px 1px at 36% 45%, #fff, transparent 60%),
    radial-gradient(1px 1px at 48% 18%, #fff, transparent 60%), radial-gradient(1.5px 1.5px at 59% 70%, #cfe0ff, transparent 60%),
    radial-gradient(1px 1px at 66% 28%, #fff, transparent 60%), radial-gradient(1.5px 1.5px at 74% 8%, #fff, transparent 60%),
    radial-gradient(1px 1px at 83% 52%, #ffe9b0, transparent 60%), radial-gradient(1px 1px at 92% 24%, #fff, transparent 60%),
    radial-gradient(1px 1px at 12% 85%, #fff, transparent 60%), radial-gradient(1.5px 1.5px at 88% 82%, #fff, transparent 60%); }

.moon { position: absolute; z-index: 0; top: 26px; right: clamp(16px, 12vw, 160px); width: clamp(86px, 16vw, 150px); aspect-ratio: 1; border-radius: 50%;
  background:
    radial-gradient(circle at 30% 34%, rgba(160,140,90,.35) 0 9%, transparent 10%),
    radial-gradient(circle at 62% 56%, rgba(160,140,90,.30) 0 12%, transparent 13%),
    radial-gradient(circle at 48% 24%, rgba(160,140,90,.25) 0 6%, transparent 7%),
    radial-gradient(circle at 36% 32%, #fffbe8, #f6e7b0 55%, #dcc47c);
  box-shadow: 0 0 40px 10px rgba(255,235,160,.35), 0 0 120px 40px rgba(255,200,120,.18); }

.fog { position: absolute; left: 0; width: 200%; height: 140px; z-index: 2; pointer-events: none; filter: blur(14px); opacity: .9;
  background: radial-gradient(ellipse 18% 50% at 10% 50%, var(--fog), transparent), radial-gradient(ellipse 22% 60% at 35% 40%, var(--fog), transparent),
    radial-gradient(ellipse 16% 50% at 60% 55%, var(--fog), transparent), radial-gradient(ellipse 24% 60% at 85% 45%, var(--fog), transparent); }
.fog-1 { bottom: 18px; animation: drift 38s linear infinite; }
.fog-2 { bottom: -10px; height: 120px; opacity: .7; animation: drift 58s linear infinite reverse; }

.web { position: absolute; z-index: 3; width: clamp(70px, 14vw, 150px); color: rgba(235,230,255,.38); pointer-events: none; }
.web-tl { top: 0; left: 0; }
.web-tr { top: 0; right: 0; transform: scaleX(-1); }
.web-br { bottom: 0; right: 0; transform: scale(-1, -1); width: 90px; }
section.card > .web-tl { width: 90px; }
.card > .web-tl, .card > .web-br { z-index: 0; color: rgba(235,230,255,.18); }

.bat { position: absolute; z-index: 1; color: #05030a; left: 0; animation: fly linear infinite; will-change: transform; }
.bat svg { width: 100%; height: auto; display: block; animation: flap .32s ease-in-out infinite alternate; transform-origin: 50% 40%; }
.bat-1 { top: 14%; width: 46px; animation-duration: 15s; }
.bat-2 { top: 30%; width: 30px; animation-duration: 20s; animation-delay: -7s; }
.bat-3 { top: 8%;  width: 24px; animation-duration: 26s; animation-delay: -15s; }
.bat-4 { top: 42%; width: 38px; animation-duration: 18s; animation-delay: -3s; animation-direction: reverse; }
.bat-1, .bat-4 { filter: drop-shadow(0 0 6px rgba(255,122,26,.25)); }

.ghost { position: absolute; z-index: 1; color: rgba(255,255,255,.82); filter: drop-shadow(0 0 14px rgba(190,170,255,.7)); animation: bob 5s ease-in-out infinite; }
.ghost svg { width: 100%; height: auto; display: block; }
.ghost-1 { left: clamp(6px, 7vw, 110px); top: 38%; width: clamp(40px, 7vw, 74px); }
.ghost-2 { right: clamp(10px, 5vw, 80px); top: 58%; width: clamp(30px, 5vw, 52px); opacity: .6; animation-duration: 6.5s; animation-delay: -2s; }

/* ---- Mapa nocturno ---- */
#map, #pickmap { background: #1b1526; box-shadow: 0 0 0 1px #3a2150, 0 0 30px rgba(139,92,246,.18); }
#map { height: 62vh; min-height: 360px; border-radius: var(--radius); border: 1px solid #3a2a52; margin-top: 8px; }
.leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.82) contrast(.92) saturate(.75); }
.leaflet-container { font-family: inherit; }
.leaflet-bar a, .leaflet-bar a:hover { background: #1d1430; color: var(--orange); border-color: #3a2150; }
.leaflet-control-attribution { background: rgba(18,13,26,.75) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: #c9b6ee !important; }

.pin { font-size: 30px; line-height: 1; text-align: center; animation: glow 2.4s ease-in-out infinite alternate; transform-origin: 50% 90%; }
.leaflet-marker-icon:hover .pin { animation: wiggle .5s ease-in-out infinite; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #1d1430; color: var(--text); border: 1px solid var(--orange); box-shadow: 0 0 22px rgba(255,122,26,.4); }
.leaflet-popup-content { font-family: inherit; color: var(--text); }
.leaflet-popup-content h3 { margin: 0 0 4px; font-family: "Palatino Linotype", Palatino, Georgia, serif; font-style: italic; color: var(--orange); font-size: 1.15rem; text-shadow: 0 0 8px rgba(255,122,26,.5); }
.leaflet-popup-content .addr { color: var(--muted); font-size: .9rem; margin-bottom: 6px; }
.leaflet-popup-content p { margin: 6px 0; }
a.leaflet-popup-close-button { color: var(--orange) !important; }
.tag { display: inline-block; background: #3a2150; color: #ffb36b; border: 1px solid #5a3380; border-radius: 999px; padding: 1px 9px; font-size: .78rem; margin: 2px 3px 2px 0; }

/* ---- Tarjetas y formulario ---- */
body.spooky section.card { position: relative; overflow: hidden; background: linear-gradient(180deg, #22163a, #1a1129); border: 1px solid #4a2e6e; box-shadow: 0 0 0 1px rgba(255,122,26,.08), 0 10px 40px rgba(0,0,0,.45); }
body.spooky section.card > * { position: relative; z-index: 1; }
body.spooky section.card > .web { position: absolute; z-index: 0; }
body.spooky section.card h2 { font-family: "Palatino Linotype", Palatino, Georgia, serif; font-style: italic; text-shadow: 0 0 12px rgba(255,122,26,.45); }
body.spooky input[type=text], body.spooky input[type=time], body.spooky textarea { background: #150e22; border-color: #5a3380; }
body.spooky input:focus, body.spooky textarea:focus { box-shadow: 0 0 0 3px rgba(255,122,26,.25); }
.msg.ok { background: #14301f; border: 1px solid #1f6b3a; }
.msg.err { border: 1px solid #7a1f1f; }

/* ---- Footer con lápidas ---- */
footer { position: relative; text-align: center; color: var(--muted); font-size: .82rem; padding: 12px 16px 34px; }
.tombs { display: flex; justify-content: center; align-items: flex-end; gap: 18px; margin-bottom: 10px; color: #2d2145; }
.tomb { width: 34px; height: auto; filter: drop-shadow(0 0 6px rgba(139,92,246,.25)); }
.tomb-b { width: 42px; }

/* ---- Animaciones ---- */
@keyframes fly { from { transform: translateX(-18vw) translateY(0); } 25% { transform: translateX(22vw) translateY(24px); } 50% { transform: translateX(55vw) translateY(-14px); } 75% { transform: translateX(88vw) translateY(18px); } to { transform: translateX(120vw) translateY(0); } }
@keyframes flap { from { transform: scaleY(1); } to { transform: scaleY(.45); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-16px) rotate(3deg); } }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes twinkle { from { opacity: .55; } to { opacity: 1; } }
@keyframes glow { from { filter: drop-shadow(0 0 4px rgba(255,122,26,.7)); } to { filter: drop-shadow(0 0 12px rgba(255,170,60,1)); } }
@keyframes wiggle { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,122,26,.55); } 70% { box-shadow: 0 0 0 16px rgba(255,122,26,0); } 100% { box-shadow: 0 0 0 0 rgba(255,122,26,0); } }
@keyframes flicker { 0%, 18%, 22%, 62%, 66%, 100% { opacity: 1; text-shadow: 0 0 10px rgba(255,122,26,.7), 0 0 32px rgba(255,122,26,.45), 0 3px 0 #5a1d00; }
  20%, 64% { opacity: .35; text-shadow: none; } 21%, 65% { opacity: .9; } 63% { opacity: .5; } }

@media (max-width: 520px) { .ghost-2, .bat-3 { display: none; } .moon { top: 10px; right: 10px; width: 64px; opacity: .8; } header.hero { padding: 44px 14px 64px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .bat { display: none; }
}


.deadline { margin: 0 0 14px; padding: 8px 12px; border: 1px dashed #7a4a1e; border-radius: 10px; background: #150e22; color: #ffd9b0; font-size: .92rem; }
.print-link { margin: 0 2px 6px; font-size: .95rem; }

/* ---- Plan de la noche ---- */
.cta.alt { background: transparent; color: var(--text); border: 2px solid var(--purple); margin-left: 10px; animation: none; }
.cta.alt:hover { background: rgba(139,92,246,.2); }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 22px; }
.chips li { background: #150e22; border: 1px solid #5a3380; border-radius: 999px; padding: 6px 14px; font-size: .9rem; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; position: relative; }
.steps::before { content: ""; position: absolute; left: 21px; top: 22px; bottom: 22px; width: 2px; background: repeating-linear-gradient(180deg, #7a4a1e 0 6px, transparent 6px 12px); z-index: 0; }
.steps li { display: grid; grid-template-columns: 44px 1fr; gap: 16px; align-items: start; position: relative; z-index: 1; }
.num { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; font: italic 700 1.3rem Georgia, serif; color: #1a0f00;
  background: radial-gradient(circle at 35% 30%, #ffb35c, var(--orange) 60%, #c95200); box-shadow: 0 0 16px rgba(255,122,26,.55); }
.steps .body { background: #150e22; border: 1px solid #4a2e6e; border-radius: 12px; padding: 12px 16px 14px; }
.steps h3 { margin: 6px 0 4px; font-family: "Palatino Linotype", Palatino, Georgia, serif; font-style: italic; font-size: 1.2rem; color: var(--text); }
.steps p { margin: 0; color: #d9cdf0; }
.when { display: inline-block; background: #3a2150; color: #ffb36b; border-radius: 999px; padding: 2px 11px; font-size: .78rem; font-weight: 600; }
.rules-title { margin: 30px 0 10px; font-family: "Palatino Linotype", Palatino, Georgia, serif; font-style: italic; color: var(--orange); font-size: 1.3rem; }
.rules { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .rules { grid-template-columns: repeat(3, 1fr); } }
.rule { background: #150e22; border: 1px solid #5a3380; border-left: 4px solid var(--orange); border-radius: 10px; padding: 12px 14px; display: grid; gap: 4px; }
.rule span { color: #d9cdf0; font-size: .92rem; }
@media (max-width: 520px) { .cta.alt { margin: 10px 0 0; } .steps li { grid-template-columns: 36px 1fr; gap: 12px; } .num { width: 36px; height: 36px; font-size: 1.1rem; } .steps::before { left: 17px; } }


/* ---- Botones de acciones en páginas internas (calabaza, mapa) ---- */
.pg-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; margin-top: 22px; }
.pg-actions .cta, .pg-actions .cta.alt { margin: 0; animation: none; }
.pg-actions .cta[disabled] { opacity: .55; cursor: wait; }

/* ---- Crédito ---- */
.credit { text-align: center; color: var(--muted); font-size: .86rem; margin: 22px auto 0; padding: 0 16px; max-width: 560px; line-height: 1.5; }
.credit::before { content: "\1F383\00a0"; }
@media print { .credit { color: #4a3a5a !important; } }

/* Admin */
.adm-wrap { max-width: 1000px; margin: 0 auto; padding: 20px 16px; }
.item { background: var(--panel); border: 1px solid #3a2a52; border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; display: grid; gap: 6px; }
.item .top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.badge { padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge.pending { background: #4a3a05; color: #fcd34d; }
.badge.approved { background: #12301f; color: var(--ok); }
.badge.rejected { background: #3a1616; color: var(--bad); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button { padding: 6px 14px; border-radius: 8px; border: 0; cursor: pointer; font-weight: 600; }
.b-ok { background: var(--ok); color: #052e16; } .b-no { background: #f59e0b; color: #1c1002; } .b-del { background: var(--bad); color: #2a0707; }
.tabs { display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap; }
.tabs button { padding: 6px 14px; border-radius: 999px; border: 1px solid #4a3869; background: transparent; color: var(--text); cursor: pointer; }
.tabs button.active { background: var(--orange); color: #1a0f00; border-color: var(--orange); }
