/**
 * QUEST FOR GLORY - VISUAL MASTERPIECE
 * Mobile-first, breathtakingly beautiful, seamless animations
 * A true work of art in digital storytelling
 */

/* ========================================
   RESPONSIVE FOUNDATION - MOBILE FIRST
   ======================================== */

:root {
    /* Adaptive spacing based on screen size */
    --spacing-xs: clamp(0.25rem, 0.5vw, 0.5rem);
    --spacing-sm: clamp(0.5rem, 1vw, 1rem);
    --spacing-md: clamp(1rem, 2vw, 2rem);
    --spacing-lg: clamp(1.5rem, 3vw, 3rem);
    --spacing-xl: clamp(2rem, 4vw, 4rem);

    /* Adaptive font sizes */
    --font-xs: clamp(0.75rem, 2vw, 0.875rem);
    --font-sm: clamp(0.875rem, 2.5vw, 1rem);
    --font-md: clamp(1rem, 3vw, 1.125rem);
    --font-lg: clamp(1.25rem, 4vw, 1.5rem);
    --font-xl: clamp(1.5rem, 5vw, 2rem);
    --font-2xl: clamp(2rem, 6vw, 3rem);
    --font-3xl: clamp(2.5rem, 8vw, 4rem);

    /* Magical color palette */
    --gold-glow: #FFD700;
    --gold-light: #FFF4D6;
    --gold-dark: #B8860B;
    --purple-mystic: #9B59B6;
    --purple-deep: #6C3483;
    --red-dark: #8B0000;
    --red-blood: #DC143C;
    --blue-electric: #4169E1;
    --blue-ice: #87CEEB;
    --green-forest: #228B22;
    --green-glow: #00FF00;
    --shadow-deep: rgba(0, 0, 0, 0.9);
    --shadow-medium: rgba(0, 0, 0, 0.7);
    --shadow-light: rgba(0, 0, 0, 0.5);

    /* Animation timings */
    --anim-fast: 0.2s;
    --anim-normal: 0.4s;
    --anim-slow: 0.8s;
    --anim-epic: 1.5s;
}

/* ========================================
   GAME OVERLAY - FULL SCREEN EXPERIENCES
   ======================================== */

.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0,0,0,0.95), rgba(20,20,40,0.98));
    z-index: 10000;
    display: none;
    opacity: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    backdrop-filter: blur(10px);
    animation: overlayFadeIn var(--anim-slow) ease-out forwards;
}

.game-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(10px);
    }
}

/* ========================================
   CHARACTER SCENES - CINEMATIC PRESENTATION
   ======================================== */

.character-scene {
    width: 100%;
    max-width: 900px;
    margin: auto;
    position: relative;
    animation: sceneSlideUp var(--anim-epic) cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes sceneSlideUp {
    from {
        opacity: 0;
        transform: translateY(100px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========================================
   CHARACTER PORTRAITS - STUNNING VISUALS
   ======================================== */

.character-portrait {
    display: block;
    margin: 0 auto var(--spacing-lg);
    border-radius: 20px;
    box-shadow:
        0 0 40px rgba(255, 215, 0, 0.5),
        0 10px 60px rgba(0, 0, 0, 0.8),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    border: 3px solid var(--gold-glow);
    animation: portraitEntrance var(--anim-epic) ease-out forwards;
    position: relative;
    overflow: hidden;
}

/* Responsive portrait sizes */
.character-portrait.small {
    width: clamp(80px, 20vw, 120px);
    height: clamp(80px, 20vw, 120px);
}

.character-portrait.medium {
    width: clamp(150px, 35vw, 250px);
    height: clamp(150px, 35vw, 250px);
}

.character-portrait.large {
    width: clamp(200px, 50vw, 400px);
    height: auto;
    max-height: 60vh;
    object-fit: cover;
}

@keyframes portraitEntrance {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
        filter: brightness(0) blur(20px);
    }
    60% {
        transform: scale(1.05) rotate(2deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: brightness(1) blur(0px);
    }
}

.character-portrait:hover {
    transform: scale(1.05);
    box-shadow:
        0 0 60px rgba(255, 215, 0, 0.8),
        0 15px 80px rgba(0, 0, 0, 0.9),
        inset 0 0 30px rgba(255, 255, 255, 0.2);
    transition: all var(--anim-normal) ease-out;
}

/* Magical shimmer effect on portraits */
.character-portrait::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 70%
    );
    animation: portraitShimmer 3s infinite;
}

@keyframes portraitShimmer {
    0%, 100% { transform: translateX(-100%) translateY(-100%); }
    50% { transform: translateX(100%) translateY(100%); }
}

/* ========================================
   DIALOGUE BOXES - ELEGANT STORYTELLING
   ======================================== */

.dialogue-box {
    background: linear-gradient(
        135deg,
        rgba(30, 20, 50, 0.95),
        rgba(50, 30, 70, 0.98)
    );
    border-radius: 25px;
    padding: var(--spacing-lg);
    border: 2px solid var(--gold-glow);
    box-shadow:
        0 0 50px rgba(155, 89, 182, 0.6),
        0 20px 80px rgba(0, 0, 0, 0.9),
        inset 0 0 30px rgba(255, 215, 0, 0.1);
    position: relative;
    overflow: hidden;
    animation: dialogueBoxExpand var(--anim-slow) cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes dialogueBoxExpand {
    from {
        opacity: 0;
        transform: scaleY(0);
        transform-origin: top center;
    }
    to {
        opacity: 1;
        transform: scaleY(1);
    }
}

/* Animated background particles */
.dialogue-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(155, 89, 182, 0.1) 0%, transparent 50%);
    animation: particleFloat 10s ease-in-out infinite;
    pointer-events: none;
}

@keyframes particleFloat {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(10px, -10px); }
    50% { transform: translate(-10px, 10px); }
    75% { transform: translate(10px, 10px); }
}

