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



/* Animated Background Elements */
.background-decorations {
    position: fixed;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.floating-emoji {
    position: absolute;
    font-size: 2rem;
    animation: float 20s infinite linear;
    opacity: 0.3;
}

.emoji1 {
    top: 10%;
    left: -50px;
    animation-duration: 25s;
}

.emoji2 {
    top: 30%;
    left: -50px;
    animation-duration: 20s;
    animation-delay: 5s;
}

.emoji3 {
    top: 50%;
    left: -50px;
    animation-duration: 22s;
    animation-delay: 10s;
}

.emoji4 {
    top: 70%;
    left: -50px;
    animation-duration: 18s;
    animation-delay: 15s;
}

.emoji5 {
    top: 90%;
    left: -50px;
    animation-duration: 24s;
    animation-delay: 2s;
}

@keyframes float {
    0% {
        transform: translateX(0) rotate(0deg);
    }

    100% {
        transform: translateX(calc(100vw + 100px)) rotate(360deg);
    }
}

/* Stars Animation */
.star {
    position: absolute;
    color: #ffd700;
    animation: twinkle 3s infinite;
}

.star1 {
    top: 15%;
    left: 10%;
    font-size: 1.5rem;
    animation-delay: 0s;
}

.star2 {
    top: 20%;
    right: 15%;
    font-size: 2rem;
    animation-delay: 1s;
}

.star3 {
    top: 75%;
    left: 20%;
    font-size: 1.8rem;
    animation-delay: 2s;
}

.star4 {
    top: 85%;
    right: 10%;
    font-size: 1.6rem;
    animation-delay: 0.5s;
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Main Container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 10;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    animation: bounceIn 1s;
}

.title {
    font-family: 'Bubblegum Sans', cursive;
    font-size: clamp(2.5rem, 6vw, 4rem);
    color: #fff;
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

.subtitle {
    font-size: clamp(1rem, 3vw, 1.3rem);
    color: #ffd700;
    font-weight: 600;
}

/* AI Badge */
.ai-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-top: 10px;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Main Card */
.main-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Topic Selection */
.topic-section {
    margin-bottom: 30px;
}

.section-title {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 1.8rem;
    color: #1e1e1e;
    text-align: center;
    margin-bottom: 20px;
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.topic-btn {
    background: linear-gradient(45deg, #dfab46 40%, #dfb86d 40%, #dfab46 61%);
    color: white;
    border: none;
    padding: 15px 10px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.topic-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.topic-btn:hover::before {
    left: 100%;
}

.topic-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.topic-btn.selected {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    transform: scale(1.1);
    animation: wiggle 0.5s;
}

@keyframes wiggle {

    0%,
    100% {
        transform: rotate(0deg) scale(1.1);
    }

    25% {
        transform: rotate(-3deg) scale(1.1);
    }

    75% {
        transform: rotate(3deg) scale(1.1);
    }
}

.topic-emoji {
    font-size: 2rem;
}

/* Create Button */
.create-btn-container {
    text-align: center;
    margin: 30px 0;
}

.create-btn {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
    border: none;
    padding: 20px 50px;
    border-radius: 50px;
    font-size: 1.5rem;
    font-family: 'Bubblegum Sans', cursive;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    animation: btnBounce 2s infinite;
}

@keyframes btnBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.create-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    animation: none;
}

.create-btn:active {
    transform: translateY(0) scale(0.98);
}

.create-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    animation: none;
}

/* Poem Display */
.poem-container {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-radius: 25px;
    padding: 30px;
    margin-top: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: none;
    position: relative;
    overflow: hidden;
}

.poem-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.poem-container.show {
    display: block;
    animation: popIn 0.5s ease-out;
}

@keyframes popIn {
    0% {
        transform: scale(0.8) rotateX(90deg);
        opacity: 0;
    }

    50% {
        transform: scale(1.1) rotateX(-10deg);
    }

    100% {
        transform: scale(1) rotateX(0);
        opacity: 1;
    }
}

.poem-header {
    text-align: center;
    margin-bottom: 20px;
}

.poem-title {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 1.8rem;
    color: #1e1e1e;
    margin-bottom: 10px;
}

.poem-topic-badge {
    display: inline-block;
    background: rgba(107, 70, 193, 0.2);
    color: #1e1e1e;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 600;
}

.poem-text {
    font-family: 'Bubblegum Sans', cursive;
    font-size: clamp(1.4rem, 4vw, 1.9rem);
    line-height: 1.8;
    color: #4a4a4a;
    text-align: center;
    margin: 20px 0;
    position: relative;
    z-index: 2;
}

.poem-line {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInLine 0.6s forwards;
    margin: 10px 0;
}

.poem-line:nth-child(1) {
    animation-delay: 0.2s;
}

.poem-line:nth-child(2) {
    animation-delay: 0.4s;
}

.poem-line:nth-child(3) {
    animation-delay: 0.6s;
}

.poem-line:nth-child(4) {
    animation-delay: 0.8s;
}

@keyframes fadeInLine {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Character Animation */
.character {
    font-size: 4rem;
    text-align: center;
    margin: 20px 0;
    animation: characterBounce 1s infinite;
}

@keyframes characterBounce {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-10px) rotate(-5deg);
    }

    50% {
        transform: translateY(-20px) rotate(0deg);
    }

    75% {
        transform: translateY(-10px) rotate(5deg);
    }
}

/* Sound Toggle */
.sound-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 100;
    font-size: 1.5rem;
    transition: all 0.3s;
}

.sound-toggle:hover {
    transform: scale(1.1) rotate(10deg);
}

/* Loading Animation */
.loading {
    display: none;
    text-align: center;
    margin: 20px 0;
}

.loading.show {
    display: block;
}

.loading-text {
    font-family: 'Bubblegum Sans', cursive;
    font-size: 1.5rem;
    color: #1e1e1e;
    margin-bottom: 15px;
}

.magic-dots {
    display: inline-flex;
    gap: 5px;
}

.dot {
    width: 12px;
    height: 12px;
    background: #1e1e1e;
    border-radius: 50%;
    animation: dotPulse 1.4s infinite ease-in-out;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

.dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes dotPulse {

    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .main-card {
        padding: 20px;
    }

    .topic-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }

    .topic-btn {
        padding: 12px 8px;
        font-size: 0.85rem;
    }

    .topic-emoji {
        font-size: 1.5rem;
    }

    .create-btn {
        padding: 15px 35px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 2rem;
    }

    .topic-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .poem-text {
        font-size: 1.3rem;
    }
}

/* Animations */
@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

    to {
        transform: translateY(0);
        opacity: 1;
    }
}