/* ==========================================================================
   Moban 8-10-31 — App Shell Mobile-First Theme
   Royal blue #283593 + amber yellow #FFC400, light bg #E8EAF6
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Paytone+One&family=Be+Vietnam+Pro:wght@400;500;600;700;800&display=swap');

html, body { overflow-x: hidden; }

:root {
    --blue: #283593;
    --blue-deep: #1a2470;
    --blue-soft: #3949ab;
    --yellow: #FFC400;
    --yellow-deep: #f5a800;
    --bg: #E8EAF6;
    --card: #ffffff;
    --ink: #1a1f3d;
    --ink-soft: #5a6189;
    --line: rgba(40, 53, 147, 0.12);
    --radius: 24px;
    --radius-sm: 16px;
    --shadow: 0 10px 30px rgba(26, 36, 112, 0.14);
    --shadow-soft: 0 4px 16px rgba(26, 36, 112, 0.08);
    --font-display: 'Paytone One', 'Be Vietnam Pro', sans-serif;
    --font-body: 'Be Vietnam Pro', sans-serif;
}

/* ------------------------------- Dark mode ------------------------------ */
body.dark-mode {
    --bg: #0c1130;
    --card: #171d4a;
    --ink: #f0f2ff;
    --ink-soft: #9aa3d6;
    --line: rgba(255, 255, 255, 0.1);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.3);
}
body.dark-mode { background: var(--bg); }
body.dark-mode .logo-img { filter: brightness(1.15); }

/* ------------------------------- Base ------------------------------------ */
body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    padding-bottom: 80px; /* chống nội dung bị thanh tab dưới che */
    transition: background 0.35s ease, color 0.35s ease;
}
img { max-width: 100%; }
a { color: var(--blue); }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; line-height: 1.25; color: var(--ink); }

.app-shell {
    max-width: 920px;
    margin: 0 auto;
    padding: 16px 16px 8px;
    min-width: 0;
}
.app-main { min-width: 0; }
.app-section { margin-bottom: 28px; min-width: 0; }

/* ------------------------------- Topbar ---------------------------------- */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 90;
    background: var(--blue);
    border-radius: 0 0 24px 24px;
    box-shadow: 0 6px 24px rgba(26, 36, 112, 0.35);
}
.topbar-inner {
    max-width: 920px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}
.topbar-logo { min-width: 0; }
.logo-img { max-height: 40px; width: auto; display: block; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.theme-toggle, .avatar-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}
.theme-toggle:hover, .avatar-btn:hover { transform: scale(1.08); background: rgba(255, 255, 255, 0.28); }
.avatar-btn { background: var(--yellow); box-shadow: 0 4px 12px rgba(0,0,0,0.25); }
.topbar-cta {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 999px;
    background: var(--yellow);
    color: var(--blue-deep);
    font-weight: 800;
    font-size: 14px;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(255, 196, 0, 0.45);
    transition: transform 0.2s ease;
}
.topbar-cta:hover { transform: translateY(-2px); }

/* ------------------------------- Buttons --------------------------------- */
.btn-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 13px 26px;
    border-radius: 999px;
    font-family: var(--font-body);
    font-weight: 800;
    font-size: 15px;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-pill-solid {
    background: linear-gradient(135deg, var(--yellow), var(--yellow-deep));
    color: var(--blue-deep);
    box-shadow: 0 6px 18px rgba(255, 196, 0, 0.45);
}
.btn-pill-solid:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(255, 196, 0, 0.55); }
.btn-pill-ghost {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.5);
}
.btn-pill-ghost:hover { background: rgba(255, 255, 255, 0.25); }
.btn-pill-outline {
    border: 2px solid var(--blue);
    color: var(--blue);
    background: transparent;
}
body.dark-mode .btn-pill-outline { border-color: var(--yellow); color: var(--yellow); }
.btn-mini {
    display: inline-block;
    margin-top: 8px;
    padding: 7px 16px;
    border-radius: 999px;
    background: var(--blue);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}
.btn-mini:hover { background: var(--yellow); color: var(--blue-deep); transform: translateY(-2px); }

/* ------------------------------- Section head ---------------------------- */
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    min-width: 0;
}
.section-title {
    margin: 0;
    font-size: 20px;
    color: var(--ink);
    letter-spacing: 0.2px;
}
.section-link {
    font-size: 13px;
    font-weight: 700;
    color: var(--blue-soft);
    text-decoration: none;
    white-space: nowrap;
}
body.dark-mode .section-link { color: var(--yellow); }

