/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Annie+Use+Your+Telescope&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Indie+Flower&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Pangolin&display=swap');

/* --- Global & Typography --- */
body { 
    font-family: 'Nunito', sans-serif; 
    margin: 0; 
    padding: 0; 
}

/* Specific sizing */
h1 { font-size: 2.8rem; }
h2 { font-size: 2.0rem; }
p  { font-size: 1.2rem; }

/* --- Tool-Specific Heading Colors --- */
h2.story, span.card-label.story      { color: #ff9800; }
h2.game, span.card-label.game       { color: #e6c24cff; }
h2.flashcard, span.card-label.flashcard { color: #4caf50; }
h2.art, span.card-label.art          { color: #2196f3; }
h2.music, span.card-label.music      { color: #9c27b0; }
h2.news, span.card-label.news        { color: #008080; }

.title {
    font-family: 'Pangolin', cursive;
    display: block;      /* Ensure it behaves as a full-width block */
    width: 100%;         /* Stretch to fill parent */
    margin-left: 0;      /* Remove default side margins */
    margin-right: 0;
    box-sizing: border-box; /* Ensures padding doesn't push width over 100% */
}

/* --- AI Effects & Animations --- */
.gradient-text-ai {
    background: linear-gradient(to right, rgb(246, 112, 59), rgb(239, 202, 68));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /*font-family: 'Pangolin', cursive;*/
}

.gradient-text-ai-2 {
    background: linear-gradient(to right, rgb(137, 206, 39), rgb(68, 131, 239));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /*font-family: 'Pangolin', cursive;*/
}

.gradient-text-rainbow {
    background: linear-gradient(to right, #e8a02dff, #efe944ff, #78e750ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.fade-in { animation: fadeIn 0.5s ease-out; }

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

/* --- Navigation & Links --- */
.user {
    /*font-family: 'Nunito', sans-serif; */
    color: #4792e2ff;
    text-decoration: none;
}
.user:hover { color: #9fcde3ff; }

.app-nav, .global-app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(65px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    width: 100%;
}

.app-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #6b7280;
    font-size: 0.65rem;
    font-weight: 600;
}
.app-link svg { width: 22px; height: 22px; margin-bottom: 2px; }

/* --- Buttons --- */
.btn-view {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    background-color: #aec3d8; /* Dark grey/black background */
    border: 0px solid #ffffff; 
    color: #ffffff;            /* White text */    
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: capitalize;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}
.btn-view:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    opacity: 0.95;
}

/* Button Backgrounds */
a.btn-view.story     { background-color: #ff9800 !important; }
a.btn-view.game      { background-color: #e6c24cff !important; }
a.btn-view.flashcard { background-color: #4caf50 !important; }
a.btn-view.art       { background-color: #2196f3 !important; }
a.btn-view.music     { background-color: #9c27b0 !important; }
a.btn-view.news      { background-color: #008080 !important; }

/* Lock the main wrapper to exactly the screen height */
.story-wrapper {
    display: flex;
    flex-direction: column;
    height: 100dvh; /* Dynamic height to stay inside browser chrome */
    width: 100%;
    overflow: hidden; /* Crucial: stops the 'pushing' from causing a page scroll */
}

/* Ensure this fills the space between the top and the bottom nav */
.story-display-area {
    flex: 1; /* This is the ONLY area allowed to grow or shrink */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0; /* Flexbox fix for nested scrolling */
}

/* Ensure the active slide fills 100% of the display area */
.story-slide.active { 
    display: flex; 
    flex-direction: column;
    height: 100%; 
}

/* Fix the image container so it doesn't 'push' the text out */
.image-container { 
    flex: 1; /* Give image and text equal priority or adjust as needed */
    width: 100%; 
    overflow: hidden;
    display: flex; 
    align-items: center; 
    justify-content: center;
}

/* The magic part: Only the text scrolls if it is too long */
.text-container { 
    flex: 1; 
    padding: 1rem 1.5rem 0.25rem 1.5rem; 
    /*font-family: 'Nunito', sans-serif;*/ 
    font-size: 1.1rem; 
    line-height: 1.5; 
    color: #111827; 
    overflow-y: auto; /* Only this part scrolls */
    -webkit-overflow-scrolling: touch;
}

.bottom-nav {
    flex-shrink: 0; /* Prevents this from being pushed off */
    height: 80px;
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid #eee;
}

.nav-btn { display: flex; flex-direction: column; align-items: center; background: none; border: none; color: #4b5563; font-size: 0.75rem; font-weight: 700; width: 80px; }
.nav-btn svg { width: 26px; height: 26px; margin-bottom: 4px; }
.play-btn-wrapper { position: relative; top: -25px; width: 70px; display: flex; justify-content: center; }
.play-btn { width: 68px; height: 68px; background: #2563eb; color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 20px rgba(37, 99, 235, 0.4); border: none; }

/* --- Flashcard Components --- */
.card-scene { perspective: 1000px; width: 100%; height: 250px; cursor: pointer; }
.flash-card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.6s; }
.card-scene.is-flipped .flash-card { transform: rotateY(180deg); }
.card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; align-items: center; justify-content: center; padding: 24px; border: 1px solid #e5e7eb; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }
.card-face-front { background-color: white; color: #111827; }
.card-face-back { background-color: #f3f4f6; color: #1f2937; transform: rotateY(180deg); }

/* --- Modals & Vocabulary --- */
.vocab-word { color: #2563eb; font-weight: 700; border-bottom: 2px dashed #bfdbfe; cursor: pointer; }
#vocab-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: none; align-items: center; justify-content: center; z-index: 2000; padding: 20px; }
.modal-content { background: white; padding: 2rem; border-radius: 24px; width: 100%; max-width: 340px; text-align: center; }

.type-badge {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.05em; /* tracking-wider */
    font-weight: 700;
    padding: 2px 6px; /* px-1.5 py-0.5 approx */
    border-radius: 4px; /* rounded */
    border-width: 1px;
    border-style: solid;
    transition: all 0.2s ease-in-out;
    display: inline-block;
}

/* Color Mappings aligned to your buttons */
.type-story     { background-color: #fff4e5; border-color: #ff9800; color: #ff9800; }
.type-game      { background-color: #fcf9ed; border-color: #e6c24c; color: #b38f00; }
.type-flashcard { background-color: #edf7ed; border-color: #4caf50; color: #2e7d32; }
.type-art       { background-color: #e3f2fd; border-color: #2196f3; color: #1976d2; }
.type-music     { background-color: #f3e5f5; border-color: #9c27b0; color: #7b1fa2; }
.type-news      { background-color: #e0f2f2; border-color: #008080; color: #008080; }
.type-default   { background-color: #f5f5f5; border-color: #9e9e9e; color: #616161; }

/* Standard CSS equivalent of your Tailwind classes */
.timestamp {
    color: #d1d5db; /* This is the hex for gray-300 */
    font-weight: 400; /* Normal weight */
    font-style: italic;
}

.meta-dot {
    margin-left: 0.5rem;  /* mx-2 */
    margin-right: 0.5rem; /* mx-2 */
    color: #e5e7eb;      /* gray-200 */
}

/* --- MOBILE OPTIMIZATION OVERRIDES --- */
/*
@media screen and (max-width: 768px) {
    html, body { 
        margin: 0 !important; 
        padding: 0 !important; 
        width: 100% !important; 
        overflow-x: hidden; 
    }
        */
    
    /* Targets common containers and edge-to-edge content */
    /*
    .container, .wrapper, .main-content, div[class*="page"], .story-wrapper { 
        margin: 0 !important; 
        padding: 0 !important; 
        width: 100% !important; 
        max-width: 100vw !important; 
    }
    
    img { 
        width: 100% !important; 
        height: auto !important; 
        border-radius: 0 !important; 
        margin: 0 !important; 
    }
        */
    
    /* Full-width inputs for easier tapping on small screens */
    /*
    button, .btn, input, select { 
        width: 100% !important; 
        box-sizing: border-box; 
    }
        
}
    */