* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #FFB6C6;
    --secondary: #FFE4E1;
    --accent: #FFD700;
    --text: #4A4A4A;
    --light-blue: #B0E0E6;
    --light-purple: #E6E6FA;
    --light-green: #F0FFF0;
    --soft-pink: #FFF0F5;
    --warm-yellow: #FFFACD;
}

body {
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Arial Rounded MT Bold', sans-serif;
    background: linear-gradient(135deg, var(--soft-pink) 0%, var(--light-blue) 50%, var(--light-purple) 100%);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    font-size: 16px;
    transition: font-size 0.3s ease;
}

/* Accessibility Bar */
.accessibility-bar {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.accessibility-btn {
    background: var(--primary);
    border: none;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.accessibility-btn:hover {
    background: #ff9fb0;
    transform: scale(1.1);
}

/* Animated Background */
.stars-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: radial-gradient(circle at 20% 50%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(255, 182, 193, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 40% 20%, rgba(176, 224, 230, 0.1) 0%, transparent 50%);
    animation: twinkle 3s ease-in-out infinite alternate;
}

@keyframes twinkle {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

header {
    text-align: center;
    padding: 2rem 1rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
    margin-bottom: 2rem;
}

.header-content h1 {
    font-size: 2.5rem;
    color: var(--primary);
    text-shadow: 2px 2px 4px rgba(255, 182, 193, 0.3);
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text);
    margin-top: 0.5rem;
}

.user-welcome {
    margin-top: 1rem;
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: bold;
}

/* Main Navigation */
.main-nav {
    display: none;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    margin-bottom: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-btn {
    background: linear-gradient(135deg, var(--light-blue) 0%, var(--light-purple) 100%);
    border: none;
    border-radius: 15px;
    padding: 1rem 1.5rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    min-width: 100px;
}

.nav-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    box-shadow: 0 4px 15px rgba(255, 182, 193, 0.4);
}

.nav-icon {
    font-size: 1.5rem;
}

.nav-label {
    font-size: 0.85rem;
}

main {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 300px);
    padding-bottom: 2rem;
}

.screen {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

.intro-text {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text);
    line-height: 1.6;
}

/* Welcome Screen */
.welcome-content {
    text-align: center;
}

.welcome-intro {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: var(--text);
}

.profile-setup h3,
.profile-welcome h3 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.profile-step {
    animation: fadeIn 0.5s ease-in;
}

.profile-hint {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 2rem;
    font-style: italic;
}

.name-input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin: 2rem 0;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.name-input {
    width: 100%;
    padding: 1.2rem;
    font-size: 1.3rem;
    font-family: inherit;
    border: 3px solid var(--primary);
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s ease;
}

.name-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    transform: scale(1.02);
}

.challenge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.challenge-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    border-radius: 20px;
    padding: 2rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    position: relative;
    overflow: hidden;
}

.challenge-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.challenge-card .emoji {
    font-size: 3rem;
    display: block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.challenge-card .label {
    font-weight: bold;
    font-size: 0.9rem;
    text-align: center;
}

.primary-btn, .secondary-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    border-radius: 15px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: bold;
    color: var(--text);
    cursor: pointer;
    margin: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.secondary-btn {
    background: linear-gradient(135deg, var(--light-blue) 0%, var(--light-purple) 100%);
}

.primary-btn:hover, .secondary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Stories Screen */
.story-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.action-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 3px solid transparent;
}

.action-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.card-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary);
    display: block;
    margin-bottom: 0.5rem;
}

.card-desc {
    font-size: 0.95rem;
    color: var(--text);
    display: block;
}

.story-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-top: 1rem;
}

.story-header h2 {
    color: var(--primary);
    text-align: center;
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.story-visual {
    position: relative;
    height: 150px;
    margin: 2rem 0;
    overflow: hidden;
}

.floating-characters {
    position: relative;
    width: 100%;
    height: 100%;
}

.character {
    position: absolute;
    font-size: 3rem;
    animation: floatAround 6s ease-in-out infinite;
}

.character-1 { left: 20%; animation-delay: 0s; }
.character-2 { left: 50%; animation-delay: 2s; }
.character-3 { left: 80%; animation-delay: 4s; }

@keyframes floatAround {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(10deg); }
    50% { transform: translateY(-40px) rotate(0deg); }
    75% { transform: translateY(-20px) rotate(-10deg); }
}

.story-text-container {
    background: var(--light-green);
    border-radius: 15px;
    padding: 2rem;
    margin: 2rem 0;
    min-height: 200px;
    border: 3px solid var(--primary);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
}

.story-text {
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text);
    text-align: left;
    animation: typewriter 1s ease-in;
}

@keyframes typewriter {
    from { opacity: 0; }
    to { opacity: 1; }
}

.story-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
}

.action-btn {
    background: linear-gradient(135deg, var(--light-blue) 0%, var(--light-purple) 100%);
    border: none;
    border-radius: 15px;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-family: inherit;
    font-weight: bold;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-icon {
    font-size: 1.3rem;
}

.back-button {
    background: var(--primary);
    border: none;
    border-radius: 10px;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-family: inherit;
    color: white;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.back-button:hover {
    background: #ff9fb0;
    transform: translateX(-5px);
}

/* Activities */
.activities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.activity-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 3px solid transparent;
}

.activity-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.activity-icon {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 1rem;
}

.activity-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary);
    display: block;
    margin-bottom: 0.5rem;
}

