/* ##########################################################################
   SOURCE: index_new.css
   ########################################################################## */

/* ==========================================================================
   LIQUID GLASS + GIAO DIỆN CUNG ĐÌNH HUẾ (OPTIMIZED)
   ========================================================================== */
:root {
    /* Royal Palette */
    --royal-red: var(--xq-crimson);
    --royal-red-dark: #b72222;
    --royal-red-light: #e63946;
    --royal-gold: var(--xq-rim);
    --royal-gold-light: #fff2cc;
    --royal-bg: #0b0c10;
    --royal-wood: #4a2511;

    /* Liquid Glass Variables */
    --glass-blur: blur(20px);
    --glass-bg-dark: rgba(11, 12, 16, 0.85);
    --glass-bg-red: rgba(var(--xq-crimson-rgb), 0.75);
    --glass-border: rgba(var(--xq-rim-rgb), 0.55);
    --liquid-highlight: rgba(255, 255, 255, 0.4);
    --liquid-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);

    /* Xiangqi artwork (served from public/img) */
    --xiangqi-bg: url("/img/xiangqi-bg.webp");

    /* Background brightness knobs: lower alpha = brighter background.
       Raise these (max 1) if gold text on the page becomes hard to read. */
    --xq-bg-color: #4a1a16;
    --xq-tint-a: 0.22;
    --xq-tint-b: 0.14;
}

/* Smaller artwork for phones / small tablets (saves bandwidth) */
@media (max-width: 768px) {
    :root {
        --xiangqi-bg: url("/img/xiangqi-bg-mobile.webp");
    }
}

* {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    /* -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none; */
}

/* ==========================================================================
   ROYAL SCROLLBAR (CUNG ĐÌNH HUẾ THEME)
   ========================================================================== */

/* Firefox Fallback */
html,
body {
    scrollbar-width: thin;
    scrollbar-color: var(--royal-red) var(--royal-bg);
    text-rendering: optimizeSpeed;
}

/* WebKit Base (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 12px; /* Vertical scrollbar width */
    height: 12px; /* Horizontal scrollbar height */
}

/* Scrollbar Track (The background) */
::-webkit-scrollbar-track {
    background: var(--royal-bg); /* Deep ebony */
    border-left: 1px solid rgba(var(--xq-metal-rgb), 0.2); /* Subtle gold separator line */
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.9); /* Inner depth */
}

/* Scrollbar Thumb (The draggable piece) */
::-webkit-scrollbar-thumb {
    background: linear-gradient(
        180deg,
        var(--royal-red),
        #5c0a0a
    ); /* Royal red gradient */
    border: 1px solid var(--royal-gold); /* Gold trim */
    border-radius: 6px;
    box-shadow: inset 0 0 5px rgba(var(--xq-rim-rgb), 0.3); /* Inner gold glow */
}

/* Scrollbar Thumb - Hover State */
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        180deg,
        var(--xq-metal),
        #b89020
    ); /* Switches to liquid gold on hover */
    border-color: #fff; /* Bright white border for emphasis */
    box-shadow: 0 0 10px rgba(var(--xq-metal-rgb), 0.8); /* Stronger glow */
}

/* Scrollbar Thumb - Active/Click State */
::-webkit-scrollbar-thumb:active {
    background: var(--royal-gold);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8); /* Pressed-in effect */
}

/* Corner where vertical and horizontal scrollbars meet */
::-webkit-scrollbar-corner {
    background: var(--royal-bg);
    border-left: 1px solid rgba(var(--xq-metal-rgb), 0.2);
    border-top: 1px solid rgba(var(--xq-metal-rgb), 0.2);
}

/* ==========================================================================
   TEXT SELECTION (CUNG ĐÌNH HUẾ GLOSSY THEME)
   ========================================================================== */

::selection {
    background: var(--royal-gold);
    color: var(--royal-red-dark);
    text-shadow: 0 0 8px rgba(var(--xq-rim-rgb), 0.6);
}

::-moz-selection {
    background: var(--royal-gold);
    color: var(--royal-red-dark);
    text-shadow: 0 0 8px rgba(var(--xq-rim-rgb), 0.6);
}

/* Responsive Width Utilities */

/* SM - >= 576px */
@media (min-width: 576px) {
    .w-sm-25 {
        width: 25% !important;
    }
    .w-sm-50 {
        width: 50% !important;
    }
    .w-sm-75 {
        width: 75% !important;
    }
    .w-sm-100 {
        width: 100% !important;
    }
    .w-sm-auto {
        width: auto !important;
    }
}

/* MD - >= 768px */
@media (min-width: 768px) {
    .w-md-25 {
        width: 25% !important;
    }
    .w-md-50 {
        width: 50% !important;
    }
    .w-md-75 {
        width: 75% !important;
    }
    .w-md-100 {
        width: 100% !important;
    }
    .w-md-auto {
        width: auto !important;
    }
}

/* LG - >= 992px */
@media (min-width: 992px) {
    .w-lg-25 {
        width: 25% !important;
    }
    .w-lg-50 {
        width: 50% !important;
    }
    .w-lg-75 {
        width: 75% !important;
    }
    .w-lg-100 {
        width: 100% !important;
    }
    .w-lg-auto {
        width: auto !important;
    }
}

/* XL - >= 1200px */
@media (min-width: 1200px) {
    .w-xl-25 {
        width: 25% !important;
    }
    .w-xl-50 {
        width: 50% !important;
    }
    .w-xl-75 {
        width: 75% !important;
    }
    .w-xl-100 {
        width: 100% !important;
    }
    .w-xl-auto {
        width: auto !important;
    }
}

/* XXL - >= 1400px - Bootstrap 5 */
@media (min-width: 1400px) {
    .w-xxl-25 {
        width: 25% !important;
    }
    .w-xxl-50 {
        width: 50% !important;
    }
    .w-xxl-75 {
        width: 75% !important;
    }
    .w-xxl-100 {
        width: 100% !important;
    }
    .w-xxl-auto {
        width: auto !important;
    }
}

input,
input:before,
input:after,
textarea {
    -webkit-user-select: initial !important;
    -khtml-user-select: initial !important;
    -moz-user-select: initial !important;
    -ms-user-select: initial !important;
    user-select: initial !important;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    border: 1px solid var(--royal-gold) !important;
    -webkit-text-fill-color: var(--royal-bg) !important;
    box-shadow: 0 0 0 0.25rem rgba(var(--xq-metal-rgb), 0.25) !important;
    -webkit-box-shadow: 0 0 0 0.25rem rgba(var(--xq-metal-rgb), 0.25) !important;
    transition: background-color 1000s ease-in-out 0s;
}

body {
    font-family:
        "Plus Jakarta Sans", "Noto Sans JP", "Noto Sans KR", "Noto Sans SC",
        sans-serif !important;
    overflow-x: hidden;
    overflow-y: scroll;
    background-color: var(--xq-bg-color) !important;
    /* layer 1: per-board SVG pattern (themes section, --xq-body-pattern);
       layer 2: the xiangqi artwork */
    /* background-image: var(--xq-body-pattern, none), var(--xiangqi-bg); */
    background-image: var(--xq-body-pattern, none);
    background-size: var(--xq-body-pattern-size, auto), cover;
    background-position:
        0 0,
        center;
    background-repeat: repeat, no-repeat;
    background-attachment: fixed, fixed;
}

/* Overlay-only animation: keeps the artwork still while the tint drifts */
@keyframes gradientOverlayBG {
    0% {
        background-position:
            0% 50%,
            center;
    }
    50% {
        background-position:
            100% 50%,
            center;
    }
    100% {
        background-position:
            0% 50%,
            center;
    }
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
    font-family:
        "Texturina", "Noto Sans JP", "Noto Sans KR", "Noto Sans SC", serif !important;
    color: var(--royal-gold); /* Chữ tiêu đề mạ vàng */
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.form-control,
input:-internal-autofill-selected {
    background-color: var(--royal-gold-light) !important;
    border: 1px solid var(--royal-wood) !important;
}
.form-control:focus,
input:-internal-autofill-selected:focus {
    border-color: var(--royal-gold) !important;
    box-shadow: 0 0 0 0.25rem rgba(var(--xq-metal-rgb), 0.25) !important;
}

/* ==========================================================================
   HEADER / LẦU NGŨ PHỤNG (UPGRADED TO LIQUID GLASS)
   ========================================================================== */

header.site-header {
    width: 100%;
    /* Replaced solid gradient with frosted royal glass */
    background: var(--glass-bg-red);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 2px solid var(--glass-border);
    box-shadow:
        var(--liquid-shadow),
        inset 0 -2px 15px rgba(var(--xq-rim-rgb), 0.15);
    z-index: 1050;
    transition: all 0.3s ease-in-out;

    /* New Animations applied here */
    animation:
        headerSlideDown 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards,
        headerLiquidGlow 3.5s ease-in-out 0.8s infinite alternate;
}

header.site-header a {
    color: var(--royal-gold-light);
    position: relative;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

/* Glowing underline effect on hover */
header.site-header a:not(.navbar-brand)::before {
    content: "";
    position: absolute;
    height: 3px;
    left: 50%;
    background: linear-gradient(
        90deg,
        transparent,
        var(--royal-gold),
        transparent
    );
    bottom: -8px;
    width: 0;
    transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: translateX(-50%);
    box-shadow: 0 0 10px var(--royal-gold);
}

header.site-header a:not(.navbar-brand):hover {
    text-decoration: none;
    color: var(--royal-gold);
    text-shadow: 0 0 10px rgba(var(--xq-rim-rgb), 0.5);
}

header.site-header a:not(.navbar-brand):hover::before {
    width: 100%;
}

#header-status {
    font-size: 15px !important;
    color: var(--royal-gold-light);
}

header.site-header ul.navbar-nav li.dropdown.language-switcher > a {
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
}

header.site-header ul.navbar-nav:hover a:before,
header.site-header ul.navbar-nav:hover a::before {
    width: 0;
}
header.site-header ul.navbar-nav .dropdown-menu {
    position: absolute;
    margin-top: -7px;
    border: 2px solid var(--royal-gold);
    background-color: var(--royal-red);
}

header.site-header a:not(.navbar-brand) {
    top: -5px;
}

header.site-header a:not(.navbar-brand):hover {
    text-decoration: none;
    font-weight: 600;
    color: var(--royal-gold);
}

header.site-header a:not(.navbar-brand):hover:before,
header.site-header a:not(.navbar-brand):hover::before {
    width: 100% !important;
}

/* Menu states active */
body.home header.site-header a.home,
body.news header.site-header a.news,
body.library header.site-header a.library,
body.puzzle header.site-header a.puzzle,
body.setup header.site-header a.setup,
body.about header.site-header a.about,
body.bmi header.site-header a.bmi,
body.game header.site-header a.game,
body.room header.site-header a.room,
body.dashboard header.site-header a.dashboard,
body.login header.site-header a.login,
body.news header.site-header a.news,
body.contact header.site-header a.contact,
body.vip header.site-header a.vip,
body.dashboard
    header.site-header
    a:has(+ div.dropdown-menu > a.dashboard.dropdown-item.active),
body.vip
    header.site-header
    a:has(+ div.dropdown-menu > a.vip.dropdown-item.active),
body.resource
    header.site-header
    a:has(+ div.dropdown-menu > a.resource.dropdown-item.active),
body.resource:has(div.container.resource) header.site-header a.resource,
body.dashboard:has(div.game.dashboard) header.site-header a.dashboard {
    font-weight: 600;
    color: var(--royal-gold);
}
body.home header.site-header a.home:before,
body.news header.site-header a.news,
body.library header.site-header a.library:before,
body.puzzle header.site-header a.puzzle:before,
body.setup header.site-header a.setup:before,
body.about header.site-header a.about:before,
body.bmi header.site-header a.bmi:before,
body.game header.site-header a.game:before,
body.room header.site-header a.room:before,
body.dashboard header.site-header a.dashboard:before,
body.login header.site-header a.login:before,
body.news header.site-header a.news:before,
body.contact header.site-header a.contact:before,
body.vip header.site-header a.vip:before,
body.vip
    header.site-header
    a:has(+ div.dropdown-menu > a.vip.dropdown-item.active):before,
body.dashboard
    header.site-header
    a:has(+ div.dropdown-menu > a.dashboard.dropdown-item.active):before,
body.resource
    header.site-header
    a:has(+ div.dropdown-menu > a.resource.dropdown-item.active):before,
body.resource:has(div.container.resource) header.site-header a.resource:before,
body.dashboard:has(div.game.dashboard) header.site-header a.dashboard:before {
    width: 100%;
}

/* ==========================================================================
   PROFILE AVATAR (NAV) — its own "current page" state
   Text links mark the current page with a gold colour + glowing underline.
   A round photo can't show that, so the avatar gets a double ring instead:
   a dark-red gap (separates it from the glass header) and a solid gold halo.
   ========================================================================== */
header.site-header a.nav-avatar-link {
    display: inline-flex;
    align-items: center;
    border-radius: 50%;
    text-transform: none;
}

/* The avatar never uses the text-link underline, hovered or current. */
header.site-header a.nav-avatar-link::before,
header.site-header a.nav-avatar-link:hover::before,
header.site-header a.nav-avatar-link.is-current::before {
    display: none !important;
}

header.site-header .nav-avatar {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 50% !important;
    border: 2px solid var(--royal-gold);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
    transition:
        transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        box-shadow 0.35s ease,
        border-color 0.35s ease;
}

/* Hover: lift and glow (instead of the underline) */
header.site-header a.nav-avatar-link:hover .nav-avatar {
    transform: translateY(-1px) scale(1.08);
    box-shadow:
        0 0 0 2px var(--royal-red),
        0 0 14px 2px rgba(var(--xq-rim-rgb), 0.55);
}

/* Current account page: steady ring, no pulse */
header.site-header a.nav-avatar-link.is-current .nav-avatar,
body.profile
    header.site-header
    a.nav-avatar-link:has(+ div.dropdown-menu > a.profile.dropdown-item.active)
    .nav-avatar {
    animation: none;
    border-color: #fff;
    box-shadow:
        0 0 0 2px var(--royal-red),
        0 0 0 4.5px var(--royal-gold),
        0 0 16px 4px rgba(var(--xq-rim-rgb), 0.5);
}

/* Current + hover: keep the ring, just brighten the glow */
header.site-header a.nav-avatar-link.is-current:hover .nav-avatar {
    box-shadow:
        0 0 0 2px var(--royal-red),
        0 0 0 4.5px var(--royal-gold),
        0 0 22px 6px rgba(var(--xq-rim-rgb), 0.75);
}

/* Keyboard focus gets the same halo as the current state */
header.site-header a.nav-avatar-link:focus-visible {
    outline: none;
}
header.site-header a.nav-avatar-link:focus-visible .nav-avatar {
    box-shadow:
        0 0 0 2px var(--royal-red),
        0 0 0 4.5px var(--royal-gold);
}

/* Keep the old text-link colour rule from tinting the avatar's caret */
body.profile header.site-header a.nav-avatar-link.is-current {
    color: var(--royal-gold);
}

@media (prefers-reduced-motion: reduce) {
    header.site-header .nav-avatar {
        transition: none;
    }
    header.site-header a.nav-avatar-link:hover .nav-avatar {
        transform: none;
    }
}

/* ==========================================================================
   AUTHENTICATION & ACTION BUTTONS
   ========================================================================== */
header.site-header a.login,
header.site-header a.register {
    position: relative;
    overflow: hidden;
    padding: 8px 20px;
    border-radius: 8px;
    z-index: 1;
    box-shadow: var(--liquid-shadow);
    backdrop-filter: var(--glass-blur);
}

header.site-header a.register {
    background: linear-gradient(to bottom, var(--xq-metal), #b89020) !important;
    color: var(--royal-bg) !important;
    border: 1px solid #fff;
}

header.site-header a.login {
    background: var(--glass-bg-dark) !important;
    color: var(--royal-gold) !important;
    border: 1px solid var(--royal-gold);
    box-shadow: inset 0 2px 5px var(--liquid-highlight);
}

header.site-header a.login:hover {
    background: rgba(var(--xq-crimson-rgb), 0.6) !important;
    box-shadow:
        0 0 20px rgba(var(--xq-metal-rgb), 0.5),
        inset 0 2px 10px var(--liquid-highlight);
}

/* ==========================================================================
   HEADER ANIMATIONS
   ========================================================================== */
@keyframes headerSlideDown {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes headerLiquidGlow {
    0% {
        box-shadow:
            var(--liquid-shadow),
            inset 0 -2px 15px rgba(var(--xq-rim-rgb), 0.15);
    }
    100% {
        box-shadow:
            0 12px 35px rgba(0, 0, 0, 0.9),
            inset 0 -2px 30px rgba(var(--xq-rim-rgb), 0.5);
    }
}

/* ==========================================================================
   HEADER HOVER (LIQUID SHEEN & GLOW)
   ========================================================================== */

/* 1. Create the liquid reflection layer (hidden by default) */
header.site-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        /* Bright white reflection */ transparent
    );
    transform: skewX(-20deg);
    transition: left 4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: -1; /* Keeps the glare behind your navigation links */
    pointer-events: none;
}

/* 2. Intensify the glass and gold aura on hover */
header.site-header:hover {
    /* Pauses the idle breathing animation so the hover state takes focus */
    animation-play-state: paused;

    /* Slightly brighter red glass for an active feel */
    background: rgba(158, 24, 24, 0.85);

    box-shadow:
        0 15px 40px rgba(0, 0, 0, 0.9),
        /* Deeper drop shadow */ 0 0 30px rgba(var(--xq-metal-rgb), 0.5),
        /* Stronger outer gold aura */ inset 0 -2px 25px var(--liquid-highlight) !important; /* Brighter inner wet look */
}

/* 3. Trigger the sweeping light effect across the header */
header.site-header:hover::before {
    left: 200%;
}

/* ==========================================================================
   GLOSSY & LIQUID GLASS LOGO (.navbar-brand img) REDESIGN
   ========================================================================== */
header.site-header .navbar-brand img {
    margin-right: 12px;
    border-radius: 50%; /* Smooth circular baseline */
    padding: 2px;
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.15) 0%,
        transparent 70%
    );

    /* Ambient Royal Gold Glow */
    filter: drop-shadow(0 0 8px rgba(var(--xq-metal-rgb), 0.6))
        drop-shadow(0 4px 10px rgba(0, 0, 0, 0.7));

    /* Liquid Motion Physics */
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 2;
}

/* Hover State: Levitate, Radiant Aura and Majestic Infinite Spin */
header.site-header .navbar-brand img:hover {
    transform: scale(1.12) translateY(-2px);
    filter: drop-shadow(0 0 18px rgba(var(--xq-rim-rgb), 0.9))
        drop-shadow(0 12px 20px rgba(0, 0, 0, 0.8));
    animation: spin 1.2s linear 0s infinite;
}

/* Active State: Click Compression (Pressed-wet look) */
header.site-header .navbar-brand img:active {
    transform: scale(0.95) translateY(1px);
    filter: drop-shadow(0 0 8px rgba(var(--xq-rim-rgb), 0.5))
        drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9));
    animation: spin 0.6s linear 0s infinite;
}

/* Global Loading Overrides */
body.loading .navbar-brand img {
    animation: spin 0.3s linear 0s infinite !important;
    filter: drop-shadow(
        0 0 15px rgba(230, 57, 70, 0.8)
    ) !important; /* Shifts to an energetic red pulse while loading */
}

header.site-header .navbar {
    box-shadow: none !important;
    border: none !important;
}
header.site-header .navbar ul {
    display: flex;
    flex-flow: row wrap;
    margin: 0 -14px;
}
header.site-header .navbar li {
    padding: 30px 12.5px 20px;
}
header.site-header .navbar li a {
    font-size: 14px;
}
header.site-header .navbar li a.waves-effect {
    display: inline !important;
}

/* Dropdown */
header.site-header .dropdown-menu a {
    color: var(--royal-gold-light);
    top: 0 !important;
}
header.site-header .dropdown-menu a:hover {
    background-color: var(--royal-red-light);
    color: var(--royal-gold);
}
header.site-header .dropdown-menu a:before {
    display: none !important;
}
header.site-header .dropdown-menu .dropdown-item.active,
header.site-header .dropdown-menu .dropdown-item:active {
    background-color: var(--royal-gold) !important;
    color: var(--royal-red) !important;
}

/* Menu toggle mobile */
header.site-header .menu-toggle {
    display: none;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    position: absolute;
    left: 0;
    top: 0;
    padding: 37px;
    z-index: 3;
}
/* Thay màu icon svg beige thành gold nếu được, ở đây mượn style cũ */
header.site-header .menu-toggle.open {
    background-image: url(/img/ic-menu-open-beige.svg);
    width: 20px;
    height: 12px;
}
header.site-header .menu-toggle.close {
    background-image: url(/img/ic-menu-close-beige.svg);
    width: 20px;
    height: 15px;
}

@media (max-width: 1280px) {
    header.site-header ul.navbar-nav {
        overflow-y: auto !important;
        max-height: calc(100vh - 74px);
    }
    header.site-header ul.navbar-nav li.dropdown.language-switcher > a {
        border-left: none;
        padding: 0 !important;
    }
    header.site-header ul.navbar-nav .dropdown-menu {
        position: static;
        background-color: var(--royal-bg);
        border: none;
    }
    header.site-header .navbar-brand {
        margin-left: auto;
    }
    header.site-header .navbar-brand h1,
    header.site-header .navbar-brand span {
        display: none !important;
    }
    header.site-header .navbar-brand img {
        margin-right: 0;
    }
    header.site-header .menu-toggle {
        display: block;
    }
    header.site-header .menu-toggle.open ~ nav.navbar {
        display: none;
    }
    header.site-header .menu-toggle.close ~ nav.navbar {
        display: block;
        position: absolute;
        background: linear-gradient(to bottom, var(--xq-crimson), #5c0a0a);
        top: 74px;
        left: 0;
        z-index: 2;
        width: 100%;
        border-bottom: 2px solid var(--royal-gold);
    }
    header.site-header .menu-toggle.close ~ nav.navbar ul li {
        width: 100%;
        margin: 0;
        padding: 12px 24px;
        border-bottom: 1px solid rgba(var(--xq-metal-rgb), 0.2);
    }
    header.site-header .menu-toggle.close ~ nav.navbar ul li a {
        color: var(--royal-gold-light);
    }
    header.site-header .menu-toggle.close ~ nav.navbar ul li .dropdown-menu a {
        color: var(--royal-gold-light);
    }
    header.site-header
        .menu-toggle.close
        ~ nav.navbar
        ul
        li
        .dropdown-menu
        .dropdown-item.active {
        background-color: var(--royal-gold);
        color: var(--royal-red);
    }

    /* Đăng nhập: in the mobile menu, render as a plain link like the others
       (no pill/button chrome). Selector is deliberately more specific than
       "header.site-header a.login" here and in theme-cozy.css. */
    header.site-header .navbar li a.login {
        display: inline;
        padding: 0;
        border: none;
        border-radius: 0;
        background: transparent !important;
        color: var(--royal-gold-light) !important;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        overflow: visible;
    }
    header.site-header .navbar li a.login:hover,
    body.login header.site-header .navbar li a.login {
        background: transparent !important;
        color: var(--royal-gold) !important;
        box-shadow: none;
    }
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
footer {
    background-color: #0f0805;
    border-top: 3px solid var(--royal-gold);
    color: var(--royal-gold-light);
    z-index: 1;
    /* user-select: none; */
}
footer a {
    color: #aa8c4a;
}
footer a:hover {
    color: var(--royal-gold);
}
footer ul li {
    margin-bottom: 0.7em;
}
body.home footer a.home,
body.dashboard footer a.dashboard,
body.trophy footer a.trophy,
body.puzzle footer a.puzzle,
body.setup footer a.setup,
body.about footer a.about,
body.bmi footer a.bmi,
body.game footer a.game,
body.room footer a.room,
body.news footer a.news,
body.contact footer a.contact {
    text-decoration: underline;
    color: var(--royal-gold);
}
footer ul.list-unstyled:hover a {
    text-decoration: none;
}
footer ul.list-unstyled > li > a:hover {
    text-decoration: underline !important;
}

/* ==========================================================================
   LAYOUTS & HERO (Cuốn thư / Tấm liễn)
   ========================================================================== */
.hero {
    background-color: transparent;
}
.hero .hero-box {
    background: rgba(28, 17, 10, 0.85); /* Nền gỗ trong suốt */
    border: 2px solid var(--royal-gold);
    box-shadow:
        0 0 20px rgba(0, 0, 0, 0.8),
        inset 0 0 15px rgba(var(--xq-metal-rgb), 0.1);
    border-radius: 8px;
    padding: 20px;
}
.hero .hero-box .nav-tabs {
    border-bottom: 2px solid var(--royal-gold);
}
.hero .hero-box .nav-tabs li a {
    cursor: pointer;
    padding: 12px 24px;
    display: block;
    color: var(--royal-gold-light);
    font-weight: 600;
    text-transform: uppercase;
}
.hero .hero-box .nav-tabs li.active a {
    background: linear-gradient(to bottom, var(--xq-crimson), #5c0a0a);
    color: var(--royal-gold);
    border: 1px solid var(--royal-gold);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}
.hero .hero-box .nav-tabs li:not(.active) a {
    color: #aa8c4a;
}
.hero .hero-box .desc {
    color: var(--royal-gold-light);
    font-style: italic;
}

.comments {
    background-color: var(--royal-bg);
}

/* Hình nền chung - Nếu có ảnh cung đình tĩnh thì thay URL ở đây */
.container-fluid.about,
.container-fluid.bmi,
.container-fluid.game,
.container-fluid.news,
.container-fluid.contact,
body.dashboard main,
body.login main,
body.register main {
    color: var(--royal-gold-light);
    isolation: isolate !important;
    position: relative !important;
}

.container-fluid.bmi-explanation,
.container-fluid.game-explanation {
    background-color: #2a1910;
    border-top: 1px solid var(--royal-gold);
    border-bottom: 1px solid var(--royal-gold);
}

/* ==========================================================================
   COMPONENTS
   ========================================================================== */
#tao-phong a {
    color: var(--royal-gold) !important;
    font-weight: 600;
}
#tao-phong a i {
    color: var(--royal-gold) !important;
}
#tao-phong a:active {
    background-color: var(--royal-red) !important;
    color: var(--royal-gold-light) !important;
}
#tao-phong a:active i {
    color: var(--royal-gold-light) !important;
}

/* Câu tục ngữ kiểu thư pháp */
#proverb {
    color: var(--royal-gold);
    font-size: 18px;
    font-family: "Texturina", serif;
    font-style: italic;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    background: rgba(var(--xq-crimson-rgb), 0.2);
    padding: 10px 20px;
    border-left: 4px solid var(--royal-gold);
    border-right: 4px solid var(--royal-gold);
}
#proverb #proverb_content:before,
#proverb #proverb_content::before {
    content: "“";
    position: relative;
    top: 15px;
    font-size: 32px;
    color: var(--royal-red-light);
}
#proverb span.content {
    cursor: pointer;
}
#proverb span.content.introjs-relativePosition {
    color: var(--royal-gold);
}
#proverb_refresh {
    display: inline-block;
    cursor: pointer;
}
#proverb_refresh i {
    color: var(--royal-gold);
    font-size: 29px;
}
#proverb_refresh:hover i {
    animation: spin 900ms linear 0s infinite;
}

#result,
#compatibility,
#ket-qua,
#ghep-cap {
    height: 74px;
    margin-top: -74px;
    pointer-events: none;
    z-index: -1;
}

.chart,
.adsense {
    background-color: var(--royal-bg);
}
.chart #main_chart {
    height: 480px;
    width: calc(100% - 100px);
    /* user-select: none; */
}

/* Nút chung */
.btn {
    cursor: pointer;
    color: var(--royal-gold-light);
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
}
/* ==========================================================================
   LIQUID ROYAL BUTTONS
   ========================================================================== */
.btn {
    position: relative;
    overflow: hidden;
    z-index: 1;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 8px;
}

/* The Liquid Glass Highlight Sheen overlay */
.btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -150%;
    width: 150%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        /* Brighter white for liquid reflection */ transparent
    );
    transform: skewX(-20deg);
    transition: all 0.6s ease;
    z-index: -1;
}

.btn:hover::before {
    left: 150%;
}

/* Obsidian Glass Button (.btn-dark) */
.btn-dark {
    background: var(--glass-bg-dark) !important;
    color: var(--royal-gold-light) !important;
    border: 1px solid var(--glass-border) !important;
    box-shadow:
        var(--liquid-shadow),
        inset 0 2px 5px var(--liquid-highlight);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.btn-dark:hover {
    background: rgba(37, 42, 54, 0.6) !important;
    color: var(--royal-gold) !important;
    border-color: rgba(var(--xq-metal-rgb), 0.8) !important;
    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.8),
        0 0 15px rgba(var(--xq-metal-rgb), 0.3),
        inset 0 2px 10px rgba(255, 255, 255, 0.3);
}

/* Ruby Glass Button (.btn-danger) */
.btn-danger {
    background: var(--glass-bg-red) !important;
    border: 1px solid rgba(var(--xq-rim-rgb), 0.4) !important;
    color: var(--royal-gold) !important;
    box-shadow:
        var(--liquid-shadow),
        inset 0 2px 8px rgba(var(--xq-rim-rgb), 0.2);
}

.btn-danger:hover {
    background: rgba(183, 34, 34, 0.5) !important;
    box-shadow:
        0 0 15px rgba(var(--xq-metal-rgb), 0.5),
        inset 0 2px 10px rgba(var(--xq-rim-rgb), 0.4);
}
.btn-success {
    background: linear-gradient(to bottom, #2d6a4f, #1b4332) !important;
    border: 1px solid var(--royal-gold) !important;
    color: var(--royal-gold) !important;
}

.btn.bootbox-cancel {
    color: #fff !important;
    background-color: #333 !important;
    border-color: #555 !important;
}

.custom-select,
#dob,
#change-date {
    cursor: pointer;
}
.chart-nav {
    font-size: 48px;
    color: #aa8c4a;
    top: 288px;
    cursor: pointer;
    /* user-select: none; */
    filter: drop-shadow(2px 3px 6px rgba(0, 0, 0, 0.5));
}
.chart-nav:hover {
    color: var(--royal-gold);
}
#ajax-chart {
    padding-top: 60px !important;
    padding-bottom: 60px !important;
}

#info {
    /* user-select: none; */
}
#info p {
    font-size: 20px;
    color: var(--royal-gold-light);
}
.info {
    background-color: #2a1910;
    border: 1px solid var(--royal-gold);
    padding: 10px;
    border-radius: 4px;
}
.info .controls {
    max-height: 0;
    overflow-y: hidden;
    transition: max-height 420ms ease-in-out;
    height: 64px;
}
.info .controls:hover,
.info .controls:active,
.info .controls:focus {
    max-height: 420px;
}
.info:hover .controls,
.info:active .controls,
.info:focus .controls {
    max-height: 420px;
}

/* ==========================================================================
   LIQUID GLASS PAGINATION
   ========================================================================== */
.page-link {
    background: var(--glass-bg-dark) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border) !important;
    color: var(--royal-gold-light) !important;
    box-shadow:
        var(--liquid-shadow),
        inset 0 2px 5px var(--liquid-highlight) !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 600;
}

/* Hover State - Dynamic Translucent Gradient & Glossy Reflection */
.page-link:hover,
.bg-dark.page-link:hover {
    background: linear-gradient(
        90deg,
        rgba(var(--xq-crimson-rgb), 0.15),
        rgba(var(--xq-crimson-rgb), 0.75),
        rgba(var(--xq-crimson-rgb), 0.15)
    ) !important;
    border-color: rgba(var(--xq-rim-rgb), 0.6) !important;
    color: var(--royal-gold) !important;
    text-shadow: 0 0 8px rgba(var(--xq-metal-rgb), 0.8);
    box-shadow:
        inset 0 2px 8px var(--liquid-highlight),
        inset 0 -2px 8px rgba(0, 0, 0, 0.4),
        0 4px 15px rgba(var(--xq-metal-rgb), 0.25) !important;
    transform: translateY(-2px);
    z-index: 2;
}

