/* ===================================
   RESET & BASE STYLES
   =================================== */
* {
    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, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    padding: 20px;
    margin: 0;
    width: 100%;
}

/* ===================================
   PUZZLE CONTAINER
   =================================== */
.puzzle-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

/* ===================================
   HEADER
   =================================== */
.puzzle-header {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeInDown 0.8s ease-out;
}

.puzzle-title {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #a8a8a8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.puzzle-subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: #b0b0b0;
    margin-bottom: 15px;
    font-weight: 300;
}

.progress-indicator {
    display: inline-block;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.9rem;
    color: #ffffff;
    backdrop-filter: blur(10px);
}

#pieces-placed {
    font-weight: 700;
    color: #4a9eff;
    font-size: 1.1rem;
}

/* ===================================
   MAIN PUZZLE AREA
   =================================== */
.puzzle-main {
    display: flex;
    flex-direction: column;
    gap: 30px;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
}

/* ===================================
   TARGET AREA (Where pieces snap to)
   =================================== */
.target-area {
    position: relative;
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.95) 0%, rgba(15, 15, 25, 0.98) 100%);
    border: 5px solid rgba(74, 158, 255, 0.6);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 50px rgba(74, 158, 255, 0.4),
        inset 0 0 80px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(74, 158, 255, 0.3);
    transition: all 0.3s ease;
    animation: pulseFrame 3s ease-in-out infinite;
    margin-left: auto;
    margin-right: auto;
}

@keyframes pulseFrame {
    0%, 100% {
        border-color: rgba(74, 158, 255, 0.6);
        box-shadow:
            0 0 50px rgba(74, 158, 255, 0.4),
            inset 0 0 80px rgba(0, 0, 0, 0.5),
            0 0 100px rgba(74, 158, 255, 0.3);
    }
    50% {
        border-color: rgba(74, 158, 255, 0.8);
        box-shadow:
            0 0 70px rgba(74, 158, 255, 0.6),
            inset 0 0 80px rgba(0, 0, 0, 0.5),
            0 0 120px rgba(74, 158, 255, 0.5);
    }
}

.target-area.complete {
    border-color: rgba(200, 200, 220, 0.6);
    box-shadow:
        0 0 80px rgba(255, 255, 255, 0.4),
        inset 0 0 80px rgba(255, 255, 255, 0.2),
        0 0 120px rgba(74, 158, 255, 0.3);
    animation: pulseGlow 2s ease-in-out infinite;
}

.target-outline {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    pointer-events: none;
}


/* ===================================
   REVEALED CONTENT
   =================================== */
.revealed-content {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s ease;
    border-radius: 8px;
    overflow: hidden;
    z-index: 500;
    transform: scale(0.8);
}

.revealed-content.visible {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
    animation: revealAlbumArt 1.5s ease-out forwards;
}

.album-artwork {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 80px rgba(74, 158, 255, 0.8), 0 0 120px rgba(255, 255, 255, 0.4);
    position: relative;
    z-index: 501;
}

.album-artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===================================
   PIECES AREA (Draggable pieces)
   =================================== */
.pieces-area {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ===================================
   MIRROR PIECES
   =================================== */
/* Puzzle Pieces */
.puzzle-piece {
    width: 120px;
    height: 120px;
    cursor: grab;
    position: relative;
    transition: transform 0.2s ease, filter 0.2s ease;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.6))
            drop-shadow(0 0 25px rgba(255, 255, 255, 0.6))
            drop-shadow(0 0 35px rgba(220, 220, 255, 0.5))
            drop-shadow(0 0 15px rgba(255, 255, 255, 0.8));
    touch-action: none;
    user-select: none;
    animation: floatPiece 4s ease-in-out infinite;
}

.puzzle-piece:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.7))
            drop-shadow(0 0 30px rgba(255, 255, 255, 0.8))
            drop-shadow(0 0 45px rgba(220, 220, 255, 0.7))
            drop-shadow(0 0 20px rgba(255, 255, 255, 1));
    animation: none;
}

@keyframes floatPiece {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

.puzzle-piece.dragging {
    cursor: grabbing;
    opacity: 0.9;
    z-index: 1000;
    transform: scale(1.08);
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.8))
            drop-shadow(0 0 30px rgba(255, 255, 255, 0.7))
            drop-shadow(0 0 50px rgba(74, 158, 255, 0.6));
}

.puzzle-piece.placed {
    cursor: default;
    pointer-events: none;
    animation: snapInPlace 0.5s ease-out;
    filter: none;
}

.puzzle-piece svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ===================================
   COMPLETION OVERLAY
   =================================== */
.completion-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    backdrop-filter: blur(10px);
}

.completion-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: all;
}

.completion-content {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.9) 0%, rgba(10, 10, 10, 0.9) 100%);
    border-radius: 20px;
    border: 2px solid rgba(74, 158, 255, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.6s ease-out;
    max-width: 500px;
}

.completion-title {
    font-size: 2.5rem;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #4a9eff 0%, #ffffff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 2s ease-in-out infinite;
}

.completion-message {
    font-size: 1.2rem;
    color: #b0b0b0;
    margin-bottom: 30px;
    font-style: italic;
}

