* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --accent1: #ff6b6b;
    --accent2: #4ecdc4;
    --accent3: #ffd93d;
    --dark: #2c3e50;
    --light: #f8f9fa;
}

html {
    /* prevent unexpected font-size scaling on mobile browsers */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    /* Mobile-first compact defaults */
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 'Noto Sans', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
    color: var(--dark);
    line-height: 1.5;
    min-height: 100vh;
    font-size: 15px; /* compact base */
    /* Khoảng cách đệm cho Header cố định */
    padding-top: 64px;
    /* Better tap targets on mobile */
    -webkit-tap-highlight-color: rgba(99, 102, 241, 0.2);
    touch-action: manipulation;
}

@media (max-width: 768px) {
    body {
        padding-top: 60px;
    }
}

body.no-scroll {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

body.no-scroll::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    animation: fadeIn 0.3s ease;
}

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

/* Header Styles */
.site-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95), rgba(118, 75, 162, 0.95));
    backdrop-filter: blur(12px);
    padding: 0.75rem 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1100;
    box-shadow: 0 12px 30px rgba(30, 41, 59, 0.18);
    transition: background 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
}

@media (max-width: 768px) {
    .site-header {
        padding: 0.6rem 0;
    }
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-brand {
    flex-shrink: 0;
}

.logo-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: white;
}

.logo-badge {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-size: 1.5rem;
    background: rgba(255,255,255,0.25);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
    animation: float 3s ease-in-out infinite;
}

.logo-emoji {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    font-size: 2rem;
    background: rgba(255,255,255,0.22);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.15),
        inset 0 0 0 2px rgba(255,255,255,0.3);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.logo-emoji:hover {
    transform: scale(1.1) rotate(5deg);
    background: rgba(255,255,255,0.28);
}

.logo-text {
    font-family: 'Fredoka One', cursive;
    font-size: 1.25rem;
    letter-spacing: 0.02em;
    color: white;
    text-shadow: 0 4px 12px rgba(15, 23, 42, 0.3);
    transition: color 0.3s ease;
}

.logo-link:hover .logo-text {
    color: rgba(255, 255, 255, 0.95);
}

/* Keep the checkbox visually hidden but focusable and toggleable via label/JS fallback.
   Avoid the `display:none`/hidden behavior which can interfere with some browsers. */
#nav-toggle {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

@media (max-width: 768px) {
    .logo-emoji {
        width: 40px;
        height: 40px;
        font-size: 1.6rem;
    }
    
    .logo-text {
        font-size: 1.05rem;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.icon-button {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: #f8fafc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.icon-button:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,0.28);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.22);
}

.icon-button:active {
    transform: translateY(0);
}

.icon-dark {
    display: none;
}

html.dark .icon-light {
    display: none;
}
html.dark .icon-dark {
    display: inline;
}

.nav-toggle {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255,255,255,0.22);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative;
    z-index: 1150;
}

.nav-toggle:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.nav-toggle:active {
    transform: scale(0.95);
}

.nav-toggle span {
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 999px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: block;
}

#nav-toggle:checked + .header-actions .nav-toggle {
    background: rgba(255,255,255,0.35);
}

#nav-toggle:checked + .header-actions .nav-toggle span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

#nav-toggle:checked + .header-actions .nav-toggle span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

#nav-toggle:checked + .header-actions .nav-toggle span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

.main-navigation {
    flex: 1;
}

.nav-level-1 {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    list-style: none;
}

.nav-item {
    position: relative;
}

.nav-link,
.nav-item > a,
.dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.98rem;
    color: white;
    background: transparent;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, transform 0.2s ease;
}

.nav-link:hover,
.dropdown-toggle:hover,
.nav-item > a:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.dropdown-icon {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.has-dropdown.submenu-open .dropdown-icon {
    transform: rotate(-180deg);
}

.dropdown-panel {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) scale(0.98);
    transform-origin: top center;
    background: white;
    color: var(--dark);
    border-radius: 18px;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.22);
    padding: 1.5rem;
    min-width: 280px;
    display: none;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    z-index: 1200;
}

