:root {
    --text-light: #64748b;
    --color-completed: #16648C;
    --color-active: #0d9488;
    --color-locked: #94a3b8;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    font-family: 'Inter', 'Poppins', sans-serif;
    background: var(--bg-primary, #f8fafc);
    color: var(--text-primary, #0f172a);
    -webkit-tap-highlight-color: transparent;
}

/* ==========================================================================
   TOAST NOTIFICATION (Corrige tanto .toast quanto .custom-toast!)
   ========================================================================== */
.toast, .custom-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(24px);
    background: #0f172a;
    color: #ffffff;
    padding: 12px 22px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.92rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(20, 184, 166, 0.4);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 10005;
    max-width: 92vw;
}

.toast.show, .custom-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   DEDICATÓRIA ACADÊMICA RETRÁTIL (NÃO POLUI A TELA)
   ========================================================================== */
.dedication-accordion {
    background: var(--bg-secondary, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-left: 4px solid #0d9488;
    border-radius: 14px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
    overflow: hidden;
}

.dedication-summary {
    list-style: none;
    padding: 0.95rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.dedication-summary::-webkit-details-marker { display: none; }

.dedication-summary-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.dedication-icon {
    font-size: 1.65rem;
    color: #0d9488;
    background: rgba(13, 148, 136, 0.1);
    padding: 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

.dedication-summary-left strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.dedication-summary-left span {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary, #64748b);
}

.dedication-toggle-pill {
    font-size: 0.78rem;
    font-weight: 700;
    color: #0d9488;
    background: rgba(13, 148, 136, 0.1);
    padding: 5px 12px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.dedication-expanded-body {
    padding: 0 1.25rem 1.15rem;
}

.dedication-quote {
    font-size: 0.92rem;
    font-style: italic;
    color: var(--text-secondary, #64748b);
    line-height: 1.6;
    border-top: 1px dashed var(--border-color, #e2e8f0);
    padding-top: 0.85rem;
}

.dedication-quote footer {
    margin-top: 0.5rem;
    font-style: normal;
    font-weight: 700;
    color: #0d9488;
    text-align: right;
    font-size: 0.84rem;
}

/* ==========================================================================
   LAYOUT SKILL TREE & PAINEL DO ESTUDANTE (100% RESPONSIVO SEM ENCOLHER NO MOBILE)
   ========================================================================== */
.instituto-koine-layout {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 1.8rem 1.25rem 4rem;
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

.trilha-sidebar, .trilha-main-area {
    min-width: 0;
    max-width: 100%;
}

.trilha-sidebar {
    position: sticky;
    top: 85px;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.student-card {
    background: var(--bg-secondary, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-top: 4px solid #0d9488;
    border-radius: 16px;
    padding: 1.35rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.student-card-top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 1rem;
}

.student-avatar {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: 2px solid #0d9488;
    object-fit: cover;
    background: rgba(13, 148, 136, 0.1);
    flex-shrink: 0;
}

.student-rank {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #0d9488;
}

.student-meta h2 {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 1.5rem;
    margin: 2px 0 0;
    color: var(--text-primary);
    line-height: 1.2;
}

.xp-streak-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 1rem;
}

.stat-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 8px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    background: rgba(13, 148, 136, 0.1);
    color: #0d9488;
}

.stat-pill.streak {
    background: rgba(245, 158, 11, 0.14);
    color: #d97706;
}

.progress-bar-track {
    width: 100%;
    height: 9px;
    background: rgba(148, 163, 184, 0.25);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0d9488, #10b981);
    width: 0%;
    transition: width 0.5s ease;
}

.badges-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1.15rem;
}

.tier-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.tier-badge.unlocked {
    background: #D4AF37;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.45);
}

.btn-instituto {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.btn-instituto.primary {
    background: #0d9488;
    color: #ffffff;
}
.btn-instituto.primary:hover { background: #0f766e; }

.btn-instituto.outline {
    background: transparent;
    border-color: var(--border-color, #cbd5e1);
    color: var(--text-primary);
}
.btn-instituto.outline:hover {
    border-color: #0d9488;
    color: #0d9488;
}

.tiers-filter-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.tier-filter-btn {
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.92rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.tier-filter-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.tier-filter-btn.active {
    background: rgba(13, 148, 136, 0.12);
    color: #0d9488;
    border-color: #0d9488;
}

.tier-section { margin-bottom: 2.2rem; }

.tier-heading {
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--tier-color, #0d9488);
    border-bottom: 2px solid var(--tier-color, #0d9488);
    padding-bottom: 8px;
    margin-bottom: 1.15rem;
}

.skill-nodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
    gap: 1.1rem;
}

.skill-node {
    background: var(--bg-secondary, #ffffff);
    border: 2px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    padding: 1.3rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: all 0.25s ease;
    position: relative;
}

.skill-node.active {
    border-color: var(--node-color, #0d9488);
    box-shadow: 0 8px 22px rgba(13, 148, 136, 0.15);
}

.skill-node.completed { border-color: #D4AF37; }
.skill-node.locked { border-style: dashed; opacity: 0.68; }

.skill-node:not(.locked):hover {
    transform: translateY(-3px);
    border-color: var(--node-color, #0d9488);
}

.skill-node-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.skill-badge {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(13, 148, 136, 0.1);
    color: var(--node-color, #0d9488);
}

.skill-title {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 1.42rem;
    margin: 0 0 0.45rem;
    color: var(--text-primary);
    line-height: 1.25;
}

.skill-desc {
    font-size: 0.94rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 1rem;
    flex: 1;
}

.skill-footer {
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-color, #e2e8f0);
    font-size: 0.82rem;
    font-weight: 700;
}
.tag-xp.completed { color: #D4AF37; }
.tag-xp.active { color: #0d9488; }
.tag-xp.locked { color: #94a3b8; }

.instituto-modal {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 16px;
    padding: 0;
    max-width: 720px;
    width: 94vw;
    margin: auto;
    background: var(--bg-secondary, #ffffff);
    color: var(--text-primary);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35);
}
.instituto-modal::backdrop { background: rgba(15, 23, 42, 0.65); backdrop-filter: blur(3px); }
.modal-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}
.modal-close-x { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: inherit; }
.modal-body-content { padding: 1.25rem; }

/* RESPONSIVIDADE MOBILE (Escala 1:1 Nativa, Sem Elementos Minúsculos!) */
@media (max-width: 920px) {
    .instituto-koine-layout {
        grid-template-columns: minmax(0, 1fr);
        padding: 1rem 0.9rem 3.5rem;
        gap: 1.15rem;
    }
    .trilha-sidebar {
        position: static;
        width: 100%;
    }
    .tiers-filter-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
        white-space: nowrap;
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }
    .tier-filter-btn {
        flex-shrink: 0;
        padding: 10px 14px;
        font-size: 0.9rem;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color, #e2e8f0);
    }
    .skill-nodes-grid {
        grid-template-columns: 1fr;
    }
    .dedication-summary {
        flex-wrap: wrap;
    }
}

/* ==========================================================================
   CORREÇÃO DO CUSTOM TOAST (ITEM 9) — OCULTO POR PADRÃO E ANIMADO NO .show
   ========================================================================== */
#customToast,
.custom-toast {
    position: fixed !important;
    bottom: 24px !important;
    left: 50% !important;
    transform: translate(-50%, 140%) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    background: #0f172a !important;
    color: #f8fafc !important;
    padding: 12px 22px !important;
    border-radius: 30px !important;
    border: 1px solid #14b8a6 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    font-size: 0.92rem !important;
    font-weight: 600 !important;
    z-index: 10050 !important;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease, visibility 0.35s !important;
    max-width: calc(100vw - 32px) !important;
}

#customToast.show,
.custom-toast.show {
    transform: translate(-50%, 0) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#customToast #toastIcon {
    color: #14b8a6;
    font-size: 1.25rem;
}

/* ==========================================================================
   RODAPÉ DE AULA MODERNO (ITEM 4) & BOTÃO DE VOCABULÁRIO INLINE (ITEM 5)
   ========================================================================== */
.lesson-footer-modern {
    margin-top: 3.5rem;
    padding-top: 2rem;
    border-top: 2px dashed var(--border-color, #e2e8f0);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.btn-complete-modern {
    width: 100%;
    padding: 16px 24px;
    border-radius: 14px;
    border: 2px solid #0d9488;
    background: var(--bg-secondary, #ffffff);
    color: #0d9488;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px rgba(13, 148, 136, 0.1);
}

.btn-complete-modern:hover {
    background: rgba(13, 148, 136, 0.08);
    transform: translateY(-2px);
}

.btn-complete-modern.completed {
    background: linear-gradient(135deg, #0d9488, #0f766e);
    border-color: #0d9488;
    color: #ffffff;
    box-shadow: 0 8px 25px rgba(13, 148, 136, 0.28);
}

.lesson-nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.btn-lesson-step {
    padding: 12px 18px;
    border-radius: 10px;
    border: 1px solid var(--border-color, #cbd5e1);
    background: var(--bg-secondary, #ffffff);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    transition: all 0.2s;
}

.btn-lesson-step.primary-step {
    background: rgba(13, 148, 136, 0.12);
    color: #0d9488;
    border-color: #0d9488;
}

.btn-save-vocab-inline {
    padding: 12px 18px;
    border-radius: 10px;
    border: none;
    background: #0d9488;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-save-vocab-inline.saved {
    background: #10b981;
}

.vocab-quick-links {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.btn-quick-link {
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(13, 148, 136, 0.12);
    color: #0d9488;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
}

/* ==========================================================================
   CORREÇÃO DE ESCALA E TAMANHO DE FONTE NO MOBILE (ITEM 10)
   Impede que tabelas largas encolham a tela e garante leitura confortável!
   ========================================================================== */
html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    -webkit-text-size-adjust: 100% !important;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1.2rem 0;
}

@media (max-width: 768px) {
    #moduleTitle {
        font-size: 1.75rem !important;
        line-height: 1.25 !important;
    }
    #moduleContent p,
    #moduleContent li,
    .lesson-paragraph {
        font-size: 1.12rem !important;
        line-height: 1.75 !important;
    }
    #moduleContent .grk {
        font-size: 1.22rem !important;
    }
    .skill-nodes-grid {
        grid-template-columns: 1fr !important;
    }
    .skill-node {
        padding: 1.35rem !important;
    }
    .skill-title {
        font-size: 1.45rem !important;
    }
    .skill-desc {
        font-size: 0.98rem !important;
    }
    .vocab-cards-grid {
        grid-template-columns: 1fr !important;
    }
    .lesson-nav-buttons {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
}