/* --- RESET & BASE STYLES --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Press Start 2P', monospace;
    user-select: none;
}

body {
    background-color: #111;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 10px;
}

/* Fluid scaling adjustments to prevent vertical cutoffs */
#game-container {
    width: 95vw;
    max-width: 800px;
    height: 85vh; /* Locks bounds vertically so it never runs off-screen */
    max-height: 500px; 
    background-color: #222;
    border: 4px solid #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.7);
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px; /* Slightly tighter padding for global breathing room */
    text-align: center;
}

.hidden { display: none !important; }

.retro-btn {
    background-color: #e67e22;
    color: #fff;
    border: 3px solid #fff;
    padding: 12px 24px;
    font-size: 12px;
    cursor: pointer;
    margin-top: 15px;
    box-shadow: 4px 4px 0px #000;
}

.retro-btn:hover, .retro-btn:focus {
    background-color: #d35400 !important;
    color: #fff !important;
    border-color: #fff !important;
    outline: none;
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px #000;
}

/* --- TITLE & RULES --- */
#title-screen { background-color: #27ae60; }
#title-screen h1 { font-size: 28px; color: #f1c40f; margin-bottom: 20px; text-shadow: 4px 4px 0px #000; }
#rules-screen { background-color: #2c3e50; }
#rules-screen h2 { font-size: 20px; color: #f1c40f; margin-bottom: 15px; }

.rules-list { 
    text-align: left; 
    max-width: 600px; 
    font-size: 11px; 
    line-height: 1.6; 
    list-style-type: square; 
    margin-bottom: 15px; 
    padding-left: 20px; 
}

/* --- GAMEPLAY SCREEN --- */
#game-screen { display: flex; flex-direction: column; justify-content: space-between; padding: 0; background-color: #27ae60;}

/* Top UI Dashboard */
#ui-dashboard {
    height: 15%;
    background-color: #000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    font-size: 10px;
    border-bottom: 4px solid #fff;
    z-index: 10;
}

/* Inline layout wrapper grouping for counter and restart button on the right */
.ui-right-cluster {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dashboard-restart-btn {
    background-color: #c0392b;
    color: #fff;
    border: 2px solid #fff;
    padding: 4px 8px;
    font-size: 8px;
    cursor: pointer;
}
.dashboard-restart-btn:hover, .dashboard-restart-btn:focus {
    background-color: #e74c3c !important;
    color: #fff !important;
    outline: none;
}

/* Middle Field Action Area */
#field-zone {
    height: 55%;
    background-color: #27ae60;
    position: relative;
    background-image: linear-gradient(90deg, #2ecc71 50%, #27ae60 50%);
    background-size: 20% 100%; 
    border-bottom: 4px solid #fff;
}

.yard-line {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.4);
}

/* Sprites & Elements */
.sprite {
    position: absolute;
    bottom: 15%;
    font-size: 32px;
}

#owner-sprite { left: 5%; }
#max-sprite { 
    left: 13%; 
    transition: left 0.1s linear; 
} 

#ball-sprite {
    position: absolute;
    left: 8%;
    bottom: 22%;
    font-size: 16px;
    z-index: 5;
    display: block;
}

/* Throwing Meter */
#meter-container {
    width: 240px;
    height: 30px;
    border: 3px solid #fff;
    display: flex;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.meter-zone { height: 100%; }
.zone-red { width: 30%; background-color: #e74c3c; }
.zone-green { width: 40%; background-color: #2ecc71; }
.zone-black { width: 30%; background-color: #111; }

#meter-ticker {
    position: absolute;
    top: -3px;
    left: 0%;
    width: 6px;
    height: 32px;
    background-color: #fff;
    border: 1px solid #000;
}

/* Bottom Interactive Quiz Area */
#interaction-zone {
    height: 30%;
    background-color: #111;
    padding: 10px 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

#question-text {
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
    margin-bottom: 12px;
    max-width: 95%;
}

#input-container {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.retro-input {
    background-color: #000;
    border: 3px solid #fff;
    color: #fff;
    padding: 8px;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    width: 50%;
    text-align: center;
    outline: none;
}
.retro-input:focus {
    border-color: #e67e22;
}

.choices-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 90%;
}

.choice-btn {
    background-color: #34495e;
    color: #fff;
    border: 2px solid #fff;
    padding: 8px;
    font-size: 10px;
    line-height: 1.4;
    cursor: pointer;
    text-align: left;
}
.choice-btn:hover, .choice-btn:focus { 
    background-color: #4f5f76 !important; 
    color: #fff !important; 
    outline: none; 
    border-color: #e67e22 !important;
}

/* --- MOBILE RESPONSIVENESS PATCH --- */
@media (max-width: 600px) {
    #game-container {
        height: 95vh; /* Utilize maximum vertical workspace on phones */
        max-height: 100%;
    }
    
    /* Downscale global typography so strings don't break wraps */
    #title-screen h1 { font-size: 18px !important; }
    #rules-screen h2 { font-size: 14px !important; }
    .rules-list { font-size: 8px !important; line-height: 1.4; }
    
    #ui-dashboard { font-size: 8px !important; }
    .dashboard-restart-btn { font-size: 7px !important; padding: 2px 4px; }
    .ui-right-cluster { gap: 8px !important; }
    
    #question-text { font-size: 9px !important; margin-bottom: 8px; }
    .choice-btn { font-size: 8px !important; padding: 6px; }
    .retro-input { font-size: 10px !important; width: 70%; }
    .retro-btn { font-size: 10px !important; padding: 8px 16px; }
    
    .sprite { font-size: 24px !important; }
    #ball-sprite { font-size: 12px !important; }
    #meter-container { width: 180px; height: 24px; }
    #meter-ticker { height: 26px; }
}