/* Dialogue box headings */
.dialogue-box h2,
.dialogue-box h3 {
    color: var(--gold-glow);
    text-align: center;
    margin: 0 0 var(--spacing-md) 0;
    font-size: var(--font-xl);
    font-weight: 700;
    text-shadow:
        0 0 20px rgba(255, 215, 0, 0.8),
        0 0 40px rgba(255, 215, 0, 0.4),
        2px 2px 10px rgba(0, 0, 0, 0.8);
    letter-spacing: 2px;
    animation: headingGlow 2s ease-in-out infinite alternate;
}

@keyframes headingGlow {
    from {
        text-shadow:
            0 0 20px rgba(255, 215, 0, 0.8),
            0 0 40px rgba(255, 215, 0, 0.4),
            2px 2px 10px rgba(0, 0, 0, 0.8);
    }
    to {
        text-shadow:
            0 0 30px rgba(255, 215, 0, 1),
            0 0 60px rgba(255, 215, 0, 0.6),
            2px 2px 15px rgba(0, 0, 0, 0.9);
    }
}

/* Dialogue text */
.dialogue-box p {
    color: var(--gold-light);
    font-size: var(--font-md);
    line-height: 1.8;
    margin: var(--spacing-sm) 0;
    text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.8);
    animation: textFadeIn var(--anim-normal) ease-out forwards;
    opacity: 0;
}

.dialogue-box p:nth-child(2) { animation-delay: 0.1s; }
.dialogue-box p:nth-child(3) { animation-delay: 0.2s; }
.dialogue-box p:nth-child(4) { animation-delay: 0.3s; }
.dialogue-box p:nth-child(5) { animation-delay: 0.4s; }

@keyframes textFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   DIALOGUE CHOICES - INTERACTIVE BUTTONS
   ======================================== */

.dialogue-choices {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
    animation: choicesSlideIn var(--anim-slow) ease-out 0.5s forwards;
    opacity: 0;
}

@keyframes choicesSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dialogue-choice {
    background: linear-gradient(
        135deg,
        rgba(155, 89, 182, 0.3),
        rgba(103, 58, 183, 0.4)
    );
    border: 2px solid var(--purple-mystic);
    border-radius: 15px;
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--gold-light);
    font-size: var(--font-md);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--anim-fast) ease-out;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 4px 15px rgba(155, 89, 182, 0.4),
        inset 0 0 20px rgba(255, 215, 0, 0.05);
    text-align: left;
    width: 100%;

    /* Touch-friendly sizing */
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hover effect shimmer */
.dialogue-choice::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4), transparent 70%);
    transform: translate(-50%, -50%);
    transition: width var(--anim-normal) ease-out, height var(--anim-normal) ease-out;
}

.dialogue-choice:hover::before,
.dialogue-choice:active::before {
    width: 500px;
    height: 500px;
}

