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

body {
    background: linear-gradient(135deg, #4A154B 0%, #2E1065 50%, #1E1B4B 100%);
    font-family: 'Quicksand', sans-serif;
    color: #FFFFFF;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    user-select: none;
}

h1, h2, h3, .home-btn, .group-title, .opt-btn, 
.btn-create-story, .btn-audio-story, .btn-stop-story, .book-badge {
    font-family: 'Fredoka One', cursive !important;
}

.container {
    max-width: 1020px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* Background Sparkles */
.sky-elements {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
}

.sparkle {
    position: absolute;
    font-size: 2.5rem;
    animation: sparkleGlow 2s infinite alternate ease-in-out;
}
.sp-1 { top: 40px; left: 60px; }
.sp-2 { top: 120px; right: 80px; animation-delay: 0.7s; }
.sp-3 { bottom: 80px; left: 120px; animation-delay: 1.2s; }

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 25px;
}

.home-btn {
    background: #FFF;
    color: #3C2A21;
    border: 3px solid #3C2A21;
    border-radius: 12px;
    padding: 8px 16px;
    text-decoration: none;
    box-shadow: 0 4px 0 #3C2A21;
}
.home-btn:hover { background: #3C2A21; color: #FFF; }

.header-info { text-align: center; flex-grow: 1; }
.header-info h1 { font-size: 2.2rem; color: #FBBF24; text-shadow: 2px 2px 0 #000; }
.header-info p { font-weight: 700; color: #DDD6FE; font-size: 1rem; }

/* Adventure Layout Split Grid */
.adventure-layout {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 25px;
}

/* LEFT STORY BUILDER */
.story-builder-panel {
    background: #FFFDF0;
    color: #3C2A21;
    border: 5px solid #3C2A21;
    border-radius: 26px;
    padding: 22px;
    box-shadow: 0 10px 0 #3C2A21;
}

.story-builder-panel h2 {
    font-size: 1.4rem;
    color: #9333EA;
    margin-bottom: 16px;
    text-align: center;
}

.choice-group {
    margin-bottom: 14px;
}

.group-title {
    font-size: 0.95rem;
    color: #4B5563;
    display: block;
    margin-bottom: 6px;
}

.options-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.opt-btn {
    background: #FFFFFF;
    border: 2.5px solid #3C2A21;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 0.95rem;
    color: #3C2A21;
    cursor: pointer;
    box-shadow: 0 3px 0 #3C2A21;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.1s, background-color 0.15s;
}

.opt-btn:hover { background: #FEF08A; }
.opt-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #3C2A21; }

.opt-btn.active {
    background: #FFD93D !important;
    outline: 3px solid #FF597B;
    transform: scale(1.02);
}

.btn-create-story {
    background: #22C55E;
    color: #FFF;
    border: 3.5px solid #3C2A21;
    border-radius: 16px;
    padding: 12px;
    font-size: 1.15rem;
    width: 100%;
    cursor: pointer;
    box-shadow: 0 6px 0 #3C2A21;
    margin-top: 10px;
    transition: transform 0.1s;
}
.btn-create-story:active { transform: translateY(4px); box-shadow: 0 2px 0 #3C2A21; }

/* RIGHT STORYBOOK PANEL */
.storybook-panel {
    display: flex;
    flex-direction: column;
}

.book-cover {
    background: #FFFDF0;
    border: 6px solid #3C2A21;
    border-radius: 28px;
    padding: 24px;
    box-shadow: 0 12px 0 #3C2A21;
    color: #3C2A21;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}

.book-header {
    text-align: center;
    border-bottom: 2.5px dashed #CBD5E1;
    padding-bottom: 12px;
    margin-bottom: 15px;
}

.book-badge {
    background: #FF597B;
    color: #FFF;
    border: 1.5px solid #3C2A21;
    border-radius: 8px;
    padding: 2px 10px;
    font-size: 0.8rem;
    display: inline-block;
    margin-bottom: 4px;
}

.book-header h3 {
    font-size: 1.45rem;
    color: #2F58CD;
}

.book-illustration {
    background: #E8F1FF;
    border: 3px solid #3C2A21;
    border-radius: 18px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 16px;
}

.art-icon {
    font-size: 3rem;
    animation: gentleBob 2s infinite alternate ease-in-out;
}
#art-buddy { animation-delay: 0.5s; }
#art-world { animation-delay: 1s; }

.book-content {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.6;
    color: #334155;
    background: #FFFFFF;
    border: 2px solid #3C2A21;
    border-radius: 14px;
    padding: 16px;
    min-height: 130px;
    margin-bottom: 18px;
}

.book-controls {
    display: flex;
    gap: 10px;
}

.btn-audio-story {
    background: #3B82F6;
    color: #FFF;
    border: 3px solid #3C2A21;
    border-radius: 12px;
    padding: 10px 18px;
    font-size: 1rem;
    flex-grow: 1;
    cursor: pointer;
    box-shadow: 0 4px 0 #3C2A21;
}
.btn-audio-story:active { transform: translateY(2px); box-shadow: 0 2px 0 #3C2A21; }

.btn-stop-story {
    background: #EF4444;
    color: #FFF;
    border: 3px solid #3C2A21;
    border-radius: 12px;
    padding: 10px 18px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 0 #3C2A21;
}
.btn-stop-story:active { transform: translateY(2px); box-shadow: 0 2px 0 #3C2A21; }

@keyframes sparkleGlow {
    0% { transform: scale(0.9) rotate(0deg); opacity: 0.5; }
    100% { transform: scale(1.15) rotate(15deg); opacity: 1; }
}

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

@media (max-width: 850px) {
    .adventure-layout { grid-template-columns: 1fr; }
}