:root {
    --home-bg: #070c16;
    --home-panel: #0d1627;
    --home-panel-soft: #111d31;
    --home-line: rgba(255, 201, 82, .16);
    --home-gold: #ffc94f;
    --home-gold-2: #f09a28;
    --home-text: #f7f8fb;
    --home-muted: #8390a5;
}

body {
    background: var(--home-bg) !important;
    padding-bottom: 0;
}
body.home-ad-open { overflow: hidden; }

body::before {
    background: radial-gradient(circle at 50% -10%, rgba(255, 185, 54, .09), transparent 34%),
                linear-gradient(180deg, #09101d 0, var(--home-bg) 42%) !important;
}

body::after { display: none; }

.top-nav {
    position: sticky;
    top: 0;
    z-index: 200;
    margin: 0;
    padding: 10px 20px;
    border: 0;
    border-bottom: 1px solid rgba(255,255,255,.055);
    border-radius: 0;
    background: rgba(7, 12, 22, .86);
    box-shadow: 0 8px 30px rgba(0,0,0,.2);
}

.nav-container { max-width: 1280px; min-height: 54px; gap: 10px 18px; flex-wrap: wrap; }
.brand-logo-img { width: 48px; height: 48px; border: 1px solid rgba(255,201,79,.55); border-radius: 14px; animation: none; }
.quick-actions {
    order: 4;
    flex: 0 0 100%;
    width: 100%;
    margin: 0;
    gap: 8px;
    justify-content: flex-end;
}
.action-btn { padding: 9px 17px; border-radius: 10px; background: #111c2d; }
.action-btn.primary { background: linear-gradient(135deg, var(--home-gold), var(--home-gold-2)); }
.site-address { order: 2; align-items: flex-start; margin-right: auto; }
.main-addr {
    font-size: 15px;
    color: var(--home-gold);
    -webkit-text-fill-color: var(--home-gold);
    text-shadow: 0 0 10px rgba(255, 201, 79, .24);
    white-space: nowrap;
}
.sub-addr { color: var(--home-muted); font-size: 12px; }

.featured-section,
.category-nav,
.games-section { max-width: 1280px; }

.featured-section { padding: 28px 20px 18px; }
.section-header { margin-bottom: 13px; }
.section-title { color: var(--home-text); -webkit-text-fill-color: var(--home-text) !important; font-size: 17px; letter-spacing: .02em; }
.section-title::before { width: 3px; height: 17px; background: var(--home-gold); box-shadow: none; }

.featured-section .announcement-bar {
    min-height: 38px;
    margin-bottom: 16px;
    padding-left: 104px;
    border-color: rgba(212, 175, 55, .35);
    border-radius: 50px;
    background: linear-gradient(135deg, rgba(8, 10, 18, .98), rgba(18, 14, 7, .96) 55%, rgba(7, 10, 18, .98));
    box-shadow: 0 4px 24px rgba(0, 0, 0, .35), inset 0 0 18px rgba(212, 175, 55, .12), 0 0 18px rgba(212, 175, 55, .12);
}
.announcement-icon { left: -6px; top: 42%; width: 112px; height: 76px; }
.marquee-content { height: 38px; }
.marquee-text { color: var(--home-gold); font-size: 15px; text-shadow: 0 0 10px rgba(212, 175, 55, .55), 0 1px 2px rgba(0, 0, 0, .85); }

.featured-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    overflow: visible;
    padding: 2px;
}
.featured-card {
    min-width: 0;
    padding: 13px 10px 12px;
    border-color: var(--home-line);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255,201,79,.075), rgba(17,29,49,.9));
    box-shadow: 0 10px 26px rgba(0,0,0,.16);
}
.featured-card:first-child { border-color: rgba(255,201,79,.55); }
.featured-card:not(:first-child) { border-color: rgba(255,255,255,.07); }
.featured-card,
.featured-img { transition: none; }
.featured-card:hover { transform: none; background: #142139; box-shadow: 0 10px 28px rgba(0,0,0,.28); }
.featured-card:active { transform: none; }
.featured-card:hover .featured-img { transform: none; }
.featured-img { width: 56px; height: 56px; margin-bottom: 9px; border-radius: 15px; }
.featured-name { font-size: 12px; }

.home-ad-modal {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(2, 5, 11, .78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity .18s ease;
}
.home-ad-modal[hidden] { display: none; }
.home-ad-modal.is-visible { opacity: 1; }
.home-ad-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(88vw, 380px);
    max-height: calc(100dvh - 44px);
    padding: 6px;
    border: 1px solid rgba(255, 201, 79, .7);
    border-radius: 20px;
    background: linear-gradient(145deg, #17130b, #090e18);
    box-shadow: 0 24px 70px rgba(0,0,0,.62), 0 0 28px rgba(255,201,79,.16);
    transform: translateY(12px) scale(.97);
    transition: transform .2s ease;
}
.home-ad-modal.is-visible .home-ad-dialog { transform: translateY(0) scale(1); }
.home-ad-image-link {
    display: block;
    flex: 0 1 auto;
    overflow: hidden;
    border-radius: 14px 14px 9px 9px;
}
.home-ad-image {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 13;
    max-height: 45vh;
    object-fit: cover;
    background: #0d1627;
    transition: filter .18s ease;
}
.home-ad-image-link:hover .home-ad-image { filter: brightness(1.08); }
.home-ad-content {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    min-height: 0;
    padding: 18px 17px 16px;
    text-align: center;
}
.home-ad-title {
    margin: 0 0 8px;
    color: var(--home-gold);
    font-size: 21px;
    line-height: 1.3;
    letter-spacing: .02em;
}
.home-ad-description {
    margin: 0;
    max-height: 8.5em;
    padding-right: 5px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 201, 79, .45) transparent;
    color: #c3cad5;
    font-size: 14px;
    line-height: 1.7;
}
.home-ad-description::-webkit-scrollbar { width: 4px; }
.home-ad-description::-webkit-scrollbar-track { background: transparent; }
.home-ad-description::-webkit-scrollbar-thumb { background: rgba(255, 201, 79, .45); border-radius: 4px; }
.home-ad-dismiss-today {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 12px;
    color: #9ca8ba;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}
.home-ad-dismiss-today input { width: 16px; height: 16px; accent-color: var(--home-gold); }
.home-ad-action {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-top: 16px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--home-gold), var(--home-gold-2));
    color: #17100a;
    font-size: 15px;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(240, 154, 40, .22);
}
.home-ad-action:hover { filter: brightness(1.06); }
.home-ad-action:active { transform: scale(.98); }
.home-ad-close {
    position: absolute;
    top: -14px;
    right: -14px;
    z-index: 2;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(255, 201, 79, .65);
    border-radius: 50%;
    background: #111a29;
    color: #fff;
    font: 400 25px/32px Arial, sans-serif;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,.45);
}
.home-ad-close:hover { color: var(--home-gold); background: #18243a; }
.home-ad-close:active { transform: scale(.94); }

.category-nav {
    margin: 0 auto 18px;
    padding: 0 20px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.category-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.category-pill { min-width: 76px; padding: 9px 15px; border: 1px solid rgba(255,255,255,.06); border-radius: 9px; background: #0e192a; }
.category-pill:hover { transform: none; }
.category-pill.active { color: #17100a; border-color: transparent; background: linear-gradient(135deg, var(--home-gold), var(--home-gold-2)); box-shadow: 0 5px 16px rgba(240,154,40,.18); }
.category-search-row { order: -1; flex: 1 0 100%; margin: 0 0 8px; }
.search-wrapper-row { padding: 0; border-color: rgba(255,255,255,.07); border-radius: 11px; background: #0c1626; }
.search-box-full { padding: 12px 16px 12px 43px; background: transparent; }
.search-icon-row { color: #707f95; }

.games-section { padding: 0 20px 42px; }
.games-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.game-card { border-color: rgba(255,255,255,.065); border-radius: 12px; background: var(--home-panel); box-shadow: 0 8px 22px rgba(0,0,0,.16); }
.game-card:hover { transform: translateY(-3px); border-color: rgba(255,201,79,.44); box-shadow: 0 12px 28px rgba(0,0,0,.32); }
.game-thumbnail { background: var(--home-panel-soft); }
.game-info { padding: 9px 8px; border-top-color: rgba(255,255,255,.05); background: #0d1727; }
.game-title { font-size: 12px; font-weight: 600; }
.game-card.ad-game { border-width: 1px; border-color: rgba(255,201,79,.35); background: rgba(255,201,79,.04); }
.game-card.ad-game::before { display: none; }

.bottom-pager { padding: 26px 0 2px; gap: 10px; }
.pager-btn { min-width: 78px; padding: 9px 15px; border-radius: 9px; background: #101c2f; }
.page-indicator { min-width: 70px; color: #a5afbf; }
.app-footer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 190;
    max-width: none;
    margin: 0;
    padding: 10px 20px;
    border: 0;
    border-top: 1px solid rgba(255, 201, 79, .14);
    border-radius: 0;
    background: rgba(7, 12, 22, .92);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, .28);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}
.stat-badge { background: #152238; color: var(--home-gold); box-shadow: none; }

@media (min-width: 1400px) {
    .games-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .featured-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
    .top-nav { padding: 8px 12px; }
    .nav-container { min-height: 45px; flex-wrap: wrap; gap: 7px 9px; }
    .brand-logo-img { width: 40px; height: 40px; order: 1; }
    .site-address { order: 2; margin: 0 auto 0 0; min-width: 0; }
    .main-addr, .sub-addr {
        max-width: none;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: anywhere;
        text-align: left;
    }
    .main-addr { white-space: nowrap; overflow-wrap: normal; }
    .sub-addr { white-space: normal; }
    .site-address { max-width: calc(100vw - 76px); }
    .main-addr { font-size: 13px; }
    .sub-addr { font-size: 10px; }
    .quick-actions { order: 4; flex: 0 0 100%; width: 100%; margin: 0; gap: 6px; justify-content: stretch; }
    .quick-actions .action-btn { flex: 1; width: auto; padding: 7px 9px; font-size: 10px; border-radius: 8px; }
    .featured-section { padding: 20px 12px 13px; }
    .section-title { font-size: 15px; }
    .featured-section .announcement-bar { padding-left: 88px; min-height: 34px; margin-bottom: 12px; border-radius: 30px; }
    .announcement-icon { left: -5px; top: 40%; width: 96px; height: 64px; }
    .marquee-content { height: 34px; }
    .marquee-text { font-size: 12px; }
    .featured-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-right: 0; padding-right: 2px; }
    .featured-card { padding: 10px 5px; }
    .featured-img { width: 46px; height: 46px; border-radius: 13px; }
    .featured-name { font-size: 11px; }
    .home-ad-modal { padding: 18px; }
    .home-ad-dialog { width: min(86vw, 340px); border-radius: 17px; }
    .home-ad-image-link { border-radius: 12px 12px 8px 8px; }
    .home-ad-image { max-height: 40vh; }
    .home-ad-content { padding: 15px 14px 14px; }
    .home-ad-title { font-size: 19px; }
    .home-ad-description { font-size: 13px; line-height: 1.6; }
    .home-ad-dismiss-today { margin-top: 10px; font-size: 12px; }
    .home-ad-action { min-height: 42px; margin-top: 12px; font-size: 14px; }
    .home-ad-close { top: -12px; right: -10px; width: 34px; height: 34px; font-size: 23px; line-height: 30px; }
    .category-nav { padding: 0 12px; margin-bottom: 13px; }
    .category-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
    .category-search-row { grid-column: 1 / -1; }
    .category-pill { min-width: 0; padding: 8px 3px; font-size: 11px; }
    .search-box-full { padding-top: 10px; padding-bottom: 10px; font-size: 13px; }
    .games-section { padding: 0 10px 86px; }
    .games-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .game-card { border-radius: 9px; }
    .game-info { padding: 7px 4px; }
    .game-title { font-size: 10px; }
    .play-overlay { display: none; }
    .bottom-pager { padding-top: 20px; }
    .app-footer { padding: 9px 12px calc(9px + env(safe-area-inset-bottom)); border-radius: 0; }
    .copyright { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
}

@media (min-width: 768px) {
    .games-section { padding-bottom: 92px; }
    .main-addr { white-space: nowrap; }
    .sub-addr { white-space: normal; overflow-wrap: anywhere; }
}