.activity-desc {
    font-size: 0.95rem;
    color: var(--text);
    display: block;
}

.activity-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 2rem;
    margin-top: 1rem;
}

/* Drawing Activity */
.drawing-container {
    text-align: center;
}

#drawing-canvas {
    border: 3px solid var(--primary);
    border-radius: 15px;
    background: white;
    cursor: crosshair;
    max-width: 100%;
    height: auto;
}

.drawing-controls {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

#color-picker {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.draw-btn {
    background: var(--light-blue);
    border: none;
    border-radius: 10px;
    padding: 0.8rem 1.5rem;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.draw-btn:hover {
    background: var(--light-purple);
    transform: translateY(-2px);
}

/* Journal Activity */
.journal-container {
    max-width: 800px;
    margin: 0 auto;
}

#journal-text {
    width: 100%;
    min-height: 300px;
    padding: 1.5rem;
    border: 3px solid var(--primary);
    border-radius: 15px;
    font-family: inherit;
    font-size: 1.1rem;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: 1rem;
}

#journal-entries {
    margin-top: 2rem;
}

.journal-entry {
    background: var(--light-green);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 5px solid var(--primary);
}

.journal-date {
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.journal-text {
    line-height: 1.6;
    color: var(--text);
}

/* Emotions Activity */
.emotions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.emotion-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    border-radius: 15px;
    padding: 2rem 1rem;
    font-size: 1.2rem;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.emotion-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.emotion-response {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--light-green);
    border-radius: 15px;
    border: 3px solid var(--primary);
}

.emotion-message {
    text-align: center;
}

.emotion-help {
    margin-top: 1rem;
    font-style: italic;
    color: var(--primary);
}

/* Breathing Activity */
.breathing-container {
    text-align: center;
    padding: 3rem;
}

.breathing-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--light-blue) 100%);
    margin: 2rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 4s ease-in-out;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.breathing-text {
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Affirmations Activity */
.affirmation-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--light-purple) 100%);
    border-radius: 20px;
    padding: 3rem;
    margin: 2rem 0;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

#affirmation-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* Community */
.community-rules {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 1.5rem;
    margin: 1rem 0;
    border-left: 5px solid var(--accent);
}

.community-main {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 2rem;
    margin-top: 1rem;
}

.messages-container {
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--light-green);
    border-radius: 15px;
}

.message-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.message-item.friendly {
    border-left: 5px solid var(--accent);
}

.message-item.user {
    border-left: 5px solid var(--primary);
}

.message-avatar {
    font-size: 2rem;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
}

.message-text {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.message-time {
    font-size: 0.85rem;
    color: #888;
}

.message-input-area {
    margin-top: 2rem;
}

#message-input {
    width: 100%;
    min-height: 100px;
    padding: 1rem;
    border: 3px solid var(--primary);
    border-radius: 15px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 1rem;
}

.input-hint {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
    margin-top: 0.5rem;
}

/* Saved Items */
.saved-tabs {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.tab-btn {
    background: var(--light-blue);
    border: none;
    border-radius: 15px;
    padding: 1rem 2rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: var(--light-purple);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.saved-list {
    display: none;
}

.saved-list.active {
    display: block;
}

.saved-stories-list, .saved-items-grid {
    display: grid;
    gap: 1.5rem;
    margin-top: 2rem;
}

.saved-items-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.saved-story-card, .saved-item-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-left: 5px solid var(--primary);
}

.saved-story-title {
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.saved-story-date, .saved-item-date {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 1rem;
}

.saved-story-preview {
    color: var(--text);
    margin: 1rem 0;
    line-height: 1.6;
}

.saved-story-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.saved-action-btn {
    background: var(--light-blue);
    border: none;
    border-radius: 10px;
    padding: 0.6rem 1.2rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text);
    font-size: 0.9rem;
}

.saved-action-btn:hover {
    background: var(--light-purple);
    transform: translateY(-2px);
}

.saved-drawing-img {
    width: 100%;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.no-stories-message {
    text-align: center;
    padding: 3rem;
    color: var(--text);
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
}

footer {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    margin-top: 3rem;
    position: relative;
    z-index: 1;
}

/* High Contrast Mode */
body.high-contrast {
    background: #000000;
    color: #FFFFFF;
}

body.high-contrast .challenge-card,
body.high-contrast .action-card,
body.high-contrast .activity-card {
    background: #FFFFFF;
    color: #000000;
    border: 3px solid #FFFFFF;
}

/* Responsive Design */
@media (max-width: 768px) {
    .accessibility-bar {
        top: 5px;
        right: 5px;
        padding: 5px;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .main-nav {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .nav-btn {
        padding: 0.8rem 1rem;
        min-width: 80px;
    }
    
    .nav-icon {
        font-size: 1.3rem;
    }
    
    .nav-label {
        font-size: 0.75rem;
    }
    
    .challenge-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .story-selection,
    .activities-grid {
        grid-template-columns: 1fr;
    }
    
    #drawing-canvas {
        width: 100%;
        height: auto;
    }
    
    .community-main {
        padding: 1rem;
    }
}

/* Accessibility */
button:focus,
.challenge-card:focus,
.action-card:focus,
.activity-card:focus {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
