/* ===== FADE-IN ANIMATION ===== */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in-content {
    animation: fade-in 0.5s ease-in;
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ===== COLOR PALETTE ===== */
:root {
    --aged-parchment: #E8D8B0;
    --warm-paper-shadow: #D6C3A1;
    --sepia-brown: #6B4F3A;
    --dark-mahogany: #4A2E1F;
    --ink-black: #1C1A18;
    --wax-seal-red: #8B2F2F;
    --antique-gold: #C2A24D;
    --dusty-teal: #2F4A4A;
}

/* ===== BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Crimson Text', serif;
    background: var(--dark-mahogany);
    color: var(--ink-black);
    height: 100vh;
    overflow: hidden;
    cursor: none;
    position: relative;
}

/* ===== STUDY ROOM ENVIRONMENT ===== */
.study-room {
    width: 100%;
    height: 100vh;
    position: relative;
    background: url('assets/floor.jpg') center/cover;
    overflow: hidden;
}

/* ===== VISUAL EFFECTS ===== */
.vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 200px rgba(0, 0, 0, 0.7);
    pointer-events: none;
    z-index: 1000;
}

.film-grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,.1) 2px, rgba(255,255,255,.1) 4px),
        repeating-linear-gradient(-45deg, transparent, transparent 2px, rgba(0,0,0,.1) 2px, rgba(0,0,0,.1) 4px);
    pointer-events: none;
    z-index: 999;
}

/* ===== DUST PARTICLES ===== */
.dust-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.dust-particles::before,
.dust-particles::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(232, 216, 176, 0.3);
    border-radius: 50%;
}


/* ===== DESK SURFACE ===== */
.desk-surface {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    height: 70vh;
    background: url('assets/table.jpg') center/cover;
    border-radius: 10px;
    box-shadow: 
        inset 0 2px 10px rgba(0, 0, 0, 0.5),
        0 10px 30px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
}

.desk-surface::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        url('assets/table.jpg') center/cover;
    opacity: 0.3;
}

/* ===== MENU PARCHMENT ===== */
.menu-parchment {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(var(--rotation, 0deg));
    width: 500px;
    min-height: 400px;
    background: url('assets/paper.jpg') center/cover;
    border-radius: 3px;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    padding: 40px;
    position: relative;
    overflow: hidden;
}



/* ===== POSTAL STAMP WATERMARK ===== */
.postal-stamp-watermark {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border: 2px solid rgba(107, 79, 58, 0.2);
    border-radius: 50%;
    opacity: 0.1;
}

.postal-stamp-watermark::before {
    content: 'POST';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8px;
    color: var(--sepia-brown);
    font-weight: bold;
}


/* ===== TYPOGRAPHY ===== */
.game-title {
    font-family: 'Tangerine', cursive;
    font-size: 6rem;
    font-weight: 400;
    color: var(--ink-black);
    text-align: center;
    margin-bottom: 2rem;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.3),
        0 0 1px rgba(194, 162, 77, 0.3);
    letter-spacing: 0.05em;
    position: relative;
    line-height: 1;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.4));
}

.game-title::before {
    display: none;
}

.game-title::after {
    display: none;
}

/* ===== MENU BUTTONS ===== */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    margin-top: 2rem;
}

.parchment-btn {
    background: var(--aged-parchment);
    border: 1px solid rgba(107, 79, 58, 0.3);
    padding: 1rem 2.5rem;
    min-width: 180px;
    position: relative;
    cursor: none;
    border-radius: 2px;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transition: all 0.2s ease;
}

