:root {
    --blue: #4A90E2;
    --green: #5CB85C;
    --yellow: #FFD93D;
    --orange: #FF914D;
    --ink: #243247;
    --muted: #6b7890;
    --paper: #ffffff;
    --soft: #f5f8ff;
    --line: #dfe8f5;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Nunito', 'Poppins', sans-serif;
    color: var(--ink);
    background: var(--soft);
    overflow-x: hidden;
}

body.dark-mode {
    --ink: #edf4ff;
    --muted: #bfd0e8;
    --paper: #172236;
    --soft: #0f1726;
    --line: #31435f;
}

main { padding-top: 78px; }

a { text-decoration: none; }

.app-navbar {
    background: rgba(255, 255, 255, 0.93);
    box-shadow: 0 10px 28px rgba(41, 65, 95, 0.12);
    backdrop-filter: blur(14px);
}

.dark-mode .app-navbar { background: rgba(19, 29, 47, 0.94); }

.navbar-brand {
    font-weight: 900;
    color: var(--blue);
    letter-spacing: 0;
}

.brand-mark, .auth-icon {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: var(--yellow);
    color: var(--ink);
}

.brand-mark img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.nav-link {
    font-weight: 800;
    color: var(--ink);
}

.nav-user-photo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-weight: 900;
}

.nav-user-photo img {
    width: 34px;
    height: 34px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--yellow);
}

.btn {
    border-radius: 8px;
    border: 0;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(36, 50, 71, 0.13);
}

.btn-primary { background: var(--blue); }
.btn-success { background: var(--green); }
.btn-warning { background: var(--yellow); color: #2c2d1d; }
.btn-danger { background: #f45b69; }

.icon-btn {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--blue);
}

.hero-section {
    min-height: calc(100vh - 78px);
    display: grid;
    align-items: center;
    padding: 64px 0 34px;
    background: linear-gradient(135deg, #243247 0%, #365f91 48%, #87ceeb 100%);
}

.hero-section h1, .page-hero h1 {
    font-size: clamp(2.35rem, 6vw, 5.4rem);
    line-height: 1.02;
    font-weight: 900;
    letter-spacing: 0;
    margin: 18px 0;
    color: #ffffff;
    text-shadow: 0 3px 14px rgba(21, 34, 54, 0.28);
}

.hero-copy {
    font-size: 1.25rem;
    color: #eef8ff;
    max-width: 650px;
    margin-bottom: 28px;
}


.hero-visual {
    position: relative;
    min-height: 420px;
    display: grid;
    place-items: center;
}

.hero-image {
    width: min(100%, 560px);
    border-radius: 8px;
    filter: drop-shadow(0 24px 30px rgba(36, 50, 71, 0.18));
}

.floating-badge {
    position: absolute;
    padding: 11px 14px;
    border-radius: 8px;
    background: var(--paper);
    box-shadow: 0 12px 28px rgba(36, 50, 71, 0.16);
    font-weight: 900;
    animation: floatY 4s ease-in-out infinite;
}

.badge-one { left: 3%; top: 18%; color: var(--orange); }
.badge-two { right: 2%; top: 34%; color: var(--blue); animation-delay: .8s; }
.badge-three { left: 18%; bottom: 10%; color: var(--green); animation-delay: 1.5s; }

@keyframes floatY {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-14px); }
}

.section-pad { padding: 78px 0; }

.section-heading {
    text-align: center;
    max-width: 760px;
    margin: 0 auto 34px;
}

.section-heading span {
    color: var(--orange);
    font-weight: 900;
}

.section-heading h2 {
    font-weight: 900;
    font-size: clamp(2rem, 4vw, 3.2rem);
    letter-spacing: 0;
}

.feature-card, .learning-card, .story-panel, .tool-panel, .auth-card, .question-card, .result-panel, .dashboard-panel, .stat-box {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 14px 35px rgba(36, 50, 71, 0.10);
}

.feature-card {
    min-height: 245px;
    padding: 26px;
}

.hover-lift { transition: transform .2s ease, box-shadow .2s ease; }
.hover-lift:hover, .learning-card:hover { transform: translateY(-7px) scale(1.01); box-shadow: 0 22px 40px rgba(36, 50, 71, .16); }

.feature-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    margin-bottom: 18px;
    color: white;
    font-size: 1.45rem;
    animation: bounceSoft 2.4s infinite;
}

.feature-icon.blue { background: var(--blue); }
.feature-icon.green { background: var(--green); }
.feature-icon.orange { background: var(--orange); }
.feature-icon.yellow { background: var(--yellow); color: var(--ink); }

