/*
 * Granny: horror tone, "old house at midnight".
 * Dark, cold, brass candlelight. No blood red, no violent imagery.
 * Loaded AFTER every other theme stylesheet (layout/header.php). Changes colours, heading font and wallpaper;
 * layout is untouched. Remove the <link ... horror.css> line (and the font preload) in header.php to revert.
 * Performance: background is an inline SVG (no request), heading font is a 26 KB self-hosted woff2, effects use
 * opacity/filter only, no JS.
 */

:root {
    /* Base palette */
    --hz-ground: #0e1211;      /* page ground: mossy black */
    --hz-surface: #151a19;     /* header, sidebar, content boxes */
    --hz-raised: #1d2321;      /* buttons, inputs, tag pills */
    --hz-raised-2: #262d2a;    /* hover */
    --hz-line: #29322e;        /* the layout's existing borders */
    --hz-ink: #e6e1d3;         /* main text: bone / old paper */
    --hz-ink-2: #b4b6aa;       /* secondary text */
    --hz-ink-3: #878c83;       /* muted text, icons */
    --hz-accent: #d9a24a;      /* candlelight */
    --hz-accent-hi: #ebbd6c;   /* candlelight on hover */
    --hz-on-accent: #17130b;   /* text on candlelight */
    --hz-moss: #8fae84;        /* success / like state */

    color-scheme: dark;

    /* style.min.css variables */
    --bg-header: var(--hz-surface);
    --bg-body: var(--hz-ground);
    --bg-input: var(--hz-raised);
    --bg-component: var(--hz-surface);
    --sidebar-bg: var(--hz-surface);
    --border-color: var(--hz-line);
    --border-active: var(--hz-accent);
    --text-body: var(--hz-ink);
    --title-color: var(--hz-accent);
    --highlight-color: var(--hz-accent);
    --icon-color: var(--hz-ink-3);
    --icon-bg: var(--hz-raised);
    --color-gray: var(--hz-ink-2);
    --light-gray: var(--hz-raised);
    --light-gray-brand-10: var(--hz-raised-2);
    --text-white: var(--hz-on-accent);
    --link-color: var(--hz-accent-hi);
    --link-color-hover: var(--hz-accent);

    /* index_chunk_2 variables (old purple scale -> candlelight, navy scale -> dark moss) */
    --brand-0: #fff8ec;
    --brand-20: #f6e3bd;
    --brand-30: #f1d6a1;
    --brand-40: #ecc985;
    --brand-50: #e6bc6e;
    --brand-60: #ebbd6c;
    --brand-70: #e2ae58;
    --brand-80: #ebbd6c;
    --brand-100: #d9a24a;
    --brand-120: #b5843a;
    --brand-130: #9c712f;
    --brand-140: #7f5c27;
    --brand-150: #64481f;
    --brand-160: #4a3517;
    --brand-180: #2a1f0e;
    --brand-200: #120d06;
    --black-10: #3a4440;
    --black-20: #343d39;
    --black-40: #2d3532;
    --black-50: #262d2a;
    --black-60: #1f2523;
    --black-70: #1a1f1d;
    --black-80: #151a19;
    --black-90: #111514;
    --black-100: #0e1211;
    --white-10: #6c7169;
    --white-20: #787d75;
    --white-30: #868b82;
    --white-40: #959990;
    --white-50: #a5a89d;
    --white-60: #b4b6aa;
    --white-70: #c5c5b8;
    --white-80: #d6d3c5;
    --white-90: #e0dccd;
    --white-100: #e6e1d3;
    --success-100: #8fae84;
    --alert-40: #d9b7a3;
    --alert-60: #c99a80;
    --alert-100: #b8826a;
    --warning-100: #d9a24a;
    --warning-200: #2a1f0e;
}

/* The 404 page sets red in its own <style>: use candlelight instead. */
html:root {
    --primary-color-page: var(--hz-accent);
    --secondary-color-page: var(--hz-ink);
}

/* Variables of the game player bar / contact popup */
.blur_dialog,
.contact-popup,
.player-footer {
    --shadow-2: none;
    --box-bg-color: var(--hz-surface);
    --btn-control: var(--hz-raised);
    --btn-control-hover: var(--hz-raised-2);
    --color-primary: var(--hz-ink);
    --btn-text-extent: var(--hz-ground);
    --text-btn-control: var(--hz-ink);
    --text-btn-control-hover: var(--hz-accent);
    --border-btn: var(--hz-line);
    --color-content-popup: var(--hz-ink);
    --color-heading-popup: var(--hz-ink);
}

/* ---------- Atmosphere: heading font, old wallpaper, dark corners ---------- */

