* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #000;
    color: #00ff00;
    font-family: 'Courier New', 'Consolas', 'Monaco', monospace;
    font-weight: bold;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.external-controls {
    width: 200px;
    height: 500px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
}

.controls-panel {
    border: 2px solid #00ff00;
    padding: 15px;
    background: rgba(0, 255, 0, 0.05);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
    width: 100%;
    flex: 1;
}

.config-panel {
    border: 2px solid #00ff00;
    padding: 15px;
    background: rgba(0, 255, 0, 0.05);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
    width: 100%;
    flex: 1;
}

.config-section-vertical {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #00ff00;
    font-size: 12px;
    margin-bottom: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #00ff00;
    font-size: 11px;
    margin-bottom: 10px;
    line-height: 1.2;
}

.slider-vertical {
    background: #003300;
    border: 1px solid #00ff00;
    color: #00ff00;
    outline: none;
    height: 20px;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
}

.slider-vertical::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    background: #00ff00;
    border: none;
    height: 16px;
    width: 16px;
    border-radius: 0;
    cursor: pointer;
}

.slider-vertical::-moz-range-thumb {
    background: #00ff00;
    border: none;
    height: 16px;
    width: 16px;
    border-radius: 0;
    cursor: pointer;
}

.slider-vertical::-moz-range-track {
    background: #003300;
    border: 1px solid #00ff00;
    height: 20px;
}

.checkbox {
    accent-color: #00ff00;
    width: 16px;
    height: 16px;
}

#next-count-display {
    text-align: center;
    font-weight: bold;
    color: #00ff00;
    background: rgba(0, 255, 0, 0.1);
    padding: 3px 6px;
    border: 1px solid #00ff00;
    border-radius: 2px;
}

.terminal-container {
    width: 700px;
    height: 500px;
    background: #000;
    border: 2px solid #00ff00;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.terminal-header {
    background: #00ff00;
    color: #000;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #00ff00;
}

.terminal-title {
    font-weight: bold;
    font-size: 14px;
}

.terminal-controls {
    display: flex;
    gap: 8px;
}

.terminal-btn {
    width: 16px;
    height: 16px;
    background: #000;
    color: #00ff00;
    border-radius: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    cursor: pointer;
}

.terminal-content {
    flex: 1;
    padding: 20px;
    overflow: hidden;
}

.game-area {
    display: flex;
    gap: 20px;
    height: 100%;
    align-items: flex-start;
}

.left-panel,
.right-panel {
    flex: 0 0 150px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.game-board-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(20, 1fr);
    gap: 1px;
    background: #001100;
    padding: 2px;
    border: 2px solid #00ff00;
    width: 250px;
    height: 350px;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

.cell {
    width: 100%;
    height: 100%;
    background: #000;
    border: 1px solid #003300;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 8px;
    transition: all 0.1s ease;
}

.cell.filled {
    background: #00ff00;
    color: #000;
    border: 1px solid #00cc00;
    text-shadow: none;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
}

.cell.ghost {
    background: rgba(0, 255, 0, 0.3);
    color: #003300;
    border: 1px dashed #006600;
    animation: none;
}

.cell.active {
    background: #00dd00;
    color: #000;
    border: 1px solid #00aa00;
    animation: blink 0.5s ease-in-out infinite alternate;
}

@keyframes blink {
    from {
        opacity: 0.8;
    }

    to {
        opacity: 1;
    }
}

.panel-title {
    color: #00ff00;
    font-size: 14px;
    margin-bottom: 10px;
    text-align: center;
    border: 1px solid #00ff00;
    padding: 5px;
    background: rgba(0, 255, 0, 0.1);
}

.hold-piece-container {
    border: 1px solid #00ff00;
    padding: 15px;
    background: rgba(0, 255, 0, 0.05);
    margin-bottom: 20px;
}

.hold-piece {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 1px;
    background: #001100;
    padding: 2px;
    width: 100%;
    height: 80px;
    margin-top: 10px;
}

.hold-cell {
    background: #000;
    border: 1px solid #003300;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 7px;
}

.hold-cell.filled {
    background: #00ff00;
    color: #000;
    border: 1px solid #00cc00;
    box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.3);
}

.next-pieces-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #001100;
    border: 2px solid #00ff00;
    padding: 15px;
    border-radius: 3px;
    min-height: 200px;
    justify-content: flex-start;
    align-items: center;
}



.next-piece-block {
    width: 8px;
    height: 8px;
    background: #00ff00;
    border: 1px solid #00cc00;
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.3);
}

.next-piece-row {
    display: flex;
    gap: 2px;
}

.next-piece-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
}

.next-piece-group:first-child {
    margin-bottom: 12px;
}

.next-piece-group:first-child .next-piece-block {
    width: 12px;
    height: 12px;
    border: 2px solid #00ff00;
}

.next-piece-group:first-child .next-piece-row {
    gap: 3px;
}



.next-piece-container {
    border: 1px solid #00ff00;
    padding: 15px;
    background: rgba(0, 255, 0, 0.05);
    margin-bottom: 15px;
}

.stats-container,
.controls-container {
    border: 1px solid #00ff00;
    padding: 15px;
    background: rgba(0, 255, 0, 0.05);
}

.next-piece {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 1px;
    background: #001100;
    padding: 2px;
    width: 100%;
    height: 120px;
    margin-top: 10px;
}


.stat-line,
.control-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    color: #00ff00;
}

.control-line {
    justify-content: flex-start;
    color: #00cc00;
}

.game-status {
    margin-top: 20px;
}

.status-message {
    text-align: center;
    font-size: 12px;
    color: #00ff00;
    background: rgba(0, 255, 0, 0.1);
    padding: 10px;
    border: 1px solid #00ff00;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }
}

.status-message.playing {
    color: #00ff00;
    background: rgba(0, 255, 0, 0.1);
    animation: none;
}

.status-message.paused {
    color: #ffff00;
    background: rgba(255, 255, 0, 0.1);
    border-color: #ffff00;
}

.status-message.game-over {
    color: #ff0000;
    background: rgba(255, 0, 0, 0.1);
    border-color: #ff0000;
    animation: blink 0.5s ease-in-out infinite;
}

/* Responsive design */
@media (max-width: 1024px) {
    body {
        flex-direction: column;
        gap: 10px;
    }

    .external-controls {
        width: 100%;
        height: auto;
        flex-direction: row;
        justify-content: center;
        gap: 20px;
    }

    .controls-panel,
    .config-panel {
        width: auto;
        flex: 1;
        max-width: 250px;
    }

    .config-section-vertical {
        margin-bottom: 10px;
    }

    .terminal-container {
        width: 95vw;
        height: auto;
        max-width: 700px;
    }

    .game-area {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .left-panel,
    .right-panel {
        flex: none;
        width: 100%;
        max-width: 300px;
    }

    .next-pieces-container {
        display: flex;
        flex-direction: row;
        gap: 5px;
        flex-wrap: wrap;
    }

    .next-piece-item {
        width: 60px;
        height: 30px;
    }

    .game-board {
        width: 200px;
        height: 280px;
    }
}

/* Scan lines effect for more terminal feel */
.terminal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 255, 0, 0.03) 2px,
            rgba(0, 255, 0, 0.03) 4px);
    pointer-events: none;
    z-index: 10;
}