/* ============================================================
   MEDPHIN — shared.css
   Design system shared across all lesson files
   ============================================================ */

/* ── GOOGLE FONTS ── */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* ── CSS VARIABLES ── */
:root {
    /* Brand blues */
    --blue-primary: #4BA3F5;
    --blue-deep: #1A6FD4;
    --blue-light: #EBF4FF;
    --blue-pale: #F0F8FF;

    /* Navy */
    --navy: #1A2B4A;
    --navy-light: #2D3F63;

    /* Feedback colors */
    --green: #2ECC71;
    --green-light: #E8F8EF;
    --green-dark: #1DA55A;
    --red: #FF4D6A;
    --red-light: #FFE8EC;
    --red-dark: #D93055;
    --yellow: #FFD93D;
    --yellow-dark: #E6C200;
    --yellow-light: #FFFBE6;

    /* Neutrals */
    --white: #FFFFFF;
    --gray-soft: #F5F7FA;
    --gray-mid: #E0E6F0;
    --gray-dark: #9AAABE;
    --text: #1A2B4A;
    --text-muted: #6B7A99;

    /* Layout */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-pill: 99px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(75, 163, 245, 0.10);
    --shadow-md: 0 4px 20px rgba(75, 163, 245, 0.15);
    --shadow-lg: 0 8px 32px rgba(75, 163, 245, 0.20);
    --shadow-btn: 0 6px 20px rgba(75, 163, 245, 0.35);

    /* Typography scale */
    --text-xs: 11px;
    --text-sm: 13px;
    --text-base: 15px;
    --text-md: 17px;
    --text-lg: 20px;
    --text-xl: 24px;
    --text-2xl: 30px;
    --text-3xl: 36px;
}