/* Headings: Cinzel, carved inscriptional capitals like an old gravestone, readable in all caps.
   Cinzel (Natanael Gama, SIL Open Font License 1.1), self-hosted, no Google Fonts request. */
@font-face {
    font-family: 'Cinzel';
    src: url('../fonts/cinzel-latin.woff2') format('woff2');
    font-weight: 600 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Cinzel';
    src: url('../fonts/cinzel-latin-ext.woff2') format('woff2');
    font-weight: 600 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

h1, h1 strong, h2, h2 strong, h3, h3 strong, h4, h4 strong, h5, h5 strong, h6, h6 strong,
.titleContainer__title,
.player-footer__left h1,
.home-faq summary,
html .error-code,
html .error-title {
    font-family: 'Cinzel', Torus, Georgia, serif;
    font-weight: 700;
    letter-spacing: .02em;
}

/* The walls: damask wallpaper drawn as an inline SVG right here (1.4 KB, no extra request) + corners fading to dark.
   This layer is fixed BEHIND the content (z-index -1) and never covers the game or the ads. */
html {
    background: var(--hz-ground);
}

body,
#__next {
    background: transparent !important;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 120% 95% at 50% 30%, rgba(3, 5, 4, 0) 45%, rgba(3, 5, 4, .7) 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='240' viewBox='0 0 160 240'%3E%3Cdefs%3E%3Cg id='h' fill='%23141917' stroke='%23141917' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0-92C7-84 9-75 0-64Z'/%3E%3Cpath stroke='none' d='M0-64C8-68 17-66 22-59C15-58 7-58 0-55Z'/%3E%3Cpath stroke='none' fill-rule='evenodd' d='M0-54C17-52 30-39 30-20C30-3 17 10 0 21ZM0-41C10-39 19-30 19-19C19-7 11 1 0 9Z'/%3E%3Cpath stroke='none' d='M0-30C5-24 6-15 0-6Z'/%3E%3Cpath fill='none' stroke-width='2.6' d='M25-37C37-50 54-44 52-31C50-21 40-21 40-28C40-33 45-34 47-31'/%3E%3Cpath stroke='none' d='M4 19C21 21 36 34 38 53C27 47 15 38 4 28Z'/%3E%3Cpath fill='none' stroke-width='2.2' d='M33 47C45 53 49 68 39 74C33 77 29 71 33 67'/%3E%3Cpath stroke='none' d='M0 21C3 42 3 63 0 86Z'/%3E%3Cpath stroke='none' d='M0 86C7 90 9 97 0 104Z'/%3E%3Ccircle stroke='none' cx='50' cy='6' r='2.6'/%3E%3Ccircle stroke='none' cx='58' cy='-8' r='1.7'/%3E%3C/g%3E%3Cg id='m'%3E%3Cuse href='%23h'/%3E%3Cuse href='%23h' transform='scale(-1 1)'/%3E%3C/g%3E%3C/defs%3E%3Cuse href='%23m' transform='translate(80 120) scale(.82)'/%3E%3Cuse href='%23m' transform='translate(0 0) scale(.82)'/%3E%3Cuse href='%23m' transform='translate(160 0) scale(.82)'/%3E%3Cuse href='%23m' transform='translate(0 240) scale(.82)'/%3E%3Cuse href='%23m' transform='translate(160 240) scale(.82)'/%3E%3C/svg%3E") 0 0 / 160px 240px repeat,
        var(--hz-ground);
}

/* Game thumbnails sit in a dark room: dimmed, lit up on hover (pointer devices only). */
@media (hover: hover) {
    .GameThumb_gameThumbImage__FSasr {
        filter: brightness(.8) saturate(.78);
        transition: filter .35s ease;
    }

    a:hover .GameThumb_gameThumbImage__FSasr,
    a:focus-visible .GameThumb_gameThumbImage__FSasr {
        filter: none;
    }
}

/* ---------- Ground, text, selection, focus ---------- */

::selection {
    background: var(--hz-accent);
    color: var(--hz-on-accent);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--hz-accent);
    outline-offset: 2px;
}

html::-webkit-scrollbar-thumb,
.css-17c412x::-webkit-scrollbar-thumb {
    background: #2e3734;
}

html {
    scrollbar-color: #2e3734 var(--hz-ground);
}

/* ---------- Light colours hard-coded in style.min.css ---------- */
.MuiButtonBase-root.active,
.css-1bnqyvi:hover,
.css-1g0vwi8:hover,
.css-qeuppi:hover {
    background: var(--hz-raised-2);
}

.css-1g0vwi8,
.css-qeuppi {
    background: var(--hz-raised);
    color: var(--hz-ink);
}

.css-1bnqyvi {
    color: var(--hz-ink-3);
}

.css-1ha0f91 {
    border-color: var(--hz-line);
    color: var(--hz-ink);
}

