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

body {
    font-family: 'Comic Sans MS', 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
    overflow: hidden;
}

.container {
    text-align: center;
    padding: 2rem;
    max-width: 600px;
}

h1 {
    font-size: 3rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 0.5rem;
    animation: bounce 2s infinite;
}

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

.subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 1.2rem;
    margin-bottom: 3rem;
}

.cookie-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto;
    cursor: pointer;
    perspective: 1000px;
}

.cookie {
    position: relative;
    width: 200px;
    height: 180px;
    margin: 0 auto;
    transition: transform 0.3s ease;
    transform-style: preserve-3d;
}

.cookie:hover {
    transform: scale(1.08) rotate(3deg);
}

.cookie.cracked {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    20% { transform: translateX(-8px) rotate(-4deg); }
    40% { transform: translateX(8px) rotate(4deg); }
    60% { transform: translateX(-8px) rotate(-4deg); }
    80% { transform: translateX(8px) rotate(4deg); }
}

/* Realistic 3D cookie halves */
.cookie-half {
    position: absolute;
    width: 100px;
    height: 180px;
    background: linear-gradient(135deg, #f4d796 0%, #e8c474 50%, #d4af37 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow: 
        inset -5px -10px 15px rgba(212, 175, 55, 0.4),
        inset 5px 10px 20px rgba(255, 255, 255, 0.3),
        0 8px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.5s ease;
}

.cookie-half.left {
    left: 0;
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
    border-right: 2px solid #c9a961;
}

.cookie-half.right {
    right: 0;
    clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%);
    border-left: 2px solid #c9a961;
}

/* Texture spots on cookie */
.cookie-half::before,
.cookie-half::after {
    content: '';
    position: absolute;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.6) 0%, transparent 70%);
    border-radius: 50%;
}

.cookie-half.left::before {
    top: 25%;
    left: 25%;
    width: 18px;
    height: 18px;
}

.cookie-half.left::after {
    top: 65%;
    left: 15%;
    width: 12px;
    height: 12px;
}

.cookie-half.right::before {
    top: 35%;
    right: 25%;
    width: 15px;
    height: 15px;
}

.cookie-half.right::after {
    top: 75%;
    right: 20%;
    width: 20px;
    height: 20px;
}

/* Breaking animation with scatter */
.cookie.broken .left {
    animation: explodeLeft 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.cookie.broken .right {
    animation: explodeRight 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes explodeLeft {
    0% {
        transform: translateX(0) translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateX(-180px) translateY(-80px) rotate(-145deg) scale(0.7);
        opacity: 0;
    }
}

@keyframes explodeRight {
    0% {
        transform: translateX(0) translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateX(180px) translateY(-80px) rotate(145deg) scale(0.7);
        opacity: 0;
    }
}

/* Cookie crumbs that scatter */
.crumb {
    position: absolute;
    background: linear-gradient(135deg, #f4d796, #d4af37);
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.crumb1 {
    width: 15px;
    height: 15px;
    top: 50%;
    left: 50%;
    animation: scatter1 0.8s ease-out forwards;
}

.crumb2 {
    width: 12px;
    height: 12px;
    top: 50%;
    left: 50%;
    animation: scatter2 0.8s ease-out forwards;
}

.crumb3 {
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    animation: scatter3 0.8s ease-out forwards;
}

.crumb4 {
    width: 10px;
    height: 10px;
    top: 50%;
    left: 50%;
    animation: scatter4 0.8s ease-out forwards;
}

.crumb5 {
    width: 14px;
    height: 14px;
    top: 50%;
    left: 50%;
    animation: scatter5 0.8s ease-out forwards;
}

.crumb6 {
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    animation: scatter6 0.8s ease-out forwards;
}

@keyframes scatter1 {
    to {
        transform: translate(-90px, 120px) rotate(180deg);
        opacity: 0;
    }
}

@keyframes scatter2 {
    to {
        transform: translate(80px, 140px) rotate(-200deg);
        opacity: 0;
    }
}

@keyframes scatter3 {
    to {
        transform: translate(-120px, -60px) rotate(220deg);
        opacity: 0;
    }
}

@keyframes scatter4 {
    to {
        transform: translate(110px, -50px) rotate(-180deg);
        opacity: 0;
    }
}

@keyframes scatter5 {
    to {
        transform: translate(-50px, 100px) rotate(160deg);
        opacity: 0;
    }
}

@keyframes scatter6 {
    to {
        transform: translate(60px, 110px) rotate(-240deg);
        opacity: 0;
    }
}

.fortune-paper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 280px;
    padding: 2rem;
    background: linear-gradient(to bottom, #fffef7, #faf8ed);
    border: 2px solid #8b7355;
    border-radius: 10px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    opacity: 0;
    transition: all 0.5s ease;
    z-index: 10;
}

.fortune-paper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 25px,
        rgba(139, 115, 85, 0.03) 25px,
        rgba(139, 115, 85, 0.03) 26px
    );
    border-radius: 10px;
    pointer-events: none;
}

.fortune-paper.show {
    transform: translate(-50%, -50%) scale(1) rotate(2deg);
    opacity: 1;
}

#fortuneText {
    font-size: 1.3rem;
    line-height: 1.6;
    color: #333;
    font-style: italic;
    margin: 0;
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

.new-cookie-btn {
    margin-top: 2rem;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #fff, #f4f4f4);
    border: 3px solid #333;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    animation: fadeIn 0.5s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

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

.new-cookie-btn:hover {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(255, 215, 0, 0.4);
}

.credits {
    margin-top: 3rem;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}