.dialogue-choice:hover,
.dialogue-choice:active {
    background: linear-gradient(
        135deg,
        rgba(155, 89, 182, 0.6),
        rgba(103, 58, 183, 0.7)
    );
    border-color: var(--gold-glow);
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 8px 30px rgba(255, 215, 0, 0.6),
        0 0 40px rgba(155, 89, 182, 0.8),
        inset 0 0 30px rgba(255, 215, 0, 0.15);
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.dialogue-choice:active {
    transform: translateY(-1px) scale(0.98);
}

/* Choice stagger animation */
.dialogue-choice:nth-child(1) { animation: choicePop var(--anim-normal) ease-out 0.6s forwards; opacity: 0; }
.dialogue-choice:nth-child(2) { animation: choicePop var(--anim-normal) ease-out 0.7s forwards; opacity: 0; }
.dialogue-choice:nth-child(3) { animation: choicePop var(--anim-normal) ease-out 0.8s forwards; opacity: 0; }
.dialogue-choice:nth-child(4) { animation: choicePop var(--anim-normal) ease-out 0.9s forwards; opacity: 0; }

@keyframes choicePop {
    0% {
        opacity: 0;
        transform: scale(0.8) rotateX(90deg);
    }
    60% {
        transform: scale(1.05) rotateX(-5deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotateX(0deg);
    }
}

/* ========================================
   SHIMMERS - DISCOVERY INDICATORS
   ======================================== */

/* Base shimmer styling */
.shimmer-base {
    position: fixed;
    border-radius: 50%;
    cursor: pointer;
    z-index: 999;
    animation: shimmerPulse 3s ease-in-out infinite;
    transition: all var(--anim-fast) ease-out;

    /* Touch-friendly sizing */
    min-width: 60px;
    min-height: 60px;
}

@keyframes shimmerPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
}

/* Shimmer hover effect */
.shimmer-base:hover,
.shimmer-base:active {
    transform: scale(1.5) !important;
    filter: brightness(1.5);
    animation-play-state: paused;
}

/* Dr. Cranium electrical shimmer */
.dr-cranium-shimmer {
    width: clamp(80px, 15vw, 120px);
    height: clamp(80px, 15vw, 120px);
    background: radial-gradient(
        circle,
        rgba(65, 105, 225, 0.8),
        rgba(135, 206, 250, 0.4),
        transparent
    );
    box-shadow:
        0 0 40px rgba(65, 105, 225, 0.9),
        0 0 80px rgba(135, 206, 250, 0.6),
        inset 0 0 30px rgba(255, 255, 255, 0.4);
    animation: electricCrackle 1s ease-in-out infinite;
}

@keyframes electricCrackle {
    0%, 100% {
        box-shadow:
            0 0 40px rgba(65, 105, 225, 0.9),
            0 0 80px rgba(135, 206, 250, 0.6);
    }
    50% {
        box-shadow:
            0 0 60px rgba(65, 105, 225, 1),
            0 0 120px rgba(135, 206, 250, 0.8),
            0 0 20px rgba(255, 255, 255, 1);
    }
}

/* Katrina dark shimmer */
.katrina-shimmer {
    width: clamp(90px, 16vw, 130px);
    height: clamp(90px, 16vw, 130px);
    background: radial-gradient(
        circle,
        rgba(139, 0, 0, 0.7),
        rgba(220, 20, 60, 0.4),
        transparent
    );
    box-shadow:
        0 0 50px rgba(139, 0, 0, 0.9),
        0 0 100px rgba(220, 20, 60, 0.6),
        inset 0 0 40px rgba(139, 0, 0, 0.5);
    animation: darkPulse 2s ease-in-out infinite;
}

@keyframes darkPulse {
    0%, 100% {
        box-shadow:
            0 0 50px rgba(139, 0, 0, 0.9),
            0 0 100px rgba(220, 20, 60, 0.6);
    }
    50% {
        box-shadow:
            0 0 70px rgba(139, 0, 0, 1),
            0 0 140px rgba(220, 20, 60, 0.8),
            0 0 30px rgba(0, 0, 0, 1);
    }
}

/* Julanaar tree shimmer */
.julanaar-tree-shimmer {
    width: clamp(100px, 18vw, 150px);
    height: clamp(100px, 18vw, 150px);
    background: radial-gradient(
        circle,
        rgba(139, 69, 19, 0.6),
        rgba(210, 180, 140, 0.4),
        transparent
    );
    box-shadow:
        0 0 50px rgba(139, 69, 19, 0.8),
        0 0 100px rgba(210, 180, 140, 0.5);
    animation: treePulse 4s ease-in-out infinite;
}

@keyframes treePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            0 0 50px rgba(139, 69, 19, 0.8),
            0 0 100px rgba(210, 180, 140, 0.5);
    }
    50% {
        transform: scale(1.2);
        box-shadow:
            0 0 70px rgba(255, 215, 0, 0.9),
            0 0 140px rgba(34, 139, 34, 0.7);
    }
}

