/* KnikkerPop - Simpel Pop-Spel Stijlen */
/* Ontwikkeld door Raymond van Hoorn voor SlimmeKids.be */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Fredoka', 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* Intro Screen */
#intro-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
}

#intro-screen.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    z-index: -1 !important;
    pointer-events: none !important;
}

#intro-content {
    width: 100%;
    max-width: 600px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

#intro-title {
    color: #ffd700;
    font-size: clamp(36px, 8vw, 64px);
    font-weight: 800;
    text-align: center;
    margin: 0;
    padding: 20px;
    text-shadow: 
        0 0 10px rgba(255, 215, 0, 0.8),
        0 0 20px rgba(255, 215, 0, 0.6),
        0 0 30px rgba(255, 215, 0, 0.4);
    animation: titleGlow 2s ease-in-out infinite;
    letter-spacing: 2px;
}

@keyframes titleGlow {
    0%, 100% {
        text-shadow: 
            0 0 10px rgba(255, 215, 0, 0.8),
            0 0 20px rgba(255, 215, 0, 0.6),
            0 0 30px rgba(255, 215, 0, 0.4);
    }
    50% {
        text-shadow: 
            0 0 20px rgba(255, 215, 0, 1),
            0 0 30px rgba(255, 215, 0, 0.8),
            0 0 40px rgba(255, 215, 0, 0.6);
    }
}

#intro-instructions {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    width: 100%;
    max-width: 500px;
    border: 3px solid rgba(255, 215, 0, 0.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#intro-instructions h2 {
    color: #2c3e50;
    font-size: clamp(20px, 5vw, 28px);
    font-weight: 700;
    margin-bottom: 15px;
}

#intro-instructions ul {
    list-style: none;
    padding: 0;
    text-align: left;
}

#intro-instructions li {
    color: #2c3e50;
    font-size: clamp(16px, 4vw, 20px);
    margin-bottom: 12px;
    padding-left: 30px;
    position: relative;
    line-height: 1.6;
    font-weight: 500;
}

#intro-instructions li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #667eea;
    font-size: 24px;
    font-weight: bold;
}

#loading-text {
    color: #2c3e50;
    font-size: clamp(14px, 3.5vw, 18px);
    text-align: center;
    font-weight: 500;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    margin: 10px 0;
}

#start-button {
    margin-top: 20px;
    padding: 15px 40px;
    font-size: clamp(18px, 4vw, 24px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 3px solid #ffd700;
    border-radius: 25px;
    cursor: pointer;
    font-family: 'Fredoka', 'Comic Sans MS', cursive, sans-serif;
    font-weight: 700;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(255, 215, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#start-button:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 
        0 8px 25px rgba(102, 126, 234, 0.5),
        0 0 30px rgba(255, 215, 0, 0.6);
}

#start-button:active {
    transform: translateY(-2px) scale(1.02);
}

/* Game Screen */
#game-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    z-index: 100;
    padding: 10px;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Game Header */
#game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    margin-bottom: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    gap: 10px;
}

#lives-display,
#level-display,
#leaves-display {
    font-size: clamp(14px, 3vw, 18px);
    font-weight: 700;
    color: #2c3e50;
    background: linear-gradient(135deg, #ffd93d 0%, #ff6b6b 100%);
    padding: 8px 12px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    flex: 1;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.life-icon {
    font-size: clamp(16px, 3.5vw, 20px);
}

/* Frog Area */
#frog-area {
    width: 100%;
    max-width: 100%;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    margin-bottom: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#frog-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5px 0;
}

#frog {
    font-size: clamp(40px, 10vw, 60px);
    animation: frogIdle 2s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

@keyframes frogIdle {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-5px) scale(1.05);
    }
}

@keyframes frogEat {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.3) rotate(-5deg);
    }
    50% {
        transform: scale(1.2) rotate(5deg);
    }
    75% {
        transform: scale(1.3) rotate(-5deg);
    }
}

/* Energy Bar */
#energy-bar-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#energy-bar-label {
    font-size: clamp(12px, 2.5vw, 16px);
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
}

#energy-bar {
    width: 100%;
    height: 25px;
    background: rgba(200, 200, 200, 0.3);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    position: relative;
}

#energy-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #8BC34A 50%, #CDDC39 100%);
    border-radius: 12px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.6);
    position: relative;
    overflow: hidden;
}

#energy-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progressShine 2s infinite;
}