/* Active State - Solid Liquid Gold */
.page-item.active .page-link {
    background: linear-gradient(
        to right,
        var(--royal-gold),
        #b89020
    ) !important;
    border-color: var(--royal-gold) !important;
    color: var(--royal-bg) !important; /* High contrast ebony text */
    text-shadow: none;
    box-shadow:
        inset 0 0 10px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(var(--xq-metal-rgb), 0.4) !important;
    transform: translateY(0);
    z-index: 3;
}

/* Disabled State - Dimmed Wood/Ebony */
.page-item.disabled .page-link {
    background: rgba(11, 12, 16, 0.8) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-color: rgba(var(--xq-metal-rgb), 0.1) !important;
    color: rgba(255, 242, 204, 0.4) !important; /* Faded royal-gold-light */
    box-shadow: none !important;
    cursor: not-allowed;
    transform: none;
}

/* Focus State - Golden Aura */
.page-link:focus,
.bg-dark.page-link:focus,
.form-check-input:focus {
    border-color: var(--royal-gold) !important;
    outline: 0;
    box-shadow:
        0 0 0 0.25rem rgba(var(--xq-metal-rgb), 0.3),
        inset 0 2px 5px var(--liquid-highlight) !important;
    z-index: 3;
}

/* Spacing and Border Radius for Page Items */
.page-item:first-child .page-link {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.page-item:last-child .page-link {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* ==========================================================================
   BÀN CỜ / KHUNG BÀN CỜ HOÀNG GIA (GAME BOARD)
   ========================================================================== */
#ban-co {
    /* touch-action: none !important; */
    pointer-events: all;
    width: 100%;
    max-width: 380px;
    margin: 0 auto !important;
    background-color: #252a36; /* */
    border-radius: 12px;
    padding: 10px;
    /* Replace static shadow with a multi-layered cinematic glow */
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(var(--xq-rim-rgb), 0.15),
        inset 0 0 20px rgba(var(--xq-rim-rgb), 0.05) !important;
    border: 1px solid var(--glass-border);
    transition:
        transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        box-shadow 0.4s ease;
}
#ban-co:hover {
    transform: translateY(-2px) scale(1.005);
    box-shadow:
        0 30px 60px rgba(0, 0, 0, 0.9),
        0 0 40px rgba(var(--xq-rim-rgb), 0.3),
        inset 0 0 30px rgba(var(--xq-rim-rgb), 0.1) !important;
}
#ban-co:has(.notation-8c7a2) {
    padding: 25px 5px !important;
    background-color: #dfbd85 !important;
}
#ban-co:has(.notation-8c7a2):has(.spare-pieces-9e77b) {
    padding: 5px !important;
}
body.setup #ban-co {
    max-width: 310px !important;
}

.side-color {
    font-weight: 600;
    font-size: 42px;
    text-align: center;
    line-height: 1.2em;
    display: block;
    cursor: default !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
.side-color.red {
    color: #ff3333;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}
.side-color.black {
    color: #111;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

#game-status {
    background: linear-gradient(
        to right,
        transparent,
        rgba(var(--xq-crimson-rgb), 0.8),
        transparent
    ) !important;
    padding: 12px 24px;
    font-size: 17px;
    font-weight: 600;
    color: var(--royal-gold);
    cursor: default !important;
    display: none;
    text-transform: uppercase;
    letter-spacing: 2px;
}
#game-over {
    color: var(--royal-gold);
    border: 2px solid var(--royal-gold);
    padding: 12px 24px;
    background-color: var(--royal-bg);
    font-weight: 600;
    cursor: default !important;
    text-transform: uppercase;
}
#game-over:hover {
    background-color: var(--royal-red);
}

/* ==========================================================================
   CHECKMATE BANNER  —  "CHIẾU!" seal, driven entirely by data-board-theme
   Every colour comes from the per-board tokens (html[data-board-theme], section 2
   of themes.css), so the banner re-skins itself with the board:
     Cozy   : honey-gold letters, lantern ring        on a crimson ribbon
     Floral : blossom-pink letters, orbiting petals   on a berry ribbon
     Golden : bright gold letters, ruby sunburst      on a ruby ribbon
     Wooden : brass letters, jade lock-on ring        on a jade ribbon
   One element, layered backgrounds (per-layer background-clip):
     text-clipped : light sweep · gloss · themed metal
     border-box   : themed hairlines · themed ribbon (grows from centre)
   ::before = board capture mark (--xq-fx-lock) bursting out on impact
   ::after  = board hover aura   (--xq-fx-aura) spinning shockwave
   Same element (#checkmateText) and animation names as before.
   ========================================================================== */
@property --cm-r {
    syntax: "<percentage>";
    inherits: false;
    initial-value: 0%;
}

#checkmateText {
    /* ---- banner tokens: all mapped from the board palette ---- */
    --cm-metal-top: var(--xq-cream);
    --cm-metal-hi: var(--xq-accent-hi);
    --cm-metal-mid: var(--xq-metal);
    --cm-metal-band: var(
        --xq-wood
    ); /* hard "horizon" line across the letters */
    --cm-metal-lo: var(--xq-accent);
    --cm-metal-base: var(--xq-sheen);
    --cm-shine-rgb: var(--xq-highlight-rgb);
    --cm-stroke: var(--xq-fx-deep);
    --cm-extrude: var(--xq-shadow);
    --cm-aura-rgb: var(--xq-fx-glow-rgb);
    --cm-bloom-rgb: var(--xq-rim-aura-rgb);
    --cm-hair: var(--xq-rim);
    --cm-hair-hi: var(--xq-highlight);
    --cm-ribbon-edge-rgb: var(--xq-surface-deep-rgb);
    --cm-ribbon-core-rgb: var(--xq-crimson-rgb);
    --cm-shadow-rest: drop-shadow(0 5px 0 var(--cm-extrude))
        drop-shadow(0 0 16px rgba(var(--cm-aura-rgb), 0.85))
        drop-shadow(0 0 46px rgba(var(--cm-bloom-rgb), 0.5));
    --cm-shadow-peak: drop-shadow(0 5px 0 var(--cm-extrude))
        drop-shadow(0 0 30px rgba(var(--cm-aura-rgb), 1))
        drop-shadow(0 0 90px rgba(var(--cm-bloom-rgb), 0.9));

    position: fixed;
    top: 50%;
    left: 0;
    right: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    text-align: center;
    white-space: nowrap;
    padding: 0.14em 0 0.06em;

    font-family: "Texturina", serif;
    font-weight: 900;
    font-size: clamp(3.25rem, 15vw, 10rem);
    line-height: 1.1;
    letter-spacing: 0.06em;
    text-transform: uppercase;

    color: transparent;
    --cm-r: 0%;
    background-image:
        /* 1 text  · travelling light sweep */
        linear-gradient(
            105deg,
            transparent 38%,
            rgba(var(--cm-shine-rgb), 0.95) 50%,
            transparent 62%
        ),
        /* 2 text  · gloss on the upper half */
        linear-gradient(
                180deg,
                rgba(var(--cm-shine-rgb), 0.6) 0%,
                rgba(var(--cm-shine-rgb), 0.12) 48%,
                transparent 50%
            ),
        /* 3 text  · themed metal with a hard horizon band */
        linear-gradient(
                180deg,
                var(--cm-metal-top) 0%,
                var(--cm-metal-hi) 24%,
                var(--cm-metal-mid) 46%,
                var(--cm-metal-band) 52%,
                var(--cm-metal-lo) 68%,
                var(--cm-metal-base) 100%
            ),
        /* 4 ribbon · top hairline */
        linear-gradient(
                90deg,
                transparent calc(50% - var(--cm-r)),
                var(--cm-hair) calc(50% - var(--cm-r) * 0.7),
                var(--cm-hair-hi) 50%,
                var(--cm-hair) calc(50% + var(--cm-r) * 0.7),
                transparent calc(50% + var(--cm-r))
            ),
        /* 5 ribbon · bottom hairline */
        linear-gradient(
                90deg,
                transparent calc(50% - var(--cm-r)),
                var(--cm-hair) calc(50% - var(--cm-r) * 0.7),
                var(--cm-hair-hi) 50%,
                var(--cm-hair) calc(50% + var(--cm-r) * 0.7),
                transparent calc(50% + var(--cm-r))
            ),
        /* 6 ribbon · dark surface edges, themed core */
        linear-gradient(
                90deg,
                transparent calc(50% - var(--cm-r)),
                rgba(var(--cm-ribbon-edge-rgb), 0.92)
                    calc(50% - var(--cm-r) * 0.72),
                rgba(var(--cm-ribbon-core-rgb), 0.96) 50%,
                rgba(var(--cm-ribbon-edge-rgb), 0.92)
                    calc(50% + var(--cm-r) * 0.72),
                transparent calc(50% + var(--cm-r))
            );
    background-size:
        250% 100%,
        100% 100%,
        100% 100%,
        100% 2px,
        100% 2px,
        100% 100%;
    background-repeat: no-repeat;
    background-position:
        120% 0,
        0 0,
        0 0,
        0 0,
        0 100%,
        0 0;
    -webkit-background-clip:
        text, text, text, border-box, border-box, border-box;
    background-clip: text, text, text, border-box, border-box, border-box;
    -webkit-text-stroke: 2px var(--cm-stroke);

    /* filter, not text-shadow: text-shadow would paint over the clipped gradient */
    filter: blur(0) var(--cm-shadow-rest);

    transform: translateY(-50%) scale(0.5);
    will-change: transform, opacity, filter;
    animation:
        epicCheckmate 2.4s cubic-bezier(0.2, 0.9, 0.25, 1.15) forwards,
        checkmateRibbon 2.4s cubic-bezier(0.2, 0.9, 0.25, 1) forwards,
        checkmateShine 1.1s 0.5s ease-in-out 2 both;
}

/* ---- Per-board character (still token-only, no raw colours) ---- */
html[data-board-theme="banco-floral"] #checkmateText {
    /* blossom letters with a berry horizon, soft petal-white shine */
    --cm-metal-band: var(--xq-primary);
    --cm-metal-mid: var(--xq-accent-lo);
    --cm-hair: var(--xq-accent);
    --cm-extrude: var(--xq-crimson);
}
html[data-board-theme="banco-gold"] #checkmateText {
    /* brightest metal, ruby bloom instead of amber */
    --cm-metal-mid: var(--xq-rim);
    --cm-bloom-rgb: var(--xq-fx-capture-rgb);
    --cm-extrude: var(--xq-crimson);
}
html[data-board-theme="banco-wood"] #checkmateText {
    /* brass letters, jade horizon, jade glow */
    --cm-metal-band: var(--xq-primary);
    --cm-aura-rgb: var(--xq-primary-light-rgb);
    --cm-extrude: var(--xq-wood);
}

/* Burst: the board's capture mark flies out from behind the letters */
#checkmateText::before,
#checkmateText::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    aspect-ratio: 1;
    background: center / contain no-repeat;
    opacity: 0;
    pointer-events: none;
}
#checkmateText::before {
    width: 1.6em;
    background-image: var(--xq-fx-lock);
    transform: translate(-50%, -50%) scale(0.3) rotate(0deg);
    animation: checkmateBurst 1.1s 0.38s cubic-bezier(0.1, 0.7, 0.3, 1) forwards;
}
/* Shockwave: the board's hover aura, spinning outwards */
#checkmateText::after {
    width: 2.2em;
    background-image: var(--xq-fx-aura);
    transform: translate(-50%, -50%) scale(0.2) rotate(0deg);
    animation: checkmateShock 1.3s 0.4s cubic-bezier(0.1, 0.7, 0.3, 1) forwards;
}

/* Slam in → impact shake → hold → rise & fade */
@keyframes epicCheckmate {
    0% {
        opacity: 0;
        transform: translateY(-50%) scale(3.4) rotate(-6deg);
        filter: blur(14px) var(--cm-shadow-rest);
    }
    18% {
        opacity: 1;
        transform: translateY(-50%) scale(0.92) rotate(1.5deg);
        filter: blur(0) var(--cm-shadow-peak);
    }
    26% {
        transform: translateY(-50%) scale(1.07) rotate(-0.8deg);
    }
    32% {
        transform: translateY(-50%) scale(1) rotate(0deg);
    }
    35% {
        transform: translate(1.2%, -50.8%) scale(1);
    }
    38% {
        transform: translate(-1.2%, -49.4%) scale(1);
    }
    41% {
        transform: translate(0.6%, -50.4%) scale(1);
    }
    44% {
        transform: translateY(-50%) scale(1);
    }
    80% {
        opacity: 1;
        transform: translateY(-50%) scale(1.02);
        filter: blur(0) var(--cm-shadow-rest);
    }
    100% {
        opacity: 0;
        transform: translateY(-58%) scale(1.12);
        filter: blur(6px) var(--cm-shadow-rest);
    }
}

/* Ribbon unrolls from the centre */
@keyframes checkmateRibbon {
    0%,
    8% {
        --cm-r: 0%;
    }
    32%,
    100% {
        --cm-r: 50%;
    }
}

@keyframes checkmateShine {
    from {
        background-position:
            120% 0,
            0 0,
            0 0,
            0 0,
            0 100%,
            0 0;
    }
    to {
        background-position:
            -20% 0,
            0 0,
            0 0,
            0 0,
            0 100%,
            0 0;
    }
}

@keyframes checkmateBurst {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3) rotate(0deg);
    }
    15% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2.6) rotate(90deg);
    }
}

@keyframes checkmateShock {
    0% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(0.2) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(3.2) rotate(-120deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    #checkmateText {
        --cm-r: 50%;
        animation: checkmateFade 2s ease forwards;
    }
    #checkmateText::before,
    #checkmateText::after {
        display: none;
    }
    @keyframes checkmateFade {
        0%,
        100% {
            opacity: 0;
            transform: translateY(-50%);
        }
        15%,
        80% {
            opacity: 1;
            transform: translateY(-50%);
        }
    }
}

/* ==========================================================================
   ANIMATIONS (Hiệu ứng tỏa sáng hoàng kim/châu sa)
   ========================================================================== */
.pulse,
.pulse-gold,
.pulse-red,
.pulse-light,
.pulse-dark {
    position: relative;
    cursor: pointer;
    border-radius: 4px;
}
.pulse {
    box-shadow: 0 0 0 0 rgba(45, 106, 79, 0.84);
    animation: pulse 1.5s infinite cubic-bezier(0.66, 0, 0, 1);
}
.pulse-gold {
    box-shadow: 0 0 0 0 rgba(var(--xq-metal-rgb), 0.84);
    animation: pulse-gold 1.5s infinite cubic-bezier(0.66, 0, 0, 1);
}
.pulse-red {
    box-shadow: 0 0 0 0 rgba(var(--xq-crimson-rgb), 0.84);
    animation: pulse-red 1.5s infinite cubic-bezier(0.66, 0, 0, 1);
}
.pulse-light {
    box-shadow: 0 0 0 0 rgba(243, 229, 216, 0.84);
    animation: pulse-light 1.5s infinite cubic-bezier(0.66, 0, 0, 1);
}
.pulse-dark {
    box-shadow: 0 0 0 0 rgba(28, 17, 10, 0.84);
    animation: pulse-dark 1.5s infinite cubic-bezier(0.66, 0, 0, 1);
}

.pulse:hover,
.pulse-gold:hover,
.pulse-red:hover,
.pulse-light:hover,
.pulse-dark:hover {
    animation: none;
}

@keyframes pulse {
    to {
        box-shadow: 0 0 0 15px rgba(45, 106, 79, 0);
    }
}
@keyframes pulse-gold {
    to {
        box-shadow: 0 0 0 15px rgba(var(--xq-metal-rgb), 0);
    }
}
@keyframes pulse-red {
    to {
        box-shadow: 0 0 0 15px rgba(var(--xq-crimson-rgb), 0);
    }
}
@keyframes pulse-light {
    to {
        box-shadow: 0 0 0 15px rgba(243, 229, 216, 0);
    }
}
@keyframes pulse-dark {
    to {
        box-shadow: 0 0 0 15px rgba(28, 17, 10, 0);
    }
}
@keyframes fadeInAnimation {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
@keyframes fade {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.3);
        opacity: 0;
    }
}

/* ==========================================================================
   GLASS TABLES
   ========================================================================== */
.table-responsive,
.dataTables_wrapper {
    background: var(--glass-bg-dark);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow:
        var(--liquid-shadow),
        inset 0 1px 5px var(--liquid-highlight);
    padding: 10px;
}

.table {
    color: var(--royal-gold-light);
    background: transparent !important;
}

.table td,
.table th {
    vertical-align: middle !important;
    border-top: 1px solid rgba(var(--xq-metal-rgb), 0.15) !important;
    color: var(--royal-gold) !important;
    background: transparent !important;
}

.table tbody tr {
    transition: background-color 0.3s ease;
}

.table tbody tr:hover {
    background-color: rgba(
        var(--xq-rim-rgb),
        0.05
    ) !important; /* Soft glossy glow on hover */
    box-shadow: inset 0 0 15px rgba(var(--xq-rim-rgb), 0.1);
}

/* 1. Prevent table headers from wrapping into multiple lines */
.table thead th {
    border-bottom: 2px solid var(--royal-gold);
    color: var(--royal-gold);
    text-transform: uppercase;
    background: rgba(11, 12, 16, 0.2);
    white-space: nowrap; /* Add this line */
}

/* 2. Prevent room names from breaking, and truncate them if they are too long */
table.table:not(#danh-sach-ky-thu) td.room-code span {
    padding: 4px 7px 5px;
    background: rgba(var(--xq-metal-rgb), 0.2);
    border-radius: 4px;
    border: 1px solid var(--royal-gold);

    /* Add these lines below to fix the wrapping bug */
    display: inline-block;
    max-width: 180px; /* Adjust this value based on your layout preference */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.table td.host-name,
.table td.guest-name {
    max-width: 140px; /* Điều chỉnh độ rộng tối đa tùy ý */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

/* ==========================================================================
   TABLE TRUNCATION (CẮT CHỮ)
   ========================================================================== */
.table td.host-name,
.table td.guest-name {
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

/* ==========================================================================
   ROYAL TOOLTIP (BOOTSTRAP OVERRIDE)
   ========================================================================== */
.tooltip .tooltip-inner {
    background: rgba(11, 12, 16, 0.95) !important; /* Nền đen mun */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--royal-gold) !important;
    color: var(--royal-gold-light) !important;
    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.9),
        0 0 15px rgba(var(--xq-metal-rgb), 0.3);
    font-family: "Plus Jakarta Sans", sans-serif;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
}

/* Mũi tên của Tooltip (màu vàng hoàng kim) */
.tooltip.bs-tooltip-top .arrow::before,
.tooltip.bs-tooltip-auto[x-placement^="top"] .arrow::before {
    border-top-color: var(--royal-gold) !important;
}
.tooltip.bs-tooltip-bottom .arrow::before,
.tooltip.bs-tooltip-auto[x-placement^="bottom"] .arrow::before {
    border-bottom-color: var(--royal-gold) !important;
}

/* ==========================================================================
   BẢNG & DATA TABLES
   ========================================================================== */
.table {
    color: var(--royal-gold-light);
}
.table td,
.table th {
    vertical-align: middle !important;
    border-top: 1px solid var(--royal-gold);
    color: var(--royal-gold) !important;
}
#app table th,
#app table td,
#app .table th,
#app .table td {
    color: var(--royal-gold) !important;
}
.table thead th {
    border-bottom: 2px solid var(--royal-gold);
    color: var(--royal-gold);
    text-transform: uppercase;
}
.table td.room-code a {
    color: var(--royal-gold);
    font-family: "Noto Sans Mono", monospace;
    font-weight: 600;
}
table.table:not(#danh-sach-ky-thu) td.room-code span {
    padding: 4px 7px 5px;
    background: rgba(var(--xq-metal-rgb), 0.2);
    border-radius: 4px;
    border: 1px solid var(--royal-gold);
}
.table td.room-time {
    font-family: "Noto Sans Mono", monospace;
    color: #aa8c4a;
}

/* ==========================================================================
   REDESIGNED SOCIAL BUTTONS (LIQUID GLASS THEME - INLINE)
   ========================================================================== */
body.login .btn-facebook,
body.login .btn-google,
body.register .btn-facebook,
body.register .btn-google {
    /* Allow buttons to share the same line */
    width: auto;
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.btn-social {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 20px;
    overflow: hidden;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 8px !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1;
}

/* Liquid sheen reflection effect */
.btn-social::before {
    content: "";
    position: absolute;
    top: 0;
    left: -150%;
    width: 150%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transform: skewX(-20deg);
    transition: all 0.6s ease;
    z-index: -1;
}

.btn-google::before {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(26, 115, 232, 0.4),
        transparent
    ) !important;
}

.btn-social:hover::before {
    left: 150%;
}

.btn-social:hover {
    transform: translateY(-3px) scale(1.02);
}

/* SVG icon levitation */
.btn-social svg {
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.15));
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-social:hover svg {
    transform: scale(1.15) rotate(-5deg);
}

/* Google Button - Official White */
.btn-google {
    background-color: #ffffff !important;
    border: 1px solid #dadce0 !important;
    color: #3c4043 !important;
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.8) !important;
}

.btn-google:hover {
    background-color: #f8f9fa !important;
    border-color: #d2e3fc !important;
    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(255, 255, 255, 0.2) !important;
    color: #1a73e8 !important;
}

/* Facebook Button - Official Blue (#1877F2) */
.btn-facebook {
    background-color: #1877f2 !important;
    border: 1px solid #1877f2 !important;
    color: #ffffff !important;
    box-shadow:
        0 4px 10px rgba(24, 119, 242, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.3) !important;
}

.btn-facebook:hover {
    background-color: #166fe5 !important;
    border-color: #166fe5 !important;
    box-shadow:
        0 10px 20px rgba(24, 119, 242, 0.6),
        0 0 20px rgba(24, 119, 242, 0.4) !important;
    color: #ffffff !important;
}

.social-wrapper {
    gap: 24px;
}

a.animate {
    box-shadow: inset 0 0 0 0 var(--royal-gold);
    font-weight: 600;
    color: var(--royal-gold);
    text-decoration: none !important;
    padding: 0 0.25rem;
    margin: 0 -0.25rem;
    border-radius: 0.5rem;
    transition:
        color 666ms ease-in-out,
        box-shadow 666ms ease-in-out;
}
a.animate:hover {
    color: var(--royal-bg) !important;
    box-shadow: inset 100em 0 0 0 var(--royal-gold);
    border-radius: 2px;
}

.highlight {
    box-shadow: inset 0 0 3px 3px var(--royal-gold) !important;
    background-color: rgba(var(--xq-metal-rgb), 0.4) !important;
    opacity: 1;
}
.highlight-red {
    box-shadow: inset 0 0 3px 3px #ff0000;
}
.highlight-black {
    box-shadow: inset 0 0 3px 3px #000;
}

.custom-control-input:checked ~ .custom-control-label::before,
.custom-control-input:active ~ .custom-control-label::before,
.custom-control-input:focus ~ .custom-control-label::before {
    background-color: var(--royal-red) !important;
    border-color: var(--royal-gold) !important;
    box-shadow: rgba(var(--xq-metal-rgb), 0.5) 0px 0px 0px 0.2rem;
}

/* ==========================================================================
   PUZZLE LAYOUT / XIANGQIBOARD / INTROJS OVERRIDES
   ========================================================================== */
.puzzle-layout-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    align-items: flex-start;
}
.puzzle-layout-board {
    flex: 1 1 520px;
    min-width: 320px;
    display: flex;
    flex-direction: column;
}
.puzzle-layout-panel {
    flex: 1 1 360px;
    min-width: 320px;
    padding: 15px;
    border-radius: 4px;
}

.board-1ef78 {
    box-sizing: content-box;
    pointer-events: none !important;
    margin: auto;
}
.board-1ef78 .row-cb702:first-of-type .square-2b8ce .notation-8c7a2 {
    top: -21px !important;
    bottom: auto !important;
}
.board-1ef78 .row-cb702:last-of-type .square-2b8ce .notation-8c7a2 {
    bottom: -21px !important;
    top: auto !important;
}
.xiangqiboard-8ddcb .spare-pieces-top-e4b47 {
    margin-bottom: 21px !important;
}
.xiangqiboard-8ddcb .spare-pieces-bottom-29dac {
    margin-top: 21px !important;
}
.square-2b8ce {
    float: left;
    position: relative;
    user-select: none;
    pointer-events: none !important;
}
.square-2b8ce img {
    pointer-events: all !important;
}
.square-2b8ce:hover {
    z-index: 2;
}
.square-2b8ce:hover img {
    cursor: pointer;
    filter: drop-shadow(0 0 5px rgba(var(--xq-metal-rgb), 0.8));
} /* Sáng lên khi di chuột */
.highlight1-e13fc,
.highlight2-e0a03 {
    box-shadow: inset 0 0 3px 3px var(--royal-gold);
    background: rgba(var(--xq-metal-rgb), 0.2);
}
.notation-8c7a2 {
    cursor: default;
    font-family: serif;
    font-size: 14px;
    position: absolute;
    color: #333;
    font-weight: 600;
}
.alpha-f4ef2 {
    bottom: 1px;
    right: 40%;
}
.numeric-fe76e {
    top: 40%;
    left: 1px;
}

.introjs-helperLayer {
    background-color: rgba(28, 17, 10, 0.9);
    border: 2px solid var(--royal-gold);
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}
.introjs-tooltip {
    color: var(--royal-gold-light);
    background-color: rgba(28, 17, 10, 0.95);
    font-family: serif;
}
.introjs-button {
    text-shadow: none;
    font-weight: 600;
    color: var(--royal-red);
    background: var(--royal-gold);
    border-radius: 2px;
}
.introjs-button:hover {
    background: var(--royal-red);
    color: var(--royal-gold) !important;
    border: 1px solid var(--royal-gold);
}
.introjs-progressbar {
    background-color: var(--royal-gold) !important;
}

/* Nút Cuộn Lên (Scroll Top) hoàng gia */
/* ==========================================================================
   LIQUID GLASS SCROLL-TO-TOP (.cd-top)
   ========================================================================== */
.cd-top {
    display: inline-block;
    height: 48px; /* Slightly larger for easier tapping */
    width: 48px;
    position: fixed;
    bottom: 20px;
    right: 20px;
    left: auto; /* Moved slightly off the exact edge for better breathing room */
    z-index: 1040;
    overflow: hidden;
    text-indent: 100%;
    white-space: nowrap;

    /* Background & Icon Setup */
    background: var(--glass-bg-dark) url(/img/cd-top-arrow.svg) no-repeat center
        50%;
    background-size: 20px;

    /* Liquid Glass Effects */
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-top: 2px solid rgba(var(--xq-rim-rgb), 0.6); /* Glossy top edge */
    border-radius: 50%; /* Floating circular button */

    /* Deep Shadow & Inner Wet Reflection */
    box-shadow:
        var(--liquid-shadow),
        inset 0 3px 10px var(--liquid-highlight);

    /* Initial Hidden State with Slide-Down Offset */
    visibility: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Liquid Sheen Reflection (matches your buttons) */
.cd-top::before {
    content: "";
    position: absolute;
    top: 0;
    left: -150%;
    width: 150%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transform: skewX(-20deg);
    transition: all 0.6s ease;
    z-index: -1;
}

/* Shown State */
.cd-top.cd-top--show {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Catchy Hover State - Glowing & Levitating */
.cd-top:hover,
.cd-top:focus {
    background-color: var(
        --glass-bg-red
    ); /* Shifts to royal red on interaction */
    border-color: var(--royal-gold);
    opacity: 1;
    transform: translateY(-6px) scale(1.1);

    /* Amplified Glow */
    box-shadow:
        0 15px 30px rgba(0, 0, 0, 0.9),
        0 0 20px rgba(var(--xq-metal-rgb), 0.6),
        inset 0 4px 15px var(--liquid-highlight),
        inset 0 -2px 10px rgba(0, 0, 0, 0.5);
}

.cd-top:hover::before {
    left: 150%; /* Triggers the light reflection swipe */
}

/* Waiting Indicator Dot */
body.player .waitingIndicator .indicator,
body.dashboard .waitingIndicator .indicator {
    background-color: var(--royal-gold);
}
.waitingIndicator {
    position: relative;
    display: inline;
}
.waitingIndicator .indicator {
    width: 6px;
    height: 6px;
    border-radius: 3px;
    display: inline-block;
    margin: 3px;
    opacity: 0;
}
.waitingIndicator .indicator:nth-child(1) {
    animation: fade 3s ease 0s infinite;
}
.waitingIndicator .indicator:nth-child(2) {
    animation: fade 3s ease 250ms infinite;
}
.waitingIndicator .indicator:nth-child(3) {
    animation: fade 3s ease 500ms infinite;
}

/* Responsive Media Queries */
@media (max-width: 991px) {
    #copy-url,
    #copy-url-red,
    #copy-url-black,
    #change-pass {
        width: 100% !important;
    }
    .btn.w-25 {
        width: 49% !important;
    }
    .btn.w-25.btn-success {
        width: 75% !important;
    }
    #ban-co {
        height: auto !important;
    }
    .puzzle-layout-panel,
    .puzzle-layout-board {
        width: 100%;
    }
}
@media screen and (max-width: 380px) {
    #ban-co {
        width: calc(100% - 15px) !important;
    }
}
@media (max-width: 413px) {
    .hero .hero-box,
    .hero #proverb {
        width: 100% !important;
    }
    .hero .hero-box .nav-tabs li {
        width: 100%;
    }
    .hero .hero-box .nav-tabs li a {
        text-align: center;
    }
}
@media screen and (min-width: 1400px) {
    .container {
        max-width: 1320px !important;
    }
}
.clearfix-5f3b5 {
    clear: both;
}
.board-1ef78 {
    box-sizing: content-box;
    pointer-events: none !important;
    margin: auto;
}
.board-1ef78 .row-cb702:first-of-type .square-2b8ce .notation-8c7a2 {
    top: -21px !important;
    bottom: auto !important;
}
.board-1ef78 .row-cb702:last-of-type .square-2b8ce .notation-8c7a2 {
    bottom: -21px !important;
    top: auto !important;
}
.xiangqiboard-8ddcb .spare-pieces-top-e4b47 {
    margin-bottom: 21px !important;
}
.xiangqiboard-8ddcb .spare-pieces-bottom-29dac {
    margin-top: 21px !important;
}
.square-2b8ce {
    float: left;
    position: relative;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    pointer-events: none !important;
}
.square-2b8ce img {
    pointer-events: all !important;
}
.square-2b8ce:hover {
    z-index: 2;
}
.square-2b8ce:hover img {
    cursor: pointer;
}
.highlight1-e13fc,
.highlight2-e0a03 {
    box-shadow: inset 0 0 3px 3px #daa520;
}
.notation-8c7a2 {
    cursor: default;
    font-family:
        "Plus Jakarta Sans", "Noto Sans JP", "Noto Sans KR", "Noto Sans SC",
        sans-serif;
    font-size: 14px;
    position: absolute;
    color: #000;
}
.alpha-f4ef2 {
    bottom: 1px;
    right: 40%;
}
.numeric-fe76e {
    top: 40%;
    left: 1px;
}
.piece-1e8b9 {
    cursor: pointer;
}
th[role="columnheader"]:not(.no-sort) {
    cursor: pointer;
}
th[role="columnheader"]:not(.no-sort):after {
    content: "";
    float: right;
    margin-top: 7px;
    border-width: 0 4px 4px;
    border-style: solid;
    border-color: #404040 transparent;
    visibility: hidden;
    opacity: 0;
    /* -ms-user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none; */
}
th[role="columnheader"]:not(.no-sort):hover:after {
    visibility: visible;
    opacity: 1;
}
th[aria-sort="ascending"]:not(.no-sort):after {
    border-bottom: none;
    border-width: 4px 4px 0;
}
th[aria-sort]:not(.no-sort):after {
    visibility: visible;
    opacity: 0.4;
}
table th.no-sort {
    cursor: default !important;
    pointer-events: none !important;
}
table th.no-sort::before,
table th.no-sort::after {
    display: none !important;
} /*# sourceMappingURL=index.css.map */