/* ── RESET ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

/* ── BASE ── */
html,
body {
    height: 100%;
    font-family: 'Nunito', sans-serif;
    background: var(--blue-pale);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ── PHONE SHELL ── */
.phone {
    width: 100%;
    max-width: 390px;
    min-height: 100dvh;
    margin: 0 auto;
    background: var(--white);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

@media (min-height: 700px) {
    body {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 24px 16px;
    }

    .phone {
        min-height: 700px;
        max-height: 860px;
        border-radius: var(--radius-xl);
        box-shadow: 0 24px 80px rgba(26, 43, 74, 0.18);
        overflow: hidden;
    }
}

/* ── SCREEN MANAGEMENT ── */
.screen {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.screen::-webkit-scrollbar {
    display: none;
}

.screen.active {
    display: flex;
}

/* ── SCROLLABLE BODY ── */
.scroll-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.scroll-body::-webkit-scrollbar {
    display: none;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px 12px;
    flex-shrink: 0;
    background: var(--white);
}

.topbar-close {
    width: 34px;
    height: 34px;
    border: none;
    background: var(--gray-soft);
    border-radius: var(--radius-pill);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
    font-family: 'Nunito', sans-serif;
}

.topbar-close:hover {
    background: var(--gray-mid);
}

.topbar-close:active {
    transform: scale(0.92);
}

.progress-track {
    flex: 1;
    height: 10px;
    background: var(--gray-mid);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue-primary), var(--blue-deep));
    border-radius: var(--radius-pill);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.hearts {
    display: flex;
    gap: 2px;
    font-size: 18px;
    flex-shrink: 0;
}

/* ============================================================
   WELCOME SCREEN
   ============================================================ */
.welcome-screen {
    background: linear-gradient(160deg, var(--navy) 0%, #1A4F8A 100%);
    align-items: center;
    justify-content: space-between;
    padding: 48px 28px 36px;
    text-align: center;
}

.welcome-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.welcome-mascot {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: float 3s ease-in-out infinite;
}

/* Placeholder while image loads */
.welcome-mascot-placeholder {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

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

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

.brand-name {
    font-size: var(--text-2xl);
    font-weight: 900;
    color: var(--white);
    letter-spacing: -0.5px;
}

.brand-name span {
    color: var(--blue-primary);
}

.brand-tagline {
    font-size: var(--text-xs);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.lesson-preview-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: left;
}

.lesson-category-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--blue-primary);
    color: var(--white);
    font-size: var(--text-xs);
    font-weight: 800;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.lesson-preview-title {
    font-size: var(--text-xl);
    font-weight: 900;
    color: var(--white);
    margin-bottom: 6px;
}

.lesson-preview-desc {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
    font-weight: 600;
}

.lesson-meta {
    display: flex;
    gap: 16px;
    margin-top: 14px;
}

.lesson-meta-item {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.65);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ============================================================
   MINI LESSON CARD
   ============================================================ */
.mini-lesson-screen {
    padding: 0;
}

.mini-lesson-body {
    padding: 16px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mini-lesson-mascot {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin: 0 auto;
    display: block;
}

.mini-lesson-mascot-placeholder {
    width: 80px;
    height: 80px;
    background: var(--blue-light);
    border-radius: 50%;
    margin: 0 auto;
}

.section-eyebrow {
    font-size: var(--text-xs);
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--blue-primary);
}

.lesson-card-title {
    font-size: var(--text-lg);
    font-weight: 900;
    color: var(--text);
    line-height: 1.3;
    margin-top: 2px;
}

.lesson-card-body {
    background: var(--blue-pale);
    border-left: 4px solid var(--blue-primary);
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: var(--text-base);
    color: var(--text);
    line-height: 1.75;
    font-weight: 600;
}

.lesson-card-body strong {
    color: var(--blue-deep);
}

/* ============================================================
   QUESTION SCREEN
   ============================================================ */
.question-screen {
    flex-direction: column;
}

.question-body {
    padding: 8px 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Illustration */
.question-illustration {
    width: 100%;
    aspect-ratio: 1;
    max-height: 180px;
    object-fit: contain;
    border-radius: var(--radius-lg);
    background: var(--blue-light);
    display: block;
}

.question-illustration-placeholder {
    width: 100%;
    height: 160px;
    background: var(--blue-light);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--blue-primary);
}

/* Question prompt */
.question-prompt {
    background: var(--gray-soft);
    border-radius: var(--radius-md);
    padding: 16px;
}

.question-prompt p {
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--text);
    line-height: 1.55;
}

/* Format label */
.format-label {
    font-size: var(--text-xs);
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: -6px;
}

/* ============================================================
   MCQ OPTIONS
   ============================================================ */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--white);
    border: 2.5px solid var(--gray-mid);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    font-family: 'Nunito', sans-serif;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    line-height: 1.4;
}

.option-btn:hover:not(:disabled) {
    border-color: var(--blue-primary);
    background: var(--blue-light);
    transform: translateX(3px);
}

.option-btn:disabled {
    cursor: default;
}

.option-btn.selected {
    border-color: var(--blue-primary);
    background: var(--blue-light);
}

.option-btn.correct {
    border-color: var(--green);
    background: var(--green-light);
    color: var(--green-dark);
}

.option-btn.wrong {
    border-color: var(--red);
    background: var(--red-light);
    color: var(--red-dark);
}

.option-letter {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    background: var(--gray-mid);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 800;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    color: var(--text-muted);
}

.option-btn.correct .option-letter {
    background: var(--green);
    color: var(--white);
}

.option-btn.wrong .option-letter {
    background: var(--red);
    color: var(--white);
}

.option-btn.selected .option-letter {
    background: var(--blue-primary);
    color: var(--white);
}

/* ============================================================
   FILL IN THE BLANK
   ============================================================ */
.blank-sentence {
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--text);
    line-height: 1.8;
    padding: 16px;
    background: var(--gray-soft);
    border-radius: var(--radius-md);
}

.blank-slot {
    display: inline-block;
    min-width: 100px;
    border-bottom: 3px solid var(--blue-primary);
    padding: 0 8px;
    margin: 0 4px;
    text-align: center;
    color: var(--blue-deep);
    font-weight: 900;
}

.blank-slot.empty {
    color: transparent;
}

