:root {
    --bg-color: #f0f4f8;
    --text-color: #333;
    --primary-blue: #0d47a1;
    --soft-blue: #e3f2fd;
    --warm-neutral: #fff8e1;
    --success-green: #2e7d32;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --radius: 12px;
}

body {
    font-family: "Nunito", "Inter", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    overflow: hidden;
    /* Prevent default scrolling */
    user-select: none;
    /* Disable text selection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    transition: transform 0.5s ease-in-out;
}


img {
    width: 360px;
    max-width: 360px !important;
    min-width: 360px !important;
}

.slide {
    min-width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    box-sizing: border-box;
    overflow: hidden;
}

/* Navigation Bar */
#nav-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    z-index: 2000;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0;
    pointer-events: auto;
    /* Let clicks pass through empty space */
}

.ccllf-label {
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem 1rem;
    border-bottom-right-radius: 12px;
    font-weight: bold;
    color: #666;
    pointer-events: auto;
    transition: opacity 0.3s ease;
    opacity: 0.4;
    /* Faded by default */
}

#nav-container:hover .ccllf-label {
    opacity: 1;
}

.nav-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
    transform: translateY(-100%);
    /* Hidden by default */
    transition: transform 0.3s ease;
    background: white;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    margin-right: 2rem;
    /* Offset from right edge */
}

/* Show nav on hover of the container area */
#nav-container:hover .nav-center {
    transform: translateY(0);
}

/* The floating tab that stays visible */
.nav-tab {
    position: absolute;
    bottom: -30px;
    /* Hangs below the hidden bar */
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 4px 12px;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--primary-blue);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    cursor: pointer;
    transition: opacity 0.3s;
}

/* Hide tab when nav is open */
#nav-container:hover .nav-tab {
    opacity: 0;
    pointer-events: none;
}

.nav-items {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    max-width: 60vw;
    padding: 0.5rem;
    scrollbar-width: none;
    /* Hide scrollbar */
}

.nav-items::-webkit-scrollbar {
    display: none;
}

.nav-item {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    color: #555;
    transition: background 0.2s;
}

.nav-item:hover {
    background: var(--soft-blue);
    color: var(--primary-blue);
}

.nav-item.active {
    background: var(--primary-blue);
    color: white;
}

/* Navigation Buttons */
.nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.7);
    border: none;
    font-size: 2rem;
    padding: 1rem;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: background 0.3s;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 1);
}

.prev-btn {
    left: 20px;
}

.next-btn {
    right: 20px;
}