.puzzle-layout-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    align-items: flex-start;
}
.puzzle-layout-board {
    flex: 1 1 520px;
    min-width: 320px;
    display: flex;
    flex-direction: column;
}
.puzzle-layout-panel {
    flex: 1 1 360px;
    min-width: 320px;
}
@media (max-width: 991.98px) {
    .puzzle-layout-panel,
    .puzzle-layout-board {
        width: 100%;
    }
}

.puzzle-layout-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    align-items: flex-start;
}
.puzzle-layout-board {
    flex: 1 1 520px;
    min-width: 320px;
    display: flex;
    flex-direction: column;
}
.puzzle-layout-panel {
    flex: 1 1 360px;
    min-width: 320px;
}
@media (max-width: 991.98px) {
    .puzzle-layout-panel,
    .puzzle-layout-board {
        width: 100%;
    }
}
.custom-control-input:checked ~ .custom-control-label::before,
.custom-control-input:active ~ .custom-control-label::before,
.custom-control-input:focus ~ .custom-control-label::before {
    background-color: #f04124 !important;
    border-color: #f04124 !important;
    box-shadow: rgba(240, 65, 36, 0.25) 0px 0px 0px 0.2rem;
}
.comment-action.liked {
    color: #f87171;
    cursor: default;
}
.comment-action.liked i {
    color: #f87171;
}
.comment-action:not(.liked):hover {
    color: #f87171;
    cursor: pointer;
}
.comment-action:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
.fa-spinner {
    margin-left: 5px;
}
.disabled {
    opacity: 0.5;
    pointer-events: none;
}
.highlight {
    background-color: #ffeb3b !important;
    opacity: 0.6;
}
.st-count,
.st-text {
    color: var(--royal-gold-light) !important;
}

/* ==========================================================================
   LIQUID GLASS CARDS & PANELS
   ========================================================================== */
.card.shadow-lg,
#app .card,
.royal-grid-card {
    background: var(--glass-bg-dark) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border) !important;
    border-top: 1px solid rgba(var(--xq-rim-rgb), 0.5) !important; /* Stronger top border for lighting */
    border-radius: 12px;
    box-shadow:
        var(--liquid-shadow),
        inset 0 2px 15px var(--liquid-highlight) !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

.card.shadow-lg:hover,
#app .card:hover,
.royal-grid-card:hover {
    transform: translateY(-5px) scale(1.005);
    border-color: rgba(var(--xq-metal-rgb), 0.6) !important;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.9),
        0 0 25px rgba(var(--xq-metal-rgb), 0.3),
        inset 0 4px 20px var(--liquid-highlight) !important;
}

/* Glassy Card Headers */
.card-header {
    background: linear-gradient(
        90deg,
        transparent,
        var(--glass-bg-red),
        transparent
    ) !important;
    border-bottom: 1px solid rgba(var(--xq-rim-rgb), 0.2) !important;
    text-shadow: 0 0 10px rgba(var(--xq-rim-rgb), 0.5);
    color: var(--royal-gold-light) !important;
    backdrop-filter: blur(8px);
}

/* Update the Hero/Proverb Boxes to match */
.hero .hero-box,
#proverb {
    background: var(--glass-bg-dark);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow:
        var(--liquid-shadow),
        inset 0 2px 10px var(--liquid-highlight);
    border-radius: 12px;
}

.card #tourBtn {
    color: var(--royal-gold-light) !important;
}

.card > a:hover {
    color: transparent !important;
}

form label {
    font-weight: 600;
    color: var(--royal-gold);
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: var(--royal-red) !important;
    color: var(--royal-gold) !important;
}

/* ==========================================================================
   DROPDOWNS HOÀNG GIA (ROYAL DROPDOWNS)
   ========================================================================== */
/* Khung nền Dropdown */
.dropdown-menu {
    background-color: rgba(11, 12, 16, 0.95) !important; /* Đen mun bóng */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--royal-gold) !important;
    border-radius: 6px;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.8),
        0 0 15px rgba(var(--xq-metal-rgb), 0.2) !important;
    padding: 0.5rem 0;
    animation: fadeInMenu 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1050; /* Đảm bảo luôn đè lên các phần tử khác */
}

/* Hiệu ứng xuất hiện mượt mà */
@keyframes fadeInMenu {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================================================
   GLOSSY & CATCHY DROPDOWN ITEM HOVER
   ========================================================================== */
.dropdown-item {
    color: var(--royal-gold-light) !important;
    font-weight: 600;
    padding: 10px 20px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background-color: transparent !important;
    display: flex;
    align-items: center;
    border-top: 1px solid transparent; /* Prevents layout shift on hover */
    border-bottom: 1px solid transparent;
}

.dropdown-item:hover,
.dropdown-item:focus {
    /* Richer, dynamic translucent gradient */
    background: linear-gradient(
        90deg,
        rgba(var(--xq-crimson-rgb), 0.15),
        rgba(var(--xq-crimson-rgb), 0.75),
        rgba(var(--xq-crimson-rgb), 0.15)
    ) !important;

    /* Glossy liquid glass reflection and outer gold glow */
    box-shadow:
        inset 0 2px 8px var(--liquid-highlight),
        /* Wet top reflection */ inset 0 -2px 8px rgba(0, 0, 0, 0.4),
        /* Deep bottom shadow */ 0 4px 15px rgba(var(--xq-metal-rgb), 0.25) !important; /* Soft gold aura */

    /* Stronger blur for the frosted glass effect */
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);

    /* Catchy text illumination */
    color: var(--royal-gold) !important;
    text-shadow: 0 0 12px rgba(var(--xq-rim-rgb), 0.9);

    /* Emphasized movement (slides right and slightly scales up) */
    transform: translateX(8px) scale(1.02);

    /* Crisp glass edges */
    border-top: 1px solid rgba(var(--xq-rim-rgb), 0.4);
    border-bottom: 1px solid rgba(var(--xq-rim-rgb), 0.1);
}

.dropdown-item:hover i,
.dropdown-item:focus i {
    color: var(--royal-gold-light) !important;
    text-shadow: 0 0 15px rgba(var(--xq-rim-rgb), 1);
    transform: scale(1.15); /* Makes the icon pop more */
}

/* Trạng thái Đang chọn (Active/Clicked) */
.dropdown-item.active,
.dropdown-item:active {
    background: linear-gradient(
        to right,
        var(--royal-gold),
        #b89020
    ) !important;
    color: var(--royal-bg) !important; /* Chữ chuyển sang đen mun */
    font-weight: 600;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    transform: translateX(0); /* Reset trượt khi click */
}

.dropdown-item.active i,
.dropdown-item:active i {
    color: var(--royal-red-dark) !important;
}

/* Đường kẻ phân cách */
.dropdown-divider {
    border-top: 1px solid rgba(var(--xq-metal-rgb), 0.2) !important;
    margin: 0.5rem 0;
}

div.dataTables_wrapper div.dataTables_length label {
    padding-left: 1rem;
    padding-top: 1rem;
}

div.dataTables_wrapper div.dataTables_filter label {
    padding-right: 1rem;
    padding-top: 1rem;
}

.dataTables_info {
    padding-bottom: 1rem;
    padding-left: 1rem;
}
/* ==========================================================================
   TRẠNG THÁI BADGES (STATUS INDICATORS)
   ========================================================================== */
.badge-status {
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
}

.badge-status i {
    font-size: 0.6rem;
}

/* Online Badge - Glowing Royal Green */
.badge-online {
    background: linear-gradient(
        to bottom,
        rgba(45, 106, 79, 0.8),
        rgba(27, 67, 50, 0.8)
    );
    border: 1px solid #2d6a4f;
    color: var(--royal-gold-light);
    box-shadow: 0 0 10px rgba(45, 106, 79, 0.4);
}

.badge-online i {
    color: #4ade80; /* Bright green for the dot */
    text-shadow: 0 0 8px #4ade80;
}

/* Offline Badge - Dimmed Wood/Gold */
.badge-offline {
    background: rgba(28, 17, 10, 0.8);
    border: 1px solid var(--royal-wood);
    color: #aa8c4a;
}

.badge-offline i {
    color: var(--royal-wood);
}

/* ==========================================================================
   ROYAL WATCH & PREVIEW BUTTONS (Overrides for roomList)
   ========================================================================== */

/* 1. The Preview Button (Eye) - Solid Royal Gold */
.btn.previewBtn {
    background: linear-gradient(to bottom, var(--xq-metal), #b89020) !important;
    border: 1px solid #fff !important;
    color: var(--royal-bg) !important; /* Ebony text for high contrast */
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
    font-weight: 600;
    text-shadow: none;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn.previewBtn:hover {
    background: linear-gradient(
        to bottom,
        var(--xq-rim),
        var(--xq-metal)
    ) !important;
    border-color: var(--royal-gold) !important;
    box-shadow:
        0 6px 15px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(var(--xq-metal-rgb), 0.6);
    transform: translateY(-2px);
}

.btn.previewBtn i {
    color: var(--royal-bg) !important;
}

/* 2. Public Watch Button (Glass Gold) */
.btn.watch-btn.btn-light {
    background: rgba(
        var(--xq-metal-rgb),
        0.1
    ) !important; /* Glassmorphism tint */
    border: 1px solid var(--royal-gold) !important;
    color: var(--royal-gold) !important;
    box-shadow: inset 0 0 10px rgba(var(--xq-metal-rgb), 0.05);
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

/* 3. Private Watch Button or Hovered Public Watch (Solid Royal Wood) */
.btn.watch-btn.btn-warning {
    background: linear-gradient(
        145deg,
        #4a2511,
        #2a1910
    ) !important; /* Rosewood base */
    border: 1px solid var(--royal-gold) !important;
    color: var(--royal-gold-light) !important;
    box-shadow:
        2px 2px 8px rgba(0, 0, 0, 0.8),
        inset 0 0 5px rgba(var(--xq-metal-rgb), 0.2);
    transition: all 0.3s ease;
}

/* 4. Force override the text-color utility classes set in the controller */
.btn.watch-btn.text-warning {
    color: var(--royal-gold) !important;
}
.btn.watch-btn.text-light {
    color: var(--royal-gold-light) !important;
}

.btn.watch-btn i {
    transition: transform 0.3s ease;
}

/* 5. Hover state for Watch buttons - Levitate and Glow */
.btn.watch-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.8),
        0 0 12px rgba(var(--xq-metal-rgb), 0.4) !important;
    border-color: #fff !important;
}

.btn.watch-btn:hover i {
    transform: scale(1.1);
}

/* ==========================================================================
   ROYAL MODALS (CUNG ĐÌNH HUẾ THEME OVERRIDES)
   ========================================================================== */

/* 1. Modal Backdrop - Deep ebony with a subtle blur */
.modal-backdrop.show {
    opacity: 0.85 !important;
    background-color: var(--royal-bg) !important;
    backdrop-filter: blur(4px);
}

/* 2. Modal Content - The Royal Panel (Glassmorphism & Gold Borders) */
.modal-content {
    background: linear-gradient(
        145deg,
        rgba(20, 22, 28, 0.98),
        rgba(11, 12, 16, 0.98)
    ) !important;
    backdrop-filter: blur(12px);
    border: 2px solid var(--royal-gold) !important;
    border-radius: 8px;
    box-shadow:
        0 15px 50px rgba(0, 0, 0, 0.9),
        0 0 20px rgba(var(--xq-metal-rgb), 0.15) !important;
    color: var(--royal-gold-light);
    overflow: hidden; /* Ensures headers/footers respect border-radius */
}

/* 3. Modal Header - Royal Red Banner */
.modal-header {
    background: linear-gradient(
        90deg,
        var(--xq-crimson),
        #5c0a0a
    ) !important; /* Royal red gradient */
    border-bottom: 2px solid var(--royal-gold) !important;
    padding: 16px 24px;
    display: flex;
    align-items: center;
}

/* 4. Modal Title - Texturina Font & Glowing Gold */
.modal-title {
    font-family: "Texturina", serif !important;
    color: var(--royal-gold) !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1.25rem;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    margin: 0;
}

/* Modal Close Button ("X") inside Header */
.modal-header .close {
    color: var(--royal-gold-light) !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    opacity: 0.8;
    transition: all 0.3s ease;
}

.modal-header .close:hover {
    color: var(--royal-gold) !important;
    opacity: 1;
    transform: scale(1.1); /* Playful majestic spin on hover */
}

/* 5. Modal Body - Content Area */
.modal-body {
    background-color: transparent !important;
    color: var(--royal-gold-light);
    padding: 24px;
    font-family: "Plus Jakarta Sans", sans-serif !important;
}

/* 6. Modal Footer - Subtle Divider */
.modal-footer {
    border-top: 1px solid rgba(var(--xq-metal-rgb), 0.3) !important; /* Faded gold line */
    background-color: transparent !important;
    padding: 16px 24px;
}

/* Modal Dialog adjustments for smooth scaling */
.modal.fade .modal-dialog {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: scale(0.9);
}

.modal.show .modal-dialog {
    transform: scale(1);
}

/* ==========================================================================
   DATATABLES ROYAL PROCESSING INDICATOR
   ========================================================================== */
div.dataTables_wrapper div.dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 260px;
    margin-left: -130px;
    margin-top: -30px;
    text-align: center;
    padding: 16px 0;

    /* Royal Glassmorphism Background */
    background: linear-gradient(
        145deg,
        rgba(20, 22, 28, 0.98),
        rgba(11, 12, 16, 0.98)
    ) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    /* Gold Trim & Shape */
    border: 2px solid var(--royal-gold) !important;
    border-radius: 8px;

    /* Deep Shadow & Inner Glow */
    box-shadow:
        0 15px 50px rgba(0, 0, 0, 0.9),
        0 0 20px rgba(var(--xq-metal-rgb), 0.15) !important;

    /* Royal Typography */
    color: var(--royal-gold) !important;
    font-family: "Texturina", serif !important;
    font-weight: 600;
    font-size: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);

    /* Golden Aura Animation */
    animation: pulse-gold 1.5s infinite cubic-bezier(0.66, 0, 0, 1);
    z-index: 1050; /* Keep above table elements */
}

/*
   Royal Waiting Indicator Dots (Optional)
   Matches the theme's custom fade animation for loading states
*/
div.dataTables_wrapper div.dataTables_processing .indicator {
    width: 6px;
    height: 6px;
    background-color: var(--royal-gold);
    border-radius: 3px;
    display: inline-block;
    margin: 3px;
    opacity: 0;
}
div.dataTables_wrapper div.dataTables_processing .indicator:nth-child(1) {
    animation: fade 1.5s ease 0s infinite;
}
div.dataTables_wrapper div.dataTables_processing .indicator:nth-child(2) {
    animation: fade 1.5s ease 250ms infinite;
}
div.dataTables_wrapper div.dataTables_processing .indicator:nth-child(3) {
    animation: fade 1.5s ease 500ms infinite;
}

.puzzle-reaction-btn {
    text-decoration: none !important;
}

/* ==========================================================================
   ROYAL GRID CARDS (Kỳ Thủ, Thế Cờ, Ván Đấu)
   ========================================================================== */
.royal-grid-card {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.6),
        inset 0 0 15px rgba(var(--xq-rim-rgb), 0.05);
}

.royal-grid-card:hover {
    transform: translateY(-5px) scale(1.005);
    border-color: rgba(var(--xq-metal-rgb), 0.6) !important;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.9),
        0 0 20px rgba(var(--xq-metal-rgb), 0.3) !important;
}

.royal-card-title {
    font-family: "Texturina", serif;
    color: var(--royal-gold);
    text-transform: uppercase;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
    font-weight: 600;
}

.royal-card-title:hover {
    color: var(--royal-gold-light);
}

.royal-vs-text {
    font-family: "Texturina", serif;
    color: var(--royal-red-light);
    font-size: 1.2rem;
    font-style: italic;
    text-shadow: 0 0 8px rgba(230, 57, 70, 0.5);
}

/* Elegant Board Wrapper replacing the ugly #e1bd86 hardcoded colors */
.royal-board-wrapper {
    background: linear-gradient(145deg, #2a1910, #0b0c10) !important;
    border-bottom: 2px solid var(--royal-gold);
    padding: 15px;
}

.royal-board-wrapper .xiangqiboard-8ddcb {
    background: transparent !important;
    margin: auto !important;
}

.royal-board-wrapper .xiangqiboard-8ddcb .board-1ef78 {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.8) !important;
    border-radius: 4px;
}

/* ==========================================================================
   LIQUID DROPDOWNS HOÀNG GIA
   ========================================================================== */
.dropdown-menu {
    background: var(--glass-bg-dark) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border) !important;
    border-top: 2px solid rgba(var(--xq-rim-rgb), 0.6) !important;
    border-radius: 12px;
    box-shadow:
        0 15px 40px rgba(0, 0, 0, 0.9),
        inset 0 2px 10px var(--liquid-highlight) !important;
    padding: 0.5rem 0;
    animation: fadeInMenu 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dropdown-item {
    color: var(--royal-gold-light) !important;
    font-weight: 600;
    padding: 12px 24px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background-color: transparent !important;
    position: relative;
    overflow: hidden;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: linear-gradient(
        90deg,
        rgba(var(--xq-crimson-rgb), 0.2),
        rgba(var(--xq-crimson-rgb), 0.8),
        rgba(var(--xq-crimson-rgb), 0.2)
    ) !important;
    color: var(--royal-gold) !important;
    text-shadow: 0 0 12px rgba(var(--xq-rim-rgb), 0.9);
    box-shadow:
        inset 0 2px 8px var(--liquid-highlight),
        inset 0 -2px 8px rgba(0, 0, 0, 0.5);
    transform: translateX(10px) scale(1.02);
    border-left: 3px solid var(--royal-gold);
}

/* Modal Content Adjustment */
.modal-content {
    background: var(--glass-bg-dark) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border) !important;
    border-top: 2px solid rgba(var(--xq-rim-rgb), 0.5) !important;
    border-radius: 12px;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.9),
        inset 0 3px 15px var(--liquid-highlight) !important;
}

.modal-header {
    background: linear-gradient(
        90deg,
        rgba(var(--xq-crimson-rgb), 0.5),
        rgba(92, 10, 10, 0.3)
    ) !important;
    border-bottom: 1px solid var(--glass-border) !important;
}

/* ==========================================================================
    LIQUID GLASS MATCH STATUS
========================================================================== */
#match-status {
    /* Liquid Glass Background */
    background: var(--glass-bg-dark) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);

    /* Royal Borders with Glossy Top Lighting */
    border: 1px solid var(--glass-border) !important;
    border-top: 2px solid rgba(var(--xq-rim-rgb), 0.5) !important;
    border-radius: 8px;

    /* Deep Shadows & Inner Wet Reflection[cite: 1] */
    box-shadow:
        var(--liquid-shadow),
        inset 0 3px 15px var(--liquid-highlight) !important;

    /* Royal Typography[cite: 1] */
    font-family: "Texturina", serif;
    color: var(--royal-gold) !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(var(--xq-rim-rgb), 0.5);

    /* Layout & Smooth Animation[cite: 1] */
    padding: 12px 24px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Auto-hide the glossy box when the script hasn't injected any text */
#match-status:empty {
    display: none !important;
    padding: 0;
    border: none !important;
}

.fa,
.fab,
.fad,
.fal,
.far,
.fas {
    margin-right: 0.2rem !important;
}

/* Visual Bracket Styles (Liquid Glass & Royal Theme) */
.bracket-container {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    padding: 20px 0;
    gap: 30px;
}
.bracket-round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    min-width: 280px;
    gap: 25px;
}

/* Liquid Glass Match Card */
.match-card {
    background: var(--glass-bg-dark) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border) !important;
    border-top: 2px solid rgba(var(--xq-rim-rgb), 0.5) !important;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow:
        var(--liquid-shadow),
        inset 0 3px 15px var(--liquid-highlight) !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Catchy Hover Animation */
.match-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: rgba(var(--xq-metal-rgb), 0.6) !important;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.9),
        0 0 25px rgba(var(--xq-metal-rgb), 0.3),
        inset 0 4px 20px var(--liquid-highlight) !important;
}

.match-player {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(var(--xq-rim-rgb), 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--royal-gold-light);
    transition: background-color 0.3s ease;
}

.match-player:hover {
    background-color: rgba(var(--xq-rim-rgb), 0.05) !important;
    box-shadow: inset 0 0 15px rgba(var(--xq-rim-rgb), 0.1);
}

.match-player:last-child {
    border-bottom: none;
}

/* Red Player styling */
.match-player.red-side {
    color: #ff3333;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.3);
}

/* Black Player styling (Updated for dark glass background) */
.match-player.black-side {
    color: var(--royal-gold-light);
}

/* Winner Highlight */
.match-winner {
    background: rgba(var(--xq-metal-rgb), 0.2) !important;
    box-shadow: inset 0 0 3px 3px var(--royal-gold);
    color: var(--royal-gold) !important;
    text-shadow: 0 0 8px rgba(var(--xq-rim-rgb), 0.5);
}

/* Glossy Action Button */
.bracket-room-link {
    display: block;
    text-align: center;
    background: linear-gradient(
        90deg,
        rgba(var(--xq-crimson-rgb), 0.5),
        rgba(92, 10, 10, 0.3)
    ) !important;
    padding: 12px;
    font-size: 0.85rem;
    text-decoration: none !important;
    color: var(--royal-gold) !important;
    text-transform: uppercase;
    font-family: "Texturina", serif;
    letter-spacing: 1px;
    border-top: 1px solid rgba(var(--xq-rim-rgb), 0.2);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bracket-room-link:hover {
    background: linear-gradient(
        90deg,
        rgba(var(--xq-crimson-rgb), 0.75),
        rgba(var(--xq-crimson-rgb), 0.15)
    ) !important;
    color: #fff !important;
    text-shadow: 0 0 12px rgba(var(--xq-rim-rgb), 0.9);
    box-shadow:
        inset 0 2px 8px var(--liquid-highlight),
        inset 0 -2px 8px rgba(0, 0, 0, 0.4);
}

#tourBtn {
    display: none !important;
}

.scrollable-menu {
    height: auto;
    /* Set maximum height relative to viewport height (e.g., 75% of the screen) */
    max-height: calc(-100px + 100vh);
    /* Enable vertical scrolling if content overflows */
    overflow-y: auto;
    overflow-x: hidden;
}

@media (max-width: 1280px) {
    .scrollable-menu {
        max-height: 100%;
    }
}

/* ==========================================================================
   DATATABLES RESPONSIVE (.dtr-control) LIQUID GLASS OVERRIDE
   ========================================================================== */

/* 1. Base Styling for the Control Element (The Plus Icon / Collapsed State) */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control::before {
    content: "+" !important;
    background: var(--glass-bg-dark) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 2px solid var(--royal-gold) !important;
    border-radius: 50% !important; /* Perfect circle */
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.8),
        inset 0 2px 5px var(--liquid-highlight) !important;
    color: var(--royal-gold) !important;

    /* ALIGNMENT FIXES */
    font-family:
        "Courier New", monospace !important; /* Monospace guarantees geometric centering for +/- */
    font-size: 18px !important;
    font-weight: bold !important;
    display: inline-flex !important;
    align-items: center !important; /* Vertically centers the flex content */
    justify-content: center !important; /* Horizontally centers the flex content */
    line-height: 0 !important; /* Removes invisible text baselines that push icons off-center */
    padding: 0 !important; /* Resets any rogue padding */

    height: 22px !important;
    width: 22px !important;
    margin-right: 12px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

/* 2. Hover State - Liquid Gold Sheen (Levitates & Spins) */
table.dataTable.dtr-inline.collapsed
    > tbody
    > tr
    > td.dtr-control:hover::before,
table.dataTable.dtr-inline.collapsed
    > tbody
    > tr
    > th.dtr-control:hover::before {
    background: linear-gradient(to bottom, var(--xq-metal), #b89020) !important;
    color: var(--royal-bg) !important;
    border-color: #fff !important;
    box-shadow:
        0 6px 15px rgba(0, 0, 0, 0.9),
        0 0 15px rgba(var(--xq-metal-rgb), 0.6),
        inset 0 2px 10px var(--liquid-highlight) !important;
    transform: scale(1.15) rotate(90deg) !important;
}

/* 3. Expanded State (The Minus Icon) - Ruby Red Glass */
table.dataTable.dtr-inline.collapsed
    > tbody
    > tr.parent
    > td.dtr-control::before,
table.dataTable.dtr-inline.collapsed
    > tbody
    > tr.parent
    > th.dtr-control::before {
    content: "-" !important;
    background: var(--glass-bg-red) !important;
    border-color: var(--royal-gold) !important;
    color: var(--royal-gold-light) !important;

    /* OPTICAL ALIGNMENT FOR MINUS */
    padding-bottom: 2px !important; /* The minus sign often needs a slight optical nudge upwards */

    box-shadow:
        var(--liquid-shadow),
        inset 0 2px 8px rgba(var(--xq-rim-rgb), 0.2) !important;
}

/* 4. Expanded Hover State (Levitates & Spins) */
table.dataTable.dtr-inline.collapsed
    > tbody
    > tr.parent
    > td.dtr-control:hover::before,
table.dataTable.dtr-inline.collapsed
    > tbody
    > tr.parent
    > th.dtr-control:hover::before {
    background: rgba(183, 34, 34, 0.8) !important;
    border-color: #fff !important;
    box-shadow:
        0 0 15px rgba(var(--xq-metal-rgb), 0.5),
        inset 0 2px 10px rgba(var(--xq-rim-rgb), 0.4) !important;
    transform: scale(1.15) rotate(180deg) !important;
}

/* ==========================================================================
   MOBILE OPTIMIZATIONS (MÀN HÌNH NHỎ HƠN 500PX)
   ========================================================================== */
@media (max-width: 768px) {
    table.dataTable tbody li.room-action .dtr-title {
        display: none !important;
    }

    table.dataTable .dtr-details {
        padding: 8px 12px !important;
        width: 100% !important;
    }
}

/* Khung bao quanh Bàn cờ */
#ban-co {
    background-color: #252a36;
    border-radius: 8px;
    padding: 5px;
    margin-bottom: 15px;
}

/* Tùy chỉnh Alerts cho Dark Theme */
.alert {
    border-radius: 8px;
    border: none;
    backdrop-filter: blur(5px);
    margin-top: 15px;
}
.alert-success {
    background-color: rgba(46, 125, 50, 0.6);
    color: #81c784;
    border-left: 4px solid #4caf50;
}
.alert-warning {
    background-color: rgba(245, 124, 0, 0.6);
    color: #ffb74d;
    border-left: 4px solid #ff9800;
}

/* ==========================================================================
   TIN TỨC / ARTICLES — LIQUID GLASS ROYAL EDITORIAL THEME
   ========================================================================== */

/* --- Hero / Search Banner --- */
.article-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(
        135deg,
        var(--glass-bg-red),
        var(--glass-bg-dark) 70%
    );
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-top: 2px solid rgba(var(--xq-rim-rgb), 0.5);
    border-radius: 18px;
    padding: 2.25rem 2rem;
    box-shadow:
        var(--liquid-shadow),
        inset 0 2px 15px var(--liquid-highlight);
}

.article-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at top right,
        rgba(var(--xq-rim-rgb), 0.15),
        transparent 55%
    );
    pointer-events: none;
}

.article-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--royal-gold);
    text-shadow: 0 0 10px rgba(var(--xq-rim-rgb), 0.4);
}

.article-hero-title {
    margin: 0.35rem 0 0 !important;
}

.article-hero-subtitle {
    font-family: "Plus Jakarta Sans", sans-serif !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    color: var(--royal-gold-light) !important;
    opacity: 0.75;
    -webkit-text-fill-color: initial;
    text-shadow: none;
    margin-bottom: 0;
}

/* --- Search Form --- */
.article-search .form-control {
    background: rgba(11, 12, 16, 0.55) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--royal-gold-light) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    height: 100%;
}

.article-search .form-control::placeholder {
    color: rgba(255, 242, 204, 0.45);
}

.article-search .form-control:focus {
    border-color: var(--royal-gold) !important;
    box-shadow: 0 0 0 0.25rem rgba(var(--xq-metal-rgb), 0.25) !important;
}

/* --- Glossy Royal Buttons (generic, reused across article views) --- */
.btn-royal {
    background: linear-gradient(135deg, var(--royal-red), #5c0a0a) !important;
    border: 1px solid var(--royal-gold) !important;
    color: var(--royal-gold-light) !important;
    box-shadow:
        var(--liquid-shadow),
        inset 0 2px 8px rgba(var(--xq-rim-rgb), 0.15) !important;
}

.btn-royal:hover {
    color: #fff !important;
    background: linear-gradient(
        135deg,
        var(--royal-red-light),
        var(--royal-red)
    ) !important;
    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.8),
        0 0 15px rgba(var(--xq-metal-rgb), 0.4),
        inset 0 2px 10px rgba(255, 255, 255, 0.3) !important;
}

.btn-royal-outline {
    background: var(--glass-bg-dark) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--royal-gold-light) !important;
    box-shadow:
        var(--liquid-shadow),
        inset 0 2px 5px var(--liquid-highlight) !important;
}

.btn-royal-outline:hover {
    color: var(--royal-gold) !important;
    border-color: var(--royal-gold) !important;
    background: rgba(37, 42, 54, 0.6) !important;
    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.8),
        0 0 15px rgba(var(--xq-metal-rgb), 0.3),
        inset 0 2px 10px rgba(255, 255, 255, 0.3) !important;
}

/* --- Article Grid Card --- */
.article-card {
    background: var(--glass-bg-dark) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border) !important;
    border-radius: 14px;
    overflow: hidden;
    box-shadow:
        var(--liquid-shadow),
        inset 0 2px 15px var(--liquid-highlight) !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.article-card:hover {
    transform: translateY(-6px) scale(1.015);
    border-color: rgba(var(--xq-metal-rgb), 0.6) !important;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.9),
        0 0 25px rgba(var(--xq-metal-rgb), 0.3),
        inset 0 4px 20px var(--liquid-highlight) !important;
}

.article-card-band {
    height: 5px;
    background: linear-gradient(
        90deg,
        var(--royal-red),
        var(--royal-gold),
        var(--royal-red)
    );
    background-size: 200% 100%;
    animation: gradientBG 6s ease infinite;
}

.article-card-title {
    font-size: 1.05rem !important;
    line-height: 1.4;
}

.article-card-title a {
    color: var(--royal-gold-light) !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    transition:
        color 0.3s ease,
        text-shadow 0.3s ease;
}

.article-card-title a:hover {
    color: var(--royal-gold) !important;
    text-shadow: 0 0 10px rgba(var(--xq-rim-rgb), 0.6);
}

.article-card-excerpt {
    font-family: "Plus Jakarta Sans", sans-serif !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    color: rgba(255, 242, 204, 0.6) !important;
    text-shadow: none;
    font-size: 0.9rem;
}

.article-card-footer {
    background: linear-gradient(
        90deg,
        transparent,
        var(--glass-bg-red),
        transparent
    ) !important;
    border-top: 1px solid rgba(var(--xq-rim-rgb), 0.2) !important;
    backdrop-filter: blur(8px);
}

.article-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(var(--xq-rim-rgb), 0.08);
    border: 1px solid rgba(var(--xq-rim-rgb), 0.2);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--royal-gold-light);
}

/* --- Empty State --- */
.article-empty {
    background: var(--glass-bg-dark) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px dashed var(--glass-border) !important;
    border-radius: 16px;
    color: var(--royal-gold-light) !important;
}

.article-empty svg {
    color: var(--royal-gold) !important;
    opacity: 0.6;
    filter: drop-shadow(0 0 10px rgba(var(--xq-rim-rgb), 0.3));
}

/* --- Article Detail --- */
.article-detail-card {
    background: var(--glass-bg-dark) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border) !important;
    border-top: 2px solid rgba(var(--xq-rim-rgb), 0.5) !important;
    border-radius: 18px;
    box-shadow:
        var(--liquid-shadow),
        inset 0 2px 20px var(--liquid-highlight) !important;
    position: relative;
    overflow: hidden;
}

