:root {
    --bg-color: #0d0d0d;
    --text-color: #ffffff;
    --accent-color: #ffca28;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

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

#game-container {
    position: relative;
    /* Maintain 16:9 aspect ratio, strictly containing inside screen bounds */
    width: 100vw;
    max-width: min(1280px, calc(100vh * 16 / 9));
    height: 100vh;
    max-height: min(720px, calc(100vw * 9 / 16));
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
    background: #000;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: transparent;
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#start-btn, #game-over-img {
    cursor: pointer;
    max-width: 50%;
    height: auto;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.3));
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#start-btn:hover {
    transform: scale(1.1);
}

#start-btn:active {
    transform: scale(0.95);
}

.instruction {
    margin-top: 20px;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
    animation: pulse 1.5s infinite;
}

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

#hud.hidden {
    display: none;
}

#score-container, #hi-score-container {
    display: flex;
    gap: 2px;
}

@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.3; }
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    #game-container {
        /* Constraints already handled by mathematical max-width/height above, just removing shadows to save rendering */
        box-shadow: none;
    }
}

/* Portrait mode rotate overlay */
#rotate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #0d0d0d 0%, #1a1a2e 50%, #0d0d0d 100%);
    justify-content: center;
    align-items: center;
}

#rotate-overlay.visible {
    display: flex;
}

.rotate-content {
    text-align: center;
    color: #fff;
    padding: 2rem;
}

.rotate-icon {
    font-size: 5rem;
    color: var(--accent-color);
    animation: spin-rock 1.5s ease-in-out infinite;
    display: block;
    margin-bottom: 1.5rem;
    line-height: 1;
}

.rotate-content p {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}

.rotate-content span {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.5px;
}

@keyframes spin-rock {
    0%   { transform: rotate(0deg);   }
    30%  { transform: rotate(90deg);  }
    60%  { transform: rotate(90deg);  }
    85%  { transform: rotate(0deg);   }
    100% { transform: rotate(0deg);   }
}

#chillet-banner {
    position: absolute;
    bottom: 25px;
    left: 25px;
    width: clamp(100px, 15vw, 180px); /* Responsive size */
    transition: transform 0.2s ease;
    z-index: 1000;
}

#chillet-banner img {
    width: 100%;
    height: auto;
    display: block;
    animation: constant-shake 0.8s ease-in-out infinite both;
}

@keyframes constant-shake {
    0%, 100% { transform: translate(0, 0) rotate(0); }
    10%, 30%, 50%, 70%, 90% { transform: translate(-2px, 0) rotate(-1deg); }
    20%, 40%, 60%, 80% { transform: translate(2px, 0) rotate(1deg); }
}

#chillet-banner:hover {
    transform: scale(1.05);
}
