/* ============================================================
   Louis Space v2.0 — Design System "Prism"
   ------------------------------------------------------------
   Triết lý: kết hợp 3 ngôn ngữ thiết kế hàng đầu thế giới
   • GitHub Primer — bảng màu trung tính, border tinh tế, bảng &
     form chuẩn, tính accessible cao (WCAG AA)
   • Vercel Geist  — minimal, typography chặt, số liệu dùng
     font mono, card phẳng + hover elevation
   • X (Twitter)   — pill buttons, timeline, avatar tròn,
     header sticky backdrop-blur, màu nhấn xanh #1d9bf0

   Cấu trúc file:
   01. Design tokens (light + dark)
   02. Reset & base
   03. Utilities
   04. Layout primitives
   05. Header & navigation
   06. Mega menu
   07. Buttons
   08. Badges / chips / labels
   09. Avatars
   10. Hero
   11. Sections
   12. Game cards & grids
   13. News cards
   14. Tags & categories
   15. Game detail
   16. Comments (timeline X-style)
   17. Rating stars
   18. Sidebar cards & share
   19. Profile
   20. Auth pages
   21. Forms & upload
   22. Tables
   23. Admin
   24. Notifications
   25. Repos
   26. Live chat
   27. Modal / toast / alert / announcement
   28. Pagination
   29. Empty & error states
   30. Static pages & prose
   31. Footer
   32. Animations & micro-interactions
   33. Responsive
   34. Accessibility & scrollbar
   ============================================================ */

/* ============================================================
   01. DESIGN TOKENS
   Light theme mặc định :root — dark qua [data-theme="dark"].
   Mọi màu dùng qua var(--*) — KHÔNG hard-code màu trong component.
   ============================================================ */
:root {
    /* --- Bề mặt (surfaces) —GitHub light--- */
    --bg-canvas: #ffffff;          /* nền trang */
    --bg-subtle: #f6f8fa;          /* nền phụ: sidebar, hover, thead */
    --bg-inset: #f6f8fa;           /* nền lõm: code block, chat */
    --bg-elevated: #ffffff;        /* dropdown, modal, toast */
    --bg-header: rgba(255, 255, 255, 0.82); /* header blur */
    --bg-overlay: rgba(31, 35, 40, 0.48);   /* modal backdrop */

    /* --- Viền (borders)--- */
    --border-default: #d1d9e0;
    --border-muted: #e8ecf1;
    --border-strong: #afb8c1;

    /* --- Chữ (foreground)--- */
    --fg-default: #1f2328;
    --fg-muted: #59636e;
    --fg-subtle: #818b98;
    --fg-on-emphasis: #ffffff;

    /* --- Màu nhấn — X blue cho CTA, GitHub blue cho link--- */
    --accent: #0969da;             /* link, focus, selected (AA trên trắng) */
    --accent-hover: #0860ca;
    --accent-subtle: #ddf4ff;      /* nền selected, hover selected */
    --accent-fg: #ffffff;
    --btn-primary-bg: #1d9bf0;     /* X blue — nút CTA chính */
    --btn-primary-hover: #1a8cd8;
    --btn-primary-active: #1771bc;

    /* --- Trạng thái —GitHub semantic--- */
    --success: #1a7f37;
    --success-emphasis: #2da44e;
    --success-subtle: #dafbe1;
    --danger: #cf222e;
    --danger-emphasis: #d1242f;
    --danger-subtle: #ffebe9;
    --warning: #9a6700;
    --warning-subtle: #fff8c5;
    --done: #8250df;               /* purple — "done" kiểu GitHub */
    --done-subtle: #fbefff;
    --attention: #bf8700;

    /* --- Typography--- */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
        'Noto Sans', Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono',
        Menlo, Consolas, 'Liberation Mono', monospace;

    /* --- Bán kính--- */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* --- Bóng — Vercel layered shadows--- */
    --shadow-sm: 0 1px 2px rgba(31, 35, 40, 0.06), 0 0 0 1px rgba(31, 35, 40, 0.02);
    --shadow-md: 0 2px 6px rgba(31, 35, 40, 0.08), 0 1px 2px rgba(31, 35, 40, 0.05);
    --shadow-lg: 0 16px 40px -12px rgba(31, 35, 40, 0.18), 0 4px 12px -4px rgba(31, 35, 40, 0.08);
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.08);

    /* --- Focus ring — GitHub style--- */
    --focus-ring: 0 0 0 3px rgba(9, 105, 218, 0.30);

    /* --- Chuyển động--- */
    --transition-fast: 120ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-base: 180ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-slow: 280ms cubic-bezier(0.25, 0.46, 0.45, 0.94);

    /* --- Layout--- */
    --container-max: 1280px;
    --header-height: 64px;

    /* --- Z-index scale--- */
    --z-header: 100;
    --z-menu: 90;
    --z-modal: 200;
    --z-toast: 300;
}

[data-theme="dark"] {
    /* --- Bề mặt — GitHub dark (#0d1117 canvas) + Vercel tinh giản--- */
    --bg-canvas: #0d1117;
    --bg-subtle: #151b23;
    --bg-inset: #010409;
    --bg-elevated: #1c2129;
    --bg-header: rgba(13, 17, 23, 0.82);
    --bg-overlay: rgba(1, 4, 9, 0.66);

    /* --- Viền--- */
    --border-default: #3d444d;
    --border-muted: #262c36;
    --border-strong: #57606a;

    /* --- Chữ--- */
    --fg-default: #e6edf3;
    --fg-muted: #9198a1;
    --fg-subtle: #6e7681;
    --fg-on-emphasis: #ffffff;

    /* --- Màu nhấn--- */
    --accent: #4493f8;
    --accent-hover: #539bf5;
    --accent-subtle: #121d2f;
    --btn-primary-bg: #1d9bf0;
    --btn-primary-hover: #1a8cd8;
    --btn-primary-active: #1771bc;

    /* --- Trạng thái--- */
    --success: #3fb950;
    --success-emphasis: #238636;
    --success-subtle: rgba(46, 160, 67, 0.15);
    --danger: #f85149;
    --danger-emphasis: #da3633;
    --danger-subtle: rgba(248, 81, 73, 0.12);
    --warning: #d29922;
    --warning-subtle: rgba(187, 128, 9, 0.16);
    --done: #ab7df8;
    --done-subtle: rgba(163, 113, 247, 0.14);
    --attention: #bb8009;

    /* --- Bóng mạnh hơn trên nền tối--- */
    --shadow-sm: 0 1px 2px rgba(1, 4, 9, 0.4), 0 0 0 1px rgba(1, 4, 9, 0.3);
    --shadow-md: 0 2px 8px rgba(1, 4, 9, 0.5), 0 1px 2px rgba(1, 4, 9, 0.4);
    --shadow-lg: 0 16px 48px -12px rgba(1, 4, 9, 0.7), 0 4px 12px -4px rgba(1, 4, 9, 0.5);
    --shadow-inset: inset 0 1px 0 rgba(230, 237, 243, 0.04);

    --focus-ring: 0 0 0 3px rgba(68, 147, 248, 0.35);
}

/* ============================================================
   02. RESET & BASE
   Modern reset + sensible defaults. Font Inter self-host.
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 16px);
    color-scheme: light;
}

[data-theme="dark"] html,
html[data-theme="dark"] {
    color-scheme: dark;
}

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--fg-default);
    background-color: var(--bg-canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    transition: background-color var(--transition-base), color var(--transition-base);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

hr {
    border: 0;
    border-top: 1px solid var(--border-muted);
    margin: 24px 0;
}

code,
kbd,
pre,
samp {
    font-family: var(--font-mono);
}

code {
    font-size: 0.9em;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-sm);
    padding: 1px 6px;
}

kbd {
    font-size: 11px;
    line-height: 1;
    color: var(--fg-muted);
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-bottom-width: 2px;
    border-radius: var(--radius-sm);
    padding: 4px 6px;
}

pre {
    background-color: var(--bg-inset);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
    padding: 16px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
}

pre code {
    background: none;
    border: 0;
    padding: 0;
    font-size: inherit;
}

::selection {
    background-color: var(--accent-subtle);
    color: var(--fg-default);
}

/* ============================================================
   03. UTILITIES
   ============================================================ */
.muted {
    color: var(--fg-muted);
}

.mono {
    font-family: var(--font-mono);
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -48px;
    left: 16px;
    z-index: var(--z-toast);
    padding: 10px 16px;
    background-color: var(--accent);
    color: #fff;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 8px;
    color: #fff;
}

.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

.gradient-text {
    background: linear-gradient(92deg, var(--accent), var(--done));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--fg-muted);
}

.back-link:hover {
    color: var(--accent);
}

/* ============================================================
   04. LAYOUT PRIMITIVES
   ============================================================ */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: 20px;
}

.site-main {
    flex: 1;
    padding-block: 28px 56px;
}

.two-col-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 28px;
    align-items: start;
}

/* ============================================================
   05. HEADER & NAVIGATION
   Sticky + backdrop-blur (X style), border-bottom tinh tế.
   ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background-color: var(--bg-header);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border-muted);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--header-height);
}

/* --- Logo --- */
.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--fg-default);
    flex-shrink: 0;
}

.logo:hover {
    color: var(--fg-default);
}

.logo svg {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-base);
}

.logo:hover svg {
    transform: rotate(-6deg) scale(1.05);
}

/* --- Search bar — pill, focus ring (GitHub/Vercel hybrid)--- */
.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 560px;
    margin-inline: auto;
    height: 40px;
}

.search-bar svg {
    position: absolute;
    left: 14px;
    color: var(--fg-subtle);
    pointer-events: none;
    flex-shrink: 0;
}

.search-bar input {
    width: 100%;
    height: 100%;
    padding: 0 88px 0 40px;
    font-size: 14px;
    color: var(--fg-default);
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-full);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.search-bar input::placeholder {
    color: var(--fg-subtle);
}

.search-bar input:focus {
    outline: none;
    background-color: var(--bg-canvas);
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.search-bar kbd {
    position: absolute;
    right: 12px;
    pointer-events: none;
}

.search-bar button {
    position: absolute;
    right: 44px;
    height: 26px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-radius: var(--radius-full);
    transition: background-color var(--transition-fast);
}

.search-bar button:hover {
    background-color: var(--accent);
    color: var(--fg-on-emphasis);
}

/* --- Header actions --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}

.icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    color: var(--fg-muted);
    border-radius: var(--radius-full);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.icon-btn:hover {
    color: var(--fg-default);
    background-color: var(--bg-subtle);
}

.icon-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.icon-btn .badge {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: #fff;
    background-color: var(--btn-primary-bg);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-canvas);
}

.avatar-link {
    display: inline-flex;
    border-radius: var(--radius-full);
    transition: box-shadow var(--transition-fast);
}

.avatar-link:hover {
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* Theme toggle icon swap theo theme hiện tại */
.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }
[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }

/* --- Hamburger ---
   Hiển thị ở MỌI kích thước màn hình (v2.1.0 fix): mega menu là
   navigation chính của site — trước đây ẩn trên desktop (>900px)
   khiến người dùng máy tính không truy cập được các mục trong menu
   (Đăng game, Đăng tin, Game của tôi, Quản trị...). Mobile vẫn như cũ. */
.menu-toggle {
    display: inline-flex;
}

.menu-bars {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 18px;
    height: 14px;
}

.menu-bars span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: currentColor;
    border-radius: 2px;
    transition: transform var(--transition-base), opacity var(--transition-base);
}

.menu-toggle[aria-expanded="true"] .menu-bars span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-bars span:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-bars span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ============================================================
   06. MEGA MENU (site-menu)
   Panel 2 cột trượt xuống dưới header — kiểu X dropdown mở rộng.
   ============================================================ */
.site-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background-color: var(--bg-elevated);
    border-bottom: 1px solid var(--border-default);
    box-shadow: var(--shadow-lg);
    animation: menu-slide var(--transition-base) ease-out;
    /* v2.9.1 FIX — menu mega (20+ mục với user đăng nhập, admin còn nhiều
       hơn) trước đây cao hơn viewport trên điện thoại: phần thừa bị cắt
       KHÔNG cuộn được (panel absolute trong header sticky, cuộn trang
       không giúp tới được các mục cuối — nút "Đăng xuất" unreachable).
       Giới hạn chiều cao = viewport trừ header + cuộn trong panel. */
    max-height: calc(100vh - var(--header-height));
    max-height: calc(100dvh - var(--header-height));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

@keyframes menu-slide {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.site-menu-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    padding-block: 24px;
}

.menu-heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-subtle);
    margin-bottom: 10px;
    padding-left: 10px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    font-size: 14px;
    font-weight: 450;
    color: var(--fg-default);
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.menu-link:hover {
    color: var(--fg-default);
    background-color: var(--bg-subtle);
}

.menu-link-accent {
    color: var(--accent);
    font-weight: 600;
}

.menu-link-accent:hover {
    color: var(--accent-hover);
}

.menu-link-danger {
    color: var(--danger);
    font-weight: 500;
    width: 100%;
}

.menu-link-danger:hover {
    color: var(--danger-emphasis);
    background-color: var(--danger-subtle);
}

.menu-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
    padding: 1px 8px;
    color: #fff;
    background-color: var(--btn-primary-bg);
    border-radius: var(--radius-full);
}

.menu-form {
    display: contents;
}

.menu-link .menu-icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    color: var(--fg-subtle);
    flex-shrink: 0;
}

.menu-link:hover .menu-icon {
    color: var(--accent);
}

.menu-link-danger .menu-icon,
.menu-link-danger:hover .menu-icon {
    color: inherit;
}

/* ============================================================
   07. BUTTONS
   Base .btn + variants. Primary = X blue; default = GitHub
   bordered; ghost = transparent. Pill cho tag/filter riêng.
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 550;
    font-family: var(--font-sans);
    line-height: 1;
    white-space: nowrap;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: background-color var(--transition-fast),
                border-color var(--transition-fast),
                color var(--transition-fast),
                box-shadow var(--transition-fast),
                transform var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled,
.btn[disabled],
.btn.htmx-request {
    opacity: 0.55;
    pointer-events: none;
}

.btn svg {
    flex-shrink: 0;
}

/* --- Primary: X blue --- */
.btn-primary {
    background-color: var(--btn-primary-bg);
    color: var(--fg-on-emphasis);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--btn-primary-hover);
    color: var(--fg-on-emphasis);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    background-color: var(--btn-primary-active);
}

/* --- Default: GitHub bordered --- */
.btn-default,
.btn-outline {
    background-color: var(--bg-canvas);
    border-color: var(--border-default);
    color: var(--fg-default);
    box-shadow: var(--shadow-sm);
}

.btn-default:hover,
.btn-outline:hover {
    background-color: var(--bg-subtle);
    border-color: var(--border-strong);
    color: var(--fg-default);
}

/* --- Ghost --- */
.btn-ghost {
    background-color: transparent;
    color: var(--fg-muted);
}

.btn-ghost:hover {
    background-color: var(--bg-subtle);
    color: var(--fg-default);
}

/* --- Danger / Success --- */
.btn-danger {
    background-color: var(--danger-emphasis);
    color: #fff;
    font-weight: 600;
}

.btn-danger:hover {
    background-color: var(--danger);
    color: #fff;
}

.btn-success {
    background-color: var(--success-emphasis);
    color: #fff;
    font-weight: 600;
}

.btn-success:hover {
    background-color: var(--success);
    color: #fff;
}

/* --- Sizes --- */
.btn-sm {
    height: 30px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: var(--radius-md);
}

.btn-lg {
    height: 46px;
    padding: 0 24px;
    font-size: 15px;
    border-radius: var(--radius-md);
}

.btn-block {
    display: flex;
    width: 100%;
}

/* --- Google login button --- */
.btn-google {
    background-color: var(--bg-canvas);
    border-color: var(--border-default);
    color: var(--fg-default);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.btn-google:hover {
    background-color: var(--bg-subtle);
    border-color: var(--border-strong);
    color: var(--fg-default);
}

/* --- Download button (game detail)--- */
.btn-download {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 48px;
    padding: 0 16px;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--fg-default);
    font-weight: 600;
    transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-download:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    color: var(--fg-default);
}

.btn-download .platform-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.25;
}

.btn-download .platform-label {
    font-size: 11px;
    font-weight: 450;
    color: var(--fg-subtle);
}

.btn-download .platform-name {
    font-size: 14px;
    font-weight: 600;
}

.btn-download > svg {
    margin-left: auto;
    color: var(--fg-muted);
}

.btn-download:hover > svg {
    color: var(--accent);
}

/* --- Icon-only action button (like/bookmark sidebar)--- */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 40px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 550;
    color: var(--fg-default);
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background-color: var(--bg-subtle);
    border-color: var(--border-strong);
}

.action-btn.active {
    color: var(--btn-primary-bg);
    border-color: var(--btn-primary-bg);
    background-color: var(--accent-subtle);
}

.action-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ============================================================
   08. BADGES / CHIPS / LABELS
   Pill (X style) + counter label (GitHub style).
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 22px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 550;
    line-height: 1;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-success { color: var(--success); background-color: var(--success-subtle); }
.badge-danger  { color: var(--danger);  background-color: var(--danger-subtle); }
.badge-warning { color: var(--warning); background-color: var(--warning-subtle); }
.badge-muted   { color: var(--fg-muted); background-color: var(--bg-subtle); border: 1px solid var(--border-muted); }
.badge-accent  { color: var(--accent);  background-color: var(--accent-subtle); }
.badge-done    { color: var(--done);    background-color: var(--done-subtle); }

/* Status badge — màu set inline từ Rust (r.status.color()) */
.status-badge {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}

/* Counter label kiểu GitHub: "Game 12" */
.counter-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--fg-muted);
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-full);
}

/* Chip — filter pill có thể click */
.chip,
.admin-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--fg-muted);
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.chip:hover,
.admin-chip:hover {
    color: var(--fg-default);
    background-color: var(--bg-subtle);
    border-color: var(--border-strong);
}

.chip.chip-active,
.admin-chip.chip-active {
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-color: var(--accent);
    font-weight: 600;
}

.chip:focus-visible,
.admin-chip:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Tag chip — tag game/tin tức */
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--fg-muted);
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.tag-chip:hover {
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-color: var(--accent);
}

.tag-count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--fg-subtle);
}

.tag-chip-sm {
    display: inline-block;
    padding: 2px 9px;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.tag-chip-sm:hover {
    background-color: var(--accent);
    color: #fff;
}

/* Platform chip — mono uppercase kiểu Vercel */
.platform-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
    background-color: rgba(1, 4, 9, 0.66);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-full);
    padding: 2px 8px;
}

/* Featured badge trên cover game */
.featured-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #1f2328;
    background-color: #fbbf24;
    border-radius: var(--radius-full);
}

/* AI badge — accent color inline từ Rust */
.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid;
    border-radius: var(--radius-full);
    vertical-align: middle;
}

.ai-badge-large {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    font-size: 32px;
    background-color: var(--accent-subtle);
    border-radius: var(--radius-xl);
}

.ai-cap-chip,
.ai-model-badge,
.ai-model-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 550;
    font-family: var(--font-mono);
    border: 1px solid;
    border-radius: var(--radius-full);
}

.ai-cap-chip {
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-color: transparent;
}

/* Pin badge trong comment */
.pin-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    color: var(--warning);
    background-color: var(--warning-subtle);
    border-radius: var(--radius-full);
    padding: 1px 8px;
}

/* ============================================================
   09. AVATARS
   Tròn hoàn toàn (X style) + fallback initials.
   ============================================================ */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    object-fit: cover;
    background-color: var(--bg-subtle);
    flex-shrink: 0;
}

.avatar-fallback {
    font-weight: 650;
    color: var(--fg-muted);
    background: linear-gradient(135deg, var(--bg-subtle), var(--accent-subtle));
    border: 1px solid var(--border-muted);
    letter-spacing: 0.02em;
    user-select: none;
}

.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 48px; height: 48px; font-size: 16px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.avatar-xl { width: 96px; height: 96px; font-size: 32px; }

/* ============================================================
   10. HERO — Vercel style: gradient aura + dot grid + số liệu mono
   ============================================================ */
.hero-section {
    position: relative;
    padding: 64px 0 48px;
    text-align: center;
    overflow: hidden;
    margin-bottom: 8px;
}

/* Dot grid nền (Vercel) */
.hero-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(var(--border-default) 1px, transparent 1px);
    background-size: 24px 24px;
    -webkit-mask-image: radial-gradient(ellipse 70% 80% at 50% 0%, black 30%, transparent 75%);
    mask-image: radial-gradient(ellipse 70% 80% at 50% 0%, black 30%, transparent 75%);
    opacity: 0.55;
    pointer-events: none;
}

/* Aura gradient (Vercel mesh) */
.hero-section::after {
    content: "";
    position: absolute;
    top: -220px;
    left: 50%;
    width: 720px;
    height: 460px;
    transform: translateX(-50%);
    background: radial-gradient(closest-side, rgba(29, 155, 240, 0.16), rgba(130, 80, 223, 0.10), transparent);
    filter: blur(8px);
    pointer-events: none;
}

.hero-content {
    position: relative;
    max-width: 760px;
    margin-inline: auto;
}

.hero-content h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.032em;
    margin-bottom: 18px;
}

.hero-subtitle {
    font-size: 16px;
    line-height: 1.65;
    color: var(--fg-muted);
    margin-bottom: 28px;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

/* Stats row — Vercel: số mono lớn + label uppercase nhỏ, chia cột border */
.hero-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    max-width: 640px;
    margin-inline: auto;
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    background-color: var(--bg-canvas);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.hero-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 8px;
    transition: background-color var(--transition-fast);
}

.hero-stat:hover {
    background-color: var(--bg-subtle);
}

.hero-stat + .hero-stat {
    border-left: 1px solid var(--border-muted);
}

.stat-num {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--fg-default);
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--fg-subtle);
}

/* ============================================================
   11. SECTIONS
   ============================================================ */
.content-section {
    margin-bottom: 48px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.section-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--fg-default);
}

.section-title svg {
    color: var(--accent);
}

.section-more {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
}

.section-more:hover {
    background-color: var(--accent-subtle);
    color: var(--accent-hover);
}

/* Page header — tiêu đề trang con */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-muted);
}

.page-header h1 {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 750;
    letter-spacing: -0.02em;
}

.page-header h1 svg {
    color: var(--accent);
}

.page-header p {
    margin-top: 6px;
    font-size: 14px;
    color: var(--fg-muted);
    max-width: 640px;
}

.page-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-radius: var(--radius-lg);
    flex-shrink: 0;
}

.page-header-text h1 {
    font-size: 22px;
}

.page-header-text p {
    margin-top: 4px;
}

/* Sort bar — GitHub UnderlineNav */
.list-sort-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding-bottom: 0;
    border-bottom: 1px solid var(--border-muted);
}

.list-sort-bar > span:first-child {
    font-size: 13px;
    color: var(--fg-subtle);
    margin-right: 8px;
}

.sort-link {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--fg-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.sort-link:hover {
    color: var(--fg-default);
}

.sort-link.active {
    color: var(--fg-default);
    font-weight: 600;
    border-bottom-color: var(--btn-primary-bg);
}

.result-count {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--fg-muted);
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-full);
    padding: 3px 12px;
}

/* Filter tabs — GitHub tab style */
.filter-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--fg-muted);
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.filter-tab:hover {
    color: var(--fg-default);
    background-color: var(--bg-subtle);
}

.filter-tab.active {
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-color: var(--accent);
    font-weight: 600;
}

/* ============================================================
   12. GAME CARDS & GRIDS
   Card phẳng + border; hover: nâng lên + bóng (Vercel); cover
   zoom nhẹ; meta dùng mono numbers (Vercel).
   ============================================================ */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.game-card {
    position: relative;
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.game-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-strong);
}

.game-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
}

.game-card-link:hover {
    color: inherit;
}

.game-card-cover {
    position: relative;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--bg-subtle), var(--bg-inset));
    overflow: hidden;
}

.game-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.game-card:hover .game-card-cover img {
    transform: scale(1.04);
}

.cover-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--fg-subtle);
    background: repeating-linear-gradient(
        -45deg,
        var(--bg-subtle),
        var(--bg-subtle) 10px,
        var(--bg-inset) 10px,
        var(--bg-inset) 20px
    );
}

.cover-fallback-lg {
    font-size: 40px;
}

.game-platforms {
    position: absolute;
    left: 10px;
    bottom: 10px;
    display: flex;
    gap: 6px;
}

.game-rating-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background-color: rgba(1, 4, 9, 0.7);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border-radius: var(--radius-full);
    padding: 2px 10px;
}

.game-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px 16px;
    flex: 1;
}

.game-card-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--fg-default);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color var(--transition-fast);
}

.game-card:hover .game-card-title {
    color: var(--accent);
}

.game-card-excerpt {
    font-size: 13px;
    line-height: 1.5;
    color: var(--fg-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Meta row — icon SVG + số mono */
.game-card-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: auto;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--fg-muted);
}

.meta-item svg {
    color: var(--fg-subtle);
}

.game-card-author {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border-muted);
    font-size: 13px;
    color: var(--fg-muted);
}

.game-card-author span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-card-author small {
    color: var(--fg-subtle);
    white-space: nowrap;
}

.game-card-category {
    display: inline-flex;
    align-self: flex-start;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-radius: var(--radius-full);
    padding: 2px 10px;
}

/* ============================================================
   13. NEWS CARDS
   ============================================================ */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.news-featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.news-card {
    position: relative;
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.news-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-strong);
}

.news-card-featured {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
}

.news-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
}

.news-card-link:hover {
    color: inherit;
}

.news-card-cover {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent-subtle), var(--bg-subtle));
}

.news-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.news-card:hover .news-card-cover img {
    transform: scale(1.04);
}

.news-card-cover-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 34px;
    font-weight: 700;
    color: var(--accent);
    opacity: 0.7;
}

.news-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    flex: 1;
}

.news-card-category {
    display: inline-flex;
    align-self: flex-start;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-radius: var(--radius-full);
    padding: 2px 10px;
}

.news-card-body h3 {
    font-size: 16px;
    font-weight: 650;
    line-height: 1.4;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color var(--transition-fast);
}

.news-card:hover .news-card-body h3 {
    color: var(--accent);
}

.news-card-excerpt {
    font-size: 13px;
    line-height: 1.55;
    color: var(--fg-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.news-card-author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border-muted);
    font-size: 13px;
    color: var(--fg-muted);
}

/* ============================================================
   14. TAGS & CATEGORIES
   ============================================================ */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.category-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    color: inherit;
    transition: all var(--transition-base);
}

.category-card:hover {
    color: inherit;
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.category-info h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--fg-default);
}

.category-info p {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--fg-muted);
    margin-top: 2px;
}

/* ============================================================
   15. GAME DETAIL
   Breadcrumb + header 2 cột + layout main/sidebar.
   ============================================================ */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: var(--fg-muted);
    margin-bottom: 20px;
}

.breadcrumb a {
    color: var(--fg-default);
    font-weight: 500;
}

.breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb span {
    color: var(--fg-default);
    font-weight: 550;
}

.game-header {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 28px;
    padding-bottom: 28px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border-muted);
}

.game-cover img,
.game-cover .cover-fallback {
    width: 100%;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-muted);
    box-shadow: var(--shadow-md);
}

