/* ---------------------------------------------------------
   INTRO CINEMATIC — BOOK OPENING
--------------------------------------------------------- */

/* Intro Container */
#book-intro {
    position: fixed;
    inset: 0;
    background: #0d0a0a;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Book Cover */
.book-cover {
    width: 420px;
    height: 600px;
    background: url('assets/backgrounds/grimoire-texture.png');
    background-size: cover;
    border: 6px solid #3b2a1a;
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
    perspective: 1200px;
    transform-style: preserve-3d;
    transform-origin: left center;
    animation: openBook 5s ease 15s forwards;
    position: relative;
}

/* Glowing Rune */
.book-cover::after {
    content: "✦";
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    color: rgba(255, 220, 150, 0.7);
    text-shadow: 0 0 12px rgba(255, 200, 120, 0.9),
                 0 0 24px rgba(255, 200, 120, 0.6);
    animation: runePulse 35s ease-in-out infinite;
}

@keyframes runePulse {
    0% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
    100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
}

/* Carved Text */
.carving {
    font-family: serif;
    font-size: 2rem;
    color: rgba(255, 230, 180, 0.8);
    text-shadow: 0 0 10px rgba(255, 200, 120, 0.5);
    text-align: center;
    margin-top: 260px;
}

/* Page Turns */
.page-turn,
.page-turn-2 {
    position: absolute;
    width: 420px;
    height: 600px;
    background: #f5e6c8;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotateY(90deg);
    transform-origin: left center;
}

.page-turn {
    animation: turnPage 35s ease 35s forwards;
}

.page-turn-2 {
    animation: turnPage2 35s ease 35s forwards;
}

/* Book Opening Animation */
@keyframes openBook {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(-100deg); }
}

@keyframes turnPage {
    0% { transform: translate(-50%, -50%) rotateY(90deg); }
    100% { transform: translate(-50%, -50%) rotateY(0deg); }
}

@keyframes turnPage2 {
    0% { transform: translate(-50%, -50%) rotateY(90deg); }
    100% { transform: translate(-50%, -50%) rotateY(0deg); }
}

/* Dust Particles */
.dust {
    position: fixed;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    pointer-events: none;
    filter: blur(1px);
    animation: rise 6s linear forwards;
    z-index: 99999;
}

@keyframes rise {
    0% { opacity: 0; transform: translateY(20px) scale(0.5); }
    20% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-120px) scale(1); }
}

/* ---------------------------------------------------------
   GLOBAL RESET + FONTS
--------------------------------------------------------- */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Uncial Antiqua", serif;
    color: white;
    min-height: 100vh;
    transition: background 1s ease, color 1s ease;
    overflow-x: hidden;
}

/* ---------------------------------------------------------
   THEMES — MATCHING YOUR REAL FILES
--------------------------------------------------------- */

/* 🜁 GRIMOIRE */
.theme-grimoire {
    background:
        url("assets/backgrounds/sigils-overlay.png") center/contain repeat,
        url("assets/backgrounds/runes-overlay.png") center/contain repeat,
        url("assets/backgrounds/ouija-wood.jpg") center/cover no-repeat,
        radial-gradient(circle at center, #1a001a, #050005);
    background-blend-mode: overlay, lighten, normal;
}

.theme-grimoire::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url("assets/backgrounds/runes-overlay.png") center/contain repeat;
    opacity: 0.08;
    animation: slowSpin 60s linear infinite;
    pointer-events: none;
}

/* 🌙 CELESTIAL */
.theme-celestial {
    background:
        url("assets/backgrounds/celestial.png") center/cover no-repeat,
        linear-gradient(180deg, #d8caff, #a7d8ff, #ffffff);
    background-blend-mode: screen;
    color: #222;
}

.theme-celestial::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url("assets/backgrounds/celestial.png") center/contain repeat;
    opacity: 0.15;
    animation: driftStars 90s linear infinite;
    pointer-events: none;
}

/* 🌿 DRUIDIC */
.theme-druidic {
    background:
        url("assets/backgrounds/druidic.png") center/cover no-repeat,
        linear-gradient(180deg, #0f3d1e, #1a5e2a, #0b2412);
    background-blend-mode: multiply;
}

.theme-druidic::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url("assets/backgrounds/druidic.png") center/contain repeat;
    opacity: 0.1;
    animation: slowGrow 120s ease-in-out infinite alternate;
    pointer-events: none;
}

/* 🦇 GOTHIC */
.theme-gothic {
    background:
        url("assets/backgrounds/gothic.png") center/cover no-repeat,
        linear-gradient(180deg, #000000, #1a1a1a, #000000);
    background-blend-mode: overlay;
}

.theme-gothic::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url("assets/backgrounds/gothic.png") center/contain repeat;
    opacity: 0.25;
    animation: smokeDrift 50s linear infinite;
    pointer-events: none;
}

/* ---------------------------------------------------------
   ANIMATIONS
--------------------------------------------------------- */