.article-detail-title {
    line-height: 1.35;
}

.article-detail-meta {
    border-bottom: 1px solid rgba(var(--xq-rim-rgb), 0.15) !important;
}

/* Long-form content injected via {!! $article->content !!} */
.article-body {
    color: rgba(255, 242, 204, 0.85);
}

.article-body :is(h1, h2, h3, h4, h5, h6) {
    letter-spacing: 0.5px;
    margin-top: 1.75rem;
}

.article-body p {
    color: rgba(255, 242, 204, 0.85);
    margin-bottom: 1.1rem;
}

.article-body a {
    color: var(--royal-gold);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}

.article-body a:hover {
    color: #fff;
    text-shadow: 0 0 8px rgba(var(--xq-rim-rgb), 0.7);
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--liquid-shadow);
    margin: 1rem 0;
}

.article-body blockquote {
    border-left: 4px solid var(--royal-gold);
    background: rgba(var(--xq-rim-rgb), 0.05);
    padding: 1rem 1.5rem;
    border-radius: 0 8px 8px 0;
    color: var(--royal-gold-light);
    font-style: italic;
}

.article-body ul,
.article-body ol {
    color: rgba(255, 242, 204, 0.85);
    padding-left: 1.5rem;
}

.article-body hr {
    border-color: rgba(var(--xq-rim-rgb), 0.2);
    margin: 2rem 0;
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
}

.article-body table th,
.article-body table td {
    border: 1px solid rgba(var(--xq-rim-rgb), 0.2);
    padding: 0.5rem 0.75rem;
}

/* ==========================================================================
   GEMS TIER DECORATIONS (LIQUID GLASS + CUNG ĐÌNH HUẾ GLOSSY GLOW)
   Colors mirror App\Support\GemsTier::color()/frameGlow() so the animated
   glow always matches the static inline styles UserPresenter renders.
   ========================================================================== */

.gems-decoration {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform-origin: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gems-decoration:hover {
    transform: scale(1.25);
}

.avatar-frame {
    position: relative;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.avatar-frame:hover {
    transform: translateY(-2px) scale(1.04);
}

/* --- Bronze: faintest breathing glow --- */
.gems-decoration--bronze i {
    animation: gemsIconGlowBronze 3.4s ease-in-out infinite;
}
.avatar-frame--bronze {
    animation: avatarGlowBronze 3.4s ease-in-out infinite;
}
@keyframes gemsIconGlowBronze {
    0%,
    100% {
        filter: drop-shadow(0 0 2px rgba(168, 118, 62, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 5px rgba(168, 118, 62, 0.85));
    }
}
@keyframes avatarGlowBronze {
    0%,
    100% {
        box-shadow: 0 0 3px rgba(168, 118, 62, 0.45);
    }
    50% {
        box-shadow: 0 0 7px rgba(168, 118, 62, 0.75);
    }
}

/* --- Silver: faint, slightly brighter than Bronze --- */
.gems-decoration--silver i {
    animation: gemsIconGlowSilver 3.1s ease-in-out infinite;
}
.avatar-frame--silver {
    animation: avatarGlowSilver 3.1s ease-in-out infinite;
}
@keyframes gemsIconGlowSilver {
    0%,
    100% {
        filter: drop-shadow(0 0 2px rgba(154, 164, 173, 0.55));
    }
    50% {
        filter: drop-shadow(0 0 6px rgba(154, 164, 173, 0.9));
    }
}
@keyframes avatarGlowSilver {
    0%,
    100% {
        box-shadow: 0 0 4px rgba(154, 164, 173, 0.5);
    }
    50% {
        box-shadow: 0 0 9px rgba(154, 164, 173, 0.8);
    }
}

/* --- Gold: noticeably richer, matches the site's royal-gold glow --- */
.gems-decoration--gold i {
    animation: gemsIconGlowGold 2.6s ease-in-out infinite;
}
.avatar-frame--gold {
    animation: avatarGlowGold 2.6s ease-in-out infinite;
}
@keyframes gemsIconGlowGold {
    0%,
    100% {
        filter: drop-shadow(0 0 3px rgba(230, 184, 0, 0.65));
    }
    50% {
        filter: drop-shadow(0 0 9px rgba(var(--xq-rim-rgb), 0.95));
    }
}
@keyframes avatarGlowGold {
    0%,
    100% {
        box-shadow: 0 0 6px rgba(230, 184, 0, 0.6);
    }
    50% {
        box-shadow: 0 0 16px rgba(var(--xq-rim-rgb), 0.95);
    }
}

/* --- Platinum: cool icy pulse, a touch faster than Gold --- */
.gems-decoration--platinum i {
    animation: gemsIconGlowPlatinum 2.3s ease-in-out infinite;
}
.avatar-frame--platinum {
    animation: avatarGlowPlatinum 2.3s ease-in-out infinite;
}
@keyframes gemsIconGlowPlatinum {
    0%,
    100% {
        filter: drop-shadow(0 0 3px rgba(91, 192, 222, 0.75));
    }
    50% {
        filter: drop-shadow(0 0 10px rgba(91, 192, 222, 1));
    }
}
@keyframes avatarGlowPlatinum {
    0%,
    100% {
        box-shadow: 0 0 8px rgba(91, 192, 222, 0.7);
    }
    50% {
        box-shadow: 0 0 20px rgba(91, 192, 222, 1);
    }
}

/* --- Diamond: strong pulse + a slow rotating shimmer ring --- */
.gems-decoration--diamond i {
    animation: gemsIconGlowDiamond 2s ease-in-out infinite;
}
.avatar-frame--diamond {
    animation: avatarGlowDiamond 2s ease-in-out infinite;
}
@keyframes gemsIconGlowDiamond {
    0%,
    100% {
        filter: drop-shadow(0 0 4px rgba(123, 63, 228, 0.85));
    }
    50% {
        filter: drop-shadow(0 0 12px rgba(181, 123, 255, 1));
    }
}
@keyframes avatarGlowDiamond {
    0%,
    100% {
        box-shadow: 0 0 10px rgba(123, 63, 228, 0.8);
    }
    50% {
        box-shadow: 0 0 24px rgba(181, 123, 255, 1);
    }
}
.avatar-frame--diamond::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    background: conic-gradient(
        from 0deg,
        transparent,
        rgba(255, 255, 255, 0.75),
        transparent 35%
    );
    /* animation: gemsShimmerSpin 3s linear infinite; */
    pointer-events: none;
    z-index: -1;
}

/* --- Legendary: fastest pulse, rotating royal-red/gold shimmer, subtle pop --- */
.gems-decoration--legendary i {
    animation: gemsIconGlowLegendary 1.7s ease-in-out infinite;
}
.avatar-frame--legendary {
    animation:
        avatarGlowLegendary 1.7s ease-in-out infinite,
        avatarPopLegendary 4s ease-in-out infinite;
}
@keyframes gemsIconGlowLegendary {
    0%,
    100% {
        filter: drop-shadow(0 0 5px rgba(255, 77, 79, 0.9));
    }
    50% {
        filter: drop-shadow(0 0 14px rgba(255, 179, 71, 1));
    }
}
@keyframes avatarGlowLegendary {
    0%,
    100% {
        box-shadow: 0 0 14px rgba(255, 77, 79, 0.85);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 179, 71, 1);
    }
}
@keyframes avatarPopLegendary {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.045);
    }
}
.avatar-frame--legendary::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    background: conic-gradient(
        from 0deg,
        var(--royal-red),
        var(--royal-gold),
        var(--royal-red-light),
        var(--royal-gold),
        var(--royal-red)
    );
    /* animation: gemsShimmerSpin 2.4s linear infinite; */
    pointer-events: none;
    filter: blur(2px);
    opacity: 0.65;
    z-index: -1;
}

@keyframes gemsShimmerSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Respect users who've asked the OS/browser to reduce motion */
@media (prefers-reduced-motion: reduce) {
    .gems-decoration,
    .gems-decoration i,
    .avatar-frame,
    .avatar-frame--bronze,
    .avatar-frame--silver,
    .avatar-frame--gold,
    .avatar-frame--platinum,
    .avatar-frame--diamond,
    .avatar-frame--legendary {
        animation: none !important;
    }
    .avatar-frame--diamond::before,
    .avatar-frame--legendary::before {
        animation: none !important;
        opacity: 0.35;
    }
}

/* Companion styles for App\Support\GemsTier::frameCssClass().
   The inline style sets the base gradient; these add motion. */

@property --gems-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

/* Gold + Platinum: slow metallic shimmer sweep.
   !important because the inline `background` shorthand resets background-size. */
.avatar-frame--gold,
.avatar-frame--platinum {
    background-size: 250% 250% !important;
    animation: gems-shimmer 4s ease-in-out infinite;
}
.avatar-frame--platinum {
    animation-duration: 3s;
}

@keyframes gems-shimmer {
    0%,
    100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Diamond: facets shift while the glow breathes like a sparkle. */
.avatar-frame--diamond {
    background-size: 300% 300% !important;
    animation:
        gems-facet 3.5s linear infinite,
        gems-sparkle 1.8s ease-in-out infinite;
}

@keyframes gems-facet {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 300% 300%;
    }
}
@keyframes gems-sparkle {
    0%,
    100% {
        filter: brightness(1) saturate(1);
    }
    50% {
        filter: brightness(1.25) saturate(1.3);
    }
}

/* Legendary: fire ring spins, aura pulses. */
.avatar-frame--legendary {
    animation:
        gems-spin 3s linear infinite,
        gems-aura 1.6s ease-in-out infinite;
}

@keyframes gems-spin {
    to {
        --gems-angle: 360deg;
    }
}
@keyframes gems-aura {
    0%,
    100% {
        filter: drop-shadow(0 0 2px rgba(255, 61, 46, 0.6));
    }
    50% {
        filter: drop-shadow(0 0 7px rgba(255, 145, 0, 0.95));
    }
}

@media (prefers-reduced-motion: reduce) {
    .avatar-frame--gold,
    .avatar-frame--platinum,
    .avatar-frame--diamond,
    .avatar-frame--legendary {
        animation: none;
    }
}

/* ==========================================================================
   MODAL LAYERING FIX
   Stack order: header (1050) < backdrop (1060) < modal (1070) < tooltips (1080).
   Previously the footer (z-index 123456789) and .cd-top (9999) outranked the
   modal, and ancestor stacking contexts (isolation: isolate on
   .container-fluid.game etc.) could trap it beneath the backdrop.
   ========================================================================== */
.modal-backdrop {
    z-index: 1060 !important;
}
.modal {
    z-index: 1070 !important;
}
.tooltip {
    z-index: 1080;
}

/* ==========================================================================
   Cookie consent bar
   The markup lives in resources/views/vendor/cookie-consent. It used to rely on
   Tailwind-style utility classes (fixed, bottom-0, hidden, md:inline) that this
   Bootstrap 4 stylesheet never defined, so it was never actually a fixed bar.
   Sits below the header (1050), modal backdrop (1060) and modals (1070).
   ========================================================================== */
.cookie-consent {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999999999 !important;
    padding: 0.75rem 0;
    background: rgba(11, 12, 16, 0.97);
    border-top: 1px solid rgba(var(--xq-metal-rgb), 0.35);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.45);
    color: #f1f1f1;
}
.cookie-consent__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
}
.cookie-consent__message {
    flex: 1 1 320px;
    font-size: 0.9rem;
    line-height: 1.45;
    text-align: left;
}
.cookie-consent__link {
    color: var(--royal-gold-light);
    text-decoration: underline;
    white-space: nowrap;
}
.cookie-consent__link:hover,
.cookie-consent__link:focus {
    color: var(--royal-gold);
}
.cookie-consent__actions {
    display: flex;
    flex: 0 0 auto;
    gap: 0.5rem;
}
/* Accept and Reject get the same size and weight on purpose. */
.cookie-consent__actions .btn {
    min-width: 7.5rem;
    min-height: 2.5rem;
    font-weight: 700;
}
@media (max-width: 575.98px) {
    .cookie-consent__actions {
        flex: 1 1 100%;
    }
    .cookie-consent__actions .btn {
        flex: 1 1 0;
        min-width: 0;
    }
}

/* ==========================================================================
   Grouped dropdown menu headings (Thi đấu menu in the site header)
   ========================================================================== */
header.site-header .dropdown-menu .dropdown-header {
    padding-top: 0.5rem;
    color: var(--royal-gold);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.85;
}
header.site-header .dropdown-menu .dropdown-divider {
    border-top-color: rgba(var(--xq-metal-rgb), 0.2);
}

/* ==========================================================================
   PVP ROOM UX (scoreboard, turn banner, last move, invite toggle)
   ========================================================================== */
.pvp-scoreboard {
    max-width: 650px;
    margin: 0 auto 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--glass-bg-dark);
    border: 1px solid var(--glass-border);
    box-shadow: var(--liquid-shadow);
}
.pvp-scoreboard #room-name {
    display: block;
    font-size: 0.85rem;
    color: var(--royal-gold-light);
    opacity: 0.8;
}
.pvp-turn-banner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    padding: 8px 40px;
    border-radius: 8px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--royal-gold-light);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(var(--xq-metal-rgb), 0.25);
    transition:
        background 0.3s ease,
        border-color 0.3s ease,
        color 0.3s ease;
}
.pvp-turn-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #777;
    flex: none;
}
.pvp-turn-banner[data-state="mine"] {
    background: linear-gradient(
        90deg,
        rgba(var(--xq-crimson-rgb), 0.2),
        rgba(var(--xq-rim-rgb), 0.25),
        rgba(var(--xq-crimson-rgb), 0.2)
    );
    border-color: var(--royal-gold);
    color: var(--royal-gold);
}
.pvp-turn-banner[data-state="mine"] .pvp-turn-dot {
    background: var(--royal-gold);
    animation: pvpPulse 1.4s ease-in-out infinite;
}
.pvp-turn-banner[data-state="theirs"] {
    opacity: 0.8;
}
.pvp-turn-banner[data-state="red"] .pvp-turn-dot {
    background: #ff5252;
}
.pvp-turn-banner[data-state="black"] .pvp-turn-dot {
    background: #222;
    box-shadow: 0 0 0 1px #aaa;
}
.pvp-turn-banner[data-state="over"] {
    border-color: var(--royal-red-light);
    color: #fff;
}
.pvp-conn {
    position: absolute;
    right: 12px;
    font-size: 0.6rem;
    color: #4caf50;
}
.pvp-conn[data-state="bad"] {
    color: #ff5252;
    animation: pvpPulse 1s ease-in-out infinite;
}
@keyframes pvpPulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.55;
    }
}

/* Last move: make the opponent's reply easy to spot */
#ban-co .square-2b8ce.last-move-from {
    background: rgba(var(--xq-rim-rgb), 0.22);
}
#ban-co .square-2b8ce.last-move-to {
    box-shadow: inset 0 0 0 3px var(--royal-gold);
    background: rgba(var(--xq-rim-rgb), 0.32);
}

/* Invite panel toggle */
.invite-toggle {
    border-radius: 12px 12px 0 0 !important;
}
.invite-toggle[aria-expanded="false"] {
    border-radius: 12px !important;
}
.invite-toggle .invite-chevron {
    margin-left: 8px;
    transition: transform 0.3s ease;
}
.invite-toggle[aria-expanded="true"] .invite-chevron {
    transform: rotate(180deg);
}
.room-code-mini {
    font-family: "Noto Sans Mono", monospace;
    color: var(--royal-gold);
}

/* Mobile: board first, tighter chrome */
@media (max-width: 575.98px) {
    .pvp-scoreboard {
        padding: 8px 10px;
        margin-bottom: 6px;
    }
    .pvp-turn-banner {
        font-size: 0.85rem;
        letter-spacing: 0.5px;
        padding: 6px 30px;
    }
    #video-call-container #remoteVideo {
        max-height: 180px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pvp-turn-dot,
    .pvp-conn,
    .pulse-gold,
    .pulse-red {
        animation: none !important;
    }
}

/* ==========================================================================
   XIANGQI BACKGROUND - make <main> transparent so body artwork shows through
   ========================================================================== */
body > main,
body > #app > main {
    background-color: transparent !important;
}

/* iOS ignores background-attachment: fixed -> avoid blurry stretched artwork */
@supports (-webkit-touch-callout: none) {
    body,
    .container-fluid.about,
    .container-fluid.bmi,
    .container-fluid.game,
    .container-fluid.news,
    .container-fluid.contact,
    body.dashboard main,
    body.login main,
    body.register main {
        background-attachment: scroll !important;
    }
}

/* Checkmate banner visibility per layout (<body data-layout="...">). */
body[data-layout="game"] #checkmateText,
body[data-layout="play"] #checkmateText {
    display: none;
}

/* ==========================================================================
   INVITE QR CODE (PvP room invite panel)
   Subtle by default: a small cream "jade seal" in a slowly turning gold ring.
   Cream card + crimson/ebony ink keeps it scannable. Click/tap to enlarge.
   ========================================================================== */
@property --qr-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

.invite-qr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 0 0 14px;
}
.invite-qr-wrap.d-none {
    display: none !important;
}

.invite-qr {
    --qr-size: 92px;
    display: inline-block;
    cursor: zoom-in;
    border-radius: 16px;
    outline: none;
    transition: transform 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    -webkit-tap-highlight-color: transparent;
}
.invite-qr.is-zoomed {
    --qr-size: 176px;
    cursor: zoom-out;
}
.invite-qr:hover {
    transform: translateY(-2px) scale(1.05);
}
.invite-qr.is-zoomed:hover {
    transform: none;
}

/* Gold ring that slowly turns */
.invite-qr-frame {
    display: block;
    padding: 3px;
    border-radius: 16px;
    background: conic-gradient(
        from var(--qr-angle),
        var(--royal-gold),
        var(--royal-red-light),
        var(--royal-gold-light),
        var(--royal-gold),
        var(--royal-red),
        var(--royal-gold)
    );
    box-shadow:
        0 8px 22px rgba(0, 0, 0, 0.7),
        0 0 14px rgba(var(--xq-rim-rgb), 0.3);
    animation: inviteQrSpin 9s linear infinite;
    transition: box-shadow 0.4s ease;
}
.invite-qr:hover .invite-qr-frame,
.invite-qr:focus-visible .invite-qr-frame,
.invite-qr.is-zoomed .invite-qr-frame {
    box-shadow:
        0 14px 30px rgba(0, 0, 0, 0.85),
        0 0 26px rgba(var(--xq-rim-rgb), 0.7);
}
.invite-qr:focus-visible .invite-qr-frame {
    box-shadow:
        0 0 0 3px var(--royal-bg),
        0 0 0 5px var(--royal-gold),
        0 0 26px rgba(var(--xq-rim-rgb), 0.7);
}

/* Cream glass card with liquid highlight */
.invite-qr-card {
    position: relative;
    display: block;
    overflow: hidden;
    padding: 7px;
    border-radius: 13px;
    background: linear-gradient(
        145deg,
        #fffdf2,
        var(--royal-gold-light) 60%,
        #f3dfa6
    );
    box-shadow:
        inset 0 2px 6px rgba(255, 255, 255, 0.9),
        inset 0 -3px 8px rgba(138, 90, 0, 0.25);
}
.invite-qr-svg {
    display: block;
    width: var(--qr-size);
    height: var(--qr-size);
    transition:
        width 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        height 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.invite-qr-svg svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Glossy glass sheen: top-half gloss + a light streak that sweeps by */
.invite-qr-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.45) 0%,
        rgba(255, 255, 255, 0.08) 46%,
        transparent 50%
    );
    pointer-events: none;
}
.invite-qr-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: -80%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.85),
        transparent
    );
    transform: skewX(-20deg);
    pointer-events: none;
    animation: inviteQrSheen 5.5s ease-in-out 1.2s infinite;
}
.invite-qr:hover .invite-qr-card::after {
    animation-duration: 1.4s;
}

.invite-qr-caption {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--royal-gold-light);
    opacity: 0.6;
    transition: opacity 0.3s ease;
}
.invite-qr-wrap:hover .invite-qr-caption {
    opacity: 1;
}
.invite-qr-caption i {
    color: var(--royal-gold);
}

@keyframes inviteQrSpin {
    to {
        --qr-angle: 360deg;
    }
}
@keyframes inviteQrSheen {
    0%,
    62% {
        left: -80%;
    }
    100% {
        left: 160%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .invite-qr,
    .invite-qr-svg {
        transition: none;
    }
    .invite-qr-frame,
    .invite-qr-card::after {
        animation: none;
    }
}

/* ##########################################################################
   SOURCE: theme-cozy.css
   ########################################################################## */

/* ==========================================================================
   THEME COZY — "Quán trà đêm bên bàn cờ"
   A warm, lantern-lit redesign layered on top of index_new.css / ban-co.css.
   Load LAST:  <link href="{{ asset('css/theme-cozy.css?v=1') }}" rel="stylesheet">

   Idea: a cosy tea-house at dusk. Cocoa-brown wood, terracotta lacquer, honey
   gold lantern light and cream paper. Softer corners, friendlier type, gentle
   motion. Colours come from the per-board palettes in themes.css (html[data-board-theme]);
   the legacy tokens index_new.css already
   uses, so existing components inherit the new look automatically; the rules
   below then refine the components that need more than a recolour.
   Board pieces / squares / game logic selectors are intentionally untouched.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
    /* Lacquer & lantern palette (same names as before → whole site re-themes) */
    --royal-red: var(--xq-primary);
    --royal-red-dark: var(--xq-primary-dark);
    --royal-red-light: var(--xq-primary-light);
    --royal-gold: var(--xq-accent);
    --royal-gold-light: var(--xq-highlight);
    --royal-bg: var(--xq-surface-deep);
    --royal-wood: var(--xq-wood);

    /* Warm glass */
    --glass-blur: blur(18px) saturate(1.25);
    --glass-bg-dark: rgba(var(--xq-surface-rgb), 0.78);
    --glass-bg-red: rgba(var(--xq-primary-rgb), 0.8);
    --glass-border: rgba(var(--xq-accent-rgb), 0.32);
    --liquid-highlight: rgba(var(--xq-sheen-rgb), 0.22);
    --liquid-shadow: 0 10px 30px rgba(var(--xq-shadow-rgb), 0.55);

    /* New cozy tokens */
    --cozy-cream: var(--xq-cream);
    --cozy-paper: var(--xq-paper);
    --cozy-ink: var(--xq-ink);
    --cozy-ember: var(--xq-ember);
    --cozy-sage: #7fb069;
    --cozy-sage-dark: #4f7a45;
    --cozy-radius: 18px;
    --cozy-radius-sm: 12px;
    --cozy-radius-pill: 999px;
    --cozy-shadow-soft: 0 6px 18px rgba(var(--xq-shadow-rgb), 0.35);
    --cozy-shadow-lift: 0 16px 36px rgba(var(--xq-shadow-rgb), 0.5);
    --cozy-glow: 0 0 22px rgba(var(--xq-glow-rgb), 0.28);
    --cozy-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --cozy-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --------------------------------------------------------------------------
   2. Page atmosphere: lantern glow, paper grain, warm vignette
   -------------------------------------------------------------------------- */
html {
    scroll-behavior: smooth;
}

body {
    color: var(--cozy-cream);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(
            ellipse 55% 40% at 12% 0%,
            rgba(var(--xq-glow-a-rgb), 0.28),
            transparent 70%
        ),
        radial-gradient(
            ellipse 50% 40% at 92% 6%,
            rgba(var(--xq-primary-light-rgb), 0.22),
            transparent 70%
        ),
        radial-gradient(
            ellipse 90% 60% at 50% 115%,
            rgba(var(--xq-shadow-rgb), 0.7),
            transparent 70%
        ),
        linear-gradient(
            180deg,
            rgba(var(--xq-bg-color-rgb), 0.35),
            rgba(var(--xq-surface-deep-rgb), 0.55)
        );
    animation: cozyLantern 9s ease-in-out infinite alternate;
}

/* Fine paper grain – cheap inline SVG noise */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.07;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 .9  0 0 0 0 .7  0 0 0 .8 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

@keyframes cozyLantern {
    from {
        opacity: 0.85;
    }
    to {
        opacity: 1;
    }
}

a {
    color: var(--royal-gold);
    transition: color 0.25s var(--cozy-ease);
}
a:hover {
    color: var(--cozy-ember);
}

p,
li,
label {
    color: inherit;
}

/* Headings: soft serif, sentence case, warm */
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
    font-family:
        "Fraunces", "Texturina", "Noto Sans JP", "Noto Sans KR", "Noto Sans SC",
        serif !important;
    text-transform: none;
    letter-spacing: 0.1px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--royal-gold);
    text-shadow: 0 2px 10px rgba(var(--xq-shadow-rgb), 0.55);
}

/* Accessible, friendly focus ring everywhere */
:focus-visible {
    outline: 3px solid rgba(var(--xq-accent-rgb), 0.85);
    outline-offset: 2px;
    border-radius: 6px;
}

::selection {
    background: var(--royal-gold);
    color: var(--cozy-ink);
    text-shadow: none;
}
::-moz-selection {
    background: var(--royal-gold);
    color: var(--cozy-ink);
    text-shadow: none;
}

/* --------------------------------------------------------------------------
   3. Scrollbar
   -------------------------------------------------------------------------- */
html,
body {
    scrollbar-color: rgb(var(--xq-primary-dark-rgb)) var(--royal-bg);
}
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}
::-webkit-scrollbar-track {
    background: var(--royal-bg);
    border-left: 1px solid rgba(var(--xq-accent-rgb), 0.12);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.6);
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(
        180deg,
        var(--xq-primary-dark),
        rgb(var(--xq-wood-rgb))
    );
    border: 2px solid var(--royal-bg);
    border-radius: 999px;
    box-shadow: none;
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        180deg,
        rgb(var(--xq-accent-hi-rgb)),
        rgb(var(--xq-metal-rgb))
    );
    border-color: var(--royal-bg);
    box-shadow: none;
}
::-webkit-scrollbar-thumb:active {
    background: var(--royal-gold);
}
::-webkit-scrollbar-corner {
    background: var(--royal-bg);
}

/* --------------------------------------------------------------------------
   4. Header — a warm lacquered rail with a soft gold underglow
   -------------------------------------------------------------------------- */
header.site-header {
    background: linear-gradient(
        180deg,
        rgba(var(--xq-primary-mid-rgb), 0.9),
        rgba(var(--xq-wood-rgb), 0.88)
    );
    border-bottom: 1px solid rgba(var(--xq-accent-rgb), 0.45);
    border-radius: 0 0 var(--cozy-radius) var(--cozy-radius);
    box-shadow:
        0 12px 32px rgba(var(--xq-shadow-rgb), 0.55),
        inset 0 1px 0 rgba(var(--xq-sheen-rgb), 0.28),
        inset 0 -1px 18px rgba(var(--xq-accent-rgb), 0.14);
}
header.site-header:hover {
    background: linear-gradient(
        180deg,
        rgba(var(--xq-primary-dark-rgb), 0.92),
        rgba(var(--xq-crimson-rgb), 0.9)
    );
}

header.site-header a {
    text-transform: none;
    letter-spacing: 0.2px;
    font-weight: 700;
    color: var(--cozy-cream);
}
header.site-header .navbar li a {
    font-size: 15px;
}
header.site-header a:not(.navbar-brand):hover {
    color: var(--royal-gold);
}
header.site-header a:not(.navbar-brand)::before {
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--royal-gold),
        transparent
    );
}

header.site-header .navbar-brand h1,
header.site-header .navbar-brand span {
    font-family: "Fraunces", serif !important;
    text-transform: none;
    letter-spacing: 0.2px;
}