/* Header Slide */
header {
    background: white;
    padding: 3rem;
    text-align: center;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

header h1 {
    color: var(--primary-blue);
    margin: 0;
    font-size: 3rem;
}

.subtitle {
    color: #666;
    margin-top: 1rem;
    font-weight: 600;
    font-size: 1.2rem;
}

/* Section Headers */
.section-header h2 {
    color: var(--primary-blue);
    border-bottom: 3px solid var(--soft-blue);
    display: inline-block;
    padding-bottom: 0.5rem;
    margin-top: 0;
    font-size: 2.5rem;
}

.section-header-bar {
    background: var(--primary-blue);
    color: white;
    padding: 1.5rem 3rem;
    border-radius: 12px;
    font-weight: bold;
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
}

/* Content Blocks */
.root-word-block,
.derivative-block {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
    position: relative;
    /* For reset button positioning */
}

.root-word-block h3,
.derivative-block h4 {
    margin: 0;
    color: #333;
    font-size: 1.8rem;
}

.sentence-pair {
    display: flex;
    flex-direction: row;
    /* Side by side for warm-up */
    gap: 1.5rem;
    max-width: 1000px;
    /* Wider to fit two */
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.sentence-block {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 800px;
    width: 100%;
}

.img-placeholder {
    width: 160px;
    /* Larger base size */
    aspect-ratio: 4/3;
    /* Enforce 4:3 */
    height: auto;
    background: #ddd;
    text-align: center;
}

.lesson-sentence {
    margin: 0;
    font-size: 1.4rem;
}

/* Emoji Hints */
.emoji-hint {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 1em;
    opacity: 0.9;
    margin-left: 8px;
}

.emoji-hint.sky {
    background: linear-gradient(135deg, #cfe9ff, #a5d4ff);
}

.emoji-hint.prot {
    background: linear-gradient(135deg, #ffffff 45%, #e0f4ff 55%);
}

.emoji-hint.cult {
    background: linear-gradient(135deg, #f3f7e0, #d8e9a8);
}

.emoji-hint.inv {
    background: linear-gradient(135deg, #e5dcff, #c7b8ff);
}

.emoji-hint.iso {
    background: linear-gradient(135deg, #eeeef1, #dcdce1);
}

/* Pronunciation Buttons */
.pronounce-btn {
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #e0e0e0;
    color: #333;
    font-weight: 600;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pronounce-btn.state1 {
    background: #0d47a1;
    color: white;
}

.pronounce-btn.state2 {
    background: linear-gradient(135deg, #0d47a1, #2e7d32);
    color: white;
}

.pronounce-btn.state3 {
    background: #2e7d32;
    color: white;
    cursor: default;
    transform: scale(1.05);
}

.pronounce-btn.state3::after {
    content: ' ✓';
    margin-left: 8px;
    font-size: 1.3em;
    line-height: 1;
}

/*
border: none;
color: #999;
cursor: pointer;
font-size: 1rem;
padding: 0.5rem;
border-radius: 50%;
transition: color 0.2s;
}*/

.reset-btn:hover {
    color: var(--primary-blue);
    background: #f0f0f0;
}

#reset-writing {
    font-size: 1rem;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin-left: 1rem;
    background: #f0f0f0;
}

/* Writing Challenge Custom Scroll */
.writing-scroll-container-wrapper {
    width: 100%;
    max-width: 80%;
    height: 70vh;
    /* Fixed height for the scrollable area */
    position: relative;
    overflow: hidden;
    /* Hide default scrollbar */
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
}

.writing-scroll-container {
    height: 100%;
    overflow: hidden;
    /* Hide default scrollbar */
    cursor: grab;
    /* Indicate draggable */
}

.writing-scroll-container:active {
    cursor: grabbing;
}

.writing-list {
    padding: 1rem;
    /* Content will be transformed via JS */
}

.writing-item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    align-items: flex-start;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.writing-content {
    flex-grow: 1;
}

.prompt {
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.input-group {
    display: flex;
    gap: 1rem;
}

input[type="text"],
input,
textarea {
    flex-grow: 1;
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1.1rem;
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    pointer-events: auto !important;
}

.check-btn {
    padding: 0 2rem;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
}

.check-btn:hover {
    opacity: 0.9;
}

.feedback {
    margin-top: 0.5rem;
    font-weight: bold;
    min-height: 1.5em;
    font-size: 1.1rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: #888;
}

.footer-content {
    max-width: 200px;
    margin: 0 auto;
}

.footer-line {
    height: 4px;
    background: #e0e0e0;
    margin-bottom: 8px;
    border-radius: 2px;
}

/* Responsive */
@media (max-width: 800px) {
    .sentence-pair {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 600px) {
    .sentence-block {
        flex-direction: column;
        align-items: flex-start;
    }

    .writing-item {
        flex-direction: column;
    }

    .input-group {
        flex-direction: column;
    }

    .check-btn {
        width: 100%;
        padding: 0.8rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .section-header-bar {
        font-size: 1.5rem;
        padding: 1rem 2rem;
    }
}

/* Victory Screen */
.victory-screen {
    text-align: center;
    background: white;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    animation: popIn 0.5s ease;
}

.victory-screen h2 {
    color: var(--success-green);
    font-size: 3rem;
    margin-bottom: 1rem;
}

.victory-screen p {
    font-size: 1.5rem;
    color: #666;
}

.star-icon {
    font-size: 5rem;
    margin-top: 1rem;
    animation: spin 2s infinite linear;
    display: inline-block;
}

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

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

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

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

/* Actual slide images - 360px thumbnails */
.slide-image {
    width: 360px;
    max-width: 100%;
    aspect-ratio: 4/3;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.slide-image:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Image overlay for fullsize view */
.image-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.9);
        z-index: 9999;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        animation: fadeIn 0.2s ease;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }

    .overlay-content {
        position: relative;
        max-width: 90vw;
        max-height: 90vh;
    }

    .overlay-image {
        max-width: 80%!important;
        max-height: 90vh;
        width: auto;
        height: auto;
        border-radius: 12px;
        box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    }

    .overlay-close {
        position: absolute;
        top: -40px;
        right: 0;
        font-size: 2.5rem;
        color: white;
        cursor: pointer;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.2s;
    }

    .overlay-close:hover {
        background: rgba(255, 255, 255, 0.1);
    }

/* Actual slide images - 360px thumbnails */
.slide-image {
    width: 360px;
    max-width: 100%;
    aspect-ratio: 4/3;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.slide-image:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Image overlay for fullsize view */
.image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.overlay-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.overlay-image {
    max-width: 800px;
    max-height: 90vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.overlay-close {
    position: absolute;
    top: -40px;
    right: 0;
    font-size: 2.5rem;
    color: white;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.overlay-close:hover {
    background: rgba(255, 255, 255, 0.1);
}
