/* Sivun perusasetukset */
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

body {
    width: 100%;
    min-height: 100vh;
    background-color: #000;
    color: #CC0000;
    font-family: 'Roboto', sans-serif;
}

/* Alku valikko */
#view-selection {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 100vh;
}

.main-title {
    font-family: 'Creepster', cursive;
    font-size: clamp(3rem, 10vw, 7rem);
    letter-spacing: 0.1em;
    animation: fadeIn 8s ease forwards;
}

.subtitle {
    font-size: clamp(1.1rem, 2.2vw, 1.3rem);
    letter-spacing: 0.2em;
    opacity: 0;
    animation: showUp 0s ease forwards;
    animation-delay: 4s;
}

.kortit {
    opacity: 0;
    animation: showUp 0s ease forwards;
    animation-delay: 6s;
}

.algorithm-card {
    border: 1px solid #CC0000;
    border-radius: 4px;
    padding: 2rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
}

.algorithm-card:hover {
    border: none;
    box-shadow: 0 0 20px #CC0000, 0 0 40px #CC0000;
    animation: flicker 0.4s ease forwards;
}

.card-title {
    font-family: 'Creepster', cursive;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    color: #CC0000;
}

.card-description {
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    line-height: 1.6;
    min-height: 3rem;
}

.btn-horror {
    background-color: transparent;
    border: 1px solid #CC0000;
    color: #CC0000;
    font-family: 'Creepster', cursive;
    font-size: clamp(1rem, 2vw, 1.3rem);
    letter-spacing: 0.1em;
    padding: 0.6rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-horror:hover {
    background-color: #CC0000;
    color: #000;
}

.speed-label {
    font-size: clamp(1rem, 2vw, 1.3rem);
}

.footer-text {
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    color: #CC0000;
    letter-spacing: 0.15em;
    margin-top: 3rem;
    opacity: 0;
    animation: showUp 0s ease forwards;
    animation-delay: 8s;
}

#view-game {
    width: 100%;
    min-height: 100vh;
    display: none;
    justify-content: center;
    align-items: center;
}

.game-title {
    font-family: 'Creepster', cursive;
}

input[type="range"] {
    width: 100%;
    accent-color: #CC0000;
    cursor: pointer;
}

#game-canvas {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: block;
}

.game-instruction {
    font-size: clamp(1rem, 2vw, 1.3rem);
}

.fade-out {
    animation: fadeOut 2s ease forwards;
}

.fade-in {
    animation: fadeInFast 2s ease forwards;
}

.btn-control.active {
    background-color: #CC0000;
    color: #000;
}

.btn-horror:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

input[type="range"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#jumpscare-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#jumpscare-overlay.hidden {
    display: none;
}

#jumpscare-image {
    max-height: 80vh;
    transform: scale(0);
    animation: scareScream 0.15s forwards ease-out, shakeEffect 0.1s infinite;
}

@keyframes scareScream {
    0% { transform: scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: scale(1.4); opacity: 1; }
}

@keyframes shakeEffect {
    0% { translate: 2px 2px; }
    25% { translate: -2px -1px; }
    50% { translate: -1px 2px; }
    75% { translate: 1px -2px; }
    100% { translate: 2px 2px; }
}

@keyframes fadeInFast {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes showUp {
    to { opacity: 1; }
}

@keyframes flicker {
    0%   { opacity: 1; }
    25%  { opacity: 0; }
    50%  { opacity: 1; }
    75%  { opacity: 0; }
    100% { opacity: 1; }
}