@keyframes bounceSoft {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.feature-card h3, .learning-card h3, .story-panel h2, .question-card h2, .result-panel h2 {
    font-weight: 900;
    letter-spacing: 0;
}

.feature-card p, .learning-card p, .story-panel p, .auth-card p {
    color: var(--muted);
}

.learning-band {
    background: linear-gradient(180deg, transparent, rgba(255, 145, 77, 0.12));
}

.learning-card {
    min-height: 220px;
    display: block;
    padding: 28px;
    color: var(--ink);
    transition: .2s ease;
}

.learning-card i {
    font-size: 2.4rem;
    color: var(--blue);
    margin-bottom: 20px;
}

.page-hero {
    padding: 84px 0;
    background: linear-gradient(135deg, #243247 0%, #366aa4 52%, #87ceeb 100%);
}

.hero-section .eyebrow,
.page-hero .eyebrow {
    background: rgba(255, 255, 255, 0.16);
    color: #FFD93D;
    border: 1px solid rgba(255, 255, 255, 0.26);
}

.page-hero p {
    color: #eef8ff;
    font-size: 1.15rem;
    max-width: 760px;
}

.small-hero h1 { font-size: clamp(2.3rem, 5vw, 4.1rem); }

.story-panel { overflow: hidden; }
.story-panel iframe { border: 0; }

.song-panel .ratio {
    min-height: 100%;
}

.song-copy {
    min-height: 100%;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.song-label {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 217, 61, 0.28);
    color: var(--ink);
    font-weight: 900;
}

.lyrics-box {
    padding: 18px;
    border-radius: 8px;
    background: var(--soft);
    border: 1px solid var(--line);
}

.lyrics-box h3 {
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 0;
}

.lyrics-list {
    margin: 0;
    padding-left: 22px;
}

.lyrics-list li {
    color: var(--ink);
    font-weight: 800;
    line-height: 1.7;
    margin-bottom: 6px;
}

.tool-panel, .result-panel, .dashboard-panel { padding: 24px; }

.help-tabs .nav-link {
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    font-weight: 900;
}

.help-tabs .nav-link.active {
    background: var(--blue);
    color: white;
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.help-panel {
    min-height: 100%;
    padding: 24px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 14px 35px rgba(36, 50, 71, 0.10);
}

.help-panel h2 {
    margin: 12px 0 14px;
    font-size: 1.28rem;
    font-weight: 900;
    letter-spacing: 0;
}

.help-panel ol {
    margin: 0;
    padding-left: 20px;
}

.help-panel li {
    color: var(--muted);
    font-weight: 800;
    margin-bottom: 8px;
}

.help-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: white;
    font-size: 1.3rem;
}

.help-icon.blue { background: var(--blue); }
.help-icon.green { background: var(--green); }
.help-icon.orange { background: var(--orange); }
.help-icon.yellow { background: var(--yellow); color: #243247; }

.vocabulary-table-wrap {
    background: var(--paper);
    border-radius: 8px;
    border: 1px solid var(--line);
}

.vocabulary-table {
    margin: 0;
    color: var(--ink);
}

.vocabulary-table th {
    background: var(--blue);
    color: white;
    white-space: nowrap;
}

.category-pill, .footer-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(74, 144, 226, .12);
    color: var(--blue);
    font-weight: 900;
}

.favorite-word.active { color: var(--yellow); background: #2f3441; }

.pagination-wrap {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.page-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    border-radius: 8px;
    font-weight: 900;
}

.page-btn.active { background: var(--orange); color: white; }

.auth-section {
    min-height: calc(100vh - 78px);
    display: grid;
    place-items: center;
    padding: 60px 16px;
}

.auth-card {
    width: min(100%, 460px);
    padding: 30px;
}

.auth-icon {
    width: 66px;
    height: 66px;
    margin-bottom: 12px;
    font-size: 1.6rem;
}

.login-hint {
    background: rgba(255, 217, 61, .24);
    padding: 12px;
    border-radius: 8px;
    color: var(--ink);
}

.quiz-meta {
    position: sticky;
    top: 90px;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.quiz-meta > div, #quizTimer {
    padding: 14px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 900;
}

#quizTimer {
    color: white;
    background: var(--orange);
    text-align: center;
}

.question-card {
    padding: 26px;
    margin-bottom: 22px;
}

.question-number {
    display: inline-block;
    padding: 6px 10px;
    background: rgba(92, 184, 92, .16);
    color: var(--green);
    border-radius: 8px;
    font-weight: 900;
    margin-bottom: 12px;
}

.option-box {
    display: flex;
    gap: 12px;
    align-items: center;
    min-height: 58px;
    padding: 14px;
    border: 2px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    transition: .2s ease;
}

.option-box:hover { border-color: var(--blue); background: rgba(74, 144, 226, .08); }
.option-box input { width: 18px; height: 18px; }

.stat-box {
    padding: 16px;
}

.stat-box span {
    display: block;
    color: var(--muted);
    font-weight: 800;
}

.stat-box strong {
    display: block;
    font-size: 1.45rem;
    font-weight: 900;
}

.profile-picture {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    border: 8px solid var(--yellow);
    background: var(--paper);
}

.compact-profile {
    width: 96px;
    height: 96px;
    flex: 0 0 96px;
}

.profile-summary {
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-summary h2 {
    margin: 10px 0 4px;
    font-weight: 900;
    letter-spacing: 0;
}

.table-avatar {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--yellow);
    background: var(--paper);
}

.certificate-bg {
    background: linear-gradient(135deg, rgba(36, 50, 71, .14), rgba(135, 206, 235, .25));
}

.certificate {
    max-width: 1120px;
    margin: 0 auto;
    aspect-ratio: 3 / 2;
    padding: 10.5% 16% 8%;
    text-align: center;
    border-radius: 8px;
    background: var(--certificate-bg) center / cover no-repeat, var(--paper);
    box-shadow: 0 24px 55px rgba(36, 50, 71, .16);
    display: flex;
    align-items: center;
    justify-content: center;
}

.certificate-content {
    width: 100%;
    max-width: 660px;
    margin: 0 auto;
    color: #243247;
}

.certificate h1 {
    font-size: clamp(2.2rem, 5vw, 4rem);
    font-weight: 900;
    letter-spacing: 0;
    color: #243247;
    margin: 16px 0 12px;
}

.certificate h2 {
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 900;
    color: var(--blue);
    margin: 8px 0;
}

.certificate strong {
    display: block;
    font-size: 4rem;
    line-height: 1;
    color: var(--green);
}

.certificate p {
    color: #44546c;
    font-weight: 800;
    margin-bottom: 8px;
}

.certificate .eyebrow {
    background: rgba(255, 217, 61, .35);
    color: #8a5b00;
    border: 1px solid rgba(220, 160, 46, .35);
}

.place-center { place-items: center; }

.rank-badge {
    display: inline-grid;
    place-items: center;
    min-width: 96px;
    height: 76px;
    padding: 0 18px;
    border-radius: 8px;
    background: var(--yellow);
    color: #243247;
    font-size: 2rem;
    font-weight: 900;
    box-shadow: 0 14px 28px rgba(36, 50, 71, .14);
}

.table-active {
    --bs-table-bg-state: rgba(255, 217, 61, .24);
}

@media print {
    .app-navbar, .site-footer, .back-to-top, .btn, #loader { display: none !important; }
    main { padding-top: 0; }
    body { background: white; }
    .section-pad { padding: 0; }
    .certificate { box-shadow: none; }
    .certificate-bg { background: white; }
}

.site-footer {
    padding: 38px 0;
    color: white;
    background: #243247;
}

.site-footer h5 { font-weight: 900; }
.site-footer p { color: #d8e5f6; }
.footer-pill { background: rgba(255,255,255,.12); color: white; margin-left: 8px; margin-top: 8px; }

.back-to-top {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 8px;
    background: var(--orange);
    color: white;
    opacity: 0;
    pointer-events: none;
    transition: .2s ease;
}

.back-to-top.show { opacity: 1; pointer-events: auto; }

#loader {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
    background: var(--soft);
    transition: opacity .25s ease, visibility .25s ease;
}

#loader.hidden { opacity: 0; visibility: hidden; }

.loader-cloud {
    width: 112px;
    height: 112px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--yellow);
    color: var(--ink);
    font-weight: 900;
    animation: bounceSoft 1.1s infinite;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--line);
    min-height: 46px;
    background: var(--paper);
    color: var(--ink);
}

