/* Lucy's Cookie Shop - Storybook Style */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Patrick Hand', cursive;
    overflow-x: hidden;
    min-height: 100vh;
    background: #87CEEB;
}

/* Main storybook page container */
.storybook-page {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background: linear-gradient(180deg, #87CEEB 0%, #B0E0E6 50%, #98D8C8 100%);
    border: 12px solid #8B4513;
    box-shadow: inset 0 0 50px rgba(139, 69, 19, 0.3);
}

/* Corner flourishes for storybook feel */
.corner-flourish {
    position: absolute;
    width: 80px;
    height: 80px;
    background: linear-gradient(45deg, transparent 50%, #8B4513 50%);
    opacity: 0.3;
    z-index: 100;
}

.corner-flourish::before {
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    border: 3px solid #8B4513;
    border-radius: 50%;
}

.top-left {
    top: 0;
    left: 0;
    transform: rotate(0deg);
}

.top-right {
    top: 0;
    right: 0;
    transform: rotate(90deg);
}

.bottom-left {
    bottom: 0;
    left: 0;
    transform: rotate(-90deg);
}

.bottom-right {
    bottom: 0;
    right: 0;
    transform: rotate(180deg);
}

/* Sky elements */
.sky {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    pointer-events: none;
}

.sun {
    position: absolute;
    top: 30px;
    right: 80px;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, #FFE87C 0%, #FFD700 50%, #FFA500 100%);
    border-radius: 50%;
    box-shadow: 0 0 40px #FFD700, 0 0 80px rgba(255, 215, 0, 0.5);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 40px #FFD700, 0 0 80px rgba(255, 215, 0, 0.5);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 50px #FFD700, 0 0 100px rgba(255, 215, 0, 0.6);
    }
}

/* Clouds */
.cloud {
    position: absolute;
    background: white;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.1));
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: white;
    border-radius: 50%;
}

.cloud-1 {
    width: 120px;
    height: 40px;
    top: 60px;
    left: 10%;
    animation: float 20s ease-in-out infinite;
}

.cloud-1::before {
    width: 50px;
    height: 50px;
    top: -25px;
    left: 20px;
}

.cloud-1::after {
    width: 60px;
    height: 60px;
    top: -30px;
    left: 50px;
}

.cloud-2 {
    width: 100px;
    height: 35px;
    top: 100px;
    left: 60%;
    animation: float 25s ease-in-out infinite reverse;
}

.cloud-2::before {
    width: 45px;
    height: 45px;
    top: -20px;
    left: 15px;
}

.cloud-2::after {
    width: 50px;
    height: 50px;
    top: -25px;
    left: 45px;
}

.cloud-3 {
    width: 80px;
    height: 30px;
    top: 40px;
    left: 35%;
    animation: float 18s ease-in-out infinite;
}

.cloud-3::before {
    width: 40px;
    height: 40px;
    top: -18px;
    left: 10px;
}

.cloud-3::after {
    width: 45px;
    height: 45px;
    top: -22px;
    left: 35px;
}

@keyframes float {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(30px);
    }
}

/* Rolling hills */
.hills {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    pointer-events: none;
}

.hill {
    position: absolute;
    bottom: 0;
    border-radius: 50% 50% 0 0;
}

