* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* Startscherm */
#start-screen {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 90vw;
    max-height: 95vh;
    overflow-y: auto;
    margin: 20px;
}

#start-screen h1 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 2em;
}

#start-screen p {
    color: #555;
    margin-bottom: 10px;
    font-size: 0.95em;
}

.table-selector {
    margin: 20px 0;
}

.tables-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
    margin: 15px 0;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 10px;
}

.table-checkbox-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.85em;
}

.table-checkbox-item:hover {
    background: #e8e8e8;
}

.table-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.table-checkbox-item label {
    cursor: pointer;
    user-select: none;
    font-size: 0.85em;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.select-all-btn, .deselect-all-btn {
    margin: 10px 5px;
    padding: 8px 15px;
    font-size: 0.85em;
    border: 2px solid #667eea;
    border-radius: 8px;
    background: white;
    color: #667eea;
    cursor: pointer;
    transition: all 0.2s;
}

.select-all-btn:hover, .deselect-all-btn:hover {
    background: #667eea;
    color: white;
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

#start-button, #restart-button, #play-again-button, #shop-button-menu {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1em;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

#start-button:hover, #restart-button:hover, #play-again-button:hover, #shop-button-menu:hover {
    transform: scale(1.05);
}

#shop-button-menu {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.controls-hint {
    font-size: 0.8em;
    color: #888;
    margin-top: 10px;
}

/* Spelscherm */
#game-screen {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* UI boven */
#game-ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10;
}

#lives-container {
    display: flex;
    gap: 5px;
}

.heart {
    font-size: 2em;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

.heart.lost {
    opacity: 0.2;
}

#info-container {
    display: flex;
    gap: 30px;
    color: white;
    font-size: 1.3em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    align-items: center;
}

#coins-info {
    color: #FFD700;
}

.home-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: 2px solid white;
    padding: 8px 20px;
    font-size: 0.9em;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.home-btn:hover {
    transform: scale(1.05);
}

.home-btn:active {
    transform: scale(0.95);
}

/* Speelveld */
#game-area {
    width: 100%;
    height: 100%;
    position: relative;
    background: linear-gradient(180deg, #E8F5E9 0%, #C8E6C9 100%);
    overflow: hidden;
    min-width: 1000px;
    min-height: 750px;
}

#game-area::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(180deg, transparent 0%, #228B22 100%);
    pointer-events: none;
}

#game-area::after {
    content: '☁️';
    position: absolute;
    top: 50px;
    left: 20%;
    font-size: 3em;
    animation: float 8s infinite ease-in-out;
    pointer-events: none;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

.cloud {
    position: absolute;
    font-size: 3em;
    animation: float 8s infinite ease-in-out;
    pointer-events: none;
    opacity: 0.7;
}

/* Touch Controls (voor mobiel/tablet) */
.touch-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 20;
    pointer-events: none;
    gap: 20px;
}

#dpad-container {
    pointer-events: all;
}

.dpad {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 5px;
}

.dpad-row-top {
    display: flex;
    justify-content: center;
    gap: 2px;
}

.dpad-row-bottom {
    display: flex;
    justify-content: center;
    gap: 2px;
}

.dpad-spacer {
    width: 50px;
    height: 50px;
}

