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

body {
    background: #181818;
    color: #ffffff;
    font-family: Arial, sans-serif;
    min-height: 100vh;
    padding: 20px;
}

#app {
    width: 100%;
    max-width: 480px;
    margin: auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -1px;
}

header p {
    color: #999999;
    margin-top: 6px;
    font-size: 14px;
}

#cube-editor {
    background: #242424;
    border: 1px solid #363636;
    border-radius: 18px;
    padding: 22px;
}

#face-info {
    text-align: center;
    margin-bottom: 15px;
}

#face-title {
    font-size: 22px;
    margin-bottom: 7px;
}

#face-description {
    color: #999999;
    font-size: 13px;
}

/* CUBO 3D */

#cube-stage {
    width: 100%;
    height: 290px;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 900px;
    perspective-origin: 50% 50%;
    overflow: hidden;
    margin: 0 auto 15px;
}

#cube {
    width: 210px;
    height: 210px;
    position: relative;
    transform-style: preserve-3d;

    --rx: -18deg;
    --ry: 0deg;

    transform: rotateX(var(--rx)) rotateY(var(--ry));

    transition: transform 0.75s cubic-bezier(0.2, 0.75, 0.25, 1);
}

.cube-face {
    position: absolute;
    width: 210px;
    height: 210px;

    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 6px;

    padding: 8px;

    background: #111111;
    border: 3px solid #050505;

    backface-visibility: visible;
}

.cube-face[data-face="0"] {
    transform: translateZ(105px);
}

.cube-face[data-face="1"] {
    transform: rotateY(90deg) translateZ(105px);
}

.cube-face[data-face="2"] {
    transform: rotateY(180deg) translateZ(105px);
}

.cube-face[data-face="3"] {
    transform: rotateY(-90deg) translateZ(105px);
}

.cube-face[data-face="4"] {
    transform: rotateX(-90deg) translateZ(105px);
}

.cube-face[data-face="5"] {
    transform: rotateX(90deg) translateZ(105px);
}

.cube-cell {
    width: 100%;
    height: 100%;

    background: #333333;

    border: 3px solid #111111;
    border-radius: 3px;

    cursor: pointer;

    transition:
        background-color 0.15s,
        filter 0.15s;
}

.cube-cell:hover {
    filter: brightness(1.2);
}

.cube-cell:focus-visible,
.color-option:focus-visible,
button:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

/* SELECTOR DE COLORES */

#color-selector {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 25px;
}

.color-option {
    width: 38px;
    height: 38px;

    border: 3px solid #555555;
    border-radius: 50%;

    cursor: pointer;
    transition: 0.15s;
}

.color-option[data-color="white"] {
    background: #ffffff;
}

.color-option[data-color="yellow"] {
    background: #ffff00;
}

.color-option[data-color="green"] {
    background: #00aa55;
}

.color-option[data-color="blue"] {
    background: #176bce;
}

.color-option[data-color="orange"] {
    background: #ff7900;
}

.color-option[data-color="red"] {
    background: #d92727;
}

.color-option:hover {
    transform: scale(1.12);
}

.color-option.selected {
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 2px #888888;
}

/* NAVEGACION */

#navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

#navigation button,
#solve-button {
    background: #3e3e3e;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.15s;
}

#navigation button:hover:not(:disabled),
#solve-button:hover:not(:disabled) {
    background: #555555;
}

#navigation button:disabled,
#solve-button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

#face-counter {
    color: #aaaaaa;
    font-size: 13px;
    font-weight: bold;
}

/* VALIDACION */

#validation {
    margin-top: 18px;
    background: #242424;
    border: 1px solid #363636;
    border-radius: 14px;
    padding: 18px;
}

#validation h3,
#solution h3 {
    font-size: 15px;
    margin-bottom: 8px;
}

#validation-message {
    font-size: 13px;
    color: #aaaaaa;
    line-height: 1.5;
}

/* SOLUCION */

#solver {
    margin-top: 18px;
}

#solve-button {
    width: 100%;
    padding: 15px;
    background: #315DFE;
    font-size: 15px;
}

#solve-button:hover:not(:disabled) {
    background: #4770ff;
}

#solution {
    margin-top: 15px;
    background: #242424;
    border: 1px solid #363636;
    border-radius: 14px;
    padding: 18px;
}

#solution-moves {
    color: #aaaaaa;
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

/* PANTALLAS PEQUEÑAS */

@media (max-width: 360px) {
    body {
        padding: 12px;
    }

    #cube-editor {
        padding: 15px;
    }

    #navigation button {
        padding: 11px;
    }

    .color-option {
        width: 34px;
        height: 34px;
    }

    #cube-stage {
        height: 260px;
    }
}