body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: sans-serif;
    background: #000;
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 1s ease;
}

#start-screen.hidden {
    opacity: 0;
    pointer-events: none;
}


#level-select {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #1a1a3a 0%, #0a0a18 60%, #050510 100%);
    z-index: 900;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease;
    font-family: 'Cinzel Decorative', serif;
}

#level-select h1 {
    color: #e8e0d0;
    font-size: 36px;
    margin-bottom: 10px;
    letter-spacing: 6px;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(200, 200, 255, 0.3), 0 0 40px rgba(150, 150, 200, 0.15);
}

#level-select .subtitle {
    color: #6a6a8a;
    font-size: 13px;
    letter-spacing: 3px;
    margin-bottom: 0;
    font-family: 'Cinzel Decorative', serif;
}

.biome-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 35px;
}

.biome-arrow {
    background: none;
    border: 2px solid rgba(200, 200, 230, 0.4);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: #e8e0d0;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: sans-serif;
}

.biome-arrow:hover {
    border-color: rgba(200, 200, 255, 0.8);
    text-shadow: 0 0 10px rgba(200, 200, 255, 0.5);
    transform: scale(1.1);
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(4, 90px);
    gap: 22px;
}

.level-btn {
    width: 90px;
    height: 90px;
    border: 2px solid rgba(200, 200, 230, 0.5);
    border-radius: 6px;
    background: rgba(20, 20, 50, 0.7);
    color: #e8e0d0;
    font-size: 32px;
    font-family: 'Cinzel Decorative', serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    text-shadow: 0 0 8px rgba(200, 200, 255, 0.4);
    box-shadow: 0 0 12px rgba(100, 100, 180, 0.15), inset 0 0 15px rgba(100, 100, 180, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.tutorial-label {
    display: block;
    font-size: 9px;
    letter-spacing: 1px;
    color: #8a8aaa;
    margin-top: 4px;
    font-weight: 400;
    text-shadow: none;
}

.level-btn:hover {
    background: rgba(40, 40, 80, 0.8);
    border-color: rgba(200, 200, 255, 0.8);
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(150, 150, 220, 0.35), inset 0 0 20px rgba(100, 100, 180, 0.15);
    text-shadow: 0 0 15px rgba(200, 200, 255, 0.7);
}

.level-btn.locked {
    border-color: rgba(60, 60, 80, 0.4);
    background: rgba(10, 10, 20, 0.6);
    color: #2a2a3a;
    cursor: default;
    text-shadow: none;
    box-shadow: none;
}

.level-btn.locked:hover {
    background: rgba(10, 10, 20, 0.6);
    border-color: rgba(60, 60, 80, 0.4);
    transform: none;
    box-shadow: none;
}

#dev-unlock-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 10px;
    letter-spacing: 2px;
    padding: 4px 10px;
    cursor: pointer;
    font-family: sans-serif;
    transition: all 0.25s ease;
}

#dev-unlock-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.6);
    border-color: rgba(255, 255, 255, 0.35);
}

.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: calc(100vh * 1.5); /* maintain 3:2 aspect ratio */
    max-height: calc(100vw / 1.5);
    overflow: hidden;
    visibility: hidden;
}

#webcam {
    position: absolute;
    top: 2.5%;
    left: 1.5%;
    width: 20%;
    height: auto;
    border: 2px solid white;
    border-radius: 8px;
    z-index: 100;
    transform: scaleX(-1);
}

canvas#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #111;
}

#fireCanvas {
    position: static;
    max-width: 100%;
    max-height: 100%;
    border: none;
    background: transparent;
}

#pause-btn {
    position: absolute;
    top: 2.5%;
    right: 2%;
    z-index: 150;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    padding: 6px 10px;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.2s ease;
    line-height: 1;
}

#pause-btn:hover {
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
}

#pause-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pause-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.pause-content h2 {
    color: #e8e0d0;
    font-family: 'Cinzel Decorative', serif;
    font-size: 28px;
    letter-spacing: 5px;
    text-shadow: 0 0 20px rgba(200, 200, 255, 0.3);
    margin: 0 0 8px 0;
}

.pause-option {
    width: 200px;
    padding: 12px 0;
    border: 1px solid rgba(200, 200, 230, 0.4);
    border-radius: 6px;
    background: rgba(20, 20, 50, 0.7);
    color: #e8e0d0;
    font-family: 'Cinzel Decorative', serif;
    font-size: 14px;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-shadow: 0 0 8px rgba(200, 200, 255, 0.3);
}

.pause-option:hover {
    background: rgba(40, 40, 80, 0.8);
    border-color: rgba(200, 200, 255, 0.8);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(150, 150, 220, 0.3);
    text-shadow: 0 0 12px rgba(200, 200, 255, 0.6);
}

#tutorial-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 160;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
}

#tutorial-subtitle {
    background: rgba(0, 0, 0, 0.75);
    color: #e8e0d0;
    font-family: 'Cinzel Decorative', serif;
    font-size: 15px;
    padding: 10px 28px;
    border-radius: 6px;
    margin-bottom: 30px;
    text-align: center;
    max-width: 85%;
    letter-spacing: 1px;
    text-shadow: 0 0 8px rgba(200, 200, 255, 0.3);
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* Gold sparkly finale button */
.level-btn.finale-gold {
    background: linear-gradient(135deg, #8B6914 0%, #DAA520 25%, #FFD700 50%, #DAA520 75%, #8B6914 100%);
    border: 2px solid #FFD700;
    color: #3a2500;
    text-shadow: 0 1px 2px rgba(255, 215, 0, 0.6);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4), 0 0 30px rgba(255, 215, 0, 0.2), inset 0 0 10px rgba(255, 255, 200, 0.2);
    animation: finale-glow 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.level-btn.finale-gold::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    animation: shimmer-sweep 3s ease-in-out infinite;
}

.level-btn.finale-gold:hover {
    background: linear-gradient(135deg, #9B7924 0%, #EAB530 25%, #FFE740 50%, #EAB530 75%, #9B7924 100%);
    border-color: #FFE740;
    transform: scale(1.12);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6), 0 0 50px rgba(255, 215, 0, 0.3), inset 0 0 15px rgba(255, 255, 200, 0.3);
}

@keyframes finale-glow {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.4), 0 0 30px rgba(255, 215, 0, 0.2), inset 0 0 10px rgba(255, 255, 200, 0.2); }
    50% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.6), 0 0 45px rgba(255, 215, 0, 0.3), inset 0 0 15px rgba(255, 255, 200, 0.3); }
}

@keyframes shimmer-sweep {
    0% { left: -100%; }
    50% { left: 200%; }
    100% { left: 200%; }
}

.level-grid.finale-grid {
    display: flex;
    justify-content: center;
}

/* Finale cinematic overlay */
#finale-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    background: #000;
}

#finaleCanvas {
    width: 100%;
    height: 100%;
}