.dpad-btn {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid rgba(102, 126, 234, 0.8);
    border-radius: 10px;
    font-size: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    touch-action: none;
    transition: all 0.1s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.dpad-btn:active,
.dpad-btn.pressed {
    background: rgba(102, 126, 234, 0.8);
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.shop-btn-game {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: 3px solid white;
    border-radius: 50%;
    font-size: 1.8em;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    touch-action: none;
    pointer-events: all;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

.shop-btn-game:active {
    transform: scale(0.9);
}

/* Nummer-invoer pad voor touch devices */
.number-pad {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.number-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.number-btn {
    padding: 20px;
    font-size: 1.8em;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    touch-action: none;
    transition: all 0.1s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    min-height: 70px;
    width: 100%;
}

.number-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.number-btn-clear {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.number-btn-submit {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

/* Verberg touch controls op desktop (optioneel, of altijd zichtbaar) */
@media (min-width: 1024px) {
    .touch-controls {
        display: flex; /* Laat ze zichtbaar voor desktop ook, maar minder prominent */
    }
    
    .dpad-btn {
        opacity: 0.7;
    }
    
    .shop-btn-game {
        opacity: 0.8;
    }
}

/* Speler */
#player {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #FF6B6B 0%, #FF4757 100%);
    border: 3px solid #fff;
    border-radius: 8px;
    position: absolute;
    transition: all 0.1s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
    line-height: 1;
}

/* Checkpoints */
.checkpoint {
    position: absolute;
    background: linear-gradient(135deg, #FFD93D 0%, #FFA500 100%);
    border: 4px solid #fff;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.checkpoint.completed {
    background: linear-gradient(135deg, #6BCF7F 0%, #4CAF50 100%);
    opacity: 0.6;
    animation: none;
}

.checkpoint.completed::after {
    content: '✓';
    font-size: 2em;
}

/* Doolhof muren */
.wall {
    position: absolute;
    background: linear-gradient(135deg, #424242 0%, #212121 100%);
    border: 3px solid #1a1a1a;
    border-radius: 4px;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.5),
        0 3px 6px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.wall::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    height: 30%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Platforms (obby stukken) - niet meer gebruikt maar behouden voor compatibiliteit */
.platform {
    position: absolute;
    background: linear-gradient(180deg, #8B4513 0%, #654321 100%);
    border: 3px solid #654321;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.platform::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Rekengebied */
#math-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#math-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
    min-width: 400px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#math-content h2 {
    color: #667eea;
    margin-bottom: 20px;
}

#question-counter {
    color: #888;
    margin-bottom: 10px;
    font-size: 0.9em;
}

#question {
    font-size: 2.5em;
    margin: 20px 0;
    color: #333;
    font-weight: bold;
}

#answer-input {
    width: 100%;
    padding: 15px;
    font-size: 1.5em;
    border: 3px solid #667eea;
    border-radius: 10px;
    text-align: center;
    margin: 20px 0;
}

#submit-answer {
    background: #667eea;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2em;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

#submit-answer:hover {
    transform: scale(1.05);
}

#feedback {
    margin-top: 20px;
    font-size: 1.3em;
    font-weight: bold;
    min-height: 30px;
}

#feedback.correct {
    color: #4CAF50;
    animation: bounceIn 0.5s;
}

#feedback.incorrect {
    color: #F44336;
    animation: shake 0.5s;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

/* Game Over scherm */
#game-over-screen, #win-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    color: white;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#game-over-screen h1, #win-screen h1 {
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
}

#game-over-screen p, #win-screen p {
    font-size: 1.5em;
    margin: 10px 0;
}

/* Shop scherm */
#shop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(204, 50, 235);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 150;
    animation: fadeIn 0.3s;
}

#shop-content {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-width: 95vw;
    max-height: 95vh;
    width: 900px;
    display: flex;
    flex-direction: column;
}

#shop-content h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.8em;
}

#shop-coins {
    font-size: 1.2em;
    color: #FFD700;
    font-weight: bold;
    margin-bottom: 20px;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin: 20px 0;
    overflow-y: auto;
    flex: 1;
    padding: 5px;
}

.shop-item {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    padding: 15px 10px;
    border-radius: 12px;
    border: 3px solid #ddd;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

.shop-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.shop-item.owned {
    border-color: #4CAF50;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.shop-item.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    transform: scale(1.05);
}

.shop-item.owned.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #e1f5fe 0%, #b3e5fc 100%);
}

.shop-item-emoji {
    font-size: 2.5em;
    margin-bottom: 8px;
}

.shop-item-name {
    font-size: 0.85em;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.2;
}

.shop-item-price {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 10px;
}

.shop-item-price.free {
    color: #4CAF50;
    font-weight: bold;
}

.shop-item-actions {
    margin-top: auto;
    width: 100%;
}

.shop-item button {
    padding: 8px 12px;
    font-size: 0.85em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s;
    width: 100%;
}

.shop-item button:hover {
    transform: scale(1.05);
}

.shop-item .buy-btn {
    background: #4CAF50;
    color: white;
}

.shop-item .buy-btn:hover {
    background: #45a049;
}

.shop-item .buy-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.shop-item .select-btn {
    background: #667eea;
    color: white;
}

.shop-item .select-btn:hover {
    background: #5568d3;
}

#close-shop {
    background: #f44336;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1em;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 15px;
    transition: transform 0.2s;
    align-self: center;
}

#close-shop:hover {
    transform: scale(1.05);
    background: #da190b;
}

