* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all 0.5s ease;
}

/* Welcome overlay styles */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    visibility: visible;
    transition: opacity 1s ease, visibility 1s ease;
}

.welcome-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.welcome-content {
    text-align: center;
    color: #fff;
    padding: 2rem;
    max-width: 600px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    transform: translateY(0);
    transition: transform 0.8s ease;
}

.welcome-overlay.hidden .welcome-content {
    transform: translateY(-50px);
}

.welcome-content h1 {
    font-family: var(--font-tertiary);
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 400;
    letter-spacing: 0.05em;
}

.welcome-content p {
    font-family: var(--font-secondary);
    font-style: italic;
    margin-bottom: 2rem;
    line-height: 1.6;
    opacity: 0.9;
}

.welcome-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.begin-button,
.spotify-button {
    background-color: transparent;
    color: #fff;
    border: 2px solid #fff;
    padding: 0.8rem 2rem;
    font-family: var(--font-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 30px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.begin-button:hover,
.spotify-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.spotify-button {
    background-color: #1DB954;
    border-color: #1DB954;
}

.spotify-button:hover {
    background-color: #1ed760;
    border-color: #1ed760;
}

.spotify-icon {
    margin-right: 8px;
    font-size: 1.2em;
}

:root {
    --bg-color: #f9f7f1;
    --text-color: #222;
    --accent-color: #476d58;
    --font-primary: 'EB Garamond', serif;
    --font-secondary: 'Spectral', serif;
    --font-tertiary: 'Libre Baskerville', serif;
    --font-size-base: 1.25rem;
    --line-height: 1.7;
    --letter-spacing: 0.01em;
    --paragraph-spacing: 1.8em;
}

body {
    font-family: var(--font-secondary);
    font-style: italic;
    background-color: #000;
    color: var(--text-color);
    line-height: var(--line-height);
    letter-spacing: var(--letter-spacing);
    font-size: var(--font-size-base);
    font-weight: 400;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 1.5s ease;
}

/* Body stays dark even after welcome screen */
body.letter-active {
    background-color: #111;
    transition: background-color 1.5s ease;
}

.container {
    max-width: 800px;
    width: 100%;
    background-color: #222;
    color: #e0e0e0;
    padding: 3.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.4), 0 2px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease, transform 1s ease, box-shadow 0.5s ease;
}

.container.visible {
    opacity: 1;
    transform: translateY(0);
}

.container:hover {
    box-shadow: 0 15px 60px rgba(0, 0, 0, 0.5), 0 3px 15px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
}

.letter {
    position: relative;
    padding: 1rem 0;
}

.letter p {
    margin-bottom: var(--paragraph-spacing);
    position: relative;
    text-indent: 1em;
    color: #e0e0e0;
}

.letter p:first-of-type {
    text-indent: 0;
}

.lyrics {
    margin: 3rem 0;
    padding: 2rem;
    font-family: var(--font-secondary);
    font-style: italic;
    line-height: 2;
    background-color: rgba(88, 138, 107, 0.15);
    border: 1px solid rgba(88, 138, 107, 0.2);
    border-radius: 8px;
    opacity: 1;
    /* Start visible */
    transform: translateY(0);
    /* No initial transformation */
    transition: all 0.8s ease;
}

.lyrics.reveal {
    opacity: 1;
    transform: translateY(0);
}

.lyrics p {
    margin-bottom: 0.8em;
    text-align: center;
    font-size: 1.1em;
    color: #c0f0d0;
}

.lyrics p:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .lyrics {
        margin: 2rem 0;
        padding: 1.5rem;
    }

    .lyrics p {
        font-size: 1em;
    }
}

/* Cursor styles removed */

.theme-highlight {
    position: relative;
    z-index: 2;
    color: #e0e0e0;
    font-family: var(--font-secondary);
    letter-spacing: var(--letter-spacing);
    pointer-events: none;
    transition: all 0.8s ease;
}

.theme-highlight.reveal {
    border-bottom: 1px dotted #588a6b;
    color: #a0e0c0;
    padding: 0 3px;
    cursor: pointer;
    pointer-events: auto;
    font-weight: 500;
}