/* Tanya ghostly shimmer */
.tanya-shimmer {
    width: clamp(85px, 15vw, 120px);
    height: clamp(85px, 15vw, 120px);
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.5),
        rgba(200, 200, 255, 0.3),
        transparent
    );
    box-shadow:
        0 0 40px rgba(255, 255, 255, 0.7),
        0 0 80px rgba(200, 200, 255, 0.5);
    animation: ghostlyFade 3s ease-in-out infinite;
}

@keyframes ghostlyFade {
    0%, 100% {
        opacity: 0.4;
        box-shadow:
            0 0 40px rgba(255, 255, 255, 0.7),
            0 0 80px rgba(200, 200, 255, 0.5);
    }
    50% {
        opacity: 0.9;
        box-shadow:
            0 0 60px rgba(255, 255, 255, 1),
            0 0 120px rgba(200, 200, 255, 0.8);
    }
}

/* Erana pixie light */
.erana-pixie {
    width: clamp(30px, 6vw, 50px);
    height: clamp(30px, 6vw, 50px);
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 1),
        rgba(255, 215, 0, 0.9),
        transparent
    );
    box-shadow:
        0 0 30px rgba(255, 215, 0, 1),
        0 0 60px rgba(255, 255, 255, 0.8);
    filter: blur(2px);
    pointer-events: none;
}

/* ========================================
   ERANA WHISPERS - SUBTLE MESSAGES
   ======================================== */

.erana-whisper {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.2),
        rgba(255, 215, 0, 0.15)
    );
    border: 2px solid rgba(255, 215, 0, 0.6);
    border-radius: 25px;
    padding: var(--spacing-lg) var(--spacing-xl);
    z-index: 10001;
    text-align: center;
    pointer-events: none;
    box-shadow:
        0 0 50px rgba(255, 215, 0, 0.7),
        0 10px 50px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    max-width: 90vw;
}

.erana-whisper p {
    color: var(--gold-glow);
    font-size: var(--font-lg);
    font-style: italic;
    text-shadow:
        0 0 15px rgba(255, 215, 0, 0.9),
        0 0 30px rgba(255, 255, 255, 0.6);
    margin: 0;
}

/* ========================================
   POINTS NOTIFICATIONS - REWARDING FEEDBACK
   ======================================== */

.points-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(
        135deg,
        rgba(255, 215, 0, 0.95),
        rgba(184, 134, 11, 0.98)
    );
    border: 3px solid #fff;
    border-radius: 20px;
    padding: var(--spacing-md) var(--spacing-lg);
    z-index: 10002;
    box-shadow:
        0 0 40px rgba(255, 215, 0, 0.9),
        0 10px 40px rgba(0, 0, 0, 0.7);
    animation: pointsPopIn var(--anim-normal) cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    pointer-events: none;
}

