/* ==========================================================================
   Moban 8-10-23 — Bảng điều khiển công nghiệp (Graphite #37474F / Vàng #FFD54F)
   ========================================================================== */

/* --- Overflow guard --- */
html, body {
    overflow-x: hidden;
}

:root {
    --ink: #37474F;
    --ink-deep: #263238;
    --ink-soft: #546E7A;
    --yellow: #FFD54F;
    --yellow-deep: #FFC107;
    --bg: #FAFBFC;
    --panel: #FFFFFF;
    --line: #CFD8DC;
    --line-dark: #37474F;
    --radius: 0; /* góc vuông - công nghiệp */
    --tabbar-h: 62px;
    --font-display: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    background-image:
        linear-gradient(var(--line) 1px, transparent 1px),
        linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 34px 34px;
    background-attachment: fixed;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 15px;
    line-height: 1.65;
    /* Khoảng đệm cho thanh tab cố định dưới cùng trên di động */
    padding-bottom: calc(var(--tabbar-h) + 14px);
}

img { max-width: 100%; height: auto; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--ink-deep); }
ul, ol { margin: 0; padding: 0; list-style: none; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 18px;
    padding-right: 18px;
}

/* ==========================================================================
   Header hẹp trên cùng
   ========================================================================== */
.site-header {
    background: var(--ink-deep);
    border-bottom: 4px solid var(--yellow);
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 64px;
}
.site-logo { flex: 0 0 auto; }
.logo-img { max-height: 44px; display: block; }
.header-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: auto;
}
.header-tag {
    background: var(--yellow);
    color: var(--ink-deep);
    font-weight: 900;
    font-size: 11px;
    letter-spacing: 2px;
    padding: 4px 10px;
}
.header-status {
    color: #B0BEC5;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.status-dot {
    width: 8px;
    height: 8px;
    background: #66BB6A;
    display: inline-block;
    animation: status-blink 1.6s infinite;
}
@keyframes status-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}
.header-actions { display: flex; gap: 10px; }

/* --- Nút --- */
.btn {
    display: inline-block;
    border: 2px solid var(--ink);
    background: var(--panel);
    color: var(--ink);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 9px 18px;
    border-radius: var(--radius);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
    cursor: pointer;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 4px 4px 0 rgba(38, 50, 56, 0.35);
}
.btn-primary { background: var(--yellow); color: var(--ink-deep); border-color: var(--ink); }
.btn-register { background: var(--yellow); color: var(--ink-deep); border-color: var(--yellow); }
.btn-login { background: transparent; color: #ECEFF1; border-color: #ECEFF1; }
.btn-login:hover { background: #ECEFF1; color: var(--ink-deep); }
.btn-ghost { background: transparent; }
.btn-block { display: block; width: 100%; text-align: center; }

/* ==========================================================================
   Thanh tab kiểu ứng dụng (dưới cùng trên di động, trên cùng trên desktop)
   ========================================================================== */
.app-navbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    background: var(--ink-deep);
    border-top: 3px solid var(--yellow);
}
.app-navbar-inner {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    max-width: 720px;
    margin: 0 auto;
}
.app-tab {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px 7px;
    background: none;
    border: 0;
    color: #B0BEC5;
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: none;
    cursor: pointer;
    position: relative;
    transition: color .15s ease, background .15s ease;
}
.app-tab-icon { font-size: 19px; line-height: 1; }
.app-tab-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.app-tab:hover, .app-tab.is-active { color: var(--yellow); }
.app-tab.is-active { background: rgba(255, 213, 79, 0.1); }
.app-tab.is-active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 3px;
    background: var(--yellow);
}
.app-tab-menu { color: #ECEFF1; }
.app-tab-menu:hover { color: var(--yellow); }

/* --- Ngăn kéo menu --- */
.menu-drawer {
    position: fixed;
    inset: 0;
    z-index: 950;
    visibility: hidden;
    opacity: 0;
    transition: opacity .25s ease, visibility .25s ease;
}
.menu-drawer.is-open { visibility: visible; opacity: 1; }
.menu-drawer-backdrop { position: absolute; inset: 0; background: rgba(38, 50, 56, 0.6); }
.menu-drawer-inner {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 86vw);
    background: var(--ink-deep);
    border-left: 4px solid var(--yellow);
    padding: 20px;
    transform: translateX(100%);
    transition: transform .25s ease;
    overflow-y: auto;
}
.menu-drawer.is-open .menu-drawer-inner { transform: translateX(0); }
.menu-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(255, 213, 79, 0.4);
}
.menu-drawer-title {
    color: var(--yellow);
    font-weight: 900;
    letter-spacing: 4px;
    font-size: 16px;
}
.menu-drawer-close {
    background: var(--yellow);
    border: 0;
    color: var(--ink-deep);
    width: 32px;
    height: 32px;
    font-size: 15px;
    cursor: pointer;
}
.drawer-menu li a {
    display: block;
    color: #ECEFF1;
    font-weight: 700;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(176, 190, 197, 0.25);
    transition: color .15s ease, padding-left .15s ease;
}
.drawer-menu li a:hover { color: var(--yellow); padding-left: 14px; }
.btn-drawer { margin-top: 20px; }