.parchment-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        transparent 50%, 
        rgba(0, 0, 0, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.parchment-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(194, 162, 77, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.parchment-btn:hover::before {
    opacity: 1;
}

.parchment-btn:active {
    transform: translateY(-1px);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-text {
    font-family: 'Crimson Text', serif;
    font-size: 1.3rem;
    color: var(--ink-black);
    position: relative;
    z-index: 2;
    letter-spacing: 1px;
}

/* ===== WAX SEALS ===== */
.wax-seal-small {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: var(--wax-seal-red);
    border-radius: 50%;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 1px rgba(255, 100, 100, 0.3);
    opacity: 0.7;
    transition: all 0.2s ease;
}

.wax-seal-small::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: var(--antique-gold);
    border-radius: 50%;
}

.parchment-btn:hover .wax-seal-small {
    opacity: 1;
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.4),
        inset 0 1px 2px rgba(255, 100, 100, 0.4),
        0 0 10px rgba(139, 47, 47, 0.3);
}

/* ===== INK SCRIBBLE ===== */
.ink-scribble {
    position: absolute;
    bottom: 20px;
    right: 30px;
    width: 40px;
    height: 20px;
    opacity: 0.2;
    transform: rotate(15deg);
}

.ink-scribble::before {
    content: '...';
    font-family: 'Crimson Text', serif;
    font-style: italic;
    color: var(--sepia-brown);
    font-size: 1.2rem;
}

/* ===== DESK ITEMS ===== */
.desk-items {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 20px;
    align-items: flex-end;
}

.letter-bundle {
    width: 60px;
    height: 80px;
    background: var(--warm-paper-shadow);
    border: 1px solid rgba(107, 79, 58, 0.3);
    position: relative;
    transform: rotate(-5deg);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.letter-bundle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -10px;
    right: -10px;
    height: 2px;
    background: var(--sepia-brown);
    transform: rotate(-2deg);
}

.ink-well {
    width: 30px;
    height: 25px;
    background: var(--dark-mahogany);
    border-radius: 50% 50% 40% 40%;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(0, 0, 0, 0.5);
    position: relative;
}

.ink-well::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 15px;
    background: var(--ink-black);
    border-radius: 50%;
    opacity: 0.8;
}

.quill-pen {
    width: 3px;
    height: 60px;
    background: linear-gradient(to bottom, #F5F5DC 0%, #D2B48C 100%);
    transform: rotate(25deg);
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.quill-pen::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 8px solid var(--ink-black);
}

/* ===== CUSTOM CURSOR ===== */
.custom-cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" fill="%231C1A18" stroke="%23E8D8B0" stroke-width="1"/></svg>') no-repeat center center;
    background-size: contain;
    pointer-events: none;
    z-index: 10000;
    transition: transform 0.1s ease;
    opacity: 0.8;
}

.custom-cursor.clicking {
    transform: scale(0.9);
}

/* Ensure cursor is always visible over modals */
.victorian-modal .custom-cursor,
.victorian-modal:hover .custom-cursor {
    opacity: 0.8 !important;
    z-index: 10003 !important;
    pointer-events: none !important;
}