.theme-highlight:hover {
    background-color: rgba(88, 138, 107, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border-radius: 2px;
    border-bottom-color: transparent;
    color: #d0ffd0;
}

.interaction-hint {
    text-align: center;
    margin: 2rem 0 1rem;
    padding: 1.2rem;
    border-radius: 8px;
    background-color: rgba(71, 109, 88, 0.15);
    border: 1px solid rgba(71, 109, 88, 0.2);
    color: #a0e0c0;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s ease 0.6s, transform 0.8s ease 0.6s;
}

.interaction-hint.visible {
    opacity: 1;
    transform: translateY(0);
}

.show-all-btn {
    background-color: transparent;
    color: #a0e0c0;
    border: 2px solid #588a6b;
    border-radius: 30px;
    padding: 0.6rem 1.8rem;
    font-family: var(--font-secondary);
    font-style: italic;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.03em;
}

.show-all-btn:hover {
    background-color: #588a6b;
    color: #111;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.audio-controls {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    align-items: center;
    padding: 1.2rem 1.5rem;
    background: rgba(20, 20, 20, 0.85);
    border-radius: 40px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(15px);
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease 1s, transform 0.8s ease 1s, background 0.3s ease;
}

.audio-controls.visible {
    opacity: 1;
    transform: translateY(0);
}

.audio-controls:hover {
    background: rgba(30, 30, 30, 0.9);
}

.audio-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    outline: none;
    position: relative;
}

.audio-btn::before {
    content: '';
    position: absolute;
    left: 17px;
    top: 13px;
    border-style: solid;
    border-width: 10px 0 10px 14px;
    border-color: transparent transparent transparent white;
    transition: all 0.3s ease;
}

.audio-btn.playing::before {
    content: '';
    left: 16px;
    border-style: double;
    border-width: 0 0 0 12px;
    height: 18px;
}

.audio-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
    background-color: #588a6b;
}

.audio-info {
    margin-left: 1.2rem;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 230px;
    font-family: var(--font-secondary);
    letter-spacing: 0.02em;
    transition: color 0.3s ease;
}

.audio-controls:hover .audio-info {
    color: rgba(255, 255, 255, 0.95);
}

@media (max-width: 768px) {
    .audio-controls {
        bottom: 1rem;
        right: 1rem;
        padding: 0.8rem;
    }

    .audio-info {
        max-width: 150px;
    }
}

.hint-icon {
    margin-right: 0.5rem;
    font-size: 1.2rem;
    color: #b8f0d0;
}

.interaction-hint p {
    margin: 0;
    color: #a0e0c0;
}

.interaction-hint kbd {
    display: inline-block;
    padding: 2px 4px;
    font-family: monospace;
    font-size: 0.85em;
    line-height: 1;
    color: #e0e0e0;
    background-color: #333;
    border: 1px solid #555;
    border-radius: 3px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
    margin: 0 2px;
    vertical-align: middle;
}

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease 1.2s, transform 0.8s ease 1.2s;
}

.controls.visible {
    opacity: 1;
    transform: translateY(0);
}

.hidden {
    display: none;
}

.reset-btn {
    background-color: transparent;
    color: #a0e0c0;
    border: 2px solid #588a6b;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    outline: none;
}

.reset-btn:hover {
    transform: scale(1.1) rotate(45deg);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    background-color: #588a6b;
    color: #111;
}

/* Animation Container Styles */
.animations-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.theme-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    z-index: 1;
    pointer-events: none;
}

.theme-animation.active {
    opacity: 1;
    visibility: visible;
}

/* Theme Styles */
/* Common theme styles */
[class*="theme-"] {
    background-color: #111;
    /* Keep dark base for all themes */
}

