/* ═══════════════════════════════════════════════════════════════════════════
   REVERIE by DEMARCA — Frontend Reading Experience Engine v1.0.5
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Keyframes ─────────────────────────────────────────────────────────── */

@keyframes rv-flicker {
    0%,100% { text-shadow: 0 0 6px #ff6a00, 0 0 14px #ff4500, 0 0 28px #ff2200; color: #ffb347; }
    25%      { text-shadow: 0 0 4px #ff8c00, 0 0 10px #ff4500; color: #ff9a1a; }
    50%      { text-shadow: 0 0 8px #ff6a00, 0 0 20px #ff2200, 0 0 36px #cc1100; color: #ffcc66; }
    75%      { text-shadow: 0 0 3px #ff4400, 0 0 12px #ff3300; color: #ff8822; }
}

@keyframes rv-shimmer {
    0%,100% { text-shadow: 0 0 8px #38bdf8, 0 0 20px #0ea5e9; color: #7dd3fc; filter: brightness(1); }
    50%      { text-shadow: 0 0 14px #38bdf8, 0 0 30px #0284c7, 0 0 45px #0ea5e9; color: #bae6fd; filter: brightness(1.15); }
}

@keyframes rv-frost {
    0%,100% { text-shadow: 0 0 6px #bae6fd, 0 0 16px #7dd3fc; color: #e0f2fe; }
    50%      { text-shadow: 0 0 10px #e0f2fe, 0 0 24px #bae6fd, 0 0 40px #38bdf8; color: #ffffff; }
}

@keyframes rv-shadow-pulse {
    0%,100% { text-shadow: 0 0 8px rgba(0,0,0,0.9), 2px 2px 12px rgba(30,0,50,0.8); color: #9f7aea; filter: brightness(0.75); }
    50%      { text-shadow: 0 0 16px rgba(80,0,120,0.9), 4px 4px 24px rgba(0,0,0,1); color: #6b21a8; filter: brightness(0.5); }
}

@keyframes rv-sun-glow {
    0%,100% { text-shadow: 0 0 8px #fbbf24, 0 0 20px #f59e0b; color: #fcd34d; }
    50%      { text-shadow: 0 0 16px #fbbf24, 0 0 36px #f59e0b, 0 0 56px #d97706; color: #fef08a; }
}

/* Twilight — gold → amber → rose → purple dusk, slow 6s cycle */
@keyframes rv-twilight {
    0%      { text-shadow: 0 0 10px #fbbf24, 0 0 24px #f59e0b; color: #fcd34d; }
    25%     { text-shadow: 0 0 12px #f97316, 0 0 28px #ea580c, 0 0 48px #c2410c; color: #fed7aa; }
    50%     { text-shadow: 0 0 12px #fb7185, 0 0 28px #f43f5e, 0 0 48px #be123c; color: #fecdd3; }
    75%     { text-shadow: 0 0 10px #a78bfa, 0 0 24px #7c3aed, 0 0 44px #4c1d95; color: #ddd6fe; }
    100%    { text-shadow: 0 0 10px #fbbf24, 0 0 24px #f59e0b; color: #fcd34d; }
}

@keyframes rv-moon-glow {
    0%,100% { text-shadow: 0 0 8px #cbd5e1, 0 0 18px #94a3b8; color: #e2e8f0; }
    50%      { text-shadow: 0 0 14px #e2e8f0, 0 0 32px #cbd5e1, 0 0 50px #94a3b8; color: #ffffff; }
}

@keyframes rv-shake {
    0%,100% { transform: translate(0,0) rotate(0deg); }
    10%      { transform: translate(-2px,1px) rotate(-0.5deg); }
    20%      { transform: translate(2px,-1px) rotate(0.5deg); }
    30%      { transform: translate(-1px,2px) rotate(-0.3deg); }
    40%      { transform: translate(1px,-2px) rotate(0.3deg); }
    50%      { transform: translate(-2px,0px) rotate(-0.5deg); }
    60%      { transform: translate(2px,1px) rotate(0.4deg); }
    70%      { transform: translate(-1px,-1px) rotate(-0.2deg); }
    80%      { transform: translate(1px,2px) rotate(0.5deg); }
    90%      { transform: translate(-1px,0px) rotate(-0.3deg); }
}

@keyframes rv-fade-pulse {
    0%,100% { opacity: 1; font-style: italic; }
    50%      { opacity: 0.35; font-style: italic; }
}

/* Explosion / Shockwave — scale burst + flash, plays once */
@keyframes rv-flash {
    0%   { transform: scale(1);    text-shadow: none; color: inherit; filter: none; }
    8%   { transform: scale(1.08); text-shadow: 0 0 20px #fff, 0 0 50px #ff8800; color: #ffffff; filter: brightness(1.4); }
    18%  { transform: scale(1.04); text-shadow: 0 0 12px #ffaa00; color: #ffd700; filter: brightness(1.1); }
    35%  { transform: scale(1.01); text-shadow: 0 0 4px #fb923c; color: #fed7aa; filter: none; }
    100% { transform: scale(1);    text-shadow: none; color: inherit; filter: none; }
}

/* Vampire — subtle dark crimson pulse, no white flashes */
@keyframes rv-vampire {
    0%,100% { text-shadow: 0 0 6px #7f1d1d, 0 0 14px #450a0a; color: #f87171; }
    40%     { text-shadow: 0 0 10px #991b1b, 0 0 22px #7f1d1d; color: #dc2626; }
    70%     { text-shadow: 0 0 4px #450a0a, 0 0 10px #7f1d1d; color: #b91c1c; }
}

/* Werewolf — slow predatory amber-brown pulse, earthy and heavy */
@keyframes rv-werewolf {
    0%,100% { text-shadow: 0 0 6px #92400e, 0 0 14px #78350f; color: #d97706; }
    33%     { text-shadow: 0 0 12px #b45309, 0 0 26px #92400e, 0 0 42px #78350f; color: #fbbf24; }
    66%     { text-shadow: 0 0 8px #78350f, 0 0 18px #451a03; color: #b45309; }
}

/* Bite — dark crimson with fang-dot pseudo-element */
@keyframes rv-bite {
    0%,100% { text-shadow: 0 0 6px #7f1d1d, 0 0 14px #450a0a; color: #fca5a5; }
    50%     { text-shadow: 0 0 12px #dc2626, 0 0 24px #991b1b; color: #f87171; }
}
/* Fang dots above the word */
@keyframes rv-fang-appear {
    0%   { opacity: 0; transform: translateY(-2px) scaleY(0.4); }
    25%  { opacity: 1; transform: translateY(0)    scaleY(1); }
    75%  { opacity: 1; transform: translateY(0)    scaleY(1); }
    100% { opacity: 0; transform: translateY(-2px) scaleY(0.4); }
}

@keyframes rv-bleed {
    0%,100% { text-shadow: 0 0 4px #7f1d1d, 1px 2px 8px #991b1b; color: #dc2626; }
    50%      { text-shadow: 0 0 10px #450a0a, 2px 4px 18px #7f1d1d; color: #b91c1c; }
}

@keyframes rv-sparkle {
    0%,100% { text-shadow: 0 0 6px #c084fc, 0 0 14px #a855f7; color: #e879f9; }
    33%      { text-shadow: 0 0 12px #fbbf24, 0 0 24px #f59e0b, 0 0 40px #c084fc; color: #fde68a; }
    66%      { text-shadow: 0 0 8px #818cf8, 0 0 18px #6366f1; color: #c7d2fe; }
}

@keyframes rv-glow {
    0%,100% { text-shadow: 0 0 6px var(--rv-word-color, #a78bfa), 0 0 14px var(--rv-word-color, #a78bfa); }
    50%      { text-shadow: 0 0 12px var(--rv-word-color, #a78bfa), 0 0 28px var(--rv-word-color, #a78bfa), 0 0 44px var(--rv-word-color, #a78bfa); }
}

@keyframes rv-pulse {
    0%,100% { transform: scale(1); }
    50%      { transform: scale(1.07); }
}

@keyframes rv-warmth {
    0%,100% { text-shadow: 0 0 6px #fb923c, 0 0 14px #f97316; color: #fed7aa; }
    50%      { text-shadow: 0 0 12px #fb923c, 0 0 26px #ea580c, 0 0 40px #c2410c; color: #ffedd5; }
}

@keyframes rv-heartbeat {
    0%,100%  { transform: scale(1);    color: #f43f5e; text-shadow: 0 0 6px #f43f5e; }
    14%      { transform: scale(1.08); color: #fb7185; text-shadow: 0 0 14px #f43f5e, 0 0 28px #fb7185; }
    28%      { transform: scale(1); }
    42%      { transform: scale(1.05); }
    70%      { transform: scale(1); }
}

@keyframes rv-adrenaline {
    0%,100% { transform: scale(1) skewX(0deg); color: #ef4444; text-shadow: 0 0 8px #ef4444; }
    20%     { transform: scale(1.06) skewX(-1.5deg); color: #fbbf24; text-shadow: 0 0 16px #ef4444, 2px 0 0 #fbbf24; }
    40%     { transform: scale(1.04) skewX(1.5deg); }
    60%     { transform: scale(1.08) skewX(-1deg); color: #f97316; }
    80%     { transform: scale(1.02) skewX(0.5deg); }
}

@keyframes rv-fight {
    0%,100% { transform: translate(0,0); text-shadow: 0 0 8px #ef4444; color: #fca5a5; }
    15%     { transform: translate(-3px, 1px) rotate(-1deg); }
    30%     { transform: translate(3px,-1px) rotate(1deg); text-shadow: 0 0 18px #ef4444, 3px 0 0 #fbbf24; }
    45%     { transform: translate(-2px, 2px); }
    60%     { transform: translate(2px,-2px) rotate(-0.5deg); }
    75%     { transform: translate(-1px,1px); }
    90%     { transform: translate(1px,-1px) rotate(0.5deg); }
}

@keyframes rv-fight-soft {
    0%,100% { transform: translate(0,0); color: #fca5a5; text-shadow: 0 0 4px rgba(239,68,68,0.5); }
    20%     { transform: translate(-1px, 0.5px) rotate(-0.4deg); }
    40%     { transform: translate(1px, -0.5px) rotate(0.4deg); text-shadow: 0 0 8px rgba(239,68,68,0.6); }
    60%     { transform: translate(-0.5px, 0.5px); }
    80%     { transform: translate(0.5px, -0.5px) rotate(0.2deg); }
}

@keyframes rv-sensual {
    0%,100% { text-shadow: 0 0 6px #fb7185, 0 0 14px #f43f5e; color: #fda4af; transform: scaleX(1); }
    50%      { text-shadow: 0 0 12px #f9a8d4, 0 0 26px #fb7185, 0 0 40px #f43f5e; color: #fecdd3; transform: scaleX(1.04); }
}

/* rv-vampire and rv-werewolf keyframes defined in the flash/explosion section above */

@keyframes rv-erotic {
    0%,100% { text-shadow: 0 0 8px #be123c, 0 0 18px #9f1239; color: #fda4af; transform: scaleX(1); }
    30%      { text-shadow: 0 0 16px #fb7185, 0 0 32px #f43f5e, 0 0 52px #be123c; color: #fecdd3; transform: scaleX(1.06); filter: brightness(1.08); }
    60%      { text-shadow: 0 0 10px #f43f5e, 0 0 24px #be123c; color: #fda4af; transform: scaleX(1); }
}

@keyframes rv-power {
    0%,100% { text-shadow: 0 0 8px #818cf8, 0 0 20px #6366f1; color: #c7d2fe; }
    33%     { text-shadow: 0 0 16px #fbbf24, 0 0 36px #f59e0b; color: #fef08a; }
    66%     { text-shadow: 0 0 20px #c084fc, 0 0 40px #a855f7, 0 0 60px #6366f1; color: #e879f9; }
}

@keyframes rv-breath {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.004); }
    100% { transform: scale(1); }
}

@keyframes rv-fog-drift {
    0%,100% { color: #94a3b8; text-shadow: 0 0 12px rgba(148,163,184,0.4), 0 0 28px rgba(100,116,139,0.2); opacity: 0.7; }
    50%      { color: #cbd5e1; text-shadow: 0 0 20px rgba(203,213,225,0.5), 0 0 40px rgba(148,163,184,0.3); opacity: 0.9; }
}

@keyframes rv-shatter {
    0%,100% { transform: translate(0,0) skewX(0deg);    color: #f1f5f9; text-shadow: none; }
    8%      { transform: translate(-3px,0) skewX(-3deg); color: #ffffff; text-shadow: 0 0 8px #fff, 2px 0 0 #94a3b8; }
    16%     { transform: translate(3px,1px) skewX(3deg); }
    24%     { transform: translate(-1px,0) skewX(-1deg);  color: #e2e8f0; }
    32%     { transform: translate(0,0); }
}

@keyframes rv-tremble {
    0%,100% { transform: translate(0,0);        color: #c4b5fd; text-shadow: 0 0 4px #a78bfa; }
    20%     { transform: translate(-1px, 0.5px); }
    40%     { transform: translate(1px, -0.5px); }
    60%     { transform: translate(-0.5px, 1px); }
    80%     { transform: translate(0.5px, -0.5px); }
}

@keyframes rv-rage {
    0%,100% { transform: scale(1);               color: #ef4444; text-shadow: 0 0 6px #dc2626; }
    25%     { transform: scale(1.05) skewX(-1deg); color: #fca5a5; text-shadow: 0 0 14px #ef4444, 0 0 28px #b91c1c; }
    50%     { transform: scale(1.02);              color: #f87171; text-shadow: 0 0 20px #dc2626, 0 0 40px #7f1d1d; }
    75%     { transform: scale(1.04) skewX(1deg);  color: #fca5a5; }
}

/* rv-alone and rv-silence removed in v1.0.8 — words removed from word map */

@keyframes rv-heart-of-gold {
    0%,100%  { transform: scale(1);    color: #fcd34d; text-shadow: 0 0 8px #f59e0b, 0 0 20px #d97706; }
    14%      { transform: scale(1.1);  color: #fef08a; text-shadow: 0 0 16px #fbbf24, 0 0 36px #f59e0b, 0 0 56px #d97706; }
    28%      { transform: scale(1); }
    42%      { transform: scale(1.06); color: #fde68a; text-shadow: 0 0 12px #fbbf24, 0 0 28px #f59e0b; }
    70%      { transform: scale(1); }
}

@keyframes rv-darkness {
    0%,100% { text-shadow: 0 0 8px rgba(0,0,0,0.9), 2px 2px 12px rgba(30,0,50,0.8); color: #9f7aea; filter: brightness(0.75); }
    50%     { text-shadow: 0 0 16px rgba(80,0,120,0.9), 4px 4px 24px rgba(0,0,0,1); color: #6b21a8; filter: brightness(0.5); }
}

@keyframes rv-grunt {
    0%,100% { transform: translate(0,0) scale(1); color: inherit; text-shadow: none; }
    8%      { transform: translate(-2px, 1px) scale(1.05); color: #fca5a5; text-shadow: 0 0 8px #ef4444; }
    16%     { transform: translate(2px, -1px) scale(1.03); }
    28%     { transform: translate(-1px, 0px) scale(1.01); color: #fecaca; text-shadow: 0 0 4px #ef4444; }
    40%     { transform: translate(0,0) scale(1); color: inherit; text-shadow: none; }
}

@keyframes rv-roar {
    0%,100% { transform: scale(1);    color: #f97316; text-shadow: 0 0 6px #ea580c, 0 0 14px #c2410c; }
    20%     { transform: scale(1.08); color: #fb923c; text-shadow: 0 0 14px #f97316, 0 0 28px #ea580c, 0 0 48px #9a3412; }
    40%     { transform: scale(1.04); color: #fed7aa; text-shadow: 0 0 20px #f97316, 0 0 40px #c2410c; }
    60%     { transform: scale(1.06); color: #fb923c; text-shadow: 0 0 16px #f97316, 0 0 32px #ea580c; }
    80%     { transform: scale(1.02); }
}

/* ─── Word Effect Classes ────────────────────────────────────────────────── */
.rv-word {
    display: inline;
    text-indent: 0 !important;
}

.rv-fire      { animation: rv-flicker      1.8s ease-in-out infinite; }
.rv-water     { animation: rv-shimmer      2.4s ease-in-out infinite; }
.rv-ice       { animation: rv-frost        3s   ease-in-out infinite; }
.rv-shadow    { animation: rv-shadow-pulse 3s   ease-in-out infinite; }
.rv-darkness  { animation: rv-darkness     3s   ease-in-out infinite; }
.rv-sun       { animation: rv-sun-glow     2.5s ease-in-out infinite; }
.rv-twilight  { animation: rv-twilight     6s   ease-in-out infinite; }
.rv-moon      { animation: rv-moon-glow    4s   ease-in-out infinite; }
.rv-fog       { animation: rv-fog-drift    5s   ease-in-out infinite; }
.rv-smoke     { animation: rv-fog-drift    6s   ease-in-out infinite; }

/* silence and alone removed from word map */

.rv-scream    { animation: rv-shake        0.5s ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-whisper   { animation: rv-fade-pulse   2.8s ease-in-out infinite; }
.rv-explosion { animation: rv-flash        1s   ease-out 1 forwards;  display: inline-block; text-indent: 0 !important; }
.rv-fight     { animation: rv-fight        0.6s ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-fight-soft{ animation: rv-fight-soft   1s   ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-grunt     { animation: rv-grunt        1.4s ease-out infinite;    display: inline-block; text-indent: 0 !important; }
.rv-roar      { animation: rv-roar         1.6s ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-shatter   { animation: rv-shatter      0.7s ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-tremble   { animation: rv-tremble      1.8s ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-rage      { animation: rv-rage         1s   ease-in-out infinite; display: inline-block; text-indent: 0 !important; }

/* Sensual group */
.rv-touch     { animation: rv-sensual      3s   ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-kiss      { animation: rv-sensual      3.2s ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-caress    { animation: rv-sensual      4s   ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-sex       { animation: rv-erotic       3.5s ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-orgasm    { animation: rv-erotic       2.8s ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-warmth    { animation: rv-warmth       3.2s ease-in-out infinite; }

/* Supernatural */
.rv-vampire   { animation: rv-vampire      5s   ease-in-out infinite; }
.rv-werewolf  { animation: rv-werewolf     4s   ease-in-out infinite; }

/* Bite — crimson pulse with fang dot pseudo-elements */
.rv-bite {
    animation: rv-bite          4s ease-in-out infinite;
    position: relative;
}
.rv-bite::before {
    content: '▾▾';
    position: absolute;
    top: -0.9em;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.45em;
    letter-spacing: 0.15em;
    color: #dc2626;
    pointer-events: none;
    animation: rv-fang-appear   4s ease-in-out infinite;
    line-height: 1;
}

.rv-adrenaline{ animation: rv-adrenaline   1.4s ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-heartbeat { animation: rv-heartbeat    1s   ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-heartgold { animation: rv-heart-of-gold 1.2s ease-in-out infinite; display: inline-block; text-indent: 0 !important; }

.rv-blood     { animation: rv-bleed        2s   ease-in-out infinite; }
.rv-wound     { animation: rv-bleed        2.3s ease-in-out infinite; }
.rv-died      { animation: rv-bleed        2.6s ease-in-out infinite; }

.rv-death { animation: rv-death-readable   4s   ease-in-out infinite; }
@keyframes rv-death-readable {
    0%,100% { text-shadow: 0 0 8px rgba(150,0,30,0.9), 0 0 20px rgba(80,0,20,0.7); color: #e57373; }
    50%     { text-shadow: 0 0 16px rgba(120,0,20,1),  0 0 36px rgba(60,0,10,0.9);  color: #c62828; }
}

.rv-spell     { animation: rv-sparkle      1.8s ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-power     { animation: rv-power        2.5s ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-awakened  { animation: rv-power        2s   ease-in-out infinite; display: inline-block; text-indent: 0 !important; }

.rv-custom-glow    { animation: rv-glow         2.5s ease-in-out infinite; }
.rv-custom-pulse   { animation: rv-pulse          2s  ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-custom-shimmer { animation: rv-shimmer        2.4s ease-in-out infinite; }
.rv-custom-flicker { animation: rv-flicker        1.8s ease-in-out infinite; }
.rv-custom-shake   { animation: rv-shake          0.5s ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-custom-frost   { animation: rv-frost          3s   ease-in-out infinite; }
.rv-custom-shadow  { animation: rv-shadow-pulse   3s   ease-in-out infinite; }
.rv-custom-bleed   { animation: rv-bleed          2s   ease-in-out infinite; }
.rv-custom-sparkle { animation: rv-sparkle        1.8s ease-in-out infinite; display: inline-block; text-indent: 0 !important; }
.rv-custom-warmth  { animation: rv-warmth         3s   ease-in-out infinite; }
.rv-custom-fade    { animation: rv-fade-pulse      2.8s ease-in-out infinite; }

/* ─── Dialogue — italic + stronger white glow ───────────────────────────── */
.rv-dialogue {
    font-style: italic;
    color: inherit;
    text-shadow: 0 0 12px rgba(255,255,255,0.28), 0 0 4px rgba(255,255,255,0.18);
}
/* Word effects inside dialogue keep italic */
.rv-dialogue .rv-word { font-style: italic; }

/* ─── Reading Halo — fixed viewport overlay ─────────────────────────────── */
/*
   Uses a layered background to create a rectangular "window of light":
   - Two linear gradients handle top/bottom soft fades
   - One linear gradient handles very gentle left/right edge softening
   - The center zone is fully transparent (lit), edges dark
   Net effect: a wide tall rectangle of light that follows the reading zone,
   with no oval or circular falloff — sides stay bright across the full column.
*/
#rv-halo {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9990;
    opacity: 0;
    transition: opacity 0.7s ease;
}

/* ─── Breath Animation ───────────────────────────────────────────────────── */
.rv-breath-active { animation: rv-breath 3.5s ease-in-out 1; }

/* ─── Atmosphere Canvas ─────────────────────────────────────────────────── */
#rv-atmosphere {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9980;
    opacity: 0.45;
    transition: opacity 0.6s ease;
}

/* ─── Control Panel ──────────────────────────────────────────────────────── */
#rv-panel {
    position: fixed;
    bottom: 28px;
    left: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#rv-panel-toggle {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    border-radius: 50%;
    background: rgba(13,13,18,0.88);
    border: 1px solid rgba(167,139,250,0.35);
    color: rgba(167,139,250,0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    transition: border-color 0.25s, box-shadow 0.25s, color 0.25s, transform 0.2s;
    box-shadow: 0 2px 16px rgba(0,0,0,0.4);
    padding: 0;
    flex-shrink: 0;
}

#rv-panel-toggle:hover,
#rv-panel.rv-panel-open #rv-panel-toggle {
    border-color: rgba(167,139,250,0.8);
    color: rgba(167,139,250,1);
    box-shadow: 0 0 20px rgba(167,139,250,0.25);
    transform: scale(1.05);
}

#rv-panel-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(13,13,18,0.92);
    border: 1px solid rgba(167,139,250,0.2);
    border-radius: 12px;
    padding: 14px 16px;
    backdrop-filter: blur(14px);
    box-shadow: 0 4px 32px rgba(0,0,0,0.5);
    min-width: 180px;
    margin-bottom: 10px;
    opacity: 0;
    transform: translateY(8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    order: -1;
}

#rv-panel.rv-panel-open #rv-panel-controls {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.rv-panel-label {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 11px;
    letter-spacing: 0.22em;
    color: rgba(167,139,250,0.55);
    text-transform: uppercase;
    margin-bottom: 6px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(167,139,250,0.1);
}

.rv-panel-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 0;
}

.rv-panel-icon {
    color: rgba(167,139,250,0.6);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.rv-panel-row-label {
    font-size: 12px;
    color: rgba(226,224,240,0.8);
    flex: 1;
    letter-spacing: 0.02em;
    user-select: none;
}

/* ─── Tier cycling button ────────────────────────────────────────────────── */
.rv-tier-control {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.rv-tier-icon {
    color: rgba(167,139,250,0.6);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.rv-tier-label {
    font-size: 12px;
    color: rgba(226,224,240,0.8);
    flex: 1;
    letter-spacing: 0.02em;
    user-select: none;
}

/* Single cycling button — pill shape matching toggle switches */
.rv-tier-btn {
    width: 44px;
    height: 24px;
    border-radius: 24px;
    border: 1px solid rgba(167,139,250,0.3);
    background: rgba(255,255,255,0.06);
    color: rgba(167,139,250,0.5);
    font-size: 10px;
    font-family: 'Cormorant Garamond', Georgia, serif;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

/* Off state */
.rv-tier-btn[data-tier="0"] {
    color: rgba(148,163,184,0.5);
    border-color: rgba(148,163,184,0.2);
    background: transparent;
}

/* Tier I — soft purple */
.rv-tier-btn[data-tier="1"] {
    background: rgba(167,139,250,0.15);
    border-color: rgba(167,139,250,0.5);
    color: rgba(167,139,250,0.8);
}

/* Tier II — medium purple */
.rv-tier-btn[data-tier="2"] {
    background: rgba(167,139,250,0.35);
    border-color: rgba(167,139,250,0.7);
    color: rgba(226,224,240,0.95);
}

/* Tier III — full accent, subtle pulse */
.rv-tier-btn[data-tier="3"] {
    background: rgba(167,139,250,0.85);
    border-color: rgba(167,139,250,1);
    color: #0d0d12;
    box-shadow: 0 0 8px rgba(167,139,250,0.4);
}

/* ─── Volume slider row (appears when Ambience is on) ───────────────────── */
.rv-volume-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    /* Use margin instead of max-height for cleaner collapse — no overflow clipping */
    margin-top: -6px;
    margin-bottom: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    transition: height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
}

.rv-volume-row.rv-volume-visible {
    height: 20px;
    opacity: 1;
    pointer-events: all;
    margin-top: -2px;
    margin-bottom: 2px;
}

.rv-volume-icon {
    color: rgba(167,139,250,0.45);
    font-size: 9px;
    flex-shrink: 0;
    line-height: 1;
    width: 13px;
    text-align: center;
}

/* Custom range slider */
.rv-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 3px;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    background: linear-gradient(
        to right,
        rgba(167,139,250,0.7) 0%,
        rgba(167,139,250,0.7) var(--rv-vol, 22%),
        rgba(167,139,250,0.18) var(--rv-vol, 22%),
        rgba(167,139,250,0.18) 100%
    );
}

.rv-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: rgba(167,139,250,0.9);
    cursor: pointer;
    box-shadow: 0 0 4px rgba(167,139,250,0.4);
    transition: background 0.2s, box-shadow 0.2s;
}

.rv-volume-slider::-moz-range-thumb {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: none;
    background: rgba(167,139,250,0.9);
    cursor: pointer;
}

.rv-volume-slider::-webkit-slider-thumb:hover {
    background: rgba(167,139,250,1);
    box-shadow: 0 0 8px rgba(167,139,250,0.6);
}

/* Toggle switch */
.reverie-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.reverie-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.reverie-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.12);
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.25s;
}
.reverie-slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
}
.reverie-switch input:checked + .reverie-slider { background: #a78bfa; }
.reverie-switch input:checked + .reverie-slider::before { transform: translateX(20px); }

/* ─── Typewriter ─────────────────────────────────────────────────────────── */
.rv-typewriter-p {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.rv-typewriter-p.rv-revealed {
    opacity: 1;
    transform: translateY(0);
}