#energy-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(11px, 2.5vw, 14px);
    font-weight: 700;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

@keyframes progressShine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

@media (max-width: 480px) {
    #game-header {
        padding: 10px 15px;
        margin-bottom: 8px;
    }
    
    #score-display,
    #level-display {
        font-size: 16px;
        padding: 8px 15px;
    }
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes matchMessagePop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes matchMessageFadeOut {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
}

/* Game Board Container */
#game-board-container {
    width: 100%;
    max-width: 100%;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 10px;
}

/* Game Board - 8 rijen x 6 kolommen (kleinere hoogte) */
#game-board {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 3px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.3),
        inset 0 2px 10px rgba(255, 255, 255, 0.8);
    border: 3px solid rgba(255, 215, 0, 0.5);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
    aspect-ratio: 6/8;
    max-height: calc(100vh - 250px);
}

/* Leaf Styling */
.leaf {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(20px, 5vw, 30px);
    z-index: 100;
    pointer-events: none;
    animation: leafFloat 2s ease-in-out infinite;
}

@keyframes leafFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-5px) rotate(5deg);
    }
}

@keyframes leafAppear {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

@keyframes leafDisappear {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
}

/* Snake Styling */
.snake {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    pointer-events: none;
    animation: snakeMove 1s ease-in-out infinite;
}

.snake img {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

@keyframes snakeMove {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes snakeStop {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

/* Bomb Charge Indicator - BOVENOP de bom, niet eronder */
.bomb-charge {
    position: absolute;
    z-index: 20;
    pointer-events: none;
}

@keyframes bombReady {
    0%, 100% {
        box-shadow: 
            0 0 20px rgba(255, 215, 0, 1),
            0 0 40px rgba(255, 140, 0, 0.8);
        transform: scale(1);
    }
    50% {
        box-shadow: 
            0 0 30px rgba(255, 215, 0, 1),
            0 0 60px rgba(255, 140, 0, 1);
        transform: scale(1.1);
    }
}

@keyframes bombReadyBadge {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
}

/* Leaf Collection Feedback */
.leaf-collection-feedback {
    font-family: 'Fredoka', sans-serif;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
}

/* Leaf near match indicator */
.leaf.near-match {
    animation: leafPulse 0.5s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(76, 175, 80, 0.8));
}

@keyframes leafPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.leaf.collecting {
    animation: leafCollecting 0.5s ease-in-out infinite !important;
    filter: drop-shadow(0 0 15px rgba(76, 175, 80, 1)) !important;
    z-index: 200 !important;
}

@keyframes leafCollecting {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.3) rotate(-10deg);
    }
    50% {
        transform: scale(1.4) rotate(0deg);
    }
    75% {
        transform: scale(1.3) rotate(10deg);
    }
}

@keyframes feedbackPop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes feedbackFadeOut {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
}

@keyframes warningPop {
    0% {
        transform: translateX(-50%) translateY(0) scale(0.8);
        opacity: 0;
    }
    50% {
        transform: translateX(-50%) translateY(-5px) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) translateY(0) scale(1);
        opacity: 1;
    }
}

/* Game Over Screen - verbeterd zoals kast en muis */
#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
    box-sizing: border-box;
}

#game-over-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.98) 100%);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    padding: clamp(25px, 6vw, 40px);
    max-width: 90%;
    width: 100%;
    max-width: 500px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(255, 215, 0, 0.3);
    border: 4px solid rgba(255, 215, 0, 0.6);
    text-align: center;
    animation: gameOverAppear 0.5s ease-out;
}

@keyframes gameOverAppear {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

#game-over-title {
    font-size: clamp(32px, 8vw, 48px);
    font-weight: 800;
    color: #2c3e50;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

#game-over-stats {
    margin-bottom: 30px;
}

.game-over-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    font-size: clamp(16px, 4vw, 20px);
}

.game-over-stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: #666;
    font-weight: 600;
    flex: 1;
    text-align: left;
}

.stat-value {
    color: #2c3e50;
    font-weight: 800;
    font-size: clamp(18px, 4.5vw, 24px);
    flex: 1;
    text-align: right;
}

.game-over-encouragement {
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #ffd93d 0%, #ff6b6b 100%);
    border-radius: 15px;
    font-size: clamp(14px, 3.5vw, 18px);
    font-weight: 700;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#game-over-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 20px;
    flex-wrap: wrap;
}

