* {
    padding: 0;
    margin: 0;
    box-sizing: border-box; /* Zorgt dat padding de grootte niet verpest */
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: radial-gradient(circle at center, #3fbdf2 0%, #29A7D9 100%);
    overflow: hidden; /* Voorkomt scrollbalken door zwevende iconen */
    font-family: "Sour Gummy", sans-serif;
}

.main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5em; 
    z-index: 10;
    animation: slideUp 1s ease-out forwards;
}

h1 {
    font-size: 6em; 
    color: #fff;
    /* Extra dikke 3D schaduw */
    text-shadow: 0.03em 0.03em 0px #b30000, 0.06em 0.06em 0px rgba(0,0,0,0.1); 
    /* De h1 wiebelt zachtjes */
    animation: float 4s ease-in-out infinite 1s;
    line-height: 1.1;
}

.start-button {
    display: inline-block;
    background-color: #F7D560;
    color: #1A1A3D;
    text-decoration: none;
    font-size: 2em; 
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.6em 2em; 
    border-radius: 3em;
    border: 0.15em solid #1A1A3D;
    box-shadow: 0px 0.25em 0px #C6A642; 
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Geeft een 'bounce' effect */
    cursor: pointer;
}

.start-button:hover {
    background-color: #ffe17a;
    transform: scale(1.05) translateY(-0.1em);
    box-shadow: 0px 0.35em 0px #C6A642;
}

.start-button:active {
    transform: translateY(0.2em);
    box-shadow: 0px 0.05em 0px #C6A642;
}

/* --- ANIMATIES --- */

@keyframes slideUp {
    from { opacity: 0; transform: translateY(50px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(-1deg); }
    50% { transform: translateY(-20px) rotate(1deg); }
}

/* --- ACHTERGROND ELEMENTEN --- */

.bg-icons {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.icon {
    position: absolute;
    font-size: 5rem;
    opacity: 0.15;
    filter: grayscale(100%) brightness(1.2);
    animation: floatAround 25s infinite linear;
}

.rock { top: 15%; left: 10%; animation-duration: 30s; }
.paper { top: 65%; left: 85%; animation-duration: 25s; animation-delay: -5s; }
.scissors { top: 75%; left: 15%; animation-duration: 28s; animation-delay: -2s; }
.rock2 { top: 25%; left: 75%; animation-duration: 35s; }

@keyframes floatAround {
    0% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, 50px) rotate(120deg); }
    66% { transform: translate(-20px, 100px) rotate(240deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    bottom: -20px;
    animation: rise 10s infinite linear;
}

.p1 { left: 10%; animation-duration: 8s; }
.p2 { left: 30%; animation-duration: 12s; animation-delay: 2s; }
.p3 { left: 50%; animation-duration: 9s; animation-delay: 4s; }
.p4 { left: 70%; animation-duration: 11s; animation-delay: 1s; }
.p5 { left: 90%; animation-duration: 13s; animation-delay: 6s; }

@keyframes rise {
    0% { bottom: -20px; opacity: 0; }
    20% { opacity: 0.5; }
    100% { bottom: 110%; opacity: 0; transform: translateX(30px); }
}

.game-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.video-container {
    position: relative;
    width: 480px;
    height: 360px;
    border: 5px solid #1A1A3D;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

#webcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: rotateY(180deg); /* Spiegelbeeld, werkt fijner */
}

#output_canvas {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    transform: rotateY(180deg);
}

.result-display {
    display: flex;
    gap: 30px;
    font-family: "Sour Gummy", sans-serif;
    font-size: 2em;
    color: white;
    text-shadow: 2px 2px 0 #b30000;
}

#timer {
    font-size: 3em;
    color: #F7D560;
}

.score-board {
    font-family: "Sour Gummy", sans-serif;
    font-size: 3em;
    color: #fff;
    background: rgba(26, 26, 61, 0.5);
    padding: 10px 30px;
    border-radius: 20px;
    border: 3px solid #F7D560;
    text-shadow: 2px 2px 0px #b30000;
    margin-bottom: 10px;
}

.modal {
    display: none; /* Standaard onzichtbaar */
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 26, 61, 0.9); /* Donkere doorzichtige achtergrond */
    backdrop-filter: blur(8px); /* Maakt de achtergrond wazig */
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #29A7D9;
    padding: 3em;
    border-radius: 30px;
    border: 5px solid #F7D560;
    text-align: center;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-content h2 {
    font-family: "Sour Gummy", sans-serif;
    font-size: 3em;
    color: white;
    margin-bottom: 0.5em;
    text-shadow: 3px 3px 0px #b30000;
}

.modal-content p {
    font-family: "Sour Gummy", sans-serif;
    font-size: 1.5em;
    color: #1A1A3D;
    margin-bottom: 1.5em;
}

/* Container voor de webcam */
.video-container {
    position: relative;
    width: 100%;
    max-width: 500px; /* Mooie breedte voor desktop, vult scherm op mobiel */
    margin: 0 auto;
    overflow: hidden;
    border-radius: 15px;
    background: #000;
}

#webcam {
    width: 100%;
    height: auto;
    display: block;
    /* Spiegel de video (zodat links ook echt links is voor de speler) */
    transform: scaleX(-1);
}

/* Knoppen groter maken voor mobiel */
#play-round-btn {
    padding: 15px 30px;
    font-size: 1.2rem;
    width: 90%; /* Bijna schermbreed op mobiel */
    max-width: 300px;
}

/* Flexbox aanpassingen voor kleine schermen */
@media (max-width: 600px) {
    .scores {
        flex-direction: row; /* Scores naast elkaar houden */
        justify-content: space-around;
        font-size: 0.9rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
}