/* =====================================================
   SCREW SORT PUZZLE - GAME CSS (REDESIGNED)
   Clean, organized game layout
   ===================================================== */

/* ===== GAME WRAPPER ===== */
.game-wrapper {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    position: relative;
    overflow-x: hidden;
}

.game-background {
    position: absolute;
    inset: 0;
    background-image: url('../assets/images/bg_game.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
    position: relative;
    z-index: 1;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}

/* ===== GAME BOARD (PLATES) ===== */
.game-board {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 15px 0;
}

/* ===== PLATE ===== */
.plate {
    background: linear-gradient(145deg, #4a5568, #2d3748);
    border-radius: 16px;
    padding: 15px 20px;
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.plate-holes {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* ===== HOLE (Screw Stack) ===== */
.hole {
    width: 55px;
    min-height: 100px;
    background: linear-gradient(180deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 12px;
    position: relative;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 0;
    box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Hole opening visual */
.hole::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 35px;
    height: 35px;
    background: radial-gradient(circle, #0a0a0a 0%, #1a1a1a 100%);
    border-radius: 50%;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.9);
    z-index: 0;
}

/* ===== SCREW ===== */
.screw {
    width: 44px;
    height: 44px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 5;
    flex-shrink: 0;
}

/* Proper screw stacking - no overlap on first */
.screw:first-child {
    margin-top: 0;
}

/* Stack with slight overlap for visual depth */
.screw:not(:first-child) {
    margin-top: -8px;
}

.screw-head {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.5),
        inset 0 -3px 6px rgba(0, 0, 0, 0.3),
        inset 0 3px 6px rgba(255, 255, 255, 0.15);
}

/* Phillips screw cross slot */
.screw-head::before,
.screw-head::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 2px;
}

.screw-head::before {
    width: 55%;
    height: 3px;
    transform: translate(-50%, -50%);
}

.screw-head::after {
    width: 3px;
    height: 55%;
    transform: translate(-50%, -50%);
}

/* ===== SCREW COLORS ===== */
.screw--red .screw-head {
    background: radial-gradient(circle at 30% 30%, #ff7b7b, #e53935, #b71c1c);
}

.screw--blue .screw-head {
    background: radial-gradient(circle at 30% 30%, #64b5f6, #1e88e5, #0d47a1);
}

.screw--green .screw-head {
    background: radial-gradient(circle at 30% 30%, #81c784, #43a047, #1b5e20);
}

.screw--yellow .screw-head {
    background: radial-gradient(circle at 30% 30%, #fff176, #fdd835, #f9a825);
}

.screw--purple .screw-head {
    background: radial-gradient(circle at 30% 30%, #ba68c8, #8e24aa, #4a148c);
}

.screw--orange .screw-head {
    background: radial-gradient(circle at 30% 30%, #ffb74d, #fb8c00, #e65100);
}

/* ===== SCREW STATES ===== */
.screw--selectable {
    cursor: pointer;
}

.screw--selectable:hover {
    transform: translateY(-3px) scale(1.05);
    filter: brightness(1.15);
}

.screw--selected {
    transform: translateY(-25px) scale(1.1);
    z-index: 100;
    filter: brightness(1.2);
    animation: selectedPulse 0.6s ease-in-out infinite alternate;
}

@keyframes selectedPulse {
    from {
        filter: brightness(1.2) drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
    }

    to {
        filter: brightness(1.3) drop-shadow(0 0 15px rgba(255, 255, 255, 0.8));
    }
}

.screw--blocked {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.4) brightness(0.7);
}

.screw--blocked:hover {
    transform: none;
    filter: grayscale(0.4) brightness(0.7);
}

/* ===== INSTRUCTION TEXT ===== */
.game-instruction {
    text-align: center;
    padding: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
}

/* ===== CONTAINERS AREA ===== */
.containers-area {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 20px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    margin: 10px;
    min-height: 130px;
    flex-wrap: wrap;
    align-items: center;
}

/* ===== CONTAINER ===== */
.container {
    width: 65px;
    height: 95px;
    background: linear-gradient(180deg, #8b7355 0%, #6d5a42 50%, #5a4a37 100%);
    border-radius: 10px;
    position: relative;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    padding: 6px;
    padding-top: 10px;
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset -2px 0 3px rgba(0, 0, 0, 0.15),
        inset 2px 0 3px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.container:hover {
    transform: translateY(-3px);
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Color indicator at bottom of container */
.container-color-indicator {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Container color variants */
.container--red .container-color-indicator {
    background: #e53935;
}

.container--blue .container-color-indicator {
    background: #1e88e5;
}

.container--green .container-color-indicator {
    background: #43a047;
}

.container--yellow .container-color-indicator {
    background: #fdd835;
}

.container--purple .container-color-indicator {
    background: #8e24aa;
}

.container--orange .container-color-indicator {
    background: #fb8c00;
}

/* Wild container - rainbow */
.container--wild {
    background: linear-gradient(135deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3);
}

.container--wild .container-color-indicator {
    background: linear-gradient(135deg, #ff6b6b, #48dbfb);
}

/* Container states */
.container--valid {
    box-shadow: 0 0 20px #4ade80, 0 5px 15px rgba(0, 0, 0, 0.4);
}

.container--invalid {
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

.container--full {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Screws inside container - smaller */
.container .screw {
    width: 36px;
    height: 36px;
    cursor: default;
}

.container .screw:not(:first-child) {
    margin-top: -6px;
}

/* ===== GAME ACTIONS ===== */
.game-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 10px;
}

/* ===== STARS ===== */
.stars-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
}

.star {
    font-size: 36px;
    opacity: 0.3;
    filter: grayscale(1);
    transition: all 0.3s ease;
}

.star--earned {
    opacity: 1;
    filter: none;
    animation: starPop 0.5s ease-out;
    text-shadow: 0 0 15px gold;
}

@keyframes starPop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

/* ===== LEVEL COMPLETE ===== */
.level-complete-content {
    background: rgba(30, 30, 50, 0.95);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 320px;
    width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.reward-display {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.reward-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 18px;
}

.coins-earned {
    color: #ffd700;
    font-weight: bold;
}