.game-cover .cover-fallback {
    aspect-ratio: 16 / 9;
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.game-info-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.game-category {
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-radius: var(--radius-full);
    padding: 3px 12px;
}

.game-category:hover {
    background-color: var(--accent);
    color: #fff;
}

.game-title {
    font-size: clamp(1.6rem, 3.2vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.028em;
    line-height: 1.2;
}

.game-excerpt {
    font-size: 15px;
    line-height: 1.6;
    color: var(--fg-muted);
}

/* Author row — X style: avatar + tên + follow button */
.game-author-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.author-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    border-radius: var(--radius-md);
}

.author-link:hover {
    color: inherit;
}

.author-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.author-name {
    font-size: 14px;
    font-weight: 650;
    color: var(--fg-default);
}

.author-stats {
    font-size: 12px;
    color: var(--fg-subtle);
}

/* Stats row — Vercel mono numbers */
.game-stats-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.game-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 88px;
    padding: 10px 14px;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
}

.game-stat .stat-icon {
    font-size: 14px;
    line-height: 1;
}

.game-stat .stat-value {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.game-stat .stat-name {
    font-size: 11px;
    font-weight: 550;
    color: var(--fg-subtle);
}

/* Layout chính: nội dung + sidebar */
.game-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 32px;
    align-items: start;
}

.game-main {
    min-width: 0;
}

.detail-section {
    margin-bottom: 36px;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    padding-bottom: 10px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-muted);
}

.section-heading svg {
    color: var(--accent);
}

.game-content {
    font-size: 15px;
    line-height: 1.7;
}

/* Screenshots grid */
.screenshots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.screenshot-item {
    display: block;
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background-color: var(--bg-subtle);
    transition: all var(--transition-fast);
}

.screenshot-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.screenshot-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.screenshot-item:hover img {
    transform: scale(1.05);
}

/* Trailer */
.trailer-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-muted);
    background-color: var(--bg-inset);
}

.trailer-container iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ============================================================
   16. COMMENTS — timeline X-style
   ============================================================ */
.comments-list,
.comment-list {
    display: flex;
    flex-direction: column;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-muted);
}

.comment-item:last-child {
    border-bottom: 0;
}

.comment-item.pinned {
    position: relative;
    background-color: var(--bg-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 8px;
    border-bottom: 0;
}

.comment-item.pinned::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 3px;
    background-color: var(--warning);
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.comment-author {
    font-size: 14px;
    font-weight: 650;
    color: var(--fg-default);
    /* v3.2.0 FIX mobile: username dài 50 ký tự (AI agent cho phép) không
       bóc từ → đẩy ngang header trên màn hình nhỏ. Cho phép bóc từ bất kỳ. */
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
    max-width: 100%;
}

/* v3.2.0 FIX mobile: avatar phải co cứng — không bị nén khi comment
   body chứa từ dài, tránh layout xô lệch dọc theo chiều cao. */
.comment-avatar {
    flex-shrink: 0;
}

/* v3.2.0 — class dùng ở trang tin (news/show.html) nhưng trước đây
   hoàn toàn chưa có CSS → các nút dồn cục, wrap xấu trên mobile. */
.comment-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--fg-subtle);
}

.comment-meta .btn {
    font-size: 12px;
    padding: 4px 10px;
}

.comment-time {
    font-size: 12px;
    color: var(--fg-subtle);
}

.comment-content {
    margin-top: 4px;
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.comment-actions {
    display: flex;
    align-items: center;
    /* v3.2.0 FIX mobile: 4-5 nút (Thích/Trả lời/Sửa/Xóa/Ghim) trên màn
       ≤320px tràn ngang → cho phép wrap xuống dòng thay vì tràn. */
    flex-wrap: wrap;
    row-gap: 4px;
    margin-top: 6px;
}

.comment-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 550;
    color: var(--fg-subtle);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.comment-action:hover {
    color: var(--accent);
    background-color: var(--accent-subtle);
}

.comment-action.like-comment.active {
    color: var(--danger);
}

.comment-action.like-comment.active:hover {
    background-color: var(--danger-subtle);
}

.comment-action.danger:hover {
    color: var(--danger);
    background-color: var(--danger-subtle);
}

/* Reply/edit form toggle */
.reply-form-container {
    margin-top: 12px;
    padding: 14px;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
}

.reply-form-container form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reply-form-container > div {
    display: flex;
    gap: 8px;
}

.comment-replies {
    margin-top: 8px;
    padding-left: 12px;
    border-left: 2px solid var(--border-muted);
}

/* v3.2.0 — FIX tràn dọc comment trên điện thoại: nội dung media (nếu có)
   và các phần tử con không được vượt width của comment body; giới hạn
   chiều cao vùng pre-wrap để 1 comment khổng lồ không phá vỡ trang. */
.comment-body,
.comment-body > * {
    max-width: 100%;
}

.comment-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

/* Form bình luận chính */
.comment-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    margin-bottom: 12px;
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.comment-form:focus-within {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.comment-form textarea {
    min-height: 80px;
}

.comment-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.char-counter {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--fg-subtle);
}

.char-counter.warn { color: var(--warning); }
.char-counter.danger,
.char-counter.error { color: var(--danger); }

.comments-load-more {
    display: flex;
    justify-content: center;
    padding: 16px 0 4px;
}

.login-prompt,
.empty-comments {
    padding: 20px;
    text-align: center;
    font-size: 14px;
    color: var(--fg-muted);
    background-color: var(--bg-subtle);
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-lg);
}

/* ============================================================
   17. RATING STARS
   ============================================================ */
.rating-stars {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
}

.stars-input {
    display: inline-flex;
    gap: 2px;
}

.star {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 22px;
    line-height: 1;
    color: var(--border-strong);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.star:hover {
    color: var(--warning);
    transform: scale(1.15);
}

.star.filled {
    color: #e3a008;
}

.star:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.rating-info {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.rating-avg {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
}

.rating-count {
    font-size: 13px;
    color: var(--fg-muted);
}

/* ============================================================
   18. SIDEBAR CARDS & SHARE
   ============================================================ */
.game-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: calc(var(--header-height) + 16px);
}

.sidebar-card {
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 18px;
}

.sidebar-card h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 650;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-muted);
}

.sidebar-card h3 svg {
    color: var(--accent);
}

.download-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.download-note {
    font-size: 13px;
    line-height: 1.5;
    color: var(--warning);
    background-color: var(--warning-subtle);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: 12px;
}

.no-downloads {
    font-size: 13px;
    color: var(--fg-muted);
    background-color: var(--bg-subtle);
    border-radius: var(--radius-md);
    padding: 12px;
}

.actions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 14px;
    font-weight: 650;
    color: var(--fg-muted);
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.share-btn:hover {
    color: var(--fg-default);
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.share-btn.share-copy:hover {
    color: var(--accent);
}

.owner-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Info list trong sidebar — dl kiểu GitHub */
.info-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    font-size: 13px;
}

.info-list dt {
    color: var(--fg-muted);
    font-weight: 550;
    white-space: nowrap;
}

.info-list dd {
    color: var(--fg-default);
    overflow-wrap: anywhere;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Game liên quan */
.related-games {
    margin-top: 40px;
    padding-top: 28px;
    border-top: 1px solid var(--border-muted);
}

/* ============================================================
   19. PROFILE — X-style header
   ============================================================ */
.profile-page {
    max-width: 920px;
    margin-inline: auto;
}

.profile-header {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    overflow: hidden;
    background-color: var(--bg-canvas);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.profile-cover {
    height: 140px;
    background:
        radial-gradient(600px 200px at 20% 0%, rgba(29, 155, 240, 0.35), transparent 60%),
        radial-gradient(500px 200px at 80% 100%, rgba(130, 80, 223, 0.28), transparent 60%),
        linear-gradient(120deg, #0f172a, #1e293b);
}

.profile-info {
    display: flex;
    gap: 20px;
    padding: 0 24px;
    /* v3.11.0 FIX (bug "tên trắng biến mất ở chế độ sáng") — đổi overlap
       40px → 62px: khối tên (h1 ~35px + @username ~23px ≈ 58px) giờ nằm
       HOÀN TOÀN trên cover tối ở cả 2 theme. Trước đây overlap 40px chỉ
       đủ che h1 → @username treo 79% dưới nền canvas: light mode = chữ
       trắng trên nền trắng (đã xác minh bằng screenshot browser).
       Avatar 104px giờ phủ 62px trên cover (~60%) — chuẩn layout X/Twitter. */
    margin-top: -62px;
    /* v3.9.0 FIX (bug "ảnh đại diện bị che") — phòng vệ: .profile-info
       chồng lên cover 62px (margin-top âm). Khi cover là element tĩnh,
       avatar (inline content, nằm sau trong tree) tự vẽ TRÊN cover; nhưng
       nếu sau này cover được đưa sang positioned (bug v3.4.0 từng gây
       che avatar hồ sơ AI) thì positioned element vẽ sau toàn bộ nội dung
       tĩnh. position:relative + z-index:1 ghim hàng avatar/tên luôn TRÊN
       cover ở mọi profile — bulletproof với cả future CSS. */
    position: relative;
    z-index: 1;
    /* v3.7.0 FIX (UI/UX — tương phản): h1 + @username nằm trong vùng
       40px chồng lên ảnh cover (linear-gradient #0f172a — TỐI ở cả 2
       theme). Trước đây chữ màu var(--fg) → light mode = chữ TỐI trên
       nền TỐI, gần như không đọc được (đã nhìn bằng screenshot).

       v3.10.0 FIX (theo yêu cầu chủ sở hữu — "đổ bóng làm chữ quá tối,
       khó nhìn"): BỎ HOÀN TOÀN text-shadow trên tên + @username.
       Bóng đổ rgba(15,23,42,.55) vẽ sau lớp gradient rainbow của
       span.rainbow-text (background-clip:text) làm màu gradient bị
       "bùn"/tối đi trông thấy — đây cũng là nguyên nhân hiệu ứng
       rainbow admin trông xỉn màu. Giữ chữ TRẮNG TINH #ffffff (sáng
       hơn #f8fafc cũ) — vẫn tương phản tối đa trên cover tối, không
       cần bóng hỗ trợ. */

    /* v2.9.1 FIX — trước đây `align-items: flex-end`: khối meta cao bằng
       phần tử cao nhất của hàng nên khi v2.9.0 thêm Level/XP + Huy hiệu
       showcase vào .profile-meta, cột này vươn lên ~300px, làm TÊN HIỂN
       THỊ (h1, nằm ở ĐỈNH meta) bị trôi lên trên đè lên ảnh cover, lệch
       hẳn khỏi avatar trên desktop. flex-start ghim avatar + tên + nút
       hành động cùng đỉnh hàng — tên luôn cạnh avatar bất kể meta cao
       bao nhiêu (đúng kiểu layout hồ sơ X/Twitter). */
    align-items: flex-start;
    flex-wrap: wrap;
}

.profile-meta h1,
.profile-meta .profile-username {
    /* v3.11.0 — tên trắng tinh trên cover tối (62px overlap đảm bảo khối
       tên nằm trọn trên cover — xem comment .profile-info). Mobile
       ≤640px layout cột: tên nằm HOÀN TOÀN dưới cover → màu theme-aware
       (xem override trong media query cuối file). */
    color: #ffffff;
    text-shadow: none;
}

/* v3.11.0 FIX — scrim bảo hiểm cho tên dài xuống 2 dòng: khi h1 wrap,
   dòng 2 + @username có thể tràn khỏi cover. @username được bọc chip
   nền tối bán trong suốt (đọc được trên MỌI nền), còn h1 có text-shadow
   scrim mềm (chỉ hiển thị khi rời khỏi cover — trên cover tối bóng
   đồng màu nên vô hình). Shadow KHÔNG áp cho .rainbow-text (gradient
   background-clip:text sẽ bị "bùn" — lý do v3.10.0 gỡ bóng). */
.profile-meta h1 {
    text-shadow: 0 1px 10px rgba(15, 23, 42, 0.45), 0 0 2px rgba(15, 23, 42, 0.30);
}

.profile-meta h1 .rainbow-text {
    text-shadow: none; /* giữ gradient rainbow tinh khiết */
}

.profile-avatar {
    border: 4px solid var(--bg-canvas);
    border-radius: var(--radius-full);
    background-color: var(--bg-canvas);
    /* Avatar không bị nén thành elip khi hàng thiếu chỗ (flex-shrink mặc
       định = 1 trước đây — hàng hẹp avatar méo, tên vẫn dài). */
    flex-shrink: 0;
}

.profile-avatar .avatar {
    box-shadow: var(--shadow-md);
}

.profile-meta {
    flex: 1;
    min-width: 240px;
    padding-bottom: 16px;
}

.profile-meta h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    /* v2.9.1 FIX — tên dài 1 từ (không khoảng trắng) trước đây tràn ngang
       ra ngoài .profile-meta (flex item ẩn danh có min-width:auto = chiều
       rộng từ dài nhất, không co được). `overflow-wrap: anywhere` hạ
       min-content xuống 1 ký tự → tên dài tự xuống dòng trong khung. */
    overflow-wrap: anywhere;
}

.profile-username {
    font-family: var(--font-mono);
    font-size: 14px;
    color: #ffffff;
    /* v3.11.0 FIX — @username là chip mờ tối: đọc được TRÊN cover tối
       (chip đồng màu ≈ vô hình) lẫn dưới nền sáng/tối khi tên dài làm
       nó trào khỏi cover. Trước đây chữ trắng trần → light mode treo
       dưới cover = mất trắng trên trắng (79% chiều dài). */
    display: inline-block;
    width: fit-content;
    background: rgba(15, 23, 42, 0.52);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 1px 10px;
    margin-top: 4px;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    /* Fallback trình duyệt cũ: nền đặc hơn thay blur */
    .profile-username { background: rgba(15, 23, 42, 0.78); }
}

.profile-role {
    display: inline-flex;
    font-size: 12px;
    font-weight: 600;
    color: var(--fg-muted);
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-full);
    padding: 1px 10px;
    margin-top: 6px;
}

/* ============================================================
   KHUNG CHỨC VỤ HIỆU ỨNG (v2.9.0)
   - Admin (Quản trị viên): CHỮ RAINBOW chạy màu + khung viền
     RAINBOW gradient động (icon lửa đã được BỎ theo yêu cầu —
     badge chỉ còn duy nhất chữ "Quản Trị Viên")
   - Moderator (Điều hành viên): hiệu ứng GLITCH (RGB-split burst
     ngắn mỗi ~2.4s, mượt không chói mắt)
   - Member: badge thường `.profile-role` (không hiệu ứng)
   Bật/tắt trong /profile/edit (checkbox, chỉ hiện với staff) —
   preference `role_badge_effects` (migration 016).
   ============================================================ */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 700;
    border-radius: var(--radius-full);
    padding: 4px 14px;
    margin-top: 6px;
    position: relative;
    isolation: isolate;
    line-height: 1.4;
}

/* --- ADMIN: chữ rainbow + khung viền rainbow (v2.9.0: bỏ lửa;
   v3.10.0: nâng toàn bộ dải màu lên sắc độ 400 sáng rực — bảng cũ
   dùng sắc 500 đậm (#ef4444/#3b82f6…) trông xỉn trên nền tối, ghép
   thêm text-shadow cũ nữa là "tối om". Bảng mới rose→amber→lime→
   emerald→sky→purple đọc rõ và tươi hơn ở CẢ 2 theme.) --- */
.role-badge-admin {
    border: 2px solid transparent;
    background:
        linear-gradient(var(--bg-elevated), var(--bg-elevated)) padding-box,
        linear-gradient(120deg, #fb7185, #fbbf24, #a3e635, #34d399, #38bdf8, #c084fc, #fb7185) border-box;
    background-size: 100% 100%, 320% 100%;
    border-color: transparent;
    background-clip: padding-box, border-box;
    -webkit-background-clip: padding-box, border-box;
    box-shadow:
        0 0 10px rgba(139, 92, 246, 0.22),
        0 0 26px rgba(59, 130, 246, 0.12);
    animation: admin-rainbow-glow 2.4s ease-in-out infinite;
}

/* Chữ rainbow chạy màu mượt */
.role-badge-admin .role-badge-text {
    /* v3.10.0 — bảng gradient sáng (đồng bộ .rainbow-text) */
    background: linear-gradient(90deg, #fb7185, #fbbf24, #a3e635, #34d399, #38bdf8, #c084fc, #fb7185);
    background-size: 320% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    font-weight: 800;
    letter-spacing: 0.02em;
    animation: admin-rainbow-slide 5s linear infinite;
}

@keyframes admin-rainbow-slide {
    0% { background-position: 0% 0; }
    100% { background-position: 320% 0; }
}

/* Glow mềm màu tím/xanh nhấp nháy nhẹ — thay cho glow lửa cũ */
@keyframes admin-rainbow-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(139, 92, 246, 0.22), 0 0 26px rgba(59, 130, 246, 0.12);
    }
    50% {
        box-shadow: 0 0 16px rgba(139, 92, 246, 0.38), 0 0 38px rgba(59, 130, 246, 0.22);
    }
}

/* --- MODERATOR: hiệu ứng Glitch --- */
.role-badge-mod {
    border: 1px solid rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.08);
    color: #60a5fa;
}

.role-badge-mod .role-badge-text {
    position: relative;
    display: inline-block;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* 2 lớp text clone lệch màu cyan/rose — burst ngắn theo chu kỳ */
.role-badge-mod .role-badge-text::before,
.role-badge-mod .role-badge-text::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.role-badge-mod .role-badge-text::before {
    color: #22d3ee;
    clip-path: inset(0 0 55% 0);
    animation: mod-glitch-top 2.4s infinite steps(1);
}

.role-badge-mod .role-badge-text::after {
    color: #f43f5e;
    clip-path: inset(55% 0 0 0);
    animation: mod-glitch-bottom 2.4s infinite steps(1);
}

@keyframes mod-glitch-top {
    0%, 87%, 96%, 100% { transform: translate(0, 0); opacity: 0; }
    88% { transform: translate(-2px, -1px); opacity: 0.9; }
    90% { transform: translate(2px, 1px); opacity: 0.75; }
    92% { transform: translate(-1px, 0); opacity: 0.9; }
    94% { transform: translate(1px, -1px); opacity: 0.8; }
}

@keyframes mod-glitch-bottom {
    0%, 87%, 96%, 100% { transform: translate(0, 0); opacity: 0; }
    89% { transform: translate(2px, 1px); opacity: 0.9; }
    91% { transform: translate(-2px, -1px); opacity: 0.75; }
    93% { transform: translate(1px, 0); opacity: 0.9; }
    95% { transform: translate(-1px, 1px); opacity: 0.8; }
}

/* Tôn trọng người dùng nhạy cảm chuyển động (a11y): tắt toàn bộ animation,
   badge về trạng thái tĩnh — admin vẫn giữ chữ rainbow gradient (tĩnh),
   mod mất glitch burst nhưng text gốc hiển thị bình thường. */
@media (prefers-reduced-motion: reduce) {
    .role-badge-admin,
    .role-badge-admin .role-badge-text,
    .role-badge-mod .role-badge-text::before,
    .role-badge-mod .role-badge-text::after,
    .rainbow-text,
    .profile-page-mod-effects,
    .profile-page-mod-effects::before,
    .profile-page-mod-effects .profile-meta h1,
    .profile-page-mod-effects .profile-cover {
        animation: none !important;
    }
}

/* ============================================================
   v2.8.0 — HIỆU ỨNG HỒ SƠ ĐƠN GIẢN HOÁ
   Trước đây (v2.6.0) hiệu ứng áp cho TOÀN BỘ `.profile-page`:
   viền lửa quanh section, glow nhấp nháy cả trang, cover gradient
   động, avatar glow cam dày — lớp phủ này CHE MẤT ảnh đại diện và
   tràn ra toàn trang. Theo yêu cầu: admin chỉ giữ ĐÚNG 2 hiệu ứng
   rainbow: (1) khung chức vụ `.role-badge-admin` (block phía trên)
   và (2) chữ rainbow tên `.rainbow-text` (block dưới đây).
   Mod giữ nguyên glitch `profile-page-mod-effects` (block sau).
   ============================================================ */

/* Chữ rainbow chạy màu cho display_name của admin.
   ⚠️ PHẢI áp trên span con của h1, KHÔNG áp trên chính h1:
   h1 có `display: flex` — text node là anonymous flex item,
   `background-clip: text` không tô màu chữ trong trường hợp này
   → chữ biến mất hoàn toàn (bug thật trên prod v2.6.0–v2.7.0).
   Span inline con của flex container thì background-clip: text
   hoạt động đúng (đã kiểm chứng qua `.role-badge-text`). */
.rainbow-text {
    background: linear-gradient(90deg, #fb7185, #fbbf24, #a3e635, #34d399, #38bdf8, #c084fc, #fb7185);
    background-size: 320% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: admin-rainbow-slide 5s linear infinite;
}

/* Nhắc trình duyệt giữ nền gradient khi in trang (in/preview PDF:
   -webkit-text-fill-color transparent + nền bị bỏ → chữ trắng trên
   giấy trắng). Chromium không in background mặc định — span vẫn
   hiện màu đầu gradient nhờ color:transparent được override ở đây. */
@media print {
    .rainbow-text {
        background: none;
        -webkit-text-fill-color: #fb7185;
        color: #fb7185;
    }
}

/* --- MODERATOR: glitch burst ngắn trên display_name + viền xanh nhấp nháy --- */
.profile-page-mod-effects {
    position: relative;
    border-radius: var(--radius-xl);
}

/* Viền xanh nhấp nháy nhẹ quanh profile-page (không chói như admin) */
.profile-page-mod-effects::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(59, 130, 246, 0.30);
    background: linear-gradient(120deg, rgba(59, 130, 246, 0.04), rgba(34, 211, 238, 0.05));
    pointer-events: none;
    z-index: 0;
    animation: mod-page-border-glow 3s ease-in-out infinite;
}

@keyframes mod-page-border-glow {
    0%, 100% {
        border-color: rgba(59, 130, 246, 0.30);
        box-shadow: 0 0 8px rgba(59, 130, 246, 0.10);
    }
    50% {
        border-color: rgba(96, 165, 250, 0.55);
        box-shadow: 0 0 18px rgba(59, 130, 246, 0.20);
    }
}

.profile-page-mod-effects > * {
    position: relative;
    z-index: 1;
}

/* Glitch burst cho display_name — sử dụng ::before/::after clones
   lệch màu cyan/rose, burst ngắn theo chu kỳ 2.4s.
   Content được lấy từ `data-text` attribute trên h1 (set bởi template
   khi mod bật effects) — pure CSS, không cần JS. */
.profile-page-mod-effects .profile-meta h1 {
    position: relative;
    color: #60a5fa;
}

.profile-page-mod-effects .profile-meta h1::before,
.profile-page-mod-effects .profile-meta h1::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.profile-page-mod-effects .profile-meta h1::before {
    color: #22d3ee;
    clip-path: inset(0 0 55% 0);
    animation: mod-glitch-top 2.4s infinite steps(1);
}

.profile-page-mod-effects .profile-meta h1::after {
    color: #f43f5e;
    clip-path: inset(55% 0 0 0);
    animation: mod-glitch-bottom 2.4s infinite steps(1);
}

/* Cover xanh gradient */
.profile-page-mod-effects .profile-cover {
    background:
        radial-gradient(600px 200px at 20% 0%, rgba(59, 130, 246, 0.35), transparent 60%),
        radial-gradient(500px 200px at 80% 100%, rgba(34, 211, 238, 0.28), transparent 60%),
        linear-gradient(120deg, #0a0f1a, #1e293b);
}

.profile-page-mod-effects .profile-avatar img,
.profile-page-mod-effects .profile-avatar .avatar-fallback {
    box-shadow:
        0 0 0 3px rgba(59, 130, 246, 0.35),
        0 0 14px rgba(59, 130, 246, 0.30);
}

.profile-bio {
    font-size: 14px;
    line-height: 1.6;
    color: var(--fg-default);
    margin-top: 10px;
    max-width: 560px;
}

.profile-joined {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--fg-subtle);
    margin-top: 8px;
}

.profile-actions {
    display: flex;
    gap: 10px;
    padding-bottom: 16px;
    /* v2.9.1 — giữ nút Theo dõi/Chỉnh sửa ở ĐÁY hàng (canh phải như cũ)
       khi .profile-info chuyển sang align-items: flex-start. */
    align-self: flex-end;
    margin-left: auto;
}

.profile-stats {
    display: flex;
    gap: 28px;
    padding: 14px 24px;
    border-top: 1px solid var(--border-muted);
}

.profile-stat {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.profile-stat .stat-value {
    font-family: var(--font-mono);
    font-size: 17px;
    font-weight: 700;
}

.profile-stat .stat-label {
    font-size: 13px;
    color: var(--fg-muted);
}

/* AI profile info */
.ai-profile-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    padding: 12px;
    background-color: var(--bg-subtle);
    border-radius: var(--radius-md);
}

.ai-meta-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
}

.ai-meta-label {
    font-weight: 600;
    color: var(--fg-muted);
}

.ai-anonymous-note {
    color: var(--fg-subtle);
    font-style: italic;
}

/* Tabs — GitHub UnderlineNav */
.profile-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-muted);
    overflow-x: auto;
}

.profile-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--fg-muted);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.profile-tab:hover {
    color: var(--fg-default);
}

.profile-tab.active {
    color: var(--fg-default);
    font-weight: 600;
    border-bottom-color: var(--btn-primary-bg);
}

/* ============================================================
   20. AUTH PAGES
   ============================================================ */
.auth-section {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 0;
    min-height: 60vh;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 36px 32px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.auth-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.auth-header h1 {
    font-size: 22px;
    font-weight: 750;
    letter-spacing: -0.02em;
}

.auth-header p {
    font-size: 14px;
    line-height: 1.55;
    color: var(--fg-muted);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0;
    color: var(--fg-subtle);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: var(--border-muted);
}

.auth-features {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
    margin-bottom: 24px;
}

.auth-feature {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    font-size: 18px;
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.auth-feature strong {
    display: block;
    font-size: 14px;
    font-weight: 650;
}

.auth-feature p {
    font-size: 13px;
    color: var(--fg-muted);
    line-height: 1.5;
}

.auth-footer {
    font-size: 12px;
    line-height: 1.6;
    color: var(--fg-subtle);
    margin-top: 20px;
}

.ai-login-form {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============================================================
   21. FORMS & UPLOAD
   GitHub form spec: label 14/600, control radius 8, focus ring.
   ============================================================ */
.form-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-section {
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 650;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-muted);
}

.form-section-title svg {
    color: var(--accent);
}

.form-section-desc {
    font-size: 13px;
    color: var(--fg-muted);
    margin: -8px 0 18px;
    line-height: 1.55;
}

.form-group {
    margin-bottom: 18px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--fg-default);
}

.required {
    color: var(--danger);
    font-weight: 700;
}

.req {
    color: var(--danger);
    font-weight: 700;
}

.form-control {
    display: block;
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--fg-default);
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control::placeholder {
    color: var(--fg-subtle);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23818b98' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

.form-control-editor,
.editor {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    min-height: 200px;
}

.form-hint,
.hint {
    display: block;
    font-size: 12px;
    line-height: 1.5;
    color: var(--fg-subtle);
    margin-top: 6px;
}

.form-hint code,
.hint code {
    font-size: 11px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 14px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--btn-primary-bg);
    cursor: pointer;
}

.form-errors {
    background-color: var(--danger-subtle);
    border: 1px solid var(--danger);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 20px;
    color: var(--danger);
}

.form-errors h3 {
    font-size: 14px;
    font-weight: 650;
    margin-bottom: 8px;
}

.form-errors ul {
    padding-left: 20px;
    font-size: 13px;
    line-height: 1.6;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 8px;
}

.warning {
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--warning);
    background-color: var(--warning-subtle);
    border-radius: var(--radius-md);
}

