html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

html {
    box-sizing: border-box;
    background-color: #000;
}

*, *:before, *:after {
    box-sizing: inherit;
}

body {
    background-color: #050505;
    color: #b0b0b0;
    font-family: 'Courier New', monospace;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    filter: 
        contrast(110%) 
        brightness(90%) 
        saturate(130%);
}

body:before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(
            circle at center,
            transparent 0%,
            rgba(0, 0, 0, 0) 40%,
            rgba(0, 0, 0, 0.3) 100%
        );
    border-radius: 20% / 10%;
    box-shadow: 0 0 40px 10px rgba(0, 0, 0, 0.7) inset;
    z-index: 2147483646;
    pointer-events: none;
}

body:after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(18, 16, 16, 0) 50%,
        rgba(0, 0, 0, 0.4) 50%
    );
    background-size: 100% 4px;
    z-index: 2147483647;
    pointer-events: none;
    opacity: 0.8;
    animation: flicker 0.15s infinite;
}

html:before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(
            0deg,
            rgba(255, 0, 0, 0.08),
            rgba(0, 255, 0, 0.08),
            rgba(0, 0, 255, 0.08),
            rgba(255, 0, 0, 0.08) 4px
        );
    pointer-events: none;
    z-index: 2147483644;
    opacity: 0.15;
    mix-blend-mode: screen;
}

html:after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at center,
        transparent 60%,
        rgba(0, 0, 0, 0.8) 100%
    );
    pointer-events: none;
    z-index: 2147483645;
}

@keyframes glitch {
    0% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    50% { transform: translateX(2px); }
    75% { transform: translateX(-1px); }
    100% { transform: translateX(0); }
}

@keyframes flicker {
    0% { opacity: 0.95; }
    3% { opacity: 0.85; }
    6% { opacity: 0.95; }
    9% { opacity: 0.9; }
    12% { opacity: 0.95; }
    15% { opacity: 0.85; }
    18% { opacity: 0.9; }
    21% { opacity: 0.95; }
    24% { opacity: 0.9; }
    27% { opacity: 0.95; }
    30% { opacity: 0.9; }
    33% { opacity: 0.95; }
    36% { opacity: 0.9; }
    39% { opacity: 1; }
    42% { opacity: 0.9; }
    45% { opacity: 0.95; }
    48% { opacity: 0.92; }
    51% { opacity: 0.9; }
    54% { opacity: 0.95; }
    57% { opacity: 0.92; }
    60% { opacity: 0.9; }
    63% { opacity: 0.95; }
    66% { opacity: 0.9; }
    69% { opacity: 0.95; }
    72% { opacity: 0.9; }
    75% { opacity: 0.95; }
    78% { opacity: 0.9; }
    81% { opacity: 0.95; }
    84% { opacity: 0.9; }
    87% { opacity: 0.95; }
    90% { opacity: 0.9; }
    93% { opacity: 0.95; }
    96% { opacity: 0.9; }
    100% { opacity: 0.95; }
}

@keyframes turnOn {
    0% { 
        transform: scale(1, 0.8) translateY(30%);
        opacity: 0;
        filter: brightness(30%);
    }
    30% { 
        transform: scale(1, 1.2) translateY(-10%);
        opacity: 1;
        filter: brightness(130%);
    }
    60% { 
        transform: scale(1, 0.9) translateY(5%);
        filter: brightness(80%);
    }
    100% { 
        transform: scale(1, 1) translateY(0);
        filter: brightness(100%);
    }
}

body {
    animation: turnOn 0.8s ease-in-out forwards;
}

.game-container {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20px;
    gap: 20px;
}

.canvas-container {
    position: relative;
    height: auto;
}

#board_canvas,
#animated_canvas,
#shadow_canvas {
    position: absolute;
    top: 0;
    left: 0;
    border: 3px solid #222;
    box-shadow: 
        0 0 10px rgba(0, 255, 170, 0.4),
        0 0 20px rgba(0, 255, 170, 0.2);
    animation-timing-function: steps(2, end);
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.score-display {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

@keyframes flicker {
    0% { opacity: 0.8; text-shadow: 0 0 5px rgba(136, 255, 204, 0.8); }
    50% { opacity: 1; text-shadow: 0 0 8px rgba(136, 255, 204, 1); }
    100% { opacity: 0.9; text-shadow: 0 0 6px rgba(136, 255, 204, 0.8); }
}

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

#score {
    font-size: 2rem;
    color: #88ffcc;
    text-shadow: 
        0 0 5px rgba(136, 255, 204, 0.8),
        0 0 10px rgba(136, 255, 204, 0.5);
    font-weight: bold;
    font-family: 'Courier New', monospace;
    animation: flicker 0.2s infinite alternate;
}

input[type='button'] {
    background: #111;
    color: #88ffcc;
    border: 2px solid #88ffcc;
    padding: 10px 15px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    text-shadow: 0 0 5px rgba(136, 255, 204, 0.5);
    font-family: 'Courier New', monospace;
}

input[type='button']:hover {
    background: #88ffcc;
    color: #111;
    box-shadow: 
        0 0 10px #88ffcc,
        0 0 20px rgba(136, 255, 204, 0.4);
}

#instructions {
    background: rgba(10, 10, 10, 0.95);
    border: 2px solid #333;
    padding: 15px;
    border-radius: 5px;
    width: 300px;
    box-shadow: 
        0 0 10px rgba(136, 255, 204, 0.4),
        0 0 20px rgba(0, 0, 0, 0.7);
    color: #88ffcc;
    text-shadow: 0 0 3px rgba(136, 255, 204, 0.4);
}

.preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    margin-top: 20px;
}

.preview-label {
    font-size: 1.2rem;
    color: #88ffcc;
    text-shadow: 0 0 5px rgba(136, 255, 204, 0.8);
    margin-bottom: 5px;
    font-family: 'Courier New', monospace;
    animation: flicker 0.2s infinite alternate;
}

#preview_canvas {
    border: 2px solid #222;
    box-shadow: 
        0 0 8px rgba(0, 255, 170, 0.4),
        0 0 16px rgba(0, 255, 170, 0.2);
    background-color: rgba(10, 10, 10, 0.95);
}

#controls {
    margin-bottom: 10px;
}

ul {
    padding-left: 20px;
}

li {
    color: #88ffcc;
    margin-bottom: 5px;
    opacity: 0.9;
}

#indicatorcontainer {
    position: relative;
}