header.site-header a.login,
header.site-header a.register {
    border-radius: var(--cozy-radius-pill);
    padding: 8px 22px;
}
header.site-header a.register {
    background: linear-gradient(
        180deg,
        var(--xq-accent-hi),
        var(--xq-accent-lo)
    ) !important;
    color: var(--cozy-ink) !important;
    border: 1px solid rgba(var(--xq-cream-rgb), 0.8);
    box-shadow:
        0 6px 16px rgba(var(--xq-accent-lo-rgb), 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
header.site-header a.login {
    background: rgba(var(--xq-surface-rgb), 0.55) !important;
    color: var(--royal-gold) !important;
    border: 1px solid rgba(var(--xq-accent-rgb), 0.7);
}
header.site-header a.login:hover {
    background: rgba(var(--xq-surface-rgb), 0.8) !important;
}

header.site-header ul.navbar-nav .dropdown-menu {
    border: 1px solid rgba(var(--xq-accent-rgb), 0.4);
    background-color: var(--xq-surface);
    border-radius: var(--cozy-radius-sm);
}

@media (max-width: 1280px) {
    header.site-header .menu-toggle.close ~ nav.navbar {
        background: linear-gradient(
            180deg,
            rgb(var(--xq-wood-rgb)),
            rgb(var(--xq-surface-hi-rgb))
        );
        border-bottom: 1px solid rgba(var(--xq-accent-rgb), 0.5);
        border-radius: 0 0 var(--cozy-radius) var(--cozy-radius);
        box-shadow: 0 18px 30px rgba(var(--xq-shadow-rgb), 0.55);
    }
    header.site-header .menu-toggle.close ~ nav.navbar ul li {
        border-bottom: 1px solid rgba(var(--xq-accent-rgb), 0.14);
    }
    header.site-header ul.navbar-nav .dropdown-menu {
        background-color: rgba(var(--xq-surface-deep-rgb), 0.7);
    }
}

/* --------------------------------------------------------------------------
   5. Buttons — friendly pills with a gentle bounce
   -------------------------------------------------------------------------- */
.btn {
    text-transform: none;
    letter-spacing: 0.2px;
    font-weight: 700;
    border-radius: 14px;
    padding-left: 1.15rem;
    padding-right: 1.15rem;
    transition:
        transform 0.3s var(--cozy-spring),
        box-shadow 0.3s var(--cozy-ease),
        background 0.3s var(--cozy-ease),
        color 0.2s ease;
}
.btn:hover {
    transform: translateY(-2px);
}
.btn:active {
    transform: translateY(1px) scale(0.98);
}
.btn-lg {
    border-radius: 16px;
    font-size: 1.1rem;
}
.btn-sm {
    border-radius: 10px;
}

/* Primary: terracotta lacquer */
.btn-danger,
.btn-royal {
    background: linear-gradient(
        180deg,
        rgb(var(--xq-primary-light-rgb)),
        var(--xq-primary)
    ) !important;
    border: 1px solid rgba(var(--xq-accent-hi-rgb), 0.55) !important;
    color: var(--cozy-cream) !important;
    box-shadow:
        0 8px 18px rgba(var(--xq-primary-rgb), 0.45),
        inset 0 1px 0 rgba(var(--xq-sheen-rgb), 0.45) !important;
    text-shadow: 0 1px 2px rgba(var(--xq-bg-color-rgb), 0.5);
}
.btn-danger:hover,
.btn-royal:hover {
    background: linear-gradient(
        180deg,
        rgb(var(--xq-primary-light-rgb)),
        rgb(var(--xq-primary-mid-rgb))
    ) !important;
    box-shadow:
        0 12px 26px rgba(var(--xq-primary-rgb), 0.55),
        0 0 22px rgba(var(--xq-glow-rgb), 0.35),
        inset 0 1px 0 rgba(var(--xq-sheen-rgb), 0.55) !important;
    color: #fff !important;
}

/* Secondary: cocoa glass */
.btn-dark {
    background: rgba(var(--xq-surface-hi-rgb), 0.82) !important;
    border: 1px solid rgba(var(--xq-accent-rgb), 0.38) !important;
    color: var(--cozy-cream) !important;
    box-shadow:
        0 6px 16px rgba(var(--xq-shadow-rgb), 0.4),
        inset 0 1px 0 rgba(var(--xq-sheen-rgb), 0.14) !important;
}
.btn-dark:hover {
    background: rgba(var(--xq-wood-rgb), 0.92) !important;
    border-color: rgba(var(--xq-accent-rgb), 0.75) !important;
    color: var(--royal-gold) !important;
    box-shadow:
        0 10px 22px rgba(var(--xq-shadow-rgb), 0.5),
        0 0 18px rgba(var(--xq-accent-rgb), 0.22),
        inset 0 1px 0 rgba(var(--xq-sheen-rgb), 0.2) !important;
}

/* Positive: sage */
.btn-success {
    background: linear-gradient(180deg, #8fc27a, #4f7a45) !important;
    border: 1px solid rgba(235, 255, 220, 0.6) !important;
    color: #fff !important;
    box-shadow: 0 8px 18px rgba(79, 122, 69, 0.4) !important;
}

/* Honey: outline / light */
.btn-royal-outline,
.btn-outline-light,
.btn-light {
    border-radius: 14px;
}
.btn-warning {
    background: linear-gradient(
        180deg,
        var(--xq-accent-hi),
        var(--xq-accent-lo)
    ) !important;
    border: 1px solid rgba(var(--xq-cream-rgb), 0.7) !important;
    color: var(--cozy-ink) !important;
}

.btn.bootbox-cancel {
    background: rgba(var(--xq-surface-hi-rgb), 0.9) !important;
    border-color: rgba(var(--xq-accent-rgb), 0.35) !important;
}

/* Calmer pulse: warm ember ring instead of hard flash */
.pulse-red {
    box-shadow: 0 0 0 0 rgba(var(--xq-primary-light-rgb), 0.7);
}
.pulse-gold {
    box-shadow: 0 0 0 0 rgba(var(--xq-accent-rgb), 0.7);
}
@keyframes pulse-red {
    to {
        box-shadow: 0 0 0 16px rgba(var(--xq-primary-light-rgb), 0);
    }
}
@keyframes pulse-gold {
    to {
        box-shadow: 0 0 0 16px rgba(var(--xq-accent-rgb), 0);
    }
}

/* --------------------------------------------------------------------------
   6. Cards, panels, hero — warm glass "tea trays"
   -------------------------------------------------------------------------- */
.card,
.royal-grid-card,
.article-card,
.article-detail-card,
.match-card,
.info,
.hero .hero-box {
    border-radius: var(--cozy-radius) !important;
}

.card {
    background: var(--glass-bg-dark);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    color: var(--cozy-cream);
    box-shadow: var(--cozy-shadow-soft);
    overflow: hidden;
}

.royal-grid-card,
.article-card {
    transition:
        transform 0.4s var(--cozy-spring),
        box-shadow 0.4s var(--cozy-ease),
        border-color 0.3s ease;
}
.royal-grid-card:hover,
.article-card:hover {
    transform: translateY(-5px);
    border-color: rgba(var(--xq-accent-rgb), 0.7);
    box-shadow:
        var(--cozy-shadow-lift),
        0 0 28px rgba(var(--xq-glow-rgb), 0.2);
}

.card-header {
    background: linear-gradient(
        90deg,
        rgba(var(--xq-primary-rgb), 0.55),
        rgba(var(--xq-primary-rgb), 0.12)
    );
    border-bottom: 1px solid rgba(var(--xq-accent-rgb), 0.25);
    font-family: "Fraunces", serif;
    font-weight: 700;
    color: var(--royal-gold);
}

.hero .hero-box {
    background: rgba(var(--xq-surface-rgb), 0.78);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow:
        var(--cozy-shadow-lift),
        inset 0 1px 0 rgba(var(--xq-sheen-rgb), 0.12);
}
.hero .hero-box .nav-tabs li a {
    text-transform: none;
    border-radius: 12px 12px 0 0;
}
.hero .hero-box .nav-tabs li.active a {
    background: linear-gradient(
        180deg,
        var(--xq-primary-dark),
        rgb(var(--xq-crimson-rgb))
    );
}

.info {
    background: rgba(var(--xq-surface-rgb), 0.7);
    border: 1px solid var(--glass-border);
}

/* Proverb = a handwritten tea-house scroll */
#proverb {
    border-radius: var(--cozy-radius);
    border-left: 4px solid var(--royal-gold);
    border-right: 4px solid var(--royal-gold);
    background: linear-gradient(
        90deg,
        rgba(var(--xq-primary-rgb), 0.3),
        rgba(var(--xq-primary-rgb), 0.08),
        rgba(var(--xq-primary-rgb), 0.3)
    );
    text-shadow: 0 2px 8px rgba(var(--xq-shadow-rgb), 0.7);
}

/* Section dividers / lists */
hr {
    border-top: 1px solid rgba(var(--xq-accent-rgb), 0.25);
}
.list-group-item {
    background: rgba(var(--xq-surface-rgb), 0.7);
    border-color: rgba(var(--xq-accent-rgb), 0.18);
    color: var(--cozy-cream);
}

/* --------------------------------------------------------------------------
   7. Forms — cream paper fields
   -------------------------------------------------------------------------- */
.form-control,
.custom-select {
    background-color: var(--cozy-cream) !important;
    color: var(--cozy-ink) !important;
    border: 1.5px solid rgba(var(--xq-wood-rgb), 0.55) !important;
    border-radius: var(--cozy-radius-sm) !important;
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}
.form-control::placeholder {
    color: rgba(var(--xq-ink-rgb), 0.5);
}
.form-control:focus,
.custom-select:focus {
    border-color: var(--royal-gold) !important;
    box-shadow: 0 0 0 0.25rem rgba(var(--xq-glow-rgb), 0.35) !important;
}
form label,
.col-form-label {
    color: var(--royal-gold-light);
    font-weight: 600;
}
.input-group-text {
    background: var(--cozy-paper);
    border-color: rgba(var(--xq-wood-rgb), 0.55);
    color: var(--cozy-ink);
    border-radius: var(--cozy-radius-sm);
}
.custom-control-input:checked ~ .custom-control-label::before {
    background-color: var(--royal-red);
    border-color: var(--royal-gold);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-text-fill-color: var(--cozy-ink) !important;
    border: 1px solid var(--royal-gold) !important;
    box-shadow: 0 0 0 0.25rem rgba(var(--xq-glow-rgb), 0.3) !important;
}

/* --------------------------------------------------------------------------
   8. Tables
   -------------------------------------------------------------------------- */
.table-responsive,
.dataTables_wrapper {
    border-radius: var(--cozy-radius);
    background: rgba(var(--xq-surface-rgb), 0.78);
    border: 1px solid var(--glass-border);
    box-shadow: var(--cozy-shadow-soft);
}
.table thead th {
    background: rgba(var(--xq-primary-rgb), 0.3);
    border-bottom: 2px solid rgba(var(--xq-accent-rgb), 0.6);
    text-transform: none;
    font-family: "Fraunces", serif;
    letter-spacing: 0.2px;
}
.table td,
.table th {
    border-top: 1px solid rgba(var(--xq-accent-rgb), 0.12) !important;
}
.table tbody tr:hover {
    background-color: rgba(var(--xq-glow-rgb), 0.08) !important;
    box-shadow: inset 3px 0 0 var(--royal-gold);
}
table.table:not(#danh-sach-ky-thu) td.room-code span {
    border-radius: var(--cozy-radius-pill);
    background: rgba(var(--xq-accent-rgb), 0.14);
    border: 1px solid rgba(var(--xq-accent-rgb), 0.55);
    padding: 4px 12px 5px;
}
div.dataTables_wrapper div.dataTables_length label,
div.dataTables_wrapper div.dataTables_filter label,
.dataTables_info {
    color: var(--royal-gold-light);
}

/* --------------------------------------------------------------------------
   9. Dropdowns, modals, tooltips, alerts, badges, pagination
   -------------------------------------------------------------------------- */
.dropdown-menu {
    background: rgba(var(--xq-surface-rgb), 0.96);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(var(--xq-accent-rgb), 0.4);
    border-radius: var(--cozy-radius-sm);
    box-shadow: var(--cozy-shadow-lift);
    padding: 0.4rem;
}
.dropdown-item {
    border-radius: 10px;
    color: var(--cozy-cream);
    font-weight: 600;
}
.dropdown-item:hover,
.dropdown-item:focus {
    background: rgba(var(--xq-accent-rgb), 0.14);
    color: var(--royal-gold);
}
.dropdown-item.active,
.dropdown-item:active {
    background: linear-gradient(
        180deg,
        var(--xq-accent-hi),
        var(--xq-accent-lo)
    ) !important;
    color: var(--cozy-ink) !important;
}
header.site-header .dropdown-menu a:hover {
    background-color: rgba(var(--xq-accent-rgb), 0.16);
}
header.site-header .dropdown-menu .dropdown-item.active,
header.site-header .dropdown-menu .dropdown-item:active {
    background: linear-gradient(
        180deg,
        var(--xq-accent-hi),
        var(--xq-accent-lo)
    ) !important;
    color: var(--cozy-ink) !important;
}

.modal-backdrop.show {
    background: rgb(var(--xq-surface-deep-rgb));
    opacity: 0.72;
}
.modal-content {
    background: linear-gradient(
        180deg,
        rgba(var(--xq-surface-hi-rgb), 0.97),
        rgba(var(--xq-surface-lo-rgb), 0.97)
    );
    color: var(--cozy-cream);
    border: 1px solid rgba(var(--xq-accent-rgb), 0.45);
    border-radius: 22px;
    box-shadow:
        0 30px 70px rgba(var(--xq-shadow-deep-rgb), 0.7),
        0 0 40px rgba(var(--xq-glow-rgb), 0.14);
    overflow: hidden;
}
.modal-header {
    border-bottom: 1px solid rgba(var(--xq-accent-rgb), 0.2);
    background: linear-gradient(
        90deg,
        rgba(var(--xq-primary-rgb), 0.45),
        transparent
    );
}
.modal-footer {
    border-top: 1px solid rgba(var(--xq-accent-rgb), 0.2);
}
.modal.fade .modal-dialog {
    transition:
        transform 0.4s var(--cozy-spring),
        opacity 0.3s ease;
}
.bootbox .modal-body {
    font-size: 1.05rem;
}

.tooltip .tooltip-inner {
    background: rgba(var(--xq-surface-deep-rgb), 0.96) !important;
    border: 1px solid rgba(var(--xq-accent-rgb), 0.6) !important;
    border-radius: 12px;
    font-weight: 600;
}

.alert {
    border-radius: var(--cozy-radius-sm);
    border-width: 1px;
    box-shadow: var(--cozy-shadow-soft);
}

.badge {
    border-radius: var(--cozy-radius-pill);
    font-weight: 700;
    padding: 0.4em 0.8em;
}

.page-link {
    font-weight: 700;
}
.page-item:first-child .page-link {
    border-top-left-radius: 14px;
    border-bottom-left-radius: 14px;
}
.page-item:last-child .page-link {
    border-top-right-radius: 14px;
    border-bottom-right-radius: 14px;
}
.page-item.active .page-link {
    background: linear-gradient(
        180deg,
        var(--xq-accent-hi),
        var(--xq-accent-lo)
    ) !important;
    color: var(--cozy-ink) !important;
}

/* --------------------------------------------------------------------------
   10. The board — a lacquered walnut tray under lantern light
   -------------------------------------------------------------------------- */
#ban-co {
    background: linear-gradient(
        145deg,
        rgb(var(--xq-wood-rgb)),
        rgb(var(--xq-surface-hi-rgb)) 55%,
        rgb(var(--xq-wood-rgb))
    );
    border: 1px solid rgba(var(--xq-accent-rgb), 0.65);
    border-radius: 20px;
    padding: 12px;
    box-shadow:
        0 0 0 3px rgba(var(--xq-surface-rgb), 0.95),
        0 0 0 4px rgba(var(--xq-accent-rgb), 0.35),
        0 10px 22px rgba(var(--xq-shadow-deep-rgb), 0.55),
        0 28px 60px rgba(var(--xq-shadow-deep-rgb), 0.6),
        0 0 70px rgba(var(--xq-glow-a-rgb), 0.24),
        inset 0 1px 0 rgba(var(--xq-sheen-rgb), 0.4),
        inset 0 -3px 8px rgba(var(--xq-shadow-deep-rgb), 0.45) !important;
}
#ban-co:hover {
    box-shadow:
        0 0 0 3px rgba(var(--xq-surface-rgb), 0.95),
        0 0 0 4px rgba(var(--xq-accent-rgb), 0.55),
        0 14px 28px rgba(var(--xq-shadow-deep-rgb), 0.6),
        0 36px 72px rgba(var(--xq-shadow-deep-rgb), 0.65),
        0 0 90px rgba(var(--xq-glow-a-rgb), 0.34),
        inset 0 1px 0 rgba(var(--xq-sheen-rgb), 0.5),
        inset 0 -3px 8px rgba(var(--xq-shadow-deep-rgb), 0.45) !important;
}
#ban-co:has(.notation-8c7a2) {
    background-color: rgb(var(--xq-accent-hi-rgb)) !important;
    background-image: none;
}

/* Game status / over chips */
#game-status {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(var(--xq-primary-rgb), 0.85),
        transparent
    ) !important;
    text-transform: none;
    letter-spacing: 0.5px;
    font-family: "Fraunces", serif;
    border-radius: var(--cozy-radius-pill);
}
#game-over {
    border: 1px solid rgba(var(--xq-accent-rgb), 0.7);
    border-radius: var(--cozy-radius-pill);
    background: rgba(var(--xq-surface-rgb), 0.9);
    text-transform: none;
}
#game-over:hover {
    background: var(--royal-red);
}
.side-color {
    font-family: "Fraunces", serif;
}

/* Scoreboard + turn banner: friendly chips instead of hard boxes */
.pvp-scoreboard {
    border-radius: var(--cozy-radius);
}
.pvp-turn-banner {
    border-radius: var(--cozy-radius-pill);
    font-weight: 700;
    box-shadow: var(--cozy-shadow-soft);
}
.pvp-turn-banner[data-state="mine"] {
    box-shadow:
        var(--cozy-shadow-soft),
        0 0 24px rgba(127, 176, 105, 0.45);
}

/* Rematch panel & match status */
#rematch-panel {
    border-radius: 20px !important;
    border-color: rgba(var(--xq-accent-rgb), 0.55) !important;
    background: rgba(var(--xq-surface-rgb), 0.92) !important;
}
#match-status {
    border-radius: var(--cozy-radius-sm);
}

/* Last-move highlight a bit warmer (colours only) */
#ban-co .square-2b8ce.last-move-from,
#ban-co .square-2b8ce.last-move-to {
    transition: background-color 0.3s ease;
}

/* --------------------------------------------------------------------------
   11. Footer — warm hearth
   -------------------------------------------------------------------------- */
footer {
    background: linear-gradient(
        180deg,
        rgb(var(--xq-surface-rgb)),
        rgb(var(--xq-shadow-rgb))
    );
    border-top: 1px solid rgba(var(--xq-accent-rgb), 0.5);
    border-radius: 28px 28px 0 0;
    margin-top: 2rem;
    box-shadow: 0 -12px 40px rgba(var(--xq-shadow-deep-rgb), 0.45);
    color: var(--royal-gold-light);
}
footer a {
    color: rgb(var(--xq-accent-rgb));
}
footer a:hover {
    color: var(--royal-gold);
}
footer p {
    font-family: "Fraunces", serif;
    font-weight: 700;
    color: var(--royal-gold);
}
footer ul li {
    margin-bottom: 0.55em;
}
footer ul.list-unstyled > li > a {
    display: inline-block;
    transition:
        transform 0.25s var(--cozy-ease),
        color 0.2s ease;
}
footer ul.list-unstyled > li > a:hover {
    transform: translateX(4px);
}
footer .display-4 {
    transition:
        transform 0.3s var(--cozy-spring),
        color 0.2s ease;
    display: inline-block;
}
footer .display-4:hover {
    transform: translateY(-3px) scale(1.1);
}

/* --------------------------------------------------------------------------
   12. Misc widgets: scroll-top, cookie banner, intro.js, avatar
   -------------------------------------------------------------------------- */
.cd-top {
    border-radius: 50%;
}
.cookie-consent {
    background: rgba(var(--xq-surface-deep-rgb), 0.96);
    border-top: 1px solid rgba(var(--xq-accent-rgb), 0.45);
    border-radius: var(--cozy-radius) var(--cozy-radius) 0 0;
    box-shadow: 0 -10px 30px rgba(var(--xq-shadow-deep-rgb), 0.5);
}
.introjs-tooltip {
    border-radius: var(--cozy-radius);
}
.introjs-button {
    border-radius: 12px;
}
.badge-status,
.badge-online,
.badge-offline {
    border-radius: var(--cozy-radius-pill);
}

/* --------------------------------------------------------------------------
   13. Gentle entrance motion (disabled for reduced-motion users)
   -------------------------------------------------------------------------- */
@keyframes cozyRise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

main .card,
main .royal-grid-card,
main .article-card,
main .hero-box,
main .table-responsive {
    animation: cozyRise 0.6s var(--cozy-ease) both;
}
main .row > div:nth-child(2) .card,
main .row > div:nth-child(2) .royal-grid-card {
    animation-delay: 0.06s;
}
main .row > div:nth-child(3) .card,
main .row > div:nth-child(3) .royal-grid-card {
    animation-delay: 0.12s;
}
main .row > div:nth-child(4) .card,
main .row > div:nth-child(4) .royal-grid-card {
    animation-delay: 0.18s;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    body::before {
        animation: none;
    }
    main .card,
    main .royal-grid-card,
    main .article-card,
    main .hero-box,
    main .table-responsive {
        animation: none;
    }
    .btn,
    .btn:hover,
    .btn:active,
    .royal-grid-card:hover,
    .article-card:hover {
        transform: none;
    }
}

/* --------------------------------------------------------------------------
   14. Small screens: bigger touch targets, tighter chrome
   -------------------------------------------------------------------------- */
@media (max-width: 576px) {
    header.site-header {
        border-radius: 0 0 14px 14px;
    }
    footer {
        border-radius: 20px 20px 0 0;
    }
    .btn-lg {
        padding-top: 0.7rem;
        padding-bottom: 0.7rem;
    }
    .modal-content {
        border-radius: 18px;
    }
    #ban-co {
        border-radius: 16px;
        padding: 8px;
    }
}

/* The page paints its own warm backdrop; the heavy blur layers are
   skipped on devices that ask for less data/transparency. */
@media (prefers-reduced-transparency: reduce) {
    .card,
    .dropdown-menu,
    .hero .hero-box,
    header.site-header {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

/* ##########################################################################
   SOURCE: header-cozy.css
   ########################################################################## */

/* ==========================================================================
   HEADER COZY — "Cổng đèn lồng"
   A lantern-lit header for the tea-house theme.
   Load AFTER theme-cozy.css:
     <link href="{{ asset('css/header-cozy.css?v=1') }}" rel="stylesheet">

   Desktop (>= 1200px):  logo coin · floating pill rail · gold "Chơi ngay" button · avatar
                         "Thi đấu" opens a 3-column mega menu with icon tiles + hints.
   Tablet / phone:       burger → full-width slide-down sheet with big touch targets,
                         dropdowns become accordions. "Chơi ngay" + avatar stay in the bar.

   Every selector starts with `header.site-header.cz-header` so it out-ranks the older
   header rules in index_new.css / theme-cozy.css without touching them. Where the old
   global `.dropdown-item` / `.dropdown-menu` rules use !important, we match with !important
   at a higher specificity.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Shell
   -------------------------------------------------------------------------- */
header.site-header.cz-header {
    --cz-h: 74px;
    --cz-gold: var(--royal-gold, var(--xq-accent));
    --cz-gold-hi: var(--xq-accent-hi);
    --cz-gold-lo: var(--xq-accent-lo);
    --cz-cream: var(--cozy-cream, var(--xq-cream));
    --cz-ink: var(--cozy-ink, var(--xq-ink));
    --cz-ember: var(--cozy-ember, var(--xq-ember));
    --cz-line: rgba(var(--xq-accent-rgb), 0.28);
    --cz-ease: var(--cozy-ease, cubic-bezier(0.22, 1, 0.36, 1));
    --cz-spring: var(--cozy-spring, cubic-bezier(0.34, 1.56, 0.64, 1));

    position: sticky;
    top: 0;
    z-index: 1050;
    width: 100%;
    padding-top: env(safe-area-inset-top, 0);
    background:
        radial-gradient(
            520px 130px at 6% -30%,
            rgba(var(--xq-glow-rgb), 0.38),
            transparent 70%
        ),
        radial-gradient(
            460px 130px at 96% -40%,
            rgba(var(--xq-ember-rgb), 0.28),
            transparent 70%
        ),
        linear-gradient(
            180deg,
            rgba(var(--xq-primary-mid-rgb), 0.96),
            rgba(var(--xq-wood-rgb), 0.96)
        );
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    backdrop-filter: blur(16px) saturate(1.3);
    border-bottom: 0;
    border-radius: 0 0 24px 24px;
    box-shadow:
        0 12px 32px rgba(var(--xq-shadow-rgb), 0.5),
        inset 0 1px 0 rgba(var(--xq-sheen-rgb), 0.3);
    animation: czDrop 0.7s var(--cz-ease) both;
    transition:
        box-shadow 0.3s ease,
        border-radius 0.3s ease;
}
/* The old header hover swaps the background and uses an !important shadow; keep it calm. */
header.site-header.cz-header:hover {
    background:
        radial-gradient(
            520px 130px at 6% -30%,
            rgba(var(--xq-glow-rgb), 0.38),
            transparent 70%
        ),
        radial-gradient(
            460px 130px at 96% -40%,
            rgba(var(--xq-ember-rgb), 0.28),
            transparent 70%
        ),
        linear-gradient(
            180deg,
            rgba(var(--xq-primary-mid-rgb), 0.96),
            rgba(var(--xq-wood-rgb), 0.96)
        );
    box-shadow:
        0 12px 32px rgba(var(--xq-shadow-rgb), 0.5),
        inset 0 1px 0 rgba(var(--xq-sheen-rgb), 0.3) !important;
}
header.site-header.cz-header.is-scrolled,
header.site-header.cz-header.is-scrolled:hover {
    --cz-h: 60px;
    border-radius: 0 0 18px 18px;
    box-shadow:
        0 14px 36px rgba(var(--xq-shadow-deep-rgb), 0.62),
        inset 0 1px 0 rgba(var(--xq-sheen-rgb), 0.3) !important;
}

/* Kill the old liquid sheen layer; draw a thin gold thread along the bottom instead. */
header.site-header.cz-header::before {
    content: none;
}
header.site-header.cz-header::after {
    content: "";
    position: absolute;
    left: 6%;
    right: 6%;
    bottom: 0;
    height: 2px;
    border-radius: 2px;
    pointer-events: none;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(var(--xq-accent-rgb), 0.9) 30%,
        var(--xq-highlight) 50%,
        rgba(var(--xq-accent-rgb), 0.9) 70%,
        transparent
    );
    background-size: 200% 100%;
    animation: czThread 7s linear infinite;
}

header.site-header.cz-header a {
    text-transform: none;
    letter-spacing: 0.1px;
    text-decoration: none;
}
/* Retire the old animated underline on every header link. */
header.site-header.cz-header a::before {
    content: none;
}

.cz-bar {
    position: relative; /* containing block for the mega menu and the mobile sheet */
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1320px;
    min-height: var(--cz-h);
    margin: 0 auto;
    padding: 0 max(20px, env(safe-area-inset-right, 0px)) 0
        max(20px, env(safe-area-inset-left, 0px));
    transition: min-height 0.3s var(--cz-ease);
}

/* --------------------------------------------------------------------------
   2. Brand
   -------------------------------------------------------------------------- */
header.site-header.cz-header .cz-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    min-width: 0;
    color: var(--cz-cream);
    top: 0;
}
header.site-header.cz-header .cz-brand img.xiangqi-logo {
    width: 46px;
    height: 46px;
    margin: 0;
    padding: 3px;
    border-radius: 50%;
    object-fit: contain;
    background: radial-gradient(
        circle at 32% 25%,
        rgb(var(--xq-sheen-rgb)),
        rgb(var(--xq-glow-a-rgb)) 72%
    );
    border: 0;
    filter: none;
    box-shadow:
        0 0 0 2px rgba(var(--xq-sheen-rgb), 0.7),
        0 0 18px rgba(var(--xq-glow-rgb), 0.55),
        0 6px 14px rgba(var(--xq-shadow-rgb), 0.5);
    transition:
        transform 0.5s var(--cz-spring),
        width 0.3s ease,
        height 0.3s ease;
    animation: czLantern 3.4s ease-in-out infinite alternate;
}
header.site-header.cz-header.is-scrolled .cz-brand img.xiangqi-logo {
    width: 38px;
    height: 38px;
}
header.site-header.cz-header .cz-brand:hover img.xiangqi-logo {
    transform: rotate(-10deg) scale(1.08);
}
header.site-header.cz-header .cz-brand:active img.xiangqi-logo {
    transform: scale(0.94);
}
body.loading header.site-header.cz-header .cz-brand img.xiangqi-logo {
    animation: spin 0.6s linear infinite !important;
}
.cz-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
header.site-header.cz-header .cz-brand-name {
    font-family: "Fraunces", "Texturina", serif;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--cz-cream);
    text-shadow: 0 2px 10px rgba(var(--xq-shadow-rgb), 0.55);
    white-space: nowrap;
}
header.site-header.cz-header .cz-brand-tag {
    display: block;
    margin-top: 5px;
    font-style: normal;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--cz-gold);
    opacity: 0.92;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   3. Navigation rail (desktop)
   -------------------------------------------------------------------------- */
header.site-header.cz-header .cz-nav {
    position: static; /* beats Bootstrap's .navbar { position: relative } so the mega menu anchors to .cz-bar */
    flex: 0 1 auto;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0 !important;
    box-shadow: none !important;
}
header.site-header.cz-header .cz-menu {
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    gap: 2px;
    margin: 0;
    padding: 5px;
    list-style: none;
    border-radius: 999px;
    background: rgba(var(--xq-surface-lo-rgb), 0.38);
    border: 1px solid var(--cz-line);
    box-shadow:
        inset 0 2px 8px rgba(var(--xq-shadow-deep-rgb), 0.4),
        0 1px 0 rgba(var(--xq-sheen-rgb), 0.12);
}
header.site-header.cz-header .cz-menu > li {
    position: relative;
    margin: 0;
    padding: 0;
    border: 0;
}
header.site-header.cz-header .cz-menu > li.cz-has-mega {
    position: static;
}

header.site-header.cz-header .cz-link {
    position: relative;
    top: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--cz-cream);
    background: transparent;
    cursor: pointer;
    transition:
        background 0.25s var(--cz-ease),
        color 0.2s ease,
        box-shadow 0.25s var(--cz-ease),
        transform 0.25s var(--cz-spring);
}
header.site-header.cz-header .cz-link i {
    width: 1.15em;
    font-size: 0.95em;
    text-align: center;
    opacity: 0.92;
}
header.site-header.cz-header .cz-link:hover,
header.site-header.cz-header .cz-link:focus-visible {
    color: var(--cz-gold);
    background: rgba(var(--xq-accent-rgb), 0.15);
    text-shadow: none;
    transform: translateY(-1px);
}
header.site-header.cz-header .cz-link.dropdown-toggle::after {
    margin-left: 2px;
    border-width: 0.3em 0.28em 0;
    vertical-align: 0.15em;
    transition: transform 0.25s var(--cz-ease);
}
header.site-header.cz-header
    .cz-link.dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}
/* The page you are on, and the menu you have open: a honey-gold pill. */
header.site-header.cz-header .cz-link.is-current,
header.site-header.cz-header .cz-link.is-current:hover,
header.site-header.cz-header .cz-link[aria-expanded="true"],
header.site-header.cz-header .cz-link[aria-expanded="true"]:hover {
    color: var(--cz-ink) !important;
    background: linear-gradient(
        180deg,
        var(--cz-gold-hi),
        var(--cz-gold-lo)
    ) !important;
    box-shadow:
        0 6px 14px rgba(var(--xq-accent-lo-rgb), 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.65) !important;
    transform: none;
}

/* VIP: a gold-trimmed pill with a slow shimmer */
header.site-header.cz-header .cz-link.cz-vip {
    overflow: hidden;
    color: var(--cz-gold-hi);
    background: linear-gradient(
        135deg,
        rgba(var(--xq-accent-hi-rgb), 0.22),
        rgba(var(--xq-accent-lo-rgb), 0.1)
    );
    box-shadow: inset 0 0 0 1px rgba(var(--xq-accent-rgb), 0.6);
}
header.site-header.cz-header .cz-link.cz-vip i {
    color: var(--xq-accent);
    filter: drop-shadow(0 0 6px rgba(var(--xq-accent-rgb), 0.7));
}
header.site-header.cz-header a.cz-link.cz-vip::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -60%;
    width: 40%;
    background: linear-gradient(
        100deg,
        transparent,
        rgba(255, 255, 255, 0.5),
        transparent
    );
    transform: skewX(-20deg);
    animation: czShimmer 4.5s ease-in-out infinite;
    pointer-events: none;
}
header.site-header.cz-header .cz-link.cz-vip.is-current,
header.site-header.cz-header .cz-link.cz-vip[aria-expanded="true"] {
    color: var(--cz-ink);
}
header.site-header.cz-header .cz-link.cz-vip.is-current i,
header.site-header.cz-header .cz-link.cz-vip[aria-expanded="true"] i {
    color: rgb(var(--xq-crimson-rgb));
    filter: none;
}

/* Language switcher: compact flag + code */
header.site-header.cz-header .cz-lang-toggle {
    padding: 9px 12px;
}
header.site-header.cz-header .cz-lang-toggle .fi {
    width: 1.35em;
    height: 1em;
    border-radius: 3px;
    background-size: cover;
}

/* --------------------------------------------------------------------------
   4. Actions: Chơi ngay · Đăng nhập · avatar
   -------------------------------------------------------------------------- */
header.site-header.cz-header .cz-actions {
    flex: 0 0 auto;
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0 !important;
    box-shadow: none !important;
}

header.site-header.cz-header .cz-cta {
    position: relative;
    top: 0;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.95rem;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--cz-ink);
    background: linear-gradient(
        180deg,
        rgb(var(--xq-accent-hi-rgb)),
        var(--cz-gold-lo)
    ) !important;
    border: 1px solid rgba(var(--xq-cream-rgb), 0.85);
    box-shadow:
        0 8px 20px rgba(var(--xq-accent-lo-rgb), 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.75);
    animation: czPulse 2.8s ease-out infinite;
    transition:
        transform 0.3s var(--cz-spring),
        filter 0.2s ease;
}
header.site-header.cz-header .cz-cta i {
    font-size: 1.05em;
}
header.site-header.cz-header .cz-cta:hover,
header.site-header.cz-header .cz-cta:focus-visible {
    color: var(--cz-ink);
    transform: translateY(-2px) scale(1.03);
    filter: brightness(1.05);
    animation-play-state: paused;
}
header.site-header.cz-header .cz-cta:active {
    transform: translateY(1px) scale(0.97);
}
header.site-header.cz-header .cz-cta i {
    transition: transform 0.4s var(--cz-spring);
}
header.site-header.cz-header .cz-cta:hover i {
    transform: rotate(-12deg) scale(1.15);
}

header.site-header.cz-header .cz-login {
    position: relative;
    top: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.92rem;
    white-space: nowrap;
    color: var(--cz-gold);
    background: rgba(var(--xq-surface-lo-rgb), 0.5);
    border: 1px solid rgba(var(--xq-accent-rgb), 0.7);
    box-shadow: none;
    transition:
        background 0.25s ease,
        transform 0.25s var(--cz-spring);
}
header.site-header.cz-header .cz-login:hover,
header.site-header.cz-header .cz-login:focus-visible {
    color: var(--cz-gold-hi);
    background: rgba(var(--xq-surface-lo-rgb), 0.78);
    transform: translateY(-1px);
}

/* Avatar: keep the existing ring/pulse states from index_new.css, just size it for the new bar */
header.site-header.cz-header .nav-avatar-link {
    top: 0;
    padding: 0;
}
header.site-header.cz-header .nav-avatar-link::after {
    display: none;
}
header.site-header.cz-header .nav-avatar {
    width: 40px;
    height: 40px;
}

/* --------------------------------------------------------------------------
   5. Dropdown panels
   -------------------------------------------------------------------------- */
