/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

/* Main panel container */
.panel-container {
    width: 95%;
    max-width: 1200px;
    background: linear-gradient(145deg, #2d2d2d, #1f1f1f);
    border-radius: 20px;
    padding: 40px 30px;
    position: relative;
    box-shadow: 
        inset 0 0 50px rgba(0, 0, 0, 0.8),
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 0 4px #333,
        0 0 0 8px #444,
        0 0 0 12px #222;
    border: 1px solid #555;
    transform-style: preserve-3d;
    perspective: 1000px;
}

/* Screw details */
.screw {
    position: absolute;
    width: 24px;
    height: 24px;
    background: radial-gradient(circle at 30% 30%, #555, #222);
    border-radius: 50%;
    box-shadow: 
        inset 0 2px 4px rgba(255, 255, 255, 0.1),
        inset 0 -2px 4px rgba(0, 0, 0, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.screw-tl { top: 15px; left: 15px; }
.screw-tr { top: 15px; right: 15px; }
.screw-bl { bottom: 15px; left: 15px; }
.screw-br { bottom: 15px; right: 15px; }

.screw::after {
    content: '+';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #777;
    font-size: 14px;
    font-weight: bold;
}

/* Warning labels */
.warning-label {
    position: absolute;
    font-size: 10px;
    color: #ff4444;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 8px;
    border-radius: 3px;
    border: 1px solid #ff4444;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 90;
}

.warning-top { top: 6px; left: 50%; transform: translateX(-50%); }
.warning-left { left: -40px; top: 50%; transform: translateY(-50%) rotate(-90deg); }
.warning-right { right: -40px; top: 50%; transform: translateY(-50%) rotate(90deg); }

/* CRT Display */
.crt-display {
    background: linear-gradient(135deg, #0a2a0a 0%, #051505 100%);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 40px;
    position: relative;
    box-shadow: 
        inset 0 0 80px rgba(0, 20, 0, 0.8),
        inset 0 0 20px rgba(0, 255, 0, 0.1),
        0 10px 30px rgba(0, 0, 0, 0.7),
        0 0 0 3px #1a3d1a,
        0 0 0 6px #0f2a0f;
    border: 1px solid #2a5a2a;
    min-height: 300px;
    overflow: hidden;
}

.crt-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        transparent 0%,
        rgba(100, 255, 100, 0.05) 50%,
        transparent 100%
    );
    pointer-events: none;
    border-radius: 10px;
}

.crt-display::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    border-radius: 10px;
}

.screen-content {
    position: relative;
    z-index: 2;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    line-height: 1.6;
    color: #a0ffa0;
    text-shadow: 0 0 10px rgba(100, 255, 100, 0.5);
    min-height: 200px;
    padding: 20px;
    border: 1px solid rgba(100, 255, 100, 0.2);
    background: rgba(0, 20, 0, 0.3);
}

.screen-default {
    text-align: center;
    padding: 40px;
}

.screen-symbol {
    font-size: 48px;
    margin-bottom: 20px;
    color: #ff4444;
}

.screen-status {
    font-size: 14px;
    color: #88ff88;
    margin-bottom: 10px;
}

.screen-hint {
    font-size: 12px;
    color: #888888;
    margin-top: 20px;
}

/* Control Modules */
.controls-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.control-module {
    background: linear-gradient(145deg, #333, #222);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 
        inset 0 0 30px rgba(0, 0, 0, 0.6),
        0 8px 25px rgba(0, 0, 0, 0.4),
        0 0 0 2px #444;
    border: 1px solid #555;
}

.module-title {
    color: #ffaa44;
    font-size: 16px;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    border-bottom: 1px solid #ffaa44;
    padding-bottom: 10px;
}

.module-display {
    background: #0a1a0a;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 24px;
    letter-spacing: 10px;
    color: #a0ffa0;
    text-shadow: 0 0 5px rgba(100, 255, 100, 0.5);
    border: 1px solid #2a5a2a;
    box-shadow: inset 0 0 20px rgba(0, 20, 0, 0.5);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Buttons */
.button-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.numeric-grid {
    grid-template-columns: repeat(3, 1fr);
}

.control-btn {
    background: linear-gradient(145deg, #444, #333);
    border: none;
    border-radius: 8px;
    padding: 20px 10px;
    font-size: 24px;
    font-weight: bold;
    color: #ffcc88;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 2px rgba(255, 255, 255, 0.1);
    touch-action: manipulation;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.control-btn:active {
    transform: translateY(4px);
    box-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.3),
        inset 0 1px 2px rgba(255, 255, 255, 0.1);
    background: linear-gradient(145deg, #333, #222);
}

.control-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 204, 136, 0.2), transparent 70%);
    opacity: 0;
    transition: opacity 0.2s;
}

.control-btn:active::after {
    opacity: 1;
}

/* LED Indicators */
.module-leds {
    text-align: center;
    margin-top: 20px;
}

.led-indicator {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin: 0 5px;
    box-shadow: 
        inset 0 0 10px rgba(0, 0, 0, 0.5),
        0 0 10px currentColor;
    animation: pulse 2s infinite;
}

.led-red { background: #ff0000; color: #ff0000; }
.led-green { background: #00ff00; color: #00ff00; }
.led-yellow { background: #ffff00; color: #ffff00; animation-delay: 1s; }

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* Clock Module */
.clock-face {
    font-family: 'Courier New', monospace;
    font-size: 36px;
    color: #ff4444;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
    margin-bottom: 15px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    border: 2px solid #444;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.clock-expression {
    background: rgba(68, 0, 0, 0.3);
    padding: 10px 15px;
    border-radius: 5px;
    border: 1px solid #ff4444;
}

.clock-status {
    font-size: 12px;
    color: #666;
    margin-top: 10px;
    text-align: center;
}

/* Status Panel */
.status-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid #444;
    margin-top: 20px;
    font-size: 12px;
    color: #888;
}

.status-locked { color: #ff4444; }
.status-unlocked { color: #00ff00; }
.status-stable { color: #00ff00; }

/* Attempts counter */
.module-attempts {
    text-align: center;
    margin-top: 20px;
    font-size: 11px;
    color: #666;
}

/* Animations */
@keyframes vibration {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

@keyframes buzz {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.vibrate {
    animation: vibration 0.3s linear;
}

.buzz {
    animation: buzz 0.5s linear;
}

/* Touch feedback */
.touch-feedback {
    position: fixed;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
    z-index: 9999;
    transition: opacity 0.3s, transform 0.3s;
}

.touch-feedback.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Depth layers */
.depth-layer-1 {
    transform: translateZ(10px);
}

.depth-layer-2 {
    transform: translateZ(20px);
}

/* Responsive */
@media (max-width: 768px) {
    .controls-section {
        grid-template-columns: 1fr;
    }
    
    .panel-container {
        padding: 30px 20px;
    }
    
    .crt-display {
        padding: 20px;
    }
    
    .clock-face {
        font-size: 28px;
        flex-direction: column;
        gap: 5px;
    }
}

.screen-story {
    text-align: left;
    padding: 20px;
}

.story-title {
    font-size: 24px;
    color: #88ff88;
    margin-bottom: 20px;
    border-bottom: 1px solid #88ff88;
    padding-bottom: 10px;
}

.story-content {
    font-size: 16px;
    color: #aaffaa;
    line-height: 1.6;
    margin-bottom: 20px;
    text-shadow: 0 0 5px rgba(100, 255, 100, 0.3);
}

.story-hint {
    font-size: 14px;
    color: #ffff88;
    padding: 10px;
    background: rgba(255, 255, 0, 0.1);
    border-left: 3px solid #ffff00;
    margin-top: 20px;
}

.story-next {
    margin-top: 30px;
    padding: 15px;
    background: rgba(0, 100, 0, 0.2);
    border: 1px solid #00aa00;
    border-radius: 5px;
}

.small-hint {
    font-size: 12px;
    color: #88cc88;
    margin-top: 10px;
}

.toolbox-contents {
    margin-top: 20px;
}

.tool-item {
    background: rgba(50, 50, 50, 0.5);
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    border-left: 4px solid #ffaa44;
}

.encrypted-note {
    font-family: monospace;
    font-size: 18px;
    letter-spacing: 2px;
    color: #ffcc00;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px dashed #ffcc00;
    margin: 10px 0;
}

.hint {
    font-size: 12px;
    color: #8888ff;
    font-style: italic;
}

@keyframes unlock {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

/* Styl dla domyślnego ekranu */
.screen-default {
    text-align: center;
    padding: 60px 20px;
}

.screen-default .screen-symbol {
    font-size: 72px;
    color: #ff4444;
    margin-bottom: 30px;
    animation: pulse 2s infinite;
}

.screen-default .screen-status {
    font-size: 18px;
    color: #88ff88;
    margin-bottom: 10px;
    letter-spacing: 3px;
}

.screen-default .screen-hint {
    font-size: 14px;
    color: #888888;
    margin-top: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}