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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top Bar */
.top-bar {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

.top-bar h1 {
    font-size: 1.5rem;
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.stats {
    display: flex;
    gap: 2rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-item .label {
    color: #888;
    font-size: 0.9rem;
}

.stat-item .value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #00d4ff;
    min-width: 2rem;
    text-align: center;
}

/* Game Container */
#game-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Control Panel */
.control-panel {
    position: fixed;
    right: 0;
    top: 80px;
    width: 300px;
    height: calc(100vh - 80px);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    overflow-y: auto;
    z-index: 5;
}

.control-section {
    margin-bottom: 2rem;
}

.control-section h3 {
    color: #00d4ff;
    font-size: 1rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Select */
select {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    color: #e0e0e0;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

select:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #00d4ff;
}

select:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #000;
    margin-bottom: 0.75rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Speed Control */
.speed-control {
    margin-top: 1rem;
}

.speed-control label {
    display: block;
    margin-bottom: 0.5rem;
    color: #888;
    font-size: 0.9rem;
}

.speed-control input[type="range"] {
    width: calc(100% - 3rem);
    vertical-align: middle;
}

#speed-value {
    display: inline-block;
    width: 2.5rem;
    text-align: right;
    color: #00d4ff;
    font-weight: bold;
    margin-left: 0.5rem;
}

/* Solve Progress */
.solve-progress {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    text-align: center;
}

#solve-progress-text {
    color: #00d4ff;
    font-weight: bold;
}

/* Instructions */
.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    padding: 0.5rem 0;
    color: #aaa;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
    padding-left: 1.5rem;
}

.instructions li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #00d4ff;
    font-size: 1.2rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 3rem;
    border-radius: 15px;
    border: 2px solid #00d4ff;
    box-shadow: 0 20px 60px rgba(0, 212, 255, 0.3);
    text-align: center;
    max-width: 400px;
    animation: slideUp 0.3s ease;
}

.modal-content h2 {
    color: #00d4ff;
    font-size: 2rem;
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.modal-content p {
    color: #e0e0e0;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

#win-stats {
    margin: 2rem 0;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

#win-stats p {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    color: #888;
    margin-bottom: 0.5rem;
}

#win-stats p:last-child {
    margin-bottom: 0;
}

#win-stats span {
    color: #00d4ff;
    font-weight: bold;
}

.victory-stats {
    margin: 2rem 0;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.victory-stats .stat {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    color: #e0e0e0;
}

.victory-stats .stat strong {
    color: #888;
}

.victory-stats .stat span {
    color: #00d4ff;
    font-weight: bold;
}

/* Close and Show Panel Buttons */
.btn-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    color: #e0e0e0;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    background: rgba(255, 0, 0, 0.3);
    border-color: #ff0000;
    color: #fff;
}

.btn-show {
    position: fixed;
    right: 1rem;
    top: 100px;
    width: 50px;
    height: 50px;
    background: rgba(0, 212, 255, 0.8);
    border: 1px solid rgba(0, 212, 255, 1);
    border-radius: 50%;
    color: #000;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.4);
}

.btn-show:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.6);
}

/* Utility */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .top-bar {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .top-bar h1 {
        font-size: 1.2rem;
    }

    .stats {
        gap: 1rem;
    }

    .control-panel {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        top: auto;
        width: 100%;
        height: auto;
        max-height: 50vh;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-top: 3rem;
    }

    .btn-close {
        top: 0.5rem;
        right: 0.5rem;
    }

    .btn-show {
        position: fixed;
        bottom: 1rem;
        right: 1rem;
        top: auto;
        width: 60px;
        height: 60px;
        font-size: 1.8rem;
    }

    .control-section {
        margin-bottom: 1rem;
    }

    .instructions {
        display: none;
    }

    .modal-content {
        padding: 2rem;
        margin: 1rem;
    }

    .modal-content h2 {
        font-size: 1.5rem;
    }
}

/* Scrollbar Styling */
.control-panel::-webkit-scrollbar {
    width: 8px;
}

.control-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.control-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 4px;
}

.control-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.5);
}
