* { 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; }
#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: #e74c3c; background: #fdf2f2; padding: 8px 20px; border-radius: 30px; border: 2px dashed #f9aca9; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; max-width: 720px; margin: 0 auto 22px; }
.tile { aspect-ratio: 1 / 1; border: 4px solid #cbd5e1; border-radius: 20px; background: #fff; cursor: pointer; padding: 12px; display: flex; align-items: center; justify-content: center; transition: transform .12s; z-index: 2; position: relative; }
.tile:hover { transform: scale(1.04); }
.tile img { width: 100%; height: 100%; object-fit: contain; }
.tile.correct { background: #e8f8f5; border-color: #2cc7c9; }
.tile.wrong { background: #fef9f9; border-color: #f1a9a9; opacity: 0.5; }
.teacher-panel { width: min(840px, 94vw); background: #2c3e50; color: white; padding: 25px; border-radius: 15px; margin-bottom: 20px; text-align: left; }
.control-row { display: flex; gap: 15px; align-items: center; flex-wrap: wrap; }
.teacher-panel h3 { margin: 0 0 15px 0; border-bottom: 1px solid #34495e; padding-bottom: 5px; }
.teacher-panel input[type="text"] { padding: 8px; font-size: 16px; border-radius: 6px; border: none; font-weight: bold; }
.teacher-panel button.start-btn { background: #27ae60; color: white; border: none; padding: 10px 20px; font-weight: bold; border-radius: 6px; cursor: pointer; }
#sound-toggle { border: 0; border-radius: 8px; padding: 8px 14px; font: bold 14px Arial; background: #e8f1ff; color: #173a63; cursor: pointer; }
#sound-toggle.on { background: #d7f5dc; color: #1d6b2b; }
.volume-setting { font-size: 15px; display: flex; align-items: center; gap: 8px; }
#message { min-height: 38px; font-size: 24px; font-weight: bold; margin-bottom: 15px; }
.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-4 { grid-template-columns: repeat(2, 1fr); } }
.database-manager { background: #34495e; padding: 15px; border-radius: 10px; margin-top: 15px; border: 1px solid #475569; }
.database-manager h4 { margin: 0 0 12px 0; color: #ebdcf7; font-size: 16px; }
.database-manager input[type="text"], .database-manager select { background: #fff !important; color: #333 !important; text-align: left !important; }
.add-btn { background: #9b59b6; color: white; border: none; padding: 8px 14px; font-weight: bold; border-radius: 6px; cursor: pointer; }
.add-btn:hover { background: #8e44ad; }
.export-btn { background: #e67e22; color: white; border: none; padding: 8px 14px; font-weight: bold; border-radius: 6px; cursor: pointer; }
.export-btn:hover { background: #d35400; }
.import-label { background: #3498db; color: white; padding: 8px 14px; font-weight: bold; border-radius: 6px; cursor: pointer; margin-left: 10px; display: inline-block; }
.import-label:hover { background: #2980b9; }