@keyframes pointsPopIn {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    70% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.points-notification h3 {
    color: #000;
    font-size: var(--font-lg);
    font-weight: 700;
    margin: 0 0 var(--spacing-xs) 0;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.points-notification p {
    color: rgba(0, 0, 0, 0.8);
    font-size: var(--font-md);
    margin: 0;
    font-weight: 600;
}

/* ========================================
   RELATIONSHIP STATS - VISUAL METERS
   ======================================== */

.relationship-stat {
    margin: var(--spacing-sm) 0;
    padding: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    animation: statSlideIn var(--anim-normal) ease-out forwards;
    opacity: 0;
}

.relationship-stat:nth-child(1) { animation-delay: 0.1s; }
.relationship-stat:nth-child(2) { animation-delay: 0.2s; }
.relationship-stat:nth-child(3) { animation-delay: 0.3s; }
.relationship-stat:nth-child(4) { animation-delay: 0.4s; }

@keyframes statSlideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.stat-label {
    color: var(--gold-light);
    font-size: var(--font-sm);
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-value {
    color: var(--gold-glow);
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.stat-bar {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

.stat-fill {
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--gold-dark),
        var(--gold-glow),
        var(--gold-dark)
    );
    background-size: 200% 100%;
    border-radius: 10px;
    box-shadow:
        0 0 15px rgba(255, 215, 0, 0.8),
        inset 0 1px 2px rgba(255, 255, 255, 0.5);
    animation: statFillGlow 2s linear infinite, statFillUp 1s ease-out forwards;
    transform-origin: left center;
}

@keyframes statFillGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes statFillUp {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

/* ========================================
   MOBILE OPTIMIZATIONS
   ======================================== */

@media (max-width: 768px) {
    .game-overlay {
        padding: var(--spacing-sm);
    }

    .dialogue-box {
        padding: var(--spacing-md);
        border-radius: 20px;
    }

    .character-portrait.large {
        max-height: 50vh;
    }

    .dialogue-choice {
        min-height: 70px; /* Larger touch targets on mobile */
        font-size: var(--font-md);
    }

    /* Shimmer touch targets */
    .shimmer-base {
        min-width: 80px;
        min-height: 80px;
    }

    .points-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: calc(100vw - 20px);
    }
}

@media (max-width: 480px) {
    .dialogue-box h2,
    .dialogue-box h3 {
        font-size: var(--font-lg);
    }

    .dialogue-choice {
        min-height: 80px;
        padding: var(--spacing-sm) var(--spacing-md);
    }

    /* Even larger touch targets on very small screens */
    .shimmer-base {
        min-width: 90px;
        min-height: 90px;
    }
}

/* ========================================
   LANDSCAPE MOBILE OPTIMIZATIONS
   ======================================== */

@media (max-width: 900px) and (orientation: landscape) {
    .game-overlay {
        align-items: flex-start;
    }

    .character-scene {
        margin-top: var(--spacing-sm);
    }

    .character-portrait.large {
        max-height: 40vh;
    }
}

/* ========================================
   LARGE SCREEN ENHANCEMENTS
   ======================================== */

@media (min-width: 1200px) {
    .dialogue-box {
        padding: var(--spacing-xl);
    }

    .character-portrait.large {
        width: 400px;
    }

    /* Enhanced effects on larger screens */
    .dialogue-choice:hover {
        transform: translateY(-5px) scale(1.03);
    }
}

/* ========================================
   ACCESSIBILITY - REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .shimmer-base {
        animation: none;
    }

    .character-portrait::before {
        animation: none;
    }
}

/* ========================================
   HIGH CONTRAST MODE
   ======================================== */

@media (prefers-contrast: high) {
    .dialogue-box {
        border-width: 3px;
    }

    .dialogue-choice {
        border-width: 3px;
    }

    .character-portrait {
        border-width: 4px;
    }
}

/* ========================================
   DARK MODE ADJUSTMENTS
   ======================================== */

@media (prefers-color-scheme: dark) {
    /* Already dark by default, but enhance contrasts */
    .dialogue-box {
        background: linear-gradient(
            135deg,
            rgba(20, 10, 40, 0.98),
            rgba(40, 20, 60, 0.99)
        );
    }
}

/* ========================================
   CINEMATIC TRANSITIONS
   ======================================== */

/* Scene transition wrapper */
.scene-transition {
    animation: sceneTransition var(--anim-epic) cubic-bezier(0.645, 0.045, 0.355, 1) forwards;
}

@keyframes sceneTransition {
    0% {
        opacity: 0;
        filter: blur(20px) brightness(0);
        transform: scale(0.8);
    }
    30% {
        opacity: 0.5;
        filter: blur(10px) brightness(0.5);
    }
    100% {
        opacity: 1;
        filter: blur(0px) brightness(1);
        transform: scale(1);
    }
}

/* Magical particle effects */
.magic-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.magic-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--gold-glow);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    animation: particleRise 4s linear infinite;
}

@keyframes particleRise {
    0% {
        bottom: -10px;
        opacity: 0;
        transform: translateX(0);
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        bottom: 110%;
        opacity: 0;
        transform: translateX(var(--particle-drift, 0px));
    }
}

/* ========================================
   LOADING STATES - ELEGANT FEEDBACK
   ======================================== */

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 215, 0, 0.2);
    border-top-color: var(--gold-glow);
    border-radius: 50%;
    animation: spinnerRotate 1s linear infinite;
    margin: var(--spacing-lg) auto;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

@keyframes spinnerRotate {
    to { transform: rotate(360deg); }
}

/* ========================================
   UTILITY CLASSES - QUICK STYLING
   ======================================== */

.text-glow-gold {
    text-shadow:
        0 0 10px rgba(255, 215, 0, 0.8),
        0 0 20px rgba(255, 215, 0, 0.5);
}

.text-glow-purple {
    text-shadow:
        0 0 10px rgba(155, 89, 182, 0.8),
        0 0 20px rgba(155, 89, 182, 0.5);
}

.text-glow-red {
    text-shadow:
        0 0 10px rgba(220, 20, 60, 0.8),
        0 0 20px rgba(220, 20, 60, 0.5);
}

.fade-in {
    animation: fadeIn var(--anim-normal) ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp var(--anim-normal) ease-out forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

/* ========================================
   PRINT STYLES - DOCUMENTATION READY
   ======================================== */

@media print {
    .game-overlay,
    .shimmer-base,
    .points-notification {
        display: none !important;
    }
}