.game-over-button {
    flex: 1;
    min-width: 140px;
    max-width: 200px;
    padding: clamp(12px, 3vw, 16px) clamp(20px, 5vw, 30px);
    font-size: clamp(16px, 4vw, 20px);
    font-weight: 700;
    font-family: 'Fredoka', 'Comic Sans MS', cursive, sans-serif;
    border: 3px solid rgba(255, 215, 0, 0.8);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.game-over-button:first-child {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.game-over-button:last-child {
    background: linear-gradient(135deg, #f093fb 0%, #4facfe 100%);
    color: white;
}

.game-over-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.game-over-button:hover::before,
.game-over-button:active::before {
    width: 300px;
    height: 300px;
}

.game-over-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(255, 215, 0, 0.6);
}

.game-over-button:active {
    transform: translateY(-1px) scale(1.02);
}

/* Level Complete Screen */
#level-complete-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
    box-sizing: border-box;
}

#level-complete-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.98) 100%);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    padding: clamp(25px, 6vw, 40px);
    max-width: 90%;
    width: 100%;
    max-width: 500px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(255, 215, 0, 0.3);
    border: 4px solid rgba(255, 215, 0, 0.6);
    text-align: center;
    animation: gameOverAppear 0.5s ease-out;
}

.victory-btn {
    flex: 1;
    min-width: 140px;
    max-width: 200px;
    padding: clamp(12px, 3vw, 16px) clamp(20px, 5vw, 30px);
    font-size: clamp(16px, 4vw, 20px);
    font-weight: 700;
    font-family: 'Fredoka', 'Comic Sans MS', cursive, sans-serif;
    border: 3px solid rgba(255, 215, 0, 0.8);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    margin: 5px;
}

.victory-btn.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.victory-btn.btn-tertiary {
    background: linear-gradient(135deg, #f093fb 0%, #4facfe 100%);
    color: white;
}

.victory-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(255, 215, 0, 0.6);
}

.victory-btn:active {
    transform: translateY(-1px) scale(1.02);
}

@media (max-width: 480px) {
    #game-over-content,
    #level-complete-content {
        padding: 20px;
        max-width: 95%;
    }
    
    .game-over-button,
    .victory-btn {
        min-width: 120px;
        padding: 12px 20px;
        font-size: 16px;
    }
    
    #game-over-buttons {
        flex-direction: column;
        gap: 12px;
    }
    
    .game-over-button {
        max-width: 100%;
        width: 100%;
    }
}

@media (max-width: 768px) {
    #game-board {
        max-height: calc(100vh - 200px);
        gap: 3px;
        padding: 6px;
        aspect-ratio: 6/8;
    }
    
    #frog-area {
        padding: 6px 10px;
    }
    
    #game-header {
        padding: 10px 12px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    #game-board {
        max-width: 380px !important;
        gap: 2px;
        padding: 7px;
    }
    
    #game-header {
        max-width: 380px !important;
    }
}

@media (max-width: 480px) {
    #game-screen {
        padding: 5px;
        justify-content: flex-start;
        padding-top: 5px;
    }
    
    #game-header {
        padding: 8px 12px;
        margin-bottom: 8px;
        border-radius: 10px;
        width: calc(100% - 10px);
    }
    
    #game-board {
        gap: 3px;
        padding: 6px;
        border-width: 2px;
        border-radius: 15px;
        width: calc(100% - 10px);
        max-width: 100%;
    }
}

/* Board Cell */
.board-cell {
    width: 100%;
    height: 100%;
    min-width: 35px;
    min-height: 35px;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(240, 240, 240, 0.5);
    border: 1px solid rgba(200, 200, 200, 0.4);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    overflow: visible;
    pointer-events: auto;
    aspect-ratio: 1;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
}

@media (max-width: 480px) {
    .board-cell {
        width: clamp(45px, 11vw, 65px);
        height: clamp(45px, 11vw, 65px);
        border-radius: 12px;
    }
}

.board-cell.selected {
    transform: scale(1.1);
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.8),
        inset 0 2px 5px rgba(255, 255, 255, 0.6);
    border-color: #ffd700;
    z-index: 10;
}

.board-cell.highlight {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.6);
    animation: highlightPulse 0.6s ease-in-out infinite;
}

@keyframes highlightPulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(76, 175, 80, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 25px rgba(76, 175, 80, 1);
        transform: scale(1.05);
    }
}

