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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #0a0a0a, #1a1a1a);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: auto;
}

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

.header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #00d4ff;
    padding-bottom: 20px;
}

.title {
    font-size: 2.5em;
    background: linear-gradient(45deg, #00d4ff, #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.subtitle {
    font-size: 1.1em;
    color: #cccccc;
    font-family: Arial, sans-serif;
    margin-bottom: 15px;
}

.info-btn {
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid #00d4ff;
    color: #00d4ff;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s;
}

.info-btn:hover {
    background: rgba(0, 212, 255, 0.4);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.6);
}

.main-content {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.canvas-section {
    flex: 1;
    min-width: 800px;
}

#mainCanvas {
    border: 2px solid #00d4ff;
    border-radius: 10px;
    background: #000;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
    display: block;
    margin: 0 auto;
}

.canvas-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    align-items: center;
}

.control-btn {
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid #00d4ff;
    color: #00d4ff;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s;
}

.control-btn:hover, .control-btn.active {
    background: rgba(0, 212, 255, 0.4);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.6);
}

.control-panel {
    width: 300px;
    background: rgba(45, 45, 45, 0.8);
    border: 1px solid #00d4ff;
    border-radius: 15px;
    padding: 20px;
    height: fit-content;
}

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

.control-group h3 {
    color: #00d4ff;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(0, 212, 255, 0.3);
    padding-bottom: 5px;
}

.pattern-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.pattern-btn {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid #00d4ff;
    color: #00d4ff;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9em;
    transition: all 0.3s;
}

.pattern-btn:hover, .pattern-btn.active {
    background: rgba(0, 212, 255, 0.3);
}

select, input[type="range"] {
    width: 100%;
    margin-top: 5px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #00d4ff;
    color: #ffffff;
    padding: 8px;
    border-radius: 5px;
    font-family: inherit;
}

label {
    display: block;
    margin-bottom: 10px;
    color: #cccccc;
    font-size: 0.9em;
}

#mirrorCanvas {
    border: 1px solid #00d4ff;
    border-radius: 8px;
    display: block;
    margin: 10px auto;
    background: #000;
}

#mirrorStats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #00d4ff;
}

.info-panel {
    background: rgba(26, 26, 26, 0.9);
    border: 1px solid #00d4ff;
    border-radius: 10px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.info-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00d4ff, transparent);
    animation: scan 3s infinite;
}

@keyframes scan {
    0% { left: -100%; }
    100% { left: 100%; }
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    font-size: 0.9em;
}

.stats span {
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
    padding: 5px 10px;
    border-radius: 5px;
}

.educational-note {
    text-align: center;
    font-family: Arial, sans-serif;
    color: #cccccc;
    font-style: italic;
    line-height: 1.4;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
    margin: 5% auto;
    padding: 30px;
    border: 2px solid #00d4ff;
    border-radius: 15px;
    width: 80%;
    max-width: 600px;
    color: #ffffff;
    font-family: Arial, sans-serif;
    box-shadow: 0 0 50px rgba(0, 212, 255, 0.5);
}

.modal-content h2 {
    color: #00d4ff;
    margin-bottom: 20px;
    text-align: center;
}

.modal-content ul {
    margin: 15px 0;
    padding-left: 20px;
}

.modal-content li {
    margin-bottom: 10px;
    line-height: 1.5;
}

.close {
    color: #00d4ff;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #ffffff;
}

footer {
    text-align: center;
    padding: 20px;
    border-top: 1px solid rgba(0, 212, 255, 0.3);
    color: #888;
    font-family: Arial, sans-serif;
}

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

footer a:hover {
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
        align-items: center;
    }
    
    .canvas-section {
        min-width: auto;
    }
    
    #mainCanvas {
        width: 100%;
        max-width: 800px;
        height: auto;
    }
    
    .control-panel {
        width: 100%;
        max-width: 600px;
    }
}

@media (max-width: 600px) {
    .canvas-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .pattern-grid {
        grid-template-columns: 1fr;
    }
    
    .stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .title {
        font-size: 2em;
    }
}

/* Glowing effects for active elements */
.control-btn.active, .pattern-btn.active {
    animation: glow 2s infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 15px rgba(0, 212, 255, 0.6); }
    to { box-shadow: 0 0 25px rgba(0, 212, 255, 0.9); }
}

/* Mirror flip animation hint */
#mirrorCanvas {
    position: relative;
}

#mirrorCanvas::after {
    content: 'Click main display to zoom in!';
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7em;
    color: #888;
    white-space: nowrap;
}