body {
    background-color: #ffffff;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    overflow: hidden;
    user-select: none;
}

.game-container {
    width: 100%;
    max-width: 600px;
    text-align: center;
    padding: 20px;
}

h2 { margin: 0 0 15px 0; font-weight: 600; }

.stats-row {
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 1.2rem;
    color: #555;
}

#timerDisplay { color: #e91e63; } 
#scoreDisplay { color: #2196F3; }

p {
    margin-top: 15px;
    color: #999;
    font-size: 0.9rem;
}

canvas {
    background-color: #fafafa;
    border: 2px solid #eee;
    border-radius: 12px;
    touch-action: none; 
    cursor: crosshair;
    display: block;
    margin: 0 auto;
}

/* --- MODAL STYLES --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    transition: opacity 0.3s;
}
.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: white;
    color: #333;
    width: 90%;
    max-width: 600px;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.modal-content h3 { margin-top: 0; }

.instruction-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 30px 0;
    justify-content: center;
    align-items: center;
}

.step { flex: 1; }

.step img {
    width: 100%;
    max-width: 180px;
    height: auto;
    object-fit: contain;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 10px;
    background: #f9f9f9;
    margin-bottom: 10px;
}

.btn-primary {
    background-color: #2196F3;
    border: none;
    color: #fff;
    padding: 12px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover { background-color: #1976D2; }

@media (min-width: 768px) {
    .modal-content { max-width: 800px; }
    .instruction-grid {
        flex-direction: row;
        align-items: flex-start;
        gap: 30px;
    }
    .step img {
        width: 200px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 18px 14px;
        border-radius: 10px;
    }
    .modal-content h3 { font-size: 1.1rem; }
    .instruction-grid { gap: 14px; margin: 16px 0; }
    .step img { max-width: 120px; padding: 6px; }
    .step p { font-size: 0.85rem; }
    .btn-primary { padding: 10px 28px; font-size: 1rem; }
    .stats-row { font-size: 1rem; padding: 0 10px; }
    h2 { font-size: 1.15rem; }
}