.css-1osun8m {
    background: var(--hz-accent);
    color: var(--hz-on-accent);
}

.css-1osun8m:hover {
    background: var(--hz-accent-hi);
}

.css-17c412x a,
.popup-link-share--copy {
    color: var(--hz-accent-hi);
}

.css-15ngedg {
    color: var(--hz-ink);
    box-shadow: none;
}

.css-1j62gbe {
    background-color: var(--hz-surface);
    color: var(--hz-ink);
    box-shadow: none;
}

.css-medxsc .MuiDrawer-paper,
.css-1307bo8,
.css-pdh0ev,
.css-1maq35i,
.css-nb4mi8,
.css-inysc7 {
    background: var(--hz-surface);
}

.css-nb4mi8:hover,
.css-inysc7:hover,
.css-jjkk1a,
.css-1xe247z {
    background-color: var(--hz-raised);
}

.css-1ffeks4 {
    background: var(--hz-ground);
}

.css-medxsc hr {
    border-color: var(--hz-line);
}

.MuiButtonBase-root::after {
    background-color: var(--hz-raised-2);
    color: var(--hz-ink);
}

/* "Back to game" / floating buttons */
.css-1ii02y2,
.SuggestionFooter_root__Vt_0G .SuggestionFooter_fluidButton__5aqLC {
    background: var(--hz-accent);
    color: var(--hz-on-accent);
}

.BackToTop_jumpingButton__MI8to {
    box-shadow: none;
}

.css-1ii02y2 svg,
.css-1ii02y2 span {
    color: var(--hz-on-accent);
}

/* Tables, toasts, checkbox */
table,
td,
tr {
    border-color: var(--hz-line);
}

.check_box_contact {
    background-color: var(--hz-raised);
}

.notification-success .toastt {
    background: var(--hz-surface);
    border-left-color: var(--hz-moss);
    box-shadow: none;
}

.notify-toast {
    background: var(--hz-raised-2);
    color: var(--hz-ink);
    box-shadow: none;
}

.contact-form button,
.form_bottom .btn_add_contact {
    background-color: var(--hz-accent);
    color: var(--hz-on-accent);
}

.details span,
.details p {
    color: var(--hz-ink-3);
}

.blur_dialog,
.contact-popup {
    box-shadow: none;
}

/* ---------- Bar under the game frame (like, dislike, favourite...) ---------- */
.g-footer__button {
    color: var(--hz-ink-3);
    box-shadow: none;
}

.g-footer__button:hover,
.g-footer__button.active,
.g-footer__button.voted,
.g-footer__button.active svg,
.g-footer__button.voted svg {
    background: var(--hz-raised-2) !important;
    color: var(--hz-accent) !important;
}

.g-footer__button:hover .g-footer__button-title_last {
    background-color: var(--hz-ground);
    color: var(--hz-ink);
}

#likeGame.active {
    color: var(--hz-accent);
}

#likeGame.active svg,
#addFavoritesGame.active svg {
    fill: var(--hz-accent) !important;
}

#dislikeGame.active svg,
.game_thumb_down .g-footer__button.active svg,
.game_thumb_down .g-footer__button.voted svg {
    fill: var(--hz-ink-2) !important;
    color: var(--hz-ink-2) !important;
}

/* ---------- Thumbnail labels: flat colours instead of red/purple gradients ---------- */
.GameThumbLabel_hot__CWhxn {
    background: var(--hz-accent);
    color: var(--hz-on-accent);
}

.GameThumbLabel_new__8GnG6 {
    background: #44573d;
    color: var(--hz-ink);
}

.GameThumbLabel_topRated__xYfMw {
    background: var(--brand-30);
    color: var(--hz-on-accent);
}

.GameThumbLabel_trending__Z69rK,
.GameThumbLabel_updated__Z69rK {
    background: #3a4a52;
    color: var(--hz-ink);
}

.GameThumb_closeBtnContainer__84qjx,
.GameThumb_closeBtnContainer__84qjx:hover {
    background-color: var(--hz-raised-2);
    color: var(--hz-ink);
}

.GameThumb_gameThumbLinkDesktop__wcir5,
.OriginalsGameThumb_originalsGameLink__XH7NN {
    background-color: var(--hz-raised);
}

.OriginalsGameThumb_originalsGameLink__XH7NN:hover {
    box-shadow: none;
    border-color: var(--hz-accent);
}

.GameCarousel_primeCarouselArrow__Xo4VH,
.GameCarousel_primeCarouselArrow__Xo4VH:hover {
    background-color: rgba(14, 18, 17, .78);
}