.hill-back {
    width: 150%;
    height: 300px;
    left: -25%;
    background: linear-gradient(180deg, #7CB342 0%, #558B2F 100%);
    bottom: 80px;
}

.hill-mid {
    width: 120%;
    height: 250px;
    left: -10%;
    background: linear-gradient(180deg, #8BC34A 0%, #689F38 100%);
    bottom: 50px;
}

.hill-front {
    width: 130%;
    height: 200px;
    left: -15%;
    background: linear-gradient(180deg, #9CCC65 0%, #7CB342 100%);
    bottom: 0;
}

/* Trees */
.tree {
    position: absolute;
    bottom: 150px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tree-left {
    left: 5%;
}

.tree-right {
    right: 5%;
}

.foliage {
    width: 100px;
    height: 120px;
    background: radial-gradient(ellipse at center, #4CAF50 0%, #2E7D32 100%);
    border-radius: 50% 50% 45% 45%;
    position: relative;
    box-shadow: inset -10px -10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: -20px;
}

.foliage::before,
.foliage::after {
    content: '';
    position: absolute;
    background: radial-gradient(ellipse at center, #66BB6A 0%, #388E3C 100%);
    border-radius: 50%;
}

.foliage::before {
    width: 70px;
    height: 80px;
    top: -20px;
    left: 15px;
}

.foliage::after {
    width: 60px;
    height: 70px;
    top: -10px;
    left: -15px;
}

.trunk {
    width: 30px;
    height: 80px;
    background: linear-gradient(90deg, #8B4513 0%, #A0522D 50%, #8B4513 100%);
    border-radius: 5px;
    position: relative;
}

.trunk::before {
    content: '';
    position: absolute;
    width: 15px;
    height: 30px;
    background: linear-gradient(90deg, #8B4513 0%, #A0522D 100%);
    border-radius: 5px;
    top: 20px;
    left: -10px;
    transform: rotate(-30deg);
}

/* Main scene */
.scene {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    min-height: 100vh;
}

/* Title banner */
.banner {
    background: linear-gradient(135deg, #00613C 0%, #004D2F 100%);
    padding: 15px 50px;
    border-radius: 10px;
    margin-top: 20px;
    margin-bottom: 20px;
    position: relative;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.2);
    border: 4px solid #FFD700;
    transform: rotate(-2deg);
}

.banner::before,
.banner::after {
    content: '🌟';
    position: absolute;
    font-size: 24px;
    top: 50%;
    transform: translateY(-50%);
}

.banner::before {
    left: 15px;
}

.banner::after {
    right: 15px;
}

.banner h1 {
    font-family: 'Bubblegum Sans', cursive;
    color: #FFFFFF;
    font-size: clamp(2rem, 5vw, 3.5rem);
    text-shadow: 3px 3px 0 #004D2F, -1px -1px 0 #FFD700;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.subtitle {
    color: #FFD700;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    text-align: center;
    font-style: italic;
}

/* Speech bubble */
.speech-bubble {
    position: absolute;
    bottom: 450px;
    right: 45%;
    max-width: 280px;
    background: white;
    padding: 15px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 3px solid #00613C;
    z-index: 20;
    animation: bobble 3s ease-in-out infinite;
}

.speech-bubble p {
    color: #333;
    font-size: 1.1rem;
    line-height: 1.4;
}

.bubble-tail {
    display: none;
}

@keyframes bobble {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Lucy character */
.lucy-character {
    position: absolute;
    right: 48%;
    bottom: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 15;
}

.head-container {
    width: 95px;
    height: 105px;
    position: relative;
    z-index: 2;
    margin-left: -8px;
    margin-bottom: -105px;
}

.lucy-head {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    border-radius: 40% 40% 35% 35%;
    border: none;
    filter: drop-shadow(2px 3px 3px rgba(0, 0, 0, 0.2));
}

.head-placeholder {
    display: none;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #FDBCB4 0%, #E8A598 100%);
    border-radius: 50%;
    border: 3px dashed #8B4513;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    color: #8B4513;
    text-align: center;
}

.placeholder-active .head-placeholder {
    display: flex;
}

.lucy-body {
    width: 140px;
    height: 250px;
    filter: drop-shadow(3px 5px 5px rgba(0, 0, 0, 0.3));
}

/* Waving animation */
.waving-arm {
    transform-origin: 118px 75px;
    animation: wave 0.8s ease-in-out infinite;
}

@keyframes wave {

    0%,
    100% {
        transform: rotate(-5deg);
    }

    25% {
        transform: rotate(15deg);
    }

    50% {
        transform: rotate(-5deg);
    }

    75% {
        transform: rotate(15deg);
    }
}

/* Cookie stand/table */
.cookie-stand {
    position: absolute;
    bottom: 180px;
    right: 10%;
    z-index: 12;
}

.table-top {
    position: relative;
    background: linear-gradient(180deg, #DEB887 0%, #D2691E 100%);
    width: 450px;
    height: 30px;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border: 3px solid #8B4513;
}

.tablecloth {
    position: absolute;
    top: -8px;
    left: -10px;
    right: -10px;
    height: 20px;
    background: repeating-linear-gradient(90deg,
            #00613C 0px,
            #00613C 20px,
            #FFFFFF 20px,
            #FFFFFF 40px);
    border-radius: 5px;
    border: 2px solid #004D2F;
}

.cookie-boxes {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    padding: 10px;
}

.cookie-box {
    text-decoration: none;
    transition: transform 0.3s ease, filter 0.3s ease;
    cursor: pointer;
}

.cookie-box:hover {
    transform: translateY(-15px) rotate(-3deg) scale(1.1);
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.4));
    z-index: 100;
}

.cookie-box:hover .box {
    animation: wiggle 0.3s ease-in-out;
}

@keyframes wiggle {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-5deg);
    }

    75% {
        transform: rotate(5deg);
    }
}

.box {
    width: 55px;
    height: 75px;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.box::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    height: 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.cookie-name {
    font-size: 0.55rem;
    font-weight: bold;
    text-align: center;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 4px;
    border-radius: 3px;
}

/* Cookie flavors */
.thin-mints {
    background: linear-gradient(135deg, #00613C 0%, #004D2F 100%);
}

.samoas {
    background: linear-gradient(135deg, #8B4513 0%, #654321 100%);
}

.tagalongs {
    background: linear-gradient(135deg, #D2691E 0%, #A0522D 100%);
}

.do-si-dos {
    background: linear-gradient(135deg, #DAA520 0%, #B8860B 100%);
}

.trefoils {
    background: linear-gradient(135deg, #FFD700 0%, #DAA520 100%);
}

.trefoils .cookie-name {
    color: #333;
    text-shadow: none;
}

.lemonades {
    background: linear-gradient(135deg, #FFEB3B 0%, #FFC107 100%);
}

.lemonades .cookie-name {
    color: #333;
    text-shadow: none;
}

/* Table legs */
.table-legs {
    display: flex;
    justify-content: space-between;
    padding: 0 30px;
}

.leg {
    width: 25px;
    height: 120px;
    background: linear-gradient(90deg, #8B4513 0%, #A0522D 50%, #8B4513 100%);
    border-radius: 0 0 5px 5px;
}

/* Order button */
.order-button {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5A5A 100%);
    color: white;
    padding: 15px 40px;
    border-radius: 50px;
    text-decoration: none;
    font-family: 'Bubblegum Sans', cursive;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 6px 20px rgba(238, 90, 90, 0.4), 0 3px 0 #C94444;
    transition: all 0.3s ease;
    border: 3px solid #FFFFFF;
    animation: buttonPulse 2s ease-in-out infinite;
    white-space: nowrap;
}

.order-button:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 8px 25px rgba(238, 90, 90, 0.5), 0 4px 0 #C94444;
    background: linear-gradient(135deg, #FF7B7B 0%, #FF6B6B 100%);
}

.order-button:active {
    transform: translateX(-50%) scale(0.98);
    box-shadow: 0 4px 15px rgba(238, 90, 90, 0.4), 0 2px 0 #C94444;
}

@keyframes buttonPulse {

    0%,
    100% {
        box-shadow: 0 6px 20px rgba(238, 90, 90, 0.4), 0 3px 0 #C94444;
    }

    50% {
        box-shadow: 0 6px 30px rgba(238, 90, 90, 0.6), 0 3px 0 #C94444, 0 0 20px rgba(255, 107, 107, 0.3);
    }
}

.button-icon {
    font-size: 1.8rem;
    animation: spin 3s ease-in-out infinite;
}

@keyframes spin {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(15deg);
    }

    75% {
        transform: rotate(-15deg);
    }
}

/* Ground and grass */
.ground {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    z-index: 8;
}

.grass {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(180deg, #7CB342 0%, #558B2F 100%);
}

.flowers {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    padding: 0 20px;
}

.flower {
    font-size: 1.5rem;
    animation: sway 3s ease-in-out infinite;
}

.flower-1 {
    animation-delay: 0s;
}

.flower-2 {
    animation-delay: 0.5s;
}

.flower-3 {
    animation-delay: 1s;
}

.flower-4 {
    animation-delay: 1.5s;
}

.flower-5 {
    animation-delay: 2s;
}

.flower-6 {
    animation-delay: 2.5s;
}

@keyframes sway {

    0%,
    100% {
        transform: rotate(-5deg);
    }

    50% {
        transform: rotate(5deg);
    }
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .cookie-stand {
        right: 5%;
    }

    .table-top {
        width: 350px;
    }

    .cookie-boxes {
        gap: 8px;
        flex-wrap: nowrap;
    }

    .box {
        width: 45px;
        height: 65px;
    }

    .speech-bubble {
        right: 40%;
        max-width: 220px;
    }

    .lucy-character {
        right: 52%;
    }
}

@media (max-width: 768px) {
    .storybook-page {
        border-width: 8px;
        min-height: 100vh;
        position: relative;
    }

    .scene {
        padding: 10px;
        min-height: 100vh;
        position: relative;
    }

    .banner {
        padding: 12px 25px;
        margin-top: 70px;
        margin-left: auto !important;
        margin-right: auto !important;
        position: relative;
        left: 0;
        right: 0;
        transform: rotate(-1deg);
        align-self: center;
    }

    .banner h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    /* Speech bubble - positioned near Lucy, constrained size */
    .speech-bubble {
        position: absolute;
        top: auto;
        bottom: 380px;
        left: 5%;
        right: auto;
        width: 160px;
        max-width: 160px;
        height: auto;
        max-height: 90px;
        padding: 10px 12px;
        z-index: 20;
        overflow: hidden;
    }

    .speech-bubble p {
        font-size: 0.75rem;
        line-height: 1.25;
        margin: 0;
    }

    .bubble-tail {
        display: none;
    }

    /* Lucy character - bigger, positioned at bottom left */
    .lucy-character {
        position: absolute;
        left: 2%;
        right: auto;
        bottom: 85px;
        z-index: 15;
    }

    .head-container {
        width: 100px;
        height: 118px;
        margin-bottom: -118px;
        margin-left: -8px;
    }

    .lucy-body {
        width: 150px;
        height: 270px;
    }

    /* Cookie stand - positioned at bottom right, bigger boxes for mobile */
    .cookie-stand {
        position: absolute;
        left: auto;
        right: 3%;
        bottom: 85px;
        z-index: 12;
    }

    .table-top {
        width: 260px;
        height: 26px;
    }

    .cookie-boxes {
        gap: 6px;
        padding: 6px;
        flex-wrap: nowrap;
        justify-content: center;
    }

    .box {
        width: 38px;
        height: 55px;
    }

    .cookie-name {
        font-size: 0.6rem;
        padding: 4px 5px;
    }

    .table-legs {
        padding: 0 40px;
    }

    .leg {
        width: 20px;
        height: 65px;
    }

    /* Order button - at the bottom center */
    .order-button {
        position: absolute;
        bottom: 25px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 1rem;
        padding: 10px 25px;
        z-index: 20;
        white-space: nowrap;
    }

    .order-button:hover,
    .order-button:active {
        transform: translateX(-50%) scale(1.05);
    }

    /* Hide trees on mobile */
    .tree {
        display: none;
    }

    /* Hide corner flourishes on mobile */
    .corner-flourish {
        display: none;
    }

    /* Adjust hills for mobile */
    .hills {
        height: 40%;
        z-index: 1;
    }

    .hill-back {
        height: 250px;
        bottom: 60px;
    }

    .hill-mid {
        height: 200px;
        bottom: 40px;
    }

    .hill-front {
        height: 150px;
    }

    /* Ground */
    .ground {
        height: 70px;
        z-index: 2;
    }

    .grass {
        height: 70px;
    }

    .flowers {
        bottom: 8px;
    }

    .flower {
        font-size: 1rem;
    }

    /* Sky adjustments */
    .sky {
        height: 35%;
    }

    .sun {
        width: 50px;
        height: 50px;
        top: 15px;
        right: 20px;
    }

    .cloud {
        transform: scale(0.5);
    }
}

@media (max-width: 500px) {
    .storybook-page {
        border-width: 5px;
    }

    .banner {
        padding: 12px 20px;
        margin-top: 100px;
        margin-left: auto !important;
        margin-right: auto !important;
        align-self: center;
    }

    .banner h1 {
        font-size: 1.4rem;
    }

    .banner::before,
    .banner::after {
        font-size: 14px;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    /* Speech bubble - bigger text */
    .speech-bubble {
        position: absolute;
        top: auto;
        bottom: 320px;
        left: 3%;
        right: auto;
        width: 160px;
        max-width: 160px;
        height: auto;
        max-height: 100px;
        padding: 10px 12px;
        overflow: hidden;
    }

    .speech-bubble p {
        font-size: 0.85rem;
        line-height: 1.3;
        margin: 0;
    }

    /* Lucy character - bigger */
    .lucy-character {
        left: 5px !important;
        bottom: 95px !important;
    }

    .head-container {
        width: 75px !important;
        height: 88px !important;
        margin-bottom: -91px !important;
        margin-left: -6px !important;
    }

    .lucy-body {
        width: 115px !important;
        height: 210px !important;
    }

    /* Cookie stand - bigger */
    .cookie-stand {
        position: absolute !important;
        right: 2% !important;
        left: auto !important;
        bottom: 95px !important;
    }

    .table-top {
        width: 220px !important;
        height: 22px !important;
    }

    .cookie-boxes {
        gap: 5px !important;
        padding: 5px !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
        max-width: none !important;
    }

    .box {
        width: 34px !important;
        height: 48px !important;
    }

    .cookie-name {
        font-size: 0.5rem !important;
        padding: 2px 3px !important;
    }

    .table-legs {
        padding: 0 25px !important;
    }

    .leg {
        width: 16px !important;
        height: 55px !important;
    }

    .order-button {
        bottom: 20px;
        font-size: 1rem;
        padding: 10px 22px;
        white-space: nowrap;
    }

    .button-icon {
        font-size: 1.2rem;
    }

    .ground {
        height: 60px;
    }

    .grass {
        height: 60px;
    }
}