:root {
    --bg-dark: #0a0a0a;
    --bg-card: #1a1a1a;
    --gold: #d4af37;
    --accent: #ff4d6d;
    --text-light: #f5f5f5;
    --text-dim: #b0b0b0;
    --cairo: 'Cairo', sans-serif;
    --caveat: 'Caveat', cursive;
    --courier: 'Courier Prime', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: var(--cairo);
    overflow: hidden; /* No scrolling in the main hub */
}

/* Vignette Effect */
.vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 40%, rgba(0,0,0,0.8) 100%);
    pointer-events: none;
    z-index: 5;
}

/* Hub Layout */
.hub-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, #1a1a1a 0%, #000000 100%);
    text-align: center;
}

.glitch {
    font-family: var(--caveat);
    font-size: 5rem;
    color: var(--gold);
    margin-bottom: 10px;
    animation: glitch 500ms infinite;
}

.button-grid {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

.hub-btn {
    background: transparent;
    border: 2px solid var(--gold);
    color: var(--gold);
    padding: 15px 30px;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s ease;
    font-family: var(--cairo);
    min-width: 180px;
}

.hub-btn:hover {
    background: var(--gold);
    color: var(--bg-dark);
    box-shadow: 0 0 20px var(--gold);
    transform: translateY(-5px);
}

/* Modal System */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 100;
    display: none; /* Hidden by default */
    overflow-y: auto;
    padding: 40px 20px;
}

.modal.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

.modal-content {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    padding-top: 60px;
}

.close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 50px;
    z-index: 110;
    font-weight: bold;
}

/* Stacked Cards Section */
.cards-stack-container {
    position: relative;
    height: 500px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
}

.polaroid-card {
    position: absolute;
    background: white;
    padding: 15px 15px 20px 15px; /* قللت الحشوة السفلية لتناسب النصوص والصور معاً */
    width: 280px;
    min-height: 100px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    color: #333;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    transform-origin: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.polaroid-image-placeholder {
    width: 100%;
    height: 220px;
    background: #eee;
    margin-bottom: 15px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.polaroid-text {
    font-family: var(--caveat);
    font-size: 1.2rem;
    text-align: center;
    line-height: 1.4;
}

.controls {
    text-align: center;
    margin-top: 40px;
}

.btn-gold {
    background: var(--gold);
    color: var(--bg-dark);
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 50px;
    font-weight: bold;
}

/* --- REWRITTEN TIMELINE --- */
.timeline {
    position: relative;
    max-width: 1000px;
    margin: 50px auto;
    padding: 40px 0;
}

/* Central Line */
.timeline::after {
    content: '';
    position: absolute;
    width: 4px;
    background-color: var(--gold);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -2px; /* Perfect center */
    z-index: 1;
}

.timeline-item {
    position: relative;
    width: 50%;
    padding: 20px 40px;
    box-sizing: border-box;
    z-index: 2;
    clear: both; /* Force vertical stacking */
}

/* Right Side Items */
.timeline-item.right {
    float: right;
    text-align: right;
}

/* Left Side Items */
.timeline-item.left {
    float: left;
    text-align: left;
}

/* Connection Circles */
.timeline-item::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: var(--bg-dark);
    border: 4px solid var(--accent);
    top: 30px;
    border-radius: 50%;
    z-index: 3;
}

.timeline-item.right::after {
    left: -10px; /* Align with center line */
}

.timeline-item.left::after {
    right: -10px; /* Align with center line */
}

.timeline-content {
    padding: 20px;
    background-color: var(--bg-card);
    border-radius: 10px;
    border: 1px solid #333;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    display: inline-block; /* Content wraps to its own size */
    width: 100%;
    transition: transform 0.3s ease;
}

.timeline-content:hover {
    transform: translateY(-5px);
    border-color: var(--gold);
}

