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;
    overscroll-behavior: none;
}

/* Renamed from game-wrapper to match game-container feel */
.game-wrapper {
    width: 100%;
    max-width: 600px;
    text-align: center;
    padding: 20px;
    background: transparent;
    box-shadow: none;
    position: relative;
}

/* Header layout */
.header-row {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 20px;
}

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

/* Help Button */
.btn-icon {
    position: absolute;
    right: 0; 
    top: 0;
    width: 32px; 
    height: 32px;
    border-radius: 50%;
    border: 1px solid #eee;
    background: #f9f9f9;
    color: #555;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.btn-icon:hover { background: #eee; }

/* Status Text */
#status {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 15px;
    min-height: 24px;
    color: #555;
}
.status-ready { color: #555; }
.status-fail { color: #f44; }     
.status-success { color: #2196F3; } 

/* Canvas Container */
.canvas-container {
    width: 100%;
    margin: 0 auto;
}

/* Canvas Styling */
canvas {
    background-color: #fafafa;
    border: 2px solid #eee;
    border-radius: 50%; /* Kept circular for Steady Hand mechanics */
    cursor: default;
    touch-action: none;
    width: 100%;
    height: auto;
    display: block;
}

canvas.can-grab { cursor: grab; }
canvas.is-grabbing { cursor: grabbing; }

/* --- 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; }
    #status { font-size: 1rem; }
    h2 { font-size: 1.15rem; }
}