body {
    background-color: #050505;
    color: #00ff00;
    font-family: 'Courier New', Courier, monospace;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

.grid-container {
    display: grid;
    width: 100vw;
    height: 100vh;
    gap: 2px;
    background-color: #333;
}

/* Dynamic grid setups */
.grid-2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.grid-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.grid-6 { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; }

.team-cell {
    background-color: #000;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px solid #00ff00;
    box-shadow: inset 0 0 20px rgba(0, 255, 0, 0.2);
    overflow: hidden;
}

.noise-cell {
    background-color: #111;
    background-image: repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      #000 2px,
      #000 4px
    );
    animation: staticNoise 0.5s infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #444;
    font-size: 2vw;
    border: 1px solid #333;
}

@keyframes staticNoise {
    0% { background-position: 0 0; opacity: 0.8; }
    50% { background-position: 0 2px; opacity: 1; }
    100% { background-position: 0 4px; opacity: 0.9; }
}

.team-name {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 1.5vw;
    font-weight: bold;
    text-shadow: 0 0 5px #00ff00;
}

.distance {
    font-size: 4vw;
    font-weight: bold;
    margin-bottom: 20px;
}

.distance span {
    font-size: 1.5vw;
    color: #88ff88;
}

.status-overlay {
    position: absolute;
    bottom: 20px;
    font-size: 2vw;
    opacity: 0;
    transition: opacity 2s ease-out;
}

.status-flash {
    animation: flash 3s ease-out forwards;
}

@keyframes flash {
    0% { opacity: 1; text-shadow: 0 0 20px #fff; }
    10% { opacity: 0.2; }
    20% { opacity: 1; }
    100% { opacity: 0; }
}

.wall-flash {
    color: #ff0000;
    animation: flashRed 3s ease-out forwards;
}

@keyframes flashRed {
    0% { opacity: 1; text-shadow: 0 0 20px #ff0000; }
    10% { opacity: 0.2; }
    20% { opacity: 1; }
    100% { opacity: 0; }
}

.obstacle-container {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: rgba(0, 0, 0, 0.9);
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    justify-content: center;
    z-index: 10;
}

.obstacle-active .obstacle-container {
    display: flex;
}

.timer {
    font-size: 8vw;
    font-weight: bold;
    margin: 20px 0;
}

.timer.safe { color: #00ff00; }
.timer.warn { color: #ffff00; }
.timer.danger { color: #ff0000; animation: blink 0.5s infinite; }

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.2; }
    100% { opacity: 1; }
}

.light-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 2px;
    width: 60%;
    aspect-ratio: 1;
    position: absolute;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
    background: #000;
}

.light-flash {
    animation: lightFade 4s ease-out forwards;
}

@keyframes lightFade {
    0% { opacity: 1; box-shadow: 0 0 50px #fff; }
    10% { opacity: 0.5; }
    20% { opacity: 1; }
    100% { opacity: 0; }
}

.light-cell {
    background: #222;
}
.light-wall {
    background: #00ff00;
    box-shadow: 0 0 10px #00ff00;
}
.light-player {
    background: #fff;
    box-shadow: 0 0 20px #fff;
}