.word-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 8px 0;
}

.word-chip {
    padding: 10px 18px;
    background: var(--white);
    border: 2.5px solid var(--gray-mid);
    border-radius: var(--radius-pill);
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.word-chip:hover:not(:disabled) {
    border-color: var(--blue-primary);
    background: var(--blue-light);
    transform: translateY(-2px);
}

.word-chip.used {
    opacity: 0.3;
    cursor: default;
    transform: none;
}

.word-chip.correct {
    border-color: var(--green);
    background: var(--green-light);
    color: var(--green-dark);
}

.word-chip.wrong {
    border-color: var(--red);
    background: var(--red-light);
    color: var(--red-dark);
}

/* ============================================================
   MATCHING PAIRS
   ============================================================ */
.matching-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.match-chip {
    padding: 12px 10px;
    background: var(--white);
    border: 2.5px solid var(--gray-mid);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    text-align: center;
    font-family: 'Nunito', sans-serif;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    line-height: 1.4;
}

.match-chip:hover:not(:disabled):not(.matched) {
    border-color: var(--blue-primary);
    background: var(--blue-light);
}

.match-chip.selected {
    border-color: var(--blue-primary);
    background: var(--blue-light);
    transform: scale(1.03);
}

.match-chip.matched {
    border-color: var(--green);
    background: var(--green-light);
    color: var(--green-dark);
    cursor: default;
}

.match-chip.wrong-match {
    border-color: var(--red);
    background: var(--red-light);
    animation: shake 0.3s ease;
}

@keyframes shake {

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

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

/* ============================================================
   SEQUENCE
   ============================================================ */
.sequence-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sequence-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--white);
    border: 2.5px solid var(--gray-mid);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text);
    cursor: grab;
    transition: border-color 0.15s, box-shadow 0.15s;
    user-select: none;
}

.sequence-item:active {
    cursor: grabbing;
}

.sequence-item.dragging {
    box-shadow: var(--shadow-lg);
    border-color: var(--blue-primary);
    background: var(--blue-light);
}

.sequence-item.correct {
    border-color: var(--green);
    background: var(--green-light);
}

.sequence-item.wrong {
    border-color: var(--red);
    background: var(--red-light);
}

.sequence-num {
    width: 26px;
    height: 26px;
    background: var(--gray-mid);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 900;
    flex-shrink: 0;
    color: var(--text-muted);
}

.drag-handle {
    color: var(--gray-dark);
    font-size: 16px;
    margin-left: auto;
    flex-shrink: 0;
}

/* ============================================================
   FEEDBACK BAR
   ============================================================ */
.feedback-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-top: 2px solid var(--gray-mid);
    flex-shrink: 0;
}

.feedback-bar.visible {
    display: flex;
}

.feedback-bar.correct-state {
    background: var(--green-light);
    border-top-color: var(--green);
}

.feedback-bar.wrong-state {
    background: var(--red-light);
    border-top-color: var(--red);
}

.feedback-mascot {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
}

.feedback-mascot-placeholder {
    width: 44px;
    height: 44px;
    background: var(--gray-mid);
    border-radius: 50%;
    flex-shrink: 0;
}

.feedback-text {
    flex: 1;
    min-width: 0;
}

.feedback-title {
    font-size: var(--text-base);
    font-weight: 900;
    color: var(--text);
    display: block;
    margin-bottom: 2px;
}

.feedback-body {
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-weight: 600;
    line-height: 1.5;
    display: block;
}

.btn-next {
    padding: 11px 18px;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 800;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    white-space: nowrap;
    flex-shrink: 0;
    transition: transform 0.1s, opacity 0.15s;
}

.btn-next:active {
    transform: scale(0.95);
}

.correct-state .btn-next {
    background: var(--green);
    color: var(--white);
}

.wrong-state .btn-next {
    background: var(--red);
    color: var(--white);
}

/* ============================================================
   PRIMARY BUTTON
   ============================================================ */
