/* ===== Global: prevent horizontal overflow ===== */
html,
body {
    overflow-x: hidden !important;
    width: 100% !important;
}

.content-wrapper>div {
    box-sizing: border-box !important;
    max-width: 100% !important;
}

/* ===== Header ===== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: rgba(18, 30, 54, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.site-header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 800;
    color: #ffb01b;
    letter-spacing: 1px;
    flex-shrink: 0;
}

.site-header .logo img {
    width: 28px;
    height: 28px;
}

.site-header .header-slogan {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 2px;
}

.site-header .header-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    border-radius: 20px;
    background: linear-gradient(135deg, #ffb01b, #ff6a00);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.site-header .header-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(255, 176, 27, 0.4);
}

body {
    padding-top: 56px;
}

/* ===== Section Titles ===== */
.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 0 4px;
}

.section-title h2 {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

.section-title .section-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 176, 27, 0.4), transparent);
}

.section-title .section-tag {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ===== Ticker ===== */
.ticker-bar {
    margin: 12px auto 0;
    max-width: 1430px;
    padding: 0 16px;
    box-sizing: border-box;
}

.ticker-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(37, 50, 75, 0.6);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.ticker-icon {
    flex-shrink: 0;
    font-size: 16px;
    position: relative;
    z-index: 2;
    padding-right: 10px;
    margin-right: -10px;
    background: rgba(37, 50, 75, 0.6);
}

.ticker-scroll {
    flex: 1;
    overflow: hidden;
    min-width: 0;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8px, #000 calc(100% - 20px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8px, #000 calc(100% - 20px), transparent);
}

.ticker-track {
    display: flex;
    animation: tickerScroll 30s linear infinite;
    width: max-content;
}

.ticker-text {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.65);
}

@keyframes tickerScroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* ===== Entrance Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

.fade-in-up:nth-child(1) {
    animation-delay: 0.05s;
}

.fade-in-up:nth-child(2) {
    animation-delay: 0.1s;
}

.fade-in-up:nth-child(3) {
    animation-delay: 0.15s;
}

.fade-in-up:nth-child(4) {
    animation-delay: 0.2s;
}

.fade-in-up:nth-child(5) {
    animation-delay: 0.25s;
}

.fade-in-up:nth-child(6) {
    animation-delay: 0.3s;
}

.fade-in-up:nth-child(7) {
    animation-delay: 0.35s;
}

.fade-in-up:nth-child(8) {
    animation-delay: 0.4s;
}

/* ===== Badges ===== */
.card-badge {
    position: absolute;
    top: 10px;
    right: 40px;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    z-index: 2;
    text-transform: uppercase;
}