.song-link {
    display: inline-block;
    margin-top: 15px;
    color: var(--gold);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 5px 15px;
    border: 1px solid var(--gold);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.song-link:hover {
    background: var(--gold);
    color: var(--bg-dark);
}

/* Timeline Image Styling */
.timeline-img {
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

/* Clearfix for float layout */
.timeline::before,
.timeline::after {
    content: "";
    display: table;
}
.timeline::after {
    clear: both;
}

/* Polaroid Image Placeholder Styling - Updated */
.polaroid-image-placeholder {
    width: 100%;
    height: 220px;
    background: #ccc;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 0.9rem;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border: 1px solid #ddd;
    border-radius: 5px;
}


/* Envelope & Letter */
.envelope-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 50px;
    cursor: pointer;
}

.envelope {
    width: 280px;
    height: 180px;
    background: #8b0000;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s;
}

.envelope .flap {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 140px solid transparent;
    border-right: 140px solid transparent;
    border-top: 100px solid #a52a2a;
    top: 0;
    z-index: 3;
    transform-origin: top;
    transition: transform 0.5s 0.3s;
}

.envelope .pocket {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 140px solid #800000;
    border-right: 140px solid #800000;
    border-bottom: 90px solid #700000;
    bottom: 0;
    z-index: 2;
}

.envelope.open .flap { transform: rotateX(180deg); }

.letter-container {
    width: 100%;
    max-width: 700px;
    margin: 30px auto;
}

.paper {
    background: #fdf5e6;
    color: #333;
    padding: 40px;
    min-height: 500px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    font-family: var(--courier);
}

.letter-content {
    white-space: pre-wrap;
    font-size: 1.1rem;
    line-height: 1.8;
    direction: ltr; /* English letter content */
    text-align: left;
}

.hidden { display: none; }

/* Glitch Animation */
@keyframes glitch {
    0% { text-shadow: 0.05em 0 0 rgba(255, 77, 109, 0.75), -0.05em -0.025em 0 rgba(212, 175, 55, 0.75); }
    15% { text-shadow: -0.05em -0.025em 0 rgba(255, 77, 109, 0.75), 0.025em 0.025em 0 rgba(212, 175, 55, 0.75); }
    50% { text-shadow: 0.025em 0.05em 0 rgba(255, 77, 109, 0.75), 0.05em 0 0 rgba(212, 175, 55, 0.75); }
    100% { text-shadow: -0.025em 0 0 rgba(255, 77, 109, 0.75), -0.025em -0.025em 0 rgba(212, 175, 55, 0.75); }
}

@media screen and (max-width: 600px) {
    .glitch { font-size: 3rem; }
    .timeline::after { left: 31px; }
    .timeline-item { width: 100%; padding-left: 70px; padding-right: 25px; text-align: right; }
    .timeline-item::after { left: 21px; }
    .right { left: 0%; }
}

/* Password Screen Styling */
.password-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    z-index: 1000;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, #1a1a1a 0%, #000000 100%);
}

.password-screen.active {
    display: flex;
}

.password-container {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 15px;
    border: 1px solid var(--gold);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.2);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.password-title {
    color: var(--gold);
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.password-subtitle {
    color: var(--text-dim);
    margin-bottom: 25px;
    font-size: 1rem;
}

.password-input {
    width: 100%;
    padding: 12px 20px;
    background: #222;
    border: 1px solid #444;
    border-radius: 50px;
    color: white;
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.password-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.password-btn {
    background: var(--gold);
    color: var(--bg-dark);
    border: none;
    padding: 12px 40px;
    border-radius: 50px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.password-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.4);
}

.password-error {
    color: var(--accent);
    margin-top: 15px;
    font-size: 0.9rem;
}

.hidden {
    display: none;
}

/* Knife Rain Styling */
.knife-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1; /* Behind content but above background */
    overflow: hidden;
}

.knife {
    position: absolute;
    color: rgba(255, 255, 255, 0.2); /* Semi-transparent white */
    font-size: 20px;
    user-select: none;
    pointer-events: none;
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.5));
    animation: fall linear infinite;
}

@keyframes fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(110vh) rotate(360deg);
        opacity: 0;
    }
}
