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

body {
    font-family: 'Press Start 2P', cursive;
    background: linear-gradient(180deg, #1a0033 0%, #0d1b2a 100%);
    color: #fff;
    overflow: hidden;
    height: 100vh;
    image-rendering: pixelated;
    -ms-interpolation-mode: nearest-neighbor;
}

#canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 1;
}

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 10;
    animation: scanline-move 8s linear infinite;
}

@keyframes scanline-move {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

#ui-overlay > * {
    pointer-events: auto;
}

#header {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 30px;
    border: 3px solid #00f0ff;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
}

.pixel-title {
    font-size: 24px;
    color: #00f0ff;
    text-shadow: 0 0 10px #00f0ff, 2px 2px 0 #ff006e;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.vibe-level {
    margin: 10px 0;
}

.vibe-level .label {
    font-size: 10px;
    color: #39ff14;
}

.progress-bar {
    width: 300px;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #00f0ff;
    margin-top: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #39ff14, #00f0ff);
    transition: width 0.3s ease;
    box-shadow: 0 0 10px #39ff14;
}

.code-counter {
    margin-top: 10px;
}

.code-counter .label {
    font-size: 10px;
    color: #ff006e;
}

.code-counter .value {
    font-size: 20px;
    color: #39ff14;
    text-shadow: 0 0 10px #39ff14;
    display: block;
    margin-top: 5px;
}

.panel {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    border: 3px solid #00f0ff;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

.panel-title {
    font-size: 12px;
    color: #00f0ff;
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 2px solid #00f0ff;
    padding-bottom: 5px;
}

#left-panel {
    left: 20px;
    top: 180px;
    width: 280px;
}

.stat-item {
    display: flex;
    align-items: center;
    margin: 8px 0;
    font-size: 9px;
}

.stat-icon {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    image-rendering: pixelated;
}

.stat-label {
    color: #fff;
    flex: 1;
}

.stat-value {
    color: #39ff14;
    text-shadow: 0 0 5px #39ff14;
}

#right-panel {
    right: 20px;
    top: 180px;
    width: 320px;
    max-height: 60vh;
    overflow-y: auto;
}

.upgrade-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upgrade-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid #444;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.upgrade-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #00f0ff;
    transform: scale(1.02);
}

.upgrade-item.affordable {
    border-color: #39ff14;
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
}

.upgrade-icon {
    width: 32px;
    height: 32px;
    margin-right: 10px;
    image-rendering: pixelated;
}

.upgrade-info {
    flex: 1;
}

.upgrade-name {
    font-size: 10px;
    color: #00f0ff;
    margin-bottom: 3px;
}

.upgrade-desc {
    font-size: 7px;
    color: #aaa;
    margin-bottom: 3px;
}

.upgrade-cost {
    font-size: 8px;
    color: #ff006e;
}

.upgrade-owned {
    font-size: 7px;
    color: #39ff14;
    margin-top: 3px;
}

#bottom-panel {
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 600px;
}

.achievement-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 5px;
}

.achievement-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid #444;
    border-radius: 5px;
    opacity: 0.3;
}

.achievement-item.unlocked {
    opacity: 1;
    border-color: #39ff14;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.5);
}

.achievement-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 5px;
    image-rendering: pixelated;
}

.achievement-name {
    font-size: 7px;
    color: #fff;
    text-align: center;
}

#settings-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    background: rgba(0, 0, 0, 0.7);
    border: 3px solid #00f0ff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

#settings-btn:hover {
    background: rgba(0, 240, 255, 0.2);
    box-shadow: 0 0 20px #00f0ff;
}

#settings-panel {
    top: 80px;
    right: 20px;
    width: 300px;
    z-index: 100;
}

#settings-panel.hidden {
    display: none;
}

.setting-item {
    margin: 10px 0;
    font-size: 8px;
}

.setting-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.setting-item input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
}

.action-btn {
    background: #00f0ff;
    color: #000;
    border: none;
    padding: 8px 15px;
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    cursor: pointer;
    border-radius: 5px;
    margin: 5px 0;
    transition: all 0.2s;
    width: 100%;
}

.action-btn:hover {
    background: #39ff14;
    box-shadow: 0 0 15px #39ff14;
}

.action-btn.danger {
    background: #ff006e;
    color: #fff;
}

.action-btn.danger:hover {
    background: #ff3388;
}

#footer {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border: 2px solid #00f0ff;
    border-radius: 10px;
    font-size: 7px;
    z-index: 6;
}

.footer-link {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #00f0ff;
    text-decoration: none;
    transition: all 0.2s;
}

.footer-link:hover {
    color: #39ff14;
    text-shadow: 0 0 10px #39ff14;
}

.berry-icon {
    width: 20px;
    height: 20px;
    image-rendering: pixelated;
}

.footer-text {
    color: #aaa;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: #00f0ff;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #39ff14;
}

/* Mobile optimization */
@media (max-width: 768px) {
    .pixel-title {
        font-size: 16px;
    }
    
    #header {
        padding: 10px 15px;
    }
    
    .progress-bar {
        width: 200px;
    }
    
    #left-panel, #right-panel {
        width: calc(50% - 30px);
        font-size: 7px;
    }
    
    #bottom-panel {
        width: 90%;
        bottom: 60px;
    }
    
    .stat-icon, .upgrade-icon, .achievement-icon {
        width: 20px;
        height: 20px;
    }
}