html,
body {
    margin: 0;
    padding: 0;
    height: 100dvh;
    overflow: hidden;
    padding-bottom: env(safe-area-insert-bottom);
}

#app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
}

.header {
    background: rgba(0, 0, 0, 0.85);
    padding: 15px 20px;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 600;
    color: #ffffff;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.playfield {
    flex-grow: 1;
    position: relative;
    width: 100%;
    min-height: 300px;
    background-color: #000;
    overflow: hidden;
    transition: background-color 0.3s ease;
}
.controls {
    background: #222222;
    padding-bottom: 20px;
    padding-top: 10px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    z-index: 10;
}

.control-btn {
    width: 65px;
    height: 65px;
    margin: 5px;
    border: none;
    border-radius: 20px;
    /* Modern rounded corners */
    background: linear-gradient(145deg, #6c63ff, #5a52d5);
    color: white;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 2px 0 #3e3a94;
    /* 3D effect */
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
}

.control-btn:active {
    transform: translateY(4px);
    /* The "Press" animation */
    box-shadow: 0 2px 0 #3e3a94;
    background: #5a52d5;
}

.player {
    position: absolute;
    width: 30px;
    height: 30px;
    transition: 0.05s linear;
    z-index: 20;
    border: 3px solid rgba(0, 0, 0, 0.6);
    box-sizing: border-box;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.3);
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.circle {
    border-radius: 50%;
}

.square {
    border-radius: 4px;
}

.triangle {
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.diamond {
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.pentagon {
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
}

.row {
    display: flex;
    gap: 20px;
}

button {
    width: 60px;
    height: 60px;
    font-size: 24px;
}

.notification {
    position: absolute;
    top: 20%;
    width: 100%;
    text-align: center;
    background: rgba(255, 255, 255, 0.8);
    padding: 10px;
    z-index: 100;
    font-weight: bold;
}

.key {
    position: absolute;
    font-size: 20px;
    z-index: 12;
}

.door {
    position: absolute;
    z-index: 15;
    width: 80px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid gold;
    background: linear-gradient(90deg, #444 0%, #666 50%, #444 100%);
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6), inset 0 0 10px rgba(0, 0, 0, 0.5);
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
    transition: all 0.3s ease;
}

.door::after {
    content: '';
    position: absolute;
    top: 15%;
    bottom: 15%;
    left: 50%;
    width: 4px;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.3) 0%, rgba(255, 215, 0, 0.8) 50%, rgba(255, 215, 0, 0.3) 100%);
    border-left: 3px solid rgba(255, 215, 0, 0.9);
}

.door::before {
    content: '🔒';
    position: absolute;
    font-size: 28px;
    z-index: 11;
    animation: lockedPulse 2s infinite;
}

@keyframes lockedPulse {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

.door.open {
    border-color: lime;
    background: linear-gradient(90deg, #1a4a1a 0%, #2d7a2d 50%, #1a4a1a 100%);
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.8), inset 0 0 15px rgba(0, 255, 0, 0.3), 0 0 50px rgba(0, 255, 0, 0.5);
}

.door.open::after {
    border-color: lime;
    background: linear-gradient(90deg, rgba(0, 255, 0, 0.3) 0%, rgba(0, 255, 0, 0.9) 50%, rgba(0, 255, 0, 0.3) 100%);
}

.door.open::before {
    content: '🔓';
    animation: unlockedPulse 2s infinite;
}

@keyframes unlockedPulse {
    0%, 100% {
        opacity: 0.9;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.15);
    }
}

.timer-display {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    z-index: 100;
}

.toast-container {
    position: fixed;
    bottom: 220px;
    left: 10%;
    width: 80%;
    z-index: 1000;
    pointer-events: none;
    display: flex;
    justify-content: center;
}

.toast {
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    animation: fadeInOut 3s forwards;
}

@keyframes pop {
    0% {
        transform: scale(0);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    10% {
        opacity: 1;
        transform: translateY(0);
    }

    90% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(0);
    }
}