.dropdown-panel.active {
    display: grid;
    transform: translateX(-50%) scale(1);
    animation: fadeIn 0.18s ease-out;
}

.dropdown-panel .dropdown-section {
    min-width: 200px;
}

.dropdown-section.accent {
    background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(236,72,153,0.08));
    border-radius: 16px;
    padding: 1.1rem;
}

.dropdown-title {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #334155;
    margin-bottom: 0.6rem;
}

.dropdown-list {
    list-style: none;
    display: grid;
    gap: 0.55rem;
}

.dropdown-list a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #1e293b;
    text-decoration: none;
    font-weight: 500;
    border-radius: 12px;
    padding: 0.55rem 0.75rem;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.dropdown-list a:hover {
    background: rgba(99,102,241,0.08);
    color: #4338ca;
    transform: translateX(4px);
}

.nav-cta-group {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 14px;
    padding: 0.6rem 1.1rem;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
    background: linear-gradient(120deg, #f97316, #ec4899);
    color: white;
    box-shadow: 0 18px 35px rgba(236, 72, 153, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 40px rgba(236, 72, 153, 0.45);
}

.btn-outline {
    background: rgba(255,255,255,0.18);
    color: white;
    border: 1px solid rgba(255,255,255,0.45);
}

.btn-outline:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.25);
}

@media (max-width: 1024px) {
    .header-container {
        padding: 0 1.25rem;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    .logo-img {
        width: 36px;
        height: 36px;
    }

    .main-navigation {
        position: fixed;
        inset: 0;
        background: linear-gradient(135deg, rgba(15, 23, 42, 0.97), rgba(30, 41, 59, 0.97));
        backdrop-filter: blur(20px);
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        padding-top: 90px;
        overflow-y: auto;
        z-index: 1140; /* above header backdrop but below nav-toggle (1150) */
        -webkit-overflow-scrolling: touch;
    }

    #nav-toggle:checked ~ .main-navigation {
        transform: translateX(0);
    }

    .main-navigation.is-open {
        transform: translateX(0);
    }

    .nav-level-1 {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 1rem 1.5rem 3rem;
        max-width: 500px;
        margin: 0 auto;
    }

    .nav-item {
        width: 100%;
    }

    .dropdown-toggle,
    .nav-link,
    .nav-item > a {
        width: 100%;
        justify-content: space-between;
        padding: 1rem 1.25rem;
        border-radius: 14px;
        background: rgba(255,255,255,0.1);
        font-size: 1.05rem;
        transition: all 0.2s ease;
    }

    .dropdown-toggle:hover,
    .nav-link:hover,
    .nav-item > a:hover {
        background: rgba(255,255,255,0.18);
        transform: translateX(4px);
    }

    .dropdown-panel {
        position: static;
        transform: none;
        background: rgba(30, 41, 59, 0.6);
        color: white;
        box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
        margin-top: 0.5rem;
        padding: 0;
        border-radius: 12px;
        border-left: 3px solid var(--accent2);
        max-height: 0;
        overflow: hidden;
        transition: all 0.3s ease, padding 0.3s ease;
    }

    .dropdown-panel.active {
        padding: 1rem;
        max-height: 800px;
    }

    .dropdown-panel .dropdown-title {
        color: rgba(226, 232, 240, 0.95);
        font-size: 0.8rem;
        margin-bottom: 0.75rem;
    }

    .dropdown-section {
        margin-bottom: 1rem;
    }

    .dropdown-section:last-child {
        margin-bottom: 0;
    }

    .dropdown-section.accent {
        background: rgba(99, 102, 241, 0.15);
        padding: 1rem;
        border-radius: 10px;
    }

    .dropdown-list {
        gap: 0.4rem;
    }

    .dropdown-list a {
        color: white;
        background: rgba(255,255,255,0.08);
        font-size: 0.95rem;
        padding: 0.85rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .dropdown-list a:hover,
    .dropdown-list a:active {
        background: rgba(129,140,248,0.3);
        color: white;
        transform: translateX(6px);
    }

    .nav-cta-group {
        width: 100%;
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(255,255,255,0.1);
    }

    .nav-cta-group .btn {
        width: 100%;
        justify-content: center;
        padding: 0.85rem 1.5rem;
        font-size: 1.05rem;
    }
}

@media (min-width: 1025px) {
    #nav-toggle,
    .nav-toggle {
        display: none;
    }

    .header-actions {
        margin-left: 1.5rem;
    }

    .main-navigation {
        display: block;
        position: static;
        transform: none;
        background: transparent;
        backdrop-filter: none;
        padding-top: 0;
    }

    .dropdown-toggle,
    .nav-link {
        font-size: 0.98rem;
    }
}


/* Hero Banner */
.hero-banner {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 6rem 2rem;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="30" r="3" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="70" r="2.5" fill="rgba(255,255,255,0.1)"/><circle cx="90" cy="80" r="1.5" fill="rgba(255,255,255,0.1)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.hero-title {
    font-family: 'Fredoka One', cursive;
    font-size: 4rem;
    margin-bottom: 1.5rem;
    text-shadow: 0 4px 15px rgba(0,0,0,0.3);
    background: linear-gradient(45deg, #ffd93d, #ff6b6b, #4ecdc4, #ffd93d);
    background-size: 300% 300%;
    /* standard and vendor-prefixed background-clip for text gradients */
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 4s ease infinite;
}

.hero-subtitle {
    font-size: 1.4rem;
    margin-bottom: 2rem;
    opacity: 0.9;
    font-weight: 300;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.8;
}

.partial-error {
    padding: 1.5rem;
    text-align: center;
    color: #ef4444;
    font-weight: 600;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--dark);
    font-weight: 700;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(45deg, var(--accent1), var(--accent2));
    border-radius: 2px;
}

/* Emotions Grid */
.emotions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.emotion-card {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.emotion-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    border-color: var(--accent2);
}

.emotion-icon-container {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color1), var(--color2));
    border-radius: 50%;
    font-size: 2.5rem;
    color: white;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.emotion-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--dark);
}