/* ==========================================================================
   Lưới khu vực (grid-template-areas) — chỉ định nghĩa tại đây
   ========================================================================== */
.dash-grid {
    display: grid;
    gap: 22px;
    padding-top: 24px;
    padding-bottom: 34px;
}
.dash-grid > * { min-width: 0; }

/* Bản đồ "hồi" trang chủ v2: ticker + banner ngang, nội dung trái, cột dữ liệu phải xuyên suốt */
.front-grid {
    grid-template-columns: minmax(0, 2.15fr) minmax(0, 1fr);
    grid-template-areas:
        "ticker ticker"
        "banner banner"
        "main   data"
        "news   data";
}

/* Bản đồ trang trong: nội dung trái + cột dữ liệu phải */
.page-grid {
    grid-template-columns: minmax(0, 2.15fr) minmax(0, 1fr);
    grid-template-areas:
        "main data";
}

.ticker-area { grid-area: ticker; }
.banner-area { grid-area: banner; }
.main-area   { grid-area: main; }
.news-area   { grid-area: news; }
.data-area   { grid-area: data; }

/* ==========================================================================
   Ticker tin nhanh
   ========================================================================== */
.ticker-area {
    display: flex;
    align-items: stretch;
    background: var(--ink-deep);
    border: 2px solid var(--ink-deep);
    overflow: hidden;
}
.ticker-flag {
    flex: 0 0 auto;
    background: var(--yellow);
    color: var(--ink-deep);
    font-weight: 900;
    font-size: 11px;
    letter-spacing: 2px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
}
.ticker-viewport { overflow: hidden; flex: 1 1 auto; min-width: 0; }
.ticker-track {
    display: inline-flex;
    gap: 26px;
    white-space: nowrap;
    padding: 10px 0;
    color: #ECEFF1;
    font-size: 13px;
    animation: ticker-scroll 30s linear infinite;
    will-change: transform;
}
.ticker-track:hover { animation-play-state: paused; }
.ticker-sep { color: var(--yellow); }
@keyframes ticker-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* ==========================================================================
   Banner
   ========================================================================== */
.banner-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.banner-strip > * { min-width: 0; }
.banner-item {
    position: relative;
    display: block;
    border: 2px solid var(--ink);
    background: var(--ink-deep);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}
.banner-item img { display: block; width: 100%; aspect-ratio: 16 / 7; object-fit: cover; }
.banner-item:hover { transform: translateY(-4px); box-shadow: 6px 6px 0 rgba(38, 50, 56, 0.3); }
.banner-cap {
    position: absolute;
    left: 0;
    bottom: 0;
    background: var(--yellow);
    color: var(--ink-deep);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1.5px;
    padding: 5px 12px;
}

/* ==========================================================================
   Tiêu đề khối
   ========================================================================== */
.panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    font-size: 17px;
    font-weight: 900;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--ink-deep);
}
.title-bar {
    flex: 0 0 auto;
    width: 12px;
    height: 20px;
    background: var(--yellow);
    border: 2px solid var(--ink);
}
.page-heading { font-size: 22px; }
.archive-desc { color: var(--ink-soft); margin-bottom: 16px; }

/* ==========================================================================
   Lưới game
   ========================================================================== */
