* { box-sizing: border-box; }
body {
    margin: 0; min-height: 100vh; background: #f4f7fb;
    font-family: Arial, sans-serif; display: flex;
    justify-content: center; align-items: center; flex-direction: column; padding: 20px;
}
.game {
    width: min(800px, 96vw); text-align: center; background: white;
    padding: 28px; border-radius: 20px; box-shadow: 0 8px 30px rgba(0,0,0,.12);
    position: relative; overflow: hidden;
}
.hidden-return-btn {
    position: absolute; top: 0; right: 0; width: 40px; height: 40px; background: transparent; z-index: 100;
}
.hidden-return-btn:hover { background: rgba(0, 0, 0, 0.02); }
#fireworks-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; display: none; }
h1 { margin: 0 0 8px; font-size: 32px; color: #222; }
p { font-size: 20px; margin: 0 0 15px; color: #555; }

.stats-counter-container { display: flex; justify-content: center; gap: 15px; margin-bottom: 25px; }
.score-display { font-size: 24px; font-weight: bold; color: #f39c12; background: #fef9e7; padding: 8px 20px; border-radius: 30px; border: 2px dashed #f1c40f; }
.clicks-display { font-size: 24px; font-weight: bold; color: #475569; background: #f1f5f9; padding: 8px 20px; border-radius: 30px; border: 2px dashed #cbd5e1; }

/* Grid aangepast voor mooie grote vierkante plaatjesboxes */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; max-width: 700px; margin: 0 auto 22px; }
.tile {
    aspect-ratio: 1 / 1; border: 3px solid #cbd5e1; border-radius: 16px; background: #fff; 
    cursor: pointer; padding: 8px; display: flex; align-items: center; justify-content: center;
    transition: transform .12s, border-color .2s; z-index: 2; position: relative;
    overflow: hidden;
}
.tile:hover { transform: scale(1.03); border-color: #94a3b8; }
.tile.revealed { cursor: default; }

/* Plaatjes binnen de tegel stylen */
.tile img {
    width: 100%; height: 100%; object-fit: contain; border-radius: 8px;
}

.tile.correct { background: #e8f8f5; border-color: #2cc7c9; }
.tile.wrong { background: #fef9f9; border-color: #f1a9a9; opacity: 0.6; } /* Foutieve plaatjes worden een beetje transparant */

.pop-star { position: absolute; font-size: 50px; z-index: 10; pointer-events: none; animation: flyUp 1.2s ease-out forwards; }
@keyframes flyUp {
    0% { transform: translate(-50%, -50%) scale(0.5); top: 50%; left: 50%; opacity: 1; }
    100% { transform: translate(-50%, -200%) scale(1.2); top: 0%; opacity: 0; }
}

/* LERAAR PANEL */
.teacher-panel { width: min(840px, 94vw); background: #2c3e50; color: white; padding: 25px; border-radius: 15px; margin-bottom: 20px; text-align: left; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.teacher-panel h3 { margin: 0 0 15px 0; font-size: 20px; color: #ecf0f1; border-bottom: 1px solid #34495e; padding-bottom: 5px; }
.control-row { display: flex; gap: 15px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.control-row label { font-size: 15px; font-weight: bold; }
.teacher-panel input[type="text"] { padding: 8px 8px; font-size: 16px; border-radius: 6px; border: none; width: 65px; text-align: center; font-weight: bold; }
.teacher-panel button.start-btn { background: #27ae60; color: white; border: none; padding: 10px 20px; font-size: 16px; font-weight: bold; border-radius: 6px; cursor: pointer; box-shadow: 0 3px 0 #1e7b43; }
.teacher-panel button.start-btn:hover { background: #2ecc71; }
#sound-toggle { border: 0; border-radius: 8px; padding: 8px 14px; font: bold 14px Arial, sans-serif; background: #e8f1ff; color: #173a63; cursor: pointer; }
#sound-toggle.on { background: #d7f5dc; color: #1d6b2b; }
.volume-setting, .delay-setting { font-size: 15px; color: #ecf0f1; display: flex; align-items: center; gap: 8px; }
.volume-setting input, .delay-setting input { cursor: pointer; width: 90px; }

.logbook-section { background: #34495e; padding: 15px; border-radius: 10px; margin-top: 15px; }
#log-table { width: 100%; border-collapse: collapse; background: #ffffff; color: #333; border-radius: 6px; overflow: hidden; font-size: 14px; }
#log-table th, #log-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e2e8f0; }
#log-table th { background: #cbd5e1; font-weight: bold; color: #1e293b; }
.clear-log-btn { background: #e74c3c; color: white; border: none; padding: 6px 12px; font-size: 13px; border-radius: 4px; margin-top: 10px; cursor: pointer; }

#message { min-height: 38px; font-size: 24px; font-weight: bold; margin-bottom: 15px; }
#reset { border: 0; border-radius: 10px; padding: 12px 24px; font: bold 20px Arial, sans-serif; background: #333; color: white; cursor: pointer; }
.win-overlay { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.85); z-index: 10; justify-content: center; align-items: center; flex-direction: column; }
.win-content { font-size: 80px; animation: bounce 0.6s infinite alternate; }
.win-text { font-size: 36px; font-weight: bold; color: #1d6b2b; margin-top: 15px; }
.restart-text { font-size: 18px; color: #555; margin-top: 10px; font-style: italic; }
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-15px); } }

@media (max-width: 600px) {
    .grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    h1 { font-size: 24px; }
}