.card-badge.hot {
    background: linear-gradient(135deg, #ff4444, #ff6b35);
    color: #fff;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.4);
}

.card-badge.new {
    background: linear-gradient(135deg, #00c853, #64dd17);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 200, 83, 0.4);
}

.card-badge.vip {
    background: linear-gradient(135deg, #ffb01b, #ff6a00);
    color: #fff;
    box-shadow: 0 2px 8px rgba(255, 176, 27, 0.4);
}

/* ===== Grid Overrides (all !important to beat external CSS) ===== */
.home-top-entry .game-wrapper {
    margin-top: 20px !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
}

.home-top-entry .game-wrapper .game-wrapper_agbox {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    height: auto !important;
    min-height: 280px;
    position: relative;
}

/* Fix: use relative positioning instead of absolute for featured card */
.home-top-entry .game-wrapper_ag {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    min-height: 250px;
    padding: 28px 32px !important;
    border-radius: 16px !important;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
}

.home-top-entry .game-wrapper_ag-join h3.ag-font {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.4;
}

.home-top-entry .game-wrapper_ag-join p {
    margin-top: 6px;
}

.home-top-entry .game-wrapper_ag .bubbly-button {
    display: inline-block;
    margin-top: 16px;
    border-radius: 10px;
    padding: 0 32px;
    font-size: 15px;
    font-weight: 700;
    line-height: 44px;
    color: #1a1a2e;
    background: linear-gradient(135deg, #fff 0%, #f0e6ff 100%);
    box-shadow: 0 4px 15px rgba(255, 176, 27, 0.3);
    transition: all 0.25s ease;
    cursor: pointer;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.home-top-entry .game-wrapper_ag .bubbly-button:hover {
    background: linear-gradient(135deg, #ffb01b 0%, #ff8c00 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(255, 176, 27, 0.5);
    transform: translateY(-2px);
}

.home-top-entry .game-wrapper_ag .bubbly-button:active {
    transform: scale(0.96);
}

/* ag-card1: keep align-items:stretch so .ag-card-img fills height */
.ag-card1 {
    position: relative;
    border-radius: 12px !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    height: 140px !important;
    border: 1px solid rgba(255, 255, 255, 0.04);
    -webkit-tap-highlight-color: transparent;
}

.ag-card1:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 176, 27, 0.15);
}

/* Touch: press effect instead of float */
@media (hover: none) {
    .ag-card1:active {
        transform: scale(0.98);
        border-color: rgba(255, 176, 27, 0.2);
    }

    .ag-card1:hover {
        transform: none;
        box-shadow: none;
    }

    .home_page .game_item:active {
        transform: scale(0.98);
    }

    .home_page .game_item:hover {
        transform: none;
        box-shadow: none;
    }

    .home_page .game_item_active {
        transform: none !important;
        box-shadow: none !important;
        border: none;
    }
}

.home-top-entry .game-wrapper .ag-card-img {
    width: 120px !important;
    min-width: 120px;
    align-self: stretch;
    border-radius: 12px !important;
    flex-shrink: 0;
    background-size: 85% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

.ag-card-content {
    padding-right: 40px;
    min-width: 0;
}

.ag-card-content h3.ag-font1 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ag-card-content ul {
    margin-bottom: 4px;
}

.ag-card-content ul li {
    font-size: 13px;
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ag-card-content p {
    font-size: 12px;
    color: #abacfd;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ag-card-arrow {
    border-radius: 0 12px 12px 0 !important;
    transition: background-color 0.2s;
}

.ag-card1:hover .ag-card-arrow {
    background-color: #4a2d7a;
}

/* ===== Bottom Game Section ===== */
.home_page .sports-and-lottery .home_sports_game .home_sports_game-content {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
    gap: 12px !important;
}

/* game_item: KEEP original absolute positioning, just fix layout */
.home_page .game_item {
    border-radius: 14px !important;
    height: 180px !important;
    position: relative !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    overflow: hidden;
}

.home_page .game_item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Keep absolute positioning for overlay text */
.home_page .game_item .top_game_tit {
    max-width: 60%;
}

.home_page .game_item .top_game_tit h3 {
    font-size: 18px !important;
    font-weight: 700;
}

.home_page .game_item .top_game_tit p {
    font-size: 13px !important;
    line-height: 1.5;
}

.home_page .game_item .img-right {
    display: block !important;
}

.home_page .game_item:hover .img-right {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

.home_page .game_item_active {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35) !important;
    border: 1px solid rgba(255, 176, 27, 0.2);
}

.home_page .game_item_active .img-right {
    transform: scale(1.08);
}

/* ===== Footer ===== */
.site-footer {
    margin-top: 40px;
    padding: 32px 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.footer-links a {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.45);
    text-decoration: none;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.footer-links a:hover {
    color: #ffb01b;
}

.footer-copy {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.25);
    line-height: 1.8;
}

.footer-copy .highlight {
    color: #ffb01b;
}

/* ===== Back to Top ===== */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(37, 50, 75, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffb01b;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99;
    -webkit-tap-highlight-color: transparent;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #ffb01b;
    color: #121e36;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* --- 1300px: 2-column grid --- */
@media screen and (max-width: 1300px) {
    .home-top-entry .game-wrapper {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .home-top-entry .game-wrapper .game-wrapper_agbox {
        grid-column: 1 / -1 !important;
        min-height: 240px;
    }
}

/* --- 960px: tablet --- */
@media screen and (max-width: 960px) {
    .home-top-entry .game-wrapper {
        margin-top: 14px !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .home-top-entry .game-wrapper .game-wrapper_agbox {
        grid-column: 1 / -1 !important;
        height: auto !important;
        min-height: 220px;
    }

    .home-top-entry .game-wrapper_ag {
        min-height: 200px;
        padding: 22px !important;
    }

    .ag-card1 {
        height: 120px !important;
        padding: 12px 0 12px 12px !important;
    }

    .home-top-entry .game-wrapper .ag-card-img {
        width: 90px !important;
        min-width: 90px !important;
        height: 80px !important;
    }

    .ag-card-content h3.ag-font1 {
        font-size: 16px;
    }

    .home_page .sports-and-lottery .home_sports_game .home_sports_game-content {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    }

    .home_page .game_item {
        height: 160px !important;
    }

    .home_page .game_item .top_game_tit h3 {
        font-size: 16px !important;
    }

    .home_page .game_item .top_game_tit p {
        font-size: 12px !important;
    }

    .section-title h2 {
        font-size: 17px;
    }
}

/* --- 768px: mobile --- */
@media screen and (max-width: 768px) {
    .site-header {
        height: 48px;
        padding: 0 12px;
    }

    .site-header .logo {
        font-size: 16px;
        gap: 8px;
    }

    .site-header .logo img {
        width: 24px;
        height: 24px;
    }

    .site-header .header-slogan {
        display: none;
    }

    .site-header .header-badge {
        padding: 5px 14px;
        font-size: 12px;
    }

    body {
        padding-top: 48px !important;
    }

    .home-top-entry .game-wrapper {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .home-top-entry .game-wrapper .game-wrapper_agbox {
        grid-column: 1 !important;
        min-height: 180px;
        height: auto !important;
    }

    .home-top-entry .game-wrapper_ag {
        min-height: 170px;
        padding: 20px 16px !important;
    }

    .home-top-entry .game-wrapper_ag-join h3.ag-font {
        font-size: 22px;
    }

    .home-top-entry .game-wrapper_ag-join p {
        font-size: 12px;
    }

    .home-top-entry .game-wrapper_ag-list {
        padding-left: 0 !important;
        margin-top: 4px !important;
    }

    .home-top-entry .game-wrapper_ag-list ul {
        grid-template-columns: repeat(3, auto) !important;
        max-width: 100% !important;
    }

    .home-top-entry .game-wrapper_ag-list ul li {
        font-size: 11px;
        line-height: 22px;
        margin-right: 4px !important;
    }

    .home-top-entry .game-wrapper_ag-list ul li i {
        margin: 0 4px !important;
    }

    .home-top-entry .game-wrapper_ag .bubbly-button {
        margin-top: 10px;
        font-size: 13px;
        line-height: 36px;
        padding: 0 20px;
    }

    .ag-card1 {
        height: 110px !important;
        padding: 10px 0 10px 10px !important;
    }

    .home-top-entry .game-wrapper .ag-card-img {
        width: 72px !important;
        min-width: 72px !important;
        height: 64px !important;
        border-radius: 10px !important;
    }

    .ag-card-content {
        padding-right: 30px !important;
        padding-left: 10px !important;
    }

    .ag-card-content h3.ag-font1 {
        font-size: 15px;
    }

    .ag-card-content ul {
        flex-wrap: wrap;
        gap: 0 8px;
    }

    .ag-card-content ul li {
        font-size: 12px;
        line-height: 1.5;
    }

    .ag-card-content p {
        font-size: 11px;
    }

    .ag-card-arrow {
        width: 26px !important;
        border-radius: 0 10px 10px 0 !important;
    }

    .card-badge {
        right: 30px;
        top: 6px;
        font-size: 10px;
        padding: 1px 7px;
    }

    .home_page {
        margin-top: 0 !important;
    }

    .home_page .sports-and-lottery .home_sports_game {
        margin-bottom: 24px !important;
    }

    .home_page .sports-and-lottery .home_sports_game .home_sports_game-content {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .home_page .game_item {
        height: 130px !important;
        margin-bottom: 0 !important;
        border-radius: 12px !important;
    }

    .home_page .game_item .top_game_tit {
        padding: 14px 12px !important;
    }

    .home_page .game_item .top_game_tit h3 {
        font-size: 15px !important;
    }

    .home_page .game_item .top_game_tit p {
        font-size: 11px !important;
        margin-top: 2px !important;
    }

    .home_page .game_item .img-right {
        height: 90% !important;
        opacity: 0.7;
        max-width: 40%;
    }

    .section-title h2 {
        font-size: 16px;
    }

    .section-title .section-tag {
        display: none;
    }

    .footer-links {
        gap: 10px 16px;
    }

    .footer-links a {
        font-size: 12px;
    }

    .site-footer {
        margin-top: 24px;
        padding: 24px 16px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .footer-copy {
        font-size: 11px;
    }

    .back-to-top {
        bottom: calc(16px + env(safe-area-inset-bottom));
        right: 12px;
        width: 36px;
        height: 36px;
        font-size: 15px;
    }

    .ticker-bar {
        padding: 0 12px;
        margin-top: 8px;
    }

    .ticker-inner {
        padding: 6px 10px;
        border-radius: 6px;
    }

    .ticker-text {
        font-size: 12px;
    }
}

/* --- 468px: small phone --- */
@media screen and (max-width: 468px) {
    .home-top-entry .game-wrapper {
        gap: 8px !important;
        margin-top: 6px !important;
    }

    .home-top-entry .game-wrapper .game-wrapper_agbox {
        min-height: 160px;
    }

    .home-top-entry .game-wrapper_ag {
        min-height: 150px;
        padding: 16px 12px !important;
    }

    .home-top-entry .game-wrapper_ag-join h3.ag-font {
        font-size: 18px;
    }

    .home-top-entry .game-wrapper_ag-list ul li {
        font-size: 10px;
        line-height: 20px;
    }

    .ag-card1 {
        height: 95px !important;
        border-radius: 10px !important;
    }

    .home-top-entry .game-wrapper .ag-card-img {
        width: 60px !important;
        min-width: 60px !important;
        height: 52px !important;
        border-radius: 8px !important;
    }

    .ag-card-content h3.ag-font1 {
        font-size: 14px;
    }

    .ag-card-content ul li {
        font-size: 11px;
        line-height: 1.4;
    }

    .ag-card-content p {
        font-size: 10px;
    }

    .ag-card-arrow {
        width: 22px !important;
    }

    .card-badge {
        right: 24px;
        top: 5px;
        font-size: 9px;
        padding: 1px 6px;
    }

    .home_page .game_item {
        height: 110px !important;
        border-radius: 10px !important;
    }

    .home_page .game_item .top_game_tit {
        padding: 12px 10px !important;
    }

    .home_page .game_item .top_game_tit h3 {
        font-size: 14px !important;
    }

    .home_page .game_item .top_game_tit p {
        font-size: 10px !important;
        line-height: 1.4;
    }

    .section-title {
        margin-bottom: 10px;
    }

    .section-title h2 {
        font-size: 15px;
    }
}

/* --- 360px: very small phone (iPhone SE) --- */
@media screen and (max-width: 360px) {
    .site-header .logo {
        font-size: 14px;
        gap: 6px;
    }

    .site-header .logo img {
        width: 20px;
        height: 20px;
    }

    .site-header .header-badge {
        padding: 4px 10px;
        font-size: 11px;
    }

    .home-top-entry .game-wrapper .ag-card-img {
        width: 50px !important;
        min-width: 50px !important;
        height: 44px !important;
    }

    .ag-card-content {
        padding-right: 24px !important;
        padding-left: 8px !important;
    }

    .ag-card-content h3.ag-font1 {
        font-size: 13px;
    }

    .ag-card-content ul li {
        font-size: 10px;
    }

    .ag-card-content p {
        font-size: 9px;
    }

    .ag-card-arrow {
        width: 20px !important;
    }

    .card-badge {
        right: 22px;
        font-size: 8px;
        padding: 1px 5px;
    }

    .home-top-entry .game-wrapper_ag-list ul {
        grid-template-columns: repeat(2, auto) !important;
    }

    .home-top-entry .game-wrapper_ag-join h3.ag-font {
        font-size: 16px;
    }

    .home-top-entry .game-wrapper_ag-join p {
        font-size: 11px;
    }

    .footer-links {
        gap: 8px 12px;
    }
}

.desktop-only {
    display: block;
}

@media screen and (max-width: 768px) {
    .desktop-only {
        display: none;
    }
}