.game-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.game-grid > * { min-width: 0; }
.game-card {
    background: var(--panel);
    border: 2px solid var(--ink);
    padding: 10px;
    transition: transform .18s ease, box-shadow .18s ease;
}
.game-card:hover { transform: translateY(-4px); box-shadow: 6px 6px 0 var(--yellow); }
.game-thumb { position: relative; overflow: hidden; }
.game-thumb img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.game-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--yellow);
    color: var(--ink-deep);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1px;
    padding: 3px 8px;
}
.game-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 2px;
}
.game-name {
    margin: 0;
    font-size: 13.5px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.game-score { color: var(--yellow-deep); font-weight: 900; font-size: 12.5px; flex: 0 0 auto; }

/* ==========================================================================
   Danh sách bài viết
   ========================================================================== */
.article-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.article-row {
    background: var(--panel);
    border: 2px solid var(--line);
    border-left: 6px solid var(--line);
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.article-row:hover {
    border-left-color: var(--yellow);
    transform: translateX(4px);
    box-shadow: 4px 4px 0 rgba(38, 50, 56, 0.12);
}
.article-row-link { display: flex; gap: 14px; padding: 12px; }
.article-row-thumb { flex: 0 0 128px; min-width: 0; }
.article-row-thumb img { display: block; width: 128px; height: 86px; object-fit: cover; border: 1px solid var(--line); }
.article-row-body { flex: 1 1 auto; min-width: 0; }
.article-row-title { margin: 0 0 6px; font-size: 15px; font-weight: 700; color: var(--ink-deep); }
.article-row-excerpt { margin: 0 0 6px; color: var(--ink-soft); font-size: 13px; }
.article-row-date { font-size: 12px; color: #90A4AE; letter-spacing: 0.5px; }
.empty-note { color: var(--ink-soft); padding: 20px; border: 2px dashed var(--line); text-align: center; }

/* ==========================================================================
   Cột dữ liệu bên phải
   ========================================================================== */
.data-area { display: flex; flex-direction: column; gap: 18px; }
.data-panel {
    background: var(--panel);
    border: 2px solid var(--ink);
    padding: 16px;
    box-shadow: 6px 6px 0 rgba(55, 71, 79, 0.14);
}
.data-panel .panel-title { font-size: 14px; margin-bottom: 14px; }

/* Xếp hạng */
.rank-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.rank-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border: 1px solid var(--line);
    background: var(--bg);
}
.rank-row.top-1 { border-color: var(--ink); background: var(--yellow); }
.rank-row.top-2 { background: #FFF3C4; }
.rank-no { font-weight: 900; font-size: 13px; color: var(--ink-deep); width: 22px; flex: 0 0 auto; }
.rank-thumb { width: 34px; height: 34px; object-fit: cover; flex: 0 0 auto; border: 1px solid var(--ink); }
.rank-name { flex: 1 1 auto; min-width: 0; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-score { flex: 0 0 auto; font-weight: 900; font-size: 13px; color: var(--ink-deep); }

/* Thống kê */
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stats-grid > * { min-width: 0; }
.stat-cell {
    border: 2px solid var(--ink);
    background: var(--bg);
    padding: 12px 10px;
    text-align: center;
}
.stat-num { display: block; font-size: 20px; font-weight: 900; color: var(--ink-deep); }
.stat-label { display: block; font-size: 11px; color: var(--ink-soft); letter-spacing: 0.5px; margin-top: 2px; }

/* Tin nhanh */
.flash-list { display: flex; flex-direction: column; gap: 10px; }
.flash-list li { display: flex; gap: 10px; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.flash-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.flash-time {
    flex: 0 0 auto;
    background: var(--ink-deep);
    color: var(--yellow);
    font-size: 11px;
    font-weight: 900;
    padding: 2px 6px;
    height: fit-content;
    margin-top: 2px;
}
.flash-text { font-size: 12.5px; color: var(--ink); }

/* CTA */
.cta-panel { background: var(--ink-deep); border-color: var(--ink-deep); }
.cta-flag {
    display: inline-block;
    background: var(--yellow);
    color: var(--ink-deep);
    font-weight: 900;
    font-size: 12px;
    letter-spacing: 2px;
    padding: 4px 10px;
    margin-bottom: 10px;
}
.cta-text { color: #CFD8DC; font-size: 13px; margin: 0 0 12px; }

/* Tìm kiếm */
.panel-search { display: flex; gap: 8px; }
.search-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 2px solid var(--ink);
    padding: 9px 12px;
    font-family: inherit;
    font-size: 13px;
    background: var(--bg);
}
.search-input:focus { outline: 3px solid var(--yellow); }
.search-btn {
    flex: 0 0 auto;
    background: var(--yellow);
    border: 2px solid var(--ink);
    font-weight: 900;
    letter-spacing: 1px;
    padding: 9px 16px;
    cursor: pointer;
}

/* Widget sidebar mặc định của WP */
.widget {
    background: var(--panel);
    border: 2px solid var(--ink);
    padding: 16px;
    box-shadow: 6px 6px 0 rgba(55, 71, 79, 0.14);
    margin-bottom: 0;
}
.widget-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin: 0 0 14px;
}
.widget-title::before { content: ""; width: 12px; height: 18px; background: var(--yellow); border: 2px solid var(--ink); }

/* ==========================================================================
   Bài viết chi tiết
   ========================================================================== */
.post-panel { background: var(--panel); border: 2px solid var(--ink); padding: 22px; }
.post-title { margin-bottom: 10px; }
.post-meta { display: flex; gap: 16px; color: var(--ink-soft); font-size: 12.5px; margin-bottom: 16px; }
.post-thumb { margin-bottom: 18px; border: 2px solid var(--line); }
.post-thumb img { display: block; width: 100%; }
.post-content { font-size: 15.5px; color: var(--ink); }
.post-content h2, .post-content h3 { color: var(--ink-deep); }
.post-content h2 { border-left: 6px solid var(--yellow); padding-left: 12px; }
.post-content a { color: var(--ink-deep); font-weight: 700; text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 2px; }
.post-content blockquote { border-left: 6px solid var(--yellow); background: #FFF8E1; margin: 0; padding: 14px 18px; }
.post-content img { border: 1px solid var(--line); }
.post-tags { margin-top: 18px; font-size: 12.5px; color: var(--ink-soft); }
.post-download {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding: 14px 16px;
    background: var(--ink-deep);
    color: #ECEFF1;
}
.post-download-text { margin: 0; font-weight: 700; font-size: 13.5px; }
.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    font-size: 13px;
    font-weight: 700;
}
.post-nav a { border: 2px solid var(--ink); padding: 8px 14px; display: inline-block; background: var(--panel); }
.post-nav a:hover { background: var(--yellow); }
.related-panel { margin-top: 24px; }

/* Phân trang */
.pagination-bar { margin-top: 18px; }
.pagination-bar .nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.pagination-bar .page-numbers {
    display: inline-block;
    border: 2px solid var(--ink);
    background: var(--panel);
    font-weight: 700;
    padding: 7px 13px;
}
.pagination-bar .page-numbers.current { background: var(--yellow); color: var(--ink-deep); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    background: var(--ink-deep);
    color: #B0BEC5;
    border-top: 4px solid var(--yellow);
    padding: 34px 0 26px;
}
.footer-widgets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
    margin-bottom: 24px;
}
.footer-widgets > * { min-width: 0; }
.footer-widget .widget { background: transparent; border: 0; box-shadow: none; padding: 0; }
.footer-widget .widget-title { color: var(--yellow); }
.footer-widget .widget-title::before { display: none; }
.footer-widget a { color: #CFD8DC; }
.footer-widget a:hover { color: var(--yellow); }
.footer-bottom { border-top: 1px solid rgba(176, 190, 197, 0.25); padding-top: 20px; text-align: center; }
.disclaimer-text { font-size: 12.5px; line-height: 1.7; color: #90A4AE; max-width: 760px; margin: 14px auto 10px; }
.footer-copy { font-size: 12px; color: #78909C; margin: 0; }

/* ==========================================================================
   Nút quay về đầu trang
   ========================================================================== */
.back-to-top {
    position: fixed;
    right: 18px;
    bottom: calc(var(--tabbar-h) + 22px);
    z-index: 850;
    width: 44px;
    height: 44px;
    background: var(--yellow);
    color: var(--ink-deep);
    border: 2px solid var(--ink);
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .25s ease, visibility .25s ease, transform .25s ease, box-shadow .15s ease;
    box-shadow: 4px 4px 0 rgba(38, 50, 56, 0.35);
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { box-shadow: 6px 6px 0 rgba(38, 50, 56, 0.45); }

/* ==========================================================================
   Chuyển đổi lưới + thanh tab trên màn hình hẹp
   ========================================================================== */
@media (max-width: 991px) {
    .front-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "ticker"
            "banner"
            "main"
            "news"
            "data";
    }
    .page-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "main"
            "data";
    }
}

/* Desktop: thanh tab chuyển lên trên cùng, bỏ đệm đáy body */
@media (min-width: 992px) {
    body { padding-bottom: 0; }
    .app-navbar {
        position: sticky;
        top: 0;
        bottom: auto;
        border-top: 0;
        border-bottom: 3px solid var(--yellow);
    }
    .app-navbar-inner { max-width: 1200px; }
    .app-tab {
        flex-direction: row;
        gap: 8px;
        padding: 13px 18px;
        font-size: 12px;
        flex: 0 0 auto;
        letter-spacing: 0.5px;
    }
    .app-tab-icon { font-size: 15px; }
    .app-tab.is-active::before {
        top: auto;
        bottom: 0;
        left: 12px;
        right: 12px;
    }
    .back-to-top { bottom: 26px; }
}

/* ==========================================================================
   Hiệu ứng xuất hiện khi cuộn
   ========================================================================== */
.scroll-reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .5s ease, transform .5s ease;
}
.scroll-reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
    .ticker-track { animation: none; }
    .scroll-reveal { opacity: 1; transform: none; transition: none; }
}
