body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #000;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
}

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    /* 100dvh usually extends into safe area on iOS Safari */
    /* Alternatively, calc(100% + env(safe-area-inset-bottom)) can be used. */
    height: calc(100% + env(safe-area-inset-bottom));
    overflow: hidden;
}

#game-container canvas {
    display: block;
}

@media (orientation: portrait) {
    body {
        /* Ensure background is the grass color in case bounds mismatch momentarily */
        background-color: #7CFC00;
    }
}

@media (orientation: landscape) {
    body {
        background-color: #000;
    }
}

.side-button {
    position: fixed;
    right: calc(20px + env(safe-area-inset-right, 0px));
    width: 50px;
    height: 50px;
    background-color: rgba(76, 175, 80);
    /* Match counter background */
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    z-index: 1000;

    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    transform: rotate(0deg);
}

#reset-button {
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

#mute-button {
    bottom: calc(90px + env(safe-area-inset-bottom, 0px));
    /* 20 + 50 + 20 gap */
    background-image: url('svg/speaker.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 28px;
}

#mute-button.muted {
    background-image: url('svg/mute.svg');
}

/* Counter table styles */
#counter-table {
    font-family: Arial, sans-serif;
    font-size: 14px;
    /* 20% larger than 12px */
    position: absolute;
    top: calc(10px + env(safe-area-inset-top, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    background-color: rgba(255, 255, 255, 0.8);
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

#counter-table table {
    border-collapse: collapse;
    width: 100%;
}

#counter-table {
    width: auto;
}

#counter-table th,
#counter-table td {
    padding: 2px 6px;
}

#counter-table th:first-child,
#counter-table td:first-child {
    width: 24px;
    /* Fixed width for icon column */
    min-width: 24px;
    max-width: 24px;
}

#counter-table th {
    text-align: left;
    font-weight: bold;
}

#counter-table th:nth-child(2) {
    text-align: right;
    width: 40px;
    /* Fixed width for total number column */
}

#counter-table th:last-child {
    text-align: right;
    /* width: 30px; Fixed width for streak number column */
    padding-left: 8px;
}

#counter-table img {
    vertical-align: middle;
    margin-right: 0;
    display: inline;
}

#counter-table td {
    vertical-align: middle;
}

.side-button:focus {
    outline: none;
}

.counter {
    position: fixed;
    top: 40px;
    padding: 8px 12px;
    background-color: rgba(76, 175, 80);
    /* Green with 80% transparency */
    border-radius: 20px;
    font-family: Arial, sans-serif;
    font-size: 18px;
    /* 66% of 28px (28 * 0.66 ≈ 18.48) */
    z-index: 1000;
    font-weight: bold;
    color: white;
    /* Make counter text white */
}

#total-counter {
    left: 20px;
}

#session-counter {
    right: 20px;
}

.counter span {
    font-weight: bold;
}

.side-button:hover {
    background-color: #45a049;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

#reset-button:hover {
    transform: rotate(90deg);
}

#mute-button:hover {
    transform: scale(1.1);
}

.side-button:active {
    background-color: #3d8b40;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#reset-button:active {
    transform: rotate(45deg);
}

#mute-button:active {
    transform: scale(0.95);
}