@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');

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

body {
    font-family: 'Space Mono', 'Courier New', monospace;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #00ff88;
    min-height: 100vh;
    overflow-x: auto;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(0, 255, 136, 0.1);
    border: 2px solid #00ff88;
    border-radius: 10px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 0 10px #00ff88;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 10px #00ff88; }
    to { text-shadow: 0 0 20px #00ff88, 0 0 30px #00ff88; }
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.8;
    color: #ffaa00;
}

.main-content {
    display: grid;
    grid-template-columns: 300px 1fr 250px;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.control-panel, .stats-panel {
    background: rgba(45, 45, 45, 0.9);
    border: 2px solid #00ff88;
    border-radius: 10px;
    padding: 20px;
    height: fit-content;
}

.section {
    margin-bottom: 25px;
}

.section h3 {
    color: #ffaa00;
    margin-bottom: 15px;
    font-size: 1.1rem;
    border-bottom: 1px solid #ffaa00;
    padding-bottom: 5px;
}

.control-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    background: #444;
    border-radius: 4px;
    outline: none;
    margin-bottom: 10px;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: #00ff88;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px #00ff88;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #00ff88;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px #00ff88;
}

select {
    width: 100%;
    padding: 8px;
    background: #444;
    color: #00ff88;
    border: 2px solid #666;
    border-radius: 5px;
    font-family: inherit;
}

select:focus {
    border-color: #00ff88;
    outline: none;
}

.preset-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 15px;
}

.preset-btn {
    padding: 8px;
    background: #444;
    color: #00ff88;
    border: 2px solid #666;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.preset-btn:hover {
    border-color: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.preset-btn.active {
    background: #00ff88;
    color: #000;
    border-color: #00ff88;
}

.preset-btn.potato {
    background: #8B4513;
    color: #FFD700;
    border-color: #D2691E;
}

.preset-btn.potato:hover {
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
    accent-color: #00ff88;
}

.canvas-container {
    position: relative;
    background: #000;
    border: 3px solid #00ff88;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

#canvas {
    display: block;
    width: 100%;
    height: auto;
    max-width: 800px;
    background: #000;
}

.overlay-stats {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    border-radius: 5px;
    font-size: 0.9rem;
    border: 1px solid #00ff88;
}

.stat {
    margin-bottom: 3px;
}

.stats-panel h3 {
    color: #ffaa00;
    margin-bottom: 20px;
    text-align: center;
}

.metric {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 5px 0;
    border-bottom: 1px solid #444;
}

.metric label {
    margin: 0;
}

.quality-meter {
    margin: 20px 0;
}

.meter-bar {
    width: 100%;
    height: 20px;
    background: #444;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #666;
}

.meter-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 8px;
}

.meter-fill.excellent {
    background: linear-gradient(90deg, #00ff88, #00cc66);
}

.meter-fill.good {
    background: linear-gradient(90deg, #ffaa00, #ff8800);
}

.meter-fill.poor {
    background: linear-gradient(90deg, #ff4444, #cc0000);
}

.meter-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-top: 5px;
    opacity: 0.7;
}

.indicators {
    margin-top: 20px;
}

.indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

.count {
    font-weight: bold;
    color: #ffaa00;
}

.status.good {
    color: #00ff88;
}

.status.poor {
    color: #ff4444;
}

.bottom-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: rgba(45, 45, 45, 0.9);
    border: 2px solid #00ff88;
    border-radius: 10px;
    flex-wrap: wrap;
}

.control-btn {
    padding: 12px 20px;
    background: #444;
    color: #00ff88;
    border: 2px solid #666;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.control-btn:hover {
    border-color: #00ff88;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
    transform: translateY(-2px);
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.speed-control input[type="range"] {
    width: 120px;
    margin: 0;
}

footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
}

footer a {
    color: #00ff88;
    text-decoration: none;
}

footer a:hover {
    text-shadow: 0 0 5px #00ff88;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .preset-buttons {
        grid-template-columns: 1fr;
    }
    
    .bottom-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .speed-control {
        margin-left: 0;
        justify-content: center;
    }
}

/* Tooltip animations */
.control-group:hover {
    transform: translateX(2px);
    transition: transform 0.2s ease;
}

/* Loading animation for canvas */
@keyframes scanline {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100vh); }
}