/* =========================================================
   ════════  V5.5 — EASTER EGGS, NEU GEBAUT  ════════
   Rave: Lichtkegel hängen an der Decke (Moving Heads) statt sich
   um die Bildmitte zu drehen; sanfte Beat-Wellen (--kick aus
   v55.js), Bühnenboden-Glühen, Plakette mit Beenden-Button.
   Konfetti/Matrix: eigene Ebenen.
   ========================================================= */

/* ---------- Konfetti ---------- */
.confetti-layer { position: fixed; inset: 0; z-index: 9700; width: 100%; height: 100%; pointer-events: none; }

/* ---------- Matrix ---------- */
.mx-veil {
    position: fixed;
    inset: 0;
    z-index: 9600;
    pointer-events: none;
    background: radial-gradient(120% 90% at 50% 40%, rgba(2, 10, 6, 0.62), rgba(1, 5, 4, 0.86));
    opacity: 0;
    transition: opacity 0.7s ease;
}
.mx-canvas { position: fixed; inset: 0; z-index: 9601; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity 0.7s ease; }
.mx-veil.on, .mx-canvas.on { opacity: 1; }
.mx-canvas.live { pointer-events: auto; touch-action: auto; }

/* ---------- Rave-Bühne (überschreibt die alte v4-Bühne) ---------- */
@property --floor { syntax: '<color>'; inherits: true; initial-value: #8B5CF6; }
.rave-stage.rv2 {
    --kick: 0;
    --floor: hsl(262 95% 60%);
    animation: raveStageIn 0.6s ease both;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    /* registrierte Farbe → der Bühnenboden blendet weich über statt zu springen */
    transition: opacity 0.4s ease, --floor 1.2s ease;
}
/* Ink-Modus hält den Fokus im Ink-Dialog → Plakette dort ausblenden */
body.ink-mode .rv-chip { display: none; }
.rave-stage.rv2::before, .rave-stage.rv2::after { content: none; }
.rave-stage.rv2.out { opacity: 0; }
/* Farbdrehung über die ganze Seite nur auf starken Geräten (v55.js) */
.rave-stage.rv2.rv-hue { animation: raveStageIn 0.6s ease both, raveBackdrop 16s linear infinite; }

.rv-rig { position: absolute; inset: 0; overflow: hidden; }
.rv-beam {
    --c: hsl(262 95% 62%);
    position: absolute;
    top: -6vh;
    left: var(--x);
    width: clamp(110px, 16vw, 260px);
    height: 125vh;
    margin-left: calc(clamp(110px, 16vw, 260px) / -2);
    background: var(--c);
    /* Kegel: schmal an der Decke, breit am Boden, nach unten auslaufend */
    clip-path: polygon(46% 0, 54% 0, 100% 100%, 0 100%);
    -webkit-mask: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.55) 45%, transparent 92%);
    mask: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.55) 45%, transparent 92%);
    mix-blend-mode: screen;
    transform-origin: 50% 0;
    opacity: calc(0.15 + var(--kick) * 0.05);
    transition: background-color 0.9s ease;
    animation: rvSweep calc(7s + var(--i) * 1.3s) ease-in-out calc(var(--i) * -2.1s) infinite alternate;
    will-change: transform;
}
.rv-beam:nth-child(odd) { animation-direction: alternate-reverse; }
@keyframes rvSweep {
    from { transform: rotate(-24deg); }
    to { transform: rotate(24deg); }
}
/* Lampenkopf an der Decke */
.rv-beam::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 6vh;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 18px 6px var(--c);
}
.rv-floor {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 34vh;
    background: radial-gradient(60% 100% at 50% 100%, var(--floor), transparent 70%);
    mix-blend-mode: screen;
    opacity: calc(0.16 + var(--kick) * 0.06);
}
[data-theme="light"] .rv-beam, [data-theme="light"] .rv-floor { mix-blend-mode: multiply; }
[data-theme="light"] .rv-beam { opacity: calc(0.09 + var(--kick) * 0.04); }

/* Plakette: eindeutig bedienbar, auch per Touch/Tastatur */
.rv-chip {
    position: absolute;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));
    translate: -50% 0;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.4rem 0.4rem 0.4rem 0.9rem;
    border-radius: 100px;
    background: rgba(10, 12, 34, 0.86);
    border: 1px solid rgba(196, 181, 253, 0.35);
    box-shadow: 0 14px 40px -14px rgba(236, 72, 153, 0.6);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: #EDEAFF;
    font: 500 0.72rem var(--font-mono);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    pointer-events: auto;
    animation: rvChipIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}
@keyframes rvChipIn { from { opacity: 0; translate: -50% 16px; } }
[data-theme="light"] .rv-chip { background: rgba(255, 255, 255, 0.9); color: #1E1645; border-color: rgba(79, 53, 201, 0.3); }
.rv-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.rv-eq i {
    width: 3px;
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(to top, #8B5CF6, #EC4899);
    transform-origin: 50% 100%;
    transform: scaleY(calc(0.25 + var(--kick) * 0.75));
}
.rv-eq i:nth-child(2) { transform: scaleY(calc(0.4 + var(--kick) * 0.5)); }
.rv-eq i:nth-child(3) { transform: scaleY(calc(0.2 + var(--kick) * 0.8)); }
.rv-eq i:nth-child(4) { transform: scaleY(calc(0.35 + var(--kick) * 0.45)); }
.rv-stop {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: rgba(196, 181, 253, 0.16);
    color: inherit;
    cursor: pointer;
    transition: background 0.25s ease;
}
.rv-stop:hover, .rv-stop:focus-visible { background: #EC4899; color: #fff; outline: none; }
.rv-stop:focus-visible { box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.35); }

/* Mobile / schwächere Geräte: nur vier Kegel */
@media (max-width: 640px) {
    .rv-beam:nth-child(2), .rv-beam:nth-child(5) { display: none; }
    .rv-chip { font-size: 0.66rem; }
}

/* Reduced Motion: stehende Lichtstimmung, kein Schwenken, kein Takt */
@media (prefers-reduced-motion: reduce) {
    .rv-beam { animation: none; transform: rotate(calc((var(--i) - 2.5) * 7deg)); }
    .rave-stage.rv2.rv-hue { animation: raveStageIn 0.6s ease both; }
    .rv-chip { animation: none; }
}
@media print { .rave-stage, .confetti-layer, .mx-veil, .mx-canvas { display: none !important; } }
