:root {
    /* Cute Theme Variables */
    --bg-color: #fff0f5;
    --text-color: #ff69b4;
    --accent-color: #ffb7b2;
    --font-primary: 'Fredoka', sans-serif;
    --font-secondary: 'Fredoka', cursive;
    --shadow-color: rgba(255, 105, 180, 0.2);
    --btn-bg: #ff69b4;
    --btn-text: #ffffff;
    --overlay-opacity: 0;
    --transition-speed: 0.5s;
}

body.horror-mode {
    /* Horror Theme Variables */
    --bg-color: #1a0505;
    /* Blackish red */
    --text-color: #8b0000;
    --accent-color: #4a0404;
    --font-primary: 'Creepster', cursive;
    --font-secondary: 'Courier New', monospace;
    --shadow-color: rgba(139, 0, 0, 0.5);
    --btn-bg: #330000;
    --btn-text: #ff0000;
    --overlay-opacity: 0.2;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all var(--transition-speed) ease;
}

html,
body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    /* Prevent default scrolling */
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at center, rgba(255, 255, 255, 0.7), rgba(255, 182, 193, 0.1));
    color: var(--text-color);
    font-family: var(--font-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    /* Improved mobile text scaling */
    -webkit-text-size-adjust: 100%;
}

/* START OVERLAY */
#start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    /* Matches initial theme */
    color: var(--text-color);
    z-index: 9999;
    /* Higher than everything */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-family: var(--font-primary);
    text-align: center;
    transition: opacity 0.5s ease-out, visibility 0.5s;
    /* Subtle pulsing background for attention */
    animation: slow-pulse 3s infinite alternate;
}

@keyframes slow-pulse {
    0% {
        background-color: #fff0f5;
    }

    100% {
        background-color: #ffe4e1;
    }
}

#start-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.start-content h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    margin-bottom: 20px;
}

.tap-icon {
    font-size: clamp(3rem, 8vw, 5rem);
    margin-top: 30px;
    animation: bounce 1.5s infinite;
    cursor: pointer;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

/* MAIN CONTENT */
.container {
    text-align: center;
    z-index: 2;
    position: relative;
    width: 90%;
    max-width: 600px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    /* Fill container height */
}

header h1 {
    font-size: clamp(2.2rem, 7vw, 4.5rem);
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px var(--shadow-color);
    line-height: 1.2;
}

header p {
    font-size: clamp(1.1rem, 4vw, 1.8rem);
    font-family: var(--font-secondary);
    letter-spacing: 1px;
    opacity: 0.8;
}

.character-container {
    margin: 2rem 0;
    position: relative;
    height: clamp(30vh, 400px, 50vh);
    /* Very responsive height */
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

img#ririn-char {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 15px var(--shadow-color));
    transition: transform 0.3s ease-in-out, filter 0.3s ease;
    /* Ensure image doesn't get squished */
    min-height: 200px;
}

/* Base Floating Animation (Cute) */
@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0px);
    }
}

.floating {
    animation: float 4s ease-in-out infinite;
}

/* Button Styles */
button {
    background-color: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    padding: 18px 45px;
    /* Larger touch target */
    border-radius: 50px;
    font-size: 1.3rem;
    font-weight: bold;
    font-family: var(--font-primary);
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s, box-shadow 0.2s, background-color 0.2s;
    user-select: none;
    touch-action: manipulation;
    white-space: nowrap;
}

button:active {
    transform: scale(0.95);
}

/* Footer */
footer {
    position: absolute;
    bottom: 15px;
    font-size: 0.8rem;
    opacity: 0.6;
    width: 100%;
    text-align: center;
}

/* --- HORROR MODE SPECIFIC --- */

/* Background Texture/Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Simple SVG Noise */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.4'/%3E%3C/svg%3E");
    opacity: 0;
    z-index: 1;
    mix-blend-mode: overlay;
    transition: opacity 0.5s;
}

body.horror-mode .overlay {
    opacity: var(--overlay-opacity);
    background-color: rgba(50, 0, 0, 0.4);
    animation: flash 4s infinite random;
    /* More complex flash */
}

/* Shake Animation */
@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}

@keyframes flicker {
    0% {
        opacity: 1;
    }

    3% {
        opacity: 0.1;
    }

    6% {
        opacity: 1;
    }

    7% {
        opacity: 0.1;
    }

    8% {
        opacity: 1;
    }

    9% {
        opacity: 1;
    }

    10% {
        opacity: 0.1;
    }

    11% {
        opacity: 1;
    }

    100% {
        opacity: 1;
    }
}

/* Horror Specific Overrides */
body.horror-mode #ririn-char {
    animation: shake 2.5s infinite linear alternate-reverse;
}

body.horror-mode h1 {
    animation: shake 0.5s infinite;
    color: #ff0000;
    text-shadow: 4px 4px 0px #000;
}

body.horror-mode p {
    animation: flicker 4s infinite step-end;
    color: #cc0000;
    font-weight: bold;
}

body.horror-mode button {
    background-color: #000;
    color: #ff0000;
    border: 3px solid #ff0000;
    box-shadow: 0 0 20px #ff0000, inset 0 0 10px #ff0000;
    animation: shake 3s infinite;
    font-family: 'Creepster', cursive;
    letter-spacing: 2px;
}

body.horror-mode button:active {
    background-color: #ff0000;
    color: #000;
}

/* Mobile Optimizations */
@media (max-height: 600px) {

    /* Special handling for very short screens (landscape mobile) */
    .character-container {
        height: 200px;
        margin: 10px 0;
    }

    header h1 {
        font-size: 2rem;
    }
}