body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #eef2f3;
    color: #333;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.top-nav {
    flex-shrink: 0;
    width: 100%;
    background-color: #2c3e50;
    padding: 5px 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    z-index: 100;
}

.top-nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.top-nav a:hover { background-color: #34495e; }
.top-nav a.active { background-color: #3498db; }

#game-header {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 0;
    z-index: 20;
}

h1 {
    margin: 5px 0;
    font-size: 1.2rem;
    color: #2c3e50;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#level-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

#level {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #3498db;
    background: white;
    font-weight: bold;
    font-size: 0.8rem;
}

#new-game-btn {
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

#game-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: #f0f2f5;
    transition: background-color 0.5s ease;
}

#maze-wrapper {
    position: relative;
    padding: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    border: 1px dashed rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

#maze {
    position: relative;
    border: 3px solid #2c3e50;
    background-color: white;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    /* Fog of War mask */
    -webkit-mask-image: radial-gradient(circle 100px at 0px 0px, black 100%, transparent 100%);
    mask-image: radial-gradient(circle 100px at 0px 0px, black 100%, transparent 100%);
}

.wall {
    position: absolute;
    border-radius: 1px;
}

#player {
    position: absolute;
    z-index: 10;
    transition: left 0.1s linear, top 0.1s linear;
}

#controls {
    position: absolute;
    right: 15px;
    bottom: 15px;
    display: grid;
    grid-template-areas:
        ". up ."
        "left down right";
    gap: 10px;
    z-index: 50;
    background: rgba(255, 255, 255, 0.4);
    padding: 12px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.control-btn {
    width: 55px;
    height: 55px;
    font-size: 22px;
    cursor: pointer;
    border: none;
    border-radius: 12px;
    background: rgba(52, 152, 219, 0.85);
    color: white;
    box-shadow: 0 4px rgba(41, 128, 185, 0.85);
    transition: transform 0.1s, background-color 0.2s, box-shadow 0.1s;
}

.control-btn:active {
    transform: translateY(3px);
    box-shadow: 0 0 rgba(41, 128, 185, 0.7);
}

#up { grid-area: up; }
#left { grid-area: left; }
#down { grid-area: down; }
#right { grid-area: right; }

.wall {
    position: absolute;
    border-radius: 2px;
}

.maze-marker {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #e74c3c;
    font-weight: bold;
    z-index: 5;
    animation: pulse 1.5s infinite;
}

.arrow-label {
    position: absolute;
    white-space: nowrap;
    font-size: 10px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    padding: 2px 5px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#start-arrow .arrow-label {
    left: -35px;
}

#exit-arrow .arrow-label {
    left: 20px;
}

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


#controls {
    display: grid;
    grid-template-areas:
        ". up ."
        "left down right";
    gap: 10px;
    position: absolute;
    right: 40px;
    bottom: 40px;
    z-index: 50;
    background: rgba(255, 255, 255, 0.3);
    padding: 15px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.control-btn {
    width: 60px;
    height: 60px;
    font-size: 28px;
    cursor: pointer;
    border: none;
    border-radius: 12px;
    background: rgba(52, 152, 219, 0.8);
    color: white;
    box-shadow: 0 4px rgba(41, 128, 185, 0.8);
    transition: transform 0.1s, box-shadow 0.1s, background-color 0.2s;
}

.control-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 rgba(41, 128, 185, 0.8);
    background-color: rgba(41, 128, 185, 1);
}

#up { grid-area: up; }
#left { grid-area: left; }
#down { grid-area: down; }
#right { grid-area: right; }