/* Base page setup to center the wrapper */
body { 
    background: #1a1a1a; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    height: 100vh; 
    width: 100vw;
    margin: 0; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #fff; 
    overflow: hidden; 
    user-select: none;
    touch-action: none;
}




/* The 90% Aspect Ratio Scaling Wrapper */
#viewport-wrapper {
    position: relative;
    /* Scale to 90% of screen height, constrained by width to maintain 9:16 */
    height: 90vh;
    width: calc(90vh * (9 / 16));
    max-width: 90vw;
    max-height: calc(90vw * (16 / 9));
    
    background: #222;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Original Game Container filling the wrapper */
#game-container { 
    position: relative; 
    width: 100%;
    height: 100%;
}

canvas { 
    width: 100%;
    height: 100%;
    display: block; 
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 5% 5%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
}

.header-ui {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

#score-label { font-size: 20px; color: #000; margin-bottom: 0px; font-weight: bold;
}

.score-box {
    font-size: 72px;
    font-weight: bold;
    color: #000;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
	margin-top: -20px; 
}

.hearts-container {
    display: flex;
    gap: 6px;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    max-width: 160px;
}

.heart {
    width: 25px;
    height: 25px;
    background-size: contain;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
}

#retry-panel {
    width: 85%;
    max-width: 420px;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
}

#retry-text {
    color: #222;
    margin: 100px 0 20px 0; 
    font-size: 20px;
    line-height: 1;
    font-weight: bold;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#yes-button {
    width: 150px;
    height: 60px;
    background-size: contain;
    background-repeat: no-repeat;
    background-color: transparent;
    border: none;
    cursor: pointer;
    pointer-events: auto;
}

#yes-button:active {
    transform: scale(0.95);
}

 #instructions {
    width: 100%;
    text-align: center;
    color: black;
    font-size: 18px;
    font-weight: bold;
    padding-bottom: 20px;
}