/* ===== AMBIENT ELEMENTS ===== */
.ambient-objects {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.floating-papers {
    position: absolute;
    width: 40px;
    height: 50px;
    background: var(--warm-paper-shadow);
    border: 1px solid rgba(107, 79, 58, 0.2);
    opacity: 0.3;
}

.floating-papers:nth-child(1) {
    top: 15%;
    left: 5%;
    transform: rotate(-10deg);
}

.floating-papers:nth-child(2) {
    top: 70%;
    right: 8%;
    transform: rotate(5deg);
}

.floating-papers:nth-child(3) {
    top: 40%;
    left: 85%;
    transform: rotate(-3deg);
}


.wall-portrait {
    position: absolute;
    top: 8%;
    right: 15%;
    width: 80px;
    height: 100px;
    background: linear-gradient(135deg, #4A2E1F 0%, #3A1F15 100%);
    border: 8px solid var(--antique-gold);
    border-radius: 2px;
    box-shadow: 
        0 5px 15px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    opacity: 0.6;
}

.wall-portrait::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 40%;
    background: rgba(107, 79, 58, 0.3);
    border-radius: 50%;
}

.wall-portrait::after {
    content: '';
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 25%;
    background: rgba(107, 79, 58, 0.2);
    border-radius: 2px;
}

.bookshelf {
    position: absolute;
    top: 20%;
    left: 5%;
    width: 120px;
    height: 150px;
    perspective: 1000px;
}

.book {
    position: absolute;
    background: var(--sepia-brown);
    border-radius: 1px;
    transform-style: preserve-3d;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.book:nth-child(1) {
    width: 15px;
    height: 80px;
    bottom: 0;
    left: 0;
    transform: rotateY(-5deg);
    background: linear-gradient(90deg, #6B4F3A 0%, #5A3F2A 100%);
}

.book:nth-child(2) {
    width: 18px;
    height: 85px;
    bottom: 0;
    left: 18px;
    transform: rotateY(3deg);
    background: linear-gradient(90deg, #4A2E1F 0%, #3A1F15 100%);
}

.book:nth-child(3) {
    width: 12px;
    height: 75px;
    bottom: 0;
    left: 38px;
    transform: rotateY(-2deg);
    background: linear-gradient(90deg, #8B2F2F 0%, #6B1F1F 100%);
}

.book:nth-child(4) {
    width: 20px;
    height: 90px;
    bottom: 0;
    left: 52px;
    transform: rotateY(5deg);
    background: linear-gradient(90deg, #2F4A4A 0%, #1F3A3A 100%);
}

.book:nth-child(5) {
    width: 16px;
    height: 78px;
    bottom: 0;
    left: 74px;
    transform: rotateY(-3deg);
    background: linear-gradient(90deg, #C2A24D 0%, #A2823D 100%);
}

.candle-holder {
    position: absolute;
    top: 15%;
    right: 8%;
    width: 30px;
    height: 40px;
}

.candle-stick {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 30px;
    background: linear-gradient(90deg, var(--antique-gold) 0%, #8B7355 50%, var(--antique-gold) 100%);
    border-radius: 1px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

.candle-flame-main {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 20px;
    background: radial-gradient(ellipse at bottom, 
        rgba(255, 220, 150, 0.8) 0%, 
        rgba(255, 200, 100, 0.4) 40%, 
        transparent 70%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}


.ink-bottle {
    position: absolute;
    bottom: 25%;
    right: 12%;
    width: 25px;
    height: 35px;
    background: linear-gradient(135deg, #2F4A4A 0%, #1F3A3A 100%);
    border-radius: 40% 40% 50% 50%;
    box-shadow: 
        0 3px 8px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.ink-bottle::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 8px;
    background: var(--dark-mahogany);
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.ink-bottle::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 20px;
    background: var(--ink-black);
    border-radius: 50%;
    opacity: 0.8;
}

.vintage-clock {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background: var(--antique-gold);
    border-radius: 50%;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.clock-face {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: var(--aged-parchment);
    border-radius: 50%;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.clock-hand {
    position: absolute;
    background: var(--ink-black);
    transform-origin: bottom center;
    left: 50%;
    bottom: 50%;
}

.clock-hand.hour {
    width: 3px;
    height: 15px;
    transform: translateX(-50%) rotate(45deg);
}

.clock-hand.minute {
    width: 2px;
    height: 20px;
    transform: translateX(-50%) rotate(180deg);
}


/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .menu-parchment {
        width: 90%;
        max-width: 400px;
        padding: 30px 20px;
    }
    
    .game-title {
        font-size: 2.5rem;
    }
    
    .parchment-btn {
        min-width: 150px;
        padding: 0.8rem 2rem;
    }
    
    .btn-text {
        font-size: 1.1rem;
    }
    
    .desk-items,
    .wall-portrait,
    .bookshelf,
    .candle-holder,
    .ink-bottle,
    .vintage-clock {
        display: none;
    }
    
    .floating-papers {
        display: none;
    }
}

/* ===== ACCESSIBILITY FEATURES ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Keyboard focus styles */
.parchment-btn.focused {
    outline: 3px solid var(--antique-gold);
    outline-offset: 2px;
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(194, 162, 77, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.parchment-btn:focus {
    outline: 2px solid var(--antique-gold);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .parchment-btn {
        border: 2px solid var(--ink-black);
    }
    
    .game-title {
        text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .custom-cursor {
        display: none;
    }
    
    body {
        cursor: auto;
    }
}

/* Enhanced responsive design */
@media (max-width: 480px) {
    .menu-parchment {
        width: 95%;
        padding: 20px 15px;
    }
    
    .game-title {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }
    
    .parchment-btn {
        min-width: 120px;
        padding: 0.6rem 1.5rem;
    }
    
    .btn-text {
        font-size: 1rem;
    }
    
    .loading-bar-container {
        width: 250px;
    }
    
    .loading-message {
        font-size: 1rem;
    }
}

@media (max-height: 600px) {
    .desk-surface {
        height: 80vh;
        padding: 20px;
    }
    
    .game-title {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }
    
    .menu-buttons {
        gap: 1rem;
        margin-top: 1rem;
    }
}

/* Print styles */
@media print {
    .vignette,
    .film-grain,
    .custom-cursor,
    .window-light {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .menu-parchment {
        background: white !important;
        box-shadow: none !important;
        border: 1px solid black !important;
    }
}