.table { --bs-table-bg: var(--paper); --bs-table-color: var(--ink); --bs-table-border-color: var(--line); }

@media (max-width: 991px) {
    .hero-section { min-height: auto; }
    .hero-visual { min-height: 340px; }
    .quiz-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .help-grid { grid-template-columns: 1fr; }
}

@media (max-width: 576px) {
    main { padding-top: 70px; }
    .hero-section { padding-top: 44px; }
    .section-pad { padding: 54px 0; }
    .hero-visual { min-height: 280px; }
    .floating-badge { position: static; margin: 8px; display: inline-flex; }
    .hero-visual { display: block; text-align: center; }
    .quiz-meta { position: static; grid-template-columns: 1fr; }
    .auth-card, .question-card, .result-panel, .dashboard-panel { padding: 20px; }
    .profile-summary {
        align-items: flex-start;
        flex-direction: column;
    }
    .certificate {
        padding: 8% 15% 7%;
    }
    .certificate .eyebrow {
        padding: 4px 7px;
        font-size: .58rem;
    }
    .certificate h1 {
        font-size: 1.12rem;
        margin: 6px 0 4px;
    }
    .certificate h2 {
        font-size: 1.18rem;
        margin: 2px 0;
    }
    .certificate strong {
        font-size: 1.8rem;
    }
    .certificate p {
        font-size: .62rem;
        line-height: 1.15;
        margin-bottom: 3px;
    }
}