blockquote {
    margin: 12px 0;
    padding: 8px 16px;
    border-left: 3px solid var(--border-default);
    color: var(--fg-muted);
    font-size: 13px;
    background-color: var(--bg-subtle);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* Upload zone */
.upload-zone {
    border: 1.5px dashed var(--border-default);
    border-radius: var(--radius-lg);
    padding: 16px;
    background-color: var(--bg-canvas);
    transition: border-color var(--transition-fast);
}

.upload-zone:hover {
    border-color: var(--accent);
}

.upload-preview-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.upload-preview-cover {
    width: 180px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
    background-color: var(--bg-subtle);
}

.upload-preview-avatar {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-full);
    background-color: var(--bg-subtle);
}

.upload-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.upload-status {
    font-size: 13px;
    font-weight: 550;
    min-height: 20px;
}

.upload-status.error { color: var(--danger); }
.upload-status.success { color: var(--success); }
.upload-status.progress { color: var(--accent); }

/* Compact form (news/repos) */
.compact-form-page {
    max-width: 720px;
    margin-inline: auto;
}

.compact-help-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.compact-help-card {
    display: flex;
    gap: 10px;
    padding: 12px;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
    font-size: 12px;
    line-height: 1.5;
    color: var(--fg-muted);
}

.compact-help-card .help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.compact-help-card strong {
    display: block;
    color: var(--fg-default);
}

.compact-form-card {
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.field-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.field-group input,
.field-group select,
.field-group textarea {
    display: block;
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--fg-default);
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.field-group textarea {
    min-height: 80px;
    resize: vertical;
}

.field-group .hint {
    margin-top: 6px;
}

.field-optional {
    font-size: 11px;
    font-weight: 500;
    color: var(--fg-subtle);
}

.source-block,
.source-fieldset {
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
    padding: 16px;
}

.source-block legend,
.source-fieldset legend {
    font-size: 13px;
    font-weight: 650;
    padding: 0 8px;
}

.compact-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid var(--border-muted);
}

.form-actions-right {
    display: flex;
    gap: 10px;
}

.form-actions-left {
    display: flex;
    gap: 10px;
}

.compact-form-tip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--fg-subtle);
}

.dup-warning {
    padding: 10px 14px;
    margin-top: 10px;
    font-size: 13px;
    color: var(--warning);
    background-color: var(--warning-subtle);
    border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
    border-radius: var(--radius-md);
}

/* Search filters bar */
.search-filters,
.news-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 16px;
    margin-bottom: 24px;
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
}

.search-filters .filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--fg-muted);
}

.search-filters .form-control {
    width: auto;
    min-width: 140px;
}

.news-filters input[type="text"] {
    flex: 1;
    min-width: 200px;
    min-height: 36px;
    padding: 6px 12px;
    font-size: 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background-color: var(--bg-canvas);
    color: var(--fg-default);
}

.news-filters input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.news-filters select {
    min-height: 36px;
    padding: 6px 32px 6px 10px;
    font-size: 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background-color: var(--bg-canvas);
    color: var(--fg-default);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23818b98' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}

/* Search suggest dropdown */
.search-suggest {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: var(--z-modal);
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-height: 320px;
    overflow-y: auto;
}

.search-suggest-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--fg-default);
}

.search-suggest-item:hover {
    background-color: var(--bg-subtle);
    color: var(--fg-default);
}

/* ============================================================
   22. TABLES — GitHub style: thead mono uppercase, row hover
   ============================================================ */
.admin-table-wrap {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    background-color: var(--bg-canvas);
    margin-bottom: 20px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th {
    padding: 10px 16px;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fg-muted);
    background-color: var(--bg-subtle);
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
}

.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-muted);
    vertical-align: middle;
}

.admin-table tbody tr:last-child td {
    border-bottom: 0;
}

.admin-table tbody tr {
    transition: background-color var(--transition-fast);
}

.admin-table tbody tr:hover {
    background-color: var(--bg-subtle);
}

.admin-table a {
    font-weight: 550;
}

.admin-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-actions form {
    display: inline-flex;
}

.admin-actions .btn {
    flex-shrink: 0;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-cell small {
    color: var(--fg-subtle);
}

.input-wide {
    width: 100%;
    min-height: 34px;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background-color: var(--bg-canvas);
    color: var(--fg-default);
}

.input-wide:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.ua-truncate {
    display: inline-block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
    font-size: 12px;
}

/* ============================================================
   23. ADMIN
   ============================================================ */
.admin-page {
    max-width: 1100px;
    margin-inline: auto;
}

/* Admin nav — GitHub UnderlineNav */
.admin-nav {
    display: flex;
    gap: 2px;
    margin-bottom: 24px;
    padding-bottom: 0;
    border-bottom: 1px solid var(--border-muted);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.admin-nav::-webkit-scrollbar {
    display: none;
}

.admin-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 42px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--fg-muted);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.admin-nav-link:hover {
    color: var(--fg-default);
}

.admin-nav-link.active {
    color: var(--fg-default);
    font-weight: 600;
    border-bottom-color: var(--btn-primary-bg);
}

.admin-nav-link svg {
    color: var(--fg-subtle);
}

.admin-nav-link.active svg,
.admin-nav-link:hover svg {
    color: var(--accent);
}

/* Stats grid — Vercel dashboard cards */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.admin-stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.admin-stat-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    font-size: 20px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.stat-icon-wrap.purple { color: var(--done); background-color: var(--done-subtle); }
.stat-icon-wrap.blue   { color: var(--accent); background-color: var(--accent-subtle); }
.stat-icon-wrap.green  { color: var(--success); background-color: var(--success-subtle); }
.stat-icon-wrap.yellow { color: var(--warning); background-color: var(--warning-subtle); }
.stat-icon-wrap.red    { color: var(--danger); background-color: var(--danger-subtle); }

.admin-stat-card .stat-value {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

.admin-stat-card .stat-label {
    font-size: 12.5px;
    color: var(--fg-muted);
    line-height: 1.35;
}

/* Admin section card */
.admin-section {
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.admin-section .section-header {
    margin-bottom: 16px;
}

.admin-section .section-header h2 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 650;
}

.admin-two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

/* v3.16.1 FIX (tràn dashboard "Game/Bình luận gần đây"): grid/flex item mặc
   định min-width:auto nên tiêu đề/bình luận dài không dấu cách (URL, spam)
   ép cột rộng hơn container. minmax(0,1fr) + min-width:0 cho phép co lại,
   overflow-wrap bẻ chuỗi dài — giao diện giữ nguyên khi nội dung ngắn. */
.admin-two-col > section {
    min-width: 0;
}

/* Admin lists */
.admin-games-list,
.reports-list {
    display: flex;
    flex-direction: column;
}

.admin-game-row,
.report-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-muted);
    flex-wrap: wrap;
}

.admin-game-row:last-child,
.report-row:last-child {
    border-bottom: 0;
}

.admin-game-row a {
    font-weight: 550;
    /* v3.16.1 FIX (tràn): link co được trong flex row + bẻ chuỗi dài. */
    min-width: 0;
    overflow-wrap: anywhere;
}

.game-meta {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--fg-muted);
    white-space: nowrap;
}

.report-info {
    min-width: 240px;
    flex: 1;
}

.report-game-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--fg-default);
}

.report-game-title:hover {
    color: var(--accent);
}

.report-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
    font-size: 12px;
    color: var(--fg-subtle);
}

.report-reason {
    color: var(--fg-muted);
    font-weight: 550;
}

.report-desc {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--fg-muted);
    padding: 8px 12px;
    background-color: var(--bg-subtle);
    border-radius: var(--radius-sm);
}

.report-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Chip row + filter chips */
.admin-chip-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.admin-filter-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* Search form trong admin */
.admin-search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.admin-search-form input {
    flex: 1;
    min-height: 38px;
    padding: 8px 14px;
    font-size: 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background-color: var(--bg-canvas);
    color: var(--fg-default);
}

.admin-search-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

/* Role form select trong bảng user */
.role-form select {
    min-height: 32px;
    font-size: 13px;
    padding: 4px 28px 4px 8px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background-color: var(--bg-canvas);
    color: var(--fg-default);
    cursor: pointer;
}

/* Settings form */
.admin-settings-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.admin-settings-form label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    margin: 12px 0 6px;
}

.admin-settings-form input:not([type="checkbox"]):not([type="radio"]),
.admin-settings-form textarea,
.admin-settings-form select {
    display: block;
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background-color: var(--bg-canvas);
    color: var(--fg-default);
}

.admin-settings-form input:focus,
.admin-settings-form textarea:focus,
.admin-settings-form select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.admin-settings-form .btn {
    margin-top: 20px;
    align-self: flex-start;
}

.admin-form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.admin-form-row input {
    flex: 1;
    min-width: 160px;
    min-height: 38px;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background-color: var(--bg-canvas);
    color: var(--fg-default);
}

.admin-form-row input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.admin-form-row label {
    font-size: 13.5px;
    font-weight: 600;
    width: 100%;
    margin-top: 8px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    margin: 10px 0;
    cursor: pointer;
}

.checkbox-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--btn-primary-bg);
}

/* Chart — bar chart thuần CSS */
.admin-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    height: 160px;
    padding: 8px 0;
}

.chart-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    height: 100%;
    justify-content: flex-end;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 100%;
    width: 100%;
    justify-content: center;
}

.chart-bar {
    width: 14px;
    border-radius: 4px 4px 0 0;
    min-height: 2px;
    transition: height var(--transition-slow);
}

.chart-bar.views {
    background: linear-gradient(180deg, var(--accent), var(--btn-primary-active));
}

.chart-bar.downloads {
    background: linear-gradient(180deg, var(--success-emphasis), var(--success));
}

.chart-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--fg-subtle);
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--fg-muted);
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chart-legend .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.chart-legend .dot.views { background-color: var(--accent); }
.chart-legend .dot.downloads { background-color: var(--success-emphasis); }

/* Admin news queue */
.admin-news-queue {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-news-item {
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.admin-news-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.admin-news-header h3 {
    flex: 1;
    font-size: 16px;
    font-weight: 650;
    min-width: 200px;
}

.admin-news-body .excerpt {
    font-size: 14px;
    color: var(--fg-muted);
    margin-bottom: 10px;
}

.admin-news-body details {
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    background-color: var(--bg-subtle);
}

.admin-news-body summary {
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--accent);
}

.admin-news-author {
    font-size: 13px;
    color: var(--fg-muted);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-muted);
    line-height: 1.8;
}

.admin-news-action {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.admin-news-action input {
    flex: 1;
    min-width: 200px;
    min-height: 34px;
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background-color: var(--bg-canvas);
    color: var(--fg-default);
}

/* Admin tabs (news pending/all) */
.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.admin-tabs .tab {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--fg-muted);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    background-color: var(--bg-canvas);
    transition: all var(--transition-fast);
}

.admin-tabs .tab:hover {
    color: var(--fg-default);
    background-color: var(--bg-subtle);
}

.admin-tabs .tab.active {
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-color: var(--accent);
    font-weight: 600;
}

/* User detail */
.user-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.user-detail-card {
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.user-detail-card h2 {
    font-size: 15px;
    font-weight: 650;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-muted);
}

.user-detail-card h3 {
    font-size: 13px;
    font-weight: 650;
    color: var(--fg-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 16px 0 8px;
}

.user-detail-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 6px 0;
    font-size: 13.5px;
}

.user-detail-row strong {
    min-width: 110px;
    color: var(--fg-muted);
    font-weight: 600;
}

/* AI agent rows */
.ai-agent-row,
.ai-report-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-muted);
    flex-wrap: wrap;
}

.ai-agent-row:last-child,
.ai-report-row:last-child {
    border-bottom: 0;
}

.ai-agent-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 260px;
    flex: 1;
}

.ai-agent-name {
    font-size: 14px;
    font-weight: 650;
    color: var(--fg-default);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ai-agent-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
    font-size: 12px;
    color: var(--fg-muted);
}

.ai-agent-caps {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.ai-agent-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--fg-subtle);
    flex-wrap: wrap;
}

.ai-verified {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background-color: var(--btn-primary-bg);
    border-radius: var(--radius-full);
}

/* AI reports */
.ai-reports-list {
    display: flex;
    flex-direction: column;
}

.ai-report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.ai-report-agent {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ai-report-time {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--fg-subtle);
}

.ai-report-body {
    flex: 1;
    min-width: 260px;
}

.ai-report-task {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 14px;
}

.ai-task-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--fg-subtle);
}

.ai-task-value {
    font-family: var(--font-mono);
    font-weight: 550;
}

.ai-action-label {
    font-size: 13px;
    color: var(--accent);
}

.ai-report-message {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--fg-muted);
}

.ai-report-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.ai-progress-bar-wrap {
    flex: 1;
    min-width: 140px;
    height: 8px;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.ai-progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.ai-progress-pct {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 650;
}

.ai-status-badge {
    font-size: 12px;
    font-weight: 650;
}

.ai-reports-hint {
    margin-top: 20px;
    font-size: 13px;
    color: var(--fg-muted);
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

.ai-profile-note {
    margin-top: 24px;
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.ai-profile-note h3 {
    font-size: 14px;
    font-weight: 650;
    margin-bottom: 10px;
}

.ai-profile-note ul {
    padding-left: 20px;
    font-size: 13.5px;
    color: var(--fg-muted);
    line-height: 1.8;
}

.admin-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}

.admin-checkbox input {
    width: 15px;
    height: 15px;
    accent-color: var(--btn-primary-bg);
}

/* Alert zones (inline result) */
.alert-zone {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    min-height: 20px;
}

.pin-zone {
    display: inline-block;
    min-height: 20px;
}

/* ============================================================
   24. NOTIFICATIONS — X notifications style
   ============================================================ */
.notifications-page {
    max-width: 720px;
    margin-inline: auto;
}

.notifications-list {
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.notification-item {
    /* v2.9.2 — flex row: <a> chiếm phần còn lại, button "đã đọc" là sibling
       (trước đây button lồng trong <a> — HTML invalid, đã tách ra). */
    display: flex;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-muted);
}

.notification-item:last-child {
    border-bottom: 0;
}

.notification-item.unread {
    position: relative;
    background-color: var(--accent-subtle);
}

.notification-item.unread::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--btn-primary-bg);
}

.notification-link {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    /* v2.9.2 — link chiếm hết chiều rộng còn lại của item flex (button
       "đã đọc" nằm ngoài link). min-width:0 giữ ellipsis của notif-body. */
    flex: 1;
    min-width: 0;
    color: inherit;
    transition: background-color var(--transition-fast);
}

.notification-link:hover {
    color: inherit;
    background-color: var(--bg-subtle);
}

.notif-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 18px;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.notif-body {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.notif-content {
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--fg-muted);
    overflow-wrap: anywhere;
}

.notif-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--fg-subtle);
}

.notif-type {
    font-weight: 600;
    color: var(--accent);
}

.notif-time {
    font-family: var(--font-mono);
}

.notif-mark-read {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 14px;
    color: var(--fg-muted);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    background-color: var(--bg-canvas);
    flex-shrink: 0;
    transition: all var(--transition-fast);
    /* v2.9.2 — canh với padding 16px của link, chừa lề phải 16px. */
    margin: 16px 16px 16px 0;
    cursor: pointer;
}

.notif-mark-read:hover {
    color: var(--success);
    border-color: var(--success);
    background-color: var(--success-subtle);
}

/* ============================================================
   25. REPOS — GitHub repo list style
   ============================================================ */
.repos-page {
    max-width: 1000px;
    margin-inline: auto;
}

.repos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.repo-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.repo-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.repo-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.repo-card-head svg {
    color: var(--fg-muted);
    flex-shrink: 0;
}

.repo-name {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 650;
    color: var(--accent);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.repo-name:hover {
    text-decoration: underline;
}

.repo-desc {
    font-size: 13px;
    line-height: 1.55;
    color: var(--fg-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 20px;
}

.repo-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--fg-muted);
}

.repo-lang {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 550;
}

.lang-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), var(--done));
}

.repo-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-muted);
    font-size: 13px;
}

.repo-author {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--fg-muted);
    min-width: 0;
}

.repo-author:hover {
    color: var(--fg-default);
}

.repo-author span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.repo-link-game {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-radius: var(--radius-full);
    padding: 3px 10px;
    white-space: nowrap;
}

.repo-link-game:hover {
    background-color: var(--accent);
    color: #fff;
}

/* ============================================================
   26. LIVE CHAT — bubbles kiểu X DM
   ============================================================ */
.live-chat-section {
    margin-bottom: 32px;
}

.live-chat-card {
    display: flex;
    flex-direction: column;
    height: 520px;
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.live-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-muted);
    background-color: var(--bg-subtle);
    flex-wrap: wrap;
}

.live-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.live-chat-title .section-title {
    font-size: 16px;
    margin: 0;
}

.live-chat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-radius: var(--radius-md);
}

.live-chat-presence {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--success);
    background-color: var(--success-subtle);
    border-radius: var(--radius-full);
    padding: 3px 12px;
}

.presence-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: var(--radius-full);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(47, 158, 68, 0.5); }
    50% { box-shadow: 0 0 0 5px rgba(47, 158, 68, 0); }
}

.live-chat-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.live-chat-today {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--fg-subtle);
}

.live-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: var(--bg-canvas);
}

.chat-loading {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 24px;
}

.chat-loading-dot {
    width: 8px;
    height: 8px;
    background-color: var(--fg-subtle);
    border-radius: var(--radius-full);
    animation: chat-bounce 1.4s infinite ease-in-out both;
}

.chat-loading-dot:nth-child(1) { animation-delay: -0.32s; }
.chat-loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes chat-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Chat message bubble */
.chat-msg {
    display: flex;
    gap: 10px;
    max-width: 88%;
    animation: msg-in var(--transition-base) ease-out;
}

@keyframes msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-msg-own {
    flex-direction: row-reverse;
    align-self: flex-end;
}

.chat-msg-avatar {
    flex-shrink: 0;
}

.chat-msg-bubble {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    min-width: 0;
}

.chat-msg-own .chat-msg-bubble {
    background-color: var(--btn-primary-bg);
    border-color: var(--btn-primary-bg);
    color: #fff;
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 4px;
}

.chat-msg-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.chat-msg-author {
    font-size: 12.5px;
    font-weight: 650;
}

.chat-msg-own .chat-msg-author {
    color: rgba(255, 255, 255, 0.92);
}

a.chat-msg-author {
    color: var(--accent);
}

.chat-msg-own a.chat-msg-author {
    color: rgba(255, 255, 255, 0.92);
}

.chat-msg-time {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--fg-subtle);
}

.chat-msg-own .chat-msg-time {
    color: rgba(255, 255, 255, 0.7);
}

.chat-msg-content {
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.chat-msg-deleted {
    font-size: 13px;
    font-style: italic;
    color: var(--fg-subtle);
}

.chat-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--fg-muted);
    font-size: 14px;
}

/* Input bar */
.live-chat-input-bar {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-muted);
    background-color: var(--bg-subtle);
}

.live-chat-input-bar input {
    flex: 1;
    min-height: 40px;
    padding: 8px 16px;
    font-size: 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    background-color: var(--bg-canvas);
    color: var(--fg-default);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.live-chat-input-bar input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.live-chat-input-bar input:disabled {
    opacity: 0.6;
}

.live-chat-hint {
    padding: 8px 16px 12px;
    font-size: 12px;
    color: var(--fg-subtle);
    background-color: var(--bg-subtle);
    text-align: center;
}

.live-chat-hint.chat-error {
    color: var(--danger);
}

/* ============================================================
   27. MODAL / TOAST / ALERT / ANNOUNCEMENT
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background-color: var(--bg-overlay);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: fade-in var(--transition-fast) ease-out;
}

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal {
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    animation: modal-pop var(--transition-base) cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-muted);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 650;
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 18px;
    color: var(--fg-muted);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    color: var(--fg-default);
    background-color: var(--bg-subtle);
}

.modal-body {
    padding: 20px;
}

.modal-desc {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--fg-muted);
    margin-bottom: 16px;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(360px, calc(100vw - 40px));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--fg-default);
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toast-in var(--transition-base) cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-out {
    animation: toast-out var(--transition-fast) ease-in forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(8px); }
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--accent); }
.toast-warning { border-left: 3px solid var(--warning); }

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    border-radius: var(--radius-md);
    border: 1px solid;
}

.alert-success {
    color: var(--success);
    background-color: var(--success-subtle);
    border-color: color-mix(in srgb, var(--success) 35%, transparent);
}

.alert-danger {
    color: var(--danger);
    background-color: var(--danger-subtle);
    border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}

.alert-warning {
    color: var(--warning);
    background-color: var(--warning-subtle);
    border-color: color-mix(in srgb, var(--warning) 35%, transparent);
}

/* Announcement banner toàn site */
.site-announcement {
    margin-top: 12px;
}

.announcement-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid;
    border-radius: var(--radius-md);
}

.announcement-banner.info {
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.announcement-banner.success {
    color: var(--success);
    background-color: var(--success-subtle);
    border-color: color-mix(in srgb, var(--success) 30%, transparent);
}

.announcement-banner.warning {
    color: var(--warning);
    background-color: var(--warning-subtle);
    border-color: color-mix(in srgb, var(--warning) 30%, transparent);
}

.announcement-banner.danger {
    color: var(--danger);
    background-color: var(--danger-subtle);
    border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.ann-text {
    flex: 1;
    line-height: 1.5;
}

.announcement-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    font-size: 16px;
    color: inherit;
    opacity: 0.7;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    transition: opacity var(--transition-fast), background-color var(--transition-fast);
}

.announcement-close:hover {
    opacity: 1;
    background-color: color-mix(in srgb, currentColor 12%, transparent);
}

/* ============================================================
   28. PAGINATION — GitHub pagination
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.page-link,
.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 550;
    color: var(--fg-default);
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.page-link:hover,
.pagination-link:hover {
    background-color: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
}

.page-link.current {
    color: var(--accent);
    background-color: var(--accent-subtle);
    border-color: var(--accent);
    font-weight: 650;
    cursor: default;
}

.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 36px;
    color: var(--fg-subtle);
}

.pagination-info {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--fg-muted);
    padding: 0 8px;
}

/* ============================================================
   29. EMPTY & ERROR STATES
   ============================================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 56px 24px;
    text-align: center;
    background-color: var(--bg-canvas);
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-lg);
}

.empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    font-size: 30px;
    color: var(--fg-subtle);
    background-color: var(--bg-subtle);
    border-radius: var(--radius-full);
    margin-bottom: 4px;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 650;
}

.empty-state p {
    font-size: 14px;
    color: var(--fg-muted);
    max-width: 420px;
    line-height: 1.55;
}

.empty-state .btn {
    margin-top: 8px;
}

/* Error partial (HTMX swap) */
.error-partial {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px;
    text-align: center;
    background-color: var(--danger-subtle);
    border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
    border-radius: var(--radius-lg);
}

.error-partial .error-icon {
    font-size: 26px;
}

.error-partial .error-message {
    font-size: 14px;
    font-weight: 550;
    color: var(--danger);
}

.error-partial small {
    font-size: 12px;
    color: var(--fg-muted);
}

.error-partial .error-request-id code {
    font-size: 12px;
}

/* Error page (404/500 full page) */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background-color: var(--bg-canvas);
}

.error-content {
    text-align: center;
    max-width: 480px;
}

.error-code {
    font-family: var(--font-mono);
    font-size: clamp(64px, 14vw, 96px);
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--accent), var(--done));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.error-content h1 {
    font-size: 24px;
    font-weight: 750;
    margin-bottom: 8px;
}

.error-content > p {
    font-size: 15px;
    color: var(--fg-muted);
    margin-bottom: 20px;
    line-height: 1.6;
}

.error-search {
    margin-bottom: 16px;
}

/* ============================================================
   30. STATIC PAGES & PROSE
   ============================================================ */
.static-page {
    max-width: 760px;
    margin-inline: auto;
}

.static-content {
    padding: 28px;
}

.static-content .section-heading {
    font-size: 16px;
}

.static-content p {
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--fg-muted);
    margin-bottom: 12px;
}

.static-back {
    margin-top: 24px;
}

/* Prose — nội dung article render từ markdown (filter |html) */
.prose {
    max-width: 720px;
}

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.3;
    margin: 28px 0 12px;
}

.prose h1 { font-size: 26px; }
.prose h2 { font-size: 21px; padding-bottom: 8px; border-bottom: 1px solid var(--border-muted); }
.prose h3 { font-size: 17px; }
.prose h4 { font-size: 15px; }

.prose p {
    margin: 14px 0;
    line-height: 1.75;
}

.prose a {
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
    text-underline-offset: 3px;
}

.prose a:hover {
    text-decoration-color: var(--accent);
}

.prose strong {
    font-weight: 650;
}

.prose ul, .prose ol {
    padding-left: 24px;
    margin: 14px 0;
}

.prose li {
    margin: 6px 0;
    line-height: 1.7;
}

.prose img {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-muted);
    margin: 16px 0;
}

.prose blockquote {
    margin: 16px 0;
    padding: 10px 18px;
    border-left: 3px solid var(--accent);
    background-color: var(--bg-subtle);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--fg-muted);
}

.prose hr {
    margin: 28px 0;
}

/* News show page */
.news-show {
    max-width: 760px;
    margin-inline: auto;
}

.news-show-header {
    margin-bottom: 20px;
}

.news-show-header h1 {
    font-size: clamp(1.5rem, 3.5vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.25;
    margin: 12px 0;
}

.news-show-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.news-author {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--fg-default);
}

.news-author:hover {
    color: var(--accent);
}

.meta-divider {
    color: var(--border-strong);
}

.news-show-cover {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-muted);
    margin-bottom: 20px;
}

.news-show-excerpt {
    font-size: 16px;
    line-height: 1.65;
    color: var(--fg-muted);
    padding: 16px 20px;
    margin-bottom: 20px;
    background-color: var(--bg-subtle);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.news-show-content {
    margin-bottom: 24px;
}

.news-source {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--fg-muted);
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-bottom: 20px;
}

.news-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 0;
    margin-bottom: 8px;
    border-top: 1px solid var(--border-muted);
    border-bottom: 1px solid var(--border-muted);
}

.news-comments {
    margin-top: 24px;
}

.news-comments h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 16px;
}

/* My news list */
.my-news-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.my-news-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    background-color: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.my-news-item:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.my-news-info h3 {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}

.my-news-info h3 a {
    color: var(--fg-default);
}

.my-news-info h3 a:hover {
    color: var(--accent);
}

.my-news-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.my-news-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ============================================================
   31. FOOTER
   ============================================================ */
.site-footer {
    border-top: 1px solid var(--border-muted);
    background-color: var(--bg-subtle);
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 32px;
    padding: 44px 0 32px;
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--fg-default);
    margin-bottom: 12px;
}