header.site-header.cz-header .dropdown-menu {
    min-width: 280px;
    /* hang just below the header's bottom edge, whatever its (compact or full) height */
    margin: calc(var(--cz-h) / 2 - 19px + 10px) 0 0;
    padding: 0;
    overflow: visible;
    border-radius: 22px;
    background: linear-gradient(
        180deg,
        rgba(var(--xq-surface-hi-rgb), 0.985),
        rgba(var(--xq-surface-lo-rgb), 0.985)
    ) !important;
    border: 1px solid rgba(var(--xq-accent-rgb), 0.38) !important;
    border-top: 2px solid rgba(var(--xq-accent-rgb), 0.85) !important;
    box-shadow:
        0 28px 60px rgba(var(--xq-shadow-deep-rgb), 0.65),
        0 0 40px rgba(var(--xq-glow-a-rgb), 0.12) !important;
    animation: czPop 0.28s var(--cz-ease) both;
    transform-origin: top right;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}
header.site-header.cz-header .cz-lang-menu {
    min-width: 330px;
}

header.site-header.cz-header .cz-panel {
    padding: 8px;
}

/* Mega menu (Thi đấu): centred under the whole bar */
header.site-header.cz-header .cz-mega {
    left: 0;
    right: 0;
    width: min(900px, calc(100vw - 40px));
    margin: 10px auto 0;
    transform-origin: top center;
}
header.site-header.cz-header .cz-panel--mega {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px 18px;
    padding: 18px 18px 16px;
}
header.site-header.cz-header .cz-group-title {
    margin: 0 0 8px;
    padding: 2px 10px 9px;
    font-family: "Fraunces", "Texturina", serif;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--cz-gold);
    border-bottom: 1px dashed rgba(var(--xq-accent-rgb), 0.3);
}

/* Rows: icon tile + label + hint */
header.site-header.cz-header .dropdown-menu .cz-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 2px 0;
    padding: 9px 10px;
    overflow: visible;
    border: 0;
    border-radius: 14px;
    font-weight: 600;
    white-space: normal;
    text-shadow: none;
    color: var(--cz-cream) !important;
    background: transparent !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    transform: none;
    top: 0 !important;
    transition:
        background 0.2s ease,
        transform 0.25s var(--cz-ease);
}
header.site-header.cz-header .dropdown-menu .cz-item:hover,
header.site-header.cz-header .dropdown-menu .cz-item:focus {
    color: var(--cz-gold-hi) !important;
    background: rgba(var(--xq-accent-rgb), 0.13) !important;
    box-shadow: none !important;
    text-shadow: none;
    border: 0;
    transform: translateX(3px);
}
header.site-header.cz-header .dropdown-menu .cz-item.active,
header.site-header.cz-header .dropdown-menu .cz-item:active {
    color: var(--cz-gold-hi) !important;
    background: linear-gradient(
        90deg,
        rgba(var(--xq-accent-rgb), 0.26),
        rgba(var(--xq-accent-rgb), 0.08)
    ) !important;
    box-shadow: inset 0 0 0 1px rgba(var(--xq-accent-rgb), 0.55) !important;
    transform: none;
}
header.site-header.cz-header .dropdown-menu .cz-item:focus-visible {
    outline: 2px solid var(--cz-gold);
    outline-offset: -2px;
}

.cz-item-ico {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(var(--xq-accent-rgb), 0.13);
    border: 1px solid rgba(var(--xq-accent-rgb), 0.3);
    transition:
        background 0.25s ease,
        transform 0.3s var(--cz-spring),
        border-color 0.25s ease;
}
header.site-header.cz-header .dropdown-menu .cz-item-ico i {
    font-size: 1rem;
    color: var(--cz-gold) !important;
    text-shadow: none !important;
    transform: none !important;
}
header.site-header.cz-header .dropdown-menu .cz-item:hover .cz-item-ico,
header.site-header.cz-header .dropdown-menu .cz-item.active .cz-item-ico {
    background: linear-gradient(180deg, var(--cz-gold-hi), var(--cz-gold-lo));
    border-color: rgba(var(--xq-cream-rgb), 0.7);
    transform: rotate(-6deg) scale(1.06);
}
header.site-header.cz-header .dropdown-menu .cz-item:hover .cz-item-ico i,
header.site-header.cz-header .dropdown-menu .cz-item.active .cz-item-ico i {
    color: var(--cz-ink) !important;
}
.cz-item-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}
.cz-item-label {
    font-size: 0.95rem;
    font-weight: 700;
}
.cz-item-hint {
    margin-top: 1px;
    font-size: 0.76rem;
    font-weight: 500;
    color: rgba(var(--xq-highlight-rgb), 0.62);
}
header.site-header.cz-header .dropdown-menu .cz-item--ai .cz-item-ico {
    background: rgba(var(--xq-primary-light-rgb), 0.2);
    border-color: rgba(var(--xq-primary-light-rgb), 0.55);
}
header.site-header.cz-header .dropdown-menu .cz-item--ai .cz-item-ico i {
    color: #ff9c82 !important;
}
header.site-header.cz-header .dropdown-menu .cz-item--logout .cz-item-ico {
    background: rgba(var(--xq-cream-rgb), 0.07);
    border-color: rgba(var(--xq-cream-rgb), 0.2);
}

.cz-divider {
    height: 1px;
    margin: 8px 6px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(var(--xq-accent-rgb), 0.35),
        transparent
    );
}

/* Language rows: two columns of flags */
header.site-header.cz-header .cz-panel--lang {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 6px;
}
header.site-header.cz-header .dropdown-menu .cz-item--lang {
    gap: 10px;
    padding: 9px 12px;
}
header.site-header.cz-header .cz-item--lang .fi {
    width: 1.5em;
    height: 1.1em;
    flex: 0 0 auto;
    border-radius: 3px;
    background-size: cover;
}

/* Account header inside the avatar menu */
.cz-me {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 4px;
}
.cz-me-avatar {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--cz-gold);
    box-shadow: 0 0 0 3px rgba(var(--xq-accent-rgb), 0.18);
}
.cz-me-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}
.cz-me-name {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: "Fraunces", serif;
    font-size: 1.05rem;
    color: var(--cz-cream);
}
header.site-header.cz-header .cz-me-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    color: var(--cz-ink);
    background: linear-gradient(180deg, var(--cz-gold-hi), var(--cz-gold-lo));
}
header.site-header.cz-header .cz-me-badge.is-upgrade:hover {
    color: var(--cz-ink);
    filter: brightness(1.08);
}

/* --------------------------------------------------------------------------
   6. Burger + scrim (hidden on desktop)
   -------------------------------------------------------------------------- */
.cz-burger {
    display: none;
    position: relative;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 14px;
    cursor: pointer;
    color: var(--cozy-cream, var(--xq-cream));
    background: rgba(var(--xq-surface-lo-rgb), 0.4);
    border: 1px solid rgba(var(--xq-accent-rgb), 0.4);
    transition:
        background 0.25s ease,
        transform 0.25s var(--cozy-spring, ease);
    -webkit-tap-highlight-color: transparent;
}
.cz-burger:hover {
    background: rgba(var(--xq-surface-lo-rgb), 0.65);
}
.cz-burger:active {
    transform: scale(0.94);
}
.cz-burger span {
    position: absolute;
    left: 12px;
    right: 12px;
    height: 2.5px;
    border-radius: 2px;
    background: currentColor;
    transition:
        transform 0.35s var(--cozy-ease, ease),
        opacity 0.2s ease,
        top 0.35s var(--cozy-ease, ease);
}
.cz-burger span:nth-child(1) {
    top: 14px;
}
.cz-burger span:nth-child(2) {
    top: 20.75px;
}
.cz-burger span:nth-child(3) {
    top: 27.5px;
}
.cz-header.is-open .cz-burger {
    background: linear-gradient(
        180deg,
        var(--xq-accent-hi),
        var(--xq-accent-lo)
    );
    color: var(--xq-ink);
    border-color: rgba(var(--xq-cream-rgb), 0.8);
}
.cz-header.is-open .cz-burger span:nth-child(1) {
    top: 20.75px;
    transform: rotate(45deg);
}
.cz-header.is-open .cz-burger span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0.2);
}
.cz-header.is-open .cz-burger span:nth-child(3) {
    top: 20.75px;
    transform: rotate(-45deg);
}

.cz-scrim {
    display: none;
}

/* --------------------------------------------------------------------------
   7. Tablet & phone (< 1200px): sheet menu
   -------------------------------------------------------------------------- */
/* Collapsed layout: sheet menu (class set by the fit script in header.blade.php) */
header.site-header.cz-header.is-collapsed {
    --cz-h: 66px;
}
header.site-header.cz-header.is-collapsed.is-scrolled,
header.site-header.cz-header.is-collapsed.is-scrolled:hover {
    --cz-h: 58px;
}
header.site-header.cz-header.is-collapsed .cz-bar {
    gap: 12px;
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
}
header.site-header.cz-header.is-collapsed .cz-burger {
    display: inline-block;
}
header.site-header.cz-header.is-collapsed .cz-brand {
    margin-right: auto;
}
header.site-header.cz-header.is-collapsed .cz-brand img.xiangqi-logo {
    width: 40px;
    height: 40px;
}
header.site-header.cz-header.is-collapsed.is-scrolled
    .cz-brand
    img.xiangqi-logo {
    width: 36px;
    height: 36px;
}
header.site-header.cz-header.is-collapsed .cz-brand-name {
    font-size: 1.3rem;
}

/* The sheet */
header.site-header.cz-header.is-collapsed .cz-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    padding: 16px 16px max(22px, env(safe-area-inset-bottom, 0px));
    max-height: calc(100vh - var(--cz-h) - 16px);
    max-height: calc(100dvh - var(--cz-h) - 16px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 0 24px 24px;
    background:
        radial-gradient(
            400px 160px at 100% 0%,
            rgba(var(--xq-glow-a-rgb), 0.16),
            transparent 70%
        ),
        linear-gradient(
            180deg,
            rgb(var(--xq-wood-rgb)),
            rgb(var(--xq-bg-color-rgb))
        );
    border-top: 1px solid rgba(var(--xq-accent-rgb), 0.3) !important;
    box-shadow: 0 30px 50px rgba(var(--xq-shadow-deep-rgb), 0.6) !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-12px);
    transition:
        opacity 0.25s ease,
        transform 0.35s var(--cz-ease),
        visibility 0s linear 0.35s;
}
header.site-header.cz-header.is-collapsed.is-open .cz-nav {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    transition-delay: 0s;
}
header.site-header.cz-header.is-collapsed .cz-nav {
    display: block; /* undo .navbar's flex so the list can fill the sheet */
}
header.site-header.cz-header.is-collapsed .cz-menu {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
}
header.site-header.cz-header.is-collapsed .cz-menu > li {
    width: 100%;
}
header.site-header.cz-header.is-collapsed .cz-menu > li.cz-has-mega {
    position: relative;
}
header.site-header.cz-header.is-collapsed .cz-link {
    width: 100%;
    padding: 14px 16px;
    font-size: 1.02rem;
    border-radius: 16px;
    background: rgba(var(--xq-cream-rgb), 0.07);
    border: 1px solid rgba(var(--xq-accent-rgb), 0.16);
}
header.site-header.cz-header.is-collapsed .cz-link.dropdown-toggle::after {
    margin-left: auto;
}
header.site-header.cz-header.is-collapsed .cz-link.cz-vip {
    background: linear-gradient(
        135deg,
        rgba(var(--xq-accent-hi-rgb), 0.22),
        rgba(var(--xq-accent-lo-rgb), 0.1)
    );
    border-color: rgba(var(--xq-accent-rgb), 0.6);
}

/* Dropdowns become accordions inside the sheet */
header.site-header.cz-header.is-collapsed .cz-menu .dropdown-menu,
header.site-header.cz-header.is-collapsed .cz-menu .cz-mega {
    position: static !important;
    transform: none !important;
    inset: auto !important;
    float: none;
    width: auto;
    min-width: 0;
    margin: 6px 0 0;
    border-radius: 18px;
    background: rgba(var(--xq-shadow-rgb), 0.38) !important;
    border: 1px solid rgba(var(--xq-accent-rgb), 0.2) !important;
    border-top: 1px solid rgba(var(--xq-accent-rgb), 0.2) !important;
    box-shadow: none !important;
    animation: czExpand 0.28s var(--cz-ease) both;
}
header.site-header.cz-header.is-collapsed .cz-panel--mega {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px;
}
header.site-header.cz-header.is-collapsed .cz-group + .cz-group {
    margin-top: 8px;
}
header.site-header.cz-header.is-collapsed .dropdown-menu .cz-item {
    padding: 11px 10px;
}
header.site-header.cz-header.is-collapsed .dropdown-menu .cz-item:hover,
header.site-header.cz-header.is-collapsed .dropdown-menu .cz-item:focus {
    transform: none;
}
header.site-header.cz-header.is-collapsed .cz-lang-toggle {
    padding: 14px 16px;
}
header.site-header.cz-header.is-collapsed .cz-lang-toggle .fi {
    width: 1.5em;
}
header.site-header.cz-header.is-collapsed .cz-lang-menu {
    min-width: 0;
}
header.site-header.cz-header.is-collapsed .cz-panel--lang {
    padding: 8px;
}

/* The avatar menu still floats from the bar's right edge */
header.site-header.cz-header.is-collapsed .cz-user .dropdown-menu {
    position: absolute !important;
    top: 100%;
    left: auto !important;
    right: 0 !important;
    transform: none !important;
    width: min(300px, calc(100vw - 28px));
    margin-top: calc(var(--cz-h) / 2 - 20px + 10px);
    border-radius: 22px;
    background: linear-gradient(
        180deg,
        rgba(var(--xq-surface-hi-rgb), 0.985),
        rgba(var(--xq-surface-lo-rgb), 0.985)
    ) !important;
    border: 1px solid rgba(var(--xq-accent-rgb), 0.38) !important;
    border-top: 2px solid rgba(var(--xq-accent-rgb), 0.85) !important;
    box-shadow: 0 28px 60px rgba(var(--xq-shadow-deep-rgb), 0.65) !important;
    animation: czPop 0.28s var(--cz-ease) both;
}

/* Dimmed backdrop behind the open sheet */
header.site-header.cz-header.is-collapsed ~ .cz-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(var(--xq-shadow-rgb), 0.62);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.3s ease,
        visibility 0s linear 0.3s;
}
.cz-header.is-open ~ .cz-scrim {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

/* --------------------------------------------------------------------------
   7b. Fit tiers (set by the fit script in header.blade.php)
   The script measures the real width of the bar in every language and picks:
     (none)        everything fits  -> full rail with icons and tagline
     .is-tight     almost fits      -> hide tagline + link icons, trim padding
     .is-collapsed still too wide   -> burger + sheet menu (section 7)
   Long labels (Wettkampf, Соревнование, Jouer maintenant…) therefore never
   wrap or overflow; they simply move to the next tier earlier.
   -------------------------------------------------------------------------- */
header.site-header.cz-header.is-tight .cz-bar {
    gap: 12px;
}
/* header.site-header.cz-header.is-tight .cz-brand-tag {
    display: none;
} */
header.site-header.cz-header.is-tight .cz-link {
    padding: 9px 12px;
    gap: 6px;
    font-size: 0.9rem;
}
header.site-header.cz-header.is-tight .cz-link > i {
    display: none;
}
header.site-header.cz-header.is-tight .cz-lang-toggle {
    padding: 9px 10px;
}
header.site-header.cz-header.is-tight .cz-actions {
    gap: 8px;
}
header.site-header.cz-header.is-tight .cz-cta {
    padding: 10px 15px;
}
header.site-header.cz-header.is-tight .cz-login {
    padding: 9px 14px;
}

header.site-header.cz-header.is-fitting,
header.site-header.cz-header.is-fitting * {
    transition: none !important;
}

/* Language switcher: short code in the rail, full name in the sheet */
header.site-header.cz-header .cz-lang-label {
    display: none;
}
header.site-header.cz-header.is-collapsed .cz-lang-code {
    display: none;
}
header.site-header.cz-header.is-collapsed .cz-lang-label {
    display: inline;
}

/* Collapsed bar: the brand and the buttons may shrink and truncate with an
   ellipsis instead of pushing each other off-screen (any language, any width). */
header.site-header.cz-header.is-collapsed .cz-burger {
    flex-shrink: 0;
}
header.site-header.cz-header.is-collapsed .cz-brand {
    flex: 0 1 auto;
    min-width: 0;
}
header.site-header.cz-header.is-collapsed .cz-brand-text {
    min-width: 0;
    overflow: hidden;
}
header.site-header.cz-header.is-collapsed .cz-brand-name,
header.site-header.cz-header.is-collapsed .cz-brand-tag {
    overflow: hidden;
    text-overflow: ellipsis;
}
header.site-header.cz-header.is-collapsed .cz-actions {
    flex: 0 1 auto;
    min-width: 0;
}
header.site-header.cz-header.is-collapsed .cz-cta,
header.site-header.cz-header.is-collapsed .cz-login {
    min-width: 0;
    max-width: 100%;
}
header.site-header.cz-header.is-collapsed .cz-cta-text,
header.site-header.cz-header.is-collapsed .cz-login-text {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(11rem, 30vw);
}
/* The tagline is the first thing to go when the collapsed bar gets narrow */
@media (max-width: 767.98px) {
    header.site-header.cz-header.is-collapsed .cz-cta-text,
    header.site-header.cz-header.is-collapsed .cz-login-text,
    header.site-header.cz-header.is-collapsed .cz-brand-tag {
        display: none;
    }
    header.site-header.cz-header.is-collapsed .cz-cta,
    header.site-header.cz-header.is-collapsed .cz-login {
        width: 42px;
        height: 42px;
        padding: 0;
        justify-content: center;
        display: flex;
    }
}
/* Touch targets in the sheet stay comfortable and hover/focus keep their tint
   (the collapsed rules above are a class more specific than the base hover). */
header.site-header.cz-header.is-collapsed .cz-link:hover,
header.site-header.cz-header.is-collapsed .cz-link:focus-visible {
    color: var(--cz-gold);
    background: rgba(var(--xq-accent-rgb), 0.16);
    transform: none;
}
header.site-header.cz-header.is-collapsed .cz-link {
    min-height: 48px;
    overflow-wrap: anywhere;
}
header.site-header.cz-header.is-collapsed .dropdown-menu .cz-item {
    min-height: 48px;
}
/* Rail dropdowns can never be wider than the viewport */
header.site-header.cz-header:not(.is-collapsed) .dropdown-menu {
    max-width: calc(100vw - 24px);
}
header.site-header.cz-header .cz-item-label,
header.site-header.cz-header .cz-item-hint {
    overflow-wrap: anywhere;
}

/* Phones */
@media (max-width: 575.98px) {
    header.site-header.cz-header.is-collapsed {
        border-radius: 0 0 18px 18px;
    }
    header.site-header.cz-header.is-collapsed .cz-bar {
        gap: 10px;
    }
    header.site-header.cz-header.is-collapsed .cz-brand-tag {
        display: none;
    }
    header.site-header.cz-header.is-collapsed .cz-brand {
        gap: 9px;
    }
    header.site-header.cz-header.is-collapsed .cz-actions {
        gap: 8px;
    }
    header.site-header.cz-header.is-collapsed .cz-cta {
        padding: 11px 15px;
    }
    header.site-header.cz-header.is-collapsed .cz-login {
        padding: 11px 13px;
    }
    header.site-header.cz-header.is-collapsed .cz-login-text {
        display: none;
    }
    header.site-header.cz-header.is-collapsed .nav-avatar {
        width: 38px;
        height: 38px;
    }
    header.site-header.cz-header.is-collapsed .cz-nav {
        padding-left: 12px;
        padding-right: 12px;
    }
    header.site-header.cz-header.is-collapsed .cz-panel--lang {
        grid-template-columns: 1fr 1fr;
    }
}
/* Very narrow phones: the play button collapses to an icon so the brand never gets squeezed */
@media (max-width: 449.98px) {
    header.site-header.cz-header.is-collapsed .cz-cta-text,
    header.site-header.cz-header.is-collapsed .cz-brand-text {
        display: none;
    }
    header.site-header.cz-header.is-collapsed .cz-cta {
        width: 42px;
        height: 42px;
        padding: 0;
        justify-content: center;
    }
    header.site-header.cz-header.is-collapsed .cz-brand-name {
        font-size: 1.18rem;
    }
}
@media (max-width: 359.98px) {
    header.site-header.cz-header.is-collapsed .cz-brand-name {
        display: none;
    }
}

/* --------------------------------------------------------------------------
   8. Motion
   -------------------------------------------------------------------------- */
@keyframes czDrop {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
@keyframes czPop {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
@keyframes czExpand {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
@keyframes czThread {
    from {
        background-position: 0% 0;
    }
    to {
        background-position: 200% 0;
    }
}
@keyframes czLantern {
    from {
        box-shadow:
            0 0 0 2px rgba(var(--xq-sheen-rgb), 0.7),
            0 0 12px rgba(var(--xq-glow-rgb), 0.4),
            0 6px 14px rgba(var(--xq-shadow-rgb), 0.5);
    }
    to {
        box-shadow:
            0 0 0 2px rgba(var(--xq-sheen-rgb), 0.85),
            0 0 26px rgba(var(--xq-glow-rgb), 0.8),
            0 6px 14px rgba(var(--xq-shadow-rgb), 0.5);
    }
}
@keyframes czPulse {
    0% {
        box-shadow:
            0 8px 20px rgba(var(--xq-accent-lo-rgb), 0.42),
            inset 0 1px 0 rgba(255, 255, 255, 0.75),
            0 0 0 0 rgba(var(--xq-accent-rgb), 0.55);
    }
    70% {
        box-shadow:
            0 8px 20px rgba(var(--xq-accent-lo-rgb), 0.42),
            inset 0 1px 0 rgba(255, 255, 255, 0.75),
            0 0 0 14px rgba(var(--xq-accent-rgb), 0);
    }
    100% {
        box-shadow:
            0 8px 20px rgba(var(--xq-accent-lo-rgb), 0.42),
            inset 0 1px 0 rgba(255, 255, 255, 0.75),
            0 0 0 0 rgba(var(--xq-accent-rgb), 0);
    }
}
@keyframes czShimmer {
    0%,
    55% {
        left: -60%;
    }
    100% {
        left: 140%;
    }
}

@media (prefers-reduced-motion: reduce) {
    header.site-header.cz-header,
    header.site-header.cz-header::after,
    header.site-header.cz-header .cz-brand img.xiangqi-logo,
    header.site-header.cz-header .cz-cta,
    header.site-header.cz-header a.cz-link.cz-vip::before,
    header.site-header.cz-header .dropdown-menu,
    header.site-header.cz-header .cz-menu .dropdown-menu {
        animation: none !important;
    }
    header.site-header.cz-header .cz-nav,
    .cz-burger span,
    .cz-scrim {
        transition: none !important;
    }
}
@media (prefers-reduced-transparency: reduce) {
    header.site-header.cz-header,
    .cz-scrim {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

/* ##########################################################################
   SOURCE: ads-cozy.css
   ########################################################################## */

/* ==========================================================================
   ADS COZY — understated, policy-safe AdSense slots (top / between / bottom)
   Load AFTER theme-cozy.css:
     <link href="{{ asset('css/ads-cozy.css?v=3') }}" rel="stylesheet">

   Design notes (AdSense policy friendly)
   - The ad unit is never covered, cropped, animated or restyled.
   - Calm, neutral frame: no glow, no pulse, no hover effects, no entrance animation.
   - A plain, readable "Quảng cáo" label separates ads from content.
   - Space is reserved with min-height so late ad fills do not shift layout.
   - Unfilled slots collapse automatically.
   ========================================================================== */

.ad-slot {
    --ad-border: rgba(var(--xq-accent-rgb), 0.35);
    --ad-surface: rgba(var(--xq-surface-lo-rgb), 0.55);
    --ad-label-ink: var(--cozy-cream, var(--xq-cream));
    --ad-radius: var(--cozy-radius, 18px);
    --ad-gap: clamp(0.75rem, 2.2vw, 1.5rem);
    --ad-pad: clamp(0.5rem, 1.6vw, 0.9rem);
}

.ad-slot {
    position: relative;
    display: block;
    width: 100%;
    max-width: 1200px;
    margin: var(--ad-gap) auto;
    padding: 0 clamp(0.5rem, 2vw, 1rem);
    box-sizing: border-box;
    text-align: center;
    contain: layout style;
    z-index: 1;
}
.ad-slot *,
.ad-slot *::before,
.ad-slot *::after {
    box-sizing: border-box;
}

.ad-slot--top {
    max-width: 100%;
    margin-top: 0;
    margin-bottom: 0;
    padding: 0.4rem clamp(0.5rem, 2vw, 1rem) 0.5rem;
}
.ad-slot--between {
    margin-top: clamp(1.5rem, 4vw, 3rem);
    margin-bottom: clamp(1.5rem, 4vw, 3rem);
}
.ad-slot--bottom {
    margin-top: var(--ad-gap);
    margin-bottom: 0;
}

.ad-slot__frame {
    position: relative;
    padding: calc(var(--ad-pad) + 0.55rem) var(--ad-pad) var(--ad-pad);
    border-radius: var(--ad-radius);
    border: 1px solid var(--ad-border);
    background: var(--ad-surface);
}
.ad-slot--top .ad-slot__frame {
    border-radius: 0 0 var(--ad-radius) var(--ad-radius);
}

.ad-slot__label {
    position: absolute;
    top: 0;
    left: 50%;
    z-index: 2;
    display: inline-block;
    max-width: calc(100% - 1.5rem);
    padding: 0.15em 0.8em 0.2em;
    transform: translate(-50%, -50%);
    border-radius: 999px;
    border: 1px solid var(--ad-border);
    background: rgb(var(--xq-surface-hi-rgb));
    color: var(--ad-label-ink);
    font-family: "Plus Jakarta Sans", "Lexend Deca", system-ui, sans-serif;
    font-size: clamp(0.62rem, 1.6vw, 0.72rem);
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1.4;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    user-select: none;
}

.ad-slot__body {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100px;
    overflow: visible;
}
.ad-slot--top .ad-slot__body {
    min-height: 90px;
}
.ad-slot--between .ad-slot__body {
    min-height: 250px;
}
.ad-slot--bottom .ad-slot__body {
    min-height: 120px;
}

.ad-slot .adsbygoogle {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: transparent;
}

.ad-slot:has(ins.adsbygoogle[data-ad-status="unfilled"]) {
    display: none;
}

@media (max-width: 767.98px) {
    .ad-slot__frame {
        border-radius: 14px;
    }
    .ad-slot--top .ad-slot__frame {
        border-radius: 0 0 14px 14px;
    }
    .ad-slot--between .ad-slot__body {
        min-height: 280px;
    }
}
@media (max-width: 575.98px) {
    .ad-slot {
        padding-left: 0.375rem;
        padding-right: 0.375rem;
    }
    .ad-slot__frame {
        padding: calc(var(--ad-pad) + 0.5rem) 0.35rem 0.4rem;
    }
    .ad-slot--top .ad-slot__body {
        min-height: 60px;
    }
    .ad-slot--bottom .ad-slot__body {
        min-height: 100px;
    }
}
@media (min-width: 992px) {
    .ad-slot {
        max-width: 1100px;
    }
    .ad-slot--top {
        max-width: 100%;
    }
}
@media (min-width: 1400px) {
    .ad-slot--between,
    .ad-slot--bottom {
        max-width: 1240px;
    }
}
@media (max-height: 480px) and (orientation: landscape) {
    .ad-slot--between {
        margin-top: 1rem;
        margin-bottom: 1rem;
    }
    .ad-slot--between .ad-slot__body {
        min-height: 120px;
    }
}

@media (prefers-contrast: more) {
    .ad-slot__frame {
        background: rgb(var(--xq-surface-lo-rgb));
        border: 2px solid var(--xq-accent);
    }
    .ad-slot__label {
        border-color: var(--xq-accent);
    }
}
@media print {
    .ad-slot {
        display: none !important;
    }
}

/* ##########################################################################
   SOURCE: ban-co.css
   ########################################################################## */

/* ==========================================================================
   BAN-CO.CSS — styles for the Xiangqi board container (#ban-co)
   Load AFTER index_new.css and themes.css (colours come from the
   html[data-board-theme] / html[data-pieces-theme] tokens in themes.css):
   <link href="{{ asset('css/ban-co.css?v=7') }}" rel="stylesheet">
   ========================================================================== */

/* --------------------------------------------------------------------------
   Board container
   -------------------------------------------------------------------------- */
#ban-co {
    /* touch-action: none !important; */
    pointer-events: all;
    width: 100%;
    max-width: 380px;
    margin: 0 auto 15px !important;
    padding: 10px;
    background-color: var(--xq-board-shell);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    /* Stunning layered shadow: gilded rim, contact shadow, deep ambient
       shadow, soft golden aura and an inner bevel (top light / bottom dark). */
    box-shadow:
        0 0 0 1px rgba(var(--xq-rim-rgb), 0.55),
        0 0 0 4px color-mix(in srgb, var(--xq-board-shell) 90%, transparent),
        0 0 0 5px rgba(var(--xq-rim-rgb), 0.25),
        0 2px 4px rgba(0, 0, 0, 0.5),
        0 8px 16px rgba(0, 0, 0, 0.45),
        0 24px 48px rgba(0, 0, 0, 0.55),
        0 48px 96px rgba(0, 0, 0, 0.6),
        0 0 60px rgba(var(--xq-rim-rgb), 0.22),
        0 0 120px rgba(var(--xq-rim-aura-rgb), 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        inset 0 -2px 6px rgba(0, 0, 0, 0.45),
        inset 0 0 24px rgba(var(--xq-rim-rgb), 0.08) !important;
    transition:
        transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        box-shadow 0.4s ease;

    /* The board itself uses the normal arrow */
    cursor: default;
}

#ban-co:hover {
    transform: translateY(-2px) scale(1.005);
    box-shadow:
        0 0 0 1px rgba(var(--xq-accent-hi-rgb), 0.9),
        0 0 0 4px color-mix(in srgb, var(--xq-board-shell) 90%, transparent),
        0 0 0 5px rgba(var(--xq-rim-rgb), 0.45),
        0 4px 8px rgba(0, 0, 0, 0.5),
        0 14px 28px rgba(0, 0, 0, 0.5),
        0 36px 72px rgba(0, 0, 0, 0.6),
        0 64px 120px rgba(0, 0, 0, 0.65),
        0 0 80px rgba(var(--xq-rim-rgb), 0.38),
        0 0 160px rgba(var(--xq-rim-aura-rgb), 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        inset 0 -2px 6px rgba(0, 0, 0, 0.45),
        inset 0 0 32px rgba(var(--xq-rim-rgb), 0.12) !important;
}

/* Board with coordinate notation */
#ban-co:has(.notation-8c7a2) {
    padding: 25px 5px !important;
    /* frame colour follows the active board (--xq-notation-bg, themes.css) */
    background: var(--xq-notation-bg) !important;
}
#ban-co:has(.notation-8c7a2):has(.spare-pieces-9e77b) {
    padding: 5px !important;
}

body.setup #ban-co {
    max-width: 310px !important;
}

/* --------------------------------------------------------------------------
   Cursors
   Board, squares, rows and notation: default arrow.
   Chess pieces: pointer (hand).
   Squares have pointer-events: none (see index_new.css), so only the piece
   images receive the mouse; everything else falls through to #ban-co.
   -------------------------------------------------------------------------- */
#ban-co,
#ban-co .board-1ef78,
#ban-co .row-cb702,
#ban-co .square-2b8ce,
#ban-co .notation-8c7a2,
#ban-co .alpha-f4ef2,
#ban-co .numeric-fe76e,
#ban-co .clearfix-5f3b5 {
    cursor: default !important;
}

#ban-co .piece-1e8b9,
#ban-co .square-2b8ce img,
#ban-co .square-2b8ce:hover img,
#ban-co .square-2b8ce.click-target img,
#ban-co .square-2b8ce.click-target:hover img,
#ban-co .spare-pieces-top-e4b47 img,
#ban-co .spare-pieces-bottom-29dac img {
    cursor: pointer !important;
}

/* Piece being dragged (chessboard.js appends the clone to <body>) */
img.piece-1e8b9 {
    cursor: pointer;
}

/* --------------------------------------------------------------------------
   Board internals
   -------------------------------------------------------------------------- */
#ban-co .board-1ef78 {
    box-sizing: content-box;
    margin: auto;
    pointer-events: none !important;
}