.unlock-button {
    display: inline-block;
    padding: 15px 40px;
    background: linear-gradient(135deg, #4a9eff 0%, #357abd 100%);
    color: #ffffff;
    text-decoration: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.unlock-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 158, 255, 0.6);
    background: linear-gradient(135deg, #5aa9ff 0%, #4a9eff 100%);
}

.reset-button {
    display: block;
    margin: 20px auto 0;
    padding: 10px 30px;
    background: transparent;
    color: #b0b0b0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-button:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

/* ===================================
   INSTRUCTIONS
   =================================== */
.instructions {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(26, 26, 46, 0.95);
    padding: 20px 25px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 300px;
    z-index: 1500;
    backdrop-filter: blur(10px);
    animation: slideInRight 0.5s ease-out;
}

.instructions.hidden {
    display: none;
}

.instructions h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #4a9eff;
}

.instructions ul {
    list-style: none;
    padding: 0;
}

.instructions li {
    margin-bottom: 10px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #b0b0b0;
}

.instructions strong {
    color: #ffffff;
}

.close-instructions {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-instructions:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

/* ===================================
   HINT BUTTON
   =================================== */
.hint-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 12px 24px;
    background: rgba(74, 158, 255, 0.2);
    border: 1px solid rgba(74, 158, 255, 0.4);
    border-radius: 50px;
    color: #ffffff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 1000;
}

.hint-button:hover {
    background: rgba(74, 158, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
}

.hint-button.active {
    animation: pulse 1s ease-in-out infinite;
}

/* ===================================
   ANIMATIONS
   =================================== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes snapInPlace {
    0% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    50% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 
            0 0 40px rgba(74, 158, 255, 0.2),
            inset 0 0 40px rgba(74, 158, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 0 60px rgba(74, 158, 255, 0.4),
            inset 0 0 60px rgba(74, 158, 255, 0.2);
    }
}

@keyframes shimmer {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes revealMirror {
    0% {
        opacity: 0;
        transform: scale(0.8) rotate(-10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes revealAlbumArt {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomIn {
    from {
        transform: scale(1.2);
    }
    to {
        transform: scale(1);
    }
}

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

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (max-width: 768px) {
    * {
        box-sizing: border-box;
    }
    
    html {
        overflow-x: hidden;
        width: 100%;
    }
    
    body {
        padding: 0;
        margin: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }
    
    .puzzle-container {
        width: 100%;
        max-width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        overflow-x: hidden;
        padding: 10px;
        margin: 0;
        box-sizing: border-box;
    }

    .puzzle-header {
        margin-bottom: 15px;
        text-align: center;
        width: 100%;
        padding: 0 10px;
        box-sizing: border-box;
    }
    
    .puzzle-title {
        font-size: 1.3rem;
    }
    
    .puzzle-subtitle {
        font-size: 0.85rem;
    }
    
    .puzzle-main {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        overflow-x: hidden;
        padding: 0;
        box-sizing: border-box;
    }

    .target-area {
        width: min(85vw, 300px);
        height: min(85vw, 300px);
        margin: 0 auto;
        flex-shrink: 0;
        box-sizing: border-box;
        position: relative;
        left: 0;
        right: 0;
    }

    .puzzle-piece {
        width: 75px;
        height: 75px;
        flex-shrink: 0;
    }

    .pieces-area {
        gap: 10px;
        padding: 12px;
        min-height: 130px;
        width: 100%;
        max-width: min(90vw, 320px);
        margin: 0 auto;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        overflow: visible;
        box-sizing: border-box;
    }

    .instructions {
        position: static;
        margin: 20px auto;
        max-width: 100%;
    }

    .hint-button {
        bottom: 20px;
        right: 20px;
        padding: 10px 20px;
        font-size: 0.85rem;
    }

    .completion-content {
        padding: 30px 20px;
        margin: 0 20px;
    }

    .completion-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0;
        margin: 0;
    }
    
    .puzzle-container {
        padding: 5px;
    }
    
    .puzzle-title {
        font-size: 1.1rem;
        letter-spacing: 0.5px;
    }
    
    .puzzle-subtitle {
        font-size: 0.8rem;
    }

    .target-area {
        width: min(80vw, 260px);
        height: min(80vw, 260px);
        margin: 0 auto;
        flex-shrink: 0;
        box-sizing: border-box;
        position: relative;
        left: 0;
        right: 0;
    }

    .puzzle-piece {
        width: 65px;
        height: 65px;
        flex-shrink: 0;
    }
    
    .pieces-area {
        gap: 8px;
        padding: 10px;
        max-width: min(85vw, 280px);
        overflow: visible;
        box-sizing: border-box;
    }

    .completion-title {
        font-size: 1.4rem;
    }

    .unlock-button {
        padding: 12px 25px;
        font-size: 0.95rem;
    }
}

/* ===================================
   ACCESSIBILITY
   =================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus,
a:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

.mirror-piece:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 4px;
}

/* ===================================
   UTILITY CLASSES
   =================================== */
.hidden {
    display: none !important;
}

.no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Made with Bob */