.footer-col > p {
    font-size: 13px;
    line-height: 1.65;
    color: var(--fg-muted);
    max-width: 320px;
}

.footer-col h4 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--fg-subtle);
    margin-bottom: 14px;
}

.footer-col a {
    display: block;
    font-size: 14px;
    color: var(--fg-muted);
    padding: 4px 0;
    transition: color var(--transition-fast);
}

.footer-col a:hover {
    color: var(--accent);
}

.footer-bottom {
    padding: 18px 0;
    border-top: 1px solid var(--border-muted);
    text-align: center;
}

.footer-bottom p {
    font-size: 13px;
    color: var(--fg-subtle);
}

/* ============================================================
   32. ANIMATIONS & MICRO-INTERACTIONS
   ============================================================ */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.content-section {
    animation: fade-up 0.4s ease-out backwards;
}

.content-section:nth-child(2) { animation-delay: 0.05s; }
.content-section:nth-child(3) { animation-delay: 0.1s; }
.content-section:nth-child(4) { animation-delay: 0.15s; }

/* ============================================================
   33. HTMX LOADING STATES
   ============================================================ */
.htmx-indicator {
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    opacity: 1;
}

/* Spinner cho HTMX request */
.htmx-request .btn {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.htmx-request .btn::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: var(--radius-full);
    animation: spin 0.7s linear infinite;
}

.btn-outline.htmx-request::after,
.btn-ghost.htmx-request::after,
.btn-default.htmx-request::after,
.action-btn.htmx-request::after {
    border-color: color-mix(in srgb, var(--fg-muted) 35%, transparent);
    border-top-color: var(--fg-muted);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Progress bar mỏng dưới header khi HTMX request đang chạy */
#htmx-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: calc(var(--z-header) + 1);
    background: linear-gradient(90deg, var(--accent), var(--done));
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 0.3s ease, opacity 0.2s ease;
    pointer-events: none;
}

#htmx-progress.active {
    transform: scaleX(0.7);
}

#htmx-progress.done {
    transform: scaleX(1);
    opacity: 0;
}

/* Skeleton loading shimmer */
.skeleton {
    position: relative;
    overflow: hidden;
    background-color: var(--bg-subtle);
    border-radius: var(--radius-md);
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        color-mix(in srgb, var(--fg-default) 6%, transparent),
        transparent
    );
    transform: translateX(-100%);
    animation: shimmer 1.6s infinite;
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

/* ============================================================
   34. RESPONSIVE
   ============================================================ */

/* Tablet lớn → nhỏ */
@media (max-width: 1100px) {
    .game-header {
        grid-template-columns: 340px 1fr;
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .game-detail-layout,
    .two-col-layout {
        grid-template-columns: 1fr;
    }

    .game-sidebar {
        position: static;
    }

    .user-detail-grid,
    .admin-two-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .game-header {
        grid-template-columns: 1fr;
    }

    .game-cover {
        max-width: 480px;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Hamburger: đã hiển thị mặc định mọi kích thước từ v2.1.0 —
       rule này giữ lại cho rõ ràng (redundant an toàn). */
    .menu-toggle {
        display: inline-flex;
    }
}

/* Mobile */
@media (max-width: 640px) {
    .container {
        padding-inline: 16px;
    }

    /* v2.9.1 — menu mega 1 cột trên điện thoại: 2 cột trước đây khiến mỗi
       cột chỉ ~150px, chữ xuống dòng xấu; 1 cột full-width dễ đọc, vùng
       chạm lớn hơn. Panel đã có max-height + overflow-y ở base nên menu
       dài hơn viewport vẫn cuộn được. */
    .site-menu-inner {
        grid-template-columns: 1fr;
        gap: 18px;
        padding-block: 16px;
    }

    .header-inner {
        gap: 10px;
    }

    /* Logo rút gọn: ẩn wordmark chỉ còn mark */
    .logo span {
        display: none;
    }

    .search-bar {
        max-width: none;
    }

    .search-bar kbd {
        display: none;
    }

    .search-bar button {
        display: none;
    }

    .search-bar input {
        padding-right: 14px;
    }

    .hero-section {
        padding: 40px 0 36px;
    }

    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-stat:nth-child(3) {
        border-left: 0;
    }

    .hero-stat:nth-child(n+3) {
        border-top: 1px solid var(--border-muted);
    }

    .game-grid,
    .news-grid,
    .news-featured-grid {
        grid-template-columns: 1fr;
    }

    .repos-grid {
        grid-template-columns: 1fr;
    }

    .form-row,
    .form-row-2 {
        grid-template-columns: 1fr;
    }

    .admin-form-row input {
        min-width: 100%;
    }

    .profile-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-top: -32px;
    }

    /* v3.11.0 FIX (mobile) — layout cột đẩy khối tên xuống HOÀN TOÀN
       dưới cover (0% chồng cover, đã đo bằng browser). Chữ trắng trên
       nền canvas → light mode mất trắng trên trắng. Mobile dùng màu
       theme-aware: luôn đúng tương phản ở cả 2 theme, chip @username
       bỏ nền tối (không còn cần). */
    .profile-meta h1 {
        color: var(--fg-default);
        text-shadow: none;
    }

    .profile-username {
        color: var(--fg-muted);
        background: var(--bg-subtle);
        border: 1px solid var(--border-muted);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .profile-stats {
        gap: 18px;
        padding: 12px 16px;
    }

    .game-stats-row {
        gap: 6px;
    }

    .game-stat {
        min-width: calc(50% - 4px);
        flex: 1;
    }

    .live-chat-card {
        height: 460px;
    }

    .chat-msg {
        max-width: 94%;
    }

    .toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 32px 0 24px;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 12px;
    }

    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .compact-help-row {
        grid-template-columns: 1fr 1fr;
    }

    .screenshot-item {
        aspect-ratio: 4 / 3;
    }
}

@media (max-width: 400px) {
    .admin-stats-grid {
        grid-template-columns: 1fr;
    }

    .compact-help-row {
        grid-template-columns: 1fr;
    }

    .hero-stats {
        /* v3.8.0 UI FIX (VLM review): giữ lưới 2x2 luôn — bản cũ hạ về
        1 cột ở ≤400px khiến khối stats phình dọc 4 hàng, đẩy CTA chính
        (điểm danh, game tuần) xuống dưới nếp gấp màn hình. 2x2 vẫn vừa
        riêng từng ô ~170px cho 4 chỉ số ngắn. */
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-stat + .hero-stat {
        border-left: 1px solid var(--border-muted);
        border-top: 0;
    }

    .hero-stat:nth-child(3) {
        border-left: 0;
    }

    .hero-stat:nth-child(n+3) {
        border-top: 1px solid var(--border-muted);
    }
}

/* ============================================================
   35. ACCESSIBILITY & SCROLLBAR
   ============================================================ */

/* Focus visible nhất quán — không hiện khi click chuột */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Reduced motion — tôn trọng user preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Scrollbar — mỏng, tinh tế (WebKit + Firefox) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--border-strong);
    border-radius: 10px;
    border: 2px solid var(--bg-canvas);
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--fg-subtle);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

/* In ấn — ẩn navigation, chat, footer */
@media print {
    .site-header,
    .site-footer,
    .site-menu,
    .live-chat-section,
    .game-sidebar,
    .btn,
    .action-btn,
    .share-buttons,
    .comment-form,
    .pagination,
    .announcement-slot {
        display: none !important;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }
}

/* ============================================================
   v2.2.0 — Markdown rendering styles
   Hỗ trợ: code blocks (syntect), callouts, spoiler, video embed,
   tables, tasklists, footnotes.
   ============================================================ */

/* Prose container — áp dụng cho mọi nơi render Markdown */
.prose-md,
.news-content,
.game-content,
.comment-body-md,
.repo-description-md {
    line-height: 1.7;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.prose-md > *:first-child,
.news-content > *:first-child,
.game-content > *:first-child {
    margin-top: 0;
}

.prose-md > *:last-child,
.news-content > *:last-child,
.game-content > *:last-child {
    margin-bottom: 0;
}

/* Headings */
.prose-md h1, .news-content h1, .game-content h1 {
    font-size: 1.8em;
    font-weight: 700;
    margin: 1.2em 0 0.6em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--border-default);
    line-height: 1.3;
}
.prose-md h2, .news-content h2, .game-content h2 {
    font-size: 1.5em;
    font-weight: 700;
    margin: 1.1em 0 0.5em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--border-default);
    line-height: 1.3;
}
.prose-md h3, .news-content h3, .game-content h3 {
    font-size: 1.25em;
    font-weight: 600;
    margin: 1em 0 0.4em;
    line-height: 1.3;
}
.prose-md h4, .prose-md h5, .prose-md h6,
.news-content h4, .news-content h5, .news-content h6,
.game-content h4, .game-content h5, .game-content h6 {
    font-size: 1.05em;
    font-weight: 600;
    margin: 0.9em 0 0.4em;
    line-height: 1.3;
}

/* Paragraphs */
.prose-md p, .news-content p, .game-content p {
    margin: 0 0 0.9em;
}