/* Green gradient buttons of the base kit -> flat */
.Button_czyButton--contained--green-gradient__yxGqG,
.GameThumb_czyButton--contained--green-gradient___bcC_,
.Pagination_czyButton--contained--green-gradient__53nJa,
.css-jyxwok {
    background: var(--hz-moss);
    color: var(--hz-on-accent);
}

/* ---------- Pagination ---------- */
.Pagination_gamePageLink__Q4NQK.Pagination_current__2Voa_,
.Pagination_gamePageLink__Q4NQK:not(.Pagination_disabled__9RqME):hover {
    color: var(--hz-on-accent);
}

.Pagination_gamePageLink__Q4NQK.Pagination_current__2Voa_ svg,
.Pagination_gamePageLink__Q4NQK:not(.Pagination_disabled__9RqME):hover svg {
    color: var(--hz-on-accent);
}

.Pagination_gamePageLink__Q4NQK.Pagination_disabled__9RqME:not(.Pagination_current__2Voa_) {
    background-color: var(--hz-raised);
}

/* ---------- Search ---------- */
.TopSearch_resultContainer__Ev21P {
    background: var(--hz-surface);
}

.TopSearch_searchInput__Nbapa::placeholder {
    color: var(--hz-ink-3);
}

.TopSearch_resultContainer__Ev21P svg path[fill="#666A7F"] {
    fill: var(--hz-ink-3);
}

/* "Random game" dice button: red body -> candlelight, dark pips */
.random-games linearGradient[id^="paint0"] stop {
    stop-color: var(--hz-accent);
}

.random-games linearGradient:not([id^="paint0"]) stop {
    stop-color: var(--hz-on-accent);
}

/* ---------- Pre-play screen (layout/game_iframe_preroll.php) ---------- */
html .play-btn__ctrl {
    background: var(--hz-accent);
    color: var(--hz-on-accent);
    box-shadow: none;
}

html .play-btn__ctrl:hover {
    background: var(--hz-accent-hi);
    box-shadow: none;
}

html .play-btn__ctrl:before {
    background-color: var(--hz-on-accent);
}

html .game-preview__logo img {
    box-shadow: none;
}

html .close_mobile_box {
    background: var(--hz-surface);
    color: var(--hz-accent);
    border-color: var(--hz-surface);
    box-shadow: none;
}

html .frame_fix_mobile {
    background: var(--hz-ground);
}

@media (prefers-reduced-motion: reduce) {
    html .play-btn__ctrl:hover {
        animation: none;
    }
}

/* ---------- Comments (comment.min.css loads after this file, hence the "html" prefix) ---------- */
html .box-comment {
    --bg-button-cmt: var(--hz-raised-2);
    --bg-button-cancel-cmt: var(--hz-raised);
    --color-button-cancel-cmt: var(--hz-ink-2);
    --text-avatar-cmt: var(--hz-on-accent);
    --shadow-form-cmt: none;
    --border-color-form-cmt: var(--hz-accent);
}

html .box-comment .form-default {
    color: var(--hz-ink);
}

html .box-comment .box-area-input .send-comment .send {
    background: var(--hz-accent);
    color: var(--hz-on-accent);
}

html .box-comment .box-area-input .send-comment .send svg {
    fill: var(--hz-on-accent);
    color: var(--hz-on-accent);
}

html .confir_res .checkmark {
    background: var(--hz-raised-2);
}

html .reply-mention,
html a.link {
    color: var(--hz-accent-hi);
}

html .box-comment .header-comment,
html .box-comment .item-comment,
html .make-comment.has_comments {
    border-color: var(--hz-line);
}

/* ---------- 404 page (its styles come after this file, hence the "html" prefix) ---------- */
html .error-code {
    text-shadow: none;
}

html .btn-home,
html .btn-home:hover {
    color: var(--hz-on-accent);
}

html .btn-home:hover {
    box-shadow: none;
    background: var(--hz-accent-hi);
}

/* The 404 heading flickers like a dying bulb: a few dips every 7 seconds, never a fast strobe. */
@media (prefers-reduced-motion: no-preference) {
    html .error-code {
        animation: hz-flicker 7s linear infinite;
    }
}

@keyframes hz-flicker {
    0%, 61%, 63%, 66%, 88%, 89.5%, 100% { opacity: 1; }
    62% { opacity: .35; }
    64.5% { opacity: .6; }
    65.2% { opacity: .2; }
    88.8% { opacity: .5; }
}

/* Lưới game dưới khung chơi: auto-fill giữ cột trống, collection ít game không bị kéo thành 1 ô to hết chiều ngang */
.GamePageDesktop_underGameContainerGrid__cdhNC .GamePageDesktop_underGameContainerGamesWrapper__Rahgf > div:first-child {
    grid-template-columns: repeat(auto-fill, minmax(147px, 1fr));
}