#ban-co .square-2b8ce {
    float: left;
    position: relative;
    pointer-events: none !important;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
#ban-co .square-2b8ce img {
    pointer-events: all !important;
}
#ban-co .square-2b8ce:hover {
    z-index: 2;
}
/* Piece hover effects: layouts/partials/boardClickInteraction.blade.php */

/* Coordinate notation */
#ban-co .notation-8c7a2 {
    position: absolute;
    font-family:
        "Plus Jakarta Sans", "Noto Sans JP", "Noto Sans KR", "Noto Sans SC",
        sans-serif;
    font-size: 14px;
    color: var(--xq-notation-ink) !important;
    text-shadow: var(--xq-notation-shadow);
}
#ban-co .alpha-f4ef2 {
    bottom: 1px;
    right: 40%;
}
#ban-co .numeric-fe76e {
    top: 40%;
    left: 1px;
}
#ban-co .row-cb702:first-of-type .square-2b8ce .notation-8c7a2 {
    top: -21px !important;
    bottom: auto !important;
}
#ban-co .row-cb702:last-of-type .square-2b8ce .notation-8c7a2 {
    bottom: -21px !important;
    top: auto !important;
}

/* Spare pieces (setup page) */
#ban-co .spare-pieces-top-e4b47 {
    margin-bottom: 21px !important;
}
#ban-co .spare-pieces-bottom-29dac {
    margin-top: 21px !important;
}

/* Pieces theme: zero-specificity, so hover / selection filters set elsewhere
   (boardClickInteraction.blade.php) always win. Values: themes.css section 1. */
:where(#ban-co .piece-1e8b9),
:where(img.piece-1e8b9) {
    filter: var(--xq-piece-filter, none);
}

/* Highlights */
#ban-co .highlight1-e13fc,
#ban-co .highlight2-e0a03 {
    box-shadow: inset 0 0 3px 3px var(--royal-gold);
    background: rgba(var(--xq-metal-rgb), 0.2);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
    #ban-co {
        height: auto !important;
    }
}
@media screen and (max-width: 380px) {
    #ban-co {
        width: calc(100% - 15px) !important;
    }
}

/* ##########################################################################
   SOURCE: themes.css
   ########################################################################## */

/* ==========================================================================
   themes.css — single source of truth for the site's look.
   Loaded from resources/views/layouts/partials/themeSelector.blade.php, but it
   MUST ALSO be linked in <head> on every page, right after index_new.css:
     <link href="{{ asset('css/themes.css?v=2') }}" rel="stylesheet">
   (theme-cozy.css, header-cozy.css, ads-cozy.css and ban-co.css read the
   tokens defined here.)
   Markup:  resources/views/layouts/partials/themeSelector.blade.php
   Bundles: config/xq_themes.php   Names: resources/lang/{locale}/themes.php

   There is no dark / light mode any more. The look follows two attributes on
   <html>, written by themes.blade.php + theme-manager.js:
     data-board-theme   banco-cozy | banco-wood | banco-gold | banco-floral
                        -> page palette, header, ads, board frame, effects
     data-pieces-theme  piece set -> piece rendering tokens (section 1)
   With no attribute the cozy values apply (:root fallback).
   ========================================================================== */

/* ==========================================================================
   1. PIECES THEME TOKENS (html[data-pieces-theme])
   Applied with zero specificity (see ban-co.css), so board hover/selection
   effects always win. Set --xq-piece-filter to "none" to disable.
   NOTE: the attribute values below follow the bundle ids in
   config/xq_themes.php (default / floral / golden / wooden). If
   theme-manager.js writes different values, rename the selectors here.
   ========================================================================== */
:root,
html[data-pieces-theme="default"] {
    --xq-piece-filter: drop-shadow(0 2px 3px rgba(var(--xq-shadow-rgb), 0.55));
    --xq-tb-piece-shadow: rgba(var(--xq-shadow-deep-rgb), 0.8);
}
html[data-pieces-theme="floral"] {
    --xq-piece-filter: drop-shadow(0 2px 3px rgba(var(--xq-shadow-rgb), 0.5))
        drop-shadow(0 0 4px rgba(var(--xq-fx-glow-rgb), 0.35));
    --xq-tb-piece-shadow: rgba(var(--xq-shadow-rgb), 0.7);
}
html[data-pieces-theme="golden"] {
    --xq-piece-filter: drop-shadow(
            0 2px 3px rgba(var(--xq-shadow-deep-rgb), 0.7)
        )
        drop-shadow(0 0 5px rgba(var(--xq-rim-rgb), 0.35));
    --xq-tb-piece-shadow: rgba(var(--xq-shadow-deep-rgb), 0.9);
}
html[data-pieces-theme="wooden"] {
    --xq-piece-filter: drop-shadow(0 3px 3px rgba(var(--xq-shadow-rgb), 0.6));
    --xq-tb-piece-shadow: rgba(var(--xq-shadow-rgb), 0.75);
}

/* ==========================================================================
   2. PER-BOARD TOKENS — palette + interaction effects, one block per board
   Every colour on the site is read from these variables, so a theme is
   restyled here and nowhere else.
     PAGE PALETTE   --xq-<name> (#hex) and --xq-<name>-rgb (r, g, b) pairs;
                    use var(--xq-accent) or rgba(var(--xq-accent-rgb), .3).
     BOARD FRAME    --xq-board-shell, --xq-notation-bg / -ink / -shadow
     EFFECTS        hover, selection, legal-move, capture and last-move rules
                    (layouts/partials/boardClickInteraction.blade.php and
                    puzzle.blade.php) only read the --xq-fx-* / --xq-arrow-* set.
     --xq-fx-mark  legal-move marker      --xq-fx-aura  ring around a hovered piece
     --xq-fx-lock  ring around a capture
   Cozy   : honey pearl + lantern ring     Floral : blossom + orbiting petals
   Golden : ruby gem + sunburst            Wooden : jade disc + cinnabar lock-on
   Unknown / legacy boards fall back to the cozy set.
   ========================================================================== */

:root,
html[data-board-theme="banco-cozy"] {
    /* --- page palette --- */
    --xq-accent: #ffc861;
    --xq-accent-rgb: 255, 200, 97;
    --xq-accent-hi: #ffd98a;
    --xq-accent-hi-rgb: 255, 217, 138;
    --xq-accent-lo: #f0a93e;
    --xq-accent-lo-rgb: 240, 169, 62;
    --xq-glow: #ffbe5a;
    --xq-glow-rgb: 255, 190, 90;
    --xq-glow-a: #ffaa46;
    --xq-glow-a-rgb: 255, 170, 70;
    --xq-ember: #ff8a4c;
    --xq-ember-rgb: 255, 138, 76;
    --xq-highlight: #fff1d6;
    --xq-highlight-rgb: 255, 241, 214;
    --xq-sheen: #ffecc8;
    --xq-sheen-rgb: 255, 236, 200;
    --xq-primary: #a8402c;
    --xq-primary-rgb: 168, 64, 44;
    --xq-primary-mid: #b4422e;
    --xq-primary-mid-rgb: 180, 66, 46;
    --xq-primary-dark: #c4513a;
    --xq-primary-dark-rgb: 196, 81, 58;
    --xq-primary-light: #ee7a5f;
    --xq-primary-light-rgb: 238, 122, 95;
    --xq-surface: #2e1a13;
    --xq-surface-rgb: 46, 26, 19;
    --xq-surface-hi: #3e2219;
    --xq-surface-hi-rgb: 62, 34, 25;
    --xq-surface-lo: #25130d;
    --xq-surface-lo-rgb: 37, 19, 13;
    --xq-surface-deep: #1f110c;
    --xq-surface-deep-rgb: 31, 17, 12;
    --xq-shadow: #120704;
    --xq-shadow-rgb: 18, 7, 4;
    --xq-shadow-deep: #0a0402;
    --xq-shadow-deep-rgb: 10, 4, 2;
    --xq-wood: #6b3a22;
    --xq-wood-rgb: 107, 58, 34;
    --xq-cream: #fff6e4;
    --xq-cream-rgb: 255, 246, 228;
    --xq-paper: #f7e7c6;
    --xq-paper-rgb: 247, 231, 198;
    --xq-ink: #3a1f14;
    --xq-ink-rgb: 58, 31, 20;
    --xq-bg-color: #3b1d14;
    --xq-bg-color-rgb: 59, 29, 20;
    --xq-rim: #ffd700;
    --xq-rim-rgb: 255, 215, 0;
    --xq-rim-aura: #ffaa00;
    --xq-rim-aura-rgb: 255, 170, 0;
    --xq-metal: #d4af37;
    --xq-metal-rgb: 212, 175, 55;
    --xq-crimson: #8a1515;
    --xq-crimson-rgb: 138, 21, 21;
    --xq-board-shell: #252a36;
    --xq-notation-bg: #e0c088;
    --xq-notation-ink: #4a2615;
    --xq-notation-shadow: none;

    /* --- body background pattern (SVG, base64; colours baked per board) --- */
    --xq-body-pattern: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI4MCIgaGVpZ2h0PSI4MCIgdmlld0JveD0iMCAwIDgwIDgwIj48cGF0aCBkPSJNMCA0MEw0MCAwTDgwIDQwTDQwIDgwWiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZjODYxIiBzdHJva2Utb3BhY2l0eT0iLjExIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNMjAgNDBMNDAgMjBMNjAgNDBMNDAgNjBaIiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmM4NjEiIHN0cm9rZS1vcGFjaXR5PSIuMDciIHN0cm9rZS13aWR0aD0iMSIvPjxjaXJjbGUgY3g9IjQwIiBjeT0iNDAiIHI9IjIuMiIgZmlsbD0iI2ZmZDk4YSIgZmlsbC1vcGFjaXR5PSIuMiIvPjxnIGZpbGw9IiNmZmM4NjEiIGZpbGwtb3BhY2l0eT0iLjE2Ij48Y2lyY2xlIGN4PSIwIiBjeT0iMCIgcj0iMS44Ii8+PGNpcmNsZSBjeD0iODAiIGN5PSIwIiByPSIxLjgiLz48Y2lyY2xlIGN4PSIwIiBjeT0iODAiIHI9IjEuOCIvPjxjaXJjbGUgY3g9IjgwIiBjeT0iODAiIHI9IjEuOCIvPjwvZz48L3N2Zz4=");
    --xq-body-pattern-size: 80px 80px;

    /* --- hover / selection / hint-arrow effects --- */
    --xq-fx-hi: #fff1d0;
    --xq-fx-main: #ffc04f;
    --xq-fx-deep: #6b2a10;
    --xq-fx-glow-rgb: 255, 178, 70;
    --xq-fx-capture-rgb: 255, 86, 40;
    --xq-arrow-red-1: #fff1d6;
    --xq-arrow-red-2: #ffc861;
    --xq-arrow-red-3: #d9822a;
    --xq-arrow-red-edge: #8f2f1c;
    --xq-arrow-black-1: #b79a86;
    --xq-arrow-black-2: #5e3a29;
    --xq-arrow-black-3: #22100a;
    --xq-arrow-black-edge: #ffc861;
    --xq-fx-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3CradialGradient id='g' cx='.35' cy='.3' r='.75'%3E%3Cstop offset='0' stop-color='%23fff'/%3E%3Cstop offset='0.25' stop-color='%23fff0c9'/%3E%3Cstop offset='0.65' stop-color='%23ffbe4d'/%3E%3Cstop offset='1' stop-color='%23d2701f'/%3E%3C/radialGradient%3E%3Ccircle cx='50' cy='50' r='38' fill='%234a1c0a' opacity='.55'/%3E%3Ccircle cx='50' cy='50' r='33' fill='%23fff8e6'/%3E%3Ccircle cx='50' cy='50' r='26' fill='url(%23g)'/%3E%3C/svg%3E");
    --xq-fx-aura: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='45' fill='none' stroke='%235a230c' stroke-width='7' stroke-linecap='round' stroke-dasharray='46.65 24.03' transform='rotate(0 50 50)'/%3E%3Ccircle cx='50' cy='50' r='45' fill='none' stroke='%23ffc861' stroke-width='4' stroke-linecap='round' stroke-dasharray='46.65 24.03' transform='rotate(0 50 50)'/%3E%3Ccircle cx='50' cy='50' r='45' fill='none' stroke='%23fff4d6' stroke-width='1.4' stroke-linecap='round' stroke-dasharray='35.34 35.34' transform='rotate(8 50 50)'/%3E%3Cg transform='rotate(-15 50 50)'%3E%3Ccircle cx='50' cy='5' r='3.6' fill='%23fff4d6' stroke='%23c4441f' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(75 50 50)'%3E%3Ccircle cx='50' cy='5' r='3.6' fill='%23fff4d6' stroke='%23c4441f' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(165 50 50)'%3E%3Ccircle cx='50' cy='5' r='3.6' fill='%23fff4d6' stroke='%23c4441f' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(255 50 50)'%3E%3Ccircle cx='50' cy='5' r='3.6' fill='%23fff4d6' stroke='%23c4441f' stroke-width='1.6'/%3E%3C/g%3E%3C/svg%3E");
    --xq-fx-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='44' fill='none' stroke='%233f1207' stroke-width='9' stroke-linecap='round' stroke-dasharray='42.85 26.26' transform='rotate(14 50 50)'/%3E%3Ccircle cx='50' cy='50' r='44' fill='none' stroke='%23ff5a2c' stroke-width='5.5' stroke-linecap='round' stroke-dasharray='42.85 26.26' transform='rotate(14 50 50)'/%3E%3Cg transform='rotate(0 50 50)'%3E%3Cpath d='M50 17 L43 2 H57 Z' fill='%23ffd27a' stroke='%237a1d0a' stroke-width='2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(90 50 50)'%3E%3Cpath d='M50 17 L43 2 H57 Z' fill='%23ffd27a' stroke='%237a1d0a' stroke-width='2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(180 50 50)'%3E%3Cpath d='M50 17 L43 2 H57 Z' fill='%23ffd27a' stroke='%237a1d0a' stroke-width='2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(270 50 50)'%3E%3Cpath d='M50 17 L43 2 H57 Z' fill='%23ffd27a' stroke='%237a1d0a' stroke-width='2' stroke-linejoin='round'/%3E%3C/g%3E%3C/svg%3E");
}

