/* ================================================
   Koningsspelen Kroontjes – style.css
   Alle selectors gescopet op #kks-root
   ================================================ */

/* Reset voor standalone gebruik */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ─── Root container ─── */
#kks-root {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    font-family: 'Segoe UI', 'Arial Rounded MT Bold', Arial, sans-serif;
    box-sizing: border-box;
    background-color: #fff8e1;
    background-image:
        radial-gradient(ellipse at top left,    rgba(255, 200, 50, 0.25) 0%, transparent 55%),
        radial-gradient(ellipse at bottom right, rgba(255, 140, 0,  0.20) 0%, transparent 55%),
        radial-gradient(circle, rgba(255, 200, 0, 0.18) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 26px 26px;
}

/* ─── Hulpklasse ─── */
.kks-hidden {
    display: none !important;
}

/* ════════════════════════════════════════════════
   STARTSCHERM
   ════════════════════════════════════════════════ */

#kks-main-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: clamp(10px, 2vh, 28px);
    padding: clamp(8px, 1.5vh, 20px) clamp(12px, 2vw, 32px);
    box-sizing: border-box;
}

/* ─── Header ─── */
#kks-header {
    text-align: center;
    flex-shrink: 0;
}

#kks-title {
    margin: 0;
    font-size: clamp(1.5rem, 3.8vw, 3rem);
    color: #c45000;
    text-shadow:
        1px  1px 0 #ffe082,
        -1px -1px 0 #ffe082,
        0 0 24px rgba(255, 160, 0, 0.35);
    letter-spacing: 0.02em;
    line-height: 1.15;
}

#kks-subtitle {
    margin: 0.3em 0 0;
    font-size: clamp(0.85rem, 1.8vw, 1.3rem);
    color: #8b4513;
    opacity: 0.8;
}

/* ─── Kroontjes-grid ─── */
#kks-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: clamp(10px, 1.8vw, 22px);
    width: 100%;
    max-width: 1080px;
}

/* ─── Kroonknop ─── */
.kks-crown-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: block;
    width: 100%;
    border-radius: 14px;
    position: relative;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    /* Verschijnings-animatie */
    animation: kks-appear 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.kks-crown-btn:not(.kks-used):hover,
.kks-crown-btn:not(.kks-used):focus-visible {
    filter: drop-shadow(0 6px 18px rgba(220, 90, 0, 0.55));
    transform: scale(1.09) translateY(-4px);
    transition: transform 0.15s ease, filter 0.15s ease;
}

.kks-crown-btn:not(.kks-used):active {
    transform: scale(0.93);
    transition: transform 0.08s ease;
}

/* Gebruikte staat */
.kks-crown-btn.kks-used {
    cursor: not-allowed;
    filter: grayscale(1) opacity(0.42);
}

/* ─── SVG-wrapper (behoudt verhouding 100:90) ─── */
.kks-svg-wrap {
    position: relative;
    width: 100%;
    padding-top: 90%;   /* hoogte = 90% van breedte → ratio 100:90 */
}

.kks-svg-wrap svg {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* ─── Vinkje overlay op gebruikte kroon ─── */
.kks-check {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.6rem, 4vw, 3rem);
    color: #22bb55;
    font-weight: 900;
    pointer-events: none;
    z-index: 3;
    /* Iets omhoog zodat het in het kroontjeslichaam valt, niet in de band */
    padding-bottom: 16%;
    text-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

/* ════════════════════════════════════════════════
   CHALLENGE-SCHERM
   ════════════════════════════════════════════════ */

#kks-challenge-screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 248, 225, 0.96);
    z-index: 10;
    padding: clamp(16px, 3vh, 40px) clamp(16px, 3vw, 48px);
    box-sizing: border-box;
    animation: kks-fade-in 0.25s ease;
}

#kks-challenge-card {
    background: #ffffff;
    border-radius: 26px;
    padding: clamp(24px, 4vw, 60px) clamp(28px, 5vw, 72px);
    max-width: 820px;
    width: 100%;
    text-align: center;
    box-shadow:
        0 6px 40px rgba(200, 80, 0, 0.20),
        0 2px 8px rgba(0,0,0,0.08);
    border: 3px solid #ffd000;
    animation: kks-slide-up 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#kks-challenge-deco {
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1;
    margin-bottom: clamp(8px, 1.5vh, 16px);
    animation: kks-spin-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#kks-challenge-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ff8c00, #e65000);
    color: #fff;
    font-size: clamp(0.85rem, 1.8vw, 1.15rem);
    font-weight: 700;
    padding: 5px 22px;
    border-radius: 100px;
    margin-bottom: clamp(10px, 1.8vh, 20px);
    letter-spacing: 0.06em;
    box-shadow: 0 3px 12px rgba(230, 80, 0, 0.38);
}