/* Marble (Knikker) */
.marble {
    position: relative;
    width: 95% !important;
    height: 95% !important;
    min-width: 30px !important;
    min-height: 30px !important;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.5),
        inset 0 4px 12px rgba(255, 255, 255, 0.7),
        inset 0 -4px 12px rgba(0, 0, 0, 0.5),
        0 0 25px rgba(255, 255, 255, 0.4);
    border: 4px solid rgba(255, 255, 255, 1);
    animation: marbleGlow 3s ease-in-out infinite;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: auto !important;
    aspect-ratio: 1;
    z-index: 10 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    overflow: visible;
    visibility: visible !important;
    opacity: 1 !important;
    background-size: 100% 100% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    isolation: isolate;
}

/* Shine effect overlay */
.marble::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.2) 40%, transparent 70%);
    animation: shineRotate 4s linear infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes shineRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}



@keyframes popAnimation {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

@keyframes marbleGlow {
    0%, 100% {
        filter: brightness(1) saturate(1.2);
        box-shadow: 
            0 6px 20px rgba(0, 0, 0, 0.4),
            inset 0 3px 10px rgba(255, 255, 255, 0.6),
            inset 0 -3px 10px rgba(0, 0, 0, 0.4),
            0 0 20px rgba(255, 255, 255, 0.3),
            0 0 15px var(--marble-glow, rgba(255, 255, 255, 0.4));
    }
    50% {
        filter: brightness(1.2) saturate(1.4);
        box-shadow: 
            0 8px 25px rgba(0, 0, 0, 0.5),
            inset 0 3px 10px rgba(255, 255, 255, 0.7),
            inset 0 -3px 10px rgba(0, 0, 0, 0.4),
            0 0 25px rgba(255, 255, 255, 0.4),
            0 0 30px var(--marble-glow, rgba(255, 255, 255, 0.5));
    }
}

.marble:hover {
    transform: scale(1.15) translateY(-3px);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.4),
        inset 0 2px 8px rgba(255, 255, 255, 0.6),
        inset 0 -2px 8px rgba(0, 0, 0, 0.3),
        0 0 25px rgba(255, 255, 255, 0.3),
        0 0 35px var(--marble-glow, rgba(255, 255, 255, 0.5));
    z-index: 5;
    filter: brightness(1.1);
}

.marble.selected {
    transform: scale(1.2) translateY(-5px);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.5),
        inset 0 2px 8px rgba(255, 255, 255, 0.7),
        inset 0 -2px 8px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(255, 255, 255, 0.4),
        0 0 50px var(--marble-glow, rgba(255, 255, 255, 0.6)),
        0 0 70px var(--marble-glow, rgba(255, 255, 255, 0.4));
    z-index: 10;
    animation: selectedPulse 0.6s ease-in-out infinite;
    filter: brightness(1.2);
    border-color: rgba(255, 255, 255, 1);
}

@keyframes selectedPulse {
    0%, 100% {
        transform: scale(1.2) translateY(-5px);
    }
    50% {
        transform: scale(1.25) translateY(-7px);
    }
}

.marble.matched {
    animation: matchAnimation 0.6s ease-out forwards;
}

@keyframes matchAnimation {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

.marble.swapping {
    z-index: 15;
    animation: swapAnimation 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes swapAnimation {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* ========== SPECIALE KNIKKERS - CANDY CRUSH STYLE ========== */

/* Bomb Marble */
.marble-bomb {
    background: linear-gradient(135deg, #FFD700 0%, #FF8C00 50%, #FF4500 100%) !important;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.5),
        inset 0 4px 12px rgba(255, 255, 255, 0.7),
        inset 0 -4px 12px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(255, 215, 0, 0.8),
        0 0 50px rgba(255, 140, 0, 0.6) !important;
    animation: bombPulse 1.5s ease-in-out infinite, marbleGlow 3s ease-in-out infinite !important;
    border: 4px solid rgba(255, 215, 0, 1) !important;
}

.marble-bomb::after {
    content: '💣';
    position: absolute;
    font-size: 24px;
    z-index: 2;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

@keyframes bombPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Rainbow Marble */
.marble-rainbow {
    background: linear-gradient(135deg, #FF0080 0%, #FF8000 25%, #FFFF00 50%, #00FF80 75%, #0080FF 100%) !important;
    background-size: 200% 200% !important;
    animation: rainbowShift 3s linear infinite, marbleGlow 3s ease-in-out infinite !important;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.5),
        inset 0 4px 12px rgba(255, 255, 255, 0.7),
        inset 0 -4px 12px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(255, 0, 255, 0.8),
        0 0 50px rgba(0, 255, 255, 0.6) !important;
    border: 4px solid rgba(255, 255, 255, 1) !important;
}

@keyframes rainbowShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Striped Marble */
.marble-striped {
    position: relative;
}

.marble-striped-h::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 8px,
        rgba(255, 255, 255, 0.4) 8px,
        rgba(255, 255, 255, 0.4) 16px
    );
    border-radius: 50%;
    pointer-events: none;
}

.marble-striped-v::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 8px,
        rgba(255, 255, 255, 0.4) 8px,
        rgba(255, 255, 255, 0.4) 16px
    );
    border-radius: 50%;
    pointer-events: none;
}

.marble-striped {
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.5),
        inset 0 4px 12px rgba(255, 255, 255, 0.7),
        inset 0 -4px 12px rgba(0, 0, 0, 0.5),
        0 0 25px rgba(255, 255, 255, 0.5),
        0 0 40px var(--marble-glow, rgba(255, 255, 255, 0.6)) !important;
    animation: stripedPulse 2s ease-in-out infinite, marbleGlow 3s ease-in-out infinite !important;
}

