:root {
    --bg-sky: #4a90e2;
    --bg-ground: #5d4037;
    --accent-color: #ffd700;
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #1a1a1a;
    color: var(--text-primary);
    font-family: 'Outfit', 'Inter', sans-serif;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-container {
    position: relative;
    /* Responsive sizing with safety guarantee for desktop */
    width: min(100vw, 800px);
    height: auto;
    aspect-ratio: 800 / 480;
    
    background: var(--bg-sky);
    border: 8px solid #333;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    margin: 0 auto; /* Center horizontally */
}

/* Fallback for very wide, short screens (like landscape phones) to prevent clipping */
@media (min-aspect-ratio: 800/480) {
    #game-container {
        height: min(100vh, 480px);
        width: auto; /* Width auto-calculates based on aspect-ratio */
    }
}

/* Orientation Warning Overlay */
#orientation-warning {
    display: none;
    position: fixed;
    inset: 0;
    background: #1a1a1a;
    z-index: 9999;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    color: var(--text-primary);
}

#orientation-warning .icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: rotate-phone 2s infinite ease-in-out;
}

@keyframes rotate-phone {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(-90deg); }
    100% { transform: rotate(0deg); }
}

/* Only show warning on Mobile Portrait */
@media (orientation: portrait) and (max-width: 768px) {
    #orientation-warning {
        display: flex;
    }
    #game-container-wrapper {
        display: none !important;
    }
}

canvas {
    display: block;
}

.hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.hint-box {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 15px 30px;
    border-radius: 15px;
    text-align: center;
    min-width: 200px;
}

.hint-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.hint-word {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-color);
}

.score-box {
    font-size: 1.5rem;
    font-weight: bold;
}

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.overlay h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    color: var(--accent-color);
}

.overlay p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.btn {
    background: var(--accent-color);
    color: #1a1a1a;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 800;
    border-radius: 50px;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.3s;
}

.btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(255, 215, 0, 0.3);
}