body {
    margin: 0;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: Arial, sans-serif;
    background: #1a1a1a;
    color: white;
    overflow-x: hidden;
    min-height: 100vh;
    box-sizing: border-box;
    /* Remove touch-action: none from body to allow scrolling */
}

h1 {
    font-size: clamp(20px, 5vw, 24px);
    margin: 10px 0;
    
    text-align: center;
    width: 100%;
}

#visualizer {
    width: min(240px, 90vw);
    height: min(240px, 90vw);
    border: 3px solid #444;
    border-radius: 50%;
    position: relative;
    margin: 15px auto;
    background: #222;
    overflow: hidden;
    /* Add touch-action only to the visualizer */
    touch-action: none;
}

#visualizer canvas {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.beat-indicator {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, #4CAF50 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.1s;
}

#controls {
    width: 100%;
    max-width: 800px; /* Limit to a maximum width for larger screens */
    display: flex;
    flex-direction: column;
    gap: 15px; /* Spacing between elements */
    margin: 20px auto; /* Center in the viewport */
    padding: 0 10px; /* Add responsive padding */
    box-sizing: border-box;
}

.button-container {
    display: flex;
    gap: 10px;
    width: 100%;
    flex-wrap: wrap;
}

button {
    flex: 1;
    padding: clamp(10px, 3vw, 15px) 0;
    font-size: clamp(16px, 4vw, 18px);
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    min-height: 44px;
    width: 100%;
    /* Remove -webkit-tap-highlight-color to keep default touch feedback */
}

button:disabled {
    background: #444;
}

button:active {
    background: #3d8b40;
}

#pattern-select {
    width: 100%;
    padding: clamp(10px, 3vw, 12px);
    font-size: clamp(14px, 4vw, 16px);
    background: #333;
    color: white;
    border: 2px solid #444;
    border-radius: 5px;
    margin-bottom: 10px;
    margin-top: 20px; 
    -webkit-appearance: none;
    appearance: none;
}

#score-display,
#total-score,
#achieved-score {
    font-size: clamp(16px, 4vw, 20px);
    margin: 5px 0;
    text-align: center;
    width: 100%;
}

#feedback {

    color: #4CAF50;
    text-align: center;

    margin: 10px 0;
    font-size: clamp(20px, 4vw, 36px);
    width: 100%;
}

.accuracy-meter {
    width: 100%;
    max-width: min(280px, 90vw);
    height: 10px;
    background: #333;
    border-radius: 5px;
    margin: 10px auto;
    overflow: hidden;
}

.accuracy-fill {
    height: 100%;
    background: #4CAF50;
    width: 0%;
    transition: width 0.3s;
}

/* Media Queries for larger screens */
@media (min-width: 768px) {
    body {
        padding: 20px;
    }

    .button-container {
        flex-wrap: nowrap;
    }

    button {
        width: auto;
    }
}

/* Ensure touch targets are large enough on mobile */
@media (max-width: 767px) {
    button,
    #pattern-select {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .button-container button {
        flex: 1 1 100%;
    }
}

/* Fix iOS overscroll behavior */
@supports (-webkit-touch-callout: none) {
    body {
        /* Prevent elastic scrolling on iOS */
        -webkit-overflow-scrolling: touch;
    }
}
.icon-container {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 15px;
    z-index: 1000;
}
.icon-button {
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    background: rgba(0, 0, 0, 0.8);
    color: white;
}
.icon-button:hover {
    transform: scale(1.05);
}
.share-icon {
    width: 24px;
    height: 24px;
}
.share-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    margin-top: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-width: 200px;
}
.share-options.active {
    display: block;
}
.share-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    cursor: pointer;
    transition: background-color 0.3s;
    border-radius: 6px;
    color: black;
    text-decoration: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}
.share-option:hover {
    background: #f5f5f5;
}
.icon-container {
position: fixed;
top: 10px;
left: 10px;
display: flex;
gap: 8px;
z-index: 1000;
}
.icon-button {
cursor: pointer;
padding: 8px;
border-radius: 50%;
border: none;
display: flex;
align-items: center;
justify-content: center;
transition: transform 0.2s;
background: rgba(0, 0, 0, 0.8);
color: white;
}
.share-icon {
width: 20px;
height: 20px;
}
.share-options {
display: none;
position: absolute;
top: 100%;
left: 0;
background: white;
border-radius: 8px;
padding: 8px;
margin-top: 12px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
min-width: 160px;
}
.share-options.active {
display: block;
}
.share-option {
display: flex;
align-items: center;
gap: 12px;
padding: 10px;
cursor: pointer;
border-radius: 6px;
color: black;
text-decoration: none;
background: none;
border: none;
width: 100%;
text-align: left;
}
.share-option:hover {
background: #f5f5f5;
}

@media (max-width: 768px) {
.icon-container {
top: 10px;
left: 10px;
gap: 8px;
}
.icon-button {
padding: 8px;
}
.share-icon {
width: 20px;
height: 20px;
}
.share-options {
min-width: 160px;
}}
.description-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%; /* Or any desired height */
    padding-top: 50px; /* Adjust as needed */
  }
  #game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh; /* Ensures content does not affect the layout */
    width: 100%; /* Occupy the full width */
    padding: 20px; /* Add spacing for content */
    box-sizing: border-box;
    
}