#kks-challenge-title {
    margin: 0 0 clamp(12px, 2.2vh, 28px);
    font-size: clamp(1.7rem, 4.5vw, 3.2rem);
    color: #c45000;
    line-height: 1.15;
}

#kks-challenge-body {
    margin-bottom: clamp(20px, 3.5vh, 44px);
}

#kks-challenge-instruction {
    margin: 0 0 clamp(10px, 1.5vh, 18px);
    font-size: clamp(1.05rem, 2.8vw, 1.8rem);
    color: #333;
    line-height: 1.5;
    font-weight: 600;
}

#kks-challenge-rule {
    margin: 0;
    font-size: clamp(0.9rem, 2.2vw, 1.4rem);
    color: #c0392b;
    font-style: italic;
    line-height: 1.5;
}

#kks-back-btn {
    background: linear-gradient(135deg, #ff8c00, #e65000);
    color: #fff;
    border: none;
    border-radius: 100px;
    padding: clamp(12px, 1.8vh, 20px) clamp(28px, 5vw, 56px);
    font-size: clamp(1rem, 2.2vw, 1.5rem);
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 4px 18px rgba(220, 80, 0, 0.40);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    letter-spacing: 0.02em;
}

#kks-back-btn:hover,
#kks-back-btn:focus-visible {
    transform: scale(1.06);
    box-shadow: 0 7px 28px rgba(220, 80, 0, 0.60);
    outline: none;
}

#kks-back-btn:active {
    transform: scale(0.96);
}

/* ════════════════════════════════════════════════
   EINDSCHERM
   ════════════════════════════════════════════════ */

#kks-end-screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fff9e6, #ffe57a, #fff3cd);
    z-index: 20;
    overflow: hidden;
    animation: kks-fade-in 0.4s ease;
}

#kks-end-card {
    background: #fff;
    border-radius: 30px;
    padding: clamp(32px, 5vw, 72px) clamp(36px, 6vw, 80px);
    max-width: 680px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 60px rgba(200, 120, 0, 0.30);
    border: 4px solid #ffd000;
    position: relative;
    z-index: 2;
    animation: kks-pop-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#kks-end-emoji {
    font-size: clamp(2.2rem, 6vw, 4rem);
    line-height: 1.1;
    margin-bottom: 14px;
    animation: kks-bounce 1.1s ease-in-out infinite alternate;
    display: block;
}

#kks-end-title {
    margin: 0 0 12px;
    font-size: clamp(1.5rem, 4vw, 2.8rem);
    color: #c45000;
    line-height: 1.2;
}

#kks-end-msg {
    margin: 0 0 clamp(24px, 4vh, 44px);
    font-size: clamp(0.95rem, 2.2vw, 1.4rem);
    color: #666;
    line-height: 1.5;
}

#kks-restart-btn {
    background: linear-gradient(135deg, #ff8c00, #e65000);
    color: #fff;
    border: none;
    border-radius: 100px;
    padding: clamp(14px, 2vh, 22px) clamp(32px, 6vw, 68px);
    font-size: clamp(1.05rem, 2.4vw, 1.6rem);
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 4px 22px rgba(220, 80, 0, 0.45);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    letter-spacing: 0.02em;
}

#kks-restart-btn:hover,
#kks-restart-btn:focus-visible {
    transform: scale(1.07);
    box-shadow: 0 8px 32px rgba(220, 80, 0, 0.65);
    outline: none;
}

#kks-restart-btn:active {
    transform: scale(0.96);
}

/* ─── Confetti ─── */
#kks-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.kks-confetti-piece {
    position: absolute;
    top: -20px;
    border-radius: 2px;
    animation: kks-confetti-fall linear infinite;
}

/* ════════════════════════════════════════════════
   ANIMATIES
   ════════════════════════════════════════════════ */

@keyframes kks-appear {
    from {
        opacity: 0;
        transform: scale(0.55) translateY(16px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes kks-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes kks-slide-up {
    from {
        opacity: 0;
        transform: translateY(48px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes kks-spin-in {
    from {
        opacity: 0;
        transform: rotate(-30deg) scale(0.4);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

@keyframes kks-pop-in {
    from {
        opacity: 0;
        transform: scale(0.4);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes kks-bounce {
    from { transform: translateY(0px); }
    to   { transform: translateY(-14px); }
}

@keyframes kks-confetti-fall {
    from {
        transform: translateY(0) rotate(0deg) translateX(0);
        opacity: 1;
    }
    to {
        transform: translateY(110vh) rotate(720deg) translateX(40px);
        opacity: 0.6;
    }
}