@keyframes stripedPulse {
    0%, 100% {
        filter: brightness(1) saturate(1.2);
    }
    50% {
        filter: brightness(1.3) saturate(1.4);
    }
}

@keyframes specialMarbleAppear {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.3) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

/* ========== UI FEEDBACK ========== */

.combo-feedback {
    font-family: 'Fredoka', sans-serif;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
}

.score-popup {
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.explosion-particle {
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.marble.falling {
    z-index: 8;
    animation: fallAnimation 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes fallAnimation {
    0% {
        transform: translateY(-100px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.marble.popping {
    animation: popAnimation 0.4s ease-out forwards;
    z-index: 20;
    pointer-events: none;
}

@keyframes popAnimation {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    30% {
        transform: scale(1.3) rotate(90deg);
        opacity: 0.9;
    }
    60% {
        transform: scale(1.6) rotate(180deg);
        opacity: 0.7;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

/* Pop Particles */
.pop-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1000;
}

/* Marble Color Variants */
.marble[data-color="1"] {
    --marble-gradient: linear-gradient(135deg, #ff006e 0%, #ff4da6 50%, #ff80c4 100%);
    --marble-glow: rgba(255, 0, 110, 0.8);
}

.marble[data-color="2"] {
    --marble-gradient: linear-gradient(135deg, #8338ec 0%, #a855f7 50%, #c084fc 100%);
    --marble-glow: rgba(131, 56, 236, 0.8);
}

.marble[data-color="3"] {
    --marble-gradient: linear-gradient(135deg, #3a86ff 0%, #60a5fa 50%, #93c5fd 100%);
    --marble-glow: rgba(58, 134, 255, 0.8);
}

.marble[data-color="4"] {
    --marble-gradient: linear-gradient(135deg, #06ffa5 0%, #34d399 50%, #6ee7b7 100%);
    --marble-glow: rgba(6, 255, 165, 0.8);
}

.marble[data-color="5"] {
    --marble-gradient: linear-gradient(135deg, #ffbe0b 0%, #ffd93d 50%, #ffe066 100%);
    --marble-glow: rgba(255, 190, 11, 0.8);
}

.marble[data-color="6"] {
    --marble-gradient: linear-gradient(135deg, #fb5607 0%, #ff6b35 50%, #ff8c69 100%);
    --marble-glow: rgba(251, 86, 7, 0.8);
}

/* Points Animation */
.points-animation {
    position: absolute;
    font-size: 32px;
    font-weight: 800;
    color: #ffd700;
    text-shadow: 
        0 0 10px rgba(255, 215, 0, 0.8),
        0 0 20px rgba(255, 215, 0, 0.6),
        2px 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 200;
    animation: pointsFloat 1s ease-out forwards;
    transform: translate(-50%, -50%);
}

@keyframes pointsFloat {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -100%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -150%) scale(1);
        opacity: 0;
    }
}


/* Glitter gold effect for number 10 */
.marble.glitter-gold {
    background: linear-gradient(135deg, #FFE55C 0%, #FFD700 25%, #FFA500 50%, #FFD700 75%, #FFE55C 100%);
    background-size: 200% 200%;
    animation: glitterGold 2s linear infinite, marbleGlow 3s ease-in-out infinite;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 2px 8px rgba(255, 255, 255, 0.6),
        inset 0 -2px 8px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(255, 215, 0, 0.6),
        0 0 30px rgba(255, 215, 0, 0.4);
}

.marble.glitter-gold::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.8) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.6) 0%, transparent 50%);
    border-radius: 50%;
    animation: glitterSparkle 1.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes glitterGold {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

@keyframes glitterSparkle {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Game message */
#game-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 20px 40px;
    border-radius: 20px;
    font-size: clamp(24px, 5vw, 36px);
    font-weight: 800;
    text-align: center;
    z-index: 2000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#game-message.show {
    opacity: 1;
    animation: messagePop 0.5s ease;
}

@keyframes messagePop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Bomb marble styles */
.marble-bomb {
    position: relative;
    border: 3px solid #FF0000 !important;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 2px 8px rgba(255, 255, 255, 0.5),
        inset 0 -2px 8px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(255, 0, 0, 0.6) !important;
    animation: bombPulse 1s ease-in-out infinite, marbleGlow 3s ease-in-out infinite;
}

@keyframes bombPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.bomb-fuse {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 8px;
    background: linear-gradient(to right, #FFA500 0%, #FF4500 100%);
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(255, 165, 0, 0.8);
    transition: width 0.1s linear, background 0.3s ease;
    z-index: 10;
}

.bomb-fuse::before {
    content: '';
    position: absolute;
    top: -2px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, #FFD700 0%, #FF4500 70%, transparent 100%);
    border-radius: 50%;
    animation: fuseSpark 0.3s ease-in-out infinite;
}

@keyframes fuseSpark {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.8);
    }
}

/* Star marble styles */
.marble-star {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%) !important;
    border: 3px solid #FFD700 !important;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 2px 8px rgba(255, 255, 255, 0.6),
        inset 0 -2px 8px rgba(0, 0, 0, 0.3),
        0 0 25px rgba(255, 215, 0, 0.8) !important;
    animation: starTwinkle 1.5s ease-in-out infinite, marbleGlow 3s ease-in-out infinite;
}

@keyframes starTwinkle {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.3);
    }
}

.star-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(24px, 6vw, 40px);
    z-index: 2;
    animation: starRotate 2s linear infinite;
}

@keyframes starRotate {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Rainbow marble styles */
.marble-rainbow {
    border: 3px solid rgba(255, 255, 255, 0.9) !important;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 2px 8px rgba(255, 255, 255, 0.6),
        inset 0 -2px 8px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(255, 255, 255, 0.6) !important;
}

@keyframes rainbowShift {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

/* Explosion particles */
.explosion-particle {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .points-animation {
        font-size: 24px;
    }
    
    #game-message {
        padding: 15px 30px;
        font-size: 20px;
    }
    
    .marble-number {
        font-size: clamp(18px, 4vw, 28px);
    }
    
    .star-icon {
        font-size: clamp(20px, 5vw, 32px);
    }
}

/* Desktop layout - smal bord gecentreerd */
@media (min-width: 769px) {
    #game-screen {
        justify-content: flex-start;
        align-items: center;
        padding: 15px;
        position: relative;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    #game-header {
        max-width: 400px !important;
        width: 100%;
        margin: 0 auto 10px auto;
    }
    
    #frog-area {
        max-width: 400px !important;
        width: 100%;
        margin: 0 auto 10px auto;
    }
    
    #game-board-container {
        max-width: 400px !important;
        width: 100%;
        margin: 0 auto;
    }
    
    #game-board {
        max-width: 400px !important;
        width: 100%;
        max-height: calc(400px * 8 / 6);
        aspect-ratio: 6/8;
        min-width: 0;
        min-height: 0;
        margin: 0 auto;
        flex-shrink: 0;
        gap: 2px !important;
        padding: 6px !important;
    }
    
    .board-cell {
        aspect-ratio: 1 !important;
        min-width: 0;
        min-height: 0;
        width: 100%;
        height: 100%;
        border-radius: 10px;
        border-width: 1.5px;
    }
    
    .marble {
        aspect-ratio: 1 !important;
        width: 96%;
        height: 96%;
        max-width: 96%;
        max-height: 96%;
        border-width: 3px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    #game-board {
        max-width: 380px !important;
    }
    
    #game-header {
        max-width: 380px !important;
    }
}