.btn-primary {
    width: 100%;
    padding: 17px;
    background: var(--blue-primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    font-weight: 800;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    box-shadow: var(--shadow-btn);
    transition: background 0.15s, transform 0.1s;
    letter-spacing: 0.2px;
}

.btn-primary:hover {
    background: var(--blue-deep);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-secondary {
    width: 100%;
    padding: 15px;
    background: var(--gray-soft);
    color: var(--text);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: 800;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    transition: background 0.15s, transform 0.1s;
}

.btn-secondary:hover {
    background: var(--gray-mid);
}

.btn-secondary:active {
    transform: scale(0.97);
}

/* ============================================================
   RESULTS SCREEN
   ============================================================ */
.results-screen {
    align-items: center;
    padding: 36px 24px 32px;
    gap: 20px;
    text-align: center;
    overflow-y: auto;
}

.results-mascot {
    width: 130px;
    height: 130px;
    object-fit: contain;
    animation: pop-in 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.results-mascot-placeholder {
    width: 130px;
    height: 130px;
    background: var(--blue-light);
    border-radius: 50%;
    animation: pop-in 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes pop-in {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    60% {
        transform: scale(1.12);
    }

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

.results-title {
    font-size: var(--text-2xl);
    font-weight: 900;
    color: var(--text);
}

.results-subtitle {
    font-size: var(--text-base);
    color: var(--text-muted);
    font-weight: 600;
    margin-top: -12px;
}

.score-row {
    display: flex;
    gap: 12px;
    width: 100%;
}

.score-box {
    flex: 1;
    background: var(--gray-soft);
    border-radius: var(--radius-lg);
    padding: 14px 8px;
    text-align: center;
}

.score-num {
    display: block;
    font-size: var(--text-xl);
    font-weight: 900;
    color: var(--blue-primary);
}

.score-label {
    display: block;
    font-size: var(--text-xs);
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.xp-banner {
    width: 100%;
    background: var(--yellow);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.xp-amount {
    font-size: var(--text-3xl);
    font-weight: 900;
    color: var(--navy);
}

.xp-label {
    font-size: var(--text-sm);
    font-weight: 800;
    color: var(--navy-light);
    letter-spacing: 0.3px;
}

/* Waitlist section */
.waitlist-box {
    width: 100%;
    background: linear-gradient(135deg, var(--navy), #1A4F8A);
    border-radius: var(--radius-lg);
    padding: 22px 20px;
    text-align: center;
}

.waitlist-box h3 {
    font-size: var(--text-md);
    font-weight: 900;
    color: var(--white);
    margin-bottom: 6px;
}

.waitlist-box p {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 14px;
}

.email-input {
    width: 100%;
    padding: 13px 16px;
    border-radius: var(--radius-md);
    border: none;
    font-size: var(--text-base);
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    margin-bottom: 10px;
    outline: none;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
}

.email-input::placeholder {
    color: var(--text-muted);
}

.email-input:focus {
    outline: 2px solid var(--blue-primary);
    outline-offset: 2px;
}

/* ============================================================
   XP POP ANIMATION
   ============================================================ */
.xp-pop {
    position: fixed;
    pointer-events: none;
    font-size: var(--text-md);
    font-weight: 900;
    color: var(--yellow-dark);
    z-index: 9999;
    animation: xp-fly 0.9s ease-out forwards;
}

@keyframes xp-fly {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-56px) scale(1.25);
    }
}

/* ============================================================
   STREAK FLASH
   ============================================================ */
.streak-flash {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    background: var(--yellow);
    color: var(--navy);
    font-size: var(--text-xl);
    font-weight: 900;
    padding: 16px 28px;
    border-radius: var(--radius-pill);
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    animation: streak-pop 1.2s ease forwards;
}

@keyframes streak-pop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.05);
    }

    70% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-center {
    text-align: center;
}

.w-full {
    width: 100%;
}

.mt-auto {
    margin-top: auto;
}

.hidden {
    display: none !important;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.gap-16 {
    gap: 16px;
}

.gap-20 {
    gap: 20px;
}

.pad-body {
    padding: 8px 20px 24px;
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}