/* ------------------------------- Hero card -------------------------------- */
.hero-card {
    position: relative;
    display: grid;
    grid-template-areas: "body media";
    grid-template-columns: 1.25fr 1fr;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    border-radius: var(--radius);
    padding: 26px 22px;
    background: linear-gradient(125deg, var(--blue) 0%, var(--blue-deep) 62%, #10164d 100%);
    color: #fff;
    box-shadow: var(--shadow);
}
.hero-card-glow {
    position: absolute;
    width: 260px; height: 260px;
    right: -70px; top: -90px;
    background: radial-gradient(circle, rgba(255,196,0,0.35), transparent 70%);
    pointer-events: none;
}
.hero-card-body { grid-area: body; min-width: 0; }
.hero-card-media { grid-area: media; min-width: 0; }
.hero-media-img {
    width: 100%;
    border-radius: 18px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
    display: block;
}
.hero-chip {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 196, 0, 0.18);
    border: 1px solid rgba(255, 196, 0, 0.55);
    color: var(--yellow);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
}
.hero-title { font-size: 32px; color: #fff; margin: 0 0 10px; }
.hero-desc { margin: 0 0 18px; font-size: 14px; color: rgba(232, 234, 246, 0.85); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-stats {
    display: grid;
    grid-template-areas: "s1 s2 s3";
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 14px;
}
.hero-stat {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 12px 8px;
    text-align: center;
    box-shadow: var(--shadow-soft);
}
.hero-stat:nth-child(1) { grid-area: s1; }
.hero-stat:nth-child(2) { grid-area: s2; }
.hero-stat:nth-child(3) { grid-area: s3; }
.hero-stat strong { display: block; font-family: var(--font-display); font-size: 18px; color: var(--blue); }
body.dark-mode .hero-stat strong { color: var(--yellow); }
.hero-stat span { font-size: 12px; color: var(--ink-soft); }

/* ------------------------------- Horizontal rail ------------------------ */
.h-rail-wrap { min-width: 0; overflow: hidden; }
.h-rail {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 4px 2px 14px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    min-width: 0;
}
.h-rail::-webkit-scrollbar { display: none; }
.rail-card {
    flex: 0 0 158px;
    scroll-snap-align: start;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.rail-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.rail-img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; }
.rail-body { padding: 12px 14px 16px; text-align: center; }
.rail-title { margin: 0; font-family: var(--font-body); font-weight: 800; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-rating { font-size: 12px; color: var(--yellow-deep); margin-top: 4px; }
body.dark-mode .rail-rating { color: var(--yellow); }

/* ------------------------------- News feed -------------------------------- */
.news-feed { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.feed-card {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.feed-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feed-card-link { display: flex; gap: 14px; padding: 12px; text-decoration: none; min-width: 0; }
.feed-thumb { flex: 0 0 104px; min-width: 0; }
.feed-thumb img { width: 104px; height: 104px; object-fit: cover; border-radius: var(--radius-sm); display: block; }
.feed-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.feed-title {
    margin: 0 0 6px;
    font-family: var(--font-body);
    font-weight: 800;
    font-size: 15px;
    color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.feed-excerpt { margin: 0 0 8px; font-size: 13px; color: var(--ink-soft); }
.feed-date { font-size: 12px; color: var(--blue-soft); font-weight: 600; }
body.dark-mode .feed-date { color: var(--yellow); }
.feed-empty { background: var(--card); border-radius: var(--radius); padding: 30px; text-align: center; color: var(--ink-soft); }

/* ------------------------------- Download cards --------------------------- */
.download-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.download-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card);
    box-shadow: var(--shadow-soft);
}
.download-poster { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.download-info { padding: 16px; }
.download-title { margin: 0 0 6px; font-size: 17px; color: var(--ink); }
.download-desc { margin: 0 0 14px; font-size: 13px; color: var(--ink-soft); }

/* ------------------------------- Archive ---------------------------------- */
.page-hero-mini {
    background: linear-gradient(120deg, var(--blue), var(--blue-deep));
    border-radius: var(--radius);
    padding: 24px 22px;
    margin-bottom: 18px;
    color: #fff;
    box-shadow: var(--shadow);
}
.page-hero-title { margin: 0 0 6px; font-size: 24px; color: #fff; }
.page-hero-desc { margin: 0; font-size: 14px; color: rgba(232, 234, 246, 0.85); }
.archive-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; min-width: 0; }
.archive-card {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    min-width: 0;
}
.archive-card .feed-card-link { flex-direction: column; gap: 0; padding: 0; }
.archive-card .feed-thumb { flex: none; }
.archive-card .feed-thumb img { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 0; }
.archive-card .feed-body { padding: 14px 16px 18px; }
.archive-cta { text-align: center; margin-top: 24px; }

/* ------------------------------- Article ---------------------------------- */
.article-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 26px 22px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
}
.article-title { margin: 0 0 12px; font-size: 26px; color: var(--ink); }
.article-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.meta-chip {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--bg);
    color: var(--ink-soft);
}
.article-figure { margin: 0 0 18px; }
.article-figure img { border-radius: var(--radius-sm); width: 100%; }
.article-content { font-size: 15px; line-height: 1.8; color: var(--ink); }
.article-content img { border-radius: var(--radius-sm); }
.article-content h2, .article-content h3 { margin-top: 1.4em; }
.article-content blockquote {
    margin: 1.2em 0;
    padding: 14px 18px;
    border-left: 4px solid var(--yellow);
    background: var(--bg);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.article-cta { text-align: center; margin: 22px 0; }

/* ------------------------------- Pagination ------------------------------- */
.app-pagination { margin-top: 22px; text-align: center; }
.app-pagination .nav-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.app-pagination .page-numbers {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 40px; height: 40px; padding: 0 12px;
    border-radius: 999px;
    background: var(--card);
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--shadow-soft);
}
.app-pagination .page-numbers.current { background: var(--blue); color: #fff; }
.app-pagination .page-numbers:hover { background: var(--yellow); color: var(--blue-deep); }

/* ------------------------------- Footer ------------------------------------ */
.app-footer { margin-top: 34px; padding: 0 16px 26px; }
.footer-inner {
    max-width: 920px;
    margin: 0 auto;
    background: var(--card);
    border-radius: var(--radius);
    padding: 26px 20px;
    box-shadow: var(--shadow-soft);
}
.footer-widgets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 20px; }
.footer-widget { font-size: 13px; color: var(--ink-soft); min-width: 0; }
.footer-widget .widget-title { font-size: 15px; color: var(--ink); margin: 0 0 10px; }
.footer-widget a { color: var(--blue-soft); text-decoration: none; }
body.dark-mode .footer-widget a { color: var(--yellow); }
.footer-bottom { border-top: 1px solid var(--line); padding-top: 18px; text-align: center; }
.disclaimer-text { font-size: 12px; color: var(--ink-soft); line-height: 1.7; margin: 12px auto 0; max-width: 640px; }

/* ------------------------------- Bottom tabbar ----------------------------- */
.bottom-tabbar {
    position: fixed;
    bottom: 12px;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    pointer-events: none;
}
.tabbar-inner {
    pointer-events: auto;
    display: flex;
    align-items: stretch;
    gap: 2px;
    max-width: 460px;
    margin: 0 auto;
    padding: 6px;
    background: var(--card);
    border-radius: 999px;
    box-shadow: 0 12px 34px rgba(26, 36, 112, 0.3);
    border: 1px solid var(--line);
}
.tab-item {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 10px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--ink-soft);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease, transform 0.2s ease;
}
.tab-icon { font-size: 18px; line-height: 1; }
.tab-item.is-active {
    background: linear-gradient(135deg, var(--blue), var(--blue-deep));
    color: #fff;
    box-shadow: 0 4px 14px rgba(40, 53, 147, 0.45);
}
body.dark-mode .tab-item.is-active {
    background: linear-gradient(135deg, var(--yellow), var(--yellow-deep));
    color: var(--blue-deep);
}
.tab-item:not(.is-active):hover { transform: translateY(-2px); color: var(--blue); }
body.dark-mode .tab-item:not(.is-active):hover { color: var(--yellow); }

/* ------------------------------- Menu panel -------------------------------- */
.menu-panel {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.menu-panel.is-open { visibility: visible; opacity: 1; }
.menu-panel-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 40, 0.55); backdrop-filter: blur(2px); }
.menu-panel-card {
    position: relative;
    width: min(520px, calc(100% - 32px));
    background: var(--card);
    border-radius: 28px 28px 0 0;
    padding: 20px 22px calc(26px + env(safe-area-inset-bottom));
    transform: translateY(105%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 -14px 44px rgba(0, 0, 0, 0.3);
}
.menu-panel.is-open .menu-panel-card { transform: translateY(0); }
.menu-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.menu-panel-title { font-family: var(--font-display); font-size: 20px; color: var(--ink); }
.menu-panel-close {
    width: 36px; height: 36px;
    border: none; border-radius: 50%;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    cursor: pointer;
}
.menu-panel-list { list-style: none; margin: 0; padding: 0; }
.menu-panel-list li a {
    display: block;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}
.menu-panel-list li a:hover { background: var(--blue); color: #fff; }
body.dark-mode .menu-panel-list li a:hover { background: var(--yellow); color: var(--blue-deep); }
.menu-panel-auth { display: flex; gap: 10px; margin-top: 16px; }
.menu-panel-auth .btn-pill { flex: 1; }

/* ------------------------------- Reveal animation -------------------------- */
@keyframes appRise {
    from { opacity: 0; transform: translateY(22px); }
    to { opacity: 1; transform: translateY(0); }
}
.app-section { animation: appRise 0.6s ease both; }
.app-section:nth-child(2) { animation-delay: 0.08s; }
.app-section:nth-child(3) { animation-delay: 0.16s; }
.app-section:nth-child(4) { animation-delay: 0.24s; }