.emotion-description {
    color: #666;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.fun-fact {
    background: linear-gradient(45deg, var(--color1), var(--color2));
    color: white;
    padding: 0.75rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Individual emotion colors */
.happy { --color1: #ffd93d; --color2: #ff6b6b; }
.sad { --color1: #4169e1; --color2: #1e90ff; }
.angry { --color1: #ff4500; --color2: #ff6347; }
.excited { --color1: #ff69b4; --color2: #ff1493; }
.confused { --color1: #9370db; --color2: #8a2be2; }
.peaceful { --color1: #32cd32; --color2: #228b22; }
.nervous { --color1: #ffa500; --color2: #ff8c00; }
.loved { --color1: #ff1493; --color2: #dc143c; }

/* Facts Section */
.facts-section {
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    padding: 4rem 2rem;
    margin: 4rem 0;
    border-radius: 30px;
}

.facts-container {
    max-width: 1200px;
    margin: 0 auto;
}

.facts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.fact-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.fact-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.fact-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.fact-text {
    color: #666;
    font-size: 0.95rem;
}

/* Subpage Content */
.subpage-content {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.subpage-content.active {
    display: block;
}

.subpage-header {
    text-align: center;
    margin-bottom: 3rem;
}

.subpage-title {
    font-size: 3rem;
    color: var(--dark);
    margin-bottom: 1rem;
}

.subpage-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.subpage-description {
    font-size: 1.2rem;
    color: #666;
    max-width: 800px;
    margin: 0 auto 2rem;
    text-align: center;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.content-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.content-card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.content-card p {
    color: #666;
    line-height: 1.7;
}

/* About Page */
.about-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.about-image {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: white;
}

/* Contact Page */
.contact-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.submit-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
}

/* Footer */
footer {
    background: linear-gradient(135deg, var(--dark), #1a2530);
    color: white;
    padding: 4rem 2rem 2rem;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    /* Dùng Grid với hàm repeat và minmax để tự động chuyển bố cục */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 3rem;
}

.footer-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--accent2);
    border-radius: 2px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-links a {
    color: #b0b0b0;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-link:hover {
    background: var(--accent2);
    transform: translateY(-3px);
}

.copyright {
    text-align: center;
    padding-top: 3rem;
    margin-top: 3rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #888;
    font-size: 0.9rem;
}

/* Animations */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

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

/* Responsive Design - TABLET */
@media (max-width: 768px) {
    .header-container {
        padding: 0 1rem;
    }
    
    body {
        /* Khoảng cách đệm cho mobile */
        padding-top: 90px; 
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .hero-stats {
        gap: 1.5rem;
        flex-wrap: wrap;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .subpage-title {
        font-size: 2.2rem;
    }

    /* Footer: 2 cột trên Tablet */
    .footer-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem 1rem; 
    }
    .footer-section h3 {
        font-size: 1.3rem; 
    }
}

@media (max-width: 480px) {
    .hero-banner {
        padding: 4rem 1rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 2rem 1rem;
    }
    
    .facts-section {
        padding: 2rem 1rem;
    }
    
    /* Nav: 2 cột trên Mobile (giữ nguyên) */
    nav ul {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }

    nav a {
        font-size: 0.88rem;
        padding: 0.35rem 0.5rem;
    }

    .logo-text { font-size: 1.2rem; }
    .logo-icon { font-size: 1.6rem; }
    .logo-img { width: 48px; height: 48px; }

    /* Footer: 1 cột trên Mobile */
    .footer-container {
        grid-template-columns: 1fr;
        gap: 2rem; 
    }
    .footer-section {
        padding-bottom: 1.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1); 
    }
    .footer-section:last-child {
        border-bottom: none; 
    }
}

/* Hamburger toggle (mobile) - MOBILE FIRST */
.nav-toggle {
    display: none; /* Ẩn mặc định trên desktop */
    width: 36px;
    height: 28px;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    position: relative;
    z-index: 1001;
}
.nav-toggle span {
    display: block;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Animation cho hamburger khi mở */
#nav-toggle:checked + .nav-toggle span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}
#nav-toggle:checked + .nav-toggle span:nth-child(2) {
    opacity: 0;
}
#nav-toggle:checked + .nav-toggle span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

/* MOBILE FIRST: Responsive cho màn hình nhỏ */
@media (max-width: 768px) {
    .nav-toggle { 
        display: flex; /* Hiện hamburger trên mobile */
    }
    
    nav { 
        width: 100%; 
    }
    
    nav ul { 
        display: none; /* Ẩn menu mặc định */
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.98), rgba(118, 75, 162, 0.98));
        backdrop-filter: blur(10px);
        padding: 1rem;
        margin: 0;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
        max-height: calc(100vh - 90px); /* Điều chỉnh chiều cao tối đa */
        overflow-y: auto;
        flex-direction: column; /* Chuyển thành cột */
        gap: 0.5rem;
    }
    
    /* Khi checkbox được check, hiển thị menu */
    #nav-toggle:checked + .nav-toggle + nav ul {
        display: flex; /* Dùng flex thay grid */
        animation: slideDown 0.3s ease-out;
    }
    
    nav a {
        font-size: 1rem;
        padding: 0.8rem 1rem;
        text-align: left; /* Căn lề trái cho dễ đọc */
        display: flex;
        justify-content: space-between; /* Đẩy icon chevron qua phải */
        border-radius: 8px;
        background: rgba(255,255,255,0.1);
        transition: all 0.2s;
    }
    
    nav a:hover {
        background: rgba(255,255,255,0.25);
    }

    /* === DROPDOWN MENU STYLES (Mobile) === */
    .has-dropdown > a .dropdown-icon {
        transition: transform 0.3s ease;
    }
    .has-dropdown.submenu-open > a .dropdown-icon {
        transform: rotate(180deg);
    }

    .dropdown-menu {
        display: none; /* Ẩn mặc định */
        position: static; /* Bỏ position absolute */
        background: rgba(0,0,0,0.15);
        border-radius: 8px;
        padding: 0.5rem;
        box-shadow: none;
        min-width: unset;
        animation: none;
        margin-top: 0.5rem;
    }

    .has-dropdown.submenu-open .dropdown-menu {
        display: block; /* Hiện khi có class */
    }

    .dropdown-menu li {
        margin-bottom: 0.25rem;
    }
    .dropdown-menu a {
        font-size: 0.9rem;
        font-weight: 400;
        color: #f0f0f0;
        background: transparent;
        padding: 0.6rem 1rem;
    }
     .dropdown-menu a:hover {
        background: rgba(255,255,255,0.1);
        color: white;
    }
}

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

/* ========== GLOBAL MOBILE TYPOGRAPHY OVERRIDES (Compact) ==========
   Applies to all pages to keep text and UI elements compact on small screens */
@media (max-width: 768px) {
    /* slightly reduce base font so headings don't dominate */
    html, body {
        font-size: 15px; /* compact base */
    }

    /* headings scale down */
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.05rem; }
    h4 { font-size: 0.95rem; }

    /* navigation and header compact */
    header { padding: 0.6rem 0; }
    .header-container { padding: 0 1rem; }
    nav a { font-size: 0.92rem; padding: 0.45rem 0.8rem; }

    /* reduce large logo & images */
    .logo-img { width: 48px; height: 48px; }
    .logo-text { font-size: 1.15rem; }

    /* hero-specific adjustments (if any pages still use hero-banner) */
    .hero-banner { padding: 3rem 1rem; }
    .hero-banner .hero-title, .hero-main-title { font-size: 1.6rem; }

    /* cards and content spacing */
    .feature-card, .post-card, .stat-item {
        padding: 1rem 0.9rem;
    }

    /* forms / inputs */
    input, textarea, button { font-size: 0.95rem; }

    /* Compact 3-column quick-stats on mobile */
    .quick-stats {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.6rem;
        padding: 0 0.6rem;
        align-items: stretch;
    }

    .quick-stats .stat-item {
        padding: 0.75rem;
        min-height: 84px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .stat-number { font-size: 1.2rem; font-weight: 800; color: var(--primary); }
}

@media (max-width: 420px) {
    /* even more compact for small phones */
    html, body { font-size: 14px; }

    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.1rem; }
    h3 { font-size: 0.98rem; }

    nav a { font-size: 0.88rem; padding: 0.35rem 0.6rem; }
    .logo-img { width: 40px; height: 40px; }
    .logo-text { font-size: 1rem; }

    .feature-card, .post-card { padding: 0.8rem; }
    .feature-icon { width: 64px; height: 64px; }
    .hero-main-title, .hero-banner .hero-title { font-size: 1.2rem; }
}

/* ========== DESKTOP (Upgrade from mobile) ==========
   Restore larger sizes for wider viewports (mobile-first approach) */
@media (min-width: 769px) {
    body { font-size: 16px; line-height: 1.6; padding-top: 80px; }
    header { padding: 1rem 0; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
    .header-container { padding: 0 2rem; }
    .logo-img { width: 72px; height: 72px; }
    .logo-text { font-size: 1.8rem; }
    nav a { font-size: 1rem; padding: 0.5rem 1rem; }
    .hero-banner { padding: 6rem 2rem; }
    .hero-title { font-size: 4rem; }
    .feature-cards-container { max-width: 900px; gap: 1.5rem; }
    .feature-card { padding: 2rem 1.5rem; border-radius: 16px; }
    .stat-number { font-size: 2.5rem; }
}

/* === BỔ SUNG CHO LOGO MỚI Ở HERO SECTION (index.html) === */
/* Các style này có thể đã tồn tại trong file index.html, 
việc thêm vào đây để đảm bảo chúng được áp dụng hoặc ghi đè nếu cần. */

.brand-logo-circle {
    width: 80px;
    height: 80px;
}

.hero-logo-img {
    width: 100%;
    height: 100%;
    padding: 8px; /* Thêm chút đệm để logo không bị sát viền */
    object-fit: contain;
    border-radius: 50%;
}