/* Links */
.prose-md a, .news-content a, .game-content a {
    color: var(--accent, #2563eb);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    transition: color 0.15s ease, text-decoration-thickness 0.15s ease;
}
.prose-md a:hover, .news-content a:hover, .game-content a:hover {
    color: var(--accent-strong, #1d4ed8);
    text-decoration-thickness: 2px;
}

/* Lists */
.prose-md ul, .prose-md ol,
.news-content ul, .news-content ol,
.game-content ul, .game-content ol {
    margin: 0 0 0.9em;
    padding-left: 1.8em;
}
.prose-md li, .news-content li, .game-content li {
    margin: 0.2em 0;
}
.prose-md li > p, .news-content li > p, .game-content li > p {
    margin: 0;
}

/* Task lists (GFM) */
.prose-md li:has(> input[type="checkbox"]),
.news-content li:has(> input[type="checkbox"]),
.game-content li:has(> input[type="checkbox"]) {
    list-style: none;
    margin-left: -1.3em;
}
.prose-md input[type="checkbox"],
.news-content input[type="checkbox"],
.game-content input[type="checkbox"] {
    margin-right: 0.4em;
    vertical-align: middle;
    accent-color: var(--accent, #2563eb);
    width: 1em;
    height: 1em;
    cursor: default;
}

/* Blockquote */
.prose-md blockquote, .news-content blockquote, .game-content blockquote {
    margin: 0 0 1em;
    padding: 0.5em 1em;
    border-left: 4px solid var(--accent, #2563eb);
    background: var(--bg-subtle, rgba(0,0,0,0.03));
    color: var(--fg-muted, #666);
    border-radius: 0 4px 4px 0;
}
.prose-md blockquote > p, .news-content blockquote > p, .game-content blockquote > p {
    margin: 0.3em 0;
}

/* Callouts (GFM-style [!NOTE] [!TIP] [!WARNING] [!CAUTION] [!IMPORTANT]) */
.prose-md blockquote.callout, .news-content blockquote.callout, .game-content blockquote.callout {
    border-left-width: 4px;
    border-radius: 6px;
    padding: 0.8em 1em;
    margin: 1em 0;
}
.prose-md blockquote.callout-note, .news-content blockquote.callout-note, .game-content blockquote.callout-note {
    border-left-color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
}
.prose-md blockquote.callout-tip, .news-content blockquote.callout-tip, .game-content blockquote.callout-tip {
    border-left-color: #16a34a;
    background: rgba(22, 163, 74, 0.08);
}
.prose-md blockquote.callout-info, .news-content blockquote.callout-info, .game-content blockquote.callout-info {
    border-left-color: #0891b2;
    background: rgba(8, 145, 178, 0.08);
}
.prose-md blockquote.callout-warning, .news-content blockquote.callout-warning, .game-content blockquote.callout-warning {
    border-left-color: #d97706;
    background: rgba(217, 119, 6, 0.08);
}
.prose-md blockquote.callout-danger, .news-content blockquote.callout-danger, .game-content blockquote.callout-danger {
    border-left-color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}
.prose-md blockquote.callout-important, .news-content blockquote.callout-important, .game-content blockquote.callout-important {
    border-left-color: #7c3aed;
    background: rgba(124, 58, 237, 0.08);
}
.prose-md blockquote.callout > p:first-child strong,
.news-content blockquote.callout > p:first-child strong,
.game-content blockquote.callout > p:first-child strong {
    display: inline-block;
    padding: 0.15em 0.5em;
    border-radius: 4px;
    background: currentColor;
    color: white !important;
    font-size: 0.85em;
    margin-bottom: 0.4em;
}

/* Code blocks (syntect classed output + .hljs marker) */
.prose-md pre.code-block, .news-content pre.code-block, .game-content pre.code-block {
    background: var(--bg-code, #0d1117);
    color: var(--fg-code, #c9d1d9);
    padding: 1em 1.2em;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1em 0;
    font-family: var(--font-mono, 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace);
    font-size: 0.9em;
    line-height: 1.55;
    border: 1px solid var(--border-code, #30363d);
    position: relative;
}
.prose-md pre.code-block code, .news-content pre.code-block code, .game-content pre.code-block code {
    font-family: inherit;
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: inherit;
}
/* Inline code */
.prose-md code, .news-content code, .game-content code {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    background: var(--bg-code-inline, rgba(175, 184, 193, 0.2));
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.88em;
    color: var(--fg-code-inline, #d6336c);
}
.prose-md pre.code-block code, .news-content pre.code-block code, .game-content pre.code-block code {
    /* Override inline code style when inside pre */
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* Syntect span colors (GitHub-dark-inspired) */
.prose-md .hljs, .news-content .hljs, .game-content .hljs {
    color: #c9d1d9;
}
.prose-md .hljs-comment, .prose-md .hljs-quote,
.news-content .hljs-comment, .news-content .hljs-quote { color: #8b949e; font-style: italic; }
.prose-md .hljs-keyword, .prose-md .hljs-selector-tag, .prose-md .hljs-deletion,
.news-content .hljs-keyword, .news-content .hljs-selector-tag, .news-content .hljs-deletion { color: #ff7b72; }
.prose-md .hljs-string, .prose-md .hljs-attr, .prose-md .hljs-addition,
.news-content .hljs-string, .news-content .hljs-attr, .news-content .hljs-addition { color: #a5d6ff; }
.prose-md .hljs-number, .prose-md .hljs-literal,
.news-content .hljs-number, .news-content .hljs-literal { color: #79c0ff; }
.prose-md .hljs-title, .prose-md .hljs-section, .prose-md .hljs-function .hljs-title,
.news-content .hljs-title, .news-content .hljs-section, .news-content .hljs-function .hljs-title { color: #d2a8ff; }
.prose-md .hljs-type, .prose-md .hljs-class .hljs-title,
.news-content .hljs-type, .news-content .hljs-class .hljs-title { color: #ffa657; }
.prose-md .hljs-variable, .prose-md .hljs-template-variable,
.news-content .hljs-variable, .news-content .hljs-template-variable { color: #ffd866; }
.prose-md .hljs-built_in, .prose-md .hljs-builtin-name,
.news-content .hljs-built_in, .news-content .hljs-builtin-name { color: #79c0ff; }
.prose-md .hljs-meta,
.news-content .hljs-meta { color: #8b949e; }
.prose-md .hljs-tag,
.news-content .hljs-tag { color: #7ee787; }

/* Tables (GFM) */
.prose-md table, .news-content table, .game-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
    font-size: 0.92em;
    display: block;
    overflow-x: auto;
}
.prose-md table thead, .news-content table thead, .game-content table thead {
    background: var(--bg-subtle, rgba(0,0,0,0.03));
}
.prose-md table th, .prose-md table td,
.news-content table th, .news-content table td,
.game-content table th, .game-content table td {
    border: 1px solid var(--border, #d0d7de);
    padding: 0.5em 0.8em;
    text-align: left;
}
.prose-md table th,
.news-content table th,
.game-content table th {
    font-weight: 600;
}

/* Horizontal rule */
.prose-md hr, .news-content hr, .game-content hr {
    border: none;
    border-top: 2px solid var(--border, #d0d7de);
    margin: 1.5em 0;
    height: 0;
}

/* Images */
.prose-md img, .news-content img, .game-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 0.5em 0;
}

/* Spoiler (comrak extension) */
.prose-md .spoiler, .news-content .spoiler, .game-content .spoiler {
    background: var(--fg-subtle, #888);
    color: transparent;
    border-radius: 3px;
    padding: 0 0.2em;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    user-select: none;
}
.prose-md .spoiler:hover, .news-content .spoiler:hover, .game-content .spoiler:hover {
    background: var(--fg-muted, #666);
}
.prose-md .spoiler:focus, .prose-md .spoiler:active,
.news-content .spoiler:focus, .news-content .spoiler:active,
.game-content .spoiler:focus, .game-content .spoiler:active {
    background: transparent;
    color: inherit;
    outline: 1px dashed var(--accent, #2563eb);
}

/* Video embed (YouTube auto-embed) */
.prose-md .video-embed, .news-content .video-embed, .game-content .video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    max-width: 100%;
    margin: 1em 0;
    border-radius: 8px;
    background: #000;
}
.prose-md .video-embed iframe, .news-content .video-embed iframe, .game-content .video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Footnotes */
.prose-md .footnotes, .news-content .footnotes, .game-content .footnotes {
    margin-top: 2em;
    padding-top: 1em;
    border-top: 1px solid var(--border, #d0d7de);
    font-size: 0.88em;
    color: var(--fg-muted, #666);
}
.prose-md sup, .news-content sup, .game-content sup {
    font-size: 0.75em;
    line-height: 0;
    vertical-align: super;
}
.prose-md .footnote-ref a,
.news-content .footnote-ref a,
.game-content .footnote-ref a {
    text-decoration: none;
}

/* ============================================================
   v3.11.0 — TRANG HƯỚNG DẪN MARKDOWN (/markdown)
   ============================================================ */
.md-guide-page .about-hero { margin-bottom: 20px; }

.md-playground {
    border: 1px solid var(--border-default, #2a3242);
    border-radius: 14px;
    background: var(--bg-elevated, #141a24);
    padding: 16px 18px 18px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-sm);
}

.md-playground-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.md-playground-head h2 {
    font-size: 17px;
    font-weight: 800;
    margin: 0;
}

.md-playground-samples { display: flex; gap: 8px; flex-wrap: wrap; }

.md-playground-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.md-playground-pane { min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.md-play-input {
    font-family: var(--font-mono, monospace);
    font-size: 13px;
    line-height: 1.55;
    resize: vertical;
    min-height: 240px;
}

.md-playground-output {
    flex: 1;
    border: 1px dashed var(--border-muted, #2a3242);
    border-radius: 10px;
    background: var(--bg-canvas, #0d1117);
    padding: 14px 16px;
    min-height: 240px;
    max-height: 560px;
    overflow: auto;
}

.md-playground-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.md-playground-meta .muted { font-size: 12.5px; }

.md-guide-content {
    margin-top: 6px;
}

@media (max-width: 860px) {
    .md-playground-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   v3.11.0 — MARKDOWN SIÊU NÂNG CẤP: kbd, abbr, mermaid,
   video/audio file embed, sortable tables
   ============================================================ */

/* Phím bàn phím `[[Ctrl]]` → <kbd> — giống GitHub */
.prose-md kbd, .news-content kbd, .game-content kbd {
    display: inline-block;
    padding: 2px 7px;
    font-family: var(--font-mono, monospace);
    font-size: 0.82em;
    line-height: 1.4;
    color: var(--fg-default, #eee);
    background: var(--bg-subtle, #1a2230);
    border: 1px solid var(--border-default, #2a3242);
    border-bottom-width: 2px;
    border-radius: 6px;
    box-shadow: 0 1px 0 var(--border-default, #2a3242);
    white-space: nowrap;
    vertical-align: middle;
}

/* Abbreviation `*[TERM]: def` → <abbr title> */
.prose-md abbr[title], .news-content abbr[title], .game-content abbr[title] {
    text-decoration: underline dotted var(--fg-muted, #9aa4b2) 1px;
    text-underline-offset: 3px;
    cursor: help;
}

/* Mermaid — container diagram (client-side render, lazy-load script) */
.mermaid-wrapper {
    margin: 1.25em 0;
    padding: 16px;
    border: 1px solid var(--border-muted, #2a3242);
    border-radius: 10px;
    background: var(--bg-elevated, #141a24);
    overflow-x: auto;
    text-align: center;
}
.mermaid-wrapper .mermaid {
    display: flex;
    justify-content: center;
    min-height: 40px;
}
.mermaid-wrapper .mermaid svg {
    max-width: 100%;
    height: auto;
}
.mermaid-noscript {
    font-size: 13px;
    color: var(--fg-muted, #9aa4b2);
}

/* Video file (.mp4/.webm...) + audio embed (.mp3/.wav...) */
.prose-md .video-embed video, .news-content .video-embed video, .game-content .video-embed video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    border-radius: 10px;
    background: #000;
}
.audio-embed {
    margin: 1em 0;
}
.prose-md .audio-embed audio, .news-content .audio-embed audio, .game-content .audio-embed audio {
    width: 100%;
}

/* Sortable tables (app.js) — nút sắp xếp trên header, visual cue */
.prose-md table.sortable th[role="columnheader"],
.news-content table.sortable th[role="columnheader"],
.game-content table.sortable th[role="columnheader"] {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 22px;
}
.prose-md table.sortable th[role="columnheader"]::after,
.news-content table.sortable th[role="columnheader"]::after,
.game-content table.sortable th[role="columnheader"]::after {
    content: "↕";
    position: absolute;
    right: 6px;
    opacity: 0.45;
    font-size: 0.85em;
}
.prose-md table.sortable th[aria-sort="ascending"]::after,
.news-content table.sortable th[aria-sort="ascending"]::after,
.game-content table.sortable th[aria-sort="ascending"]::after {
    content: "↑";
    opacity: 1;
}
.prose-md table.sortable th[aria-sort="descending"]::after,
.news-content table.sortable th[aria-sort="descending"]::after,
.game-content table.sortable th[aria-sort="descending"]::after {
    content: "↓";
    opacity: 1;
}

/* Math — v3.11.0: comrak phát `<span class="math inline/display">`
   (selector cũ `.math-inline` KHÔNG bao giờ khớp — đã sửa). Style dưới là
   FALLBACK khi JS tắt (KaTeX chưa chạy): hiển thị công thức dạng code dễ
   đọc. Khi KaTeX render xong, span được thay bằng .katex — style này hết
   tác dụng tự nhiên. */
.prose-md .math.inline, .news-content .math.inline, .game-content .math.inline,
.prose-md .math-inline, .news-content .math-inline, .game-content .math-inline {
    font-family: var(--font-mono, 'JetBrains Mono', 'Cambria Math', monospace);
    font-style: italic;
    background: var(--bg-code-inline, rgba(175,184,193,0.2));
    padding: 0.1em 0.3em;
    border-radius: 3px;
}
.prose-md .math.display, .news-content .math.display, .game-content .math.display,
.prose-md .math-display, .news-content .math-display, .game-content .math-display {
    font-family: var(--font-mono, 'JetBrains Mono', 'Cambria Math', monospace);
    font-style: italic;
    background: var(--bg-code-inline, rgba(175,184,193,0.2));
    padding: 0.6em 1em;
    border-radius: 6px;
    text-align: center;
    margin: 1em 0;
    overflow-x: auto;
    display: block;
}

/* KaTeX v3.11.0 — self-hosted /static/vendor/katex/. Scale vừa text,
   inherit màu theo theme; overflow-x cho công thức dài trên mobile. */
.prose-md .katex, .news-content .katex, .game-content .katex {
    font-size: 1.05em;
}
.prose-md .katex-display, .news-content .katex-display, .game-content .katex-display {
    margin: 1em 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 0;
}

/* Strikethrough */
.prose-md del, .news-content del, .game-content del {
    color: var(--fg-muted, #999);
}

/* Dark mode: code blocks remain dark, but tweak inline code */
[data-theme="dark"] .prose-md code,
[data-theme="dark"] .news-content code,
[data-theme="dark"] .game-content code {
    background: rgba(110, 118, 129, 0.4);
    color: #f0883e;
}
[data-theme="dark"] .prose-md blockquote,
[data-theme="dark"] .news-content blockquote,
[data-theme="dark"] .game-content blockquote {
    background: rgba(255, 255, 255, 0.04);
    color: #b1bac4;
}

/* v2.2.0 — News related section */
.news-related {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border, #e5e7eb);
}
.news-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.news-related-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.news-related-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    border-color: var(--accent, #2563eb);
}
.news-related-thumb {
    aspect-ratio: 16 / 9;
    background: var(--bg-subtle, #f3f4f6);
    overflow: hidden;
}
.news-related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.news-related-card:hover .news-related-thumb img {
    transform: scale(1.05);
}
.news-related-body {
    padding: 0.75rem 1rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.news-related-body h3 {
    font-size: 0.95em;
    font-weight: 600;
    margin: 0;
    line-height: 1.35;
    color: var(--fg-strong, #1a1a1a);
}
.news-related-body .muted {
    font-size: 0.85em;
    margin: 0;
    color: var(--fg-muted, #666);
    line-height: 1.5;
}
.news-related-meta {
    font-size: 0.78em;
    color: var(--fg-muted, #888);
    margin-top: auto;
}
.news-related-meta strong {
    color: var(--accent, #2563eb);
    font-weight: 500;
}
[data-theme="dark"] .news-related-card {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .news-related-thumb {
    background: rgba(0, 0, 0, 0.3);
}

/* ============================================================
   v2.3.0 — Markdown rendering extensions
   Hỗ trợ: heading anchors (# link), ToC (Table of Contents),
   code-block copy button, lazy image enhancements, external
   link marker, additional callout variants.
   KHÔNG thay đổi giao diện cũ — chỉ THÊM style cho element mới.
   ============================================================ */

/* --- Heading anchor link (GitHub-style "#" on hover) ---
   Anchor link do AnchorHeadingAdapter::exit() phát ra nằm cuối heading,
   được CSS định vị tuyệt đối góc trên-trái heading. Hidden mặc định,
   hiện khi hover heading. Click vào để copy URL với #slug. */
.prose-md h1, .prose-md h2, .prose-md h3, .prose-md h4, .prose-md h5, .prose-md h6,
.news-content h1, .news-content h2, .news-content h3, .news-content h4, .news-content h5, .news-content h6,
.game-content h1, .game-content h2, .game-content h3, .game-content h4, .game-content h5, .game-content h6 {
    position: relative;
}
.prose-md .heading-anchor,
.news-content .heading-anchor,
.game-content .heading-anchor {
    position: absolute;
    top: 0;
    left: -1.2em;
    width: 1em;
    height: 100%;
    color: var(--fg-muted, #6c757d);
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    display: inline-flex;
    align-items: center;
    font-size: 0.85em;
}
.prose-md .heading-anchor::before,
.news-content .heading-anchor::before,
.game-content .heading-anchor::before {
    content: "#";
    font-weight: 600;
}
.prose-md h1:hover .heading-anchor,
.prose-md h2:hover .heading-anchor,
.prose-md h3:hover .heading-anchor,
.prose-md h4:hover .heading-anchor,
.prose-md h5:hover .heading-anchor,
.prose-md h6:hover .heading-anchor,
.news-content h1:hover .heading-anchor,
.news-content h2:hover .heading-anchor,
.news-content h3:hover .heading-anchor,
.news-content h4:hover .heading-anchor,
.news-content h5:hover .heading-anchor,
.news-content h6:hover .heading-anchor,
.game-content h1:hover .heading-anchor,
.game-content h2:hover .heading-anchor,
.game-content h3:hover .heading-anchor,
.game-content h4:hover .heading-anchor,
.game-content h5:hover .heading-anchor,
.game-content h6:hover .heading-anchor {
    opacity: 1;
}
.prose-md .heading-anchor:focus,
.news-content .heading-anchor:focus,
.game-content .heading-anchor:focus {
    opacity: 1;
    outline: 2px solid var(--accent, #2563eb);
    outline-offset: 2px;
    border-radius: 2px;
}

/* --- Table of Contents (ToC) ---
   Markup: <nav class="toc"><p class="toc-title">Mục lục</p><ul class="toc-list">... */
.prose-md .toc,
.news-content .toc,
.game-content .toc {
    background: var(--bg-subtle, rgba(0,0,0,0.03));
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    padding: 1em 1.2em;
    margin: 1.5em 0;
    font-size: 0.92em;
}
.prose-md .toc-title,
.news-content .toc-title,
.game-content .toc-title {
    font-weight: 600;
    margin: 0 0 0.5em;
    color: var(--fg-strong, #1a1a1a);
    font-size: 1em;
}
.prose-md .toc-list,
.news-content .toc-list,
.game-content .toc-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.prose-md .toc-list .toc-list,
.news-content .toc-list .toc-list,
.game-content .toc-list .toc-list {
    padding-left: 1.2em;
    margin: 0.2em 0;
}
.prose-md .toc-list li,
.news-content .toc-list li,
.game-content .toc-list li {
    margin: 0.2em 0;
}
.prose-md .toc-list a,
.news-content .toc-list a,
.game-content .toc-list a {
    color: var(--accent, #2563eb);
    text-decoration: none;
    transition: color 0.15s ease, text-decoration 0.15s ease;
}
.prose-md .toc-list a:hover,
.news-content .toc-list a:hover,
.game-content .toc-list a:hover {
    color: var(--accent-strong, #1d4ed8);
    text-decoration: underline;
}

/* --- Code block copy button ---
   Wrapper: <div class="code-block-wrapper">
            <button class="code-copy-btn">Sao chép</button>
            <pre class="code-block">...</pre>
           </div>
   Button positioned absolutely top-right. Hidden khi không hover (xó khó
   nhìn), hiện khi hover (show-on-hover).
   Click handler ở static/js/app.js (xem registerCopyCodeButtons). */
.prose-md .code-block-wrapper,
.news-content .code-block-wrapper,
.game-content .code-block-wrapper {
    position: relative;
    margin: 1em 0;
}
.prose-md .code-block-wrapper pre.code-block,
.news-content .code-block-wrapper pre.code-block,
.game-content .code-block-wrapper pre.code-block {
    margin: 0;
}
.prose-md .code-copy-btn,
.news-content .code-copy-btn,
.game-content .code-copy-btn {
    position: absolute;
    top: 0.4em;
    right: 0.4em;
    padding: 0.25em 0.6em;
    font-size: 0.78em;
    font-family: var(--font-sans, 'Inter', sans-serif);
    background: var(--bg-card, #fff);
    color: var(--fg-muted, #6c757d);
    border: 1px solid var(--border, #d0d7de);
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
    z-index: 1;
}
.prose-md .code-block-wrapper:hover .code-copy-btn,
.news-content .code-block-wrapper:hover .code-copy-btn,
.game-content .code-block-wrapper:hover .code-copy-btn,
.prose-md .code-copy-btn:focus-visible,
.news-content .code-copy-btn:focus-visible,
.game-content .code-copy-btn:focus-visible {
    opacity: 1;
}
.prose-md .code-copy-btn:hover,
.news-content .code-copy-btn:hover,
.game-content .code-copy-btn:hover {
    background: var(--accent, #2563eb);
    color: #fff;
    border-color: var(--accent, #2563eb);
}
/* "Đã sao chép" state — JS thêm class .code-copy-btn-copied sau khi click */
.prose-md .code-copy-btn-copied,
.news-content .code-copy-btn-copied,
.game-content .code-copy-btn-copied {
    background: #10b981 !important;
    color: #fff !important;
    border-color: #10b981 !important;
    opacity: 1 !important;
}

/* --- External link marker ---
   Markdown engine thêm class="external-link" cho mọi <a href="http(s)://...">
   ngoại trừ localhost. CSS thêm icon ↗ nhỏ sau link (decorative, không
   ảnh hưởng text). */
.prose-md .external-link::after,
.news-content .external-link::after,
.game-content .external-link::after {
    content: "↗";
    display: inline-block;
    margin-left: 0.15em;
    font-size: 0.85em;
    vertical-align: super;
    color: var(--fg-muted, #6c757d);
    text-decoration: none;
}

/* --- Additional callout variants v2.3.0 ---
   Kế thừa style callout cũ, thêm:
   - callout-success (xanh lá)
   - callout-question (xanh dương đậm)
   - callout-quote (xám, italic) */
.prose-md blockquote.callout-success, .news-content blockquote.callout-success, .game-content blockquote.callout-success {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}
.prose-md blockquote.callout-success strong, .news-content blockquote.callout-success strong, .game-content blockquote.callout-success strong {
    color: #059669;
}
.prose-md blockquote.callout-question, .news-content blockquote.callout-question, .game-content blockquote.callout-question {
    border-left-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}
.prose-md blockquote.callout-question strong, .news-content blockquote.callout-question strong, .game-content blockquote.callout-question strong {
    color: #2563eb;
}
.prose-md blockquote.callout-quote, .news-content blockquote.callout-quote, .game-content blockquote.callout-quote {
    border-left-color: #94a3b8;
    background: rgba(148, 163, 184, 0.08);
    font-style: italic;
}
.prose-md blockquote.callout-quote strong, .news-content blockquote.callout-quote strong, .game-content blockquote.callout-quote strong {
    color: #475569;
    font-style: normal;
}

/* Dark mode tweaks for v2.3.0 elements */
[data-theme="dark"] .prose-md .toc,
[data-theme="dark"] .news-content .toc,
[data-theme="dark"] .game-content .toc {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .prose-md .code-copy-btn,
[data-theme="dark"] .news-content .code-copy-btn,
[data-theme="dark"] .game-content .code-copy-btn {
    background: rgba(255, 255, 255, 0.06);
    color: #b1bac4;
    border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .prose-md .heading-anchor,
[data-theme="dark"] .news-content .heading-anchor,
[data-theme="dark"] .game-content .heading-anchor {
    color: #8b949e;
}
[data-theme="dark"] .prose-md blockquote.callout-success,
[data-theme="dark"] .news-content blockquote.callout-success,
[data-theme="dark"] .game-content blockquote.callout-success {
    background: rgba(16, 185, 129, 0.12);
}
[data-theme="dark"] .prose-md blockquote.callout-success strong,
[data-theme="dark"] .news-content blockquote.callout-success strong,
[data-theme="dark"] .game-content blockquote.callout-success strong {
    color: #34d399;
}
[data-theme="dark"] .prose-md blockquote.callout-question,
[data-theme="dark"] .news-content blockquote.callout-question,
[data-theme="dark"] .game-content blockquote.callout-question {
    background: rgba(59, 130, 246, 0.14);
}
[data-theme="dark"] .prose-md blockquote.callout-question strong,
[data-theme="dark"] .news-content blockquote.callout-question strong,
[data-theme="dark"] .game-content blockquote.callout-question strong {
    color: #60a5fa;
}
[data-theme="dark"] .prose-md blockquote.callout-quote,
[data-theme="dark"] .news-content blockquote.callout-quote,
[data-theme="dark"] .game-content blockquote.callout-quote {
    background: rgba(148, 163, 184, 0.1);
}

/* ============================================================
   v2.4.0 — Markdown UX additions (KHÔNG thay đổi UI hiện có)
   - .md-figure: figure caption cho ảnh (alt có prefix "caption:")
   - .code-lang-label: badge tên ngôn ngữ trên code block
   - .callout-collapsible: <details><summary> cho [!NOTE]+/-
   - .reading-time-badge: badge "X phút đọc" trong meta
   ============================================================ */

/* Figure với caption — áp dụng cả .news-content và .game-content */
.prose-md figure.md-figure,
.news-content figure.md-figure,
.game-content figure.md-figure {
    margin: 1.25rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.prose-md figure.md-figure img,
.news-content figure.md-figure img,
.game-content figure.md-figure img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.prose-md figure.md-figure figcaption,
.news-content figure.md-figure figcaption,
.game-content figure.md-figure figcaption {
    font-size: 0.875em;
    color: var(--muted, #6b7280);
    text-align: center;
    font-style: italic;
    max-width: 90%;
}

/* Language label badge trên code block — không ảnh hưởng layout */
.prose-md .code-block-wrapper,
.news-content .code-block-wrapper,
.game-content .code-block-wrapper {
    position: relative;
}
.prose-md .code-lang-label,
.news-content .code-lang-label,
.game-content .code-lang-label {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.15em 0.6em;
    font-size: 0.7em;
    font-family: var(--font-mono, monospace);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted, #6b7280);
    background: rgba(0, 0, 0, 0.05);
    border-bottom-left-radius: 6px;
    pointer-events: none;
    user-select: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.prose-md .code-block-wrapper:hover .code-lang-label,
.news-content .code-block-wrapper:hover .code-lang-label,
.game-content .code-block-wrapper:hover .code-lang-label {
    opacity: 1;
}
[data-theme="dark"] .prose-md .code-lang-label,
[data-theme="dark"] .news-content .code-lang-label,
[data-theme="dark"] .game-content .code-lang-label {
    color: #9ca3af;
    background: rgba(255, 255, 255, 0.06);
}

/* Collapsible callout (<details><summary>) — variants theo kind */
.prose-md details.callout-collapsible,
.news-content details.callout-collapsible,
.game-content details.callout-collapsible {
    margin: 1rem 0;
    padding: 0;
    border-radius: 8px;
    border-left: 4px solid var(--accent, #6366f1);
    background: rgba(99, 102, 241, 0.05);
    overflow: hidden;
}
.prose-md details.callout-collapsible > .callout-summary,
.news-content details.callout-collapsible > .callout-summary,
.game-content details.callout-collapsible > .callout-summary {
    padding: 0.625rem 1rem;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.prose-md details.callout-collapsible > .callout-summary::before,
.news-content details.callout-collapsible > .callout-summary::before,
.game-content details.callout-collapsible > .callout-summary::before {
    content: "▸";
    font-size: 0.85em;
    transition: transform 0.2s ease;
    color: var(--muted, #6b7280);
}
.prose-md details.callout-collapsible[open] > .callout-summary::before,
.news-content details.callout-collapsible[open] > .callout-summary::before,
.game-content details.callout-collapsible[open] > .callout-summary::before {
    transform: rotate(90deg);
}
.prose-md details.callout-collapsible > .callout-summary::-webkit-details-marker,
.news-content details.callout-collapsible > .callout-summary::-webkit-details-marker,
.game-content details.callout-collapsible > .callout-summary::-webkit-details-marker {
    display: none;
}
.prose-md details.callout-collapsible > .callout-body,
.news-content details.callout-collapsible > .callout-body,
.game-content details.callout-collapsible > .callout-body {
    padding: 0 1rem 0.75rem;
}
.prose-md details.callout-collapsible > .callout-body > p:first-child,
.news-content details.callout-collapsible > .callout-body > p:first-child,
.game-content details.callout-collapsible > .callout-body > p:first-child {
    margin-top: 0;
}

/* Color variants for collapsible — mirror static callouts */
.prose-md details.callout-note, .news-content details.callout-note, .game-content details.callout-note { border-left-color: #6366f1; background: rgba(99, 102, 241, 0.06); }
.prose-md details.callout-tip, .news-content details.callout-tip, .game-content details.callout-tip { border-left-color: #10b981; background: rgba(16, 185, 129, 0.06); }
.prose-md details.callout-info, .news-content details.callout-info, .game-content details.callout-info { border-left-color: #3b82f6; background: rgba(59, 130, 246, 0.06); }
.prose-md details.callout-warning, .news-content details.callout-warning, .game-content details.callout-warning { border-left-color: #f59e0b; background: rgba(245, 158, 11, 0.06); }
.prose-md details.callout-danger, .news-content details.callout-danger, .game-content details.callout-danger { border-left-color: #ef4444; background: rgba(239, 68, 68, 0.06); }
.prose-md details.callout-important, .news-content details.callout-important, .game-content details.callout-important { border-left-color: #8b5cf6; background: rgba(139, 92, 246, 0.06); }
.prose-md details.callout-success, .news-content details.callout-success, .game-content details.callout-success { border-left-color: #22c55e; background: rgba(34, 197, 94, 0.06); }
.prose-md details.callout-question, .news-content details.callout-question, .game-content details.callout-question { border-left-color: #3b82f6; background: rgba(59, 130, 246, 0.08); }
.prose-md details.callout-quote, .news-content details.callout-quote, .game-content details.callout-quote { border-left-color: #94a3b8; background: rgba(148, 163, 184, 0.06); }

/* Description lists (<dl><dt><dd>) — comrak description_lists feature */
.prose-md dl, .news-content dl, .game-content dl {
    margin: 1rem 0;
    padding-left: 1rem;
    border-left: 3px solid rgba(99, 102, 241, 0.25);
}
.prose-md dt, .news-content dt, .game-content dt {
    font-weight: 600;
    margin-top: 0.5rem;
}
.prose-md dd, .news-content dd, .game-content dd {
    margin: 0.25rem 0 0.5rem 1rem;
    color: var(--text-muted, #4b5563);
}
[data-theme="dark"] .prose-md dd,
[data-theme="dark"] .news-content dd,
[data-theme="dark"] .game-content dd {
    color: #9ca3af;
}

/* Reading time badge — subtle meta-item */
.news-show-meta .reading-time-badge {
    color: var(--muted, #6b7280);
    opacity: 0.85;
}


/* ============================================================
   v2.5.0 — Markdown engine "mạnh hơn nữa" + Bio Markdown
   - Syntect token colors (GitHub-dark-inspired) — lần ĐẦU có màu thật
     (trước đây class syntect không có CSS nào → code 1 màu phẳng)
   - Code line numbers (CSS counter trên .code-line)
   - Diff block coloring (+ xanh / - đỏ / @@ xanh dương)
   - mark/ins/u/sub (==highlight==, ++insert++, __underline__, H~2~O)
   - @mention + #hashtag links
   - .bio-md — bio hồ sơ render Markdown (compact)
   ============================================================ */

/* --- 1) Syntect token colors — bổ sung selector cho class syntect.
   Syntect ClassStyle::Spaced phát class theo scope: "keyword control rust",
   "string quoted double python"... CSS cũ chỉ target .hljs-* (dead code —
   syntect không bao giờ phát class đó). Giờ target scope-class thật. --- */
.prose-md .code-block .keyword,
.news-content .code-block .keyword,
.game-content .code-block .keyword,
.prose-md pre.code-block .keyword,
.news-content pre.code-block .keyword,
.game-content pre.code-block .keyword,
.prose-md .storage,
.news-content .storage,
.game-content .storage { color: #ff7b72; } /* keyword / storage.type */

.prose-md .code-block .string,
.news-content .code-block .string,
.game-content .code-block .string,
.prose-md pre.code-block .string,
.news-content pre.code-block .string,
.game-content pre.code-block .string { color: #a5d6ff; } /* string */

.prose-md .code-block .comment,
.news-content .code-block .comment,
.game-content .code-block .comment,
.prose-md pre.code-block .comment,
.news-content pre.code-block .comment,
.game-content pre.code-block .comment {
    color: #8b949e;
    font-style: italic;
}

.prose-md .code-block .constant,
.news-content .code-block .constant,
.game-content .code-block .constant,
.prose-md pre.code-block .constant,
.news-content pre.code-block .constant,
.game-content pre.code-block .constant,
.prose-md .code-block .numeric,
.news-content .code-block .numeric,
.game-content .code-block .numeric { color: #79c0ff; } /* số / constant */

.prose-md .code-block .entity,
.news-content .code-block .entity,
.game-content .code-block .entity,
.prose-md pre.code-block .entity,
.news-content pre.code-block .entity,
.game-content pre.code-block .entity,
.prose-md .code-block .support,
.news-content .code-block .support,
.game-content .code-block .support { color: #d2a8ff; } /* tên hàm / class */

.prose-md .code-block .variable,
.news-content .code-block .variable,
.game-content .code-block .variable,
.prose-md pre.code-block .variable,
.news-content pre.code-block .variable,
.game-content pre.code-block .variable,
.prose-md .code-block .variable-parameter,
.news-content .code-block .variable-parameter,
.game-content .code-block .variable-parameter { color: #ffa657; } /* biến / tham số */

.prose-md .code-block .punctuation,
.news-content .code-block .punctuation,
.game-content .code-block .punctuation,
.prose-md pre.code-block .punctuation,
.news-content pre.code-block .punctuation,
.game-content pre.code-block .punctuation { color: #c9d1d9; }

/* --- 2) Code line numbers — CSS counter, hiển thị trái, mờ, không chọn --- */
.prose-md pre.code-block,
.news-content pre.code-block,
.game-content pre.code-block {
    counter-reset: md-code-line;
}
.prose-md pre.code-block .code-line,
.news-content pre.code-block .code-line,
.game-content pre.code-block .code-line {
    counter-increment: md-code-line;
    display: inline-block;
    width: 100%;
}
.prose-md pre.code-block .code-line::before,
.news-content pre.code-block .code-line::before,
.game-content pre.code-block .code-line::before {
    content: counter(md-code-line);
    display: inline-block;
    min-width: 2.2em;
    margin-right: 1.2em;
    text-align: right;
    color: var(--muted, #6b7280);
    opacity: 0.55;
    user-select: none;
    -webkit-user-select: none;
}
[data-theme="dark"] .prose-md pre.code-block .code-line::before,
[data-theme="dark"] .news-content pre.code-block .code-line::before,
[data-theme="dark"] .game-content pre.code-block .code-line::before {
    color: #6e7681;
}

/* --- 3) Diff block coloring --- */
.prose-md .diff-add,
.news-content .diff-add,
.game-content .diff-add {
    display: inline-block;
    width: 100%;
    background: rgba(46, 160, 67, 0.15);
    color: #3fb950;
}
.prose-md .diff-del,
.news-content .diff-del,
.game-content .diff-del {
    display: inline-block;
    width: 100%;
    background: rgba(248, 81, 73, 0.15);
    color: #f85149;
}
.prose-md .diff-meta,
.news-content .diff-meta,
.game-content .diff-meta {
    display: inline-block;
    width: 100%;
    background: rgba(56, 139, 253, 0.15);
    color: #58a6ff;
}

/* --- 4) mark / ins / u / sub — inline formatting mới --- */
.prose-md mark, .news-content mark, .game-content mark, .bio-md mark {
    background: rgba(255, 212, 0, 0.35);
    color: inherit;
    padding: 0.08em 0.25em;
    border-radius: 3px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}
[data-theme="dark"] .prose-md mark,
[data-theme="dark"] .news-content mark,
[data-theme="dark"] .game-content mark,
[data-theme="dark"] .bio-md mark {
    background: rgba(187, 128, 9, 0.4);
    color: #fff;
}
.prose-md ins, .news-content ins, .game-content ins, .bio-md ins {
    text-decoration: underline;
    text-decoration-style: solid;
    text-decoration-color: #3fb950;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}
.prose-md u, .news-content u, .game-content u, .bio-md u {
    text-underline-offset: 2px;
}
.prose-md sub, .news-content sub, .game-content sub, .bio-md sub {
    font-size: 0.72em;
}

/* --- 5) @mention + #hashtag --- */
.prose-md .md-mention,
.news-content .md-mention,
.game-content .md-mention,
.bio-md .md-mention {
    color: #58a6ff;
    font-weight: 600;
    text-decoration: none;
    background: rgba(56, 139, 253, 0.1);
    padding: 0.05em 0.35em;
    border-radius: 999px;
    transition: background 0.15s ease, color 0.15s ease;
}
.prose-md .md-mention:hover,
.news-content .md-mention:hover,
.game-content .md-mention:hover,
.bio-md .md-mention:hover {
    background: rgba(56, 139, 253, 0.22);
}
.prose-md .md-hashtag,
.news-content .md-hashtag,
.game-content .md-hashtag,
.bio-md .md-hashtag {
    color: #d2a8ff;
    font-weight: 600;
    text-decoration: none;
}
.prose-md .md-hashtag:hover,
.news-content .md-hashtag:hover,
.game-content .md-hashtag:hover,
.bio-md .md-hashtag:hover {
    text-decoration: underline;
}

/* --- 6) Bio Markdown — render_bio trên trang hồ sơ --- */
.bio-md {
    font-size: 0.95rem;
    line-height: 1.65;
    word-break: break-word;
}
.bio-md p { margin: 0 0 0.5em; }
.bio-md p:last-child { margin-bottom: 0; }
.bio-md a { color: var(--link, #2563eb); text-decoration: none; }
.bio-md a:hover { text-decoration: underline; }
[data-theme="dark"] .bio-md a { color: #58a6ff; }
.bio-md ul, .bio-md ol { margin: 0.4em 0; padding-left: 1.4em; }
.bio-md li { margin: 0.15em 0; }
.bio-md code {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.85em;
    background: rgba(175, 184, 193, 0.2);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}
.bio-md pre.code-block {
    font-size: 0.8rem;
    padding: 0.75em 1em;
    margin: 0.6em 0;
}
.bio-md blockquote {
    margin: 0.5em 0;
    padding: 0.2em 0.9em;
    border-left: 3px solid var(--border, #d1d5db);
    color: var(--muted, #6b7280);
}
.bio-md h1, .bio-md h2, .bio-md h3, .bio-md h4 {
    font-size: 1em; /* heading trong bio giữ kích thước tiết chế */
    font-weight: 700;
    margin: 0.6em 0 0.3em;
}
.profile-bio.bio-md { margin: 4px 0 8px; }

/* --- 6b) v3.12.0 — FIX LỖI BẢNG SO SÁNH KHÔNG HIỂN THỊ TRÊN TIỂU SỬ ---
   Gốc rễ: render_bio dùng chung comrak_options() (GFM table ON) nên bảng
   CÓ render ra <table>…</table> trong bio — nhưng CSS chỉ style bảng cho
   .prose-md/.news-content/.game-content, .bio-md KHÔNG có rule nào →
   trình duyệt vẽ table "trần" không viền, không header, không kẻ dòng:
   các ô dính thành từng dòng text → user thấy "bảng không hiển thị".
   Ảnh hưởng cả hồ sơ user lẫn hồ sơ AI Agent (cùng khối .profile-bio
   .bio-md trong profile/show.html) + admin/user_detail (.bio-md).
   Fix: đồng bộ style bảng với .prose-md (viền, thead nền, zebra, hover,
   alignment GFM :---:) + display:block overflow-x:auto vì cột bio hẹp
   (max-width 560px) — bảng so sánh nhiều cột cuộn ngang mượt thay vì vỡ
   layout. Kích thước chữ tiết chế 0.82em cho vừa khối bio. */
.bio-md table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.6em 0;
    font-size: 0.82em;
    line-height: 1.5;
    display: block;
    overflow-x: auto;
    /* Bảng trong bio thường ngắn — không để nó chiếm cả chiều rộng nếu
       nội dung hẹp (khác .prose-md: bài viết luôn full-width). */
    max-width: 100%;
}
.bio-md table thead {
    background: var(--bg-subtle, rgba(0,0,0,0.03));
}
.bio-md table th,
.bio-md table td {
    border: 1px solid var(--border, #d0d7de);
    padding: 0.4em 0.65em;
    text-align: left;
    vertical-align: top;
    word-break: normal;
}
.bio-md table th {
    font-weight: 600;
    white-space: nowrap;
}
/* Alignment GFM (:--- / :---: / ---:) — comrak phát align attr */
.bio-md table th[align="center"],
.bio-md table td[align="center"] { text-align: center; }
.bio-md table th[align="right"],
.bio-md table td[align="right"] { text-align: right; }
/* Zebra + hover — giúp bảng so sánh nhiều dòng đọc không lệch hàng */
.bio-md table tbody tr:nth-child(even) {
    background: var(--bg-subtle, rgba(0,0,0,0.02));
}
.bio-md table tbody tr:hover {
    background: rgba(99, 102, 241, 0.06);
}
[data-theme="dark"] .bio-md table tbody tr:hover {
    background: rgba(129, 140, 248, 0.08);
}
/* Bảng trong bio cũng sortable (app.js quét .bio-md table từ v3.12.0) */
.bio-md table.sortable th[role="columnheader"] {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 20px;
}
.bio-md table.sortable th[role="columnheader"]::after {
    content: "↕";
    position: absolute;
    right: 5px;
    opacity: 0.45;
    font-size: 0.85em;
}
.bio-md table.sortable th[aria-sort="ascending"]::after {
    content: "↑";
    opacity: 1;
}
.bio-md table.sortable th[aria-sort="descending"]::after {
    content: "↓";
    opacity: 1;
}

/* v3.12.0 — Vá đồng bộ tiếp 9 nhóm element bio render được nhưng trước
   đây không có style (kết quả quét diff .prose-md vs .bio-md): */

/* Ảnh trong bio — chặn tràn layout cột hồ sơ (max-width 560px) */
.bio-md img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 0.4em 0;
}
/* Spoiler ||nội dung|| — trước đây hiện THẲNG nội dung (tính năng vỡ) */
.bio-md .spoiler {
    background: var(--fg-subtle, #888);
    color: transparent;
    border-radius: 3px;
    padding: 0 0.2em;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    user-select: none;
}
.bio-md .spoiler:hover {
    background: var(--fg-muted, #666);
}
.bio-md .spoiler:focus,
.bio-md .spoiler:active {
    background: transparent;
    color: inherit;
    outline: 1px dashed var(--accent, #2563eb);
}
/* Task list - [ ] / - [x] — bỏ bullet nhân đôi với checkbox */
.bio-md li:has(> input[type="checkbox"]) {
    list-style: none;
    margin-left: -1.3em;
}
.bio-md input[type="checkbox"] {
    margin-right: 0.4em;
    vertical-align: middle;
    accent-color: var(--accent, #2563eb);
    width: 1em;
    height: 1em;
    cursor: default;
}
/* Phím [[Ctrl]] → <kbd> — tiết chế hơn article nhưng vẫn "hình phím" */
.bio-md kbd {
    display: inline-block;
    padding: 1px 5px;
    font-family: var(--font-mono, monospace);
    font-size: 0.8em;
    line-height: 1.4;
    color: var(--fg-default, #eee);
    background: var(--bg-subtle, #1a2230);
    border: 1px solid var(--border-default, #2a3242);
    border-bottom-width: 2px;
    border-radius: 5px;
    box-shadow: 0 1px 0 var(--border-default, #2a3242);
    white-space: nowrap;
    vertical-align: middle;
}
/* Math $..$ / $$..$$ — CSS fallback khi KaTeX chưa load (JS tắt/chậm) */
.bio-md .math.inline,
.bio-md .math-inline {
    font-family: var(--font-mono, 'JetBrains Mono', 'Cambria Math', monospace);
    font-style: italic;
    background: var(--bg-code-inline, rgba(175,184,193,0.2));
    padding: 0.1em 0.3em;
    border-radius: 3px;
}
.bio-md .math.display,
.bio-md .math-display {
    display: block;
    font-family: var(--font-mono, 'JetBrains Mono', 'Cambria Math', monospace);
    font-style: italic;
    background: var(--bg-code-inline, rgba(175,184,193,0.2));
    padding: 0.5em 0.8em;
    border-radius: 6px;
    text-align: center;
    margin: 0.6em 0;
    overflow-x: auto;
}
.bio-md .katex { font-size: 1.02em; }
.bio-md .katex-display {
    margin: 0.6em 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 3px 0;
}
/* Footnotes [^1] — tiết chế: không border-top đậm như article */
.bio-md .footnotes {
    margin-top: 1em;
    padding-top: 0.5em;
    border-top: 1px solid var(--border-muted, #e5e7eb);
    font-size: 0.8em;
    color: var(--fg-muted, #666);
}
.bio-md .footnote-ref a { text-decoration: none; }
.bio-md sup {
    font-size: 0.75em;
    line-height: 0;
    vertical-align: super;
}
/* Description list Term\n: Def */
.bio-md dl {
    margin: 0.5rem 0;
    padding-left: 0.8rem;
    border-left: 3px solid rgba(99, 102, 241, 0.25);
}
.bio-md dt {
    font-weight: 600;
    margin-top: 0.35rem;
}
.bio-md dd {
    margin: 0.15rem 0 0.4rem 0.9rem;
    color: var(--text-muted, #4b5563);
}
[data-theme="dark"] .bio-md dd { color: #9ca3af; }
/* Strikethrough màu muted + hr mảnh */
.bio-md del { color: var(--fg-muted, #999); }
.bio-md hr {
    border: none;
    border-top: 1px solid var(--border, #d0d7de);
    margin: 0.8em 0;
    height: 0;
}
/* Callout > [!NOTE] (v3.12.0 render_bio) — tiết chế cho cột bio */
.bio-md blockquote.callout {
    border-left-width: 4px;
    border-radius: 6px;
    padding: 0.6em 0.8em;
    margin: 0.6em 0;
}
/* Mermaid ```mermaid (v3.12.0 render_bio) — co vừa cột bio */
.bio-md .mermaid {
    display: flex;
    justify-content: center;
    margin: 0.6em 0;
    padding: 0.5em;
    background: var(--bg-subtle, rgba(0,0,0,0.03));
    border-radius: 6px;
    overflow-x: auto;
}
.bio-md .mermaid svg { max-width: 100%; height: auto; }
/* Token màu syntect (class style) cho code block bio — trước đây 1 màu
   phẳng vì thiếu selector .bio-md .hljs-* */
.bio-md .hljs-keyword, .bio-md .keyword { color: #ff7b72; font-weight: 600; }
.bio-md .hljs-string, .bio-md .string { color: #a5d6ff; }
.bio-md .hljs-comment, .bio-md .comment { color: #8b949e; font-style: italic; }
.bio-md .hljs-number, .bio-md .constant { color: #79c0ff; }
.bio-md .hljs-function, .bio-md .function { color: #d2a8ff; }
.bio-md .hljs-title, .bio-md .title { color: #d2a8ff; font-weight: 600; }
.bio-md .hljs-type, .bio-md .type { color: #ffa657; }
.bio-md .hljs-variable, .bio-md .variable { color: #ffd866; }
.bio-md .hljs-built_in, .bio-md .builtin { color: #79c0ff; }
.bio-md .hljs-meta, .bio-md .meta { color: #8b949e; }
.bio-md .hljs-tag, .bio-md .tag { color: #7ee787; }
.bio-md .hljs-attr, .bio-md .attribute { color: #79c0ff; }
[data-theme="light"] .bio-md .hljs-keyword, [data-theme="light"] .bio-md .keyword { color: #cf222e; }
[data-theme="light"] .bio-md .hljs-string, [data-theme="light"] .bio-md .string { color: #0a3069; }
[data-theme="light"] .bio-md .hljs-comment, [data-theme="light"] .bio-md .comment { color: #6e7781; }
[data-theme="light"] .bio-md .hljs-number, [data-theme="light"] .bio-md .constant { color: #0550ae; }
[data-theme="light"] .bio-md .hljs-title, [data-theme="light"] .bio-md .function { color: #8250df; }
[data-theme="light"] .bio-md .hljs-type, [data-theme="light"] .bio-md .type { color: #953800; }

/* --- 7) Badge "Hỗ trợ Markdown" trên label form --- */
.md-support-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #a21caf;
    background: rgba(162, 28, 175, 0.1);
    border: 1px solid rgba(162, 28, 175, 0.25);
    padding: 0.1em 0.5em;
    border-radius: 999px;
    vertical-align: middle;
    margin-left: 0.35em;
}
[data-theme="dark"] .md-support-badge {
    color: #d8b4fe;
    background: rgba(162, 28, 175, 0.18);
    border-color: rgba(216, 180, 254, 0.3);
}

/* ============================================================
   v2.7.0 — Social links trên hồ sơ (10 nền tảng)
   Icon brand: simple-icons (CC0). Hover đổi màu brand.
   ============================================================ */
.profile-social {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: var(--fg-muted);
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    transition: transform 0.15s ease, color 0.15s ease,
        border-color 0.15s ease, background 0.15s ease,
        box-shadow 0.15s ease;
}

.social-link:hover,
.social-link:focus-visible {
    transform: translateY(-2px);
    background: var(--bg-canvas);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.social-link svg {
    width: 17px;
    height: 17px;
}

/* Màu thương hiệu khi hover (chỉ đổi icon + viền, nền vẫn neutral
   để hoạt động trên cả light + dark theme) */
.social-github:hover { color: #24292f; border-color: #24292f; }
.social-facebook:hover { color: #1877f2; border-color: #1877f2; }
.social-zalo:hover { color: #0068ff; border-color: #0068ff; }
.social-discord:hover { color: #5865f2; border-color: #5865f2; }
.social-youtube:hover { color: #ff0000; border-color: #ff0000; }
.social-tiktok:hover { color: #ee1d52; border-color: #ee1d52; }
.social-instagram:hover { color: #e4405f; border-color: #e4405f; }
.social-twitter:hover { color: #1d9bf0; border-color: #1d9bf0; }
.social-telegram:hover { color: #26a5e4; border-color: #26a5e4; }
.social-website:hover { color: #10b981; border-color: #10b981; }

[data-theme="dark"] .social-link {
    background: rgba(177, 186, 196, 0.08);
    color: var(--fg-muted);
}
[data-theme="dark"] .social-github:hover { color: #f0f6fc; }

/* --- Form edit: grid 10 input mạng xã hội --- */
.social-edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
    margin-top: 6px;
}

.social-edit-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.social-edit-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--fg-muted);
}

/* ============================================================
   v2.9.0 — GAMIFICATION: check-in, cấp độ, huy hiệu, leaderboard,
   collections, reviews, activity feed, typing indicator, confetti
   ============================================================ */

/* --- Widget điểm danh (trang chủ) --- */
.checkin-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding: 18px 22px;
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    box-shadow: 0 1px 3px rgb(0 0 0 / 6%);
}
.checkin-skeleton { min-height: 72px; }
.skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--border-muted) 25%, var(--bg-elevated) 50%, var(--border-muted) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    margin-bottom: 8px;
    width: 60%;
}
.skeleton-line.short { width: 35%; }
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.checkin-info { flex: 1; min-width: 220px; }
.checkin-level { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.checkin-streak { font-size: 0.85rem; font-weight: 600; color: #f97316; }
.checkin-done, .checkin-done-big {
    font-weight: 600; color: #16a34a;
}
.checkin-success { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.checkin-success-icon { font-size: 1.8rem; animation: checkin-pop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55); }
.checkin-success-title { font-weight: 800; font-size: 1.05rem; }
.checkin-success-detail { color: var(--fg-muted); font-size: 0.9rem; }
@keyframes checkin-pop {
    0% { transform: scale(0); }
    80% { transform: scale(1.15); }
    100% { transform: scale(1); }
}
.checkin-btn { font-weight: 700; }
.checkin-card-result { border-color: #16a34a66; }

/* --- Chip cấp độ + thanh XP --- */
.level-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    background: linear-gradient(120deg, #6366f1, #8b5cf6, #a855f7);
    color: #fff;
    white-space: nowrap;
}
.level-chip-lg { font-size: 0.85rem; padding: 4px 14px; }
.level-title { font-weight: 700; color: var(--fg-default); }
.checkin-xp-bar {
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--border-muted);
    overflow: hidden;
    margin: 6px 0;
}
.checkin-xp-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #d946ef);
    transition: width 0.6s ease;
}
.checkin-xp-text, .profile-xp-text {
    font-size: 0.78rem;
    color: var(--fg-muted);
    font-variant-numeric: tabular-nums;
}

/* --- Confetti (điểm danh / huy hiệu) --- */
.confetti-piece {
    position: fixed;
    top: -12px;
    width: 9px;
    height: 14px;
    z-index: 9999;
    pointer-events: none;
    animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(105vh) rotate(720deg); opacity: 0.6; }
}

/* --- Bảng xếp hạng --- */
.leaderboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 28px;
    align-items: start;
}
@media (max-width: 900px) { .leaderboard-layout { grid-template-columns: 1fr; } }
.leaderboard-subtitle { font-size: 1.05rem; font-weight: 800; margin-bottom: 14px; }
.leaderboard-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
}
.leaderboard-top-1 { border-color: #f59e0b88; box-shadow: 0 0 14px rgb(245 158 11 / 12%); }
.leaderboard-top-2 { border-color: #94a3b888; }
.leaderboard-top-3 { border-color: #d9770666; }
.leaderboard-rank {
    min-width: 34px;
    text-align: center;
    font-weight: 900;
    font-size: 1.1rem;
    font-variant-numeric: tabular-nums;
    color: var(--fg-muted);
}
.leaderboard-top-1 .leaderboard-rank { color: #f59e0b; }
.leaderboard-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.leaderboard-user:hover .leaderboard-display-name { color: var(--accent); }
.leaderboard-name { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.leaderboard-display-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-stats { display: flex; align-items: center; gap: 12px; font-size: 0.8rem; color: var(--fg-muted); white-space: nowrap; }
.leaderboard-xp { font-weight: 800; color: #8b5cf6; font-variant-numeric: tabular-nums; }
.leaderboard-streak { color: #f97316; font-weight: 600; }
.leaderboard-side { display: flex; flex-direction: column; gap: 20px; }
.hotweek-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.hotweek-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; border-radius: var(--radius-md);
    border: 1px solid var(--border-muted); background: var(--bg-elevated);
}
.hotweek-rank { font-weight: 800; color: var(--fg-muted); min-width: 20px; }
.hotweek-title { flex: 1; min-width: 0; font-weight: 600; text-decoration: none; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hotweek-title:hover { color: var(--accent); }
.hotweek-meta { font-size: 0.75rem; color: var(--fg-muted); white-space: nowrap; }
.leaderboard-cta {
    padding: 14px 16px; border-radius: var(--radius-lg);
    background: var(--bg-subtle); border: 1px dashed var(--border-default);
    font-size: 0.85rem;
}
.leaderboard-rules { margin: 8px 0 0; padding-left: 18px; color: var(--fg-muted); }
.leaderboard-rules li { margin-bottom: 3px; }

/* --- Trang huy hiệu --- */
.achievements-summary {
    display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
    padding: 16px 22px; margin-bottom: 10px;
    border: 1px solid var(--border-muted); border-radius: var(--radius-lg);
    background: var(--bg-elevated);
}
.ach-summary-item { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.ach-summary-value { font-weight: 900; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.ach-summary-label { font-size: 0.75rem; color: var(--fg-muted); }
.ach-summary-progress { flex: 1; min-width: 180px; }
.achievements-hint { color: var(--fg-muted); font-size: 0.85rem; margin-bottom: 18px; }
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}
.achievement-card {
    display: flex; align-items: center; gap: 14px;
    padding: 16px; border-radius: var(--radius-lg);
    border: 1px solid var(--border-muted); background: var(--bg-elevated);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.achievement-card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgb(0 0 0 / 10%); }
.achievement-earned { border-color: #8b5cf666; }
.achievement-earned .achievement-icon { filter: none; }
.achievement-locked { opacity: 0.62; }
.achievement-locked .achievement-icon { filter: grayscale(1); font-size: 1.6rem; }
.achievement-icon { font-size: 2rem; line-height: 1; flex-shrink: 0; }
.achievement-icon-sm { font-size: 1.1rem; }
.achievement-body { flex: 1; min-width: 0; }
.achievement-title { font-size: 0.95rem; font-weight: 800; margin: 0 0 4px; }
.achievement-desc { font-size: 0.8rem; color: var(--fg-muted); margin: 0 0 6px; }
.achievement-meta { display: flex; gap: 10px; font-size: 0.72rem; flex-wrap: wrap; }
.achievement-xp { color: #8b5cf6; font-weight: 700; }
.achievement-date, .achievement-locked-label { color: var(--fg-muted); }
.achievement-showcased { border-color: #f59e0b88; box-shadow: 0 0 10px rgb(245 158 11 / 15%); }

/* --- Bộ sưu tập --- */
.collections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}
.collection-card {
    position: relative;
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    padding: 18px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.collection-card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgb(0 0 0 / 10%); }
.collection-card-link { text-decoration: none; color: inherit; display: block; }
.collection-title { margin: 0 0 6px; font-size: 1rem; font-weight: 800; }
.collection-desc { margin: 0 0 10px; font-size: 0.85rem; color: var(--fg-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.collection-meta { display: flex; gap: 12px; font-size: 0.75rem; color: var(--fg-muted); flex-wrap: wrap; }
.collection-visibility { color: var(--accent); font-weight: 600; }
.collection-create-form { margin-bottom: 24px; padding: 16px; border: 1px dashed var(--border-default); border-radius: var(--radius-lg); }
.collection-create-form .form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.collection-create-form input[type="text"] { flex: 1; min-width: 200px; }
.form-check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88rem; white-space: nowrap; }
.collection-delete-form { position: absolute; top: 10px; right: 10px; }
.collection-page-desc { color: var(--fg-muted); margin: 4px 0 0; }
.collection-meta-page { margin-top: 8px; }
.collection-owner { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--fg-muted); font-size: 0.9rem; }
.collection-owner:hover strong { color: var(--accent); }
.add-to-collection { margin-top: 16px; }
.collection-add-form { display: flex; gap: 8px; margin-bottom: 8px; }
.collection-add-form select { flex: 1; }
.collection-remove-form { display: inline-block; margin: 2px 4px 2px 0; }
.collection-remove-btn {
    border: 1px solid var(--border-muted); background: var(--bg-subtle);
    color: var(--fg-muted); font-size: 0.72rem; padding: 2px 10px;
    border-radius: var(--radius-full); cursor: pointer;
}
.collection-remove-btn:hover { color: #dc2626; border-color: #dc262666; }
.collection-empty-hint { font-size: 0.8rem; color: var(--fg-muted); margin: 0 0 8px; }

/* --- Reviews --- */
.reviews-section { margin-top: 36px; }
.reviews-title { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; margin-bottom: 16px; }
.reviews-count { color: var(--fg-muted); font-weight: 600; font-size: 0.9rem; }
.reviews-login-hint { color: var(--fg-muted); }
.review-form-card {
    padding: 16px; margin-bottom: 20px;
    border: 1px solid var(--border-muted); border-radius: var(--radius-lg);
    background: var(--bg-elevated);
}
.review-form-note { font-size: 0.85rem; color: var(--fg-muted); margin: 0 0 10px; }
.review-form { display: flex; flex-direction: column; gap: 10px; }
.review-form-rating { display: flex; align-items: center; gap: 12px; }
.review-rating-label { font-size: 0.88rem; font-weight: 600; }
.rating-input-stars { display: inline-flex; gap: 2px; }
.rating-star-label { cursor: pointer; }
.rating-star-label input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rating-star { font-size: 1.5rem; color: var(--border-strong); transition: color 0.12s ease, transform 0.12s ease; display: inline-block; }
.rating-star-label:hover .rating-star { transform: scale(1.15); }
.rating-star-label input:checked ~ .rating-star,
.rating-star-label input:focus-visible ~ .rating-star { color: #f59e0b; }
.rating-star-label input:focus-visible ~ .rating-star { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.review-title-input, .review-content-input {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--border-default); border-radius: var(--radius-md);
    background: var(--bg-default); color: var(--fg-default); font: inherit;
}
.review-content-input { resize: vertical; min-height: 90px; }
.review-form-actions { display: flex; gap: 10px; align-items: center; }
.reviews-list { display: flex; flex-direction: column; gap: 14px; }
.review-card {
    padding: 16px 18px;
    border: 1px solid var(--border-muted); border-radius: var(--radius-lg);
    background: var(--bg-elevated);
}
.review-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.review-author { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; font-weight: 700; }
.review-author:hover .review-author-name { color: var(--accent); }
.review-stars { color: #f59e0b; letter-spacing: 2px; font-size: 0.9rem; }
.review-date { color: var(--fg-muted); font-size: 0.78rem; margin-left: auto; }
.review-title { margin: 0 0 6px; font-size: 1rem; }
.review-content { font-size: 0.9rem; color: var(--fg-muted); }
.review-footer { margin-top: 10px; display: flex; gap: 10px; align-items: center; }
.review-helpful-count { font-size: 0.8rem; color: var(--fg-muted); }
.btn-danger-outline { color: #dc2626; border-color: #dc262666; }
.btn-danger-outline:hover { background: #dc262611; }

/* --- Phiên đăng nhập (user) --- */
.sessions-list { display: flex; flex-direction: column; gap: 10px; }
.session-row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 16px; border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg); background: var(--bg-elevated);
    flex-wrap: wrap;
}
.session-current { border-color: #16a34a66; }
.session-info { min-width: 0; flex: 1; }
.session-ua { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.78rem; color: var(--fg-muted); margin-top: 4px; }
.session-current-badge {
    background: #16a34a1a; color: #16a34a; font-weight: 700;
    padding: 1px 8px; border-radius: var(--radius-full); font-size: 0.72rem;
}

/* --- Gamification trên hồ sơ --- */
.profile-level-block { margin-top: 12px; }
.profile-level-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-streak { font-size: 0.8rem; font-weight: 700; color: #f97316; }
.profile-showcase { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.showcase-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: var(--radius-full);
    border: 1px solid #f59e0b66; background: #f59e0b14;
    font-size: 0.78rem; font-weight: 700;
}
.showcase-icon { font-size: 1rem; }
.profile-achievements-row { display: flex; gap: 8px; flex-wrap: wrap; }
.mini-achievement {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: var(--radius-full);
    border: 1px solid var(--border-muted); background: var(--bg-elevated);
    font-size: 0.78rem; font-weight: 600;
}
.mini-achievement-icon { font-size: 1rem; }
.activity-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.activity-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: var(--radius-md);
    border: 1px solid var(--border-muted); background: var(--bg-elevated);
    font-size: 0.88rem;
}
.activity-text { flex: 1; min-width: 0; }
.activity-xp { color: #8b5cf6; font-weight: 800; font-size: 0.8rem; white-space: nowrap; }
.activity-time { color: var(--fg-muted); font-size: 0.75rem; white-space: nowrap; }

/* --- Chat: typing indicator + online users --- */
.typing-indicator {
    min-height: 20px; padding: 2px 10px; margin-top: 4px;
    font-size: 0.78rem; color: var(--fg-muted); font-style: italic;
}
.typing-dots::after {
    content: "…";
    animation: typing-dots 1.2s steps(4, end) infinite;
}
@keyframes typing-dots {
    0% { content: ""; }
    25% { content: "."; }
    50% { content: ".."; }
    75% { content: "..."; }
}
.chat-online-panel {
    border-top: 1px solid var(--border-muted); padding-top: 10px; margin-top: 10px;
    max-height: 160px; overflow-y: auto;
}
.chat-online-panel h4 { margin: 0 0 8px; font-size: 0.8rem; color: var(--fg-muted); }
.online-user-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 0.85rem; }
.online-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #16a34a; flex-shrink: 0;
    box-shadow: 0 0 6px #16a34a99;
}
.online-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.online-avatar-fallback {
    width: 22px; height: 22px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bg-subtle); font-size: 0.6rem; font-weight: 700;
}

/* --- Khóa phím tắt (? dialog) --- */
.kbd-help-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgb(0 0 0 / 45%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.kbd-help-dialog {
    background: var(--bg-elevated); border-radius: var(--radius-lg);
    padding: 24px 28px; max-width: 420px; width: 100%;
    box-shadow: 0 20px 60px rgb(0 0 0 / 30%);
}
.kbd-help-dialog h3 { margin: 0 0 14px; }
.kbd-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 0.9rem; }
kbd.kbd-key {
    background: var(--bg-subtle); border: 1px solid var(--border-default);
    border-bottom-width: 2px; border-radius: 6px;
    padding: 2px 8px; font-family: var(--font-mono, monospace);
    font-size: 0.8rem; font-weight: 600;
}

/* --- Admin achievements --- */
.ach-holders-bar { width: 120px; height: 8px; border-radius: var(--radius-full); background: var(--border-muted); overflow: hidden; }
.ach-holders-fill { height: 100%; background: linear-gradient(90deg, #6366f1, #a855f7); border-radius: var(--radius-full); }

/* --- Section title accent (Game của tuần) --- */
.section-title-accent { color: #d946ef; }

/* --- Sidebar card game show (random + collection) --- */
.random-game-card { text-align: center; }
.btn-block { display: block; width: 100%; justify-content: center; }

/* --- Toast achievement (special) --- */
.toast-achievement { border-left: 4px solid #f59e0b; }

@media (prefers-reduced-motion: reduce) {
    .skeleton-line, .checkin-success-icon, .confetti-piece { animation: none !important; }
    .achievement-card, .collection-card { transition: none; }
}

/* v2.9.0 — heading khối gợi ý trong search dropdown */
.search-suggest-heading {
    padding: 8px 14px 4px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fg-muted);
}

/* ============================================================
   v3.0.0 — RETENTION: quests, spin, trivia, shop, referral,
   heatmap, streak banner, onboarding, calendar, season boards,
   release countdown, invite rating, chat name glow, XP toast.
   ============================================================ */

/* --- Toast XP (global, dùng data-xp-toast trên partial HTMX) --- */
.xp-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff;
  padding: 10px 22px; border-radius: 999px; font-weight: 700; font-size: .95rem;
  box-shadow: 0 8px 24px rgba(34,197,94,.4); z-index: 9999;
  animation: xp-toast-in .3s cubic-bezier(.2,1.4,.4,1), xp-toast-out .4s ease 2.2s forwards;
  pointer-events: none;
}
@keyframes xp-toast-in { from { opacity: 0; transform: translate(-50%, 16px) scale(.9); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes xp-toast-out { to { opacity: 0; transform: translate(-50%, -8px); } }

/* --- Quests --- */
.quest-level-chip { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.quest-list { display: flex; flex-direction: column; gap: .75rem; margin: 1rem 0 2rem; }
.quest-card { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem;
  border: 1px solid var(--border-muted); border-radius: 14px; background: var(--bg-canvas);
  transition: border-color .2s, transform .15s; }
.quest-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.quest-completed-card { border-color: #22c55e55; background: linear-gradient(135deg, rgba(34,197,94,.06), transparent); }
.quest-claimed-card { opacity: .65; }
.quest-icon { font-size: 1.75rem; flex-shrink: 0; }
.quest-body { flex: 1; min-width: 0; }
.quest-title { font-size: 1rem; font-weight: 700; margin: 0 0 .15rem; }
.quest-desc { font-size: .85rem; color: var(--text-dim); margin: 0 0 .5rem; }
.quest-progress-bar { height: 6px; border-radius: var(--radius-full); background: var(--border-muted); overflow: hidden; margin-bottom: .3rem; }
.quest-progress-fill { height: 100%; background: linear-gradient(90deg, #22c55e, #84cc16); border-radius: var(--radius-full); transition: width .4s ease; }
.quest-progress-label { font-size: .75rem; color: var(--text-dim); }
.quest-claimed { color: #22c55e; font-weight: 700; white-space: nowrap; }
.quest-pending { color: var(--text-dim); font-size: .85rem; white-space: nowrap; }
.section-more-group { display: flex; gap: 1rem; flex-wrap: wrap; }

/* --- Spin (đa số style nằm trong spin.html head_extra) --- */
.spin-result.celebrate { animation: pop-in .45s cubic-bezier(.2,1.4,.4,1), celebrate-glow 1.2s ease .2s; }
@keyframes celebrate-glow { 0%,100% { box-shadow: none; } 50% { box-shadow: 0 0 48px rgba(245,158,11,.8); } }

/* --- Trivia --- */
.trivia-list { display: flex; flex-direction: column; gap: 1rem; }
.trivia-card { padding: 1.25rem 1.5rem; border: 1px solid var(--border-muted); border-radius: 14px; background: var(--bg-canvas); }
.trivia-question { margin: 0 0 1rem; font-size: 1.05rem; }
.trivia-choices { display: grid; gap: .5rem; }
.trivia-choice { text-align: left; padding: .65rem 1rem; border-radius: 10px; border: 1px solid var(--border-muted);
  background: var(--bg-soft); color: var(--text); cursor: pointer; transition: border-color .15s, background .15s; font-size: .95rem; }
.trivia-choice:hover:not(:disabled) { border-color: #6366f1; background: rgba(99,102,241,.08); }
.trivia-choices-review .trivia-choice { cursor: default; }
.trivia-choice.correct { border-color: #22c55e; background: rgba(34,197,94,.12); color: #16a34a; font-weight: 600; }
.trivia-choice.wrong { border-color: #ef4444; background: rgba(239,68,68,.1); color: #dc2626; }
.trivia-choice.dim { opacity: .55; }
.trivia-feedback { margin-top: 1rem; padding: .75rem 1rem; border-radius: 10px; animation: pop-in .3s ease; }
.trivia-feedback.correct { background: rgba(34,197,94,.1); border: 1px solid #22c55e55; }
.trivia-feedback.wrong { background: rgba(239,68,68,.08); border: 1px solid #ef444455; }
.trivia-explanation { margin: .5rem 0 0; font-size: .85rem; color: var(--text-dim); }
.trivia-bonus { margin-top: .75rem; padding: .6rem 1rem; border-radius: 10px; background: linear-gradient(135deg, rgba(245,158,11,.15), rgba(234,179,8,.1)); border: 1px solid #f59e0b55; font-weight: 600; }

/* --- Shop --- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.shop-card { padding: 1.5rem 1.25rem; border: 1px solid var(--border-muted); border-radius: 16px;
  background: var(--bg-canvas); display: flex; flex-direction: column; gap: .6rem; align-items: flex-start;
  transition: transform .15s, border-color .2s; }
.shop-card:hover { transform: translateY(-2px); border-color: #a855f766; }
.shop-item-icon { font-size: 2.25rem; }
.shop-item-name { margin: 0; font-size: 1.05rem; }
.shop-item-desc { margin: 0; font-size: .85rem; color: var(--text-dim); flex: 1; }
.shop-owned { margin: 0; font-size: .8rem; color: #22c55e; }
.shop-result { width: 100%; }

/* --- Referral --- */
.referral-link-line { word-break: break-all; }

/* --- Heatmap (GitHub-style) --- */
.profile-heat-row { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 720px) { .profile-heat-row { grid-template-columns: 1fr; } }
.heatmap-grid { display: flex; gap: 3px; overflow-x: auto; padding-bottom: .5rem; }
.heatmap-col { display: flex; flex-direction: column; gap: 3px; }
.heatmap-cell { width: 12px; height: 12px; border-radius: 3px; background: var(--border-muted); display: inline-block; }
.heatmap-cell.heat-0 { background: var(--border-muted); }
.heatmap-cell.heat-1 { background: #22c55e40; }
.heatmap-cell.heat-2 { background: #22c55e80; }
.heatmap-cell.heat-3 { background: #22c55eb0; }
.heatmap-cell.heat-4 { background: #22c55e; }
.heatmap-legend { display: flex; align-items: center; gap: 4px; font-size: .72rem; color: var(--text-dim); margin-top: .5rem; }
.completeness-block { text-align: center; }
.completeness-ring { width: 120px; height: 120px; margin: 0 auto 1rem; border-radius: 50%;
  background: conic-gradient(#a855f7 calc(var(--pct, 0) * 1%), var(--border-muted) 0);
  display: flex; align-items: center; justify-content: center; position: relative; }
.completeness-ring::after { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--bg); }
.completeness-num { position: relative; z-index: 1; font-size: 1.6rem; font-weight: 800; }
.completeness-note { font-size: .85rem; color: var(--text-dim); }

/* --- Streak banner --- */
.streak-banner { display: flex; align-items: center; gap: 1rem; margin: 1.25rem auto; padding: 1rem 1.5rem;
  max-width: 1100px; border-radius: 14px; background: linear-gradient(135deg, rgba(245,158,11,.15), rgba(239,68,68,.1));
  border: 1px solid #f59e0b66; }
.streak-banner-icon { font-size: 2rem; }
.streak-banner-text { flex: 1; display: flex; flex-direction: column; gap: .15rem; }
.streak-banner-text em { color: #f59e0b; font-style: normal; font-weight: 800; }

/* --- Onboarding widget --- */
.onboarding-widget { max-width: 1100px; margin: 1.25rem auto; padding: 1.5rem; border-radius: 16px;
  background: linear-gradient(135deg, rgba(99,102,241,.08), rgba(168,85,247,.06));
  border: 1px solid #6366f155; }
.onboarding-title { margin: 0 0 .25rem; font-size: 1.15rem; }
.onboarding-sub { margin: 0 0 1rem; color: var(--text-dim); font-size: .9rem; }
.onboarding-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.onboarding-step { display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem; border-radius: 10px; background: var(--bg-canvas); }
.onboarding-step.onboarding-done { opacity: .6; }
.onboarding-step.onboarding-done .onboarding-label { text-decoration: line-through; }
.onboarding-check { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--border-muted); font-size: .8rem; font-weight: 700; flex-shrink: 0; }
.onboarding-done .onboarding-check { background: #22c55e; color: #fff; }
.onboarding-icon { font-size: 1.1rem; }
.onboarding-label { flex: 1; }
.onboarding-xp { color: #22c55e; font-weight: 700; font-size: .85rem; }

/* --- Game của ngày + upcoming --- */
.gotd-grid { max-width: 420px; }
.gotd-hint { color: var(--text-dim); font-size: .85rem; margin-top: -.5rem; }
.upcoming-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.upcoming-item { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-radius: 12px;
  border: 1px solid var(--border-muted); background: var(--bg-canvas); color: var(--text); transition: border-color .15s; }
.upcoming-item:hover { border-color: #0ea5e9; }
.upcoming-item img { border-radius: 8px; object-fit: cover; }
.upcoming-fallback { font-size: 1.75rem; }
.upcoming-title { flex: 1; font-weight: 600; font-size: .92rem; }
.upcoming-date { font-size: .8rem; color: #0ea5e9; white-space: nowrap; }

/* --- Release countdown + invite rating (game detail) --- */
.release-countdown { display: flex; align-items: center; gap: .75rem; margin: 1.5rem 0; padding: 1rem 1.25rem;
  border-radius: 12px; background: linear-gradient(135deg, rgba(14,165,233,.12), rgba(99,102,241,.08));
  border: 1px solid #0ea5e955; }
.countdown-icon { font-size: 1.5rem; }
.invite-rating { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1rem 0;
  padding: .9rem 1.25rem; border-radius: 12px; background: rgba(245,158,11,.08); border: 1px dashed #f59e0b66; }

/* --- Leaderboard: season boards + calendar --- */
.season-boards { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin: 2rem 0; }
@media (max-width: 860px) { .season-boards { grid-template-columns: 1fr; } }
.season-list .leaderboard-xp { margin-left: auto; color: #22c55e; font-weight: 700; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: .5rem; }
.calendar-day { aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; font-size: .72rem; background: var(--border-muted); color: var(--text-dim); }
.calendar-day.calendar-checked { background: #22c55e; color: #fff; font-weight: 700; }
.calendar-day.calendar-today { outline: 2px solid #f59e0b; outline-offset: 1px; }
.calendar-day.calendar-future { opacity: .35; }

/* --- Chat name glow (cửa hàng XP) --- */
.chat-name-glow { text-shadow: 0 0 8px rgba(245,158,11,.9), 0 0 16px rgba(245,158,11,.5); color: #fbbf24; }

/* ============================================================
   33. v3.2.0 — MOBILE COMMENT GUARDS (fix tràn dọc trên điện thoại)
   ============================================================ */
@media (max-width: 640px) {
    .comment-item {
        gap: 10px;
        padding: 13px 0;
    }

    .comment-item.pinned {
        padding: 13px;
    }

    .comment-body {
        flex: 1 1 0%;
        min-width: 0;
        overflow: hidden;
    }

    .comment-header {
        gap: 5px;
        row-gap: 3px;
    }

    .comment-content {
        font-size: 13.5px;
        line-height: 1.55;
        /* pre-wrap giữ khoảng trắng nhưng dòng cực dài không được phép
           tràn ngang → cuộn ngang trên mobile là nguồn gốc của cảm giác
           "tràn"; chiều dọc tự co vì <br> đã chuẩn hoá 1 break/1 dòng. */
        overflow-wrap: anywhere;
        overflow-x: hidden;
    }

    .comment-actions {
        gap: 2px 4px;
        margin-top: 5px;
    }

    .comment-action {
        padding: 3px 8px;
        font-size: 11.5px;
    }

    .comment-replies {
        padding-left: 9px;
        margin-top: 6px;
    }

    /* Nested replies lồng 2+ tầng vẫn phải nằm gọn trong viewport */
    .comment-replies .comment-item {
        padding: 11px 0;
    }

    .reply-form-container {
        padding: 10px;
    }

    .reply-form-container textarea,
    .comment-form textarea {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        resize: vertical;
    }

    .comment-form-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Form edit/reply khi mở trên mobile chiếm trọn bề ngang, không
       đẩy trang sang phải (nguyên nhân 1 của scroll ngang). */
    .reply-form-container form,
    .reply-form-container > div {
        width: 100%;
        max-width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 400px) {
    .comment-avatar .avatar-sm,
    .comment-avatar img.avatar-sm {
        width: 26px !important;
        height: 26px !important;
    }

    .comment-content {
        font-size: 13px;
    }

    .comment-author {
        font-size: 13px;
    }
}

/* ============================================================
   34. v3.2.0 — EFFECTS & ANIMATIONS
   Hiệu ứng chuyển động toàn site. Tất cả đều tôn trọng
   `prefers-reduced-motion` (accessibility — người dùng bật
   "giảm chuyển động" trên iOS/Android sẽ không thấy gì chạy).
   ============================================================ */

/* ---- Keyframes dùng chung ---- */
@keyframes kg-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes kg-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes kg-pop {
    0%   { transform: scale(.6); opacity: 0; }
    60%  { transform: scale(1.06); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes kg-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

@keyframes kg-glow-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(14,165,233,.35); }
    50%      { box-shadow: 0 0 18px 4px rgba(14,165,233,.28); }
}

@keyframes kg-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

@keyframes kg-shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

@keyframes kg-spin {
    to { transform: rotate(360deg); }
}

@keyframes kg-heartbeat {
    0%, 40%, 80%, 100% { transform: scale(1); }
    20% { transform: scale(1.22); }
    60% { transform: scale(1.14); }
}

@keyframes kg-slide-down {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes kg-confetti-fall {
    0%   { opacity: 1; transform: translate(0, -10px) rotate(0deg); }
    100% { opacity: 0; transform: translate(var(--confetti-x, 0), 90px) rotate(540deg); }
}

/* ---- Page entry: nội dung chính trượt nhẹ khi tải trang ---- */
.content-section {
    animation: kg-fade-up .45s cubic-bezier(.21,.8,.35,1) both;
}

/* Stagger nhẹ cho lưới thẻ (trang chủ, danh sách game/tin) — mỗi thẻ
   trễ 40ms hơn thẻ trước, tối đa 12 thẻ đầu để không đốt GPU. */
.game-grid > :nth-child(1)  { animation: kg-fade-up .5s .00s cubic-bezier(.21,.8,.35,1) both; }
.game-grid > :nth-child(2)  { animation: kg-fade-up .5s .04s cubic-bezier(.21,.8,.35,1) both; }
.game-grid > :nth-child(3)  { animation: kg-fade-up .5s .08s cubic-bezier(.21,.8,.35,1) both; }
.game-grid > :nth-child(4)  { animation: kg-fade-up .5s .12s cubic-bezier(.21,.8,.35,1) both; }
.game-grid > :nth-child(5)  { animation: kg-fade-up .5s .16s cubic-bezier(.21,.8,.35,1) both; }
.game-grid > :nth-child(6)  { animation: kg-fade-up .5s .20s cubic-bezier(.21,.8,.35,1) both; }
.game-grid > :nth-child(7)  { animation: kg-fade-up .5s .24s cubic-bezier(.21,.8,.35,1) both; }
.game-grid > :nth-child(8)  { animation: kg-fade-up .5s .28s cubic-bezier(.21,.8,.35,1) both; }
.game-grid > :nth-child(9)  { animation: kg-fade-up .5s .32s cubic-bezier(.21,.8,.35,1) both; }
.game-grid > :nth-child(10) { animation: kg-fade-up .5s .36s cubic-bezier(.21,.8,.35,1) both; }
.game-grid > :nth-child(11) { animation: kg-fade-up .5s .40s cubic-bezier(.21,.8,.35,1) both; }
.game-grid > :nth-child(12) { animation: kg-fade-up .5s .44s cubic-bezier(.21,.8,.35,1) both; }

/* ---- Card hover: nâng + đổ bóng sâu hơn ---- */
.game-card,
.news-card {
    transition: transform .22s cubic-bezier(.21,.8,.35,1),
                box-shadow .22s cubic-bezier(.21,.8,.35,1),
                border-color .22s;
    will-change: transform;
}

.game-card:hover,
.news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px -12px rgba(0,0,0,.28), 0 4px 12px -6px rgba(0,0,0,.14);
}

.game-card:active,
.news-card:active {
    transform: translateY(-1px) scale(.995);
    transition-duration: .08s;
}

/* ---- Button micro-interactions ---- */
.btn {
    transition: transform .12s ease, box-shadow .18s ease, background-color .18s ease,
                border-color .18s ease, color .18s ease, opacity .18s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); transition-duration: .06s; }

.btn-primary:hover {
    box-shadow: 0 6px 18px -6px rgba(14,165,233,.45);
}

/* ---- Menu mobile trượt xuống thay vì bật/tắt cứng ---- */
#site-menu:not([hidden]) {
    animation: kg-slide-down .28s cubic-bezier(.21,.8,.35,1);
}

/* ---- Toast (XP / thông báo) nổi bật hơn ---- */
.xp-toast {
    animation: kg-pop .4s cubic-bezier(.2,1.4,.4,1), kg-float 2.2s .4s ease-in-out infinite;
}

/* ---- Skeleton shimmer cho vùng đang tải HTMX ---- */
.htmx-request .skeleton,
.htmx-request.skeleton,
.skeleton {
    background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--border-muted) 50%, var(--bg-subtle) 75%);
    background-size: 800px 100%;
    animation: kg-shimmer 1.3s linear infinite;
    border-radius: var(--radius-md);
}

/* ---- Loading spinner mini cho nút HTMX đang chờ ---- */
.htmx-request.btn,
button.htmx-request {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.htmx-request.btn::after,
button.htmx-request::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 15px;
    height: 15px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: kg-spin .6s linear infinite;
}


/* ---- Avatar admin/mod: viền gradient VIP ---- */
.role-admin-badge,
.avatar-wrapper.role-admin::after {
    content: none;
}

/* Huy hiệu cấp độ trên hồ sơ phát sáng nhẹ khi hover */
.level-badge {
    transition: box-shadow .25s ease, transform .25s ease;
}

.level-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 16px 2px rgba(14,165,233,.25);
}

/* ---- Theme toggle xoay nhẹ ---- */
#themeToggle {
    transition: transform .4s cubic-bezier(.21,.8,.35,1);
}

#themeToggle:hover {
    transform: rotate(24deg) scale(1.06);
}

/* ---- Liên kết trong nội dung: gạch chân trượt ---- */
.static-content a:not(.btn) {
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0% 1.5px;
    background-repeat: no-repeat;
    background-position: 0 100%;
    transition: background-size .22s ease;
}

.static-content a:not(.btn):hover {
    background-size: 100% 1.5px;
}

/* ---- Achievement vừa mở: tim đập ---- */
.achievement-card.newly-unlocked,
.ach-card.newly-unlocked {
    animation: kg-heartbeat .9s ease 2;
}

/* ---- Giảm chuyển động: tắt toàn bộ khi user yêu cầu ---- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---- Scroll mượt (đặt SAU media query reduced-motion) ---- */
html {
    scroll-behavior: smooth;
}

/* ============================================================
   35. v3.4.0 — AI AGENT PROFILE EFFECTS (GLM 5.3)
   Hồ sơ AI có hiệu ứng riêng dùng accent color của agent
   (--ai-accent đặt inline từ ai_agent_profiles.accent_color).
   Tất cả tôn trọng prefers-reduced-motion (mục 34).
   ============================================================ */

/* v3.9.0 — XÓA toàn bộ hiệu ứng trang trí hồ sơ AI (cover gradient +
   sheen quét, avatar ring/glow “thở”, tên shimmer, username tô màu,
   badge pulse, viền gradient + scanline khối model info). Nguyên nhân
   avatar bị che cũng nằm ở đây: `.profile-cover { position: relative }`
   đưa cover sang phase positioned elements → vẽ ĐÈ LÊN vùng avatar
   chồng lên cover (margin-top -40px) + sheen quét qua mặt avatar.
   Giờ cover tĩnh như profile thường → thứ tự vẽ mặc định, avatar luôn
   trên cover. Thêm z-index phòng vệ ở .profile-info (mục 19). */

/* ---- v3.4.0 — BÁO CÁO HOẠT ĐỘNG AI (card LIVE) ---- */
.ai-activity-card {
    /* v3.9.0 — bỏ gradient border-box accent → card phẳng, nền riêng. */
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
}

.ai-activity-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.ai-activity-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--fg-default);
}

.ai-activity-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .8px;
    color: color-mix(in srgb, var(--ai-accent, #0ea5e9) 90%, var(--fg-default));
    padding: 2px 9px;
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--ai-accent, #0ea5e9) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--ai-accent, #0ea5e9) 30%, transparent);
}

.ai-activity-dot {
    /* v3.9.0 — chấm LIVE đứng yên (bỏ nhấp nháy theo yêu cầu "trắng"). */
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    opacity: .8;
}

.ai-activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
    font-size: 13px;
    min-width: 0;
}

.ai-activity-status {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    padding: 2.5px 9px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.ai-activity-task {
    flex: 1 1 160px;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    overflow-wrap: anywhere;
}

.ai-activity-task strong {
    color: var(--fg-default);
    font-weight: 650;
}

.ai-activity-action {
    color: var(--fg-subtle);
    font-size: 12.5px;
    overflow-wrap: anywhere;
}

.ai-activity-pct {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
}

.ai-activity-pct-bar {
    display: inline-block;
    width: 64px;
    height: 5px;
    border-radius: 3px;
    background: var(--border-muted);
    overflow: hidden;
}

.ai-activity-pct-fill {
    display: block;
    height: 100%;
    border-radius: 3px;
    transition: width .5s ease;
}

.ai-activity-pct-num {
    font-size: 11.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--fg-muted);
}

.ai-activity-time {
    flex-shrink: 0;
    margin-left: auto;
    font-size: 11.5px;
    color: var(--fg-subtle);
    white-space: nowrap;
}

@media (max-width: 480px) {
    .ai-activity-item { gap: 6px 8px; padding: 7px 9px; }
    .ai-activity-time { margin-left: 0; width: 100%; order: 9; }
    .ai-activity-pct { width: 100%; }
    .ai-activity-pct-bar { flex: 1; width: auto; }
}

/* Fallback cho browser không hỗ trợ color-mix (Safari <16.2).
   v3.9.0 — chỉ còn .ai-activity-live dùng color-mix (chip LIVE). */
@supports not (color: color-mix(in srgb, red, blue)) {
    .ai-activity-live { color: var(--fg-muted); }
}

/* ============================================================
   36. v3.4.0 — AI AGENT LOGIN TRANG MỚI (username + password)
   ============================================================ */
.ai-login-notice,
.ai-login-error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    line-height: 1.5;
    margin-bottom: 16px;
    text-align: left;
}

.ai-login-notice {
    background: color-mix(in srgb, var(--warning) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
    color: var(--fg-default);
}

.ai-login-notice svg { flex-shrink: 0; margin-top: 2px; color: var(--warning); }

.ai-login-error {
    background: color-mix(in srgb, var(--danger) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
    color: var(--fg-default);
    font-weight: 550;
}

.ai-login-error svg { flex-shrink: 0; margin-top: 2px; color: var(--danger); }

/* Form đăng nhập AI cách đều, input chữ mono dễ copy username */
.ai-login-form .form-group { margin-bottom: 16px; }

/* ============================================================
   37. v3.4.0 — ADMIN: AI AGENTS (tạo + mật khẩu có thời hạn)
   ============================================================ */
.ai-create-panel {
    margin: 0 0 20px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    overflow: hidden;
}

.ai-create-panel summary {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 14px 18px;
    cursor: pointer;
    font-size: 14px;
    color: var(--fg-default);
    list-style: none;
    user-select: none;
}

.ai-create-panel summary::-webkit-details-marker { display: none; }

.ai-create-panel summary:hover { background: var(--bg-subtle); }

.ai-create-panel summary svg { color: var(--accent); flex-shrink: 0; }

.ai-create-hint { color: var(--fg-subtle); font-weight: 400; font-size: 13px; }

.ai-create-form {
    padding: 4px 18px 18px;
    border-top: 1px dashed var(--border-muted);
}

.ai-create-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px 16px;
    margin: 14px 0;
}

.ai-form-full { grid-column: 1 / -1; }

.ai-pwd-input { display: flex; gap: 8px; align-items: stretch; }
.ai-pwd-input .form-control { flex: 1; min-width: 0; }

/* Flash mật khẩu hiển thị 1 lần sau tạo/đặt lại */
.ai-cred-flash {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    margin-bottom: 20px;
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, #10b981 9%, transparent);
    border: 1px solid color-mix(in srgb, #10b981 38%, transparent);
}

.ai-cred-flash > svg { color: #10b981; flex-shrink: 0; margin-top: 2px; }

.ai-cred-flash-pwd {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 8px 0;
}

.ai-cred-flash-pwd code {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .4px;
    padding: 8px 14px;
    background: var(--bg-canvas);
    border: 1px dashed color-mix(in srgb, #10b981 55%, transparent);
    border-radius: var(--radius-md);
    overflow-wrap: anywhere;
}

.ai-cred-flash-note { font-size: 12.5px; color: var(--fg-subtle); margin-top: 6px; }

/* Dòng trạng thái mật khẩu trên mỗi agent row */
.ai-cred-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
    font-size: 12px;
    color: var(--fg-muted);
}

.ai-cred-expire { color: var(--fg-subtle); }

.ai-cred-fail {
    color: var(--danger);
    font-weight: 650;
    padding: 1px 8px;
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--danger) 10%, transparent);
}

code.ai-agent-username {
    font-size: 11.5px;
    color: var(--fg-muted);
    background: var(--bg-subtle);
    padding: 1px 7px;
    border-radius: var(--radius-full);
    overflow-wrap: anywhere;
}

/* Panel đặt lại mật khẩu thả xuống trong từng row */
.ai-reset-panel { width: 100%; margin-top: 6px; }

.ai-reset-panel summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.ai-reset-panel summary::-webkit-details-marker { display: none; }

.ai-reset-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
    margin-top: 10px;
    padding: 12px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
}

.ai-reset-form .form-control { width: 100%; min-width: 0; }

@media (min-width: 640px) {
    .ai-reset-form .form-control { width: auto; flex: 1 1 220px; }
}

.ai-reset-form .form-label {
    width: 100%;
    font-size: 12px;
    margin: 6px 0 4px;
}

/* Hộp hướng dẫn cuối trang admin AI agents */
.ai-help-note {
    margin-top: 24px;
    padding: 16px 20px;
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--bg-subtle);
    font-size: 13.5px;
}

.ai-help-note h3 { font-size: 14px; margin-bottom: 8px; }

.ai-help-note ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.ai-help-note li { line-height: 1.55; }

/* Mobile: agent row xếp dọc gọn */
@media (max-width: 640px) {
    .ai-agent-row { flex-direction: column; align-items: stretch; gap: 10px; }
    .ai-agent-actions { flex-wrap: wrap; gap: 8px; }
    .ai-agent-actions form { margin: 0; }
    .ai-create-grid { grid-template-columns: 1fr; }
    .ai-pwd-input { flex-direction: column; }
    .ai-pwd-input .btn { width: 100%; }
}

/* ============================================================
   38. v3.4.0 — FEEDBACK SYSTEM (user + admin)
   ============================================================ */
.feedback-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 28px;
    align-items: start;
    margin-top: 20px;
}

@media (max-width: 900px) {
    .feedback-layout { grid-template-columns: 1fr; }
}

.feedback-form-card,
.feedback-my-list {
    background: var(--bg-elevated);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
}

.feedback-form-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--fg-default);
}

.feedback-form-title svg { color: var(--accent); }

.feedback-form .form-group { margin-bottom: 14px; }

.feedback-form .btn-lg { width: 100%; margin-top: 4px; }

.feedback-limit-hint { display: block; margin-top: 8px; text-align: center; }

.req { color: var(--danger); font-weight: 700; }

/* Banner đã gửi thành công */
.feedback-success {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, #10b981 9%, transparent);
    border: 1px solid color-mix(in srgb, #10b981 38%, transparent);
    margin-top: 16px;
}

.feedback-success > svg { color: #10b981; flex-shrink: 0; margin-top: 2px; }
.feedback-success p { margin: 4px 0 0; color: var(--fg-muted); font-size: 13.5px; }

/* Danh sách góp ý (user + admin dùng chung) */
.feedback-items { display: flex; flex-direction: column; gap: 14px; }

.feedback-item,
.feedback-admin-row {
    padding: 14px 16px;
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    min-width: 0;
}

.feedback-item-security { border-color: color-mix(in srgb, #f59e0b 45%, transparent); }

.feedback-item-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.feedback-cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    white-space: nowrap;
}

.feedback-status-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    white-space: nowrap;
}

.feedback-time { font-size: 12px; color: var(--fg-subtle); margin-left: auto; white-space: nowrap; }

.feedback-item-title {
    font-size: 14.5px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--fg-default);
    overflow-wrap: anywhere;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.feedback-security-flag { flex-shrink: 0; }

.feedback-item-body {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--fg-muted);
    margin: 0 0 6px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.feedback-item-url { font-size: 12.5px; margin: 0 0 4px; overflow-wrap: anywhere; }

.feedback-admin-response {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--accent) 7%, transparent);
    border-left: 3px solid var(--accent);
    font-size: 13px;
}

.feedback-admin-response p { margin: 4px 0 0; color: var(--fg-muted); }

/* Admin list — 2 cột: info + actions */
.feedback-admin-list { display: flex; flex-direction: column; gap: 14px; }

.feedback-admin-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 16px;
}

@media (max-width: 860px) {
    .feedback-admin-row { grid-template-columns: 1fr; }
    .feedback-time { margin-left: 0; }
}

.feedback-admin-row-security { border-color: color-mix(in srgb, #f59e0b 50%, transparent); }

.feedback-admin-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    font-size: 13px;
}

.feedback-reporter {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 600;
    color: var(--fg-default);
    text-decoration: none;
    min-width: 0;
    overflow-wrap: anywhere;
}

.feedback-reporter:hover { color: var(--accent); }

.feedback-admin-actions { min-width: 0; }

.feedback-status-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
}

.feedback-status-form .form-label { font-size: 12px; margin: 2px 0 0; }

.form-control-sm { font-size: 13px; padding: 7px 10px; }

.filter-count {
    display: inline-block;
    min-width: 20px;
    padding: 0 6px;
    border-radius: var(--radius-full);
    background: var(--bg-subtle);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    line-height: 18px;
}

/* ============================================================
   39. v3.4.0 — ARCADE "ĐANG ĐƯỢC XEM XÉT" PAGE
   ============================================================ */
.arcade-review-hero {
    max-width: 680px;
    margin: 2.5rem auto;
    padding: 40px 32px;
    text-align: center;
    border-radius: var(--radius-lg);
    background:
        radial-gradient(600px 240px at 50% -60px, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
        var(--bg-elevated);
    border: 1px solid var(--border-muted);
}

.arcade-review-icon { font-size: 52px; line-height: 1; animation: kg-float 3.5s ease-in-out infinite; }

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

.arcade-review-title { font-size: 26px; font-weight: 800; margin: 14px 0 10px; }

.arcade-review-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    border-radius: var(--radius-full);
    font-size: 13.5px;
    background: color-mix(in srgb, var(--warning) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
    color: var(--fg-default);
}

.arcade-review-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    /* v3.9.0 — keyframes ai-dot-blink đã xóa theo hiệu ứng GLM 5.3;
       dot arcade giữ nhịp riêng của mình. */
    animation: arcade-dot-blink 1.6s ease-in-out infinite;
}

@keyframes arcade-dot-blink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .35; transform: scale(.72); }
}

.arcade-review-sub {
    margin: 18px auto 0;
    max-width: 520px;
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--fg-muted);
}

.arcade-review-plan {
    margin: 26px auto 0;
    text-align: left;
    max-width: 480px;
}

.arcade-review-plan h2 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }

.arcade-review-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.arcade-review-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
}

.arcade-review-check { font-size: 20px; line-height: 1.2; flex-shrink: 0; }

.arcade-review-list p { margin: 3px 0 0; font-size: 13px; color: var(--fg-subtle); }

.arcade-review-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.arcade-review-footer {
    margin: 22px auto 0;
    max-width: 480px;
    font-size: 12.5px;
    color: var(--fg-subtle);
}

@media (max-width: 480px) {
    .arcade-review-hero { padding: 28px 18px; margin: 1.5rem auto; }
    .arcade-review-title { font-size: 21px; }
    .arcade-review-actions .btn { width: 100%; }
}

/* ============================================================
   40. v3.4.0 — LEADERBOARD MOBILE FIX
   Trước đây: .leaderboard-stats nowrap + không media query →
   tràn ngang / chèn chữ trên điện thoại.
   ============================================================ */
@media (max-width: 640px) {
    .leaderboard-row {
        flex-wrap: wrap;
        gap: 8px 10px;
        padding: 12px 14px;
    }

    .leaderboard-rank { min-width: 26px; font-size: 1rem; }

    /* User (avatar + tên) chiếm trọn hàng đầu cùng rank; stats chuyển
       xuống hàng riêng, cho phép wrap — hết tràn ngang. */
    .leaderboard-user { flex: 1 1 calc(100% - 60px); min-width: 0; }
    .leaderboard-display-name { max-width: 100%; }

    .leaderboard-stats {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 4px 12px;
        white-space: normal;
        order: 3;
        font-size: .78rem;
    }

    .leaderboard-xp { margin-left: auto; }

    /* Season boards: 1 cột từ 860px (có sẵn), siết thêm khoảng cách */
    .season-list .leaderboard-row { padding: 10px 12px; }
    .season-list .leaderboard-xp { margin-left: auto; }

    .hotweek-row { padding: 10px; gap: 8px; }
    .hotweek-title { font-size: .92rem; }

    .calendar-grid { gap: 3px; }
}

/* Rất hẹp (iPhone SE): ẩn streak cho thoáng, XP là số quan trọng nhất */
@media (max-width: 380px) {
    .leaderboard-streak { display: none; }
    .leaderboard-rank { min-width: 22px; }
}

/* ============================================================
   41. v3.4.0 — NEWS COMMENT DEFENSIVE CSS
   Fix gốc nằm ở template (restructure) — lớp CSS này bảo vệ thêm
   mọi .comment-item còn cấu trúc flex ngang cũ: body KHÔNG BAO GIỜ
   bị ép dưới 140px.
   ============================================================ */
.comment-item > .comment-body {
    flex: 1 1 140px;
    min-width: 140px;
    max-width: 100%;
}

.comment-item > .comment-author {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 60%;
    overflow-wrap: anywhere;
}

.comment-content.comment-body-md {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Markdown trong comment không sinh khoảng trắng dọc thừa */
.comment-body-md > :first-child { margin-top: 0; }
.comment-body-md > :last-child { margin-bottom: 0; }
.comment-body-md p { margin: 0 0 .5em; }
.comment-body-md pre { max-width: 100%; overflow-x: auto; }

/* v3.4.0 — badge "tạm dừng" nhỏ trên menu arcade */
.menu-badge-muted {
    display: inline-block;
    font-size: 10px;
    opacity: .65;
    margin-left: 2px;
}

/* v3.4.0 — ghi chú ẩn góp ý bảo mật khỏi moderator */
.feedback-security-note {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 14px;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, #f59e0b 8%, transparent);
    border: 1px solid color-mix(in srgb, #f59e0b 35%, transparent);
    font-size: 13px;
}

.feedback-security-note svg { color: #f59e0b; flex-shrink: 0; }

/* ============================================================
   v3.9.0 — HERO FX GLM 5.3 ĐÃ XÓA HOÀN TOÀN
   Theo yêu cầu chủ sở hữu: hồ sơ AI mặc định hiển thị SẠCH như hồ sơ
   thường — bỏ aurora/hạt sao/lưới neuron/orbs/tia quét/vignette +
   glow avatar + text-shadow tên (toàn bộ khối CSS của v3.5.0/v3.6.2
   đã gỡ). IIFE initHeroFx trong app.js cũng đã gỡ.
   ============================================================ */

/* ============================================================
   v3.11.0 — CARD "THÔNG TIN MÔ HÌNH AI" (hồ sơ AI công khai)
   Thiết kế lại TOÀN BỘ theo yêu cầu chủ sở hữu ("UI phần thông tin
   AI Agent quá loạn — sắp xếp lại"): thay 2 khối rời (.ai-profile-info
   + .ai-params-card bảng key/value 2 nhóm) bằng MỘT card gọn với
   đúng 10 trường cấu trúc + 2 ô thống kê Tổng tham số / Tham số
   kích hoạt.

   Theme-aware (bỏ nền trắng cố định v3.10.0 — slab trắng chói trên
   dark mode là một phần cảm giác "loạn"): nền card = bg-elevated pha
   6% màu nhấn của agent, viền 30% nhấn — nổi bật mà vẫn ăn theo theme,
   chuẩn tương phản ở CẢ 2 theme (nhãn fg-muted, giá trị fg-default).
   ============================================================ */
.ai-spec-card {
    margin-top: 14px;
    max-width: 560px;
    border: 1px solid color-mix(in srgb, var(--ai-accent, #0ea5e9) 30%, var(--border-muted, #2a3242));
    border-radius: 12px;
    background:
        linear-gradient(
            160deg,
            color-mix(in srgb, var(--ai-accent, #0ea5e9) 7%, var(--bg-elevated, #141a24)),
            color-mix(in srgb, var(--ai-accent, #0ea5e9) 3%, var(--bg-elevated, #141a24))
        );
    padding: 14px 16px 12px;
    text-align: left;
    box-shadow: var(--shadow-sm);
}

.ai-spec-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.ai-spec-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
    color: color-mix(in srgb, var(--ai-accent, #0ea5e9) 78%, var(--fg-default, #eee));
}

.ai-spec-title svg { flex-shrink: 0; }

.ai-spec-verified {
    margin-left: auto;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 999px;
    padding: 1px 10px;
    color: #16a34a;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.35);
}

[data-theme="light"] .ai-spec-verified { color: #15803d; }

/* Lưới 2 cột các trường spec — 1 cột trên mobile */
.ai-spec-grid {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 14px;
}

.ai-spec-item {
    min-width: 0;
    padding: 6px 10px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--ai-accent, #0ea5e9) 4%, transparent);
    border: 1px solid color-mix(in srgb, var(--ai-accent, #0ea5e9) 14%, transparent);
}

.ai-spec-wide { grid-column: 1 / -1; }

.ai-spec-item dt {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--fg-muted, #9aa4b2);
    margin-bottom: 2px;
}

.ai-spec-item dd {
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--fg-default, #eee);
    overflow-wrap: anywhere;
}

.ai-spec-model {
    display: inline-block;
    font-family: var(--font-mono, monospace);
    font-size: 12.5px;
    font-weight: 700;
    padding: 1px 9px;
    border-radius: 999px;
    border: 1px solid;
}

/* 2 ô thống kê — Tổng tham số / Tham số kích hoạt */
.ai-spec-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0 0;
}

.ai-spec-stat {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 10px 12px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--ai-accent, #0ea5e9) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--ai-accent, #0ea5e9) 28%, transparent);
}

.ai-spec-stat.is-active {
    background: color-mix(in srgb, #f59e0b 9%, transparent);
    border-color: color-mix(in srgb, #f59e0b 30%, transparent);
}

.ai-spec-stat-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--fg-muted, #9aa4b2);
}

.ai-spec-stat-value {
    font-size: 16px;
    font-weight: 800;
    color: var(--fg-default, #eee);
    overflow-wrap: anywhere;
}

.ai-spec-stat-hint {
    font-size: 11.5px;
    color: var(--fg-subtle, #6e7a87);
    font-style: italic;
}

/* Khả năng — chips */
.ai-spec-caps {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.ai-spec-caps-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--fg-muted, #9aa4b2);
}

.ai-spec-caps-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* Chân card: phiên bản + hoạt động cuối */
.ai-spec-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed color-mix(in srgb, var(--ai-accent, #0ea5e9) 25%, var(--border-muted, #2a3242));
    font-size: 12px;
    color: var(--fg-muted, #9aa4b2);
}

.ai-spec-foot-item { display: inline-flex; align-items: center; gap: 4px; }

@media (max-width: 480px) {
    .ai-spec-grid { grid-template-columns: 1fr; }
    .ai-spec-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .ai-spec-card, .ai-spec-stat { animation: none !important; }
}

/* ============================================================
   v3.5.0 — NÚT "ĐĂNG NHẬP TÀI KHOẢN NÀY" (admin trên hồ sơ AI)
   ============================================================ */
.profile-impersonate-form { display: inline-flex; }
.btn-impersonate-ai {
    background: linear-gradient(135deg, var(--ai-accent, #0ea5e9), #7c3aed) !important;
    border: none !important;
    color: #fff !important;
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--ai-accent, #0ea5e9) 45%, transparent);
    animation: ai-impersonate-pulse 2.6s ease-in-out infinite;
}
@keyframes ai-impersonate-pulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ai-accent, #0ea5e9) 42%, transparent); }
    50%      { box-shadow: 0 0 0 7px color-mix(in srgb, var(--ai-accent, #0ea5e9) 6%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
    .btn-impersonate-ai { animation: none !important; }
}

/* ============================================================
   v3.7.0 — KHUNG AVATAR (cửa hàng XP, migration 036)
   ============================================================
   Kỹ thuật:
   * Class `avatar-frame` đặt trên PHẦN TỬ BỌC (a/span/div) —
     pseudo-element KHÔNG render trên <img> (replaced element).
   * Ring vẽ bằng ::before: đĩa gradient đặt Z-SAU nội dung
     (z-index:-1 + isolation:isolate để không tụt dưới nền trang),
     chỉ lộ phần vành ngoài avatar → viền tròn hoàn hảo mọi size.
   * Bronze/Silver/Gold: conic-gradient kim loại tĩnh (sáng/tối xen
     kẽ như ánh kim chạm khắc).
   * Neon/Phoenix/Dragon: @property --frame-angle xoay mượt conic
     gradient (Chrome/Edge/Safari 16.4+; browser cũ → gradient tĩnh,
     không vỡ layout).
   * prefers-reduced-motion: tắt toàn bộ animation — chỉ còn màu.
   ============================================================ */

@property --frame-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

/* ---- Base: element bọc avatar ---- */
.avatar-frame {
    position: relative;
    isolation: isolate;
    border-radius: var(--radius-full);
}
.avatar-frame::before {
    content: "";
    position: absolute;
    inset: -3px;                      /* ring 32px avatar (header/chat) */
    border-radius: inherit;
    z-index: -1;
    pointer-events: none;
}
/* Hồ sơ: container .profile-avatar có 4px viền nền sẵn → ring bám
   sát mép ngoài border-box, phần gradient phủ lên viền nền cũ */
.profile-avatar.avatar-frame::before {
    inset: -4px;
}

/* ---- 1) BRONZE — kim loại đồng ấm (150 XP) ---- */
.avatar-frame-bronze::before {
    background: conic-gradient(from 210deg,
        #6e3f1d, #c98a4b 12%, #8a5524 26%, #e3a96d 40%,
        #7a4517 55%, #d99a5b 72%, #6e3f1d 88%, #a96c33);
    box-shadow: 0 0 6px rgba(184, 115, 51, 0.35);
}

/* ---- 2) SILVER — bạc sáng lạnh (300 XP) ---- */
.avatar-frame-silver::before {
    background: conic-gradient(from 30deg,
        #8e99a6, #f2f5f9 15%, #8b95a1 30%, #dde4ec 46%,
        #77828f 62%, #e9eef4 80%, #a6b0bd);
    box-shadow: 0 0 6px rgba(148, 163, 184, 0.45);
}

/* ---- 3) GOLD — vàng 24K + glow ấm (600 XP) ---- */
.avatar-frame-gold::before {
    background: conic-gradient(from 45deg,
        #8a5a00, #ffd54a 14%, #a8720a 28%, #ffe98a 44%,
        #93650b 60%, #f4c542 76%, #8a5a00 90%, #d9a521);
    box-shadow: 0 0 9px rgba(245, 196, 66, 0.5);
}

/* ---- 4) NEON — cyberpunk cyan/magenta nhấp nháy (900 XP) ---- */
.avatar-frame-neon::before {
    background: conic-gradient(from var(--frame-angle),
        #22d3ee, #8b5cf6 25%, #f0abfc 50%, #22d3ee 75%, #8b5cf6);
    box-shadow:
        0 0 10px rgba(34, 211, 238, 0.55),
        0 0 18px rgba(168, 85, 247, 0.35);
    animation: frame-neon-pulse 2.2s ease-in-out infinite;
}
@keyframes frame-neon-pulse {
    0%, 100% { filter: brightness(1); }
    50%      { filter: brightness(1.45) saturate(1.25); }
}

/* ---- 5) PHOENIX — vòng lửa cam–đỏ xoay chậm (1500 XP) ---- */
.avatar-frame-phoenix::before {
    background: conic-gradient(from var(--frame-angle),
        #f97316, #fbbf24 12%, #ef4444 26%, #f97316 40%,
        #fde047 54%, #ef4444 70%, #f97316 86%, #fbbf24);
    box-shadow: 0 0 12px rgba(249, 115, 22, 0.5);
    animation: frame-rotate 6s linear infinite;
}

/* ---- 6) DRAGON FIRE 🐲 — HUYỀN THOẠI (5000 XP) ----
   3 lớp: vảy rồng (repeating-conic alpha) + lửa 7 màu xoay nhanh
   + hào quang trắng-vàng thở (flicker) — sang trọng nhất cửa hàng. */
.avatar-frame-dragon_fire::before {
    background:
        repeating-conic-gradient(from calc(var(--frame-angle) * -1),
            rgba(0, 0, 0, 0) 0deg 7deg, rgba(90, 15, 0, 0.4) 7deg 14deg),
        conic-gradient(from var(--frame-angle),
            #7f1d1d, #dc2626 10%, #f97316 21%, #fde047 31%,
            #fb923c 42%, #dc2626 53%, #7f1d1d 63%, #ef4444 74%,
            #f59e0b 85%, #7f1d1d);
    box-shadow:
        0 0 12px rgba(249, 115, 22, 0.65),
        0 0 28px rgba(220, 38, 38, 0.4);
    animation: frame-rotate 3.2s linear infinite;
}
.avatar-frame-dragon_fire::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    z-index: -1;
    background: radial-gradient(circle,
        transparent 56%, rgba(255, 224, 130, 0.55) 68%, transparent 78%);
    animation: frame-flicker 1.5s ease-in-out infinite;
    pointer-events: none;
}
@keyframes frame-rotate {
    to { --frame-angle: 360deg; }
}
@keyframes frame-flicker {
    0%, 100% { opacity: 0.35; }
    50%      { opacity: 1; }
}

/* Giảm chuyển động — tắt xoay/nhấp nháy, giữ màu tĩnh */
@media (prefers-reduced-motion: reduce) {
    .avatar-frame-neon::before,
    .avatar-frame-phoenix::before,
    .avatar-frame-dragon_fire::before,
    .avatar-frame-dragon_fire::after {
        animation: none !important;
    }
}

/* ============================================================
   v3.7.0 — CỬA HÀNG: khu KHUNG AVATAR + preview swatch
   ============================================================ */
.shop-section-head {
    margin: 28px 0 14px;
}
.shop-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
    margin: 0 0 4px;
}
.shop-section-sub {
    margin: 0;
    color: var(--fg-muted);
    font-size: 0.9rem;
}
.shop-section-head-frames .shop-section-title {
    color: var(--warning, #d97706);
}

.shop-grid-frames {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}
.shop-card-frame {
    text-align: center;
}
/* Rồng Lửa — HERO CARD full-width: preview trái, nội dung giữa,
   nút mua phải — sang trọng nhất cửa hàng, không ô lẻ loi */
.shop-card-dragon {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
        "preview info btn"
        "preview info btn";
    align-items: center;
    gap: 8px 20px;
    text-align: left;
    padding: 20px 24px;
}
.shop-card-dragon .shop-frame-preview-box {
    grid-area: preview;
    padding: 0;
}
.shop-card-dragon .shop-dragon-info {
    grid-area: info;
    min-width: 0;
}
.shop-card-dragon > #shop-result-frame_dragon_fire {
    grid-column: 1 / -1;
}
.shop-card-dragon .frame-swatch {
    width: 72px;
    height: 72px;
    font-size: 34px;
}
.shop-card-dragon .shop-item-name {
    margin: 0 0 4px;
    font-size: 1.18rem;
}
.shop-card-dragon .shop-item-desc {
    margin: 0 0 6px;
    max-width: 560px;
}
.shop-card-dragon .shop-item-duration {
    margin: 0;
}
.shop-card-dragon > .btn {
    align-self: center;
    white-space: nowrap;
}
@media (max-width: 700px) {
    .shop-card-dragon {
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "preview info"
            "btn btn";
        gap: 12px 14px;
        padding: 16px;
    }
    .shop-card-dragon > .btn {
        justify-self: stretch;
        text-align: center;
    }
}
.shop-frame-preview-box {
    display: flex;
    justify-content: center;
    padding: 14px 0 10px;
}
/* Swatch preview: đúng gradient của từng khung — hình tròn 56px,
   chữ emoji ở giữa = xem trước trung thực trước khi mua */
.frame-swatch {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 26px;
    background: var(--bg-subtle);
}
.frame-swatch::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    z-index: -1;
}
.frame-swatch-bronze::before {
    background: conic-gradient(from 210deg,
        #6e3f1d, #c98a4b 12%, #8a5524 26%, #e3a96d 40%,
        #7a4517 55%, #d99a5b 72%, #6e3f1d 88%, #a96c33);
    box-shadow: 0 0 6px rgba(184, 115, 51, 0.35);
}
.frame-swatch-silver::before {
    background: conic-gradient(from 30deg,
        #8e99a6, #f2f5f9 15%, #8b95a1 30%, #dde4ec 46%,
        #77828f 62%, #e9eef4 80%, #a6b0bd);
    box-shadow: 0 0 6px rgba(148, 163, 184, 0.45);
}
.frame-swatch-gold::before {
    background: conic-gradient(from 45deg,
        #8a5a00, #ffd54a 14%, #a8720a 28%, #ffe98a 44%,
        #93650b 60%, #f4c542 76%, #8a5a00 90%, #d9a521);
    box-shadow: 0 0 9px rgba(245, 196, 66, 0.5);
}
.frame-swatch-neon::before {
    background: conic-gradient(from var(--frame-angle),
        #22d3ee, #8b5cf6 25%, #f0abfc 50%, #22d3ee 75%, #8b5cf6);
    box-shadow:
        0 0 10px rgba(34, 211, 238, 0.55),
        0 0 18px rgba(168, 85, 247, 0.35);
    animation: frame-neon-pulse 2.2s ease-in-out infinite;
}
.frame-swatch-phoenix::before {
    background: conic-gradient(from var(--frame-angle),
        #f97316, #fbbf24 12%, #ef4444 26%, #f97316 40%,
        #fde047 54%, #ef4444 70%, #f97316 86%, #fbbf24);
    box-shadow: 0 0 12px rgba(249, 115, 22, 0.5);
    animation: frame-rotate 6s linear infinite;
}
.frame-swatch-dragon_fire::before {
    background:
        repeating-conic-gradient(from calc(var(--frame-angle) * -1),
            rgba(0, 0, 0, 0) 0deg 7deg, rgba(90, 15, 0, 0.4) 7deg 14deg),
        conic-gradient(from var(--frame-angle),
            #7f1d1d, #dc2626 10%, #f97316 21%, #fde047 31%,
            #fb923c 42%, #dc2626 53%, #7f1d1d 63%, #ef4444 74%,
            #f59e0b 85%, #7f1d1d);
    box-shadow:
        0 0 12px rgba(249, 115, 22, 0.65),
        0 0 28px rgba(220, 38, 38, 0.4);
    animation: frame-rotate 3.2s linear infinite;
}

/* Thẻ Rồng Lửa — nổi bật nhất: viền lửa + nhãn vàng "ĐẮT NHẤT" */
.shop-card-dragon {
    position: relative;      /* anchor cho nhãn "ĐẮT NHẤT" absolute */
    border: 2px solid transparent;
    background:
        linear-gradient(var(--bg-card, var(--bg-subtle)), var(--bg-card, var(--bg-subtle))) padding-box,
        conic-gradient(from var(--frame-angle), #7f1d1d, #f97316 25%, #fde047 50%, #dc2626 75%, #7f1d1d) border-box;
    animation: frame-rotate 4s linear infinite;
}
.shop-card-dragon:hover {
    transform: translateY(-2px);
}
.shop-frame-legend {
    position: absolute;
    top: -12px;
    z-index: 2;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #dc2626, #f97316);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.4px;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
}
.shop-item-duration {
    margin: 4px 0;
    font-size: 0.8rem;
    color: var(--fg-muted);
}
@media (max-width: 480px) {
    .shop-grid-frames {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    .shop-frame-legend {
        font-size: 0.6rem;
        padding: 2px 8px;
    }
}

/* ============================================================
   v3.7.0 — TRANG ADMIN SỬA AI AGENT (/admin/ai-agents/{id}/edit)
   ============================================================ */
.ai-edit-section-title {
    font-size: 1.05rem;
    margin: 22px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-default);
}
.ai-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin: 18px 0 8px;
}
.ai-cred-flash-error {
    background: color-mix(in srgb, var(--danger, #dc2626) 8%, transparent);
}
/* v3.10.0 — box cấp/thu hồi huy hiệu độc quyền AI Agent */
/* v3.11.0 — checkbox label inline (form sửa hồ sơ AI Agent) */
.ai-check-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: var(--fg-default, #eee);
    cursor: pointer;
    user-select: none;
}

.ai-check-label input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* v3.11.0 — tiêu đề phân mục trong form /profile/ai/edit */
.ai-edit-self-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--fg-default, #eee);
    margin: 20px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-muted, #2a3242);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-edit-self-title:first-of-type { margin-top: 4px; }

/* v3.11.0 — tóm tắt spec nhanh trên thẻ agent (trang /admin/ai-agents) */
.ai-spec-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.ai-spec-quick-item {
    font-size: 11.5px;
    font-family: var(--font-mono, monospace);
    padding: 2px 9px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--ai-accent, #0ea5e9) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--ai-accent, #0ea5e9) 22%, transparent);
    color: var(--fg-default, #eee);
}

.ai-spec-quick-item.is-active {
    background: color-mix(in srgb, #f59e0b 8%, transparent);
    border-color: color-mix(in srgb, #f59e0b 25%, transparent);
}

.ai-spec-quick-empty {
    font-size: 12px;
    color: var(--fg-muted, #9aa4b2);
    font-style: italic;
}

.ai-badge-grant-box {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    border: 1px solid var(--border-default);
    border-left: 3px solid var(--ai-accent, #7c3aed);
    border-radius: var(--radius-md, 10px);
    background: var(--bg-subtle);
    padding: 14px 16px;
}
.ai-badge-grant-box form {
    margin: 0;
}
.ai-badge-grant-box .status-badge {
    margin-left: auto;
}
.ai-badge-grant-info {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1 1 260px;
    min-width: 0;
}
.ai-badge-grant-info .achievement-icon-sm {
    font-size: 26px;
    line-height: 1.2;
}
.ai-edit-params-list {
    display: grid;
    gap: 10px;
}
.ai-edit-param-card {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md, 10px);
    background: var(--bg-subtle);
    overflow: hidden;
}
.ai-edit-param-card.ai-param-activation {
    border-left: 3px solid var(--warning, #f59e0b);
}
.ai-edit-param-card summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    list-style: none;
    flex-wrap: wrap;
}
.ai-edit-param-card summary::-webkit-details-marker {
    display: none;
}
.ai-edit-param-card summary:hover {
    background: color-mix(in srgb, var(--fg-muted) 6%, transparent);
}
.ai-edit-param-key {
    word-break: break-word;
}
.ai-edit-param-value {
    color: var(--fg-muted);
    word-break: break-word;
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ai-edit-param-order {
    margin-left: auto;
    color: var(--fg-muted);
    font-size: 0.78rem;
}
.ai-param-edit-form {
    display: grid;
    gap: 10px;
    padding: 12px 14px 14px;
    border-top: 1px dashed var(--border-default);
    background: var(--bg-canvas);
}
@media (max-width: 640px) {
    .ai-edit-param-value {
        max-width: 100%;
        white-space: normal;
    }
    .ai-edit-param-order {
        display: none;
    }
    .ai-edit-actions {
        flex-direction: column-reverse;
    }
    .ai-edit-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   v3.14.0 — Kết bạn + Chat riêng + Nhóm chat
   ============================================================ */
.friend-list, .inbox-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.friend-row, .inbox-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border-default); border-radius: 12px; background: var(--bg-canvas); }
.friend-user, .inbox-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.friend-name, .inbox-main { display: flex; flex-direction: column; min-width: 0; }
.friend-display-name { font-weight: 600; }
.friend-actions { display: flex; gap: 6px; flex-shrink: 0; }
.inbox-top { display: flex; align-items: center; gap: 8px; }
.inbox-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dm-thread { max-width: 760px; }
.dm-back { text-decoration: none; margin-right: 4px; }
.dm-box { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow-y: auto; padding: 12px; border: 1px solid var(--border-default); border-radius: 12px; background: var(--bg-canvas); margin-bottom: 10px; }
.dm-msg { display: flex; gap: 8px; align-items: flex-start; }
.dm-msg.dm-mine { justify-content: flex-end; }
.dm-bubble { max-width: 75%; padding: 8px 12px; border-radius: 14px; background: var(--bg-inset); overflow-wrap: anywhere; }
.dm-msg.dm-mine .dm-bubble { background: #6d5ae0; color: #fff; }
.dm-name { font-size: 12px; font-weight: 600; opacity: 0.75; margin-bottom: 2px; }
.dm-text { white-space: pre-wrap; }
.dm-deleted { font-style: italic; }
.dm-image { max-width: 280px; width: 100%; border-radius: 10px; margin-top: 6px; display: block; }
.dm-form { margin-bottom: 12px; }
.dm-preview:empty { display: none; }
.dm-preview-img { max-width: 160px; border-radius: 8px; margin-bottom: 6px; }
.dm-input-row { display: flex; gap: 8px; align-items: flex-end; }
.dm-input-row textarea { flex: 1; resize: vertical; min-height: 38px; }
.dm-attach { cursor: pointer; font-size: 22px; padding: 4px 6px; flex-shrink: 0; }
.dm-manage { margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--border-default); border-radius: 12px; }
.dm-manage summary { cursor: pointer; font-weight: 600; }
.stack-form { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; max-width: 520px; }
.stack-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
@media (max-width: 640px) {
    .friend-row, .inbox-row { flex-wrap: wrap; }
    .dm-bubble { max-width: 88%; }
}

/* ============================================================
   v3.16.0 — Toast realtime huy hiệu/lên cấp (góc phải dưới,
   tự ẩn 10s, không che nội dung chính trên mobile)
   ============================================================ */
.toast-root { position: fixed; right: 16px; bottom: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--border-default); border-radius: 14px; background: var(--bg-elevated); box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,.18)); animation: toast-in .25s ease-out; }
.toast-icon { font-size: 22px; line-height: 1.2; flex-shrink: 0; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { display: block; font-size: 14px; }
.toast-sub { font-size: 12.5px; margin-top: 2px; }
.toast-close { border: none; background: none; font-size: 18px; line-height: 1; cursor: pointer; color: var(--fg-muted); padding: 0 0 0 4px; flex-shrink: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
