body {
    margin: 0;
    padding: 0;
    background: #000000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

#container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#controls {
    position: relative;
    color: white;
    z-index: 100;
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border-radius: 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

#canvas-container {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

#controls h2 {
    margin: 0 0 15px 0;
    font-size: 20px;
    background: linear-gradient(45deg, #fff, #f093fb, #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    text-align: center;
    letter-spacing: 1px;
}

#controls p {
    margin: 8px 0;
    font-size: 13px;
    opacity: 0.9;
    line-height: 1.4;
    padding: 4px 0;
    transition: opacity 0.2s ease;
}

#controls p:hover {
    opacity: 1;
}

#size-control {
    margin-top: 15px;
}

#size-control label {
    display: block;
    margin-bottom: 5px;
}

#size-control input {
    width: 150px;
}

#solver-controls {
    margin-top: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    display: flex;
    gap: 12px;
    justify-content: center;
}

#solver-controls button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    border: none;
    color: white;
    padding: 12px 20px;
    margin: 6px 4px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

#solver-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #764ba2 0%, #f093fb 50%, #667eea 100%);
}

#solver-controls button:active {
    transform: translateY(0px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

#solution-display {
    margin-top: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
}

#solution-display label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

#solution-moves {
    font-weight: bold;
    color: #88ffff;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-word;
    background: rgba(136, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(136, 255, 255, 0.2);
    font-family: 'Courier New', monospace;
}

#solver-status {
    margin-top: 12px;
    font-size: 13px;
    color: #ffff88;
    font-style: italic;
    text-align: center;
    padding: 6px;
    background: rgba(255, 255, 136, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 136, 0.2);
}



.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    font-weight: 600;
    z-index: 50;
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px 30px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    body {
        overflow: auto; /* Allow scrolling on mobile if needed */
    }

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

    #canvas-container {
        flex: 1;
        min-height: 70vh;
        max-height: 75vh;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px;
        width: 100%;
        overflow: hidden;
    }



    #controls h2 {
        font-size: 18px;
        margin: 0 0 10px 0;
        text-align: center;
    }

    #controls p {
        font-size: 12px;
        margin: 3px 0;
        opacity: 0.8;
        line-height: 1.3;
    }

    #solver-controls {
        margin-top: 16px;
        padding-top: 16px;
        text-align: center;
    }

    #solver-controls button {
        display: inline-block;
        width: calc(50% - 10px);
        margin: 8px 5px;
        padding: 18px 12px;
        font-size: 16px;
        font-weight: 600;
        min-height: 56px; /* 44px minimum + padding for better touch targets */
        border-radius: 16px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    #solution-display {
        margin-top: 12px;
        text-align: center;
    }

    #solution-moves {
        font-size: 14px;
        line-height: 1.5;
        background: rgba(255,255,255,0.1);
        padding: 8px;
        border-radius: 8px;
        margin-top: 8px;
        word-break: break-all;
    }

    #solver-status {
        font-size: 14px;
        margin-top: 12px;
        text-align: center;
        font-style: italic;
    }

    #cube-info {
        font-size: 13px !important;
        margin: 15px 0;
        padding: 12px;
        text-align: center;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(10px);
        transition: all 0.3s ease;
    }

    #cube-info:hover {
        background: rgba(255, 255, 255, 0.15);
        transform: translateY(-1px);
    }

@media (max-width: 480px) {
    #canvas-container {
        min-height: 65vh;
        max-height: 70vh;
        padding: 5px;
    }

    #controls {
        padding: 10px;
    }

    #controls h2 {
        font-size: 16px;
    }

    #controls p {
        font-size: 11px;
        margin: 2px 0;
    }

    #solver-controls button {
        width: calc(50% - 6px);
        margin: 4px 3px;
        padding: 14px 8px;
        font-size: 15px;
        min-height: 48px; /* Maintain good touch targets */
    }

    #controls {
        padding: 8px;
    }

    #controls h2 {
        font-size: 16px;
        margin: 0 0 6px 0;
    }

    #controls p {
        font-size: 10px;
        margin: 1px 0;
    }

    #solver-controls button {
        width: calc(50% - 4px);
        margin: 3px 2px;
        padding: 12px 8px;
        font-size: 14px;
        min-height: auto;
    }

    #solution-moves {
        font-size: 13px;
    }
}