[class*="theme-"] .container {
    background-color: #222;
    /* Consistent dark container */
    color: #e0e0e0;
    /* Consistent text color */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Cherry Blossom Theme */
.theme-cherry .container {
    border-color: rgba(255, 209, 220, 0.3);
    box-shadow: 0 0 50px rgba(255, 155, 180, 0.1), 0 0 20px rgba(255, 155, 180, 0.05);
}

.theme-cherry::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 70% 30%, rgba(255, 209, 220, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

/* Home Theme */
.theme-home .container {
    border-color: rgba(210, 197, 157, 0.3);
    box-shadow: 0 0 50px rgba(210, 197, 157, 0.1), 0 0 20px rgba(210, 197, 157, 0.05);
}

.theme-home::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 50%, rgba(210, 197, 157, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

/* Fire Theme */
.theme-fire .container {
    border-color: rgba(255, 183, 77, 0.3);
    box-shadow: 0 0 50px rgba(255, 183, 77, 0.1), 0 0 20px rgba(255, 183, 77, 0.05);
}

.theme-fire::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 60% 70%, rgba(255, 183, 77, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

/* Darkness Theme */
.theme-darkness .container {
    background-color: #1a1a1a;
    border-color: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 0, 0, 0.3);
}

/* Light Theme - subtle */
.theme-light .container {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.1), 0 0 20px rgba(255, 255, 255, 0.05);
}

.theme-light::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.06) 0%, transparent 60%);
    pointer-events: none;
}

.theme-light .theme-highlight[data-theme="light"] {
    position: relative;
}

.theme-light .theme-highlight[data-theme="light"]::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    opacity: 0;
    animation: subtle-glow 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes subtle-glow {

    0%,
    100% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }
}

/* Bear Theme */
.theme-bear .container {
    border-color: rgba(192, 170, 142, 0.3);
    box-shadow: 0 0 50px rgba(192, 170, 142, 0.1), 0 0 20px rgba(192, 170, 142, 0.05);
}

.theme-bear::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 40% 60%, rgba(192, 170, 142, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

/* Lover Theme */
.theme-lover .container {
    border-color: rgba(255, 192, 203, 0.3);
    box-shadow: 0 0 50px rgba(255, 192, 203, 0.1), 0 0 20px rgba(255, 192, 203, 0.05);
}

.theme-lover::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 40%, rgba(255, 192, 203, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.theme-lover .theme-highlight[data-theme="lover"] {
    position: relative;
    /* Avoid any size changes that would cause jumpiness */
    color: #ff8d9e; /* Just change the color instead of adding effects */
    transition: color 0.3s ease;
}

/* Floating hearts effect - position fixed to prevent layout reflow */
.theme-lover .hearts-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: 999;
}

.theme-lover .heart {
    position: absolute;
    font-size: 12px;
    color: rgba(255, 77, 109, 0.25);
    opacity: 0;
    animation: float-up 5s ease-in-out forwards;
}

/* Birds Theme */
.theme-birds .container {
    border-color: rgba(179, 212, 255, 0.3);
    box-shadow: 0 0 50px rgba(179, 212, 255, 0.1), 0 0 20px rgba(179, 212, 255, 0.05);
}

.theme-birds::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 80% 20%, rgba(179, 212, 255, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

/* Song Theme */
.theme-song .container {
    border-color: rgba(212, 194, 255, 0.3);
    box-shadow: 0 0 50px rgba(212, 194, 255, 0.1), 0 0 20px rgba(212, 194, 255, 0.05);
}

.theme-song::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 30%, rgba(212, 194, 255, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

/* Glass Theme */
.theme-glass .container {
    border-color: rgba(179, 230, 194, 0.3);
    box-shadow: 0 0 50px rgba(179, 230, 194, 0.1), 0 0 20px rgba(179, 230, 194, 0.05);
}

.theme-glass::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 80%, rgba(179, 230, 194, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

@keyframes float-up {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }
    
    10% {
        opacity: 0.4;
    }
    
    50% {
        opacity: 0.5;
        transform: translateY(-50vh) rotate(60deg);
    }
    
    90% {
        opacity: 0.1;
    }
    
    100% {
        transform: translateY(-100vh) rotate(120deg);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
        font-size: calc(var(--font-size-base) - 0.05rem);
    }

    .container {
        padding: 2rem;
    }
}

@media print {
    body {
        background: none;
        padding: 0;
    }

    .container {
        box-shadow: none;
        border: none;
        padding: 1cm;
        max-width: 100%;
    }

    .animations-container,
    .controls {
        display: none;
    }

    .theme-highlight {
        color: inherit;
        text-decoration: none;
        border-bottom: none;
    }
}