html[data-board-theme="banco-floral"] {
    /* --- page palette --- */
    --xq-accent: #ffb3cf;
    --xq-accent-rgb: 255, 179, 207;
    --xq-accent-hi: #ffd2e1;
    --xq-accent-hi-rgb: 255, 210, 225;
    --xq-accent-lo: #f06a9b;
    --xq-accent-lo-rgb: 240, 106, 155;
    --xq-glow: #ff96be;
    --xq-glow-rgb: 255, 150, 190;
    --xq-glow-a: #ff7eab;
    --xq-glow-a-rgb: 255, 126, 171;
    --xq-ember: #ff7eab;
    --xq-ember-rgb: 255, 126, 171;
    --xq-highlight: #fff0f5;
    --xq-highlight-rgb: 255, 240, 245;
    --xq-sheen: #ffe4ee;
    --xq-sheen-rgb: 255, 228, 238;
    --xq-primary: #b02c60;
    --xq-primary-rgb: 176, 44, 96;
    --xq-primary-mid: #be346a;
    --xq-primary-mid-rgb: 190, 52, 106;
    --xq-primary-dark: #ce4078;
    --xq-primary-dark-rgb: 206, 64, 120;
    --xq-primary-light: #ff82ae;
    --xq-primary-light-rgb: 255, 130, 174;
    --xq-surface: #16281f;
    --xq-surface-rgb: 22, 40, 31;
    --xq-surface-hi: #1f3a2d;
    --xq-surface-hi-rgb: 31, 58, 45;
    --xq-surface-lo: #112018;
    --xq-surface-lo-rgb: 17, 32, 24;
    --xq-surface-deep: #0c1812;
    --xq-surface-deep-rgb: 12, 24, 18;
    --xq-shadow: #040e09;
    --xq-shadow-rgb: 4, 14, 9;
    --xq-shadow-deep: #020805;
    --xq-shadow-deep-rgb: 2, 8, 5;
    --xq-wood: #2f5b46;
    --xq-wood-rgb: 47, 91, 70;
    --xq-cream: #fff2f7;
    --xq-cream-rgb: 255, 242, 247;
    --xq-paper: #fde4e4;
    --xq-paper-rgb: 253, 228, 228;
    --xq-ink: #173527;
    --xq-ink-rgb: 23, 53, 39;
    --xq-bg-color: #1b3a2a;
    --xq-bg-color-rgb: 27, 58, 42;
    --xq-rim: #ffb3cf;
    --xq-rim-rgb: 255, 179, 207;
    --xq-rim-aura: #ff7eab;
    --xq-rim-aura-rgb: 255, 126, 171;
    --xq-metal: #e996b9;
    --xq-metal-rgb: 233, 150, 185;
    --xq-crimson: #7c1242;
    --xq-crimson-rgb: 124, 18, 66;
    --xq-board-shell: #12261c;
    --xq-notation-bg: linear-gradient(145deg, #2f5b46, #1f4535 50%, #173527);
    --xq-notation-ink: #fde4e4;
    --xq-notation-shadow: 0 1px 1px rgba(5, 20, 12, 0.7);

    /* --- body background pattern (SVG, base64; colours baked per board) --- */
    --xq-body-pattern: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNTAgNTApIHNjYWxlKDEuMTUpIj48ZyBmaWxsPSIjZmZiM2NmIiBmaWxsLW9wYWNpdHk9IjAuMTQiPjxlbGxpcHNlIGN4PSIwIiBjeT0iLTgiIHJ4PSI0LjYiIHJ5PSI4IiB0cmFuc2Zvcm09InJvdGF0ZSgwKSIvPjxlbGxpcHNlIGN4PSIwIiBjeT0iLTgiIHJ4PSI0LjYiIHJ5PSI4IiB0cmFuc2Zvcm09InJvdGF0ZSg3MikiLz48ZWxsaXBzZSBjeD0iMCIgY3k9Ii04IiByeD0iNC42IiByeT0iOCIgdHJhbnNmb3JtPSJyb3RhdGUoMTQ0KSIvPjxlbGxpcHNlIGN4PSIwIiBjeT0iLTgiIHJ4PSI0LjYiIHJ5PSI4IiB0cmFuc2Zvcm09InJvdGF0ZSgyMTYpIi8+PGVsbGlwc2UgY3g9IjAiIGN5PSItOCIgcng9IjQuNiIgcnk9IjgiIHRyYW5zZm9ybT0icm90YXRlKDI4OCkiLz48L2c+PGNpcmNsZSByPSIzIiBmaWxsPSIjZmZlMjdhIiBmaWxsLW9wYWNpdHk9IjAuMzUiLz48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAwKSBzY2FsZSgwLjg1KSI+PGcgZmlsbD0iI2ZmYjNjZiIgZmlsbC1vcGFjaXR5PSIwLjExIj48ZWxsaXBzZSBjeD0iMCIgY3k9Ii04IiByeD0iNC42IiByeT0iOCIgdHJhbnNmb3JtPSJyb3RhdGUoMCkiLz48ZWxsaXBzZSBjeD0iMCIgY3k9Ii04IiByeD0iNC42IiByeT0iOCIgdHJhbnNmb3JtPSJyb3RhdGUoNzIpIi8+PGVsbGlwc2UgY3g9IjAiIGN5PSItOCIgcng9IjQuNiIgcnk9IjgiIHRyYW5zZm9ybT0icm90YXRlKDE0NCkiLz48ZWxsaXBzZSBjeD0iMCIgY3k9Ii04IiByeD0iNC42IiByeT0iOCIgdHJhbnNmb3JtPSJyb3RhdGUoMjE2KSIvPjxlbGxpcHNlIGN4PSIwIiBjeT0iLTgiIHJ4PSI0LjYiIHJ5PSI4IiB0cmFuc2Zvcm09InJvdGF0ZSgyODgpIi8+PC9nPjxjaXJjbGUgcj0iMyIgZmlsbD0iI2ZmZTI3YSIgZmlsbC1vcGFjaXR5PSIwLjM1Ii8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwMCAwKSBzY2FsZSgwLjg1KSI+PGcgZmlsbD0iI2ZmYjNjZiIgZmlsbC1vcGFjaXR5PSIwLjExIj48ZWxsaXBzZSBjeD0iMCIgY3k9Ii04IiByeD0iNC42IiByeT0iOCIgdHJhbnNmb3JtPSJyb3RhdGUoMCkiLz48ZWxsaXBzZSBjeD0iMCIgY3k9Ii04IiByeD0iNC42IiByeT0iOCIgdHJhbnNmb3JtPSJyb3RhdGUoNzIpIi8+PGVsbGlwc2UgY3g9IjAiIGN5PSItOCIgcng9IjQuNiIgcnk9IjgiIHRyYW5zZm9ybT0icm90YXRlKDE0NCkiLz48ZWxsaXBzZSBjeD0iMCIgY3k9Ii04IiByeD0iNC42IiByeT0iOCIgdHJhbnNmb3JtPSJyb3RhdGUoMjE2KSIvPjxlbGxpcHNlIGN4PSIwIiBjeT0iLTgiIHJ4PSI0LjYiIHJ5PSI4IiB0cmFuc2Zvcm09InJvdGF0ZSgyODgpIi8+PC9nPjxjaXJjbGUgcj0iMyIgZmlsbD0iI2ZmZTI3YSIgZmlsbC1vcGFjaXR5PSIwLjM1Ii8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgMTAwKSBzY2FsZSgwLjg1KSI+PGcgZmlsbD0iI2ZmYjNjZiIgZmlsbC1vcGFjaXR5PSIwLjExIj48ZWxsaXBzZSBjeD0iMCIgY3k9Ii04IiByeD0iNC42IiByeT0iOCIgdHJhbnNmb3JtPSJyb3RhdGUoMCkiLz48ZWxsaXBzZSBjeD0iMCIgY3k9Ii04IiByeD0iNC42IiByeT0iOCIgdHJhbnNmb3JtPSJyb3RhdGUoNzIpIi8+PGVsbGlwc2UgY3g9IjAiIGN5PSItOCIgcng9IjQuNiIgcnk9IjgiIHRyYW5zZm9ybT0icm90YXRlKDE0NCkiLz48ZWxsaXBzZSBjeD0iMCIgY3k9Ii04IiByeD0iNC42IiByeT0iOCIgdHJhbnNmb3JtPSJyb3RhdGUoMjE2KSIvPjxlbGxpcHNlIGN4PSIwIiBjeT0iLTgiIHJ4PSI0LjYiIHJ5PSI4IiB0cmFuc2Zvcm09InJvdGF0ZSgyODgpIi8+PC9nPjxjaXJjbGUgcj0iMyIgZmlsbD0iI2ZmZTI3YSIgZmlsbC1vcGFjaXR5PSIwLjM1Ii8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwMCAxMDApIHNjYWxlKDAuODUpIj48ZyBmaWxsPSIjZmZiM2NmIiBmaWxsLW9wYWNpdHk9IjAuMTEiPjxlbGxpcHNlIGN4PSIwIiBjeT0iLTgiIHJ4PSI0LjYiIHJ5PSI4IiB0cmFuc2Zvcm09InJvdGF0ZSgwKSIvPjxlbGxpcHNlIGN4PSIwIiBjeT0iLTgiIHJ4PSI0LjYiIHJ5PSI4IiB0cmFuc2Zvcm09InJvdGF0ZSg3MikiLz48ZWxsaXBzZSBjeD0iMCIgY3k9Ii04IiByeD0iNC42IiByeT0iOCIgdHJhbnNmb3JtPSJyb3RhdGUoMTQ0KSIvPjxlbGxpcHNlIGN4PSIwIiBjeT0iLTgiIHJ4PSI0LjYiIHJ5PSI4IiB0cmFuc2Zvcm09InJvdGF0ZSgyMTYpIi8+PGVsbGlwc2UgY3g9IjAiIGN5PSItOCIgcng9IjQuNiIgcnk9IjgiIHRyYW5zZm9ybT0icm90YXRlKDI4OCkiLz48L2c+PGNpcmNsZSByPSIzIiBmaWxsPSIjZmZlMjdhIiBmaWxsLW9wYWNpdHk9IjAuMzUiLz48L2c+PGcgZmlsbD0iIzVhYWE4MiIgZmlsbC1vcGFjaXR5PSIuMTIiPjxlbGxpcHNlIGN4PSIyNSIgY3k9IjcyIiByeD0iNiIgcnk9IjIuNCIgdHJhbnNmb3JtPSJyb3RhdGUoLTM1IDI1IDcyKSIvPjxlbGxpcHNlIGN4PSI3NiIgY3k9IjI2IiByeD0iNiIgcnk9IjIuNCIgdHJhbnNmb3JtPSJyb3RhdGUoMzAgNzYgMjYpIi8+PC9nPjwvc3ZnPg==");
    --xq-body-pattern-size: 100px 100px;

    /* --- hover / selection / hint-arrow effects --- */
    --xq-fx-hi: #fff2f7;
    --xq-fx-main: #ff7eab;
    --xq-fx-deep: #8d1c4e;
    --xq-fx-glow-rgb: 255, 92, 150;
    --xq-fx-capture-rgb: 214, 18, 98;
    --xq-arrow-red-1: #ffe3ee;
    --xq-arrow-red-2: #ff82ae;
    --xq-arrow-red-3: #d62d6c;
    --xq-arrow-red-edge: #7c1242;
    --xq-arrow-black-1: #dce7ff;
    --xq-arrow-black-2: #6f8fe0;
    --xq-arrow-black-3: #26408f;
    --xq-arrow-black-edge: #ffffff;
    --xq-fx-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='41' fill='%236d1840' opacity='.2'/%3E%3Cg transform='rotate(0 50 50)'%3E%3Cpath d='M50 50 C30 40 28 14 43 12 L50 19 L57 12 C72 14 70 40 50 50Z' fill='%23e9558a' stroke='%23fff' stroke-width='4' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(72 50 50)'%3E%3Cpath d='M50 50 C30 40 28 14 43 12 L50 19 L57 12 C72 14 70 40 50 50Z' fill='%23e9558a' stroke='%23fff' stroke-width='4' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(144 50 50)'%3E%3Cpath d='M50 50 C30 40 28 14 43 12 L50 19 L57 12 C72 14 70 40 50 50Z' fill='%23e9558a' stroke='%23fff' stroke-width='4' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(216 50 50)'%3E%3Cpath d='M50 50 C30 40 28 14 43 12 L50 19 L57 12 C72 14 70 40 50 50Z' fill='%23e9558a' stroke='%23fff' stroke-width='4' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(288 50 50)'%3E%3Cpath d='M50 50 C30 40 28 14 43 12 L50 19 L57 12 C72 14 70 40 50 50Z' fill='%23e9558a' stroke='%23fff' stroke-width='4' stroke-linejoin='round'/%3E%3C/g%3E%3Ccircle cx='50' cy='50' r='11' fill='%23ffe27a' stroke='%23a82a5c' stroke-width='3'/%3E%3C/svg%3E");
    --xq-fx-aura: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='44' fill='none' stroke='%23b52f66' stroke-width='2.4' stroke-dasharray='1 6' stroke-linecap='round'/%3E%3Cg transform='rotate(0 50 50)'%3E%3Cpath d='M50 13 C41 9 41 -1 50 1 C59 -1 59 9 50 13Z' fill='%23ff9fc0' stroke='%239c1f55' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(45 50 50)'%3E%3Cpath d='M50 13 C41 9 41 -1 50 1 C59 -1 59 9 50 13Z' fill='%23ff9fc0' stroke='%239c1f55' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(90 50 50)'%3E%3Cpath d='M50 13 C41 9 41 -1 50 1 C59 -1 59 9 50 13Z' fill='%23ff9fc0' stroke='%239c1f55' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(135 50 50)'%3E%3Cpath d='M50 13 C41 9 41 -1 50 1 C59 -1 59 9 50 13Z' fill='%23ff9fc0' stroke='%239c1f55' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(180 50 50)'%3E%3Cpath d='M50 13 C41 9 41 -1 50 1 C59 -1 59 9 50 13Z' fill='%23ff9fc0' stroke='%239c1f55' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(225 50 50)'%3E%3Cpath d='M50 13 C41 9 41 -1 50 1 C59 -1 59 9 50 13Z' fill='%23ff9fc0' stroke='%239c1f55' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(270 50 50)'%3E%3Cpath d='M50 13 C41 9 41 -1 50 1 C59 -1 59 9 50 13Z' fill='%23ff9fc0' stroke='%239c1f55' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(315 50 50)'%3E%3Cpath d='M50 13 C41 9 41 -1 50 1 C59 -1 59 9 50 13Z' fill='%23ff9fc0' stroke='%239c1f55' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(22.5 50 50)'%3E%3Cpath d='M50 13 C41 9 41 -1 50 1 C59 -1 59 9 50 13Z' fill='%23fff' stroke='%23c9487b' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(67.5 50 50)'%3E%3Cpath d='M50 13 C41 9 41 -1 50 1 C59 -1 59 9 50 13Z' fill='%23fff' stroke='%23c9487b' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(112.5 50 50)'%3E%3Cpath d='M50 13 C41 9 41 -1 50 1 C59 -1 59 9 50 13Z' fill='%23fff' stroke='%23c9487b' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(157.5 50 50)'%3E%3Cpath d='M50 13 C41 9 41 -1 50 1 C59 -1 59 9 50 13Z' fill='%23fff' stroke='%23c9487b' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(202.5 50 50)'%3E%3Cpath d='M50 13 C41 9 41 -1 50 1 C59 -1 59 9 50 13Z' fill='%23fff' stroke='%23c9487b' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(247.5 50 50)'%3E%3Cpath d='M50 13 C41 9 41 -1 50 1 C59 -1 59 9 50 13Z' fill='%23fff' stroke='%23c9487b' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(292.5 50 50)'%3E%3Cpath d='M50 13 C41 9 41 -1 50 1 C59 -1 59 9 50 13Z' fill='%23fff' stroke='%23c9487b' stroke-width='1.6'/%3E%3C/g%3E%3Cg transform='rotate(337.5 50 50)'%3E%3Cpath d='M50 13 C41 9 41 -1 50 1 C59 -1 59 9 50 13Z' fill='%23fff' stroke='%23c9487b' stroke-width='1.6'/%3E%3C/g%3E%3C/svg%3E");
    --xq-fx-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='43' fill='none' stroke='%23fff' stroke-width='9' stroke-linecap='round' stroke-dasharray='32.42 21.61' transform='rotate(20 50 50)'/%3E%3Ccircle cx='50' cy='50' r='43' fill='none' stroke='%23c4155a' stroke-width='5.5' stroke-linecap='round' stroke-dasharray='32.42 21.61' transform='rotate(20 50 50)'/%3E%3Cg transform='rotate(0 50 50)'%3E%3Cpath d='M50 20 C40 14 39 1 46 2 L50 6 L54 2 C61 1 60 14 50 20Z' fill='%23ff4f8b' stroke='%236d0f38' stroke-width='2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(72 50 50)'%3E%3Cpath d='M50 20 C40 14 39 1 46 2 L50 6 L54 2 C61 1 60 14 50 20Z' fill='%23ff4f8b' stroke='%236d0f38' stroke-width='2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(144 50 50)'%3E%3Cpath d='M50 20 C40 14 39 1 46 2 L50 6 L54 2 C61 1 60 14 50 20Z' fill='%23ff4f8b' stroke='%236d0f38' stroke-width='2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(216 50 50)'%3E%3Cpath d='M50 20 C40 14 39 1 46 2 L50 6 L54 2 C61 1 60 14 50 20Z' fill='%23ff4f8b' stroke='%236d0f38' stroke-width='2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(288 50 50)'%3E%3Cpath d='M50 20 C40 14 39 1 46 2 L50 6 L54 2 C61 1 60 14 50 20Z' fill='%23ff4f8b' stroke='%236d0f38' stroke-width='2' stroke-linejoin='round'/%3E%3C/g%3E%3C/svg%3E");
}

html[data-board-theme="banco-gold"] {
    /* --- page palette --- */
    --xq-accent: #ffd75e;
    --xq-accent-rgb: 255, 215, 94;
    --xq-accent-hi: #ffe79a;
    --xq-accent-hi-rgb: 255, 231, 154;
    --xq-accent-lo: #e0a82a;
    --xq-accent-lo-rgb: 224, 168, 42;
    --xq-glow: #ffc850;
    --xq-glow-rgb: 255, 200, 80;
    --xq-glow-a: #ffc850;
    --xq-glow-a-rgb: 255, 200, 80;
    --xq-ember: #ff6a4d;
    --xq-ember-rgb: 255, 106, 77;
    --xq-highlight: #fff3c4;
    --xq-highlight-rgb: 255, 243, 196;
    --xq-sheen: #fff0be;
    --xq-sheen-rgb: 255, 240, 190;
    --xq-primary: #b3122a;
    --xq-primary-rgb: 179, 18, 42;
    --xq-primary-mid: #c3122a;
    --xq-primary-mid-rgb: 195, 18, 42;
    --xq-primary-dark: #d3122b;
    --xq-primary-dark-rgb: 211, 18, 43;
    --xq-primary-light: #ff4a55;
    --xq-primary-light-rgb: 255, 74, 85;
    --xq-surface: #1e160a;
    --xq-surface-rgb: 30, 22, 10;
    --xq-surface-hi: #2e220e;
    --xq-surface-hi-rgb: 46, 34, 14;
    --xq-surface-lo: #181107;
    --xq-surface-lo-rgb: 24, 17, 7;
    --xq-surface-deep: #120d05;
    --xq-surface-deep-rgb: 18, 13, 5;
    --xq-shadow: #0a0602;
    --xq-shadow-rgb: 10, 6, 2;
    --xq-shadow-deep: #060301;
    --xq-shadow-deep-rgb: 6, 3, 1;
    --xq-wood: #5a3d0d;
    --xq-wood-rgb: 90, 61, 13;
    --xq-cream: #fff6dc;
    --xq-cream-rgb: 255, 246, 220;
    --xq-paper: #f3e2ae;
    --xq-paper-rgb: 243, 226, 174;
    --xq-ink: #2b1d05;
    --xq-ink-rgb: 43, 29, 5;
    --xq-bg-color: #231808;
    --xq-bg-color-rgb: 35, 24, 8;
    --xq-rim: #ffd700;
    --xq-rim-rgb: 255, 215, 0;
    --xq-rim-aura: #ffaa00;
    --xq-rim-aura-rgb: 255, 170, 0;
    --xq-metal: #e0a82a;
    --xq-metal-rgb: 224, 168, 42;
    --xq-crimson: #8a0016;
    --xq-crimson-rgb: 138, 0, 22;
    --xq-board-shell: #1c1407;
    --xq-notation-bg: linear-gradient(
        145deg,
        #6b4a12,
        #7d5a18 40%,
        #3d2907 70%,
        #5a3d0d
    );
    --xq-notation-ink: #fff0b4;
    --xq-notation-shadow: 0 1px 1px rgba(30, 18, 0, 0.8);

    /* --- body background pattern (SVG, base64; colours baked per board) --- */
    --xq-body-pattern: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2NCIgaGVpZ2h0PSI2NCIgdmlld0JveD0iMCAwIDY0IDY0Ij48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzMiAzMikiPjxjaXJjbGUgcj0iMTEiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZDc1ZSIgc3Ryb2tlLW9wYWNpdHk9Ii4xNiIgc3Ryb2tlLXdpZHRoPSIxLjIiLz48cmVjdCB4PSItMy41IiB5PSItMy41IiB3aWR0aD0iNyIgaGVpZ2h0PSI3IiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmQ3NWUiIHN0cm9rZS1vcGFjaXR5PSIuMiIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgMCkiPjxjaXJjbGUgcj0iMTEiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZDc1ZSIgc3Ryb2tlLW9wYWNpdHk9Ii4xNiIgc3Ryb2tlLXdpZHRoPSIxLjIiLz48cmVjdCB4PSItMy41IiB5PSItMy41IiB3aWR0aD0iNyIgaGVpZ2h0PSI3IiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmQ3NWUiIHN0cm9rZS1vcGFjaXR5PSIuMiIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDY0IDApIj48Y2lyY2xlIHI9IjExIiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmQ3NWUiIHN0cm9rZS1vcGFjaXR5PSIuMTYiIHN0cm9rZS13aWR0aD0iMS4yIi8+PHJlY3QgeD0iLTMuNSIgeT0iLTMuNSIgd2lkdGg9IjciIGhlaWdodD0iNyIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZkNzVlIiBzdHJva2Utb3BhY2l0eT0iLjIiIHN0cm9rZS13aWR0aD0iMSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDY0KSI+PGNpcmNsZSByPSIxMSIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZkNzVlIiBzdHJva2Utb3BhY2l0eT0iLjE2IiBzdHJva2Utd2lkdGg9IjEuMiIvPjxyZWN0IHg9Ii0zLjUiIHk9Ii0zLjUiIHdpZHRoPSI3IiBoZWlnaHQ9IjciIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZDc1ZSIgc3Ryb2tlLW9wYWNpdHk9Ii4yIiBzdHJva2Utd2lkdGg9IjEiLz48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNjQgNjQpIj48Y2lyY2xlIHI9IjExIiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmQ3NWUiIHN0cm9rZS1vcGFjaXR5PSIuMTYiIHN0cm9rZS13aWR0aD0iMS4yIi8+PHJlY3QgeD0iLTMuNSIgeT0iLTMuNSIgd2lkdGg9IjciIGhlaWdodD0iNyIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZkNzVlIiBzdHJva2Utb3BhY2l0eT0iLjIiIHN0cm9rZS13aWR0aD0iMSIvPjwvZz48cGF0aCBkPSJNMTYgMTZMNDggMTZNMTYgNDhMNDggNDgiIHN0cm9rZT0iI2ZmZDc1ZSIgc3Ryb2tlLW9wYWNpdHk9Ii4wNSIvPjwvc3ZnPg==");
    --xq-body-pattern-size: 64px 64px;

    /* --- hover / selection / hint-arrow effects --- */
    --xq-fx-hi: #fffbe8;
    --xq-fx-main: #e3122f;
    --xq-fx-deep: #4a0610;
    --xq-fx-glow-rgb: 226, 24, 52;
    --xq-fx-capture-rgb: 230, 0, 38;
    --xq-arrow-red-1: #ffb3b3;
    --xq-arrow-red-2: #e3122f;
    --xq-arrow-red-3: #8a0016;
    --xq-arrow-red-edge: #fff0b4;
    --xq-arrow-black-1: #8a8478;
    --xq-arrow-black-2: #35302a;
    --xq-arrow-black-3: #0c0a08;
    --xq-arrow-black-edge: #ffd75e;
    --xq-fx-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3CradialGradient id='g' cx='.35' cy='.3' r='.75'%3E%3Cstop offset='0' stop-color='%23ffd9d9'/%3E%3Cstop offset='0.3' stop-color='%23ff4a55'/%3E%3Cstop offset='0.75' stop-color='%23c20d24'/%3E%3Cstop offset='1' stop-color='%236b0010'/%3E%3C/radialGradient%3E%3Cpath d='M50 6 L94 50 L50 94 L6 50Z' fill='%23fffbe8' stroke='%233a1500' stroke-width='5' stroke-linejoin='round'/%3E%3Cpath d='M50 19 L81 50 L50 81 L19 50Z' fill='url(%23g)'/%3E%3Cpath d='M50 19 L66 50 L50 50 L34 50Z' fill='%23fff' opacity='.35'/%3E%3C/svg%3E");
    --xq-fx-aura: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='42' fill='none' stroke='%234a0610' stroke-width='5.5'/%3E%3Ccircle cx='50' cy='50' r='42' fill='none' stroke='%23fffbe8' stroke-width='2.4'/%3E%3Cg transform='rotate(0 50 50)'%3E%3Cpath d='M50 0 L54 9 L50 13 L46 9Z' fill='%23d3122b' stroke='%23fffbe8' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(30 50 50)'%3E%3Cpath d='M50 0 L54 9 L50 13 L46 9Z' fill='%23d3122b' stroke='%23fffbe8' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(60 50 50)'%3E%3Cpath d='M50 0 L54 9 L50 13 L46 9Z' fill='%23d3122b' stroke='%23fffbe8' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(90 50 50)'%3E%3Cpath d='M50 0 L54 9 L50 13 L46 9Z' fill='%23d3122b' stroke='%23fffbe8' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(120 50 50)'%3E%3Cpath d='M50 0 L54 9 L50 13 L46 9Z' fill='%23d3122b' stroke='%23fffbe8' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(150 50 50)'%3E%3Cpath d='M50 0 L54 9 L50 13 L46 9Z' fill='%23d3122b' stroke='%23fffbe8' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(180 50 50)'%3E%3Cpath d='M50 0 L54 9 L50 13 L46 9Z' fill='%23d3122b' stroke='%23fffbe8' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(210 50 50)'%3E%3Cpath d='M50 0 L54 9 L50 13 L46 9Z' fill='%23d3122b' stroke='%23fffbe8' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(240 50 50)'%3E%3Cpath d='M50 0 L54 9 L50 13 L46 9Z' fill='%23d3122b' stroke='%23fffbe8' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(270 50 50)'%3E%3Cpath d='M50 0 L54 9 L50 13 L46 9Z' fill='%23d3122b' stroke='%23fffbe8' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(300 50 50)'%3E%3Cpath d='M50 0 L54 9 L50 13 L46 9Z' fill='%23d3122b' stroke='%23fffbe8' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(330 50 50)'%3E%3Cpath d='M50 0 L54 9 L50 13 L46 9Z' fill='%23d3122b' stroke='%23fffbe8' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(15 50 50)'%3E%3Cpath d='M50 2.5 V8' stroke='%235a0814' stroke-width='2.2' stroke-linecap='round'/%3E%3C/g%3E%3Cg transform='rotate(45 50 50)'%3E%3Cpath d='M50 2.5 V8' stroke='%235a0814' stroke-width='2.2' stroke-linecap='round'/%3E%3C/g%3E%3Cg transform='rotate(75 50 50)'%3E%3Cpath d='M50 2.5 V8' stroke='%235a0814' stroke-width='2.2' stroke-linecap='round'/%3E%3C/g%3E%3Cg transform='rotate(105 50 50)'%3E%3Cpath d='M50 2.5 V8' stroke='%235a0814' stroke-width='2.2' stroke-linecap='round'/%3E%3C/g%3E%3Cg transform='rotate(135 50 50)'%3E%3Cpath d='M50 2.5 V8' stroke='%235a0814' stroke-width='2.2' stroke-linecap='round'/%3E%3C/g%3E%3Cg transform='rotate(165 50 50)'%3E%3Cpath d='M50 2.5 V8' stroke='%235a0814' stroke-width='2.2' stroke-linecap='round'/%3E%3C/g%3E%3Cg transform='rotate(195 50 50)'%3E%3Cpath d='M50 2.5 V8' stroke='%235a0814' stroke-width='2.2' stroke-linecap='round'/%3E%3C/g%3E%3Cg transform='rotate(225 50 50)'%3E%3Cpath d='M50 2.5 V8' stroke='%235a0814' stroke-width='2.2' stroke-linecap='round'/%3E%3C/g%3E%3Cg transform='rotate(255 50 50)'%3E%3Cpath d='M50 2.5 V8' stroke='%235a0814' stroke-width='2.2' stroke-linecap='round'/%3E%3C/g%3E%3Cg transform='rotate(285 50 50)'%3E%3Cpath d='M50 2.5 V8' stroke='%235a0814' stroke-width='2.2' stroke-linecap='round'/%3E%3C/g%3E%3Cg transform='rotate(315 50 50)'%3E%3Cpath d='M50 2.5 V8' stroke='%235a0814' stroke-width='2.2' stroke-linecap='round'/%3E%3C/g%3E%3Cg transform='rotate(345 50 50)'%3E%3Cpath d='M50 2.5 V8' stroke='%235a0814' stroke-width='2.2' stroke-linecap='round'/%3E%3C/g%3E%3C/svg%3E");
    --xq-fx-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='42' fill='none' stroke='%232b0005' stroke-width='9' stroke-linecap='round' stroke-dasharray='23.09 9.90' transform='rotate(0 50 50)'/%3E%3Ccircle cx='50' cy='50' r='42' fill='none' stroke='%23e3122f' stroke-width='5.5' stroke-linecap='round' stroke-dasharray='23.09 9.90' transform='rotate(0 50 50)'/%3E%3Cg transform='rotate(22.5 50 50)'%3E%3Cpath d='M50 15 L44 6 L50 0 L56 6Z' fill='%23fffbe8' stroke='%237a0012' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(67.5 50 50)'%3E%3Cpath d='M50 15 L44 6 L50 0 L56 6Z' fill='%23fffbe8' stroke='%237a0012' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(112.5 50 50)'%3E%3Cpath d='M50 15 L44 6 L50 0 L56 6Z' fill='%23fffbe8' stroke='%237a0012' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(157.5 50 50)'%3E%3Cpath d='M50 15 L44 6 L50 0 L56 6Z' fill='%23fffbe8' stroke='%237a0012' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(202.5 50 50)'%3E%3Cpath d='M50 15 L44 6 L50 0 L56 6Z' fill='%23fffbe8' stroke='%237a0012' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(247.5 50 50)'%3E%3Cpath d='M50 15 L44 6 L50 0 L56 6Z' fill='%23fffbe8' stroke='%237a0012' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(292.5 50 50)'%3E%3Cpath d='M50 15 L44 6 L50 0 L56 6Z' fill='%23fffbe8' stroke='%237a0012' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(337.5 50 50)'%3E%3Cpath d='M50 15 L44 6 L50 0 L56 6Z' fill='%23fffbe8' stroke='%237a0012' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/g%3E%3C/svg%3E");
}

html[data-board-theme="banco-wood"] {
    /* --- page palette --- */
    --xq-accent: #e9c58b;
    --xq-accent-rgb: 233, 197, 139;
    --xq-accent-hi: #f6dfb4;
    --xq-accent-hi-rgb: 246, 223, 180;
    --xq-accent-lo: #c99a4e;
    --xq-accent-lo-rgb: 201, 154, 78;
    --xq-glow: #f0be6e;
    --xq-glow-rgb: 240, 190, 110;
    --xq-glow-a: #e9aa5a;
    --xq-glow-a-rgb: 233, 170, 90;
    --xq-ember: #e08a4a;
    --xq-ember-rgb: 224, 138, 74;
    --xq-highlight: #fbefd3;
    --xq-highlight-rgb: 251, 239, 211;
    --xq-sheen: #f6e6c8;
    --xq-sheen-rgb: 246, 230, 200;
    --xq-primary: #1b6f51;
    --xq-primary-rgb: 27, 111, 81;
    --xq-primary-mid: #1f7a5a;
    --xq-primary-mid-rgb: 31, 122, 90;
    --xq-primary-dark: #207d5f;
    --xq-primary-dark-rgb: 32, 125, 95;
    --xq-primary-light: #4cc79a;
    --xq-primary-light-rgb: 76, 199, 154;
    --xq-surface: #28190f;
    --xq-surface-rgb: 40, 25, 15;
    --xq-surface-hi: #3a2516;
    --xq-surface-hi-rgb: 58, 37, 22;
    --xq-surface-lo: #20130b;
    --xq-surface-lo-rgb: 32, 19, 11;
    --xq-surface-deep: #1a0f08;
    --xq-surface-deep-rgb: 26, 15, 8;
    --xq-shadow: #0e0703;
    --xq-shadow-rgb: 14, 7, 3;
    --xq-shadow-deep: #080402;
    --xq-shadow-deep-rgb: 8, 4, 2;
    --xq-wood: #7a4a26;
    --xq-wood-rgb: 122, 74, 38;
    --xq-cream: #fdf1dc;
    --xq-cream-rgb: 253, 241, 220;
    --xq-paper: #f1dfbc;
    --xq-paper-rgb: 241, 223, 188;
    --xq-ink: #2e1a0e;
    --xq-ink-rgb: 46, 26, 14;
    --xq-bg-color: #2b190d;
    --xq-bg-color-rgb: 43, 25, 13;
    --xq-rim: #e9c58b;
    --xq-rim-rgb: 233, 197, 139;
    --xq-rim-aura: #c99a4e;
    --xq-rim-aura-rgb: 201, 154, 78;
    --xq-metal: #c99a4e;
    --xq-metal-rgb: 201, 154, 78;
    --xq-crimson: #1b6f51;
    --xq-crimson-rgb: 27, 111, 81;
    --xq-board-shell: #24160c;
    --xq-notation-bg: linear-gradient(145deg, #4a2311, #6e3719 50%, #3b1b0c);
    --xq-notation-ink: #f6dfb4;
    --xq-notation-shadow: 0 1px 1px rgba(20, 5, 0, 0.7);

    /* --- body background pattern (SVG, base64; colours baked per board) --- */
    --xq-body-pattern: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNjAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCAxNjAgODAiPjxnIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2U5YzU4YiIgc3Ryb2tlLXdpZHRoPSIxIiBzdHJva2UtbGluZWNhcD0icm91bmQiPjxwYXRoIGQ9Ik0wIDhDNDAgMiA4MCAxNCAxMjAgOFMxNjAgOCAxNjAgOCIgc3Ryb2tlLW9wYWNpdHk9IjAuMSIvPjxwYXRoIGQ9Ik0wIDIyQzQwIDE2IDgwIDI4IDEyMCAyMlMxNjAgMjIgMTYwIDIyIiBzdHJva2Utb3BhY2l0eT0iMC4wNiIvPjxwYXRoIGQ9Ik0wIDM4QzQwIDMyIDgwIDQ0IDEyMCAzOFMxNjAgMzggMTYwIDM4IiBzdHJva2Utb3BhY2l0eT0iMC4xMiIvPjxwYXRoIGQ9Ik0wIDU0QzQwIDQ4IDgwIDYwIDEyMCA1NFMxNjAgNTQgMTYwIDU0IiBzdHJva2Utb3BhY2l0eT0iMC4wNyIvPjxwYXRoIGQ9Ik0wIDY4QzQwIDYyIDgwIDc0IDEyMCA2OFMxNjAgNjggMTYwIDY4IiBzdHJva2Utb3BhY2l0eT0iMC4xIi8+PC9nPjxnIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2U5YzU4YiIgc3Ryb2tlLW9wYWNpdHk9Ii4xMiI+PGVsbGlwc2UgY3g9IjExMiIgY3k9IjQ2IiByeD0iOSIgcnk9IjQiLz48ZWxsaXBzZSBjeD0iMTEyIiBjeT0iNDYiIHJ4PSI1IiByeT0iMiIvPjwvZz48L3N2Zz4=");
    --xq-body-pattern-size: 160px 80px;

    /* --- hover / selection / hint-arrow effects --- */
    --xq-fx-hi: #e8fff3;
    --xq-fx-main: #35c48d;
    --xq-fx-deep: #0a4a35;
    --xq-fx-glow-rgb: 38, 214, 146;
    --xq-fx-capture-rgb: 222, 42, 22;
    --xq-arrow-red-1: #d8ffea;
    --xq-arrow-red-2: #35c48d;
    --xq-arrow-red-3: #0f7552;
    --xq-arrow-red-edge: #052d20;
    --xq-arrow-black-1: #9c8576;
    --xq-arrow-black-2: #4a2c1c;
    --xq-arrow-black-3: #170b05;
    --xq-arrow-black-edge: #f1d29c;
    --xq-fx-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3CradialGradient id='g' cx='.35' cy='.3' r='.75'%3E%3Cstop offset='0' stop-color='%23f0fff6'/%3E%3Cstop offset='0.3' stop-color='%238fe6bd'/%3E%3Cstop offset='0.7' stop-color='%2323a374'/%3E%3Cstop offset='1' stop-color='%230a5a41'/%3E%3C/radialGradient%3E%3Ccircle cx='50' cy='50' r='40' fill='%2308261b' opacity='.5'/%3E%3Ccircle cx='50' cy='50' r='35' fill='%23eafff2'/%3E%3Cpath fill-rule='evenodd' fill='url(%23g)' d='M50 20a30 30 0 1 0 .01 0Z M50 40a10 10 0 1 1 -.01 0Z'/%3E%3Ccircle cx='50' cy='50' r='10' fill='%230b3f2e'/%3E%3C/svg%3E");
    --xq-fx-aura: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='44.5' fill='none' stroke='%2306261b' stroke-width='8' stroke-linecap='round' stroke-dasharray='70.83 22.37' transform='rotate(0 50 50)'/%3E%3Ccircle cx='50' cy='50' r='44.5' fill='none' stroke='%2335c48d' stroke-width='4.6' stroke-linecap='round' stroke-dasharray='70.83 22.37' transform='rotate(0 50 50)'/%3E%3Ccircle cx='50' cy='50' r='44.5' fill='none' stroke='%23e6fff1' stroke-width='1.3' stroke-linecap='round' stroke-dasharray='55.92 37.28' transform='rotate(10 50 50)'/%3E%3Cg transform='rotate(-43 50 50)'%3E%3Cpath d='M50 0 L56 5.5 L50 11 L44 5.5Z' fill='%23e6fff1' stroke='%230a5a41' stroke-width='1.8' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(77 50 50)'%3E%3Cpath d='M50 0 L56 5.5 L50 11 L44 5.5Z' fill='%23e6fff1' stroke='%230a5a41' stroke-width='1.8' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(197 50 50)'%3E%3Cpath d='M50 0 L56 5.5 L50 11 L44 5.5Z' fill='%23e6fff1' stroke='%230a5a41' stroke-width='1.8' stroke-linejoin='round'/%3E%3C/g%3E%3C/svg%3E");
    --xq-fx-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='44' fill='none' stroke='%23fff1dc' stroke-width='9.5' stroke-linecap='round' stroke-dasharray='48.38 20.73' transform='rotate(9 50 50)'/%3E%3Ccircle cx='50' cy='50' r='44' fill='none' stroke='%23c51f12' stroke-width='6' stroke-linecap='round' stroke-dasharray='48.38 20.73' transform='rotate(9 50 50)'/%3E%3Cg transform='rotate(0 50 50)'%3E%3Cpath d='M44 1 H56 V10 L50 17 L44 10Z' fill='%23e0301c' stroke='%23fff1dc' stroke-width='2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(90 50 50)'%3E%3Cpath d='M44 1 H56 V10 L50 17 L44 10Z' fill='%23e0301c' stroke='%23fff1dc' stroke-width='2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(180 50 50)'%3E%3Cpath d='M44 1 H56 V10 L50 17 L44 10Z' fill='%23e0301c' stroke='%23fff1dc' stroke-width='2' stroke-linejoin='round'/%3E%3C/g%3E%3Cg transform='rotate(270 50 50)'%3E%3Cpath d='M44 1 H56 V10 L50 17 L44 10Z' fill='%23e0301c' stroke='%23fff1dc' stroke-width='2' stroke-linejoin='round'/%3E%3C/g%3E%3C/svg%3E");
}

/* ==========================================================================
   3. THEME SELECTOR — panel tokens (all derived from the board palette)
   ========================================================================== */
.theme-selector-wrapper {
    --ts-panel-bg: rgba(var(--xq-surface-deep-rgb), 0.9);
    --ts-panel-border: 1px solid rgba(var(--xq-accent-rgb), 0.3);
    --ts-panel-shadow:
        0 20px 50px rgba(var(--xq-shadow-deep-rgb), 0.9),
        0 0 30px rgba(var(--xq-accent-rgb), 0.08);
    --ts-title: var(--xq-highlight);
    --ts-title-shadow: 0 0 10px rgba(var(--xq-accent-rgb), 0.3);

    --ts-btn-bg: linear-gradient(
        145deg,
        rgb(var(--xq-surface-hi-rgb)),
        rgb(var(--xq-surface-deep-rgb))
    );
    --ts-btn-bg-hover: linear-gradient(
        145deg,
        rgb(var(--xq-wood-rgb)),
        rgb(var(--xq-surface-rgb))
    );
    --ts-btn-text: var(--xq-highlight);
    --ts-btn-text-hover: #fff;
    --ts-btn-border: rgba(var(--xq-accent-rgb), 0.45);
    --ts-btn-border-hover: rgba(var(--xq-accent-rgb), 0.9);
    --ts-btn-shadow:
        0 8px 20px rgba(var(--xq-shadow-deep-rgb), 0.6),
        0 0 15px rgba(var(--xq-accent-rgb), 0.15);
    --ts-btn-shadow-hover:
        0 12px 25px rgba(var(--xq-shadow-deep-rgb), 0.8),
        0 0 25px rgba(var(--xq-accent-rgb), 0.4);

    --ts-opt-bg: rgba(255, 255, 255, 0.04);
    --ts-opt-border: rgba(255, 255, 255, 0.12);
    --ts-opt-hover-bg: rgba(var(--xq-accent-rgb), 0.07);
    --ts-opt-hover-border: rgba(var(--xq-accent-rgb), 0.55);
    --ts-opt-hover-shadow: 0 10px 20px rgba(var(--xq-shadow-deep-rgb), 0.6);
    --ts-opt-active-bg: rgba(var(--xq-accent-rgb), 0.16);
    --ts-opt-active-border: var(--xq-accent);
    --ts-opt-active-shadow:
        inset 0 0 15px rgba(var(--xq-accent-rgb), 0.4),
        0 0 20px rgba(var(--xq-accent-rgb), 0.5);
    --ts-check-bg: var(--xq-accent);
    --ts-check-tick: var(--xq-ink);
    --ts-img-shadow: var(--xq-tb-piece-shadow);
    --ts-focus: var(--xq-accent);

    --ts-apply-bg: linear-gradient(
        to right,
        var(--xq-primary),
        var(--xq-primary-dark)
    );
    --ts-apply-bg-hover: linear-gradient(
        to right,
        var(--xq-primary-dark),
        var(--xq-primary-light)
    );
    --ts-apply-border: var(--xq-primary-light);
    --ts-apply-shadow: 0 4px 15px rgba(var(--xq-primary-rgb), 0.5);
    --ts-apply-shadow-hover:
        0 6px 20px rgba(var(--xq-primary-rgb), 0.65),
        0 0 15px rgba(255, 255, 255, 0.2);
    --ts-apply-shadow-active: 0 2px 5px rgba(var(--xq-primary-rgb), 0.5);
}

/* ==========================================================================
   THEME SELECTOR WRAPPER & PANEL
   ========================================================================== */
.theme-selector-wrapper {
    position: relative;
    display: block;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    text-align: center;
    z-index: 50;
    pointer-events: none;
}

.theme-selector-panel {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);

    /* Glassmorphism panel: tinted by the active board theme */
    background: var(--ts-panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: var(--ts-panel-border);
    border-radius: 6px;
    padding: 20px;
    display: none;
    min-width: 340px;
    max-width: 420px;
    max-height: min(75vh, 620px);
    overflow-y: auto;

    box-shadow: var(--ts-panel-shadow);
    z-index: 1000;
    pointer-events: all;
}

.theme-selector-panel.show {
    display: block;
    animation: floatUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.theme-selector-panel .theme-section + .theme-section {
    margin-top: 16px;
}

@keyframes floatUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

/* Titles */
.theme-title {
    color: var(--ts-title);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: var(--ts-title-shadow);
}

.theme-bundle:focus-visible,
.theme-toggle-btn:focus-visible,
#apply-theme-btn:focus-visible {
    outline: 2px solid var(--ts-focus);
    outline-offset: 2px;
}

/* ==========================================================================
   THE THEME TOGGLE BUTTON (.theme-toggle-btn)
   ========================================================================== */
.theme-toggle-btn {
    background: var(--ts-btn-bg);
    color: var(--ts-btn-text);
    border: 1px solid var(--ts-btn-border);
    border-radius: 6px;
    padding: 10px 24px;
    font-size: 15px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    pointer-events: all;

    box-shadow: var(--ts-btn-shadow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.theme-toggle-btn:hover,
.theme-toggle-btn:focus-visible {
    background: var(--ts-btn-bg-hover);
    border-color: var(--ts-btn-border-hover);
    color: var(--ts-btn-text-hover);
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--ts-btn-shadow-hover);
}

/* ==========================================================================
   THEME BUNDLES (.theme-bundle)
   A theme = board + pieces, previewed together. The board image is passed in
   from the Blade view as --tb-board (single source: config/xq_themes.php);
   the per-theme tokens below only add the accent and a no-image fallback.
   ========================================================================== */
.theme-bundles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.theme-bundle {
    --tb-accent: var(--ts-opt-active-border);
    --tb-fallback: var(--xq-wood);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 6px;
    background: var(--ts-opt-bg);
    border: 2px solid var(--ts-opt-border);
    border-radius: 8px;
    color: var(--ts-title);
    cursor: pointer;
    position: relative;
    text-align: center;
    transition:
        transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        border-color 0.3s ease,
        background 0.3s ease,
        box-shadow 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

/* Per-theme tokens (accent ring + fallback colour while/if the board SVG is missing) */
.theme-bundle[data-bundle="default"] {
    --tb-accent: #e63946;
    --tb-fallback: #5a1d12;
}
.theme-bundle[data-bundle="floral"] {
    --tb-accent: #e07a9b;
    --tb-fallback: #f3d9c4;
}
.theme-bundle[data-bundle="golden"] {
    --tb-accent: #ffd700;
    --tb-fallback: #e8c66a;
}
.theme-bundle[data-bundle="wooden"] {
    --tb-accent: #b9783a;
    --tb-fallback: #b98a58;
}

.theme-bundle:hover {
    border-color: var(--tb-accent);
    background: var(--ts-opt-hover-bg);
    transform: translateY(-3px);
    box-shadow: var(--ts-opt-hover-shadow);
}

.theme-bundle.active {
    border-color: var(--tb-accent);
    background: var(--ts-opt-active-bg);
    box-shadow: var(--ts-opt-active-shadow);
}

.theme-bundle-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 84px;
    border-radius: 6px;
    overflow: hidden;
    background-color: var(--tb-fallback);
    background-image: var(--tb-board, none);
    background-size: cover;
    background-position: center;
}

.tb-piece {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: drop-shadow(0 2px 3px var(--ts-img-shadow));
}

.theme-bundle-name {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.2;
    padding-bottom: 2px;
}

/* Selected badge: a CSS-drawn tick, so the state never relies on colour alone. */
.theme-bundle.active::after {
    content: "";
    position: absolute;
    top: -7px;
    right: -7px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--ts-check-bg);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.theme-bundle.active::before {
    content: "";
    position: absolute;
    top: -2px;
    right: 0;
    width: 4px;
    height: 9px;
    border: solid var(--ts-check-tick);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

/* ==========================================================================
   THE APPLY BUTTON (#apply-theme-btn)
   ========================================================================== */
#apply-theme-btn {
    background: var(--ts-apply-bg);
    color: #fff;
    border: 1px solid var(--ts-apply-border);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 6px;
    padding: 10px 30px;
    box-shadow: var(--ts-apply-shadow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#apply-theme-btn:hover {
    background: var(--ts-apply-bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--ts-apply-shadow-hover);
}

#apply-theme-btn:active {
    transform: translateY(1px);
    box-shadow: var(--ts-apply-shadow-active);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .theme-selector-panel {
        min-width: 300px;
        padding: 15px;
        bottom: 55px;
    }
    .theme-bundle-preview {
        height: 72px;
    }
    .tb-piece {
        width: 30px;
        height: 30px;
    }
    .theme-toggle-btn {
        padding: 8px 18px;
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .theme-selector-panel.show {
        animation: none;
    }
    .theme-bundle,
    .theme-toggle-btn,
    #apply-theme-btn {
        transition: none;
    }
}