@keyframes slowSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes driftStars {
    from { transform: translateY(0); }
    to { transform: translateY(-200px); }
}

@keyframes slowGrow {
    from { transform: scale(1); }
    to { transform: scale(1.15); }
}

@keyframes smokeDrift {
    from { transform: translateX(0); }
    to { transform: translateX(200px); }
}

/* ---------------------------------------------------------
   HEADER + NAV
--------------------------------------------------------- */

header {
    text-align: center;
    padding: 20px;
}

nav button {
    margin: 5px;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    border-radius: 6px;
    transition: 0.3s;
    background: rgba(80, 0, 120, 0.6);
    border: 1px solid rgba(200, 120, 255, 0.6);
    color: #fff;
    box-shadow: 0 0 10px rgba(200, 120, 255, 0.4);
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}

nav button:hover {
    transform: scale(1.15);
    box-shadow: 0 0 20px rgba(220, 160, 255, 0.8);
}

/* ---------------------------------------------------------
   MAGICAL PARTICLES
--------------------------------------------------------- */

.magic-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: url("assets/effects/particles.gif");
    opacity: 0.4;
    mix-blend-mode: screen;
    z-index: 1;
}

/* ---------------------------------------------------------
   PANELS
--------------------------------------------------------- */

.panel {
    max-width: 700px;
    margin: 60px auto;
    padding: 40px;
    background: rgba(20, 0, 30, 0.6);
    border: 2px solid rgba(180, 80, 255, 0.4);
    border-radius: 12px;
    box-shadow: 0 0 25px rgba(180, 80, 255, 0.3);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 2;
}

.panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("assets/effects/runes.png") center/contain no-repeat;
    opacity: 0.15;
    animation: rotateRunes 40s linear infinite;
    z-index: -1;
}

@keyframes rotateRunes {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ---------------------------------------------------------
   SPIRIT AURA COLORS
--------------------------------------------------------- */

#spirit-image-frame {
    position: relative;
}

#spirit-aura {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    filter: blur(25px);
    opacity: 0.8;
    z-index: -1;
    transition: background 1.2s ease, opacity 1.2s ease;
}

.aura-default {
    background: radial-gradient(circle, rgba(255,255,255,0.2), rgba(0,0,0,0));
}

.aura-wolf {
    background: radial-gradient(circle, rgba(120,180,255,0.7), rgba(0,40,80,0.2));
}

.aura-owl {
    background: radial-gradient(circle, rgba(180,120,255,0.7), rgba(60,0,120,0.2));
}

.aura-stag {
    background: radial-gradient(circle, rgba(120,255,160,0.7), rgba(0,80,40,0.2));
}

.aura-serpent {
    background: radial-gradient(circle, rgba(120,255,255,0.7), rgba(0,60,80,0.2));
}

.aura-fox {
    background: radial-gradient(circle, rgba(255,160,80,0.7), rgba(120,40,0,0.2));
}

/* ---------------------------------------------------------
   LIVING AURA ANIMATIONS
--------------------------------------------------------- */

@keyframes auraPulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 0.7; }
}

@keyframes auraFlare {
    0% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0.4; transform: scale(1); }
}

.aura-animated {
    animation: auraPulse 6s ease-in-out infinite;
}

.aura-flare {
    animation: auraFlare 1.8s ease-out;
}

.aura-mood-joyful {
    filter: hue-rotate(40deg) brightness(1.2);
}

.aura-mood-focused {
    filter: hue-rotate(-20deg) saturate(1.3);
}

.aura-mood-tired {
    filter: brightness(0.7) saturate(0.6);
}

.aura-mood-anxious {
    filter: hue-rotate(180deg) saturate(0.8);
}

.aura-stage-1 { opacity: 0.6; }
.aura-stage-2 { opacity: 0.8; }
.aura-stage-3 { opacity: 1; }

.spirit-shimmer {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, white, transparent);
    border-radius: 50%;
    opacity: 0.8;
    pointer-events: none;
    animation: shimmerRise 3s linear forwards;
    filter: blur(2px);
}

@keyframes shimmerRise {
    0% { transform: translateY(20px) scale(0.4); opacity: 0; }
    20% { opacity: 1; }
    100% { transform: translateY(-60px) scale(1); opacity: 0; }
}

.login-page {
  background: url("assets/backgrounds/grimoire-texture.png");
  background-size: cover;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.login-container {
  background: rgba(10, 5, 20, 0.85);
  padding: 2rem 3rem;
  border: 1px solid rgba(200, 150, 255, 0.4);
  border-radius: 12px;
  backdrop-filter: blur(6px);
  text-align: center;
  width: 320px;
}

.login-title {
  margin-bottom: 1rem;
  color: #e6d6ff;
  text-shadow: 0 0 8px #b38cff;
}

#username {
  width: 100%;
  padding: 0.6rem;
  margin: 0.5rem 0 1rem;
  border-radius: 6px;
  border: none;
}

#login-btn {
  width: 100%;
  padding: 0.7rem;
  background: #b38cff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  color: #1a0f2b;
}
